Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsApr 29, 2026·3 min de lectura

Monaco Editor — Browser-Based Code Editor That Powers VS Code

The code editor component extracted from Visual Studio Code, offering IntelliSense, syntax highlighting, and diff editing directly in the browser.

Introduction

Monaco Editor is the code editor component extracted from Visual Studio Code. It provides rich IntelliSense, validation, and syntax highlighting for dozens of languages, all running directly in the browser with zero server dependency.

What Monaco Editor Does

  • Provides syntax highlighting for 70+ programming languages out of the box
  • Offers IntelliSense with autocompletion, parameter hints, and hover information
  • Supports diff editing to compare two files side by side
  • Includes find-and-replace with regex support across the editor
  • Enables code folding, bracket matching, and minimap navigation

Architecture Overview

Monaco is built on the same core as VS Code but packaged as a standalone browser library. It uses a model-view architecture where TextModel holds document state and CodeEditorWidget handles rendering. Language services run in Web Workers to keep the UI thread responsive, and text is painted via absolute-positioned DOM spans for performance.

Self-Hosting & Configuration

  • Install via npm or load from a CDN with AMD or ESM module loaders
  • Configure language defaults, themes, and editor options through the global API
  • Register custom languages and tokenizers with monaco.languages.register
  • Use monaco.editor.defineTheme to create branded color schemes
  • Bundle with Webpack, Vite, or esbuild using the official plugins for worker support

Key Features

  • Same editing engine used by millions of VS Code users daily
  • Built-in diff editor for side-by-side file comparison
  • Accessibility support with screen reader and high contrast modes
  • Multi-cursor editing and column selection
  • Extensible via custom language services, completions, and code actions

Comparison with Similar Tools

  • CodeMirror — lighter weight and more modular; Monaco offers richer out-of-box IntelliSense
  • Ace Editor — mature and widely deployed; Monaco has a more modern API and TypeScript-first design
  • Quill — focused on rich text WYSIWYG editing, not source code
  • ProseMirror — document-oriented schema editing versus Monaco's code-centric model

FAQ

Q: Can Monaco run without an internet connection? A: Yes. Once bundled, all assets are local and no external service is required.

Q: Does Monaco support mobile browsers? A: Partial support exists, but the editor is primarily optimized for desktop browsers with keyboard input.

Q: How do I add a new language? A: Use monaco.languages.register and supply a Monarch tokenizer or connect a Language Server via the LSP bridge.

Q: Is Monaco Editor the same as VS Code? A: Monaco is the editor component only. VS Code adds extensions, debugging, terminal, and the full IDE shell on top.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados