Registry / devops / monaco-sql-languages

monaco-sql-languages

JSON →
library1.1.0jsnpmunverified

A library providing SQL language support for the Monaco Editor, including syntax highlighting, code completion, and error diagnostics for multiple SQL dialects. Based on monaco-languages, it supports Hive, Spark, MySQL, PostgreSQL, Flink, Trino, Impala, and a generic SQL mode. Current stable version 1.1.0 requires Node >=18 and monaco-editor >=0.37.1. Released under MIT, actively maintained on GitHub by DTStack. Key differentiator: comprehensive dialect coverage with built-in completion logic, good for embedding SQL editing in web apps running on modern Node.js.

npm install monaco-sql-languages
INSTALL
IMPORT
SIG · MONACO-SQL-LANGUAG
M
monaco-sql-languages
devopsjavascriptv1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

registerLanguage
import { registerLanguage } from 'monaco-sql-languages';
Default function to register a SQL language with predefined completion and validation.
SQLDialect
import { SQLDialect } from 'monaco-sql-languages';
import SQLDialect from 'monaco-sql-languages';
Enum used to specify dialect (e.g., SQLDialect.MySQL, SQLDialect.Hive). Not a default export.
getCompletions
import { getCompletions } from 'monaco-sql-languages/esm';
import { getCompletions } from 'monaco-sql-languages';
Utility to get inline completions for SQL; available in ESM path only. Direct import from root may not work in all bundlers.

Registers MySQL language support for Monaco Editor and creates an editor instance with sample SQL.

import * as monaco from 'monaco-editor'; import { registerLanguage, SQLDialect } from 'monaco-sql-languages'; // Register MySQL language support registerLanguage(SQLDialect.MySQL); // Create editor with SQL content const editor = monaco.editor.create(document.getElementById('container'), { value: 'SELECT * FROM users WHERE id = 1;', language: 'mysql', automaticLayout: true });
Debug
Known issues
breakingRequires Node.js >=18. Older versions will fail to install or run.
fix
Upgrade Node.js to version 18 or higher.
affects: >=1.0.0
breakingOnly compatible with monaco-editor >=0.37.1. Using older versions may cause errors in language registration.
fix
Update monaco-editor to version 0.37.1 or later.
affects: >=1.0.0
gotchaEagerly imports all dialects if using the root import; tree-shaking may not work.
fix
Import from specific paths like 'monaco-sql-languages/esm' or use dynamic imports to reduce bundle size.
affects: >=1.0.0
deprecatedThe 'registerCompletionProvider' function is deprecated in favor of 'registerLanguage' which automatically registers completions.
fix
Use 'registerLanguage' instead.
affects: <1.0.0
gotchaTypeScript types are shipped but only for the main entry point; internal utilities may not have declarations.
fix
Use 'SQLDialect' enum and 'registerLanguage' which have full type support.
affects: >=1.0.0
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'monaco-editor' in '.../node_modules/monaco-sql-languages'
monaco-editor is a peer dependency and not automatically installed.
fix
Run 'npm install monaco-editor' (ensure version >=0.37.1).
Cannot read properties of undefined (reading 'getCompletions')
Importing 'getCompletions' from the wrong path; root exports may not include it.
fix
Use 'import { getCompletions } from 'monaco-sql-languages/esm';' instead.
Cannot find module 'monaco-sql-languages' or its corresponding type declarations.
Package not installed or TypeScript resolver misconfigured.
fix
Install the package: 'npm install monaco-sql-languages'. Ensure tsconfig.json includes 'node_modules' in compilerOptions.paths if using custom resolution.
SyntaxError: Unexpected token 'export'
The package is ESM-only; CommonJS environments cannot load it directly.
fix
Set 'type': 'module' in package.json or use dynamic import(). For Node <18, upgrade Node.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
monaco-editorrequiredPeer dependency required for the Monaco Editor instance to register language providers.
Agent activity
13 hits · last 30 days
node
10
Resources
monaco-sql-languages — npm install monaco-sql-languages · libregistry