简体   繁体   中英

VS Code: How to enable .CSS intellisense for ASP.NET .cshtml files?

I have installed the "HTML CSS Support" extension for VS Code but it only seems to work on files with extension.html. I can't get it to work with.cshtml files unless I rename the file temporarily to html but that's cumbersome.

What's the best way to enable VS Code to provide intellisense for local and remote.css files for use in.cshtml files?

In order to associate .cshtml files to html formatter, you can insert the following snippet in your settings.json file:

  "files.associations": {
    "*.cshtml": "html"
  }

that way vscode treats .cshtml files like html file and you should be able to use formatters and intellisense in those files.


Besides, you can use this workaround using this extension to change the language-mode-setting of vscode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM