About this project
Monaco Editor is the fully featured code editor from VS Code, packaged as a library that runs in the browser. It is published on npm as `monaco-editor` and ships an ESM build (compatible with bundlers such as webpack) plus a deprecated AMD build kept for backwards compatibility. The versioned public surface is described in `monaco.d.ts`; everything else is considered private and may change between releases.
Core concepts:
- Models represent opened content: they hold text, determine the language, and track edit history. A model does not have to correspond to a real file.
- URIs identify models, so two models cannot share a URI. Models created without one get generated `inmemory://model/N` URIs. Choosing meaningful URIs matters because some smart features (for example TypeScript import resolution or JSON schema selection) depend on the file URI.
- Editors are the user-facing views attached to the DOM; they display a model, manage view state, and execute actions or commands.
- Providers supply smart editor features such as completion and hover information, often mapping to Language Server Protocol capabilities.
- Many objects expose `.dispose()` for cleanup; disposing a model frees its URI, and editors should be disposed to release resources and listeners.
Localization is handled by loading the matching nls script (for example `esm/nls.messages.de.js`) before the main editor script. The README points to an interactive playground for trying features, testing versions, and building minimal reproductions, plus complete integration samples, API docs, an accessibility guide for integrators, and a Monarch playground for creating tokenizers for new languages.
The FAQ clarifies that Monaco is generated from VS Code sources with shims so it can run in a browser, that its version does not track VS Code's version, and that VS Code extensions generally do not work in it unless they are fully LSP-based with a JavaScript language server. Language services use web workers; pages loaded over `file://` cannot create workers, so the editor should be served over http or https. Mobile browsers and mobile web app frameworks are not supported, and TextMate grammars are not built in (a separate community project combines monaco-editor with vscode-oniguruma and vscode-textmate). The project is MIT licensed and welcomes community contributions.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.