SQL language support for the CodeMirror code editor
Installations
npm install @codemirror/lang-sql
Releases
Unable to fetch releases
Developer
Developer Guide
Module System
ESM
Min. Node Version
Typescript Support
Yes
Node Version
20.13.1
NPM Version
10.8.0
Statistics
77 Stars
133 Commits
39 Forks
4 Watching
1 Branches
10 Contributors
Updated on 23 Nov 2024
Languages
TypeScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
18,573,945
Last day
-10.7%
46,446
Compared to previous day
Last week
-2%
265,140
Compared to previous week
Last month
4.1%
1,210,780
Compared to previous month
Last year
101%
11,716,436
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
@codemirror/lang-sql
[ WEBSITE | ISSUES | FORUM | CHANGELOG ]
This package implements SQL language support for the CodeMirror code editor.
The project page has more information, a number of examples and the documentation.
This code is released under an MIT license.
We aim to be an inclusive, welcoming community. To make that explicit, we have a code of conduct that applies to communication around the project.
API Reference
-
sql(config?: SQLConfig = {}) → LanguageSupport
SQL language support for the given SQL dialect, with keyword completion, and, if provided, schema-based completion as extra extensions.
-
interface
SQLConfig Options used to configure an SQL extension.
-
dialect?: SQLDialect
The dialect to use. Defaults to
StandardSQL
.-
schema?: SQLNamespace
You can use this to define the schemas, tables, and their fields for autocompletion.
-
defaultTable?: string
When given, columns from the named table can be completed directly at the top level.
-
defaultSchema?: string
When given, tables prefixed with this schema name can be completed directly at the top level.
-
upperCaseKeywords?: boolean
When set to true, keyword completions will be upper-case.
-
-
type SQLNamespace = Object<SQLNamespace> | {self: Completion, children: SQLNamespace} | readonly (string | Completion)[]
The type used to describe a level of the schema for completion. Can be an array of options (columns), an object mapping table or schema names to deeper levels, or a
{self, children}
object that assigns a completion option to use for its parent property, when the default option (its name as label and type"type"
) isn't suitable.-
class
SQLDialect Represents an SQL dialect.
-
language: LRLanguage
The language for this dialect.
-
spec: SQLDialectSpec
The spec used to define this dialect.
-
extension: Extension
Returns the language for this dialect as an extension.
-
static define(spec: SQLDialectSpec) → SQLDialect
Define a new dialect.
-
-
type
SQLDialectSpec Configuration for an SQL Dialect.
-
keywords?: string
A space-separated list of keywords for the dialect.
-
builtin?: string
A space-separated string of built-in identifiers for the dialect.
-
types?: string
A space-separated string of type names for the dialect.
-
backslashEscapes?: boolean
Controls whether regular strings allow backslash escapes.
-
hashComments?: boolean
Controls whether # creates a line comment.
-
slashComments?: boolean
Controls whether
//
creates a line comment.-
spaceAfterDashes?: boolean
When enabled
--
comments are only recognized when there's a space after the dashes.-
doubleDollarQuotedStrings?: boolean
When enabled, things quoted with "$" are treated as strings, rather than identifiers.
-
doubleQuotedStrings?: boolean
When enabled, things quoted with double quotes are treated as strings, rather than identifiers.
-
charSetCasts?: boolean
Enables strings like
_utf8'str'
orN'str'
.-
plsqlQuotingMechanism?: boolean
Enables string quoting syntax like
q'[str]'
, as used in PL/SQL.-
operatorChars?: string
The set of characters that make up operators. Defaults to
"*+\-%<>!=&|~^/"
.-
specialVar?: string
The set of characters that start a special variable name. Defaults to
"?"
.-
identifierQuotes?: string
The characters that can be used to quote identifiers. Defaults to
"\""
.-
caseInsensitiveIdentifiers?: boolean
Controls whether identifiers are case-insensitive. Identifiers with upper-case letters are quoted when set to false (which is the default).
-
unquotedBitLiterals?: boolean
Controls whether bit values can be defined as 0b1010. Defaults to false.
-
treatBitsAsBytes?: boolean
Controls whether bit values can contain other characters than 0 and 1. Defaults to false.
-
-
StandardSQL: SQLDialect
The standard SQL dialect.
-
PostgreSQL: SQLDialect
Dialect for PostgreSQL.
-
MySQL: SQLDialect
MySQL dialect.
-
MariaSQL: SQLDialect
-
MSSQL: SQLDialect
SQL dialect for Microsoft SQL Server.
-
SQLite: SQLDialect
SQLite dialect.
-
Cassandra: SQLDialect
Dialect for Cassandra's SQL-ish query language.
-
PLSQL: SQLDialect
PL/SQL dialect.
-
keywordCompletionSource(dialect: SQLDialect, upperCase?: boolean = false) → CompletionSource
Returns a completion source that provides keyword completion for the given SQL dialect.
-
schemaCompletionSource(config: SQLConfig) → CompletionSource
Returns a completion sources that provides schema-based completion for the given configuration.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/dispatch.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/dispatch.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/codemirror/lang-sql/dispatch.yml/main?enable=pin
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Score
3.6
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More