calamari
calamari

Reputation: 337

Disable syntax highlighting for text files (*.txt) in vscode

When I open text files (".txt" plaintext files), in Visual Studio Code, they are syntax highlighted and also vscode starts offering suggestions as I type. How can I turn all this off and just use vscode as a simple editor for these files?

Upvotes: 6

Views: 2054

Answers (2)

Zodman
Zodman

Reputation: 3864

It's almost 4 years since the accepted answer and VScode has changed. At the time I write this answer I was getting highlighting on square braces when I format the file with plain text.

As per @calamari's answer, if you click on the Plain Text button on the bottom toolbar (lower right corner), and this time select Configure 'Plain Text' language based settings..., it will open the relevant section of your settings file.

Here are the settings I have for plain text:

    "[plaintext]": {
        "editor.unicodeHighlight.ambiguousCharacters": false,
        "editor.unicodeHighlight.invisibleCharacters": false,
        "editor.guides.highlightActiveBracketPair": false,
        "editor.semanticHighlighting.enabled": false,
        "editor.matchBrackets": "never",
        "editor.bracketPairColorization.enabled": false,
    }

It's that last line "editor.bracketPairColorization.enabled": false, that turns off the highlighting of brackets for me.

Remember to save your settings.json to see the affect of your changes in the editor. Settings don't get applied until you save the file.

Upvotes: 0

calamari
calamari

Reputation: 337

Here's how to fix it:

  1. Open a text file.
  2. In the lower right corner of the window, click the syntax highlighting language (in my case, C++):
    enter image description here
  3. A menu will appear at the top center of the window. Click Configure File Association for '.txt'...:
    enter image description here
  4. A list of languages will appear. Scroll down and choose Plain Text.
  5. Now ".txt" files will be treated as plaintext and won't be highlighted, etc.

Upvotes: 7

Related Questions