Can Visual Studio Code use Emmet completion in racor.cshtml files

I am using Visual Studio Code (1.17.1, on MacOS 10.13 and Windows 10), developing an asp.net core mvc web application using razor patterns. Visual Studio Code supports Emmet ( https://code.visualstudio.com/docs/editor/emmet )

My problem is that Emmet works correctly in HTML files but does not work in razor CSHTML files.

I found:

To enable the Emmet extension in file types where it is not available by default, use the emmet.includeLanguages ​​parameter. Be sure to use language identifiers for both sides of the display. https://code.visualstudio.com/docs/editor/emmet

but does not indicate where to find the list of "language identifiers". I tried to find it, but you can imagine what happens when you look for a programming language identifier!

Is there a way to tell Emmet in VS Code to handle cshtml files as html files? Is there any other way to make this work (besides renaming files, which is another solution)?

+8
razor visual-studio-code emmet
source share
1 answer

According to this link , the corresponding language for * .cshtml files is a razor, so you need to specify it in the emmet display as follows:

"emmet.includeLanguages": { "razor": "html" }

+16
source share

All Articles