@likec4/language-server 0.35.0 → 0.36.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/dist/generated/ast.d.ts +2 -1
- package/dist/generated/ast.js +2 -1
- package/dist/generated/grammar.js +16 -11
- package/dist/logger.js +3 -2
- package/dist/lsp/DocumentSymbolProvider.js +2 -2
- package/dist/model/model-parser.js +1 -1
- package/dist/references/scope-computation.d.ts +0 -3
- package/dist/references/scope-computation.js +10 -21
- package/package.json +2 -2
package/dist/generated/ast.d.ts
CHANGED
|
@@ -269,8 +269,9 @@ export declare function isSpecificationElementKind(item: unknown): item is Speci
|
|
|
269
269
|
export interface SpecificationRule extends AstNode {
|
|
270
270
|
readonly $container: LikeC4Document;
|
|
271
271
|
readonly $type: 'SpecificationRule';
|
|
272
|
+
elements: Array<SpecificationElementKind>;
|
|
272
273
|
name: 'specification';
|
|
273
|
-
|
|
274
|
+
tags: Array<SpecificationTag>;
|
|
274
275
|
}
|
|
275
276
|
export declare const SpecificationRule = "SpecificationRule";
|
|
276
277
|
export declare function isSpecificationRule(item: unknown): item is SpecificationRule;
|
package/dist/generated/ast.js
CHANGED
|
@@ -352,7 +352,8 @@ export class LikeC4AstReflection extends AbstractAstReflection {
|
|
|
352
352
|
return {
|
|
353
353
|
name: 'SpecificationRule',
|
|
354
354
|
mandatory: [
|
|
355
|
-
{ name: '
|
|
355
|
+
{ name: 'elements', type: 'array' },
|
|
356
|
+
{ name: 'tags', type: 'array' }
|
|
356
357
|
]
|
|
357
358
|
};
|
|
358
359
|
}
|
|
@@ -130,28 +130,33 @@ export const LikeC4Grammar = () => loadedLikeC4Grammar ?? (loadedLikeC4Grammar =
|
|
|
130
130
|
"arguments": []
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
|
-
"$type": "
|
|
134
|
-
"
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
{
|
|
133
|
+
"$type": "Alternatives",
|
|
134
|
+
"elements": [
|
|
135
|
+
{
|
|
136
|
+
"$type": "Assignment",
|
|
137
|
+
"feature": "elements",
|
|
138
|
+
"operator": "+=",
|
|
139
|
+
"terminal": {
|
|
140
140
|
"$type": "RuleCall",
|
|
141
141
|
"rule": {
|
|
142
142
|
"$ref": "#/rules@4"
|
|
143
143
|
},
|
|
144
144
|
"arguments": []
|
|
145
|
-
}
|
|
146
|
-
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"$type": "Assignment",
|
|
149
|
+
"feature": "tags",
|
|
150
|
+
"operator": "+=",
|
|
151
|
+
"terminal": {
|
|
147
152
|
"$type": "RuleCall",
|
|
148
153
|
"rule": {
|
|
149
154
|
"$ref": "#/rules@5"
|
|
150
155
|
},
|
|
151
156
|
"arguments": []
|
|
152
157
|
}
|
|
153
|
-
|
|
154
|
-
|
|
158
|
+
}
|
|
159
|
+
],
|
|
155
160
|
"cardinality": "*"
|
|
156
161
|
},
|
|
157
162
|
{
|
package/dist/logger.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { normalizeError
|
|
2
|
+
import { normalizeError } from '@likec4/core';
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
|
|
4
4
|
let isSilent = false;
|
|
5
5
|
export const logger = {
|
|
@@ -44,6 +44,7 @@ export function logWarnError(err) {
|
|
|
44
44
|
logger.warn(err);
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
const error = normalizeError(err);
|
|
48
|
+
logger.warn(`${error.name}: ${error.message}`);
|
|
48
49
|
}
|
|
49
50
|
//# sourceMappingURL=logger.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findNodeForProperty } from 'langium';
|
|
2
|
-
import { compact, isEmpty, map, pipe } from 'remeda';
|
|
2
|
+
import { compact, concat, isEmpty, map, pipe } from 'remeda';
|
|
3
3
|
import { SymbolKind } from 'vscode-languageserver-protocol';
|
|
4
4
|
import { ast } from '../ast';
|
|
5
5
|
import { logError } from '../logger';
|
|
@@ -68,7 +68,7 @@ export class LikeC4DocumentSymbolProvider {
|
|
|
68
68
|
const specKeywordNode = findNodeForProperty(cstModel, 'name');
|
|
69
69
|
if (!specKeywordNode)
|
|
70
70
|
return [];
|
|
71
|
-
const specSymbols = pipe(astSpec.
|
|
71
|
+
const specSymbols = pipe(concat(astSpec.elements, astSpec.tags), map(nd => {
|
|
72
72
|
if (ast.isSpecificationElementKind(nd)) {
|
|
73
73
|
return getElementKindSymbol(nd);
|
|
74
74
|
}
|
|
@@ -46,7 +46,7 @@ export class LikeC4ModelParser {
|
|
|
46
46
|
}
|
|
47
47
|
async parseDocument(doc, cancelToken) {
|
|
48
48
|
const { elements, relations, views, specification } = cleanParsedModel(doc);
|
|
49
|
-
const specs = doc.parseResult.value.specification?.
|
|
49
|
+
const specs = doc.parseResult.value.specification?.elements;
|
|
50
50
|
if (specs) {
|
|
51
51
|
for (const { kind, style } of specs) {
|
|
52
52
|
if (kind.name in specification.kinds) {
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { DefaultScopeComputation, MultiMap, type AstNodeDescription, type PrecomputedScopes } from 'langium';
|
|
2
2
|
import type { CancellationToken } from 'vscode-languageserver';
|
|
3
3
|
import { ast, type LikeC4LangiumDocument } from '../ast';
|
|
4
|
-
import type { LikeC4Services } from '../module';
|
|
5
4
|
type ElementsContainer = ast.Model | ast.ElementBody | ast.ExtendElementBody;
|
|
6
5
|
export declare class LikeC4ScopeComputation extends DefaultScopeComputation {
|
|
7
|
-
private services;
|
|
8
|
-
constructor(services: LikeC4Services);
|
|
9
6
|
computeExports(document: LikeC4LangiumDocument, _cancelToken: CancellationToken): Promise<AstNodeDescription[]>;
|
|
10
7
|
computeLocalScopes(document: LikeC4LangiumDocument, _cancelToken: CancellationToken): Promise<PrecomputedScopes>;
|
|
11
8
|
protected processContainer(container: ElementsContainer, scopes: PrecomputedScopes, document: LikeC4LangiumDocument): MultiMap<string, AstNodeDescription>;
|
|
@@ -1,32 +1,21 @@
|
|
|
1
1
|
import { DefaultScopeComputation, MultiMap } from 'langium';
|
|
2
|
-
import { ast } from '../ast';
|
|
3
2
|
import { isEmpty } from 'remeda';
|
|
4
|
-
import {
|
|
3
|
+
import { ast } from '../ast';
|
|
5
4
|
export class LikeC4ScopeComputation extends DefaultScopeComputation {
|
|
6
|
-
services;
|
|
7
|
-
constructor(services) {
|
|
8
|
-
super(services);
|
|
9
|
-
this.services = services;
|
|
10
|
-
}
|
|
11
5
|
computeExports(document, _cancelToken) {
|
|
12
6
|
const { specification, model, views } = document.parseResult.value;
|
|
13
7
|
const docExports = [];
|
|
14
|
-
if (specification
|
|
15
|
-
for (const spec of specification.
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
docExports.push(this.descriptions.createDescription(spec.kind, spec.kind.name, document));
|
|
19
|
-
}
|
|
20
|
-
continue;
|
|
8
|
+
if (specification) {
|
|
9
|
+
for (const spec of specification.elements) {
|
|
10
|
+
if (spec.kind && !isEmpty(spec.kind.name)) {
|
|
11
|
+
docExports.push(this.descriptions.createDescription(spec.kind, spec.kind.name, document));
|
|
21
12
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
continue;
|
|
13
|
+
}
|
|
14
|
+
for (const spec of specification.tags) {
|
|
15
|
+
if (spec.tag && !isEmpty(spec.tag.name)) {
|
|
16
|
+
docExports.push(this.descriptions.createDescription(spec.tag, spec.tag.name, document));
|
|
17
|
+
docExports.push(this.descriptions.createDescription(spec.tag, '#' + spec.tag.name, document));
|
|
28
18
|
}
|
|
29
|
-
nonexhaustive(spec);
|
|
30
19
|
}
|
|
31
20
|
}
|
|
32
21
|
// Only root model elements are exported
|
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.36.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
7
7
|
"homepage": "https://likec4.dev",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"test:watch": "vitest"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@likec4/core": "0.
|
|
45
|
+
"@likec4/core": "0.36.0",
|
|
46
46
|
"langium": "^2.0.2",
|
|
47
47
|
"nanoid": "^4.0.2",
|
|
48
48
|
"object-hash": "^3.0.0",
|