dql-language-support 0.8.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ {
2
+ "comments": {
3
+ "lineComment": "//"
4
+ },
5
+ "brackets": [
6
+ ["{", "}"],
7
+ ["[", "]"],
8
+ ["(", ")"]
9
+ ],
10
+ "autoClosingPairs": [
11
+ { "open": "{", "close": "}" },
12
+ { "open": "[", "close": "]" },
13
+ { "open": "(", "close": ")" },
14
+ { "open": "\"", "close": "\"" },
15
+ { "open": "'", "close": "'" }
16
+ ],
17
+ "surroundingPairs": [
18
+ ["{", "}"],
19
+ ["[", "]"],
20
+ ["(", ")"],
21
+ ["\"", "\""],
22
+ ["'", "'"]
23
+ ]
24
+ }
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "dql-language-support",
3
+ "displayName": "DQL Language Support",
4
+ "description": "Syntax highlighting, snippets, formatting, and language server support for DQL.",
5
+ "version": "0.8.12",
6
+ "publisher": "dql",
7
+ "license": "Apache-2.0",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/duckcode-ai/dql.git",
11
+ "directory": "apps/vscode-extension"
12
+ },
13
+ "private": false,
14
+ "engines": {
15
+ "vscode": "^1.85.0"
16
+ },
17
+ "categories": [
18
+ "Programming Languages",
19
+ "Linters",
20
+ "Formatters"
21
+ ],
22
+ "activationEvents": [
23
+ "onLanguage:dql"
24
+ ],
25
+ "main": "./dist/extension.js",
26
+ "contributes": {
27
+ "languages": [
28
+ {
29
+ "id": "dql",
30
+ "aliases": [
31
+ "DQL",
32
+ "Domain Query Language"
33
+ ],
34
+ "extensions": [
35
+ ".dql"
36
+ ],
37
+ "configuration": "./language-configuration.json"
38
+ }
39
+ ],
40
+ "grammars": [
41
+ {
42
+ "language": "dql",
43
+ "scopeName": "source.dql",
44
+ "path": "./syntaxes/dql.tmLanguage.json"
45
+ }
46
+ ],
47
+ "snippets": [
48
+ {
49
+ "language": "dql",
50
+ "path": "./snippets/dql.json"
51
+ }
52
+ ]
53
+ },
54
+ "dependencies": {},
55
+ "devDependencies": {
56
+ "@types/node": "^22.0.0",
57
+ "@types/vscode": "^1.85.0",
58
+ "@vscode/vsce": "^3.2.2",
59
+ "esbuild": "^0.25.0",
60
+ "typescript": "^5.7.0",
61
+ "vscode-languageclient": "^9.0.1"
62
+ },
63
+ "scripts": {
64
+ "typecheck": "tsc -p . --noEmit",
65
+ "build": "pnpm run typecheck && node ./scripts/build.mjs",
66
+ "dev": "node ./scripts/build.mjs --watch",
67
+ "package": "vsce package --no-dependencies",
68
+ "publish:vsce": "vsce publish --no-dependencies"
69
+ }
70
+ }
@@ -0,0 +1,43 @@
1
+ import { mkdir } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import process from 'node:process';
4
+ import { context, build } from 'esbuild';
5
+
6
+ const root = process.cwd();
7
+ const outdir = path.join(root, 'dist');
8
+ const watchMode = process.argv.includes('--watch');
9
+
10
+ await mkdir(outdir, { recursive: true });
11
+
12
+ const extensionBuild = {
13
+ entryPoints: [path.join(root, 'src', 'extension.ts')],
14
+ outfile: path.join(outdir, 'extension.js'),
15
+ bundle: true,
16
+ platform: 'node',
17
+ format: 'cjs',
18
+ sourcemap: true,
19
+ target: ['node18'],
20
+ external: ['vscode'],
21
+ };
22
+
23
+ const lspBuild = {
24
+ entryPoints: [path.resolve(root, '../../packages/dql-lsp/src/cli.ts')],
25
+ outfile: path.join(outdir, 'lsp-server.js'),
26
+ bundle: true,
27
+ platform: 'node',
28
+ format: 'cjs',
29
+ sourcemap: true,
30
+ target: ['node18'],
31
+ };
32
+
33
+ if (watchMode) {
34
+ const extensionCtx = await context(extensionBuild);
35
+ const lspCtx = await context(lspBuild);
36
+ await extensionCtx.watch();
37
+ await lspCtx.watch();
38
+ console.log('[dql-vscode-extension] watching extension and LSP bundles...');
39
+ } else {
40
+ await build(extensionBuild);
41
+ await build(lspBuild);
42
+ console.log('[dql-vscode-extension] build complete');
43
+ }
@@ -0,0 +1,62 @@
1
+ {
2
+ "Dashboard": {
3
+ "prefix": "dql-dashboard",
4
+ "body": [
5
+ "dashboard \"${1:Revenue Overview}\" {",
6
+ " chart.line(",
7
+ " SELECT ${2:order_date}, ${3:SUM(revenue)} as ${4:total}",
8
+ " FROM ${5:orders}",
9
+ " GROUP BY ${2:order_date},",
10
+ " x = ${2:order_date},",
11
+ " y = ${4:total},",
12
+ " title = \"${6:Revenue Trend}\"",
13
+ " )",
14
+ "}"
15
+ ],
16
+ "description": "Create a dashboard with a line chart"
17
+ },
18
+ "Block": {
19
+ "prefix": "dql-block",
20
+ "body": [
21
+ "block \"${1:revenue_by_segment}\" {",
22
+ " domain = \"${2:sales}\"",
23
+ " type = \"chart.bar\"",
24
+ " description = \"${3:Revenue grouped by customer segment}\"",
25
+ " owner = \"${4:data-team}\"",
26
+ " query = \"\"\"",
27
+ " SELECT ${5:segment}, SUM(${6:revenue}) as ${7:rev}",
28
+ " FROM ${8:orders}",
29
+ " GROUP BY ${5:segment}",
30
+ " \"\"\"",
31
+ " visualization {",
32
+ " x = ${5:segment}",
33
+ " y = ${7:rev}",
34
+ " title = \"${9:Revenue by Segment}\"",
35
+ " }",
36
+ " tests {",
37
+ " assert ${7:rev} > 0",
38
+ " }",
39
+ "}"
40
+ ],
41
+ "description": "Create a reusable DQL block"
42
+ },
43
+ "Workbook": {
44
+ "prefix": "dql-workbook",
45
+ "body": [
46
+ "workbook \"${1:Executive Review}\" {",
47
+ " page \"${2:Overview}\" {",
48
+ " layout(columns = 12) {",
49
+ " row {",
50
+ " chart.kpi(",
51
+ " SELECT SUM(${3:revenue}) as total FROM ${4:orders},",
52
+ " metrics = [\"total\"],",
53
+ " title = \"${5:Total Revenue}\"",
54
+ " ) span 12",
55
+ " }",
56
+ " }",
57
+ " }",
58
+ "}"
59
+ ],
60
+ "description": "Create a workbook page skeleton"
61
+ }
62
+ }
@@ -0,0 +1,39 @@
1
+ import * as path from 'node:path';
2
+ import * as vscode from 'vscode';
3
+ import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind } from 'vscode-languageclient/node';
4
+
5
+ let client: LanguageClient | undefined;
6
+
7
+ export async function activate(context: vscode.ExtensionContext): Promise<void> {
8
+ const bundledServer = context.asAbsolutePath(path.join('dist', 'lsp-server.js'));
9
+ const serverOptions: ServerOptions = {
10
+ run: {
11
+ module: bundledServer,
12
+ transport: TransportKind.ipc,
13
+ },
14
+ debug: {
15
+ module: bundledServer,
16
+ transport: TransportKind.ipc,
17
+ options: { execArgv: ['--nolazy', '--inspect=6009'] },
18
+ },
19
+ };
20
+
21
+ const clientOptions: LanguageClientOptions = {
22
+ documentSelector: [
23
+ { scheme: 'file', language: 'dql' },
24
+ { scheme: 'untitled', language: 'dql' },
25
+ ],
26
+ synchronize: {
27
+ fileEvents: vscode.workspace.createFileSystemWatcher('**/*.dql'),
28
+ },
29
+ };
30
+
31
+ client = new LanguageClient('dqlLanguageServer', 'DQL Language Server', serverOptions, clientOptions);
32
+ context.subscriptions.push(client);
33
+ await client.start();
34
+ }
35
+
36
+ export async function deactivate(): Promise<void> {
37
+ if (!client) return;
38
+ await client.stop();
39
+ }
@@ -0,0 +1,92 @@
1
+ {
2
+ "name": "DQL",
3
+ "scopeName": "source.dql",
4
+ "patterns": [
5
+ { "include": "#comments" },
6
+ { "include": "#decorators" },
7
+ { "include": "#keywords" },
8
+ { "include": "#types" },
9
+ { "include": "#numbers" },
10
+ { "include": "#strings" },
11
+ { "include": "#operators" }
12
+ ],
13
+ "repository": {
14
+ "comments": {
15
+ "patterns": [
16
+ {
17
+ "name": "comment.line.double-slash.dql",
18
+ "match": "//.*$"
19
+ }
20
+ ]
21
+ },
22
+ "decorators": {
23
+ "patterns": [
24
+ {
25
+ "name": "entity.name.function.decorator.dql",
26
+ "match": "@[A-Za-z_][A-Za-z0-9_]*"
27
+ }
28
+ ]
29
+ },
30
+ "keywords": {
31
+ "patterns": [
32
+ {
33
+ "name": "keyword.control.dql",
34
+ "match": "\\b(dashboard|workbook|page|layout|row|span|chart|filter|param|let|import|from|use|block|domain|type|description|tags|owner|params|query|visualization|tests|assert|IN)\\b"
35
+ }
36
+ ]
37
+ },
38
+ "types": {
39
+ "patterns": [
40
+ {
41
+ "name": "entity.name.type.chart.dql",
42
+ "match": "(?<=chart\\.)[A-Za-z_][A-Za-z0-9_\\-]*"
43
+ },
44
+ {
45
+ "name": "entity.name.type.filter.dql",
46
+ "match": "(?<=filter\\.)[A-Za-z_][A-Za-z0-9_\\-]*"
47
+ }
48
+ ]
49
+ },
50
+ "numbers": {
51
+ "patterns": [
52
+ {
53
+ "name": "constant.numeric.dql",
54
+ "match": "\\b-?[0-9]+(?:\\.[0-9]+)?\\b"
55
+ }
56
+ ]
57
+ },
58
+ "strings": {
59
+ "patterns": [
60
+ {
61
+ "name": "string.quoted.triple.dql",
62
+ "begin": "\"\"\"",
63
+ "end": "\"\"\""
64
+ },
65
+ {
66
+ "name": "string.quoted.double.dql",
67
+ "begin": "\"",
68
+ "end": "\"",
69
+ "patterns": [
70
+ { "name": "constant.character.escape.dql", "match": "\\\\." }
71
+ ]
72
+ },
73
+ {
74
+ "name": "string.quoted.single.dql",
75
+ "begin": "'",
76
+ "end": "'",
77
+ "patterns": [
78
+ { "name": "constant.character.escape.dql", "match": "\\\\." }
79
+ ]
80
+ }
81
+ ]
82
+ },
83
+ "operators": {
84
+ "patterns": [
85
+ {
86
+ "name": "keyword.operator.comparison.dql",
87
+ "match": "(>=|<=|==|!=|>|<|=)"
88
+ }
89
+ ]
90
+ }
91
+ }
92
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "module": "CommonJS",
5
+ "moduleResolution": "Node",
6
+ "target": "ES2022",
7
+ "lib": ["ES2022"],
8
+ "outDir": "./dist",
9
+ "rootDir": "./src",
10
+ "types": ["node", "vscode"],
11
+ "declaration": false,
12
+ "declarationMap": false,
13
+ "sourceMap": true,
14
+ "composite": false
15
+ },
16
+ "include": ["src/**/*"]
17
+ }