简体   繁体   English

VS Code:如何为 ASP.NET.cshtml 文件启用.CSS 智能感知?

[英]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.我已经为 VS Code 安装了“HTML CSS 支持”扩展,但它似乎只适用于扩展名为 html 的文件。 I can't get it to work with.cshtml files unless I rename the file temporarily to html but that's cumbersome.除非我将文件临时重命名为 html ,否则我无法让它与 .cshtml 文件一起使用,但这很麻烦。

What's the best way to enable VS Code to provide intellisense for local and remote.css files for use in.cshtml files?启用 VS Code 为本地和远程提供智能感知的最佳方法是什么。css 文件用于 in.cshtml 文件?

In order to associate .cshtml files to html formatter, you can insert the following snippet in your settings.json file:为了将.cshtml文件关联到html格式化程序,您可以在settings.json文件中插入以下代码段:

  "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.这样,vscode 将.cshtml文件视为html文件,您应该能够在这些文件中使用格式化程序和智能感知。


Besides, you can use this workaround using this extension to change the language-mode-setting of vscode.此外,您可以使用扩展来更改 vscode 的语言模式设置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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