Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 910
StepUp Avatar asked Apr 15 '18 12:04

StepUp


People also ask

Why VS Code is not giving suggestions?

Why is VS Code suggestions not working? If you're coding in JavaScript or TypeScript and finds that VSCode IntelliSense does work but does not behave properly, it's likely that you've selected the wrong language mode. TypeScript and JavaScript share the same language service, so you need to select the right language.

How do I enable suggestions in Visual Studio?

To access this options page, choose Tools > Options, and then choose Text Editor > C# > IntelliSense.

How do I enable HTML code in Visual Studio?

For single html file, in VS 2022, you can click File > View in Browser (Ctrl + Shift + W) to preview it(or right-click the white space of this single html file > click View in Browser ).

How do I enable HTML Emmet in VS Code?

To enable the Emmet abbreviation expansion in file types where it is not available by default, use the emmet.includeLanguages setting. Make sure to use language identifiers for both sides of the mapping, with the right side being the language identifier of an Emmet supported language (see the list above).


1 Answers

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" },
}
like image 175
fanduin Avatar answered Sep 30 '22 05:09

fanduin