VSCode 如何在不按 Enter 的情况下自动插入 Intellisense 建议?
VSCode how to automatically insert Intellisense suggestions without having to press Enter?
默认 VS 代码智能感知行为
- 用户会看到一个建议菜单
- 然后用户必须按 向上 或 向下 箭头键来浏览菜单
- 最后用户必须使用 Enter 确认以插入建议并关闭对话框
我想要什么
- 不需要按回车
- 通过按 Up/Down
自动插入(并循环)建议
- 按任何其他键将关闭对话框并继续输入
要清楚,我想复制 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.
Visual Studio 代码是否可以默认或通过插件实现这种行为?
editor.tabCompletion
option 是目前最接近的:
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.
(强调我的)
... 除了第一个 Tab
按下隐藏建议 window.
我对 editor.tabCompletion
进行了一些挖掘,发现 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 目前不支持此功能。
"editor.acceptSuggestionOnEnter": "off",
禁用输入接受建议。
默认 VS 代码智能感知行为
- 用户会看到一个建议菜单
- 然后用户必须按 向上 或 向下 箭头键来浏览菜单
- 最后用户必须使用 Enter 确认以插入建议并关闭对话框
我想要什么
- 不需要按回车
- 通过按 Up/Down 自动插入(并循环)建议
- 按任何其他键将关闭对话框并继续输入
要清楚,我想复制 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.
Visual Studio 代码是否可以默认或通过插件实现这种行为?
editor.tabCompletion
option 是目前最接近的:
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.
(强调我的)
... 除了第一个 Tab
按下隐藏建议 window.
我对 editor.tabCompletion
进行了一些挖掘,发现 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 目前不支持此功能。
"editor.acceptSuggestionOnEnter": "off",
禁用输入接受建议。