diff --git a/.gitignore b/.gitignore index 03243fea..193cb599 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,9 @@ /*.iml /node_modules/ /out/ +/esm/ /release/ .history /docs/ .DS_Store +*.tgz diff --git a/package.json b/package.json index 6c3ba43b..2854018f 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,12 @@ "version": "0.12.0-beta.ng.2", "description": "SQL languages for the Monaco Editor, based on monaco-languages.", "scripts": { - "compile": "mrmdir ./out && tsc -p ./tsconfig.amd.json && tsc -p ./tsconfig.esm.json", + "build": "mrmdir ./esm && tsc -p ./tsconfig.esm.json", + "build-amd": "mrmdir ./out && tsc -p ./tsconfig.amd.json", "watch-esm": "tsc -p ./tsconfig.esm.json --watch", - "test": "npm run compile && mocha ./test/all.js", - "prepublishOnly": "npm run compile", - "prettier": "prettier --write .", + "test": "npm run build-amd && mocha ./test/all.js", + "prepublishOnly": "npm run build", + "prettier": "prettier --write ./src", "check-types": "tsc -p ./tsconfig.json", "dev": "node --max_old_space_size=4092 & cd website && npm run dev", "prod": "mrmdir ./docs && node --max_old_space_size=4092 & cd website && npm run build", @@ -16,11 +17,11 @@ }, "author": "DTStack Corporation", "license": "MIT", - "main": "out/esm/main.js", - "module": "out/esm/main.js", - "types": "out/esm/main.d.ts", + "main": "esm/main.js", + "module": "esm/main.js", + "types": "esm/main.d.ts", "files": [ - "out" + "esm" ], "repository": { "type": "git", diff --git a/scripts/bundle.js b/scripts/bundle.js deleted file mode 100644 index a02c3348..00000000 --- a/scripts/bundle.js +++ /dev/null @@ -1,72 +0,0 @@ -const requirejs = require('requirejs'); -const path = require('path'); -const fs = require('fs'); -const terser = require('terser'); -const glob = require('glob'); -const helpers = require('monaco-plugin-helpers'); - -const REPO_ROOT = path.resolve(__dirname, '..'); - -const sha1 = helpers.getGitVersion(REPO_ROOT); -const semver = require('../package.json').version; -const headerVersion = semver + '(' + sha1 + ')'; - -const BUNDLED_FILE_HEADER = [ - '/*!-----------------------------------------------------------------------------', - ' * Copyright (c) Microsoft Corporation. All rights reserved.', - ' * monaco-languages version: ' + headerVersion, - ' * Released under the MIT license', - ' * https://github.com/Microsoft/monaco-languages/blob/master/LICENSE.md', - ' *-----------------------------------------------------------------------------*/', - '' -].join('\n'); - -bundleOne('monaco.contribution'); -glob('out/amd/*/*.contribution.js', { cwd: path.dirname(__dirname) }, function (err, files) { - if (err) { - console.log(err); - return; - } - files.forEach(function (file) { - file = file.replace(/\.contribution\.js$/, ''); - file = file.replace(/out[/\\]amd[/\\]/, ''); - bundleOne(file, ['vs/basic-languages/monaco.contribution']); - }); -}); - -function bundleOne(moduleId, exclude) { - requirejs.optimize( - { - baseUrl: 'out/amd/', - name: 'vs/basic-languages/' + moduleId, - out: 'release/dev/' + moduleId + '.js', - exclude: exclude, - paths: { - 'vs/basic-languages': REPO_ROOT + '/out/amd', - 'vs/basic-languages/fillers/monaco-editor-core': - REPO_ROOT + '/out/amd/fillers/monaco-editor-core-amd' - }, - optimize: 'none' - }, - async function (buildResponse) { - const devFilePath = path.join(REPO_ROOT, 'release/dev/' + moduleId + '.js'); - const minFilePath = path.join(REPO_ROOT, 'release/min/' + moduleId + '.js'); - const fileContents = fs.readFileSync(devFilePath).toString(); - console.log(); - console.log(`Minifying ${devFilePath}...`); - const result = await terser.minify(fileContents, { - output: { - comments: 'some' - } - }); - console.log(`Done minifying ${devFilePath}.`); - try { - fs.mkdirSync(path.join(REPO_ROOT, 'release/min')); - } catch (err) {} - try { - fs.mkdirSync(path.dirname(minFilePath)); - } catch (err) {} - fs.writeFileSync(minFilePath, BUNDLED_FILE_HEADER + result.code); - } - ); -} diff --git a/scripts/release.js b/scripts/release.js deleted file mode 100644 index e9a3e421..00000000 --- a/scripts/release.js +++ /dev/null @@ -1,17 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -const path = require('path'); -const helpers = require('monaco-plugin-helpers'); - -const REPO_ROOT = path.join(__dirname, '../'); - -helpers.packageESM({ - repoRoot: REPO_ROOT, - esmSource: 'out/esm', - esmDestination: 'release/esm', - entryPoints: ['monaco.contribution.js'], - resolveSkip: ['monaco-editor'] -}); diff --git a/src/all.contributions.ts b/src/all.contributions.ts index 553b85c9..8989152f 100644 --- a/src/all.contributions.ts +++ b/src/all.contributions.ts @@ -1,9 +1,7 @@ -import './flinksql/flinksql.contribution'; -import './sparksql/sparksql.contribution'; -import './hivesql/hivesql.contribution'; -import './trinosql/trinosql.contribution'; -import './sql/sql.contribution'; -import './mysql/mysql.contribution'; -import './plsql/plsql.contribution'; -import './pgsql/pgsql.contribution'; -import './impalasql/impalasql.contribution'; +import './languages/flink/flink.contribution'; +import './languages/spark/spark.contribution'; +import './languages/hive/hive.contribution'; +import './languages/trino/trino.contribution'; +import './languages/mysql/mysql.contribution'; +import './languages/pgsql/pgsql.contribution'; +import './languages/impala/impala.contribution'; diff --git a/src/flinksql/flinksql.contribution.ts b/src/languages/flink/flink.contribution.ts similarity index 72% rename from src/flinksql/flinksql.contribution.ts rename to src/languages/flink/flink.contribution.ts index c75b9605..5efc8c86 100644 --- a/src/flinksql/flinksql.contribution.ts +++ b/src/languages/flink/flink.contribution.ts @@ -3,15 +3,15 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { registerLanguage } from '../_.contribution'; -import { setupLanguageFeatures } from '../setupLanguageFeatures'; -import { LanguageIdEnum } from '../common/constants'; +import { registerLanguage } from '../../_.contribution'; +import { setupLanguageFeatures } from '../../setupLanguageFeatures'; +import { LanguageIdEnum } from '../../common/constants'; registerLanguage({ id: LanguageIdEnum.FLINK, extensions: ['.flinksql'], aliases: ['FlinkSQL', 'flink', 'Flink'], - loader: () => import('./flinksql') + loader: () => import('./flink') }); setupLanguageFeatures(LanguageIdEnum.FLINK, { diff --git a/src/flinksql/flinksql.test.ts b/src/languages/flink/flink.test.ts similarity index 100% rename from src/flinksql/flinksql.test.ts rename to src/languages/flink/flink.test.ts diff --git a/src/flinksql/flinksql.ts b/src/languages/flink/flink.ts similarity index 98% rename from src/flinksql/flinksql.ts rename to src/languages/flink/flink.ts index bf10c1c9..81b4f820 100644 --- a/src/flinksql/flinksql.ts +++ b/src/languages/flink/flink.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { languages } from '../fillers/monaco-editor-core'; -import { TokenClassConsts } from '../common/constants'; +import type { languages } from '../../fillers/monaco-editor-core'; +import { TokenClassConsts } from '../../common/constants'; export const conf: languages.LanguageConfiguration = { comments: { diff --git a/src/flinksql/flinksql.worker.ts b/src/languages/flink/flink.worker.ts similarity index 63% rename from src/flinksql/flinksql.worker.ts rename to src/languages/flink/flink.worker.ts index 26edc942..64d3e729 100644 --- a/src/flinksql/flinksql.worker.ts +++ b/src/languages/flink/flink.worker.ts @@ -1,7 +1,7 @@ -import { worker } from '../fillers/monaco-editor-core'; +import { worker } from '../../fillers/monaco-editor-core'; import * as EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker.js'; -import { FLinkSQLWorker } from './flinkSQLWorker'; -import { ICreateData } from '../baseSQLWorker'; +import { FLinkSQLWorker } from './flinkWorker'; +import { ICreateData } from '../../baseSQLWorker'; self.onmessage = () => { // ignore the first message diff --git a/src/flinksql/flinkSQLWorker.ts b/src/languages/flink/flinkWorker.ts similarity index 79% rename from src/flinksql/flinkSQLWorker.ts rename to src/languages/flink/flinkWorker.ts index 75fbfbae..92a70206 100644 --- a/src/flinksql/flinkSQLWorker.ts +++ b/src/languages/flink/flinkWorker.ts @@ -1,6 +1,6 @@ -import { worker } from '../fillers/monaco-editor-core'; +import { worker } from '../../fillers/monaco-editor-core'; import { FlinkSQL } from 'dt-sql-parser/dist/parser/flink'; -import { BaseSQLWorker, ICreateData } from '../baseSQLWorker'; +import { BaseSQLWorker, ICreateData } from '../../baseSQLWorker'; export class FLinkSQLWorker extends BaseSQLWorker { protected _ctx: worker.IWorkerContext; diff --git a/src/hivesql/hivesql.contribution.ts b/src/languages/hive/hive.contribution.ts similarity index 72% rename from src/hivesql/hivesql.contribution.ts rename to src/languages/hive/hive.contribution.ts index 7f314afb..1ec7650b 100644 --- a/src/hivesql/hivesql.contribution.ts +++ b/src/languages/hive/hive.contribution.ts @@ -3,15 +3,15 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { registerLanguage } from '../_.contribution'; -import { setupLanguageFeatures } from '../setupLanguageFeatures'; -import { LanguageIdEnum } from '../common/constants'; +import { registerLanguage } from '../../_.contribution'; +import { setupLanguageFeatures } from '../../setupLanguageFeatures'; +import { LanguageIdEnum } from '../../common/constants'; registerLanguage({ id: LanguageIdEnum.HIVE, extensions: ['.hivesql'], aliases: ['HiveSQL', 'hive', 'Hive'], - loader: () => import('./hivesql') + loader: () => import('./hive') }); setupLanguageFeatures(LanguageIdEnum.HIVE, { diff --git a/src/hivesql/hivesql.test.ts b/src/languages/hive/hive.test.ts similarity index 99% rename from src/hivesql/hivesql.test.ts rename to src/languages/hive/hive.test.ts index 9d3592d2..a4d97718 100644 --- a/src/hivesql/hivesql.test.ts +++ b/src/languages/hive/hive.test.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { testTokenization } from '../test/testRunner'; -import { TokenClassConsts, postfixTokenClass } from '../common/constants'; +import { testTokenization } from '../../test/testRunner'; +import { TokenClassConsts, postfixTokenClass } from '../../common/constants'; testTokenization('hivesql', [ // Comments diff --git a/src/hivesql/hivesql.ts b/src/languages/hive/hive.ts similarity index 98% rename from src/hivesql/hivesql.ts rename to src/languages/hive/hive.ts index 1343df26..b25539f6 100644 --- a/src/hivesql/hivesql.ts +++ b/src/languages/hive/hive.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { languages } from '../fillers/monaco-editor-core'; -import { TokenClassConsts } from '../common/constants'; +import type { languages } from '../../fillers/monaco-editor-core'; +import { TokenClassConsts } from '../../common/constants'; export const conf: languages.LanguageConfiguration = { comments: { diff --git a/src/hivesql/hivesql.worker.ts b/src/languages/hive/hive.worker.ts similarity index 63% rename from src/hivesql/hivesql.worker.ts rename to src/languages/hive/hive.worker.ts index 5a00dee1..ae8c1b6f 100644 --- a/src/hivesql/hivesql.worker.ts +++ b/src/languages/hive/hive.worker.ts @@ -1,7 +1,7 @@ -import { worker } from '../fillers/monaco-editor-core'; +import { worker } from '../../fillers/monaco-editor-core'; import * as EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker.js'; -import { ICreateData } from '../baseSQLWorker'; -import { HiveSQLWorker } from './hiveSQLWorker'; +import { ICreateData } from '../../baseSQLWorker'; +import { HiveSQLWorker } from './hiveWorker'; self.onmessage = () => { // ignore the first message diff --git a/src/hivesql/hiveSQLWorker.ts b/src/languages/hive/hiveWorker.ts similarity index 78% rename from src/hivesql/hiveSQLWorker.ts rename to src/languages/hive/hiveWorker.ts index 9cab245d..e1994009 100644 --- a/src/hivesql/hiveSQLWorker.ts +++ b/src/languages/hive/hiveWorker.ts @@ -1,6 +1,6 @@ -import { worker } from '../fillers/monaco-editor-core'; +import { worker } from '../../fillers/monaco-editor-core'; import { HiveSQL } from 'dt-sql-parser/dist/parser/hive'; -import { BaseSQLWorker, ICreateData } from '../baseSQLWorker'; +import { BaseSQLWorker, ICreateData } from '../../baseSQLWorker'; export class HiveSQLWorker extends BaseSQLWorker { protected _ctx: worker.IWorkerContext; diff --git a/src/impalasql/impalasql.contribution.ts b/src/languages/impala/impala.contribution.ts similarity index 72% rename from src/impalasql/impalasql.contribution.ts rename to src/languages/impala/impala.contribution.ts index 28f6247c..35a6b6f0 100644 --- a/src/impalasql/impalasql.contribution.ts +++ b/src/languages/impala/impala.contribution.ts @@ -3,15 +3,15 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { registerLanguage } from '../_.contribution'; -import { setupLanguageFeatures } from '../setupLanguageFeatures'; -import { LanguageIdEnum } from '../common/constants'; +import { registerLanguage } from '../../_.contribution'; +import { setupLanguageFeatures } from '../../setupLanguageFeatures'; +import { LanguageIdEnum } from '../../common/constants'; registerLanguage({ id: LanguageIdEnum.IMPALA, extensions: ['.impalasql'], aliases: ['impalaSQL', 'impala', 'Impala'], - loader: () => import('./impalasql') + loader: () => import('./impala') }); setupLanguageFeatures(LanguageIdEnum.IMPALA, { diff --git a/src/impalasql/impalasql.test.ts b/src/languages/impala/impala.test.ts similarity index 100% rename from src/impalasql/impalasql.test.ts rename to src/languages/impala/impala.test.ts diff --git a/src/impalasql/impalasql.ts b/src/languages/impala/impala.ts similarity index 98% rename from src/impalasql/impalasql.ts rename to src/languages/impala/impala.ts index 5f73af52..b968bf68 100644 --- a/src/impalasql/impalasql.ts +++ b/src/languages/impala/impala.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { languages } from '../fillers/monaco-editor-core'; -import { TokenClassConsts } from '../common/constants'; +import type { languages } from '../../fillers/monaco-editor-core'; +import { TokenClassConsts } from '../../common/constants'; export const conf: languages.LanguageConfiguration = { comments: { diff --git a/src/impalasql/impalasql.worker.ts b/src/languages/impala/impala.worker.ts similarity index 62% rename from src/impalasql/impalasql.worker.ts rename to src/languages/impala/impala.worker.ts index 323bd430..e3e5c821 100644 --- a/src/impalasql/impalasql.worker.ts +++ b/src/languages/impala/impala.worker.ts @@ -1,7 +1,7 @@ -import { worker } from '../fillers/monaco-editor-core'; +import { worker } from '../../fillers/monaco-editor-core'; import * as EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker.js'; -import { ImpalaSQLWorker } from './impalaSQLWorker'; -import { ICreateData } from '../baseSQLWorker'; +import { ImpalaSQLWorker } from './impalaWorker'; +import { ICreateData } from '../../baseSQLWorker'; self.onmessage = () => { // ignore the first message diff --git a/src/impalasql/impalaSQLWorker.ts b/src/languages/impala/impalaWorker.ts similarity index 79% rename from src/impalasql/impalaSQLWorker.ts rename to src/languages/impala/impalaWorker.ts index 2ae4bdce..327c9b08 100644 --- a/src/impalasql/impalaSQLWorker.ts +++ b/src/languages/impala/impalaWorker.ts @@ -1,6 +1,6 @@ -import { worker } from '../fillers/monaco-editor-core'; +import { worker } from '../../fillers/monaco-editor-core'; import { ImpalaSQL } from 'dt-sql-parser/dist/parser/impala'; -import { BaseSQLWorker, ICreateData } from '../baseSQLWorker'; +import { BaseSQLWorker, ICreateData } from '../../baseSQLWorker'; export class ImpalaSQLWorker extends BaseSQLWorker { protected _ctx: worker.IWorkerContext; diff --git a/src/mysql/mysql.contribution.ts b/src/languages/mysql/mysql.contribution.ts similarity index 76% rename from src/mysql/mysql.contribution.ts rename to src/languages/mysql/mysql.contribution.ts index db78eddd..bd4c8be1 100644 --- a/src/mysql/mysql.contribution.ts +++ b/src/languages/mysql/mysql.contribution.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { registerLanguage } from '../_.contribution'; -import { setupLanguageFeatures } from '../setupLanguageFeatures'; -import { LanguageIdEnum } from '../common/constants'; +import { registerLanguage } from '../../_.contribution'; +import { setupLanguageFeatures } from '../../setupLanguageFeatures'; +import { LanguageIdEnum } from '../../common/constants'; registerLanguage({ id: LanguageIdEnum.MYSQL, diff --git a/src/mysql/mysql.test.ts b/src/languages/mysql/mysql.test.ts similarity index 99% rename from src/mysql/mysql.test.ts rename to src/languages/mysql/mysql.test.ts index b4b632d3..8089cafa 100644 --- a/src/mysql/mysql.test.ts +++ b/src/languages/mysql/mysql.test.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { testTokenization } from '../test/testRunner'; -import { TokenClassConsts, postfixTokenClass } from '../common/constants'; +import { testTokenization } from '../../test/testRunner'; +import { TokenClassConsts, postfixTokenClass } from '../../common/constants'; testTokenization('mysql', [ // Comments diff --git a/src/mysql/mysql.ts b/src/languages/mysql/mysql.ts similarity index 99% rename from src/mysql/mysql.ts rename to src/languages/mysql/mysql.ts index 4e61ecf3..6a1e03bd 100644 --- a/src/mysql/mysql.ts +++ b/src/languages/mysql/mysql.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { TokenClassConsts } from '../common/constants'; -import type { languages } from '../fillers/monaco-editor-core'; +import { TokenClassConsts } from '../../common/constants'; +import type { languages } from '../../fillers/monaco-editor-core'; export const conf: languages.LanguageConfiguration = { comments: { diff --git a/src/mysql/mysql.worker.ts b/src/languages/mysql/mysql.worker.ts similarity index 63% rename from src/mysql/mysql.worker.ts rename to src/languages/mysql/mysql.worker.ts index fd963896..6ab8c824 100644 --- a/src/mysql/mysql.worker.ts +++ b/src/languages/mysql/mysql.worker.ts @@ -1,7 +1,7 @@ -import { worker } from '../fillers/monaco-editor-core'; +import { worker } from '../../fillers/monaco-editor-core'; import * as EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker.js'; -import { ICreateData } from '../baseSQLWorker'; -import { MySQLWorker } from './mySQLWorker'; +import { ICreateData } from '../../baseSQLWorker'; +import { MySQLWorker } from './mysqlWorker'; self.onmessage = () => { // ignore the first message diff --git a/src/mysql/mySQLWorker.ts b/src/languages/mysql/mysqlWorker.ts similarity index 78% rename from src/mysql/mySQLWorker.ts rename to src/languages/mysql/mysqlWorker.ts index 57ea7699..dff29382 100644 --- a/src/mysql/mySQLWorker.ts +++ b/src/languages/mysql/mysqlWorker.ts @@ -1,6 +1,6 @@ -import { worker } from '../fillers/monaco-editor-core'; +import { worker } from '../../fillers/monaco-editor-core'; import { MySQL } from 'dt-sql-parser/dist/parser/mysql'; -import { BaseSQLWorker, ICreateData } from '../baseSQLWorker'; +import { BaseSQLWorker, ICreateData } from '../../baseSQLWorker'; export class MySQLWorker extends BaseSQLWorker { protected _ctx: worker.IWorkerContext; diff --git a/src/pgsql/PgSQLWorker.ts b/src/languages/pgsql/PgSQLWorker.ts similarity index 79% rename from src/pgsql/PgSQLWorker.ts rename to src/languages/pgsql/PgSQLWorker.ts index f5c1cea2..f5f91087 100644 --- a/src/pgsql/PgSQLWorker.ts +++ b/src/languages/pgsql/PgSQLWorker.ts @@ -1,6 +1,6 @@ -import { worker } from '../fillers/monaco-editor-core'; +import { worker } from '../../fillers/monaco-editor-core'; import { PostgreSQL } from 'dt-sql-parser/dist/parser/postgresql'; -import { BaseSQLWorker, ICreateData } from '../baseSQLWorker'; +import { BaseSQLWorker, ICreateData } from '../../baseSQLWorker'; export class PgSQLWorker extends BaseSQLWorker { protected _ctx: worker.IWorkerContext; diff --git a/src/pgsql/pgsql.contribution.ts b/src/languages/pgsql/pgsql.contribution.ts similarity index 76% rename from src/pgsql/pgsql.contribution.ts rename to src/languages/pgsql/pgsql.contribution.ts index ff934fcc..6d6adc56 100644 --- a/src/pgsql/pgsql.contribution.ts +++ b/src/languages/pgsql/pgsql.contribution.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { registerLanguage } from '../_.contribution'; -import { setupLanguageFeatures } from '../setupLanguageFeatures'; -import { LanguageIdEnum } from '../common/constants'; +import { registerLanguage } from '../../_.contribution'; +import { setupLanguageFeatures } from '../../setupLanguageFeatures'; +import { LanguageIdEnum } from '../../common/constants'; registerLanguage({ id: LanguageIdEnum.PG, diff --git a/src/pgsql/pgsql.test.ts b/src/languages/pgsql/pgsql.test.ts similarity index 99% rename from src/pgsql/pgsql.test.ts rename to src/languages/pgsql/pgsql.test.ts index 48df8845..5f8dcb21 100644 --- a/src/pgsql/pgsql.test.ts +++ b/src/languages/pgsql/pgsql.test.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { testTokenization } from '../test/testRunner'; -import { TokenClassConsts, postfixTokenClass } from '../common/constants'; +import { testTokenization } from '../../test/testRunner'; +import { TokenClassConsts, postfixTokenClass } from '../../common/constants'; testTokenization('pgsql', [ // Comments diff --git a/src/pgsql/pgsql.ts b/src/languages/pgsql/pgsql.ts similarity index 99% rename from src/pgsql/pgsql.ts rename to src/languages/pgsql/pgsql.ts index 82b0e958..0657b4f3 100644 --- a/src/pgsql/pgsql.ts +++ b/src/languages/pgsql/pgsql.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { languages } from '../fillers/monaco-editor-core'; -import { TokenClassConsts } from '../common/constants'; +import type { languages } from '../../fillers/monaco-editor-core'; +import { TokenClassConsts } from '../../common/constants'; export const conf: languages.LanguageConfiguration = { comments: { diff --git a/src/pgsql/pgsql.worker.ts b/src/languages/pgsql/pgsql.worker.ts similarity index 73% rename from src/pgsql/pgsql.worker.ts rename to src/languages/pgsql/pgsql.worker.ts index 444fecf6..6c072c94 100644 --- a/src/pgsql/pgsql.worker.ts +++ b/src/languages/pgsql/pgsql.worker.ts @@ -1,6 +1,6 @@ -import { worker } from '../fillers/monaco-editor-core'; +import { worker } from '../../fillers/monaco-editor-core'; import * as EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker.js'; -import { ICreateData } from '../baseSQLWorker'; +import { ICreateData } from '../../baseSQLWorker'; import { PgSQLWorker } from './PgSQLWorker'; self.onmessage = () => { diff --git a/src/sparksql/sparksql.contribution.ts b/src/languages/spark/spark.contribution.ts similarity index 72% rename from src/sparksql/sparksql.contribution.ts rename to src/languages/spark/spark.contribution.ts index 40fb2cc1..18c67757 100644 --- a/src/sparksql/sparksql.contribution.ts +++ b/src/languages/spark/spark.contribution.ts @@ -3,15 +3,15 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { registerLanguage } from '../_.contribution'; -import { setupLanguageFeatures } from '../setupLanguageFeatures'; -import { LanguageIdEnum } from '../common/constants'; +import { registerLanguage } from '../../_.contribution'; +import { setupLanguageFeatures } from '../../setupLanguageFeatures'; +import { LanguageIdEnum } from '../../common/constants'; registerLanguage({ id: LanguageIdEnum.SPARK, extensions: ['.sparksql'], aliases: ['SparkSQL', 'spark', 'Spark'], - loader: () => import('./sparksql') + loader: () => import('./spark') }); setupLanguageFeatures(LanguageIdEnum.SPARK, { diff --git a/src/sparksql/sparksql.test.ts b/src/languages/spark/spark.test.ts similarity index 100% rename from src/sparksql/sparksql.test.ts rename to src/languages/spark/spark.test.ts diff --git a/src/sparksql/sparksql.ts b/src/languages/spark/spark.ts similarity index 99% rename from src/sparksql/sparksql.ts rename to src/languages/spark/spark.ts index b60c1b11..5a3db275 100644 --- a/src/sparksql/sparksql.ts +++ b/src/languages/spark/spark.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { languages } from '../fillers/monaco-editor-core'; -import { TokenClassConsts } from '../common/constants'; +import type { languages } from '../../fillers/monaco-editor-core'; +import { TokenClassConsts } from '../../common/constants'; export const conf: languages.LanguageConfiguration = { comments: { diff --git a/src/sparksql/sparksql.worker.ts b/src/languages/spark/spark.worker.ts similarity index 66% rename from src/sparksql/sparksql.worker.ts rename to src/languages/spark/spark.worker.ts index d07e61f2..944dfa98 100644 --- a/src/sparksql/sparksql.worker.ts +++ b/src/languages/spark/spark.worker.ts @@ -1,7 +1,7 @@ -import { worker } from '../fillers/monaco-editor-core'; +import { worker } from '../../fillers/monaco-editor-core'; import * as EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker.js'; -import { ICreateData } from '../baseSQLWorker'; -import { SparkSQLWorker } from './sparkSQLWorker'; +import { ICreateData } from '../../baseSQLWorker'; +import { SparkSQLWorker } from './sparkWorker'; self.onmessage = () => { // ignore the first message diff --git a/src/sparksql/sparkSQLWorker.ts b/src/languages/spark/sparkWorker.ts similarity index 79% rename from src/sparksql/sparkSQLWorker.ts rename to src/languages/spark/sparkWorker.ts index 6ebcd856..d55a219e 100644 --- a/src/sparksql/sparkSQLWorker.ts +++ b/src/languages/spark/sparkWorker.ts @@ -1,6 +1,6 @@ -import { worker } from '../fillers/monaco-editor-core'; +import { worker } from '../../fillers/monaco-editor-core'; import { SparkSQL } from 'dt-sql-parser/dist/parser/spark'; -import { BaseSQLWorker, ICreateData } from '../baseSQLWorker'; +import { BaseSQLWorker, ICreateData } from '../../baseSQLWorker'; export class SparkSQLWorker extends BaseSQLWorker { protected _ctx: worker.IWorkerContext; diff --git a/src/trinosql/trinosql.contribution.ts b/src/languages/trino/trino.contribution.ts similarity index 54% rename from src/trinosql/trinosql.contribution.ts rename to src/languages/trino/trino.contribution.ts index ee6c77f0..c8971197 100644 --- a/src/trinosql/trinosql.contribution.ts +++ b/src/languages/trino/trino.contribution.ts @@ -1,12 +1,12 @@ -import { registerLanguage } from '../_.contribution'; -import { setupLanguageFeatures } from '../setupLanguageFeatures'; -import { LanguageIdEnum } from '../common/constants'; +import { registerLanguage } from '../../_.contribution'; +import { setupLanguageFeatures } from '../../setupLanguageFeatures'; +import { LanguageIdEnum } from '../../common/constants'; registerLanguage({ id: LanguageIdEnum.TRINO, extensions: ['.trinosql'], aliases: ['TrinoSQL', 'trino', 'Trino', 'prestosql', 'PrestoSQL', 'presto', 'Presto'], - loader: () => import('./trinosql') + loader: () => import('./trino') }); setupLanguageFeatures(LanguageIdEnum.TRINO, { diff --git a/src/trinosql/trinosql.ts b/src/languages/trino/trino.ts similarity index 99% rename from src/trinosql/trinosql.ts rename to src/languages/trino/trino.ts index eaa43d7a..788e9cbf 100644 --- a/src/trinosql/trinosql.ts +++ b/src/languages/trino/trino.ts @@ -1,5 +1,5 @@ -import type { languages } from '../fillers/monaco-editor-core'; -import { TokenClassConsts } from '../common/constants'; +import type { languages } from '../../fillers/monaco-editor-core'; +import { TokenClassConsts } from '../../common/constants'; export const conf: languages.LanguageConfiguration = { comments: { diff --git a/src/trinosql/trinosql.worker.ts b/src/languages/trino/trino.worker.ts similarity index 63% rename from src/trinosql/trinosql.worker.ts rename to src/languages/trino/trino.worker.ts index 579710ef..bb3960bd 100644 --- a/src/trinosql/trinosql.worker.ts +++ b/src/languages/trino/trino.worker.ts @@ -1,7 +1,7 @@ -import { worker } from '../fillers/monaco-editor-core'; +import { worker } from '../../fillers/monaco-editor-core'; import * as EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker.js'; -import { ICreateData } from '../baseSQLWorker'; -import { TrinoSQLWorker } from './TrinoSQLWorker'; +import { ICreateData } from '../../baseSQLWorker'; +import { TrinoSQLWorker } from './trinoWorker'; self.onmessage = () => { // ignore the first message diff --git a/src/trinosql/TrinoSQLWorker.ts b/src/languages/trino/trinoWorker.ts similarity index 79% rename from src/trinosql/TrinoSQLWorker.ts rename to src/languages/trino/trinoWorker.ts index 919dd860..759b6a23 100644 --- a/src/trinosql/TrinoSQLWorker.ts +++ b/src/languages/trino/trinoWorker.ts @@ -1,6 +1,6 @@ -import { worker } from '../fillers/monaco-editor-core'; +import { worker } from '../../fillers/monaco-editor-core'; import { TrinoSQL } from 'dt-sql-parser/dist/parser/trino'; -import { BaseSQLWorker, ICreateData } from '../baseSQLWorker'; +import { BaseSQLWorker, ICreateData } from '../../baseSQLWorker'; export class TrinoSQLWorker extends BaseSQLWorker { protected _ctx: worker.IWorkerContext; diff --git a/src/plsql/plSQLWorker.ts b/src/plsql/plSQLWorker.ts deleted file mode 100644 index d2810662..00000000 --- a/src/plsql/plSQLWorker.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { worker } from '../fillers/monaco-editor-core'; -import { PLSQL } from 'dt-sql-parser/dist/parser/plsql'; -import { BaseSQLWorker, ICreateData } from '../baseSQLWorker'; - -export class PLSQLWorker extends BaseSQLWorker { - protected _ctx: worker.IWorkerContext; - protected parser: PLSQL; - constructor(ctx: worker.IWorkerContext, createData: ICreateData) { - super(ctx, createData); - this._ctx = ctx; - this.parser = new PLSQL(); - } -} - -export function create(ctx: worker.IWorkerContext, createData: ICreateData): PLSQLWorker { - return new PLSQLWorker(ctx, createData); -} diff --git a/src/plsql/plsql.contribution.ts b/src/plsql/plsql.contribution.ts deleted file mode 100644 index f07606b9..00000000 --- a/src/plsql/plsql.contribution.ts +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { registerLanguage } from '../_.contribution'; -import { setupLanguageFeatures } from '../setupLanguageFeatures'; -import { LanguageIdEnum } from '../common/constants'; - -registerLanguage({ - id: LanguageIdEnum.PL, - extensions: ['.plsql'], - aliases: ['PLSQL'], - loader: () => import('./plsql') -}); - -setupLanguageFeatures(LanguageIdEnum.PL, { - completionItems: false, - diagnostics: true -}); diff --git a/src/plsql/plsql.test.ts b/src/plsql/plsql.test.ts deleted file mode 100644 index 9ece7170..00000000 --- a/src/plsql/plsql.test.ts +++ /dev/null @@ -1,692 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { testTokenization } from '../test/testRunner'; - -testTokenization('plsql', [ - // Comments - [ - { - line: '-- a comment', - tokens: [{ startIndex: 0, type: 'comment.sql' }] - } - ], - - [ - { - line: '---sticky -- comment', - tokens: [{ startIndex: 0, type: 'comment.sql' }] - } - ], - - [ - { - line: '-almost a comment', - tokens: [ - { startIndex: 0, type: 'operator.sql' }, - { startIndex: 1, type: 'identifier.sql' }, - { startIndex: 7, type: 'white.sql' }, - { startIndex: 8, type: 'identifier.sql' }, - { startIndex: 9, type: 'white.sql' }, - { startIndex: 10, type: 'identifier.sql' } - ] - } - ], - - [ - { - line: '/* a full line comment */', - tokens: [ - { startIndex: 0, type: 'comment.quote.sql' }, - { startIndex: 2, type: 'comment.sql' }, - { startIndex: 23, type: 'comment.quote.sql' } - ] - } - ], - - [ - { - line: '/* /// *** /// */', - tokens: [ - { startIndex: 0, type: 'comment.quote.sql' }, - { startIndex: 2, type: 'comment.sql' }, - { startIndex: 15, type: 'comment.quote.sql' } - ] - } - ], - - [ - { - line: 'declare @x int = /* a simple comment */ 1;', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 7, type: 'white.sql' }, - { startIndex: 8, type: 'identifier.sql' }, - { startIndex: 10, type: 'white.sql' }, - { startIndex: 11, type: 'keyword.sql' }, - { startIndex: 14, type: 'white.sql' }, - { startIndex: 15, type: 'operator.sql' }, - { startIndex: 16, type: 'white.sql' }, - { startIndex: 17, type: 'comment.quote.sql' }, - { startIndex: 19, type: 'comment.sql' }, - { startIndex: 37, type: 'comment.quote.sql' }, - { startIndex: 39, type: 'white.sql' }, - { startIndex: 40, type: 'number.sql' }, - { startIndex: 41, type: 'delimiter.sql' } - ] - } - ], - - // Not supporting nested comments, as nested comments seem to not be standard? - // i.e. http://stackoverflow.com/questions/728172/are-there-multiline-comment-delimiters-in-sql-that-are-vendor-agnostic - [ - { - line: '@x=/* a /* nested comment 1*/;', - tokens: [ - { startIndex: 0, type: 'identifier.sql' }, - { startIndex: 2, type: 'operator.sql' }, - { startIndex: 3, type: 'comment.quote.sql' }, - { startIndex: 5, type: 'comment.sql' }, - { startIndex: 28, type: 'comment.quote.sql' }, - { startIndex: 30, type: 'delimiter.sql' } - ] - } - ], - - [ - { - line: '@x=/* another comment */ 1*/;', - tokens: [ - { startIndex: 0, type: 'identifier.sql' }, - { startIndex: 2, type: 'operator.sql' }, - { startIndex: 3, type: 'comment.quote.sql' }, - { startIndex: 5, type: 'comment.sql' }, - { startIndex: 22, type: 'comment.quote.sql' }, - { startIndex: 24, type: 'white.sql' }, - { startIndex: 25, type: 'number.sql' }, - { startIndex: 26, type: 'operator.sql' }, - { startIndex: 28, type: 'delimiter.sql' } - ] - } - ], - - [ - { - line: '@x=/*/;', - tokens: [ - { startIndex: 0, type: 'identifier.sql' }, - { startIndex: 2, type: 'operator.sql' }, - { startIndex: 3, type: 'comment.quote.sql' }, - { startIndex: 5, type: 'comment.sql' } - ] - } - ], - - // Numbers - [ - { - line: '123', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '-123', - tokens: [ - { startIndex: 0, type: 'operator.sql' }, - { startIndex: 1, type: 'number.sql' } - ] - } - ], - - [ - { - line: '0xaBc123', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '0XaBc123', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '0x', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '0x0', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '0xAB_CD', - tokens: [ - { startIndex: 0, type: 'number.sql' }, - { startIndex: 4, type: 'identifier.sql' } - ] - } - ], - - [ - { - line: '$', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '$-123', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '$-+-123', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '$123.5678', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '$0.99', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '$.99', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '$99.', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '$0.', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '$.0', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '.', - tokens: [{ startIndex: 0, type: 'delimiter.sql' }] - } - ], - - [ - { - line: '123', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '123.5678', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '0.99', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '.99', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '99.', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '0.', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '.0', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '1E-2', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '1E+2', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '1E2', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '0.1E2', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '1.E2', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '.1E2', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - // Identifiers - [ - { - line: '_abc$01', - tokens: [{ startIndex: 0, type: 'identifier.sql' }] - } - ], - - [ - { - line: '#abc$01', - tokens: [{ startIndex: 0, type: 'identifier.sql' }] - } - ], - - [ - { - line: '##abc$01', - tokens: [{ startIndex: 0, type: 'identifier.sql' }] - } - ], - - [ - { - line: '@abc$01', - tokens: [{ startIndex: 0, type: 'identifier.sql' }] - } - ], - - [ - { - line: '@@abc$01', - tokens: [{ startIndex: 0, type: 'identifier.sql' }] - } - ], - - [ - { - line: '$abc', - tokens: [{ startIndex: 0, type: 'identifier.sql' }] - } - ], - - [ - { - line: '$action', - tokens: [{ startIndex: 0, type: 'predefined.sql' }] - } - ], - - [ - { - line: '$nonexistent', - tokens: [{ startIndex: 0, type: 'identifier.sql' }] - } - ], - - [ - { - line: '@@DBTS', - tokens: [{ startIndex: 0, type: 'predefined.sql' }] - } - ], - - [ - { - line: '@@nonexistent', - tokens: [{ startIndex: 0, type: 'identifier.sql' }] - } - ], - - [ - { - line: 'declare [abc 321];', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 7, type: 'white.sql' }, - { startIndex: 8, type: 'identifier.quote.sql' }, - { startIndex: 9, type: 'identifier.sql' }, - { startIndex: 16, type: 'identifier.quote.sql' }, - { startIndex: 17, type: 'delimiter.sql' } - ] - } - ], - - [ - { - line: '[abc[[ 321 ]] xyz]', - tokens: [ - { startIndex: 0, type: 'identifier.quote.sql' }, - { startIndex: 1, type: 'identifier.sql' }, - { startIndex: 17, type: 'identifier.quote.sql' } - ] - } - ], - - [ - { - line: '[abc', - tokens: [ - { startIndex: 0, type: 'identifier.quote.sql' }, - { startIndex: 1, type: 'identifier.sql' } - ] - } - ], - - [ - { - line: 'declare "abc 321";', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 7, type: 'white.sql' }, - { startIndex: 8, type: 'identifier.quote.sql' }, - { startIndex: 9, type: 'identifier.sql' }, - { startIndex: 16, type: 'identifier.quote.sql' }, - { startIndex: 17, type: 'delimiter.sql' } - ] - } - ], - - [ - { - line: '"abc"" 321 "" xyz"', - tokens: [ - { startIndex: 0, type: 'identifier.quote.sql' }, - { startIndex: 1, type: 'identifier.sql' }, - { startIndex: 17, type: 'identifier.quote.sql' } - ] - } - ], - - [ - { - line: '"abc', - tokens: [ - { startIndex: 0, type: 'identifier.quote.sql' }, - { startIndex: 1, type: 'identifier.sql' } - ] - } - ], - - [ - { - line: 'int', - tokens: [{ startIndex: 0, type: 'keyword.sql' }] - } - ], - - [ - { - line: '[int]', - tokens: [ - { startIndex: 0, type: 'identifier.quote.sql' }, - { startIndex: 1, type: 'identifier.sql' }, - { startIndex: 4, type: 'identifier.quote.sql' } - ] - } - ], - - // Strings - [ - { - line: "declare @x='a string';", - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 7, type: 'white.sql' }, - { startIndex: 8, type: 'identifier.sql' }, - { startIndex: 10, type: 'operator.sql' }, - { startIndex: 11, type: 'string.sql' }, - { startIndex: 21, type: 'delimiter.sql' } - ] - } - ], - - [ - { - line: "'a '' string with quotes'", - tokens: [{ startIndex: 0, type: 'string.sql' }] - } - ], - - [ - { - line: "'a \" string with quotes'", - tokens: [{ startIndex: 0, type: 'string.sql' }] - } - ], - - [ - { - line: "'a -- string with comment'", - tokens: [{ startIndex: 0, type: 'string.sql' }] - } - ], - - [ - { - line: "N'a unicode string'", - tokens: [{ startIndex: 0, type: 'string.sql' }] - } - ], - - [ - { - line: "'a endless string", - tokens: [{ startIndex: 0, type: 'string.sql' }] - } - ], - - // Operators - [ - { - line: 'SET @x=@x+1', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 3, type: 'white.sql' }, - { startIndex: 4, type: 'identifier.sql' }, - { startIndex: 6, type: 'operator.sql' }, - { startIndex: 7, type: 'identifier.sql' }, - { startIndex: 9, type: 'operator.sql' }, - { startIndex: 10, type: 'number.sql' } - ] - } - ], - - [ - { - line: '@x^=@x', - tokens: [ - { startIndex: 0, type: 'identifier.sql' }, - { startIndex: 2, type: 'operator.sql' }, - { startIndex: 4, type: 'identifier.sql' } - ] - } - ], - - [ - { - line: 'WHERE x IS NOT NULL', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 5, type: 'white.sql' }, - { startIndex: 6, type: 'identifier.sql' }, - { startIndex: 7, type: 'white.sql' }, - { startIndex: 8, type: 'operator.sql' }, - { startIndex: 10, type: 'white.sql' }, - { startIndex: 11, type: 'operator.sql' }, - { startIndex: 14, type: 'white.sql' }, - { startIndex: 15, type: 'operator.sql' } - ] - } - ], - - [ - { - line: 'SELECT * FROM dbo.MyTable WHERE MyColumn IN (1,2)', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 6, type: 'white.sql' }, - { startIndex: 7, type: 'operator.sql' }, - { startIndex: 8, type: 'white.sql' }, - { startIndex: 9, type: 'keyword.sql' }, - { startIndex: 13, type: 'white.sql' }, - { startIndex: 14, type: 'identifier.sql' }, - { startIndex: 17, type: 'delimiter.sql' }, - { startIndex: 18, type: 'identifier.sql' }, - { startIndex: 25, type: 'white.sql' }, - { startIndex: 26, type: 'keyword.sql' }, - { startIndex: 31, type: 'white.sql' }, - { startIndex: 32, type: 'identifier.sql' }, - { startIndex: 40, type: 'white.sql' }, - { startIndex: 41, type: 'operator.sql' }, - { startIndex: 43, type: 'white.sql' }, - { startIndex: 44, type: 'delimiter.parenthesis.sql' }, - { startIndex: 45, type: 'number.sql' }, - { startIndex: 46, type: 'delimiter.sql' }, - { startIndex: 47, type: 'number.sql' }, - { startIndex: 48, type: 'delimiter.parenthesis.sql' } - ] - } - ], - - // Scopes - [ - { - line: 'WHILE() BEGIN END', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 5, type: 'delimiter.parenthesis.sql' }, - { startIndex: 7, type: 'white.sql' }, - { startIndex: 8, type: 'keyword.block.sql' }, - { startIndex: 13, type: 'white.sql' }, - { startIndex: 14, type: 'keyword.block.sql' } - ] - } - ], - - [ - { - line: 'BEGIN TRAN BEGIN TRY SELECT $ COMMIT END TRY BEGIN CATCH ROLLBACK END CATCH', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 10, type: 'white.sql' }, - { startIndex: 11, type: 'keyword.try.sql' }, - { startIndex: 20, type: 'white.sql' }, - { startIndex: 21, type: 'keyword.sql' }, - { startIndex: 27, type: 'white.sql' }, - { startIndex: 28, type: 'number.sql' }, - { startIndex: 29, type: 'white.sql' }, - { startIndex: 30, type: 'keyword.sql' }, - { startIndex: 36, type: 'white.sql' }, - { startIndex: 37, type: 'keyword.try.sql' }, - { startIndex: 44, type: 'white.sql' }, - { startIndex: 45, type: 'keyword.catch.sql' }, - { startIndex: 56, type: 'white.sql' }, - { startIndex: 57, type: 'keyword.sql' }, - { startIndex: 65, type: 'white.sql' }, - { startIndex: 66, type: 'keyword.catch.sql' } - ] - } - ], - - [ - { - line: 'SELECT CASE $ WHEN 3 THEN 4 ELSE 5 END', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 6, type: 'white.sql' }, - { startIndex: 7, type: 'keyword.block.sql' }, - { startIndex: 11, type: 'white.sql' }, - { startIndex: 12, type: 'number.sql' }, - { startIndex: 13, type: 'white.sql' }, - { startIndex: 14, type: 'keyword.choice.sql' }, - { startIndex: 18, type: 'white.sql' }, - { startIndex: 19, type: 'number.sql' }, - { startIndex: 20, type: 'white.sql' }, - { startIndex: 21, type: 'keyword.choice.sql' }, - { startIndex: 25, type: 'white.sql' }, - { startIndex: 26, type: 'number.sql' }, - { startIndex: 27, type: 'white.sql' }, - { startIndex: 28, type: 'keyword.sql' }, - { startIndex: 32, type: 'white.sql' }, - { startIndex: 33, type: 'number.sql' }, - { startIndex: 34, type: 'white.sql' }, - { startIndex: 35, type: 'keyword.block.sql' } - ] - } - ] -]); diff --git a/src/plsql/plsql.ts b/src/plsql/plsql.ts deleted file mode 100644 index 1624ca8a..00000000 --- a/src/plsql/plsql.ts +++ /dev/null @@ -1,1403 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import type { languages } from '../fillers/monaco-editor-core'; - -export const conf: languages.LanguageConfiguration = { - comments: { - lineComment: '--', - blockComment: ['/*', '*/'] - }, - brackets: [ - ['{', '}'], - ['[', ']'], - ['(', ')'] - ], - autoClosingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '"', close: '"' }, - { open: "'", close: "'" } - ], - surroundingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '"', close: '"' }, - { open: "'", close: "'" } - ] -}; - -export const language = { - defaultToken: '', - tokenPostfix: '.sql', - ignoreCase: true, - - brackets: [ - { open: '[', close: ']', token: 'delimiter.square' }, - { open: '(', close: ')', token: 'delimiter.parenthesis' } - ], - - keywords: [ - 'ABORT_AFTER_WAIT', - 'ABSENT', - 'ABSOLUTE', - 'ACCENT_SENSITIVITY', - 'ACTION', - 'ACTIVATION', - 'ACTIVE', - 'ADD', - 'ADDRESS', - 'ADMIN', - 'AES', - 'AES_128', - 'AES_192', - 'AES_256', - 'AFFINITY', - 'AFTER', - 'AGGREGATE', - 'ALGORITHM', - 'ALL_CONSTRAINTS', - 'ALL_ERRORMSGS', - 'ALL_INDEXES', - 'ALL_LEVELS', - 'ALL_SPARSE_COLUMNS', - 'ALLOW_CONNECTIONS', - 'ALLOW_MULTIPLE_EVENT_LOSS', - 'ALLOW_PAGE_LOCKS', - 'ALLOW_ROW_LOCKS', - 'ALLOW_SINGLE_EVENT_LOSS', - 'ALLOW_SNAPSHOT_ISOLATION', - 'ALLOWED', - 'ALTER', - 'ANONYMOUS', - 'ANSI_DEFAULTS', - 'ANSI_NULL_DEFAULT', - 'ANSI_NULL_DFLT_OFF', - 'ANSI_NULL_DFLT_ON', - 'ANSI_NULLS', - 'ANSI_PADDING', - 'ANSI_WARNINGS', - 'APPEND', - 'APPLICATION', - 'APPLICATION_LOG', - 'ARITHABORT', - 'ARITHIGNORE', - 'AS', - 'ASC', - 'ASSEMBLY', - 'ASYMMETRIC', - 'ASYNCHRONOUS_COMMIT', - 'AT', - 'ATOMIC', - 'ATTACH', - 'ATTACH_REBUILD_LOG', - 'AUDIT', - 'AUDIT_GUID', - 'AUTHENTICATION', - 'AUTHORIZATION', - 'AUTO', - 'AUTO_CLEANUP', - 'AUTO_CLOSE', - 'AUTO_CREATE_STATISTICS', - 'AUTO_SHRINK', - 'AUTO_UPDATE_STATISTICS', - 'AUTO_UPDATE_STATISTICS_ASYNC', - 'AUTOMATED_BACKUP_PREFERENCE', - 'AUTOMATIC', - 'AVAILABILITY', - 'AVAILABILITY_MODE', - 'BACKUP', - 'BACKUP_PRIORITY', - 'BASE64', - 'BATCHSIZE', - 'BEGIN', - 'BEGIN_DIALOG', - 'BIGINT', - 'BINARY', - 'BINDING', - 'BIT', - 'BLOCKERS', - 'BLOCKSIZE', - 'BOUNDING_BOX', - 'BREAK', - 'BROKER', - 'BROKER_INSTANCE', - 'BROWSE', - 'BUCKET_COUNT', - 'BUFFER', - 'BUFFERCOUNT', - 'BULK', - 'BULK_LOGGED', - 'BY', - 'CACHE', - 'CALL', - 'CALLED', - 'CALLER', - 'CAP_CPU_PERCENT', - 'CASCADE', - 'CASE', - 'CATALOG', - 'CATCH', - 'CELLS_PER_OBJECT', - 'CERTIFICATE', - 'CHANGE_RETENTION', - 'CHANGE_TRACKING', - 'CHANGES', - 'CHAR', - 'CHARACTER', - 'CHECK', - 'CHECK_CONSTRAINTS', - 'CHECK_EXPIRATION', - 'CHECK_POLICY', - 'CHECKALLOC', - 'CHECKCATALOG', - 'CHECKCONSTRAINTS', - 'CHECKDB', - 'CHECKFILEGROUP', - 'CHECKIDENT', - 'CHECKPOINT', - 'CHECKTABLE', - 'CLASSIFIER_FUNCTION', - 'CLEANTABLE', - 'CLEANUP', - 'CLEAR', - 'CLOSE', - 'CLUSTER', - 'CLUSTERED', - 'CODEPAGE', - 'COLLATE', - 'COLLECTION', - 'COLUMN', - 'COLUMN_SET', - 'COLUMNS', - 'COLUMNSTORE', - 'COLUMNSTORE_ARCHIVE', - 'COMMIT', - 'COMMITTED', - 'COMPATIBILITY_LEVEL', - 'COMPRESSION', - 'COMPUTE', - 'CONCAT', - 'CONCAT_NULL_YIELDS_NULL', - 'CONFIGURATION', - 'CONNECT', - 'CONSTRAINT', - 'CONTAINMENT', - 'CONTENT', - 'CONTEXT', - 'CONTINUE', - 'CONTINUE_AFTER_ERROR', - 'CONTRACT', - 'CONTRACT_NAME', - 'CONTROL', - 'CONVERSATION', - 'COOKIE', - 'COPY_ONLY', - 'COUNTER', - 'CPU', - 'CREATE', - 'CREATE_NEW', - 'CREATION_DISPOSITION', - 'CREDENTIAL', - 'CRYPTOGRAPHIC', - 'CUBE', - 'CURRENT', - 'CURRENT_DATE', - 'CURSOR', - 'CURSOR_CLOSE_ON_COMMIT', - 'CURSOR_DEFAULT', - 'CYCLE', - 'DATA', - 'DATA_COMPRESSION', - 'DATA_PURITY', - 'DATABASE', - 'DATABASE_DEFAULT', - 'DATABASE_MIRRORING', - 'DATABASE_SNAPSHOT', - 'DATAFILETYPE', - 'DATE', - 'DATE_CORRELATION_OPTIMIZATION', - 'DATEFIRST', - 'DATEFORMAT', - 'DATETIME', - 'DATETIME2', - 'DATETIMEOFFSET', - 'DAY', - 'DAYOFYEAR', - 'DAYS', - 'DB_CHAINING', - 'DBCC', - 'DBREINDEX', - 'DDL_DATABASE_LEVEL_EVENTS', - 'DEADLOCK_PRIORITY', - 'DEALLOCATE', - 'DEC', - 'DECIMAL', - 'DECLARE', - 'DECRYPTION', - 'DEFAULT', - 'DEFAULT_DATABASE', - 'DEFAULT_FULLTEXT_LANGUAGE', - 'DEFAULT_LANGUAGE', - 'DEFAULT_SCHEMA', - 'DEFINITION', - 'DELAY', - 'DELAYED_DURABILITY', - 'DELETE', - 'DELETED', - 'DENSITY_VECTOR', - 'DENY', - 'DEPENDENTS', - 'DES', - 'DESC', - 'DESCRIPTION', - 'DESX', - 'DHCP', - 'DIAGNOSTICS', - 'DIALOG', - 'DIFFERENTIAL', - 'DIRECTORY_NAME', - 'DISABLE', - 'DISABLE_BROKER', - 'DISABLED', - 'DISK', - 'DISTINCT', - 'DISTRIBUTED', - 'DOCUMENT', - 'DOUBLE', - 'DROP', - 'DROP_EXISTING', - 'DROPCLEANBUFFERS', - 'DUMP', - 'DURABILITY', - 'DYNAMIC', - 'EDITION', - 'ELEMENTS', - 'ELSE', - 'EMERGENCY', - 'EMPTY', - 'EMPTYFILE', - 'ENABLE', - 'ENABLE_BROKER', - 'ENABLED', - 'ENCRYPTION', - 'END', - 'ENDPOINT', - 'ENDPOINT_URL', - 'ERRLVL', - 'ERROR', - 'ERROR_BROKER_CONVERSATIONS', - 'ERRORFILE', - 'ESCAPE', - 'ESTIMATEONLY', - 'EVENT', - 'EVENT_RETENTION_MODE', - 'EXEC', - 'EXECUTABLE', - 'EXECUTE', - 'EXIT', - 'EXPAND', - 'EXPIREDATE', - 'EXPIRY_DATE', - 'EXPLICIT', - 'EXTENDED_LOGICAL_CHECKS', - 'EXTENSION', - 'EXTERNAL', - 'EXTERNAL_ACCESS', - 'FAIL_OPERATION', - 'FAILOVER', - 'FAILOVER_MODE', - 'FAILURE_CONDITION_LEVEL', - 'FALSE', - 'FAN_IN', - 'FAST', - 'FAST_FORWARD', - 'FETCH', - 'FIELDTERMINATOR', - 'FILE', - 'FILEGROUP', - 'FILEGROWTH', - 'FILELISTONLY', - 'FILENAME', - 'FILEPATH', - 'FILESTREAM', - 'FILESTREAM_ON', - 'FILETABLE_COLLATE_FILENAME', - 'FILETABLE_DIRECTORY', - 'FILETABLE_FULLPATH_UNIQUE_CONSTRAINT_NAME', - 'FILETABLE_NAMESPACE', - 'FILETABLE_PRIMARY_KEY_CONSTRAINT_NAME', - 'FILETABLE_STREAMID_UNIQUE_CONSTRAINT_NAME', - 'FILLFACTOR', - 'FILTERING', - 'FIRE_TRIGGERS', - 'FIRST', - 'FIRSTROW', - 'FLOAT', - 'FMTONLY', - 'FOLLOWING', - 'FOR', - 'FORCE', - 'FORCE_FAILOVER_ALLOW_DATA_LOSS', - 'FORCE_SERVICE_ALLOW_DATA_LOSS', - 'FORCED', - 'FORCEPLAN', - 'FORCESCAN', - 'FORCESEEK', - 'FOREIGN', - 'FORMATFILE', - 'FORMSOF', - 'FORWARD_ONLY', - 'FREE', - 'FREEPROCCACHE', - 'FREESESSIONCACHE', - 'FREESYSTEMCACHE', - 'FROM', - 'FULL', - 'FULLSCAN', - 'FULLTEXT', - 'FUNCTION', - 'GB', - 'GEOGRAPHY_AUTO_GRID', - 'GEOGRAPHY_GRID', - 'GEOMETRY_AUTO_GRID', - 'GEOMETRY_GRID', - 'GET', - 'GLOBAL', - 'GO', - 'GOTO', - 'GOVERNOR', - 'GRANT', - 'GRIDS', - 'GROUP', - 'GROUP_MAX_REQUESTS', - 'HADR', - 'HASH', - 'HASHED', - 'HAVING', - 'HEADERONLY', - 'HEALTH_CHECK_TIMEOUT', - 'HELP', - 'HIERARCHYID', - 'HIGH', - 'HINT', - 'HISTOGRAM', - 'HOLDLOCK', - 'HONOR_BROKER_PRIORITY', - 'HOUR', - 'HOURS', - 'IDENTITY', - 'IDENTITY_INSERT', - 'IDENTITY_VALUE', - 'IDENTITYCOL', - 'IF', - 'IGNORE_CONSTRAINTS', - 'IGNORE_DUP_KEY', - 'IGNORE_NONCLUSTERED_COLUMNSTORE_INDEX', - 'IGNORE_TRIGGERS', - 'IMAGE', - 'IMMEDIATE', - 'IMPERSONATE', - 'IMPLICIT_TRANSACTIONS', - 'IMPORTANCE', - 'INCLUDE', - 'INCREMENT', - 'INCREMENTAL', - 'INDEX', - 'INDEXDEFRAG', - 'INFINITE', - 'INFLECTIONAL', - 'INIT', - 'INITIATOR', - 'INPUT', - 'INPUTBUFFER', - 'INSENSITIVE', - 'INSERT', - 'INSERTED', - 'INSTEAD', - 'INT', - 'INTEGER', - 'INTO', - 'IO', - 'IP', - 'ISABOUT', - 'ISOLATION', - 'JOB', - 'KB', - 'KEEP', - 'KEEP_CDC', - 'KEEP_NULLS', - 'KEEP_REPLICATION', - 'KEEPDEFAULTS', - 'KEEPFIXED', - 'KEEPIDENTITY', - 'KEEPNULLS', - 'KERBEROS', - 'KEY', - 'KEY_SOURCE', - 'KEYS', - 'KEYSET', - 'KILL', - 'KILOBYTES_PER_BATCH', - 'LABELONLY', - 'LANGUAGE', - 'LAST', - 'LASTROW', - 'LEVEL', - 'LEVEL_1', - 'LEVEL_2', - 'LEVEL_3', - 'LEVEL_4', - 'LIFETIME', - 'LIMIT', - 'LINENO', - 'LIST', - 'LISTENER', - 'LISTENER_IP', - 'LISTENER_PORT', - 'LOAD', - 'LOADHISTORY', - 'LOB_COMPACTION', - 'LOCAL', - 'LOCAL_SERVICE_NAME', - 'LOCK_ESCALATION', - 'LOCK_TIMEOUT', - 'LOGIN', - 'LOGSPACE', - 'LOOP', - 'LOW', - 'MANUAL', - 'MARK', - 'MARK_IN_USE_FOR_REMOVAL', - 'MASTER', - 'MAX_CPU_PERCENT', - 'MAX_DISPATCH_LATENCY', - 'MAX_DOP', - 'MAX_DURATION', - 'MAX_EVENT_SIZE', - 'MAX_FILES', - 'MAX_IOPS_PER_VOLUME', - 'MAX_MEMORY', - 'MAX_MEMORY_PERCENT', - 'MAX_QUEUE_READERS', - 'MAX_ROLLOVER_FILES', - 'MAX_SIZE', - 'MAXDOP', - 'MAXERRORS', - 'MAXLENGTH', - 'MAXRECURSION', - 'MAXSIZE', - 'MAXTRANSFERSIZE', - 'MAXVALUE', - 'MB', - 'MEDIADESCRIPTION', - 'MEDIANAME', - 'MEDIAPASSWORD', - 'MEDIUM', - 'MEMBER', - 'MEMORY_OPTIMIZED', - 'MEMORY_OPTIMIZED_DATA', - 'MEMORY_OPTIMIZED_ELEVATE_TO_SNAPSHOT', - 'MEMORY_PARTITION_MODE', - 'MERGE', - 'MESSAGE', - 'MESSAGE_FORWARD_SIZE', - 'MESSAGE_FORWARDING', - 'MICROSECOND', - 'MILLISECOND', - 'MIN_CPU_PERCENT', - 'MIN_IOPS_PER_VOLUME', - 'MIN_MEMORY_PERCENT', - 'MINUTE', - 'MINUTES', - 'MINVALUE', - 'MIRROR', - 'MIRROR_ADDRESS', - 'MODIFY', - 'MONEY', - 'MONTH', - 'MOVE', - 'MULTI_USER', - 'MUST_CHANGE', - 'NAME', - 'NANOSECOND', - 'NATIONAL', - 'NATIVE_COMPILATION', - 'NCHAR', - 'NEGOTIATE', - 'NESTED_TRIGGERS', - 'NEW_ACCOUNT', - 'NEW_BROKER', - 'NEW_PASSWORD', - 'NEWNAME', - 'NEXT', - 'NO', - 'NO_BROWSETABLE', - 'NO_CHECKSUM', - 'NO_COMPRESSION', - 'NO_EVENT_LOSS', - 'NO_INFOMSGS', - 'NO_TRUNCATE', - 'NO_WAIT', - 'NOCHECK', - 'NOCOUNT', - 'NOEXEC', - 'NOEXPAND', - 'NOFORMAT', - 'NOINDEX', - 'NOINIT', - 'NOLOCK', - 'NON', - 'NON_TRANSACTED_ACCESS', - 'NONCLUSTERED', - 'NONE', - 'NORECOMPUTE', - 'NORECOVERY', - 'NORESEED', - 'NORESET', - 'NOREWIND', - 'NORMAL', - 'NOSKIP', - 'NOTIFICATION', - 'NOTRUNCATE', - 'NOUNLOAD', - 'NOWAIT', - 'NTEXT', - 'NTLM', - 'NUMANODE', - 'NUMERIC', - 'NUMERIC_ROUNDABORT', - 'NVARCHAR', - 'OBJECT', - 'OF', - 'OFF', - 'OFFLINE', - 'OFFSET', - 'OFFSETS', - 'OLD_ACCOUNT', - 'OLD_PASSWORD', - 'ON', - 'ON_FAILURE', - 'ONLINE', - 'ONLY', - 'OPEN', - 'OPEN_EXISTING', - 'OPENTRAN', - 'OPTIMISTIC', - 'OPTIMIZE', - 'OPTION', - 'ORDER', - 'OUT', - 'OUTPUT', - 'OUTPUTBUFFER', - 'OVER', - 'OVERRIDE', - 'OWNER', - 'OWNERSHIP', - 'PAD_INDEX', - 'PAGE', - 'PAGE_VERIFY', - 'PAGECOUNT', - 'PAGLOCK', - 'PARAMETERIZATION', - 'PARSEONLY', - 'PARTIAL', - 'PARTITION', - 'PARTITIONS', - 'PARTNER', - 'PASSWORD', - 'PATH', - 'PER_CPU', - 'PER_NODE', - 'PERCENT', - 'PERMISSION_SET', - 'PERSISTED', - 'PHYSICAL_ONLY', - 'PLAN', - 'POISON_MESSAGE_HANDLING', - 'POOL', - 'POPULATION', - 'PORT', - 'PRECEDING', - 'PRECISION', - 'PRIMARY', - 'PRIMARY_ROLE', - 'PRINT', - 'PRIOR', - 'PRIORITY', - 'PRIORITY_LEVEL', - 'PRIVATE', - 'PRIVILEGES', - 'PROC', - 'PROCCACHE', - 'PROCEDURE', - 'PROCEDURE_NAME', - 'PROCESS', - 'PROFILE', - 'PROPERTY', - 'PROPERTY_DESCRIPTION', - 'PROPERTY_INT_ID', - 'PROPERTY_SET_GUID', - 'PROVIDER', - 'PROVIDER_KEY_NAME', - 'PUBLIC', - 'PUT', - 'QUARTER', - 'QUERY', - 'QUERY_GOVERNOR_COST_LIMIT', - 'QUEUE', - 'QUEUE_DELAY', - 'QUOTED_IDENTIFIER', - 'RAISERROR', - 'RANGE', - 'RAW', - 'RC2', - 'RC4', - 'RC4_128', - 'READ', - 'READ_COMMITTED_SNAPSHOT', - 'READ_ONLY', - 'READ_ONLY_ROUTING_LIST', - 'READ_ONLY_ROUTING_URL', - 'READ_WRITE', - 'READ_WRITE_FILEGROUPS', - 'READCOMMITTED', - 'READCOMMITTEDLOCK', - 'READONLY', - 'READPAST', - 'READTEXT', - 'READUNCOMMITTED', - 'READWRITE', - 'REAL', - 'REBUILD', - 'RECEIVE', - 'RECOMPILE', - 'RECONFIGURE', - 'RECOVERY', - 'RECURSIVE', - 'RECURSIVE_TRIGGERS', - 'REFERENCES', - 'REGENERATE', - 'RELATED_CONVERSATION', - 'RELATED_CONVERSATION_GROUP', - 'RELATIVE', - 'REMOTE', - 'REMOTE_PROC_TRANSACTIONS', - 'REMOTE_SERVICE_NAME', - 'REMOVE', - 'REORGANIZE', - 'REPAIR_ALLOW_DATA_LOSS', - 'REPAIR_FAST', - 'REPAIR_REBUILD', - 'REPEATABLE', - 'REPEATABLEREAD', - 'REPLICA', - 'REPLICATION', - 'REQUEST_MAX_CPU_TIME_SEC', - 'REQUEST_MAX_MEMORY_GRANT_PERCENT', - 'REQUEST_MEMORY_GRANT_TIMEOUT_SEC', - 'REQUIRED', - 'RESAMPLE', - 'RESEED', - 'RESERVE_DISK_SPACE', - 'RESET', - 'RESOURCE', - 'RESTART', - 'RESTORE', - 'RESTRICT', - 'RESTRICTED_USER', - 'RESULT', - 'RESUME', - 'RETAINDAYS', - 'RETENTION', - 'RETURN', - 'RETURNS', - 'REVERT', - 'REVOKE', - 'REWIND', - 'REWINDONLY', - 'ROBUST', - 'ROLE', - 'ROLLBACK', - 'ROLLUP', - 'ROOT', - 'ROUTE', - 'ROW', - 'ROWCOUNT', - 'ROWGUIDCOL', - 'ROWLOCK', - 'ROWS', - 'ROWS_PER_BATCH', - 'ROWTERMINATOR', - 'ROWVERSION', - 'RSA_1024', - 'RSA_2048', - 'RSA_512', - 'RULE', - 'SAFE', - 'SAFETY', - 'SAMPLE', - 'SAVE', - 'SCHEDULER', - 'SCHEMA', - 'SCHEMA_AND_DATA', - 'SCHEMA_ONLY', - 'SCHEMABINDING', - 'SCHEME', - 'SCROLL', - 'SCROLL_LOCKS', - 'SEARCH', - 'SECOND', - 'SECONDARY', - 'SECONDARY_ONLY', - 'SECONDARY_ROLE', - 'SECONDS', - 'SECRET', - 'SECURITY_LOG', - 'SECURITYAUDIT', - 'SELECT', - 'SELECTIVE', - 'SELF', - 'SEND', - 'SENT', - 'SEQUENCE', - 'SERIALIZABLE', - 'SERVER', - 'SERVICE', - 'SERVICE_BROKER', - 'SERVICE_NAME', - 'SESSION', - 'SESSION_TIMEOUT', - 'SET', - 'SETS', - 'SETUSER', - 'SHOW_STATISTICS', - 'SHOWCONTIG', - 'SHOWPLAN', - 'SHOWPLAN_ALL', - 'SHOWPLAN_TEXT', - 'SHOWPLAN_XML', - 'SHRINKDATABASE', - 'SHRINKFILE', - 'SHUTDOWN', - 'SID', - 'SIGNATURE', - 'SIMPLE', - 'SINGLE_BLOB', - 'SINGLE_CLOB', - 'SINGLE_NCLOB', - 'SINGLE_USER', - 'SINGLETON', - 'SIZE', - 'SKIP', - 'SMALLDATETIME', - 'SMALLINT', - 'SMALLMONEY', - 'SNAPSHOT', - 'SORT_IN_TEMPDB', - 'SOURCE', - 'SPARSE', - 'SPATIAL', - 'SPATIAL_WINDOW_MAX_CELLS', - 'SPECIFICATION', - 'SPLIT', - 'SQL', - 'SQL_VARIANT', - 'SQLPERF', - 'STANDBY', - 'START', - 'START_DATE', - 'STARTED', - 'STARTUP_STATE', - 'STAT_HEADER', - 'STATE', - 'STATEMENT', - 'STATIC', - 'STATISTICAL_SEMANTICS', - 'STATISTICS', - 'STATISTICS_INCREMENTAL', - 'STATISTICS_NORECOMPUTE', - 'STATS', - 'STATS_STREAM', - 'STATUS', - 'STATUSONLY', - 'STOP', - 'STOP_ON_ERROR', - 'STOPAT', - 'STOPATMARK', - 'STOPBEFOREMARK', - 'STOPLIST', - 'STOPPED', - 'SUBJECT', - 'SUBSCRIPTION', - 'SUPPORTED', - 'SUSPEND', - 'SWITCH', - 'SYMMETRIC', - 'SYNCHRONOUS_COMMIT', - 'SYNONYM', - 'SYSNAME', - 'SYSTEM', - 'TABLE', - 'TABLERESULTS', - 'TABLESAMPLE', - 'TABLOCK', - 'TABLOCKX', - 'TAKE', - 'TAPE', - 'TARGET', - 'TARGET_RECOVERY_TIME', - 'TB', - 'TCP', - 'TEXT', - 'TEXTIMAGE_ON', - 'TEXTSIZE', - 'THEN', - 'THESAURUS', - 'THROW', - 'TIES', - 'TIME', - 'TIMEOUT', - 'TIMER', - 'TIMESTAMP', - 'TINYINT', - 'TO', - 'TOP', - 'TORN_PAGE_DETECTION', - 'TRACEOFF', - 'TRACEON', - 'TRACESTATUS', - 'TRACK_CAUSALITY', - 'TRACK_COLUMNS_UPDATED', - 'TRAN', - 'TRANSACTION', - 'TRANSFER', - 'TRANSFORM_NOISE_WORDS', - 'TRIGGER', - 'TRIPLE_DES', - 'TRIPLE_DES_3KEY', - 'TRUE', - 'TRUNCATE', - 'TRUNCATEONLY', - 'TRUSTWORTHY', - 'TRY', - 'TSQL', - 'TWO_DIGIT_YEAR_CUTOFF', - 'TYPE', - 'TYPE_WARNING', - 'UNBOUNDED', - 'UNCHECKED', - 'UNCOMMITTED', - 'UNDEFINED', - 'UNIQUE', - 'UNIQUEIDENTIFIER', - 'UNKNOWN', - 'UNLIMITED', - 'UNLOAD', - 'UNSAFE', - 'UPDATE', - 'UPDATETEXT', - 'UPDATEUSAGE', - 'UPDLOCK', - 'URL', - 'USE', - 'USED', - 'USER', - 'USEROPTIONS', - 'USING', - 'VALID_XML', - 'VALIDATION', - 'VALUE', - 'VALUES', - 'VARBINARY', - 'VARCHAR', - 'VARYING', - 'VERIFYONLY', - 'VERSION', - 'VIEW', - 'VIEW_METADATA', - 'VIEWS', - 'VISIBILITY', - 'WAIT_AT_LOW_PRIORITY', - 'WAITFOR', - 'WEEK', - 'WEIGHT', - 'WELL_FORMED_XML', - 'WHEN', - 'WHERE', - 'WHILE', - 'WINDOWS', - 'WITH', - 'WITHIN', - 'WITHOUT', - 'WITNESS', - 'WORK', - 'WORKLOAD', - 'WRITETEXT', - 'XACT_ABORT', - 'XLOCK', - 'XMAX', - 'XMIN', - 'XML', - 'XMLDATA', - 'XMLNAMESPACES', - 'XMLSCHEMA', - 'XQUERY', - 'XSINIL', - 'YEAR', - 'YMAX', - 'YMIN' - ], - operators: [ - // Logical - 'ALL', - 'AND', - 'ANY', - 'BETWEEN', - 'EXISTS', - 'IN', - 'LIKE', - 'NOT', - 'OR', - 'SOME', - // Set - 'EXCEPT', - 'INTERSECT', - 'UNION', - // Join - 'APPLY', - 'CROSS', - 'FULL', - 'INNER', - 'JOIN', - 'LEFT', - 'OUTER', - 'RIGHT', - // Predicates - 'CONTAINS', - 'FREETEXT', - 'IS', - 'NULL', - // Pivoting - 'PIVOT', - 'UNPIVOT', - // Merging - 'MATCHED' - ], - builtinFunctions: [ - // Aggregate - 'AVG', - 'CHECKSUM_AGG', - 'COUNT', - 'COUNT_BIG', - 'GROUPING', - 'GROUPING_ID', - 'MAX', - 'MIN', - 'SUM', - 'STDEV', - 'STDEVP', - 'VAR', - 'VARP', - // Analytic - 'CUME_DIST', - 'FIRST_VALUE', - 'LAG', - 'LAST_VALUE', - 'LEAD', - 'PERCENTILE_CONT', - 'PERCENTILE_DISC', - 'PERCENT_RANK', - // Collation - 'COLLATE', - 'COLLATIONPROPERTY', - 'TERTIARY_WEIGHTS', - // Azure - 'FEDERATION_FILTERING_VALUE', - // Conversion - 'CAST', - 'CONVERT', - 'PARSE', - 'TRY_CAST', - 'TRY_CONVERT', - 'TRY_PARSE', - // Cryptographic - 'ASYMKEY_ID', - 'ASYMKEYPROPERTY', - 'CERTPROPERTY', - 'CERT_ID', - 'CRYPT_GEN_RANDOM', - 'DECRYPTBYASYMKEY', - 'DECRYPTBYCERT', - 'DECRYPTBYKEY', - 'DECRYPTBYKEYAUTOASYMKEY', - 'DECRYPTBYKEYAUTOCERT', - 'DECRYPTBYPASSPHRASE', - 'ENCRYPTBYASYMKEY', - 'ENCRYPTBYCERT', - 'ENCRYPTBYKEY', - 'ENCRYPTBYPASSPHRASE', - 'HASHBYTES', - 'IS_OBJECTSIGNED', - 'KEY_GUID', - 'KEY_ID', - 'KEY_NAME', - 'SIGNBYASYMKEY', - 'SIGNBYCERT', - 'SYMKEYPROPERTY', - 'VERIFYSIGNEDBYCERT', - 'VERIFYSIGNEDBYASYMKEY', - // Cursor - 'CURSOR_STATUS', - // Datatype - 'DATALENGTH', - 'IDENT_CURRENT', - 'IDENT_INCR', - 'IDENT_SEED', - 'IDENTITY', - 'SQL_VARIANT_PROPERTY', - // Datetime - 'CURRENT_TIMESTAMP', - 'DATEADD', - 'DATEDIFF', - 'DATEFROMPARTS', - 'DATENAME', - 'DATEPART', - 'DATETIME2FROMPARTS', - 'DATETIMEFROMPARTS', - 'DATETIMEOFFSETFROMPARTS', - 'DAY', - 'EOMONTH', - 'GETDATE', - 'GETUTCDATE', - 'ISDATE', - 'MONTH', - 'SMALLDATETIMEFROMPARTS', - 'SWITCHOFFSET', - 'SYSDATETIME', - 'SYSDATETIMEOFFSET', - 'SYSUTCDATETIME', - 'TIMEFROMPARTS', - 'TODATETIMEOFFSET', - 'YEAR', - // Logical - 'CHOOSE', - 'COALESCE', - 'IIF', - 'NULLIF', - // Mathematical - 'ABS', - 'ACOS', - 'ASIN', - 'ATAN', - 'ATN2', - 'CEILING', - 'COS', - 'COT', - 'DEGREES', - 'EXP', - 'FLOOR', - 'LOG', - 'LOG10', - 'PI', - 'POWER', - 'RADIANS', - 'RAND', - 'ROUND', - 'SIGN', - 'SIN', - 'SQRT', - 'SQUARE', - 'TAN', - // Metadata - 'APP_NAME', - 'APPLOCK_MODE', - 'APPLOCK_TEST', - 'ASSEMBLYPROPERTY', - 'COL_LENGTH', - 'COL_NAME', - 'COLUMNPROPERTY', - 'DATABASE_PRINCIPAL_ID', - 'DATABASEPROPERTYEX', - 'DB_ID', - 'DB_NAME', - 'FILE_ID', - 'FILE_IDEX', - 'FILE_NAME', - 'FILEGROUP_ID', - 'FILEGROUP_NAME', - 'FILEGROUPPROPERTY', - 'FILEPROPERTY', - 'FULLTEXTCATALOGPROPERTY', - 'FULLTEXTSERVICEPROPERTY', - 'INDEX_COL', - 'INDEXKEY_PROPERTY', - 'INDEXPROPERTY', - 'OBJECT_DEFINITION', - 'OBJECT_ID', - 'OBJECT_NAME', - 'OBJECT_SCHEMA_NAME', - 'OBJECTPROPERTY', - 'OBJECTPROPERTYEX', - 'ORIGINAL_DB_NAME', - 'PARSENAME', - 'SCHEMA_ID', - 'SCHEMA_NAME', - 'SCOPE_IDENTITY', - 'SERVERPROPERTY', - 'STATS_DATE', - 'TYPE_ID', - 'TYPE_NAME', - 'TYPEPROPERTY', - // Ranking - 'DENSE_RANK', - 'NTILE', - 'RANK', - 'ROW_NUMBER', - // Replication - 'PUBLISHINGSERVERNAME', - // Rowset - 'OPENDATASOURCE', - 'OPENQUERY', - 'OPENROWSET', - 'OPENXML', - // Security - 'CERTENCODED', - 'CERTPRIVATEKEY', - 'CURRENT_USER', - 'HAS_DBACCESS', - 'HAS_PERMS_BY_NAME', - 'IS_MEMBER', - 'IS_ROLEMEMBER', - 'IS_SRVROLEMEMBER', - 'LOGINPROPERTY', - 'ORIGINAL_LOGIN', - 'PERMISSIONS', - 'PWDENCRYPT', - 'PWDCOMPARE', - 'SESSION_USER', - 'SESSIONPROPERTY', - 'SUSER_ID', - 'SUSER_NAME', - 'SUSER_SID', - 'SUSER_SNAME', - 'SYSTEM_USER', - 'USER', - 'USER_ID', - 'USER_NAME', - // String - 'ASCII', - 'CHAR', - 'CHARINDEX', - 'CONCAT', - 'DIFFERENCE', - 'FORMAT', - 'LEFT', - 'LEN', - 'LOWER', - 'LTRIM', - 'NCHAR', - 'PATINDEX', - 'QUOTENAME', - 'REPLACE', - 'REPLICATE', - 'REVERSE', - 'RIGHT', - 'RTRIM', - 'SOUNDEX', - 'SPACE', - 'STR', - 'STUFF', - 'SUBSTRING', - 'UNICODE', - 'UPPER', - // System - 'BINARY_CHECKSUM', - 'CHECKSUM', - 'CONNECTIONPROPERTY', - 'CONTEXT_INFO', - 'CURRENT_REQUEST_ID', - 'ERROR_LINE', - 'ERROR_NUMBER', - 'ERROR_MESSAGE', - 'ERROR_PROCEDURE', - 'ERROR_SEVERITY', - 'ERROR_STATE', - 'FORMATMESSAGE', - 'GETANSINULL', - 'GET_FILESTREAM_TRANSACTION_CONTEXT', - 'HOST_ID', - 'HOST_NAME', - 'ISNULL', - 'ISNUMERIC', - 'MIN_ACTIVE_ROWVERSION', - 'NEWID', - 'NEWSEQUENTIALID', - 'ROWCOUNT_BIG', - 'XACT_STATE', - // TextImage - 'TEXTPTR', - 'TEXTVALID', - // Trigger - 'COLUMNS_UPDATED', - 'EVENTDATA', - 'TRIGGER_NESTLEVEL', - 'UPDATE', - // ChangeTracking - 'CHANGETABLE', - 'CHANGE_TRACKING_CONTEXT', - 'CHANGE_TRACKING_CURRENT_VERSION', - 'CHANGE_TRACKING_IS_COLUMN_IN_MASK', - 'CHANGE_TRACKING_MIN_VALID_VERSION', - // FullTextSearch - 'CONTAINSTABLE', - 'FREETEXTTABLE', - // SemanticTextSearch - 'SEMANTICKEYPHRASETABLE', - 'SEMANTICSIMILARITYDETAILSTABLE', - 'SEMANTICSIMILARITYTABLE', - // FileStream - 'FILETABLEROOTPATH', - 'GETFILENAMESPACEPATH', - 'GETPATHLOCATOR', - 'PATHNAME', - // ServiceBroker - 'GET_TRANSMISSION_STATUS' - ], - builtinVariables: [ - // Configuration - '@@DATEFIRST', - '@@DBTS', - '@@LANGID', - '@@LANGUAGE', - '@@LOCK_TIMEOUT', - '@@MAX_CONNECTIONS', - '@@MAX_PRECISION', - '@@NESTLEVEL', - '@@OPTIONS', - '@@REMSERVER', - '@@SERVERNAME', - '@@SERVICENAME', - '@@SPID', - '@@TEXTSIZE', - '@@VERSION', - // Cursor - '@@CURSOR_ROWS', - '@@FETCH_STATUS', - // Datetime - '@@DATEFIRST', - // Metadata - '@@PROCID', - // System - '@@ERROR', - '@@IDENTITY', - '@@ROWCOUNT', - '@@TRANCOUNT', - // Stats - '@@CONNECTIONS', - '@@CPU_BUSY', - '@@IDLE', - '@@IO_BUSY', - '@@PACKET_ERRORS', - '@@PACK_RECEIVED', - '@@PACK_SENT', - '@@TIMETICKS', - '@@TOTAL_ERRORS', - '@@TOTAL_READ', - '@@TOTAL_WRITE' - ], - pseudoColumns: ['$ACTION', '$IDENTITY', '$ROWGUID', '$PARTITION'], - tokenizer: { - root: [ - { include: '@comments' }, - { include: '@whitespace' }, - { include: '@pseudoColumns' }, - { include: '@numbers' }, - { include: '@strings' }, - { include: '@complexIdentifiers' }, - { include: '@scopes' }, - [/[;,.]/, 'delimiter'], - [/[()]/, '@brackets'], - [ - /[\w@#$]+/, - { - cases: { - '@keywords': 'keyword', - '@operators': 'operator', - '@builtinVariables': 'predefined', - '@builtinFunctions': 'predefined', - '@default': 'identifier' - } - } - ], - [/[<>=!%&+\-*/|~^]/, 'operator'] - ], - whitespace: [[/\s+/, 'white']], - comments: [ - [/--+.*/, 'comment'], - [/\/\*/, { token: 'comment.quote', next: '@comment' }] - ], - comment: [ - [/[^*/]+/, 'comment'], - // Not supporting nested comments, as nested comments seem to not be standard? - // i.e. http://stackoverflow.com/questions/728172/are-there-multiline-comment-delimiters-in-sql-that-are-vendor-agnostic - // [/\/\*/, { token: 'comment.quote', next: '@push' }], // nested comment not allowed :-( - [/\*\//, { token: 'comment.quote', next: '@pop' }], - [/./, 'comment'] - ], - pseudoColumns: [ - [ - /[$][A-Za-z_][\w@#$]*/, - { - cases: { - '@pseudoColumns': 'predefined', - '@default': 'identifier' - } - } - ] - ], - numbers: [ - [/0[xX][0-9a-fA-F]*/, 'number'], - [/[$][+-]*\d*(\.\d*)?/, 'number'], - [/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/, 'number'] - ], - strings: [ - [/N'/, { token: 'string', next: '@string' }], - [/'/, { token: 'string', next: '@string' }] - ], - string: [ - [/[^']+/, 'string'], - [/''/, 'string'], - [/'/, { token: 'string', next: '@pop' }] - ], - complexIdentifiers: [ - [/\[/, { token: 'identifier.quote', next: '@bracketedIdentifier' }], - [/"/, { token: 'identifier.quote', next: '@quotedIdentifier' }] - ], - bracketedIdentifier: [ - [/[^\]]+/, 'identifier'], - [/]]/, 'identifier'], - [/]/, { token: 'identifier.quote', next: '@pop' }] - ], - quotedIdentifier: [ - [/[^"]+/, 'identifier'], - [/""/, 'identifier'], - [/"/, { token: 'identifier.quote', next: '@pop' }] - ], - scopes: [ - [/BEGIN\s+(DISTRIBUTED\s+)?TRAN(SACTION)?\b/i, 'keyword'], - [/BEGIN\s+TRY\b/i, { token: 'keyword.try' }], - [/END\s+TRY\b/i, { token: 'keyword.try' }], - [/BEGIN\s+CATCH\b/i, { token: 'keyword.catch' }], - [/END\s+CATCH\b/i, { token: 'keyword.catch' }], - [/(BEGIN|CASE)\b/i, { token: 'keyword.block' }], - [/END\b/i, { token: 'keyword.block' }], - [/WHEN\b/i, { token: 'keyword.choice' }], - [/THEN\b/i, { token: 'keyword.choice' }] - ] - } -}; diff --git a/src/plsql/plsql.worker.ts b/src/plsql/plsql.worker.ts deleted file mode 100644 index 9387a7f2..00000000 --- a/src/plsql/plsql.worker.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { worker } from '../fillers/monaco-editor-core'; -import * as EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker.js'; -import { ICreateData } from '../baseSQLWorker'; -import { PLSQLWorker } from './plSQLWorker'; - -self.onmessage = () => { - // ignore the first message - EditorWorker.initialize((ctx: worker.IWorkerContext, createData: ICreateData) => { - return new PLSQLWorker(ctx, createData); - }); -}; diff --git a/src/sql/sql.contribution.ts b/src/sql/sql.contribution.ts deleted file mode 100644 index 5665f796..00000000 --- a/src/sql/sql.contribution.ts +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { registerLanguage } from '../_.contribution'; -import { setupLanguageFeatures } from '../setupLanguageFeatures'; -import { LanguageIdEnum } from '../common/constants'; - -registerLanguage({ - id: LanguageIdEnum.SQL, - extensions: ['.sql'], - aliases: ['SQL'], - loader: () => import('./sql') -}); - -setupLanguageFeatures(LanguageIdEnum.SQL, { - completionItems: false, - diagnostics: true -}); diff --git a/src/sql/sql.test.ts b/src/sql/sql.test.ts deleted file mode 100644 index efd35c9d..00000000 --- a/src/sql/sql.test.ts +++ /dev/null @@ -1,692 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { testTokenization } from '../test/testRunner'; - -testTokenization('sql', [ - // Comments - [ - { - line: '-- a comment', - tokens: [{ startIndex: 0, type: 'comment.sql' }] - } - ], - - [ - { - line: '---sticky -- comment', - tokens: [{ startIndex: 0, type: 'comment.sql' }] - } - ], - - [ - { - line: '-almost a comment', - tokens: [ - { startIndex: 0, type: 'operator.sql' }, - { startIndex: 1, type: 'identifier.sql' }, - { startIndex: 7, type: 'white.sql' }, - { startIndex: 8, type: 'identifier.sql' }, - { startIndex: 9, type: 'white.sql' }, - { startIndex: 10, type: 'identifier.sql' } - ] - } - ], - - [ - { - line: '/* a full line comment */', - tokens: [ - { startIndex: 0, type: 'comment.quote.sql' }, - { startIndex: 2, type: 'comment.sql' }, - { startIndex: 23, type: 'comment.quote.sql' } - ] - } - ], - - [ - { - line: '/* /// *** /// */', - tokens: [ - { startIndex: 0, type: 'comment.quote.sql' }, - { startIndex: 2, type: 'comment.sql' }, - { startIndex: 15, type: 'comment.quote.sql' } - ] - } - ], - - [ - { - line: 'declare @x int = /* a simple comment */ 1;', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 7, type: 'white.sql' }, - { startIndex: 8, type: 'identifier.sql' }, - { startIndex: 10, type: 'white.sql' }, - { startIndex: 11, type: 'keyword.sql' }, - { startIndex: 14, type: 'white.sql' }, - { startIndex: 15, type: 'operator.sql' }, - { startIndex: 16, type: 'white.sql' }, - { startIndex: 17, type: 'comment.quote.sql' }, - { startIndex: 19, type: 'comment.sql' }, - { startIndex: 37, type: 'comment.quote.sql' }, - { startIndex: 39, type: 'white.sql' }, - { startIndex: 40, type: 'number.sql' }, - { startIndex: 41, type: 'delimiter.sql' } - ] - } - ], - - // Not supporting nested comments, as nested comments seem to not be standard? - // i.e. http://stackoverflow.com/questions/728172/are-there-multiline-comment-delimiters-in-sql-that-are-vendor-agnostic - [ - { - line: '@x=/* a /* nested comment 1*/;', - tokens: [ - { startIndex: 0, type: 'identifier.sql' }, - { startIndex: 2, type: 'operator.sql' }, - { startIndex: 3, type: 'comment.quote.sql' }, - { startIndex: 5, type: 'comment.sql' }, - { startIndex: 28, type: 'comment.quote.sql' }, - { startIndex: 30, type: 'delimiter.sql' } - ] - } - ], - - [ - { - line: '@x=/* another comment */ 1*/;', - tokens: [ - { startIndex: 0, type: 'identifier.sql' }, - { startIndex: 2, type: 'operator.sql' }, - { startIndex: 3, type: 'comment.quote.sql' }, - { startIndex: 5, type: 'comment.sql' }, - { startIndex: 22, type: 'comment.quote.sql' }, - { startIndex: 24, type: 'white.sql' }, - { startIndex: 25, type: 'number.sql' }, - { startIndex: 26, type: 'operator.sql' }, - { startIndex: 28, type: 'delimiter.sql' } - ] - } - ], - - [ - { - line: '@x=/*/;', - tokens: [ - { startIndex: 0, type: 'identifier.sql' }, - { startIndex: 2, type: 'operator.sql' }, - { startIndex: 3, type: 'comment.quote.sql' }, - { startIndex: 5, type: 'comment.sql' } - ] - } - ], - - // Numbers - [ - { - line: '123', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '-123', - tokens: [ - { startIndex: 0, type: 'operator.sql' }, - { startIndex: 1, type: 'number.sql' } - ] - } - ], - - [ - { - line: '0xaBc123', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '0XaBc123', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '0x', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '0x0', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '0xAB_CD', - tokens: [ - { startIndex: 0, type: 'number.sql' }, - { startIndex: 4, type: 'identifier.sql' } - ] - } - ], - - [ - { - line: '$', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '$-123', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '$-+-123', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '$123.5678', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '$0.99', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '$.99', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '$99.', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '$0.', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '$.0', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '.', - tokens: [{ startIndex: 0, type: 'delimiter.sql' }] - } - ], - - [ - { - line: '123', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '123.5678', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '0.99', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '.99', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '99.', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '0.', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '.0', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '1E-2', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '1E+2', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '1E2', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '0.1E2', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '1.E2', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - [ - { - line: '.1E2', - tokens: [{ startIndex: 0, type: 'number.sql' }] - } - ], - - // Identifiers - [ - { - line: '_abc$01', - tokens: [{ startIndex: 0, type: 'identifier.sql' }] - } - ], - - [ - { - line: '#abc$01', - tokens: [{ startIndex: 0, type: 'identifier.sql' }] - } - ], - - [ - { - line: '##abc$01', - tokens: [{ startIndex: 0, type: 'identifier.sql' }] - } - ], - - [ - { - line: '@abc$01', - tokens: [{ startIndex: 0, type: 'identifier.sql' }] - } - ], - - [ - { - line: '@@abc$01', - tokens: [{ startIndex: 0, type: 'identifier.sql' }] - } - ], - - [ - { - line: '$abc', - tokens: [{ startIndex: 0, type: 'identifier.sql' }] - } - ], - - [ - { - line: '$action', - tokens: [{ startIndex: 0, type: 'predefined.sql' }] - } - ], - - [ - { - line: '$nonexistent', - tokens: [{ startIndex: 0, type: 'identifier.sql' }] - } - ], - - [ - { - line: '@@DBTS', - tokens: [{ startIndex: 0, type: 'predefined.sql' }] - } - ], - - [ - { - line: '@@nonexistent', - tokens: [{ startIndex: 0, type: 'identifier.sql' }] - } - ], - - [ - { - line: 'declare [abc 321];', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 7, type: 'white.sql' }, - { startIndex: 8, type: 'identifier.quote.sql' }, - { startIndex: 9, type: 'identifier.sql' }, - { startIndex: 16, type: 'identifier.quote.sql' }, - { startIndex: 17, type: 'delimiter.sql' } - ] - } - ], - - [ - { - line: '[abc[[ 321 ]] xyz]', - tokens: [ - { startIndex: 0, type: 'identifier.quote.sql' }, - { startIndex: 1, type: 'identifier.sql' }, - { startIndex: 17, type: 'identifier.quote.sql' } - ] - } - ], - - [ - { - line: '[abc', - tokens: [ - { startIndex: 0, type: 'identifier.quote.sql' }, - { startIndex: 1, type: 'identifier.sql' } - ] - } - ], - - [ - { - line: 'declare "abc 321";', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 7, type: 'white.sql' }, - { startIndex: 8, type: 'identifier.quote.sql' }, - { startIndex: 9, type: 'identifier.sql' }, - { startIndex: 16, type: 'identifier.quote.sql' }, - { startIndex: 17, type: 'delimiter.sql' } - ] - } - ], - - [ - { - line: '"abc"" 321 "" xyz"', - tokens: [ - { startIndex: 0, type: 'identifier.quote.sql' }, - { startIndex: 1, type: 'identifier.sql' }, - { startIndex: 17, type: 'identifier.quote.sql' } - ] - } - ], - - [ - { - line: '"abc', - tokens: [ - { startIndex: 0, type: 'identifier.quote.sql' }, - { startIndex: 1, type: 'identifier.sql' } - ] - } - ], - - [ - { - line: 'int', - tokens: [{ startIndex: 0, type: 'keyword.sql' }] - } - ], - - [ - { - line: '[int]', - tokens: [ - { startIndex: 0, type: 'identifier.quote.sql' }, - { startIndex: 1, type: 'identifier.sql' }, - { startIndex: 4, type: 'identifier.quote.sql' } - ] - } - ], - - // Strings - [ - { - line: "declare @x='a string';", - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 7, type: 'white.sql' }, - { startIndex: 8, type: 'identifier.sql' }, - { startIndex: 10, type: 'operator.sql' }, - { startIndex: 11, type: 'string.sql' }, - { startIndex: 21, type: 'delimiter.sql' } - ] - } - ], - - [ - { - line: "'a '' string with quotes'", - tokens: [{ startIndex: 0, type: 'string.sql' }] - } - ], - - [ - { - line: "'a \" string with quotes'", - tokens: [{ startIndex: 0, type: 'string.sql' }] - } - ], - - [ - { - line: "'a -- string with comment'", - tokens: [{ startIndex: 0, type: 'string.sql' }] - } - ], - - [ - { - line: "N'a unicode string'", - tokens: [{ startIndex: 0, type: 'string.sql' }] - } - ], - - [ - { - line: "'a endless string", - tokens: [{ startIndex: 0, type: 'string.sql' }] - } - ], - - // Operators - [ - { - line: 'SET @x=@x+1', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 3, type: 'white.sql' }, - { startIndex: 4, type: 'identifier.sql' }, - { startIndex: 6, type: 'operator.sql' }, - { startIndex: 7, type: 'identifier.sql' }, - { startIndex: 9, type: 'operator.sql' }, - { startIndex: 10, type: 'number.sql' } - ] - } - ], - - [ - { - line: '@x^=@x', - tokens: [ - { startIndex: 0, type: 'identifier.sql' }, - { startIndex: 2, type: 'operator.sql' }, - { startIndex: 4, type: 'identifier.sql' } - ] - } - ], - - [ - { - line: 'WHERE x IS NOT NULL', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 5, type: 'white.sql' }, - { startIndex: 6, type: 'identifier.sql' }, - { startIndex: 7, type: 'white.sql' }, - { startIndex: 8, type: 'operator.sql' }, - { startIndex: 10, type: 'white.sql' }, - { startIndex: 11, type: 'operator.sql' }, - { startIndex: 14, type: 'white.sql' }, - { startIndex: 15, type: 'operator.sql' } - ] - } - ], - - [ - { - line: 'SELECT * FROM dbo.MyTable WHERE MyColumn IN (1,2)', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 6, type: 'white.sql' }, - { startIndex: 7, type: 'operator.sql' }, - { startIndex: 8, type: 'white.sql' }, - { startIndex: 9, type: 'keyword.sql' }, - { startIndex: 13, type: 'white.sql' }, - { startIndex: 14, type: 'identifier.sql' }, - { startIndex: 17, type: 'delimiter.sql' }, - { startIndex: 18, type: 'identifier.sql' }, - { startIndex: 25, type: 'white.sql' }, - { startIndex: 26, type: 'keyword.sql' }, - { startIndex: 31, type: 'white.sql' }, - { startIndex: 32, type: 'identifier.sql' }, - { startIndex: 40, type: 'white.sql' }, - { startIndex: 41, type: 'operator.sql' }, - { startIndex: 43, type: 'white.sql' }, - { startIndex: 44, type: 'delimiter.parenthesis.sql' }, - { startIndex: 45, type: 'number.sql' }, - { startIndex: 46, type: 'delimiter.sql' }, - { startIndex: 47, type: 'number.sql' }, - { startIndex: 48, type: 'delimiter.parenthesis.sql' } - ] - } - ], - - // Scopes - [ - { - line: 'WHILE() BEGIN END', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 5, type: 'delimiter.parenthesis.sql' }, - { startIndex: 7, type: 'white.sql' }, - { startIndex: 8, type: 'keyword.block.sql' }, - { startIndex: 13, type: 'white.sql' }, - { startIndex: 14, type: 'keyword.block.sql' } - ] - } - ], - - [ - { - line: 'BEGIN TRAN BEGIN TRY SELECT $ COMMIT END TRY BEGIN CATCH ROLLBACK END CATCH', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 10, type: 'white.sql' }, - { startIndex: 11, type: 'keyword.try.sql' }, - { startIndex: 20, type: 'white.sql' }, - { startIndex: 21, type: 'keyword.sql' }, - { startIndex: 27, type: 'white.sql' }, - { startIndex: 28, type: 'number.sql' }, - { startIndex: 29, type: 'white.sql' }, - { startIndex: 30, type: 'keyword.sql' }, - { startIndex: 36, type: 'white.sql' }, - { startIndex: 37, type: 'keyword.try.sql' }, - { startIndex: 44, type: 'white.sql' }, - { startIndex: 45, type: 'keyword.catch.sql' }, - { startIndex: 56, type: 'white.sql' }, - { startIndex: 57, type: 'keyword.sql' }, - { startIndex: 65, type: 'white.sql' }, - { startIndex: 66, type: 'keyword.catch.sql' } - ] - } - ], - - [ - { - line: 'SELECT CASE $ WHEN 3 THEN 4 ELSE 5 END', - tokens: [ - { startIndex: 0, type: 'keyword.sql' }, - { startIndex: 6, type: 'white.sql' }, - { startIndex: 7, type: 'keyword.block.sql' }, - { startIndex: 11, type: 'white.sql' }, - { startIndex: 12, type: 'number.sql' }, - { startIndex: 13, type: 'white.sql' }, - { startIndex: 14, type: 'keyword.choice.sql' }, - { startIndex: 18, type: 'white.sql' }, - { startIndex: 19, type: 'number.sql' }, - { startIndex: 20, type: 'white.sql' }, - { startIndex: 21, type: 'keyword.choice.sql' }, - { startIndex: 25, type: 'white.sql' }, - { startIndex: 26, type: 'number.sql' }, - { startIndex: 27, type: 'white.sql' }, - { startIndex: 28, type: 'keyword.sql' }, - { startIndex: 32, type: 'white.sql' }, - { startIndex: 33, type: 'number.sql' }, - { startIndex: 34, type: 'white.sql' }, - { startIndex: 35, type: 'keyword.block.sql' } - ] - } - ] -]); diff --git a/src/sql/sql.ts b/src/sql/sql.ts deleted file mode 100644 index 1624ca8a..00000000 --- a/src/sql/sql.ts +++ /dev/null @@ -1,1403 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import type { languages } from '../fillers/monaco-editor-core'; - -export const conf: languages.LanguageConfiguration = { - comments: { - lineComment: '--', - blockComment: ['/*', '*/'] - }, - brackets: [ - ['{', '}'], - ['[', ']'], - ['(', ')'] - ], - autoClosingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '"', close: '"' }, - { open: "'", close: "'" } - ], - surroundingPairs: [ - { open: '{', close: '}' }, - { open: '[', close: ']' }, - { open: '(', close: ')' }, - { open: '"', close: '"' }, - { open: "'", close: "'" } - ] -}; - -export const language = { - defaultToken: '', - tokenPostfix: '.sql', - ignoreCase: true, - - brackets: [ - { open: '[', close: ']', token: 'delimiter.square' }, - { open: '(', close: ')', token: 'delimiter.parenthesis' } - ], - - keywords: [ - 'ABORT_AFTER_WAIT', - 'ABSENT', - 'ABSOLUTE', - 'ACCENT_SENSITIVITY', - 'ACTION', - 'ACTIVATION', - 'ACTIVE', - 'ADD', - 'ADDRESS', - 'ADMIN', - 'AES', - 'AES_128', - 'AES_192', - 'AES_256', - 'AFFINITY', - 'AFTER', - 'AGGREGATE', - 'ALGORITHM', - 'ALL_CONSTRAINTS', - 'ALL_ERRORMSGS', - 'ALL_INDEXES', - 'ALL_LEVELS', - 'ALL_SPARSE_COLUMNS', - 'ALLOW_CONNECTIONS', - 'ALLOW_MULTIPLE_EVENT_LOSS', - 'ALLOW_PAGE_LOCKS', - 'ALLOW_ROW_LOCKS', - 'ALLOW_SINGLE_EVENT_LOSS', - 'ALLOW_SNAPSHOT_ISOLATION', - 'ALLOWED', - 'ALTER', - 'ANONYMOUS', - 'ANSI_DEFAULTS', - 'ANSI_NULL_DEFAULT', - 'ANSI_NULL_DFLT_OFF', - 'ANSI_NULL_DFLT_ON', - 'ANSI_NULLS', - 'ANSI_PADDING', - 'ANSI_WARNINGS', - 'APPEND', - 'APPLICATION', - 'APPLICATION_LOG', - 'ARITHABORT', - 'ARITHIGNORE', - 'AS', - 'ASC', - 'ASSEMBLY', - 'ASYMMETRIC', - 'ASYNCHRONOUS_COMMIT', - 'AT', - 'ATOMIC', - 'ATTACH', - 'ATTACH_REBUILD_LOG', - 'AUDIT', - 'AUDIT_GUID', - 'AUTHENTICATION', - 'AUTHORIZATION', - 'AUTO', - 'AUTO_CLEANUP', - 'AUTO_CLOSE', - 'AUTO_CREATE_STATISTICS', - 'AUTO_SHRINK', - 'AUTO_UPDATE_STATISTICS', - 'AUTO_UPDATE_STATISTICS_ASYNC', - 'AUTOMATED_BACKUP_PREFERENCE', - 'AUTOMATIC', - 'AVAILABILITY', - 'AVAILABILITY_MODE', - 'BACKUP', - 'BACKUP_PRIORITY', - 'BASE64', - 'BATCHSIZE', - 'BEGIN', - 'BEGIN_DIALOG', - 'BIGINT', - 'BINARY', - 'BINDING', - 'BIT', - 'BLOCKERS', - 'BLOCKSIZE', - 'BOUNDING_BOX', - 'BREAK', - 'BROKER', - 'BROKER_INSTANCE', - 'BROWSE', - 'BUCKET_COUNT', - 'BUFFER', - 'BUFFERCOUNT', - 'BULK', - 'BULK_LOGGED', - 'BY', - 'CACHE', - 'CALL', - 'CALLED', - 'CALLER', - 'CAP_CPU_PERCENT', - 'CASCADE', - 'CASE', - 'CATALOG', - 'CATCH', - 'CELLS_PER_OBJECT', - 'CERTIFICATE', - 'CHANGE_RETENTION', - 'CHANGE_TRACKING', - 'CHANGES', - 'CHAR', - 'CHARACTER', - 'CHECK', - 'CHECK_CONSTRAINTS', - 'CHECK_EXPIRATION', - 'CHECK_POLICY', - 'CHECKALLOC', - 'CHECKCATALOG', - 'CHECKCONSTRAINTS', - 'CHECKDB', - 'CHECKFILEGROUP', - 'CHECKIDENT', - 'CHECKPOINT', - 'CHECKTABLE', - 'CLASSIFIER_FUNCTION', - 'CLEANTABLE', - 'CLEANUP', - 'CLEAR', - 'CLOSE', - 'CLUSTER', - 'CLUSTERED', - 'CODEPAGE', - 'COLLATE', - 'COLLECTION', - 'COLUMN', - 'COLUMN_SET', - 'COLUMNS', - 'COLUMNSTORE', - 'COLUMNSTORE_ARCHIVE', - 'COMMIT', - 'COMMITTED', - 'COMPATIBILITY_LEVEL', - 'COMPRESSION', - 'COMPUTE', - 'CONCAT', - 'CONCAT_NULL_YIELDS_NULL', - 'CONFIGURATION', - 'CONNECT', - 'CONSTRAINT', - 'CONTAINMENT', - 'CONTENT', - 'CONTEXT', - 'CONTINUE', - 'CONTINUE_AFTER_ERROR', - 'CONTRACT', - 'CONTRACT_NAME', - 'CONTROL', - 'CONVERSATION', - 'COOKIE', - 'COPY_ONLY', - 'COUNTER', - 'CPU', - 'CREATE', - 'CREATE_NEW', - 'CREATION_DISPOSITION', - 'CREDENTIAL', - 'CRYPTOGRAPHIC', - 'CUBE', - 'CURRENT', - 'CURRENT_DATE', - 'CURSOR', - 'CURSOR_CLOSE_ON_COMMIT', - 'CURSOR_DEFAULT', - 'CYCLE', - 'DATA', - 'DATA_COMPRESSION', - 'DATA_PURITY', - 'DATABASE', - 'DATABASE_DEFAULT', - 'DATABASE_MIRRORING', - 'DATABASE_SNAPSHOT', - 'DATAFILETYPE', - 'DATE', - 'DATE_CORRELATION_OPTIMIZATION', - 'DATEFIRST', - 'DATEFORMAT', - 'DATETIME', - 'DATETIME2', - 'DATETIMEOFFSET', - 'DAY', - 'DAYOFYEAR', - 'DAYS', - 'DB_CHAINING', - 'DBCC', - 'DBREINDEX', - 'DDL_DATABASE_LEVEL_EVENTS', - 'DEADLOCK_PRIORITY', - 'DEALLOCATE', - 'DEC', - 'DECIMAL', - 'DECLARE', - 'DECRYPTION', - 'DEFAULT', - 'DEFAULT_DATABASE', - 'DEFAULT_FULLTEXT_LANGUAGE', - 'DEFAULT_LANGUAGE', - 'DEFAULT_SCHEMA', - 'DEFINITION', - 'DELAY', - 'DELAYED_DURABILITY', - 'DELETE', - 'DELETED', - 'DENSITY_VECTOR', - 'DENY', - 'DEPENDENTS', - 'DES', - 'DESC', - 'DESCRIPTION', - 'DESX', - 'DHCP', - 'DIAGNOSTICS', - 'DIALOG', - 'DIFFERENTIAL', - 'DIRECTORY_NAME', - 'DISABLE', - 'DISABLE_BROKER', - 'DISABLED', - 'DISK', - 'DISTINCT', - 'DISTRIBUTED', - 'DOCUMENT', - 'DOUBLE', - 'DROP', - 'DROP_EXISTING', - 'DROPCLEANBUFFERS', - 'DUMP', - 'DURABILITY', - 'DYNAMIC', - 'EDITION', - 'ELEMENTS', - 'ELSE', - 'EMERGENCY', - 'EMPTY', - 'EMPTYFILE', - 'ENABLE', - 'ENABLE_BROKER', - 'ENABLED', - 'ENCRYPTION', - 'END', - 'ENDPOINT', - 'ENDPOINT_URL', - 'ERRLVL', - 'ERROR', - 'ERROR_BROKER_CONVERSATIONS', - 'ERRORFILE', - 'ESCAPE', - 'ESTIMATEONLY', - 'EVENT', - 'EVENT_RETENTION_MODE', - 'EXEC', - 'EXECUTABLE', - 'EXECUTE', - 'EXIT', - 'EXPAND', - 'EXPIREDATE', - 'EXPIRY_DATE', - 'EXPLICIT', - 'EXTENDED_LOGICAL_CHECKS', - 'EXTENSION', - 'EXTERNAL', - 'EXTERNAL_ACCESS', - 'FAIL_OPERATION', - 'FAILOVER', - 'FAILOVER_MODE', - 'FAILURE_CONDITION_LEVEL', - 'FALSE', - 'FAN_IN', - 'FAST', - 'FAST_FORWARD', - 'FETCH', - 'FIELDTERMINATOR', - 'FILE', - 'FILEGROUP', - 'FILEGROWTH', - 'FILELISTONLY', - 'FILENAME', - 'FILEPATH', - 'FILESTREAM', - 'FILESTREAM_ON', - 'FILETABLE_COLLATE_FILENAME', - 'FILETABLE_DIRECTORY', - 'FILETABLE_FULLPATH_UNIQUE_CONSTRAINT_NAME', - 'FILETABLE_NAMESPACE', - 'FILETABLE_PRIMARY_KEY_CONSTRAINT_NAME', - 'FILETABLE_STREAMID_UNIQUE_CONSTRAINT_NAME', - 'FILLFACTOR', - 'FILTERING', - 'FIRE_TRIGGERS', - 'FIRST', - 'FIRSTROW', - 'FLOAT', - 'FMTONLY', - 'FOLLOWING', - 'FOR', - 'FORCE', - 'FORCE_FAILOVER_ALLOW_DATA_LOSS', - 'FORCE_SERVICE_ALLOW_DATA_LOSS', - 'FORCED', - 'FORCEPLAN', - 'FORCESCAN', - 'FORCESEEK', - 'FOREIGN', - 'FORMATFILE', - 'FORMSOF', - 'FORWARD_ONLY', - 'FREE', - 'FREEPROCCACHE', - 'FREESESSIONCACHE', - 'FREESYSTEMCACHE', - 'FROM', - 'FULL', - 'FULLSCAN', - 'FULLTEXT', - 'FUNCTION', - 'GB', - 'GEOGRAPHY_AUTO_GRID', - 'GEOGRAPHY_GRID', - 'GEOMETRY_AUTO_GRID', - 'GEOMETRY_GRID', - 'GET', - 'GLOBAL', - 'GO', - 'GOTO', - 'GOVERNOR', - 'GRANT', - 'GRIDS', - 'GROUP', - 'GROUP_MAX_REQUESTS', - 'HADR', - 'HASH', - 'HASHED', - 'HAVING', - 'HEADERONLY', - 'HEALTH_CHECK_TIMEOUT', - 'HELP', - 'HIERARCHYID', - 'HIGH', - 'HINT', - 'HISTOGRAM', - 'HOLDLOCK', - 'HONOR_BROKER_PRIORITY', - 'HOUR', - 'HOURS', - 'IDENTITY', - 'IDENTITY_INSERT', - 'IDENTITY_VALUE', - 'IDENTITYCOL', - 'IF', - 'IGNORE_CONSTRAINTS', - 'IGNORE_DUP_KEY', - 'IGNORE_NONCLUSTERED_COLUMNSTORE_INDEX', - 'IGNORE_TRIGGERS', - 'IMAGE', - 'IMMEDIATE', - 'IMPERSONATE', - 'IMPLICIT_TRANSACTIONS', - 'IMPORTANCE', - 'INCLUDE', - 'INCREMENT', - 'INCREMENTAL', - 'INDEX', - 'INDEXDEFRAG', - 'INFINITE', - 'INFLECTIONAL', - 'INIT', - 'INITIATOR', - 'INPUT', - 'INPUTBUFFER', - 'INSENSITIVE', - 'INSERT', - 'INSERTED', - 'INSTEAD', - 'INT', - 'INTEGER', - 'INTO', - 'IO', - 'IP', - 'ISABOUT', - 'ISOLATION', - 'JOB', - 'KB', - 'KEEP', - 'KEEP_CDC', - 'KEEP_NULLS', - 'KEEP_REPLICATION', - 'KEEPDEFAULTS', - 'KEEPFIXED', - 'KEEPIDENTITY', - 'KEEPNULLS', - 'KERBEROS', - 'KEY', - 'KEY_SOURCE', - 'KEYS', - 'KEYSET', - 'KILL', - 'KILOBYTES_PER_BATCH', - 'LABELONLY', - 'LANGUAGE', - 'LAST', - 'LASTROW', - 'LEVEL', - 'LEVEL_1', - 'LEVEL_2', - 'LEVEL_3', - 'LEVEL_4', - 'LIFETIME', - 'LIMIT', - 'LINENO', - 'LIST', - 'LISTENER', - 'LISTENER_IP', - 'LISTENER_PORT', - 'LOAD', - 'LOADHISTORY', - 'LOB_COMPACTION', - 'LOCAL', - 'LOCAL_SERVICE_NAME', - 'LOCK_ESCALATION', - 'LOCK_TIMEOUT', - 'LOGIN', - 'LOGSPACE', - 'LOOP', - 'LOW', - 'MANUAL', - 'MARK', - 'MARK_IN_USE_FOR_REMOVAL', - 'MASTER', - 'MAX_CPU_PERCENT', - 'MAX_DISPATCH_LATENCY', - 'MAX_DOP', - 'MAX_DURATION', - 'MAX_EVENT_SIZE', - 'MAX_FILES', - 'MAX_IOPS_PER_VOLUME', - 'MAX_MEMORY', - 'MAX_MEMORY_PERCENT', - 'MAX_QUEUE_READERS', - 'MAX_ROLLOVER_FILES', - 'MAX_SIZE', - 'MAXDOP', - 'MAXERRORS', - 'MAXLENGTH', - 'MAXRECURSION', - 'MAXSIZE', - 'MAXTRANSFERSIZE', - 'MAXVALUE', - 'MB', - 'MEDIADESCRIPTION', - 'MEDIANAME', - 'MEDIAPASSWORD', - 'MEDIUM', - 'MEMBER', - 'MEMORY_OPTIMIZED', - 'MEMORY_OPTIMIZED_DATA', - 'MEMORY_OPTIMIZED_ELEVATE_TO_SNAPSHOT', - 'MEMORY_PARTITION_MODE', - 'MERGE', - 'MESSAGE', - 'MESSAGE_FORWARD_SIZE', - 'MESSAGE_FORWARDING', - 'MICROSECOND', - 'MILLISECOND', - 'MIN_CPU_PERCENT', - 'MIN_IOPS_PER_VOLUME', - 'MIN_MEMORY_PERCENT', - 'MINUTE', - 'MINUTES', - 'MINVALUE', - 'MIRROR', - 'MIRROR_ADDRESS', - 'MODIFY', - 'MONEY', - 'MONTH', - 'MOVE', - 'MULTI_USER', - 'MUST_CHANGE', - 'NAME', - 'NANOSECOND', - 'NATIONAL', - 'NATIVE_COMPILATION', - 'NCHAR', - 'NEGOTIATE', - 'NESTED_TRIGGERS', - 'NEW_ACCOUNT', - 'NEW_BROKER', - 'NEW_PASSWORD', - 'NEWNAME', - 'NEXT', - 'NO', - 'NO_BROWSETABLE', - 'NO_CHECKSUM', - 'NO_COMPRESSION', - 'NO_EVENT_LOSS', - 'NO_INFOMSGS', - 'NO_TRUNCATE', - 'NO_WAIT', - 'NOCHECK', - 'NOCOUNT', - 'NOEXEC', - 'NOEXPAND', - 'NOFORMAT', - 'NOINDEX', - 'NOINIT', - 'NOLOCK', - 'NON', - 'NON_TRANSACTED_ACCESS', - 'NONCLUSTERED', - 'NONE', - 'NORECOMPUTE', - 'NORECOVERY', - 'NORESEED', - 'NORESET', - 'NOREWIND', - 'NORMAL', - 'NOSKIP', - 'NOTIFICATION', - 'NOTRUNCATE', - 'NOUNLOAD', - 'NOWAIT', - 'NTEXT', - 'NTLM', - 'NUMANODE', - 'NUMERIC', - 'NUMERIC_ROUNDABORT', - 'NVARCHAR', - 'OBJECT', - 'OF', - 'OFF', - 'OFFLINE', - 'OFFSET', - 'OFFSETS', - 'OLD_ACCOUNT', - 'OLD_PASSWORD', - 'ON', - 'ON_FAILURE', - 'ONLINE', - 'ONLY', - 'OPEN', - 'OPEN_EXISTING', - 'OPENTRAN', - 'OPTIMISTIC', - 'OPTIMIZE', - 'OPTION', - 'ORDER', - 'OUT', - 'OUTPUT', - 'OUTPUTBUFFER', - 'OVER', - 'OVERRIDE', - 'OWNER', - 'OWNERSHIP', - 'PAD_INDEX', - 'PAGE', - 'PAGE_VERIFY', - 'PAGECOUNT', - 'PAGLOCK', - 'PARAMETERIZATION', - 'PARSEONLY', - 'PARTIAL', - 'PARTITION', - 'PARTITIONS', - 'PARTNER', - 'PASSWORD', - 'PATH', - 'PER_CPU', - 'PER_NODE', - 'PERCENT', - 'PERMISSION_SET', - 'PERSISTED', - 'PHYSICAL_ONLY', - 'PLAN', - 'POISON_MESSAGE_HANDLING', - 'POOL', - 'POPULATION', - 'PORT', - 'PRECEDING', - 'PRECISION', - 'PRIMARY', - 'PRIMARY_ROLE', - 'PRINT', - 'PRIOR', - 'PRIORITY', - 'PRIORITY_LEVEL', - 'PRIVATE', - 'PRIVILEGES', - 'PROC', - 'PROCCACHE', - 'PROCEDURE', - 'PROCEDURE_NAME', - 'PROCESS', - 'PROFILE', - 'PROPERTY', - 'PROPERTY_DESCRIPTION', - 'PROPERTY_INT_ID', - 'PROPERTY_SET_GUID', - 'PROVIDER', - 'PROVIDER_KEY_NAME', - 'PUBLIC', - 'PUT', - 'QUARTER', - 'QUERY', - 'QUERY_GOVERNOR_COST_LIMIT', - 'QUEUE', - 'QUEUE_DELAY', - 'QUOTED_IDENTIFIER', - 'RAISERROR', - 'RANGE', - 'RAW', - 'RC2', - 'RC4', - 'RC4_128', - 'READ', - 'READ_COMMITTED_SNAPSHOT', - 'READ_ONLY', - 'READ_ONLY_ROUTING_LIST', - 'READ_ONLY_ROUTING_URL', - 'READ_WRITE', - 'READ_WRITE_FILEGROUPS', - 'READCOMMITTED', - 'READCOMMITTEDLOCK', - 'READONLY', - 'READPAST', - 'READTEXT', - 'READUNCOMMITTED', - 'READWRITE', - 'REAL', - 'REBUILD', - 'RECEIVE', - 'RECOMPILE', - 'RECONFIGURE', - 'RECOVERY', - 'RECURSIVE', - 'RECURSIVE_TRIGGERS', - 'REFERENCES', - 'REGENERATE', - 'RELATED_CONVERSATION', - 'RELATED_CONVERSATION_GROUP', - 'RELATIVE', - 'REMOTE', - 'REMOTE_PROC_TRANSACTIONS', - 'REMOTE_SERVICE_NAME', - 'REMOVE', - 'REORGANIZE', - 'REPAIR_ALLOW_DATA_LOSS', - 'REPAIR_FAST', - 'REPAIR_REBUILD', - 'REPEATABLE', - 'REPEATABLEREAD', - 'REPLICA', - 'REPLICATION', - 'REQUEST_MAX_CPU_TIME_SEC', - 'REQUEST_MAX_MEMORY_GRANT_PERCENT', - 'REQUEST_MEMORY_GRANT_TIMEOUT_SEC', - 'REQUIRED', - 'RESAMPLE', - 'RESEED', - 'RESERVE_DISK_SPACE', - 'RESET', - 'RESOURCE', - 'RESTART', - 'RESTORE', - 'RESTRICT', - 'RESTRICTED_USER', - 'RESULT', - 'RESUME', - 'RETAINDAYS', - 'RETENTION', - 'RETURN', - 'RETURNS', - 'REVERT', - 'REVOKE', - 'REWIND', - 'REWINDONLY', - 'ROBUST', - 'ROLE', - 'ROLLBACK', - 'ROLLUP', - 'ROOT', - 'ROUTE', - 'ROW', - 'ROWCOUNT', - 'ROWGUIDCOL', - 'ROWLOCK', - 'ROWS', - 'ROWS_PER_BATCH', - 'ROWTERMINATOR', - 'ROWVERSION', - 'RSA_1024', - 'RSA_2048', - 'RSA_512', - 'RULE', - 'SAFE', - 'SAFETY', - 'SAMPLE', - 'SAVE', - 'SCHEDULER', - 'SCHEMA', - 'SCHEMA_AND_DATA', - 'SCHEMA_ONLY', - 'SCHEMABINDING', - 'SCHEME', - 'SCROLL', - 'SCROLL_LOCKS', - 'SEARCH', - 'SECOND', - 'SECONDARY', - 'SECONDARY_ONLY', - 'SECONDARY_ROLE', - 'SECONDS', - 'SECRET', - 'SECURITY_LOG', - 'SECURITYAUDIT', - 'SELECT', - 'SELECTIVE', - 'SELF', - 'SEND', - 'SENT', - 'SEQUENCE', - 'SERIALIZABLE', - 'SERVER', - 'SERVICE', - 'SERVICE_BROKER', - 'SERVICE_NAME', - 'SESSION', - 'SESSION_TIMEOUT', - 'SET', - 'SETS', - 'SETUSER', - 'SHOW_STATISTICS', - 'SHOWCONTIG', - 'SHOWPLAN', - 'SHOWPLAN_ALL', - 'SHOWPLAN_TEXT', - 'SHOWPLAN_XML', - 'SHRINKDATABASE', - 'SHRINKFILE', - 'SHUTDOWN', - 'SID', - 'SIGNATURE', - 'SIMPLE', - 'SINGLE_BLOB', - 'SINGLE_CLOB', - 'SINGLE_NCLOB', - 'SINGLE_USER', - 'SINGLETON', - 'SIZE', - 'SKIP', - 'SMALLDATETIME', - 'SMALLINT', - 'SMALLMONEY', - 'SNAPSHOT', - 'SORT_IN_TEMPDB', - 'SOURCE', - 'SPARSE', - 'SPATIAL', - 'SPATIAL_WINDOW_MAX_CELLS', - 'SPECIFICATION', - 'SPLIT', - 'SQL', - 'SQL_VARIANT', - 'SQLPERF', - 'STANDBY', - 'START', - 'START_DATE', - 'STARTED', - 'STARTUP_STATE', - 'STAT_HEADER', - 'STATE', - 'STATEMENT', - 'STATIC', - 'STATISTICAL_SEMANTICS', - 'STATISTICS', - 'STATISTICS_INCREMENTAL', - 'STATISTICS_NORECOMPUTE', - 'STATS', - 'STATS_STREAM', - 'STATUS', - 'STATUSONLY', - 'STOP', - 'STOP_ON_ERROR', - 'STOPAT', - 'STOPATMARK', - 'STOPBEFOREMARK', - 'STOPLIST', - 'STOPPED', - 'SUBJECT', - 'SUBSCRIPTION', - 'SUPPORTED', - 'SUSPEND', - 'SWITCH', - 'SYMMETRIC', - 'SYNCHRONOUS_COMMIT', - 'SYNONYM', - 'SYSNAME', - 'SYSTEM', - 'TABLE', - 'TABLERESULTS', - 'TABLESAMPLE', - 'TABLOCK', - 'TABLOCKX', - 'TAKE', - 'TAPE', - 'TARGET', - 'TARGET_RECOVERY_TIME', - 'TB', - 'TCP', - 'TEXT', - 'TEXTIMAGE_ON', - 'TEXTSIZE', - 'THEN', - 'THESAURUS', - 'THROW', - 'TIES', - 'TIME', - 'TIMEOUT', - 'TIMER', - 'TIMESTAMP', - 'TINYINT', - 'TO', - 'TOP', - 'TORN_PAGE_DETECTION', - 'TRACEOFF', - 'TRACEON', - 'TRACESTATUS', - 'TRACK_CAUSALITY', - 'TRACK_COLUMNS_UPDATED', - 'TRAN', - 'TRANSACTION', - 'TRANSFER', - 'TRANSFORM_NOISE_WORDS', - 'TRIGGER', - 'TRIPLE_DES', - 'TRIPLE_DES_3KEY', - 'TRUE', - 'TRUNCATE', - 'TRUNCATEONLY', - 'TRUSTWORTHY', - 'TRY', - 'TSQL', - 'TWO_DIGIT_YEAR_CUTOFF', - 'TYPE', - 'TYPE_WARNING', - 'UNBOUNDED', - 'UNCHECKED', - 'UNCOMMITTED', - 'UNDEFINED', - 'UNIQUE', - 'UNIQUEIDENTIFIER', - 'UNKNOWN', - 'UNLIMITED', - 'UNLOAD', - 'UNSAFE', - 'UPDATE', - 'UPDATETEXT', - 'UPDATEUSAGE', - 'UPDLOCK', - 'URL', - 'USE', - 'USED', - 'USER', - 'USEROPTIONS', - 'USING', - 'VALID_XML', - 'VALIDATION', - 'VALUE', - 'VALUES', - 'VARBINARY', - 'VARCHAR', - 'VARYING', - 'VERIFYONLY', - 'VERSION', - 'VIEW', - 'VIEW_METADATA', - 'VIEWS', - 'VISIBILITY', - 'WAIT_AT_LOW_PRIORITY', - 'WAITFOR', - 'WEEK', - 'WEIGHT', - 'WELL_FORMED_XML', - 'WHEN', - 'WHERE', - 'WHILE', - 'WINDOWS', - 'WITH', - 'WITHIN', - 'WITHOUT', - 'WITNESS', - 'WORK', - 'WORKLOAD', - 'WRITETEXT', - 'XACT_ABORT', - 'XLOCK', - 'XMAX', - 'XMIN', - 'XML', - 'XMLDATA', - 'XMLNAMESPACES', - 'XMLSCHEMA', - 'XQUERY', - 'XSINIL', - 'YEAR', - 'YMAX', - 'YMIN' - ], - operators: [ - // Logical - 'ALL', - 'AND', - 'ANY', - 'BETWEEN', - 'EXISTS', - 'IN', - 'LIKE', - 'NOT', - 'OR', - 'SOME', - // Set - 'EXCEPT', - 'INTERSECT', - 'UNION', - // Join - 'APPLY', - 'CROSS', - 'FULL', - 'INNER', - 'JOIN', - 'LEFT', - 'OUTER', - 'RIGHT', - // Predicates - 'CONTAINS', - 'FREETEXT', - 'IS', - 'NULL', - // Pivoting - 'PIVOT', - 'UNPIVOT', - // Merging - 'MATCHED' - ], - builtinFunctions: [ - // Aggregate - 'AVG', - 'CHECKSUM_AGG', - 'COUNT', - 'COUNT_BIG', - 'GROUPING', - 'GROUPING_ID', - 'MAX', - 'MIN', - 'SUM', - 'STDEV', - 'STDEVP', - 'VAR', - 'VARP', - // Analytic - 'CUME_DIST', - 'FIRST_VALUE', - 'LAG', - 'LAST_VALUE', - 'LEAD', - 'PERCENTILE_CONT', - 'PERCENTILE_DISC', - 'PERCENT_RANK', - // Collation - 'COLLATE', - 'COLLATIONPROPERTY', - 'TERTIARY_WEIGHTS', - // Azure - 'FEDERATION_FILTERING_VALUE', - // Conversion - 'CAST', - 'CONVERT', - 'PARSE', - 'TRY_CAST', - 'TRY_CONVERT', - 'TRY_PARSE', - // Cryptographic - 'ASYMKEY_ID', - 'ASYMKEYPROPERTY', - 'CERTPROPERTY', - 'CERT_ID', - 'CRYPT_GEN_RANDOM', - 'DECRYPTBYASYMKEY', - 'DECRYPTBYCERT', - 'DECRYPTBYKEY', - 'DECRYPTBYKEYAUTOASYMKEY', - 'DECRYPTBYKEYAUTOCERT', - 'DECRYPTBYPASSPHRASE', - 'ENCRYPTBYASYMKEY', - 'ENCRYPTBYCERT', - 'ENCRYPTBYKEY', - 'ENCRYPTBYPASSPHRASE', - 'HASHBYTES', - 'IS_OBJECTSIGNED', - 'KEY_GUID', - 'KEY_ID', - 'KEY_NAME', - 'SIGNBYASYMKEY', - 'SIGNBYCERT', - 'SYMKEYPROPERTY', - 'VERIFYSIGNEDBYCERT', - 'VERIFYSIGNEDBYASYMKEY', - // Cursor - 'CURSOR_STATUS', - // Datatype - 'DATALENGTH', - 'IDENT_CURRENT', - 'IDENT_INCR', - 'IDENT_SEED', - 'IDENTITY', - 'SQL_VARIANT_PROPERTY', - // Datetime - 'CURRENT_TIMESTAMP', - 'DATEADD', - 'DATEDIFF', - 'DATEFROMPARTS', - 'DATENAME', - 'DATEPART', - 'DATETIME2FROMPARTS', - 'DATETIMEFROMPARTS', - 'DATETIMEOFFSETFROMPARTS', - 'DAY', - 'EOMONTH', - 'GETDATE', - 'GETUTCDATE', - 'ISDATE', - 'MONTH', - 'SMALLDATETIMEFROMPARTS', - 'SWITCHOFFSET', - 'SYSDATETIME', - 'SYSDATETIMEOFFSET', - 'SYSUTCDATETIME', - 'TIMEFROMPARTS', - 'TODATETIMEOFFSET', - 'YEAR', - // Logical - 'CHOOSE', - 'COALESCE', - 'IIF', - 'NULLIF', - // Mathematical - 'ABS', - 'ACOS', - 'ASIN', - 'ATAN', - 'ATN2', - 'CEILING', - 'COS', - 'COT', - 'DEGREES', - 'EXP', - 'FLOOR', - 'LOG', - 'LOG10', - 'PI', - 'POWER', - 'RADIANS', - 'RAND', - 'ROUND', - 'SIGN', - 'SIN', - 'SQRT', - 'SQUARE', - 'TAN', - // Metadata - 'APP_NAME', - 'APPLOCK_MODE', - 'APPLOCK_TEST', - 'ASSEMBLYPROPERTY', - 'COL_LENGTH', - 'COL_NAME', - 'COLUMNPROPERTY', - 'DATABASE_PRINCIPAL_ID', - 'DATABASEPROPERTYEX', - 'DB_ID', - 'DB_NAME', - 'FILE_ID', - 'FILE_IDEX', - 'FILE_NAME', - 'FILEGROUP_ID', - 'FILEGROUP_NAME', - 'FILEGROUPPROPERTY', - 'FILEPROPERTY', - 'FULLTEXTCATALOGPROPERTY', - 'FULLTEXTSERVICEPROPERTY', - 'INDEX_COL', - 'INDEXKEY_PROPERTY', - 'INDEXPROPERTY', - 'OBJECT_DEFINITION', - 'OBJECT_ID', - 'OBJECT_NAME', - 'OBJECT_SCHEMA_NAME', - 'OBJECTPROPERTY', - 'OBJECTPROPERTYEX', - 'ORIGINAL_DB_NAME', - 'PARSENAME', - 'SCHEMA_ID', - 'SCHEMA_NAME', - 'SCOPE_IDENTITY', - 'SERVERPROPERTY', - 'STATS_DATE', - 'TYPE_ID', - 'TYPE_NAME', - 'TYPEPROPERTY', - // Ranking - 'DENSE_RANK', - 'NTILE', - 'RANK', - 'ROW_NUMBER', - // Replication - 'PUBLISHINGSERVERNAME', - // Rowset - 'OPENDATASOURCE', - 'OPENQUERY', - 'OPENROWSET', - 'OPENXML', - // Security - 'CERTENCODED', - 'CERTPRIVATEKEY', - 'CURRENT_USER', - 'HAS_DBACCESS', - 'HAS_PERMS_BY_NAME', - 'IS_MEMBER', - 'IS_ROLEMEMBER', - 'IS_SRVROLEMEMBER', - 'LOGINPROPERTY', - 'ORIGINAL_LOGIN', - 'PERMISSIONS', - 'PWDENCRYPT', - 'PWDCOMPARE', - 'SESSION_USER', - 'SESSIONPROPERTY', - 'SUSER_ID', - 'SUSER_NAME', - 'SUSER_SID', - 'SUSER_SNAME', - 'SYSTEM_USER', - 'USER', - 'USER_ID', - 'USER_NAME', - // String - 'ASCII', - 'CHAR', - 'CHARINDEX', - 'CONCAT', - 'DIFFERENCE', - 'FORMAT', - 'LEFT', - 'LEN', - 'LOWER', - 'LTRIM', - 'NCHAR', - 'PATINDEX', - 'QUOTENAME', - 'REPLACE', - 'REPLICATE', - 'REVERSE', - 'RIGHT', - 'RTRIM', - 'SOUNDEX', - 'SPACE', - 'STR', - 'STUFF', - 'SUBSTRING', - 'UNICODE', - 'UPPER', - // System - 'BINARY_CHECKSUM', - 'CHECKSUM', - 'CONNECTIONPROPERTY', - 'CONTEXT_INFO', - 'CURRENT_REQUEST_ID', - 'ERROR_LINE', - 'ERROR_NUMBER', - 'ERROR_MESSAGE', - 'ERROR_PROCEDURE', - 'ERROR_SEVERITY', - 'ERROR_STATE', - 'FORMATMESSAGE', - 'GETANSINULL', - 'GET_FILESTREAM_TRANSACTION_CONTEXT', - 'HOST_ID', - 'HOST_NAME', - 'ISNULL', - 'ISNUMERIC', - 'MIN_ACTIVE_ROWVERSION', - 'NEWID', - 'NEWSEQUENTIALID', - 'ROWCOUNT_BIG', - 'XACT_STATE', - // TextImage - 'TEXTPTR', - 'TEXTVALID', - // Trigger - 'COLUMNS_UPDATED', - 'EVENTDATA', - 'TRIGGER_NESTLEVEL', - 'UPDATE', - // ChangeTracking - 'CHANGETABLE', - 'CHANGE_TRACKING_CONTEXT', - 'CHANGE_TRACKING_CURRENT_VERSION', - 'CHANGE_TRACKING_IS_COLUMN_IN_MASK', - 'CHANGE_TRACKING_MIN_VALID_VERSION', - // FullTextSearch - 'CONTAINSTABLE', - 'FREETEXTTABLE', - // SemanticTextSearch - 'SEMANTICKEYPHRASETABLE', - 'SEMANTICSIMILARITYDETAILSTABLE', - 'SEMANTICSIMILARITYTABLE', - // FileStream - 'FILETABLEROOTPATH', - 'GETFILENAMESPACEPATH', - 'GETPATHLOCATOR', - 'PATHNAME', - // ServiceBroker - 'GET_TRANSMISSION_STATUS' - ], - builtinVariables: [ - // Configuration - '@@DATEFIRST', - '@@DBTS', - '@@LANGID', - '@@LANGUAGE', - '@@LOCK_TIMEOUT', - '@@MAX_CONNECTIONS', - '@@MAX_PRECISION', - '@@NESTLEVEL', - '@@OPTIONS', - '@@REMSERVER', - '@@SERVERNAME', - '@@SERVICENAME', - '@@SPID', - '@@TEXTSIZE', - '@@VERSION', - // Cursor - '@@CURSOR_ROWS', - '@@FETCH_STATUS', - // Datetime - '@@DATEFIRST', - // Metadata - '@@PROCID', - // System - '@@ERROR', - '@@IDENTITY', - '@@ROWCOUNT', - '@@TRANCOUNT', - // Stats - '@@CONNECTIONS', - '@@CPU_BUSY', - '@@IDLE', - '@@IO_BUSY', - '@@PACKET_ERRORS', - '@@PACK_RECEIVED', - '@@PACK_SENT', - '@@TIMETICKS', - '@@TOTAL_ERRORS', - '@@TOTAL_READ', - '@@TOTAL_WRITE' - ], - pseudoColumns: ['$ACTION', '$IDENTITY', '$ROWGUID', '$PARTITION'], - tokenizer: { - root: [ - { include: '@comments' }, - { include: '@whitespace' }, - { include: '@pseudoColumns' }, - { include: '@numbers' }, - { include: '@strings' }, - { include: '@complexIdentifiers' }, - { include: '@scopes' }, - [/[;,.]/, 'delimiter'], - [/[()]/, '@brackets'], - [ - /[\w@#$]+/, - { - cases: { - '@keywords': 'keyword', - '@operators': 'operator', - '@builtinVariables': 'predefined', - '@builtinFunctions': 'predefined', - '@default': 'identifier' - } - } - ], - [/[<>=!%&+\-*/|~^]/, 'operator'] - ], - whitespace: [[/\s+/, 'white']], - comments: [ - [/--+.*/, 'comment'], - [/\/\*/, { token: 'comment.quote', next: '@comment' }] - ], - comment: [ - [/[^*/]+/, 'comment'], - // Not supporting nested comments, as nested comments seem to not be standard? - // i.e. http://stackoverflow.com/questions/728172/are-there-multiline-comment-delimiters-in-sql-that-are-vendor-agnostic - // [/\/\*/, { token: 'comment.quote', next: '@push' }], // nested comment not allowed :-( - [/\*\//, { token: 'comment.quote', next: '@pop' }], - [/./, 'comment'] - ], - pseudoColumns: [ - [ - /[$][A-Za-z_][\w@#$]*/, - { - cases: { - '@pseudoColumns': 'predefined', - '@default': 'identifier' - } - } - ] - ], - numbers: [ - [/0[xX][0-9a-fA-F]*/, 'number'], - [/[$][+-]*\d*(\.\d*)?/, 'number'], - [/((\d+(\.\d*)?)|(\.\d+))([eE][\-+]?\d+)?/, 'number'] - ], - strings: [ - [/N'/, { token: 'string', next: '@string' }], - [/'/, { token: 'string', next: '@string' }] - ], - string: [ - [/[^']+/, 'string'], - [/''/, 'string'], - [/'/, { token: 'string', next: '@pop' }] - ], - complexIdentifiers: [ - [/\[/, { token: 'identifier.quote', next: '@bracketedIdentifier' }], - [/"/, { token: 'identifier.quote', next: '@quotedIdentifier' }] - ], - bracketedIdentifier: [ - [/[^\]]+/, 'identifier'], - [/]]/, 'identifier'], - [/]/, { token: 'identifier.quote', next: '@pop' }] - ], - quotedIdentifier: [ - [/[^"]+/, 'identifier'], - [/""/, 'identifier'], - [/"/, { token: 'identifier.quote', next: '@pop' }] - ], - scopes: [ - [/BEGIN\s+(DISTRIBUTED\s+)?TRAN(SACTION)?\b/i, 'keyword'], - [/BEGIN\s+TRY\b/i, { token: 'keyword.try' }], - [/END\s+TRY\b/i, { token: 'keyword.try' }], - [/BEGIN\s+CATCH\b/i, { token: 'keyword.catch' }], - [/END\s+CATCH\b/i, { token: 'keyword.catch' }], - [/(BEGIN|CASE)\b/i, { token: 'keyword.block' }], - [/END\b/i, { token: 'keyword.block' }], - [/WHEN\b/i, { token: 'keyword.choice' }], - [/THEN\b/i, { token: 'keyword.choice' }] - ] - } -}; diff --git a/src/sql/sql.worker.ts b/src/sql/sql.worker.ts deleted file mode 100644 index fbb843aa..00000000 --- a/src/sql/sql.worker.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { worker } from '../fillers/monaco-editor-core'; -import * as EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker.js'; -import { ICreateData } from '../baseSQLWorker'; -import { SQLWorker } from './sqlWorker'; - -self.onmessage = () => { - // ignore the first message - EditorWorker.initialize((ctx: worker.IWorkerContext, createData: ICreateData) => { - return new SQLWorker(ctx, createData); - }); -}; diff --git a/src/sql/sqlWorker.ts b/src/sql/sqlWorker.ts deleted file mode 100644 index c9200807..00000000 --- a/src/sql/sqlWorker.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { worker } from '../fillers/monaco-editor-core'; -import { MySQL } from 'dt-sql-parser/dist/parser/mysql'; -import { BaseSQLWorker, ICreateData } from '../baseSQLWorker'; - -export class SQLWorker extends BaseSQLWorker { - protected _ctx: worker.IWorkerContext; - protected parser: MySQL; - constructor(ctx: worker.IWorkerContext, createData: ICreateData) { - super(ctx, createData); - this._ctx = ctx; - this.parser = new MySQL(); - } -} - -export function create(ctx: worker.IWorkerContext, createData: ICreateData): SQLWorker { - return new SQLWorker(ctx, createData); -} diff --git a/test/all.js b/test/all.js index b286e590..9cf04f8b 100644 --- a/test/all.js +++ b/test/all.js @@ -38,21 +38,25 @@ global.window = { requirejs( ['./test/setup'], function () { - glob('out/amd/*/*.test.js', { cwd: path.dirname(__dirname) }, function (err, files) { - if (err) { - console.log(err); - return; - } - requirejs( - files.map((f) => f.replace(/\.js$/, '')), - function () { - run(); // We can launch the tests! - }, - function (err) { + glob( + 'out/amd/languages/*/*.test.js', + { cwd: path.dirname(__dirname) }, + function (err, files) { + if (err) { console.log(err); + return; } - ); - }); + requirejs( + files.map((f) => f.replace(/\.js$/, '')), + function () { + run(); // We can launch the tests! + }, + function (err) { + console.log(err); + } + ); + } + ); }, function (err) { console.log(err); diff --git a/tsconfig.esm.json b/tsconfig.esm.json index a8b9edfd..4a60c9f1 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -2,7 +2,7 @@ "extends": ["./tsconfig.json"], "compilerOptions": { "module": "esnext", - "outDir": "out/esm/", + "outDir": "esm/", "target": "es6", "noEmit": false, "declaration": true