Change syntax coloring for a file extension in Vis

2019-08-03 04:22发布

问题:

I have a file1.cshtml that really contains JSON data. 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. I then closed and reopened Visual Studio, but my editor isn't showing the desired syntax highlighting. 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. I'm using Visual Studio 2013 Premium. Changing the file extension is not an option.

Thanks

回答1:

I've found at least a partial answer to my question. Right click on the .json file in Visual Studio, choose Open with. In the dialog that appears, choose JSON Editor, and click "Set as Default," then choose OK.