visual studio code suggestion escape - visual-studio-code

how do I escape using a suggestion? ex every time I write a test the suggested text is TextDecoderStream and as soon as I invoke test it changes to TextDecoderStream(). It also selects TextDecoderStream when I hit enter and tab.

If you are trying to declare a variable name try to embrace it between brackets e.g. "[text]".
If you're looking for another solution try this: Visual Studio Code: close suggestion box on `esc`?

Related

Visual studio code - create a macro that copies content over files

I'm looking into creating something like a macro for localization of strings. Until now, I have only find that (maybe) a custom Code Action might be what I need.
After I select some code, let's call it selection, I want the to:
Ask me for a name
Write to another file: name = selection
Write in current file: (some_fixed_code)name(some_other_fixed_code)
Is there any way to create that macro, for it lo launch with a left click option or a keyboard shortcut?
Thanks in advance!

Create custom keymap in vscode

I want to create a custom keymapping in vscode that would help me write special text faster when writing in LATEX.
Example of what I mean :
I'm using the \color{choosen_color}{text} command in latex.
I have written "some text" and within that I want to use the above command over the "text" word.
Instead of having to write it manually, I want that if I select "text" and then press Ctrl+Alt+c, vscode automatically writes \color{}{text} and place the cursor between the first brackets.
Any idea how to do it ?
Ok, so thanks to #rioV8 I figured it out.
What I was looking for is the VsCode Keymapping snippets.
More about it here :
https://code.visualstudio.com/updates/v1_9#_insert-snippets
Visual Studio Code snippet as keyboard shortcut key

Not supporting hover variable with hyphen in vscode extension

For debugging Cobol program using vscode extension I have extended debug extension protocol. I have variables with hyphen in my cobol program e.g: emp-salary.
I have set the flag supportsEvaluateForHovers to true.
While debugging I am trying to hover this kind of variable but, value I am getting inside evaluateRequest method is NOT considering this as complete one variable name and just returning hyphen separated part of variable. For example out of emp-salary I do mouse hover over emp it is returning emp only.
My expectation is it shall return emp-salary as it is single variable name.
What exact changes I will need to implement in my code so it will consider hyphen separated variable as one variable?
Try enabling the "Use Managed Compatibility Mode" flag under Debugging. This worked for me today using VS 2019.

How can I make Visual Studio Code suggest tab-completions for any previous line in the file?

I want visual studio code to suggest an autocompletion for an entire line if I start typing the first few characters of any line already in the file, regardless of the content of the existing line. So if this is the content of my file:
this is a line with whitespace
this,is,a,comma,separated,list
And I type this on a new line, I would get a pop-up like any other autocomplete suggestion and I could fill in either of the lines above. How can I do this (and if I can't, is there another editor that has this ability)?
The extension Line Completion does what you want.
You have to configure for which files (language identifiers) it should perform these suggestions. (To prevent to much calculation on large files where you don't use it. See the README page.

How can I set the cursor selection for snippet in vscode?

I work in vscode and I recently got to know about snippets. I use a snippet generator website for doing that. But the problem I am facing is after inserting snippet in the code the cursor actually is set at the last of the snippet. But I want like it should keep the cursor in a certain position or select the variables which should be changed in the snippet. Is it possible? If yes, can I know how to do that?
Add the field $0 in the snippet
"body" : "<p>$0</p>"