Registry / storage / langium-sql

langium-sql

JSON →
library0.3.2jsnpmunverified

Langium/SQL is an extensible language server for SQL dialects built on the Langium framework. It provides schema-driven SQL editing with code completion, syntax highlighting, symbol search, and real-time validation. The current stable version is 0.3.2, released on an irregular cadence. Key differentiators include a super-set approach that allows adding missing dialect features to the grammar while protecting others via validations, and high customizability where any behavior can be overridden. It is designed for integration into editors and IDEs via the Language Server Protocol.

npm install langium-sql
INSTALL
IMPORT
SIG · LANGIUM-SQL
L
langium-sql
storagejavascriptv0.3.2
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.

parseHelper
import { parseHelper } from 'langium-sql/test-utils';
import { parseHelper } from 'langium-sql';
parseHelper is only exported from the test-utils subpath, not the main package.
createTestServices
import { createTestServices } from 'langium-sql/test-utils';
import { createTestServices } from 'langium-sql';
createTestServices is only exported from the test-utils subpath.
MySqlDialectTypes
import { MySqlDialectTypes } from 'langium-sql/dialects/mysql/data-types';
import { MySqlDialectTypes } from 'langium-sql';
Dialect-specific types are imported from subpaths under dialects/.
LangiumSqlServices
import { LangiumSqlServices } from 'langium-sql';
The main services type is exported from the package root.

Parses a SQL query using Langium/SQL dialect for MySQL and prints the parse result.

import { createTestServices } from 'langium-sql/test-utils'; import { MySqlDialectTypes } from 'langium-sql/dialects/mysql/data-types'; import { parseHelper } from 'langium-sql/test-utils'; import { join } from 'path'; async function example() { const services = createTestServices(MySqlDialectTypes); const parse = await parseHelper(services.Sql, join(__dirname, 'schemas.sql')); const document = await parse('SELECT * FROM mytable;'); console.log(document.parseResult.value); } example().catch(console.error);
Debug
Known issues
gotchaKey utilities parseHelper and createTestServices are not exported from the main package; they must be imported from '/test-utils' subpath.
fix
Use import { parseHelper } from 'langium-sql/test-utils'; instead of from 'langium-sql'.
affects: >=0.3.0
breakingIn version 0.2.x, dialect types were exported from the main package. They moved to subpaths in 0.3.0.
fix
Update imports to include the full subpath, e.g., 'langium-sql/dialects/mysql/data-types'.
affects: >=0.3.0
gotchaThe parseHelper function expects a path to a schema file; if the file is missing or has errors, parsing fails silently.
fix
Ensure the schema file path is correct and check for validation errors in the returned document.
affects: >=0.3.0
deprecatedThe services factory 'createLangiumSqlServices' is deprecated in favor of 'createTestServices'.
fix
Replace createLangiumSqlServices with createTestServices and pass dialect types explicitly.
affects: >=0.3.0
Errors
Common errors & fixes
Cannot find module 'langium-sql/test-utils'
Missing or incorrect subpath export in package.json; older versions may not expose test-utils.
fix
Ensure langium-sql version >= 0.3.0, and verify your bundler or TypeScript resolves subpath exports.
TypeError: parseHelper is not a function
parseHelper is an async function that must be awaited, or imported incorrectly.
fix
Use: const parse = await parseHelper(services.Sql, 'schema.sql'); then const doc = await parse('SELECT ...');
'MySqlDialectTypes' is not exported from 'langium-sql'
MySqlDialectTypes is exported from a subpath, not the main module.
fix
Import from 'langium-sql/dialects/mysql/data-types'.
Upgrade
Version history
0.3.2latest on npm
Audit
Dependencies
langiumrequiredCore language engineering framework for building language servers.
Agent activity
16 hits · last 30 days
node
16
Resources
langium-sql — npm install langium-sql · libregistry