mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 15:05:39 +01:00
A browser based code editor
When a monaco editor instance is created and destroyed shortly afterwards, the error 'Cannot read property 'getModeId' of null' occurs. As far as I could trace this issue, this happens because in onModelAdd a call to setTimeout is made with a delay of 500ms, which in turn calls _doValidate. If the monaco editor instance is destroyed before the callback is called, _doValidate tries to call model.getModeId(), but model is null. The little additional null-check in this PR ensures no exception is thrown if the model cannot be determined. Unfortunately, I wasn't able to reproduce this problem using vs code playground or similar. It is easily reproducible in our angular application which uses monaco-editor@0.21.2. Here, we display a monaco editor instance in a property editor on the right side of the screen which is newly instantiated whenever the user selects a new object on the left side of the screen. If you quickly change the items selected the error occurs. I'll be happy to provide a screen recording including the Chrome dev tools console if needed. Last but not least: Thanks for all your great work! :) |
||
|---|---|---|
| .vscode | ||
| scripts | ||
| src | ||
| test | ||
| .gitignore | ||
| .npmignore | ||
| .prettierignore | ||
| .prettierrc | ||
| LICENSE.md | ||
| monaco.d.ts | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
Monaco CSS
CSS language plugin for the Monaco Editor. It provides the following features when editing CSS, LESS and SCSS files:
- Code completion
- Hovers
- Validation: Syntax errors and linting
- Find definition, references & highlights for symbols in the same file
- Document Symbols
- Color Decorators
Linting an be configured through the API. See here for the API that the CSS plugin offers to configure the CSS/LESS/SCSS language support.
Internally the CSS plugin uses the vscode-css-languageservice node module, providing the implementation of the functionally listed above. The same module is also used in Visual Studio Code to power the CSS, LESS and SCSS editing experience.
Issues
Please file issues concering monaco-css in the monaco-editor repository.
Installing
This npm module is bundled and distributed in the monaco-editor npm module.
Development
npm install .- compile with
npm run compile - watch with
npm run watch npm run prepublishOnly- open
$/monaco-css/test/index.htmlin your favorite browser.