@likec4/language-server 0.5.0 → 0.6.1
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.
- package/contrib/likec4.monarch.ts +31 -0
- package/contrib/likec4.tmLanguage.json +73 -0
- package/dist/__test__/parser-smoke/01-Specification.d.ts +3 -0
- package/dist/__test__/parser-smoke/01-Specification.js +42 -0
- package/dist/__test__/parser-smoke/02-Model.d.ts +9 -0
- package/dist/__test__/parser-smoke/02-Model.js +110 -0
- package/dist/__test__/parser-smoke/03-ModelRelation.d.ts +6 -0
- package/dist/__test__/parser-smoke/03-ModelRelation.js +81 -0
- package/dist/__test__/parser-smoke/04-Scope.d.ts +2 -0
- package/dist/__test__/parser-smoke/04-Scope.js +38 -0
- package/dist/__test__/parser-smoke/05-StrictElementRef.d.ts +3 -0
- package/dist/__test__/parser-smoke/05-StrictElementRef.js +46 -0
- package/dist/__test__/parser-smoke/06-ElementRef.d.ts +2 -0
- package/dist/__test__/parser-smoke/06-ElementRef.js +59 -0
- package/dist/__test__/parser-smoke/07-Views.d.ts +10 -0
- package/dist/__test__/parser-smoke/07-Views.js +146 -0
- package/dist/__test__/parser-smoke/08-Structurizr.d.ts +1 -0
- package/dist/__test__/parser-smoke/08-Structurizr.js +22 -0
- package/dist/__test__/parser-smoke/index.d.ts +8 -0
- package/dist/__test__/parser-smoke/index.js +8 -0
- package/dist/__test__/parser-smoke-extendsElement.spec.d.ts +1 -0
- package/dist/__test__/parser-smoke-extendsElement.spec.js +36 -0
- package/dist/__test__/parser-smoke.spec.d.ts +1 -0
- package/dist/__test__/parser-smoke.spec.js +28 -0
- package/dist/ast.d.ts +1 -0
- package/dist/ast.js +16 -15
- package/dist/generated/ast.d.ts +16 -12
- package/dist/generated/ast.js +15 -5
- package/dist/generated/grammar.js +1534 -1379
- package/dist/index.d.ts +1 -1
- package/dist/index.js +0 -2
- package/dist/lsp/SemanticTokenProvider.js +32 -58
- package/dist/model/model-builder.js +13 -12
- package/dist/model/model-builder.spec.d.ts +1 -0
- package/dist/model/model-builder.spec.js +141 -0
- package/dist/protocol.d.ts +16 -12
- package/dist/protocol.js +2 -2
- package/dist/registerProtocolHandlers.js +24 -9
- package/dist/validation/element.spec.d.ts +1 -0
- package/dist/validation/element.spec.js +65 -0
- package/dist/validation/relation.spec.d.ts +1 -0
- package/dist/validation/relation.spec.js +93 -0
- package/dist/validation/specification.spec.d.ts +1 -0
- package/dist/validation/specification.spec.js +31 -0
- package/dist/validation/view.spec.d.ts +1 -0
- package/dist/validation/view.spec.js +20 -0
- package/package.json +22 -18
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { expect, test } from 'vitest';
|
|
2
|
+
import { createTestServices } from '../test';
|
|
3
|
+
const { validate } = createTestServices();
|
|
4
|
+
test('elementKindChecks', async () => {
|
|
5
|
+
const { diagnostics } = await validate(`
|
|
6
|
+
specification {
|
|
7
|
+
element component
|
|
8
|
+
element user
|
|
9
|
+
element component
|
|
10
|
+
}
|
|
11
|
+
`);
|
|
12
|
+
expect(diagnostics).toHaveLength(2);
|
|
13
|
+
for (const diagnostic of diagnostics) {
|
|
14
|
+
expect(diagnostic.severity, 'diagnostic severity').toBe(1);
|
|
15
|
+
expect(diagnostic.message, 'diagnostic message').toBe("Duplicate element kind 'component'");
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
test('tagChecks', async () => {
|
|
19
|
+
const { diagnostics } = await validate(`
|
|
20
|
+
specification {
|
|
21
|
+
tag tag1
|
|
22
|
+
tag tag2
|
|
23
|
+
tag tag1
|
|
24
|
+
}
|
|
25
|
+
`);
|
|
26
|
+
expect(diagnostics).toHaveLength(2);
|
|
27
|
+
for (const diagnostic of diagnostics) {
|
|
28
|
+
expect(diagnostic.severity, 'diagnostic severity').toBe(1);
|
|
29
|
+
expect(diagnostic.message, 'diagnostic message').toBe("Duplicate tag 'tag1'");
|
|
30
|
+
}
|
|
31
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { createTestServices } from '../test';
|
|
3
|
+
describe('viewChecks', () => {
|
|
4
|
+
it('should report duplicate view names', async () => {
|
|
5
|
+
const { validate } = createTestServices();
|
|
6
|
+
const { diagnostics } = await validate(`
|
|
7
|
+
views {
|
|
8
|
+
view v1 {
|
|
9
|
+
}
|
|
10
|
+
view v1 {
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`);
|
|
14
|
+
expect(diagnostics).toHaveLength(2);
|
|
15
|
+
for (const diagnostic of diagnostics) {
|
|
16
|
+
expect(diagnostic.severity, 'diagnostic severity').toBe(1);
|
|
17
|
+
expect(diagnostic.message, 'diagnostic message').toBe("Duplicate view 'v1'");
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
package/package.json
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/language-server",
|
|
3
|
-
"
|
|
3
|
+
"description": "LikeC4 Language Server",
|
|
4
|
+
"version": "0.6.1",
|
|
5
|
+
"license": "MIT",
|
|
4
6
|
"type": "module",
|
|
5
7
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
6
8
|
"homepage": "https://like-c4.dev",
|
|
7
9
|
"author": "Denis Davydkov <denis@davydkov.com>",
|
|
8
10
|
"files": [
|
|
9
|
-
"dist"
|
|
11
|
+
"dist",
|
|
12
|
+
"contrib"
|
|
10
13
|
],
|
|
11
14
|
"repository": {
|
|
12
15
|
"type": "git",
|
|
13
|
-
"url": "https://github.com/likec4/likec4.git"
|
|
16
|
+
"url": "https://github.com/likec4/likec4.git",
|
|
17
|
+
"directory": "packages/language-server"
|
|
14
18
|
},
|
|
15
19
|
"main": "./dist/index.js",
|
|
20
|
+
"module": "./dist/index.js",
|
|
16
21
|
"types": "./dist/index.d.ts",
|
|
17
22
|
"exports": {
|
|
18
23
|
".": {
|
|
@@ -20,11 +25,6 @@
|
|
|
20
25
|
"import": "./dist/index.js",
|
|
21
26
|
"require": "./dist/index.cjs"
|
|
22
27
|
},
|
|
23
|
-
"./protocol": {
|
|
24
|
-
"types": "./dist/protocol.d.ts",
|
|
25
|
-
"import": "./dist/protocol.js",
|
|
26
|
-
"require": "./dist/protocol.cjs"
|
|
27
|
-
},
|
|
28
28
|
"./builtin": {
|
|
29
29
|
"types": "./dist/builtin.d.ts",
|
|
30
30
|
"import": "./dist/builtin.js",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"registry": "https://registry.npmjs.org",
|
|
36
36
|
"access": "public",
|
|
37
37
|
"main": "./dist/index.js",
|
|
38
|
+
"module": "./dist/index.js",
|
|
38
39
|
"types": "./dist/index.d.ts",
|
|
39
40
|
"exports": {
|
|
40
41
|
".": {
|
|
@@ -42,11 +43,6 @@
|
|
|
42
43
|
"import": "./dist/index.js",
|
|
43
44
|
"require": "./dist/index.cjs"
|
|
44
45
|
},
|
|
45
|
-
"./protocol": {
|
|
46
|
-
"types": "./dist/protocol.d.ts",
|
|
47
|
-
"import": "./dist/protocol.js",
|
|
48
|
-
"require": "./dist/protocol.cjs"
|
|
49
|
-
},
|
|
50
46
|
"./builtin": {
|
|
51
47
|
"types": "./dist/builtin.d.ts",
|
|
52
48
|
"import": "./dist/builtin.js",
|
|
@@ -70,17 +66,25 @@
|
|
|
70
66
|
"test:watch": "vitest"
|
|
71
67
|
},
|
|
72
68
|
"dependencies": {
|
|
73
|
-
"@likec4/core": "0.
|
|
69
|
+
"@likec4/core": "0.6.1",
|
|
70
|
+
"@likec4/language-protocol": "0.6.1",
|
|
74
71
|
"@mobily/ts-belt": "^3.13.1",
|
|
75
|
-
"langium": "^1.1.0",
|
|
76
72
|
"nanoid": "^4.0.2",
|
|
77
73
|
"object-hash": "^3.0.0",
|
|
78
74
|
"rambdax": "^9.1.0",
|
|
79
75
|
"strip-indent": "^4.0.0",
|
|
80
76
|
"tiny-invariant": "^1.3.1",
|
|
81
77
|
"type-fest": "^3.8.0",
|
|
82
|
-
"vscode-
|
|
83
|
-
|
|
78
|
+
"vscode-uri": "~3.0.7"
|
|
79
|
+
},
|
|
80
|
+
"peerDependencies": {
|
|
81
|
+
"langium": "^1.1.0",
|
|
82
|
+
"vscode-languageserver-protocol": "~3.17.2"
|
|
83
|
+
},
|
|
84
|
+
"peerDependenciesMeta": {
|
|
85
|
+
"vscode-languageserver-protocol": {
|
|
86
|
+
"optional": true
|
|
87
|
+
}
|
|
84
88
|
},
|
|
85
89
|
"devDependencies": {
|
|
86
90
|
"@types/node": "^18.15.11",
|
|
@@ -88,7 +92,7 @@
|
|
|
88
92
|
"langium-cli": "^1.1.0",
|
|
89
93
|
"npm-run-all": "^4.1.5",
|
|
90
94
|
"typescript": "^5.0.4",
|
|
91
|
-
"vite": "^4.2.
|
|
95
|
+
"vite": "^4.2.2",
|
|
92
96
|
"vitest": "^0.30.1"
|
|
93
97
|
}
|
|
94
98
|
}
|