microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.2k stars 28.55k forks source link

Potentially FATAL: Invalid `editor.language.brackets` or `editor.language.colorizedBracketPairs` #223276

Open Number-3434 opened 1 month ago

Number-3434 commented 1 month ago

Does this issue occur when all extensions are disabled?: Yes

Version: 1.91.1 Commit: f1e16e1e6214d7c44d078b1f0607b2388f29d729 Date: 2024-07-09T22:07:54.982Z Electron: 29.4.0 ElectronBuildId: 9728852 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Darwin x64 22.6.0 OS Version: macOS Ventura 13.6.6

The bug causes the Text Editor to stop functioning. It appears that all the other features still work as normal. This action is reversible.

When the bug is active, VSCode will either show an error message, or not render any text. This prevents the user from editing the settings.json file to fix it.

(Note that it can be fixed by either fixing, moving, or deleting the settings.json file.)

[!caution] This bug causes the text editor to stop functioning.

Steps to Reproduce:

  1. Enable bracket matching / colourising.
  2. Set the editor.language.brackets or the editor.language.colorizedBracketPairs to an invalid value.

For example:

{
    "editor.language.brackets": [["<", [">"]]]
}

or

{
    "editor.language.colorizedBracketPairs": [
        ["{", "}"],
        ["[", "]"],

        // The following is faulty
        [["${"], "}"]
    ]
}

To fix the file, you need to revert it back to a previous working state (e.g. using the Timeline, or an external Text Editor).

hediet commented 1 month ago

Thanks for the find! This is not a recent regression, right?

Number-3434 commented 1 month ago

@hediet I'm not too sure how recent this bug is, but I'm assuming it's been there after VSCode v1.60 (which introduced built-in bracket matching).