I'm defining new language in monaco-editor. I expect that it automatically highlight matching brackets and parentheses because by default matchBrackets
option is true.
Should I do anything else?
Sample Code: Look at this page it doesn't work in Microsoft's samples codes too.
editor . create( document. getElementById('ide'), { model: null, readOnly: true, contextmenu: false, } ); So now that editor is readonly.
Starting from version v4. 4.0 it's possible to use monaco-editor as an npm package; import it from node_modules and include monaco sources into your bundle (instead of using CDN). To make it work you can do the following: import * as monaco from "monaco-editor"; import { loader } from "@monaco-editor/react"; loader.
The Monaco Editor is the code editor that powers VS Code. A good page describing the code editor's features is here. It is licensed under the MIT License and supports Edge, Chrome, Firefox, Safari and Opera. The Monaco editor is not supported in mobile browsers or mobile web frameworks.
You can see the original TypeScript source for the java
language defined at:
https://github.com/microsoft/monaco-languages/blob/master/src/java/java.ts
The Compiled JavaScript looks like:
If you see, what you need is not part of the language as such but part of the config of that language.
So If I open the console window on the Monarch
demo link and execute below
config = {"surroundingPairs":[{"open":"{","close":"}"}],"autoClosingPairs":[{"open":"{","close":"}"}],"brackets":[["{","}"]]}
monaco.languages.setLanguageConfiguration("monarch-language-mylang", config)
The auto-matching of brackets starts working as shown below
So you need to make sure to set the config as well for your language
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With