Can't get suggestions in snippets - visual-studio-code

I have customized one snippet:
"Import for eslint": {
"prefix": "import",
"body": [
"import { $2 } from '$1'",
],
"description": "import (eslint)"
}
Though it works well, but I can't get suggestions when you code the file path($1), Like this:
the image No Suggestions
the code has highlight background, and don't have suggestions, How should I do some work to implement the feature like this:
only has cursor

Try changing to
"editor.suggest.snippetsPreventQuickSuggestions": false,
true is the default which may be preventing you from seeing suggestions inside your snippet. You want false.

Related

VS Code Custom Snippets parameters hints

I am creating my own snippets for my script, and would like to make hints in the parameters.
"GDX Round": {
"prefix": "gdxround",
"body".
"GDX.Round(${1:int}, ${2:round_decimal})"
],
"description": "GDX Round"
},
Something like this:

Why is VSCode latex snippet not working (// character)?

I want to have create the following snippets:
"fraction": {
"prefix": ["//"],
"body": [
"\\frac{$1}{$2}",
],
"description": "Fraction"
},
I have many snippets in my latex.json file and all seem to work fine but this one doesn't, any idea why this could be the case?

Disable intellisense for css classnames in .tsx/.ts files

Whenever I enter a . after a object the autocomplete dropdown contains a lot of unnecessary css classnames as options:
Is it possible to ignore css files for ts/tsx intellisense, so i only get relevant options?
VS Code version: 1.37.1
"[typescript]": {
"editor.suggest.showClasses": false
},
"[typescriptreact]": {
"editor.suggest.showClasses": false
}
Basically the same as Mark's answer but it looks like "editor.suggest.filteredTypes" has been deprecated since VSCode >= 1.40 in favor of settings like "editor.suggest.showClasses".
Try something like this in your settings:
"[typescript]": {
"editor.suggest.filteredTypes": {
"class": false,
}
},
"[typescriptreact]": {
"editor.suggest.filteredTypes": {
"class": false,
}
}
[it would be nice if you could combine these but [typescript, typescriptreact] didn't work for me.
From types of completions it looks like it is class that you want to filter out.
And see create language-specific settings to see how to create settings for specific languages.
You will have to reload vscode to see these changes take effect.

In Visual Code (mac) is there a way to start at the second placeholder on a snippet?

I love to use snippets in the form of:
println("MyVariable:" + MyVariable);
So I end up creating snippets like this:
SnippetBody:[ "printlns(\"$1:\" + $1);" ]
The problem is that I want the focus on the second $1 so the intellisense triggers. Since the focus is on the first $1 and it's a string, then there is no intellisense.
Thanks!
If all you want is for autocomplete to work on strings, you can look at the settings and set:
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": true
}
Then you start typing and use CtrlSpace to trigger the list.

Correctly escaping in snippet?

I'm currently facing an issue where my snippet is not correctly rendered when used.
Snippet
"Import": {
"prefix": "import",
"body": ["import ${1: { ${2:module} } } from \"${0:library}\";"],
"description": "Import module (es6)"
},
The problem
This is the first tab, as you can see it does not select the } for some reason. The other tabs are working fine. I've tried a couple of possibilities but they are not resolving the issue.
You need to escape the second '}' with '\'. The following works.
"body": ["import ${1:{ ${2:module} \\}} from \"${0:library}\";"],