'Define when VS Code shows snippets

Is there any setting where I can define when (not) to show suggestions? Currently I am setting up VS Code for writing LaTeX and I am creating a lot of user snippets. But when I create a snippet whichs prefix starts with a non-letter character, the suggestions menu isn't coming up. For example I have the following snippet:

"rightarrow":{
    "prefix": ["->", "rarrow"],
    "body": "\\rightarrow"
},

but the suggestions menu is not showing up when typing "->". I have to press Ctrl+Space manually to bring up the menu or insert the snippet with Ctrl+P>"Insert Snippet", which makes it hard to write fast:

You can see it on this gif: Suggestion menu not showing up despite inserting the prefix

When I type the text, the suggestion menu pops up and I can hit enter to insert the snippet, but when i type "->" there is no menu that comes up, even though I typed the prefix.

I see that it makes sense that per default it is not showing, but is there a way to show suggestions then too? VS Code only shows it when the prefix starts with a letter, which limits me. Thanks for your help!



Solution 1:[1]

Okay, I found this issue which looks to be right on:

Snippet doesn't get triggered for certain tokens:

Ok. Thanks for clarifying. Quick suggestion is working on at the end of "words". What a word is can be re-defined by extensions, e.g latex say => is valid word.

[I tested it in a non-latex file where your snippet works fine without manually bringing up intellisense, that was dumb of me ;>}.]

The problem is the latex language must not use the - > characters as word separators, so when you type those characters vscode has chosen to not pop up suggestions because it thinks you may be within a word and doesn't want to constantly pop up suggestions when it doesn't know you are within a word.

By the way, apparently latex snippets provided by an extension are not treated this same way and the suggestions can pop up automatically.

I don't think there is any work-around except to make your own latex snippet extension and see if it works how you want.

Solution 2:[2]

In case someone else has this problem: Another way of solving this somewhat is to assign the command "insertSnippet" to a custom key binding (I used alt+space). This always inserts the snippet if the entire prefix is typed, even if no suggestion is showing up (also when in snippet mode).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mark
Solution 2 Hebol