Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set language for syntax highlighting in Visual Studio Code

Before the confusion begins, this question is about Code, the new lightweight Visual Studio Editor. You can get it from here: https://code.visualstudio.com/

I have a textfile (.txt) with CSS in it and want to get syntax hightlighting. You can open the command palette with ctrl+shift+p. But there you can not set syntax like in Sublime.

Is there any other way to get the CSS coloring in from my textfile?

like image 679
Florian Leitgeb Avatar asked Jun 11 '15 08:06

Florian Leitgeb


People also ask

How do I change the syntax highlighting in VS Code?

To change the text and syntax colors in visual studio code follow the steps given below: Open VS Code editor to change the syntax colors. Go to Settings, which is on the bottom left corner of the VS Code window. In the search field type JSON, and click on the 'Edit in settings.

How do I change the language mode in Visual Studio Code?

Press Ctrl+Shift+P to bring up the Command Palette then start typing "display" to filter and display the Configure Display Language command. Press Enter and a list of installed languages by locale is displayed, with the current locale highlighted.

How do I change the highlighting syntax?

You can change (or apply) syntax highlighting for the active file by using the View as language drop down in the Formatting group of the Coding tab, or the syntax highlighting selector in the Status bar.

What does VS Code use for syntax highlighting?

VS Code uses TextMate grammars as the syntax tokenization engine.


2 Answers

In the very right bottom corner, left to the smiley there was the icon saying "Plain Text". When you click it, the menu with all languages appears where you can choose your desired language.

VSCode

like image 85
Florian Leitgeb Avatar answered Sep 22 '22 22:09

Florian Leitgeb


Press Ctrl + KM and then type in (or click) the language you want.

Alternatively, to access it from the command palette, look for "Change Language Mode" as seen below:

enter image description here

like image 31
gitsitgo Avatar answered Sep 24 '22 22:09

gitsitgo