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?
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.
To access this options page, choose Tools > Options, and then choose Text Editor > C# > IntelliSense.
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 ).
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).
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:
Auto Detect
. I think this will be the first option.Configure File Association for '.html'...
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" },
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With