问题
I want to use a 'for' snippet for example. I write for and press tab twice so it autocompletes to the whole for loop and selects the counter so I can change it. I change that and then press tab to go to next variable(the one 'counter < [here]' in the condition statement). Then the problem is i write 'arr' and it autocompletes to something like 'ANGLE_instanced_arrays'. I want to just write 'arr' then press tab to go to next variable in the loop, BUT if I press tab it autocompletes. Any solutions?
回答1:
I created an account specifically to answer this question because it's such an annoying problem :)
Add the following to your keybindings.json
:
{"key": "tab", "command": "-acceptSelectedSuggestion", "when": "editorTextFocus && suggestWidgetVisible"},
{"key": "tab", "command": "acceptSelectedSuggestion", "when": "editorTextFocus && suggestWidgetVisible && !inSnippetMode" },
The first line disables the existing rule, the second line re-enables it unless you're in snippet mode.
回答2:
What you can do is to disable accepting suggestions on tab
and to enable pure tabCompletion
. The respective settings are "editor.acceptSuggestionOnEnter": false
and "editor.tabCompletion": true
. With those settings you can complete snippets, like for
just with tab (no IntelliSense pop up) and when IntelliSense shows suggestions can be accepted with enter
only
回答3:
this is my keybindings.json press tab to go to next variable in the loop ctrl+p go to the previous one
[
{
"key": "tab",
"command": "selectNextSuggestion",
"when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible" },
{
"key": "ctrl+p",
"command": "selectPrevSuggestion",
"when": "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible" },
]
来源:https://stackoverflow.com/questions/41348083/tab-is-conflicting-intellisense-and-snippets-in-vs-code