There're two built-in commands for showing "inline suggestion":
editor.action.inlineSuggest.showPrevious
editor.action.inlineSuggest.showNext
I've tried both, but nothing happened, in what circumstance could an inline suggestion be triggered?
There're two built-in commands for showing "inline suggestion":
editor.action.inlineSuggest.showPrevious
editor.action.inlineSuggest.showNext
I've tried both, but nothing happened, in what circumstance could an inline suggestion be triggered?
For v1.58+, see Inline Suggestions:
Inline Suggestions
The inline suggestions API allows extensions to provide inline suggestions that are decoupled from the suggestion widget. An inline suggestion is rendered as if it was already accepted, but with a gray color. Users can cycle through suggestions and accept them with the
Tab
key.vscode.languages.registerInlineCompletionItemProvider( { pattern: '**' }, { provideInlineCompletionItems: async (document, position) => { return [{ text: '< 2) {\n\treturn 1;\n\t}' }] }, }, )
Demo:
VS Code now allows you to choose how you'd like to code suggestions to appear.
By default, they appear in a widget, but you can also choose them to appear in-line as you write.
If you want the code suggestions to be shown in-line, then go to Settings by pressing down CTRL + , (comma) and type in quick suggestions.
Edit the item labeled other and select the inline value.
The in-line code suggestion looks like this: