[英]No HTML suggestions in Visual Studio Code
I've download the latest Visual Studio Code and am trying to write some HTML code.我已经下载了最新的 Visual Studio Code并正在尝试编写一些 HTML 代码。 For example, <div>, <a>, <p>
tags.例如, <div>, <a>, <p>
标签。 However, there are no HTML suggestions in Visual Studio Code:但是,Visual Studio Code 中没有 HTML 建议:
I've read this article and it says:我读过这篇文章,它说:
Visual Studio Code provides basic support for HTML programming out of the box. Visual Studio Code 为开箱即用的 HTML 编程提供基本支持。
However, I've tried to install HTML extension:但是,我尝试安装 HTML 扩展:
In addition, I've turned on HTML5 suggestion in settings.json
file:另外,我在settings.json
文件中开启了 HTML5 建议:
{
"workbench.colorTheme": "Visual Studio Light",
"workbench.activityBar.visible": true,
"editor.multiCursorModifier": "ctrlCmd",
"window.zoomLevel": 0,
"html.suggest.html5": true,
}
Nevertheless, HTML, CSS suggestion does not work.然而,HTML、CSS 建议不起作用。
What can I do to code with suggestions?我可以做些什么来编写带有建议的代码?
I think the issue is that Visual Studio Code is not detecting the file type correctly.我认为问题在于 Visual Studio Code 没有正确检测文件类型。 If you notice in these pictures, vscode has correctly detected that I am writing a html file by the icon <>
beside the file name and the language indicator in the bottom right of the screen.如果您在这些图片中注意到,vscode 已经通过文件名旁边的图标<>
和屏幕右下角的语言指示器正确检测到我正在编写一个 html 文件。
The language indicator most likely says plain text
in your case.在您的情况下,语言指示器最有可能显示plain text
。 Click on it and a menu should appear at the top centre of the screen.单击它,菜单应出现在屏幕的顶部中心。 Then try the following:然后尝试以下操作:
Auto Detect
.启用Auto Detect
。 I think this will be the first option.我认为这将是第一个选择。Configure File Association for '.html'...
选择Configure File Association for '.html'...
2 can also be accomplished by adding 2也可以通过添加来完成
"files.associations": { "*.html": "html" } “files.associations”:{“*.html”:“html”}
to your settings.到您的设置。
OR just add to settings.json (File -> Preferences -> Settings)
:或者只是添加到settings.json (File -> Preferences -> Settings)
:
{
// Configure file associations to languages (e.g. "*.extension": "html"). These have
//precedence over the default associations of the languages installed.
"files.associations": { "*.html": "html" },
}
Just go to "File -> Preferences -> Settings"只需转到“文件->首选项->设置”
Search for "Associations"搜索“协会”
Go to去
File > Preferences > settings > Extensions > Emmet文件>首选项>设置>扩展> Emmet
Then click on然后点击
( C:\Users\Code\User\settings.json ) #
for reference以供参考
Add the following code:-添加以下代码:-
"emmet.triggerExpansionOnTab": true,
"files.associations": {"*html":"html"},
Save the file.保存文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.