Socket
Book a DemoInstallSign in
Socket

langium-sql

Package Overview
Dependencies
Maintainers
5
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

langium-sql

Extensible language server for SQL

latest
Source
npmnpm
Version
0.3.2
Version published
Weekly downloads
233
-50.95%
Maintainers
5
Weekly downloads
 
Created
Source

Langium/SQL

This project provides a language server for SQL dialects.

Features

  • Schema-driven: Add a set of table definitions to spread out the world for your SELECT queries. The table definitions can be located in a different file of the same workspace. You can keep definitions and queries separated.
  • Code completion: Press Ctrl + Space keys to trigger the completion directly. You will get suggestions for the current context.
  • Syntax highlighting: to distinguish what are keywords, identifiers, numeric literals and for a better perception of the SQL syntax.
  • Symbol search: Use Cmd or Ctrl + mouse click on a column name to find the definition of it or explore the places where a column is used.
  • Fast feedback about contextual correctness: Whether referenced columns exist or types on certain operators are matching.
  • Super-set approach: Any piece of any dialect that is missing can be added to the main grammar and be protected from other dialects using validations.
  • Highly customizable: Any behavior or aspect that is missing for your specific use case can be easily overwritten.

Demo

We prepared a showcase on the Langium project website. You can find it here.

The given schema describes an airport database. It contains tables for airports, airlines, flights, and passengers. The queries are written in the MySQL dialect.

Getting started

Installation

npm install langium-sql

or

yarn add langium-sql

Example usage

Here is a minimal example of how to use the Langium/SQL language server in your project.

import { parseHelper, createTestServices } from "../test-utils";
import { join } from "path";
import { MySqlDialectTypes } from "../../src/dialects/mysql/data-types";

const services = createTestServices(MySqlDialectTypes);
const parse = await parseHelper(services.Sql, join('path', 'to', 'schemas.sql'));
const document = await parse("SELECT * FROM my_table;");

console.log(document.parseResult.value);

See more examples in the Langium test folder.

Learn more

Look at the announcing blog post or the Langium documentation to get familiar with the project structure.

License

MIT

FAQs

Package last updated on 19 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.