Search code examples
htmlvisual-studio-code

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:

enter image description here

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:

enter image description here

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?


Solution

  • 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.

    File Icons Language indicator

    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" },
    }