Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way in vscode to enable syntax highlighting without saving the file? [duplicate]

Notepad++ has a Language menu which we can use to set the language of the current file without saving it, which provides syntax highlighting. This is useful for quickly checking out things, like, pasting an XML file and quickly analyzing it, typing out some JS code and copying it into a console.

Is there a way to achieve this in vscode?

like image 717
Andrew Nessin Avatar asked Aug 18 '17 15:08

Andrew Nessin


People also ask

What is enable auto save option in VS Code?

The easiest way to turn on Auto Save is with the File > Auto Save toggle that turns on and off save after a delay. For more control over Auto Save , open User or Workspace settings and find the associated settings: files.

How do you highlight syntax in VS Code?

To solve this you can Cmd + Shift + P → "install Extensions" and look for the language you want to add, say "Scala". Find the suitable Syntax package, install it and reload. This will pick up the correct syntax for your files with the predefined extension, i.e. . scala in this case.

How do I change 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.


1 Answers

In the lower right corner of the vscode window (next to the tweet feedback smiley face button) is the current language used for the opened file. If you click the current language (defaults to "Plain Text" for me) you will be given an option to select the language for the file. No need to save the file with an extension.

You could also press Ctrl+Shift+P and type "Change Language Mode" to get to the same language prompt

like image 172
alexriedl Avatar answered Sep 18 '22 06:09

alexriedl