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

后端 未结 2 1538
滥情空心
滥情空心 2021-02-05 04:00

I\'m using Visual Studio Code (1.17.1, on MacOS 10.13 AND Windows 10) developing an asp.net core mvc web app using razor templating. Visual Studio Code supports Emmet (https://c

相关标签:
2条回答
  • 2021-02-05 04:28

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

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

    0 讨论(0)
  • 2021-02-05 04:34

    updated: Press Ctrl+K than M (Ctrl+K,M) than select highlighter from the dropdownlist you want this is a common shortcut. very useful. even works for any file types. ie. create a new file and code some xml or what language you want than Ctrl+K,M you can specify/override ide hilighter on the fly. very useful shortcut. try it. you won't forget Ctrl+K,M. one of most useful hotkey combination I ever use in vscode. by this way code-completion wakes up and works as language you selected.

    in vscode > settings.json
    I added the related codes mentionel above. emmet worked for cshtml files.

     "emmet.includeLanguages": {
       "razor":"html",
       "aspnetcorerazor":"html"
      }
    
    0 讨论(0)
提交回复
热议问题