visual-studio-codevscode-snippets

VS Code tab completion inside snippet prevented by placeholder


I want to achieve the following:

  1. the editor does not select any suggestions (but it shows so I can select with arrow keys), this is achieved by "editor.suggest.selectionMode": "never";
  2. when I type (exact) prefix for snippets I can tab complete it without choose it with arrow keys, this is achieved by "editor.tabCompletion": "onlySnippets";
  3. I want that two behaviors able to nest so I make sure "editor.suggest.snippetsPreventQuickSuggestions": false.

most of the time those works fine but when i tried to tab complete snippets within tab completed snippet, I can't tab complete it unless the placeholder is $0. When I reach a placeholder, whatever I type is highlighted and when I type prefix and tab I go to next placeholder instead of tab complete that.... In this case I need to manually type ESC to escape the highlights..

i want this with placeholder it is highlighted

Any fix to this?


Solution

  • Thanks @rioV8! I have found a workaround to this in case anyone need :) I override the key in the following way

    {
            "key": "tab",
            "command": "insertSnippet",
            "when": "editorTextFocus && hasSnippetCompletions && !editorTabMovesFocus"
    }
    

    i.e., remove !inSnippetMode