Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSON Javascript highlighting in Visual Studio 2010

Does anybody know how to get VS 2010 to use the same highlighting for a file called .JSON as it uses for a JavaScript file? Just working on a client site and they've named all their JSON template files as .JSON, with the result that I just get a plain old text editor when I open it in Visual Studio. Any suggestions? I'm sure there must be an option somewhere that would do it but I can't find it so far...

like image 577
Mel Padden Avatar asked Oct 27 '10 14:10

Mel Padden


People also ask

Can you highlight code in Visual Studio?

These can be added by using Ctrl+K , Ctrl+K and you can press Ctrl+K , Ctrl+N to move to the next bookmark, or Ctrl+K , CTRL+P for the previous bookmark.

How does syntax highlighting work?

Syntax highlighting determines the color and style of source code displayed in the Visual Studio Code editor. It is responsible for colorizing keywords like if or for in JavaScript differently than strings and comments and variable names.


2 Answers

Tools -> Options -> Text Editor -> File Extension

End your extension 'json' and select 'Script Editor' and click 'add'.

Re-open any json documents for it to take affect.

like image 178
Garth Avatar answered Oct 02 '22 13:10

Garth


Another option is to use Text Highlighter (extention for Visual Studio 2010), which offers syntax highlighting for the following text formats:

  • .json (also offer syntax validation)
  • .bat
  • .cmd
  • .ini
  • .txt
  • .log
like image 34
Dmitry Pavlov Avatar answered Oct 02 '22 14:10

Dmitry Pavlov