VSCode如何自动插入Intellisense建议而不必按Enter键? [英] VSCode how to automatically insert Intellisense suggestions without having to press Enter?

查看:78
本文介绍了VSCode如何自动插入Intellisense建议而不必按Enter键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • 向用户显示建议菜单
  • 然后,用户必须按箭头键浏览菜单
  • 最后,用户必须通过 Enter 进行确认,以插入建议并关闭对话框.
  • User is presented with a menu of suggestions
  • User then has to press the Up or Down arrow keys to navigate through the menu
  • Finally user has to confirm with Enter to insert the suggestion and close the dialog
  • 不需要按 Enter
  • 通过按/ ,自动插入(并循环浏览)建议
  • 按任何其他键将关闭对话框并继续输入

为清楚起见,我要复制默认YouCompleteMe的行为:

键入时,会弹出一个完成菜单.如果您喜欢补全,请使用< Tab> 键(默认情况下,可以更改为< Enter> < Down> 箭头或其他任意字符)来选择所需的完成字符串.遍历"列表以选择要插入候选字符串的项目.当您跳至其他候选项时,编辑器代码将替换为新的候选项.没有接受键,因为到菜单中要选择的候选对象的位置,候选已经插入编辑器.没有什么可以接受"的.您只需继续输入,候选人已经被插入.

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 Code可能会发生这种情况吗?

推荐答案

editor.tabCompletion 选项是当前可用的最接近的选项:

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

默认情况下,制表符补全是禁用的.使用 editor.tabCompletion 设置将其启用.这些值存在:

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

  • 关闭-(默认)选项卡补全被禁用.
  • on -为所有建议启用制表符完成,并且重复调用将插入下一个最佳建议.
  • onlySnippets -制表符补全仅插入其前缀与当前行前缀匹配的静态片段.
  • 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.

(强调我的)

...,除了第一次按键会隐藏建议窗口.

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

我对 editor.tabCompletion 进行了一些挖掘,发现关闭建议窗口是选项卡补全选项原始设计的一部分,并且在其他用户询问 YouCompleteMe风格的行为,目前尚不支持.

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.

这篇关于VSCode如何自动插入Intellisense建议而不必按Enter键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆