Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@codemirror/lang-sql

Package Overview
Dependencies
Maintainers
2
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codemirror/lang-sql

SQL language support for the CodeMirror code editor

  • 6.8.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is @codemirror/lang-sql?

@codemirror/lang-sql is a language support package for CodeMirror 6 that provides syntax highlighting, autocompletion, and other SQL language features. It is designed to help developers integrate SQL editing capabilities into their web applications.

What are @codemirror/lang-sql's main functionalities?

Syntax Highlighting

This feature provides syntax highlighting for SQL code. The code sample demonstrates how to set up a CodeMirror editor with SQL syntax highlighting.

import { sql } from '@codemirror/lang-sql';
import { EditorState } from '@codemirror/state';
import { EditorView, basicSetup } from '@codemirror/basic-setup';

const state = EditorState.create({
  doc: 'SELECT * FROM users;',
  extensions: [basicSetup, sql()]
});

const view = new EditorView({
  state,
  parent: document.body
});

Autocompletion

This feature provides autocompletion for SQL code. The code sample demonstrates how to set up a CodeMirror editor with SQL autocompletion.

import { sql, sqlCompletion } from '@codemirror/lang-sql';
import { EditorState } from '@codemirror/state';
import { EditorView, basicSetup } from '@codemirror/basic-setup';
import { autocompletion } from '@codemirror/autocomplete';

const state = EditorState.create({
  doc: 'SELECT * FROM ',
  extensions: [basicSetup, sql(), autocompletion({ override: [sqlCompletion] })]
});

const view = new EditorView({
  state,
  parent: document.body
});

Error Checking

This feature provides error checking for SQL code. The code sample demonstrates how to set up a CodeMirror editor with SQL error checking.

import { sql, sqlDiagnostics } from '@codemirror/lang-sql';
import { EditorState } from '@codemirror/state';
import { EditorView, basicSetup } from '@codemirror/basic-setup';
import { linter } from '@codemirror/lint';

const state = EditorState.create({
  doc: 'SELECT * FORM users;',
  extensions: [basicSetup, sql(), linter(sqlDiagnostics)]
});

const view = new EditorView({
  state,
  parent: document.body
});

Other packages similar to @codemirror/lang-sql

Keywords

FAQs

Package last updated on 01 Oct 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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc