visual-studio-codeintellisensecode-completionyoucompleteme

VSCode how to automatically insert Intellisense suggestions without having to press Enter?


Default VS Code Intellisense behaviour

What I would like instead


To be clear, I want to replicate the default behaviour of YouCompleteMe:

When you type, a completion menu pops up. If you like the completions, you use the <Tab> key (by default, can be changed to <Enter> or <Down> arrow or whatever) to select a completion string you want. The very act of "tabbing through" the list to select the item you want inserts the candidate string. When you tab to a different candidate, the editor code is replaced with the new candidate. There is no accept key because by the point where you have the candidate you want selected in the menu the candidate has already been inserted in the editor. There is nothing to "accept". You just keep typing, the candidate has already been inserted.


Is such behaviour possible with Visual Studio Code, either by default or through a plugin?


Solution

  • The editor.tabCompletion option is the closest thing currently available:

    By default, tab completion is disabled. Use the editor.tabCompletion setting to enable it. These values exist:

    • off - (default) Tab completion is disabled.
    • on - Tab completion is enabled for all suggestions and repeated invocations insert the next best suggestion.
    • onlySnippets - Tab completion only inserts static snippets which prefix match the current line prefix.

    (Emphasis mine)


    ... except that the first Tab press hides the suggestion window.

    I did some digging about editor.tabCompletion, and I found that closing the suggestion window is part of the tab completion's option original design, and that while other users have asked about an option not to close the suggestion window or specifically YouCompleteMe-style behaviour, that this is currently not supported.