65

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?

1
  • Absolutely IS a duplicate. With the same given answer. Commented Aug 13, 2018 at 8:13

1 Answer 1

142

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

Sign up to request clarification or add additional context in comments.

4 Comments

Just wanted to say that I've been using VS Code for quite some time now, working with many advanced extensions, writing code in various languages, and yet I've managed to disregard this option in the software somehow. So simple, yet so powerful. Thanks!!
To set a default language mode: Settings -> type "language mode" -> Under: Files: Default Language, type "javascript" (or whatever else you want)
feature request: vscode to remember selection
damn this was so simple yet evaded me for ages, my colleague would laugh at me for using vscode whilst he felt superior with his notepad ++, no more!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.