@likec4/language-server 0.33.1 → 0.34.0
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 +17 -3
- package/dist/ast.d.ts +24 -11
- package/dist/ast.js +11 -8
- package/dist/elementRef.d.ts +1 -1
- package/dist/elementRef.js +2 -3
- package/dist/generated/ast.d.ts +29 -10
- package/dist/generated/ast.js +20 -1
- package/dist/generated/grammar.d.ts +1 -1
- package/dist/generated/grammar.js +11 -11
- package/dist/generated/module.d.ts +7 -3
- package/dist/generated/module.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/logger.d.ts +6 -4
- package/dist/logger.js +34 -6
- package/dist/{shared → lsp}/CodeLensProvider.d.ts +3 -3
- package/dist/{shared → lsp}/DocumentLinkProvider.d.ts +3 -2
- package/dist/{shared → lsp}/DocumentLinkProvider.js +3 -3
- package/dist/lsp/DocumentSymbolProvider.js +3 -3
- package/dist/lsp/index.d.ts +2 -0
- package/dist/lsp/index.js +2 -0
- package/dist/model/fqn-computation.js +6 -3
- package/dist/model/fqn-index.d.ts +4 -7
- package/dist/model/fqn-index.js +36 -21
- package/dist/model/index.d.ts +1 -0
- package/dist/model/index.js +1 -0
- package/dist/model/model-builder.d.ts +1 -18
- package/dist/model/model-builder.js +111 -340
- package/dist/model/model-locator.js +5 -9
- package/dist/model/model-parser.d.ts +27 -0
- package/dist/model/model-parser.js +281 -0
- package/dist/module.d.ts +2 -1
- package/dist/module.js +20 -29
- package/dist/protocol.d.ts +8 -16
- package/dist/protocol.js +2 -6
- package/dist/references/scope-provider.js +2 -3
- package/dist/registerProtocolHandlers.js +19 -16
- package/dist/shared/index.d.ts +0 -2
- package/dist/shared/index.js +0 -2
- package/dist/test/testServices.d.ts +2 -2
- package/dist/test/testServices.js +16 -10
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +2 -7
- package/dist/validation/element.d.ts +1 -1
- package/dist/validation/element.js +16 -3
- package/dist/validation/index.js +26 -0
- package/dist/validation/relation.js +3 -10
- package/package.json +6 -5
- /package/dist/{shared → lsp}/CodeLensProvider.js +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getDocument } from 'langium';
|
|
1
2
|
export const elementChecks = (services) => {
|
|
2
3
|
const fqnIndex = services.likec4.FqnIndex;
|
|
3
4
|
return (el, accept) => {
|
|
@@ -9,11 +10,23 @@ export const elementChecks = (services) => {
|
|
|
9
10
|
});
|
|
10
11
|
return;
|
|
11
12
|
}
|
|
12
|
-
const withSameFqn = fqnIndex
|
|
13
|
-
|
|
13
|
+
const withSameFqn = fqnIndex
|
|
14
|
+
.byFqn(fqn)
|
|
15
|
+
.filter(v => v.el !== el)
|
|
16
|
+
.head();
|
|
17
|
+
if (withSameFqn) {
|
|
14
18
|
accept('error', `Duplicate element name ${el.name !== fqn ? el.name + ' (' + fqn + ')' : el.name}`, {
|
|
15
19
|
node: el,
|
|
16
|
-
property: 'name'
|
|
20
|
+
property: 'name',
|
|
21
|
+
relatedInformation: [
|
|
22
|
+
{
|
|
23
|
+
location: {
|
|
24
|
+
range: withSameFqn.el.$cstNode.range,
|
|
25
|
+
uri: getDocument(withSameFqn.el).uri.toString()
|
|
26
|
+
},
|
|
27
|
+
message: `Already defined here`
|
|
28
|
+
}
|
|
29
|
+
]
|
|
17
30
|
});
|
|
18
31
|
}
|
|
19
32
|
};
|
package/dist/validation/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { Utils } from 'vscode-uri';
|
|
2
|
+
import { logger } from '../logger';
|
|
1
3
|
import { elementChecks } from './element';
|
|
2
4
|
import { relationChecks } from './relation';
|
|
3
5
|
import { elementKindChecks, tagChecks } from './specification';
|
|
4
6
|
import { viewChecks } from './view';
|
|
5
7
|
export function registerValidationChecks(services) {
|
|
8
|
+
logger.info('registerValidationChecks');
|
|
6
9
|
const registry = services.validation.ValidationRegistry;
|
|
7
10
|
// const checks: ValidationChecks = {
|
|
8
11
|
// Element: validator.checkElementNameDuplicates,
|
|
@@ -19,5 +22,28 @@ export function registerValidationChecks(services) {
|
|
|
19
22
|
Relation: relationChecks(services),
|
|
20
23
|
Tag: tagChecks(services)
|
|
21
24
|
});
|
|
25
|
+
const connection = services.shared.lsp.Connection;
|
|
26
|
+
if (connection) {
|
|
27
|
+
logger.info('registerValidationChecks');
|
|
28
|
+
// wokraround for bug in langium
|
|
29
|
+
services.shared.workspace.DocumentBuilder.onUpdate((changed, deleted) => {
|
|
30
|
+
const message = [`[DocumentBuilder.onUpdate]`];
|
|
31
|
+
if (changed.length > 0) {
|
|
32
|
+
message.push(` changed:`);
|
|
33
|
+
changed.forEach(u => message.push(` - ${Utils.basename(u)}`));
|
|
34
|
+
}
|
|
35
|
+
if (deleted.length > 0) {
|
|
36
|
+
message.push(` deleted:`);
|
|
37
|
+
deleted.forEach(u => message.push(` - ${Utils.basename(u)}`));
|
|
38
|
+
}
|
|
39
|
+
logger.debug(message.join('\n'));
|
|
40
|
+
for (const uri of deleted) {
|
|
41
|
+
void connection.sendDiagnostics({
|
|
42
|
+
uri: uri.toString(),
|
|
43
|
+
diagnostics: []
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
22
48
|
}
|
|
23
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isSameHierarchy } from '@likec4/core/utils';
|
|
1
|
+
import { isSameHierarchy } from '@likec4/core';
|
|
3
2
|
import { resolveRelationPoints } from '../ast';
|
|
3
|
+
import { logError } from '../logger';
|
|
4
4
|
export const relationChecks = (services) => {
|
|
5
5
|
const fqnIndex = services.likec4.FqnIndex;
|
|
6
6
|
return (el, accept) => {
|
|
@@ -30,14 +30,7 @@ export const relationChecks = (services) => {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
catch (e) {
|
|
33
|
-
|
|
34
|
-
return accept('error', e.message, {
|
|
35
|
-
node: el
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
accept('error', 'Invalid relation', {
|
|
39
|
-
node: el
|
|
40
|
-
});
|
|
33
|
+
logError(e);
|
|
41
34
|
}
|
|
42
35
|
};
|
|
43
36
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/language-server",
|
|
3
3
|
"description": "LikeC4 Language Server",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.34.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
7
7
|
"homepage": "https://likec4.dev",
|
|
@@ -42,20 +42,21 @@
|
|
|
42
42
|
"test:watch": "vitest"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@likec4/core": "0.
|
|
46
|
-
"langium": "^
|
|
45
|
+
"@likec4/core": "0.34.0",
|
|
46
|
+
"langium": "^2.0.0",
|
|
47
47
|
"nanoid": "^4.0.2",
|
|
48
48
|
"object-hash": "^3.0.0",
|
|
49
49
|
"rambdax": "^9.1.1",
|
|
50
50
|
"remeda": "^1.24.0",
|
|
51
51
|
"strip-indent": "^4.0.0",
|
|
52
52
|
"vscode-languageserver": "~8.1.0",
|
|
53
|
-
"vscode-languageserver-protocol": "~3.17.3"
|
|
53
|
+
"vscode-languageserver-protocol": "~3.17.3",
|
|
54
|
+
"vscode-uri": "~3.0.7"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
57
|
"@types/node": "^18.15.11",
|
|
57
58
|
"@types/object-hash": "^3.0.2",
|
|
58
|
-
"langium-cli": "^
|
|
59
|
+
"langium-cli": "^2.0.0",
|
|
59
60
|
"npm-run-all": "^4.1.5",
|
|
60
61
|
"typescript": "^5.1.6",
|
|
61
62
|
"vitest": "^0.34.1"
|
|
File without changes
|