Reproducible in vscode.dev or in VS Code Desktop?
Reproducible in the monaco editor playground?
Monaco Editor Playground Link
Current Broken Version (latest):
https://microsoft.github.io/monaco-editor/playground.html?source=v0.36.1#XQAAAAI5AQAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscrHQDZUcqL2Gu_y6-pesM5CAK4Rl2SA3OZZypoZAb43HgZ99s3BRMgXtreldIbr5SD4XF5Tatz5q50l9C62FqPMzPpUOWn0KyP2OajTzBZa3r3xwFuz_bvlBduMYE4EJ1jKJvqTNpAOrjRdK3jtBTzQOXj5_qIDbaqXPzfb5D1SHpUF1n8kjogmjV1xItO7tOO1PQ8z-sIBrqo5PvQKHC-agBecyvVVfLlwrxQbBp-cAedPSral5liedjr3fSsYJrtO9__96qDrw
Last Working Version (0.33.0):
https://microsoft.github.io/monaco-editor/playground.html?source=v0.33.0#XQAAAAI5AQAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscrHQDZUcqL2Gu_y6-pesM5CAK4Rl2SA3OZZypoZAb43HgZ99s3BRMgXtreldIbr5SD4XF5Tatz5q50l9C62FqPMzPpUOWn0KyP2OajTzBZa3r3xwFuz_bvlBduMYE4EJ1jKJvqTNpAOrjRdK3jtBTzQOXj5_qIDbaqXPzfb5D1SHpUF1n8kjogmjV1xItO7tOO1PQ8z-sIBrqo5PvQKHC-agBecyvVVfLlwrxQbBp-cAedPSral5liedjr3fSsYJrtO9__96qDrw
Monaco Editor Playground Code
const text = `{
"array-brackets": [],
"object-brackets": {
"value": 1
}
}`;
// Hover on each property to see its docs!
monaco.editor.create(document.getElementById("container"), {
value: text,
language: "json",
automaticLayout: true,
});
Reproduction Steps
Use as language "json", open the editor with valid json data, e.g:
{ "array-brackets": [], "object-brackets": { "value": 1 } }
If the editor is opened, move the cursor to one of the brackets, e.g { or [.
Now the bracket pairs should be highlighted.
Actual (Problematic) Behavior
Matching Brackets are not highlighted:

Expected Behavior
Expected that the matching brackets are highlighted:

Additional Context
With the language "javascript" it is working as expected.
The difference I observed is that in case of javascript the lexer editor/standalone/common/monarch/monarchLexer.ts is invoked and every token line is marked with the flag MetadataConsts.BALANCED_BRACKETS_MASK:
const metadata = this._theme.match(this._currentLanguageId, type) | MetadataConsts.BALANCED_BRACKETS_MASK;
In the case of json the editor/standalone/browser/standaloneLanguages.ts is analyzing the tokens and here in the method _toBinaryTokens is looking up the line tokens metadata from the color theme, but without combining it with the MetadataConsts.BALANCED_BRACKETS_MASK.
In my custom project I hacked this into the code and it solved the problem. But I'm really only guessing and have no deep understanding of the code responsibilities.
Reproducible in vscode.dev or in VS Code Desktop?
Reproducible in the monaco editor playground?
Monaco Editor Playground Link
Current Broken Version (latest):
https://microsoft.github.io/monaco-editor/playground.html?source=v0.36.1#XQAAAAI5AQAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscrHQDZUcqL2Gu_y6-pesM5CAK4Rl2SA3OZZypoZAb43HgZ99s3BRMgXtreldIbr5SD4XF5Tatz5q50l9C62FqPMzPpUOWn0KyP2OajTzBZa3r3xwFuz_bvlBduMYE4EJ1jKJvqTNpAOrjRdK3jtBTzQOXj5_qIDbaqXPzfb5D1SHpUF1n8kjogmjV1xItO7tOO1PQ8z-sIBrqo5PvQKHC-agBecyvVVfLlwrxQbBp-cAedPSral5liedjr3fSsYJrtO9__96qDrw
Last Working Version (0.33.0):
https://microsoft.github.io/monaco-editor/playground.html?source=v0.33.0#XQAAAAI5AQAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscrHQDZUcqL2Gu_y6-pesM5CAK4Rl2SA3OZZypoZAb43HgZ99s3BRMgXtreldIbr5SD4XF5Tatz5q50l9C62FqPMzPpUOWn0KyP2OajTzBZa3r3xwFuz_bvlBduMYE4EJ1jKJvqTNpAOrjRdK3jtBTzQOXj5_qIDbaqXPzfb5D1SHpUF1n8kjogmjV1xItO7tOO1PQ8z-sIBrqo5PvQKHC-agBecyvVVfLlwrxQbBp-cAedPSral5liedjr3fSsYJrtO9__96qDrw
Monaco Editor Playground Code
Reproduction Steps
Use as language "json", open the editor with valid json data, e.g:
{ "array-brackets": [], "object-brackets": { "value": 1 } }If the editor is opened, move the cursor to one of the brackets, e.g
{or[.Now the bracket pairs should be highlighted.
Actual (Problematic) Behavior
Matching Brackets are not highlighted:
Expected Behavior
Expected that the matching brackets are highlighted:
Additional Context
With the language "javascript" it is working as expected.
The difference I observed is that in case of javascript the lexer editor/standalone/common/monarch/monarchLexer.ts is invoked and every token line is marked with the flag
MetadataConsts.BALANCED_BRACKETS_MASK:const metadata = this._theme.match(this._currentLanguageId, type) | MetadataConsts.BALANCED_BRACKETS_MASK;In the case of json the editor/standalone/browser/standaloneLanguages.ts is analyzing the tokens and here in the method
_toBinaryTokensis looking up the line tokens metadata from the color theme, but without combining it with theMetadataConsts.BALANCED_BRACKETS_MASK.In my custom project I hacked this into the code and it solved the problem. But I'm really only guessing and have no deep understanding of the code responsibilities.