简体   繁体   中英

No HTML suggestions in Visual Studio Code

I've download the latest Visual Studio Code and am trying to write some HTML code. For example, <div>, <a>, <p> tags. However, there are no HTML suggestions in Visual Studio Code:

在此处输入图像描述

I've read this article and it says:

Visual Studio Code provides basic support for HTML programming out of the box.

However, I've tried to install HTML extension:

在此处输入图像描述

In addition, I've turned on HTML5 suggestion in settings.json file:

{
    "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.

What can I do to code with suggestions?

I think the issue is that Visual Studio Code is not detecting the file type correctly. 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.

文件图标 语言指示器

The language indicator most likely says plain text in your case. Click on it and a menu should appear at the top centre of the screen. Then try the following:

  1. Enabling Auto Detect . I think this will be the first option.
  2. Selecting Configure File Association for '.html'...
  3. 2 can also be accomplished by adding

    "files.associations": { "*.html": "html" }

    to your settings.

OR just add to 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"

Check this image

Go to

File > Preferences > settings > Extensions > 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM