简体   繁体   English

在Visual Studio 2013中更改文件扩展名的语法颜色

[英]Change syntax coloring for a file extension in Visual Studio 2013

I have a file1.cshtml that really contains JSON data. 我有一个file1.cshtml,其中确实包含JSON数据。 I'd like the syntax highlighting, etc. to reflect this. 我希望语法高亮显示等。 I tried going to Tools > Options > Text Editor > File Extension and changed the cshtml extension's Editing Experience to be JSON Editor. 我尝试转到“工具”>“选项”>“文本编辑器”>“文件扩展名”,并将cshtml扩展名的“编辑体验”更改为JSON编辑器。 I then closed and reopened Visual Studio, but my editor isn't showing the desired syntax highlighting. 然后,我关闭并重新打开了Visual Studio,但是我的编辑器没有显示所需的语法突出显示。 I can copy and paste the contents of file1.cshtml into file2.json and everything looks ok, but I'd rather not have to do it this way. 我可以将file1.cshtml的内容复制并粘贴到file2.json中,一切看起来都很好,但是我宁愿不必这样做。 I'm using Visual Studio 2013 Premium. 我正在使用Visual Studio 2013 Premium。 Changing the file extension is not an option. 不能更改文件扩展名。

Thanks 谢谢

I've found at least a partial answer to my question. 我至少对我的问题有部分答案。 Right click on the .json file in Visual Studio, choose Open with. 右键单击Visual Studio中的.json文件,选择“打开方式”。 In the dialog that appears, choose JSON Editor, and click "Set as Default," then choose OK. 在出现的对话框中,选择“ JSON编辑器”,然后单击“设置为默认值”,然后选择“确定”。

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

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