Place plaintext right beside variables (without whitespace) in VS Code User Snippets - vscode-snippets

I would like to create a User Snipper in VS Code that is a combination of variables and plaint text. This can typically be achieved by combining variables and plain text with a whitespace between then. But I would like to ad a variable next to a text without a whitespace.
For Example, I would like to create the current timestamp like this:
2022-02-19T21:02:24-0530
Below is what I tried
$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATET$CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND-0530
Notice the T in between $CURRENT_DATE & $CURRENT_HOUR
OUTPUT:
2022-02-CURRENT_DATET21:06:12-0530

You can add $ symbol before the plain-text you want to add.
In this case, you need at add $T instead of T
$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE$T$CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND-0530
Note that $T will get considered as a placeholder, and it will be the last item selected while tabbing through the inserted snippet.

Related

Is there a way to use the data-splitting function for different types of separators at the same time?

Working with a data sheet with phylogenetic data. Trying to separate information out of it. Problem is it's all in one cell and for me to manually double click, highlight part of the cell I need, copy, double click my spreadsheet, and paste into it would be really painful. Trying to separate to columns so I can just copy/paste from one spreadsheet to another.
So it'll look like this in one cell:
cervical vertebrae, postzygapophysis, contact anteriorly: absent(0); present but looks weird (1)
I want it to look like, in one row:
cervical vertebrae | postzygapophysis | contact anteriorly | absent(0) | present but looks weird(1)
If you look at HELP or the pop-up when you enter the Split function in sheets, you will see that [split_by_each] is an option. When set to TRUE it will split by each character in the delimiter argument.
So, in your case:
=split(A1,",:;",true,true)
What you are looking for in Googlesheet is split:
Basically, for a single separator, you can simply do:
=split(Cell,",")
But for multiple separators like yours, put all the separator together:
=split(Cell,"separators")
For example, say in Cell A1 you put your dirty string there,
cervical vertebrae, postzygapophysis, contact anteriorly: absent(0); present but looks weird (1);
In cell B2, or any other cell, you can type: =split(Cell,",;:")
If you need to trim out white spaces if present, then you can use this instead:
=ArrayFormula(trim(split(A1,",;:")))
for one row (as mentioned):
=SPLIT(A1; ",;:")
for array use:
=ARRAYFORMULA(IFERROR(SPLIT(A1:A; ",;:")))

PhpStorm editing multiple selection

I'm wondering about way to edit multiple selections but with different texts
For example:
arr=['hi','i','am','your','array','can','change','me','quickly','please']
arr=['test1','text','foo','test','fast','yes','test2','test3','text2','text3']
I have array of ten elements and I want to change them all with different texts.
Ordinary way to select one then change it. If you use multiple selections all of them are replaced with the same new text.
The question there: any way to change them faster?
I think there may be a way to change it like Emmet in HTML when you enter Emmet code PhpStorm convert it and take you inside red box in each element to write inside it one by one.
i have found the solution to make it easily to edit the array
just using the find ctrl+f and then use f3 to get next value to edit
in the search we can enter the regular expression that will find any matched values
(?<=')\w+(?=')|(?<=,)\w+(?=,)|(?<=\[)\w+(?=,)|(?<=,)\w+(?=])
(?<=')\w+(?=') : any text inside single quotes symbol ' can be changed double "
(?<=,)\w+(?=,): any word between commas for numbers and variables in the array
(?<=\[)\w+(?=,): the first element of the array if it as number or variable
(?<=,)\w+(?=]) : the last element in the array if it as number or variable
| : or operator

Regular Expression Generation for AngularJS ng-pattern

I'm using a regex to validate a form input. So basically a user can input "SELECT some_name of select_match".
So far I have the regex: \bSELECT\b \bof select_match\b
The last part is the middle part, which I think should be [a-zA-Z] but I'm not sure how to place it in the middle. I've read multiple pages but can't get it to work.
Also preferably I'd like the regex to ignore spaces between "SELECT" and of "select_match". Meaning that SELECT blabla of select_match and SELECT blabla of select_match would both be validated as correct.
Can anyone tell me how to do this? Thank you.
If I understood you correctly, this should work:
/^SELECT\s+(\w+)\s+of select_match$/
Notes:
This allows any number of spaces between "SELECT" and the match_name; and between the match_name and the "of" (but, at least 1. To change to at least 0, change the \s+ to a \s*)
After that, the rest of the string must be exactly like that (same spaces and words exactly).
The match_name will be in match group 1.
If this doesn't work, show a bit of your code (where you use it) and we can try to find the problem.
Note: If you are using it in ng-pattern lose the "/"s (being the pattern: ^SELECT\s+(\w+)\s+of select_match$).
Note2: If you are using it in a string, remember you might need to escape every "\" (making it a "\", and the result: ^SELECT\\s+(\\w+)\\s+of select_match$

Reportbuilder showing the same like WPF

So I'm programming and I want to show my first name and last name but i want my last name on a new line. Of course I use the function \n right after my first name. In WPF it shows it like how it should be shown:
first name
last name
If I now want to show this through a report with SSRS this will not work cause my report will show first name \n last name. Is there anyway that report builder will understand this function and give me the same representation like in WPF?
I don't think it will ever understand "\n". Instead of "\n", use "vbcrlf" - that sticks in a carriage return and drops the text to a new line.
You can just encase the field with your text with the below:
=Replace(Fields!<<fieldname>>.Value, "\n", vbcrlf)
Make sure the text is not set to interpret tags as HTML and you'll be fine.

In there a convenient way to have multiline input in libedit/editline

Using libedit/editline, and trying to figure out a good way to do multiline input/editing. The target is an SQL client, where queries will often span multiple lines and terminate with ;.
I can call el_gets, and process each line of input, stopping when I see the terminating ;. I can even concatenate those and store them as a single entry in el_history - and it will correctly access them when using the arrows to scroll through history.
However, when entering the command and after starting a new line, I can no longer use the arrows to move up and edit the previous line. E.g.:
prompt> SELECT * FROM table
WHERE 🀫
At that point, I'd like to be able to use the up-arrow, to move up and edit the text already entered on the first line. Is this possible? How would one do so? I assume that using el_gets isn't correct in this case, since it would remove the line from the editline buffering, yet I don't see an alternative API that would work.
Thoughts?

Resources