问题描述
我刚开始使用 Visual Studio Code,并且一直是 Atom 的用户.我注意到的一件事,特别是对于 PHP 的自动完成,我必须滚动选项列表才能找到自动填充代码的选项.我想通过点击标签来获得自动完成.
I'm getting started with Visual Studio Code and have been a user of Atom. One thing I've noticed, particularly with autocomplete for PHP, I have to scroll through a list of options in order to find the option to automatically fill in code. I want to get the autocomplete just by hitting tab.
比如说,我想创建一个 if
语句.在 Atom 中,我只需输入if",然后点击 Tab 键,它就会用我需要的所有内容填充代码.在 VS Code 中,如果我输入if"后跟 Tab,什么都不会发生.我必须先滚动到特定选项.有没有办法通过输入关键字然后按 Tab 来自动完成?
Say, for example, I want to make an if
statement. In Atom, I just type "if" then hit tab and it will fill in the code with everything I need. In VS Code, if I type "if" followed by tab, nothing will happen. I would have to first scroll to the specific option. Is there a way to just get autocomplete by typing in the keyword then pressing tab?
这个问题也适用于elseif
、else
、while
.
This issue also applies to elseif
, else
, while
.
推荐答案
听起来您想要片段.您可以自己添加,也可以安装来自市场的扩展,其中包含许多流行的片段.
It sounds like you're wanting snippets. You can add them yourself, or you can install an extension from the marketplace that will come with a number of popular snippets baked in.
您可能也有兴趣更改以下设置,控制选项卡的工作方式以及片段是否首先出现在建议中.
You may be interested in changing the settings below as well, controlling how tab works and whether or not snippets appear first in the suggestions.
editor.snippetSuggestions
editor.tabCompletion
在 Mac 上使用 ⌘、
或在 Windows 上使用 Ctrl+
打开设置.然后搜索设置并点击结果旁边的编辑图标.
Open settings with ⌘,
on mac, or Ctrl+
on Windows. Then search for the setting and click the edit icon next to the result.
这篇关于自动完成在 Visual Studio 代码中无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!