Monaco editor matchBrackets don't emit

I define a new language in monaco-editor . I expect it to automatically highlight the matching brackets and parentheses, because by default the matchBrackets parameter is true.

Should I do anything else?

Sample code: See this page ; it also does not work in Microsoft sample code.

+8
monaco-editor
source share
1 answer

You can see the java language defined by the link below

https://microsoft.imtqy.com/monaco-editor/node_modules/monaco-editor/min/vs/basic-languages/src/java.js

Tongue

If you see, what you need is not part of the language as such, but part of the configuration of that language.

So, if I open the console window on the Monarch demo link and follow below

 config = {"surroundingPairs":[{"open":"{","close":"}"}],"autoClosingPairs":[{"open":"{","close":"}"}],"brackets":[["{","}"]]} monaco.languages.setLanguageConfiguration("monarch-language-mylang", config) 

Automatic parenthesis matching begins as shown below.

config

Work as agreed

Therefore, you also need to set the configuration for your language

+2
source share

All Articles