@likec4/language-server 0.42.0 → 0.42.2

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/ast.d.ts CHANGED
@@ -41,6 +41,7 @@ export interface ParsedAstRelation {
41
41
  source: c4.Fqn;
42
42
  target: c4.Fqn;
43
43
  kind?: c4.RelationshipKind;
44
+ tags?: c4.NonEmptyArray<c4.Tag>;
44
45
  title: string;
45
46
  }
46
47
  export interface ParsedAstElementView {
package/dist/ast.js CHANGED
@@ -1,4 +1,12 @@
1
- import { DefaultElementShape, DefaultThemeColor, RelationRefError, nonexhaustive, DefaultLineStyle, DefaultArrowType, DefaultRelationshipColor } from "@likec4/core";
1
+ import {
2
+ DefaultElementShape,
3
+ DefaultThemeColor,
4
+ RelationRefError,
5
+ nonexhaustive,
6
+ DefaultLineStyle,
7
+ DefaultArrowType,
8
+ DefaultRelationshipColor
9
+ } from "@likec4/core";
2
10
  import { DocumentState } from "langium";
3
11
  import { elementRef } from "./elementRef.js";
4
12
  import * as ast from "./generated/ast.js";
@@ -78,15 +78,16 @@ function buildModel(docs) {
78
78
  astPath,
79
79
  source,
80
80
  target,
81
+ kind,
81
82
  ...model
82
83
  }) => {
83
84
  if (source in elements && target in elements) {
84
- if (model.kind) {
85
- const kind = c4Specification.relationships[model.kind];
85
+ if (!!kind && kind in c4Specification.relationships) {
86
86
  return {
87
87
  source,
88
88
  target,
89
- ...kind,
89
+ kind,
90
+ ...c4Specification.relationships[kind],
90
91
  ...model
91
92
  };
92
93
  }
@@ -64,9 +64,7 @@ ${printDocs(docs)}`);
64
64
  continue;
65
65
  }
66
66
  try {
67
- specification.relationships[kind.name] = toRelationshipStyleExcludeDefaults(
68
- props
69
- );
67
+ specification.relationships[kind.name] = toRelationshipStyleExcludeDefaults(props);
70
68
  } catch (e) {
71
69
  logWarnError(e);
72
70
  }
@@ -136,19 +134,23 @@ ${printDocs(docs)}`);
136
134
  const coupling = resolveRelationPoints(astNode);
137
135
  const target = this.resolveFqn(coupling.target);
138
136
  const source = this.resolveFqn(coupling.source);
137
+ const tags = this.convertTags(astNode.body);
139
138
  const kind = astNode.kind?.ref?.name;
140
- const hashdata = {
141
- astPath: this.getAstNodePath(astNode),
139
+ const astPath = this.getAstNodePath(astNode);
140
+ const title = astNode.title ?? astNode.body?.props.find((p) => p.key === "title")?.value ?? "";
141
+ const id = objectHash({
142
+ astPath,
142
143
  source,
143
144
  target
144
- };
145
- const id = objectHash(hashdata);
146
- const title = astNode.title ?? astNode.body?.props.find((p) => p.key === "title")?.value ?? "";
145
+ });
147
146
  return {
148
147
  id,
149
- ...hashdata,
148
+ astPath,
149
+ source,
150
+ target,
151
+ title,
150
152
  ...kind && { kind },
151
- title
153
+ ...tags && { tags }
152
154
  };
153
155
  }
154
156
  parseElementExpression(astNode) {
@@ -178,11 +180,14 @@ ${printDocs(docs)}`);
178
180
  };
179
181
  }
180
182
  if (ast.isElementRefExpression(astNode)) {
181
- const element = elementRef(astNode.id);
182
- invariant(element, "Element not found " + astNode.id.$cstNode?.text);
183
- return {
184
- element: this.resolveFqn(element),
183
+ const elementNode = elementRef(astNode.id);
184
+ invariant(elementNode, "Element not found " + astNode.id.$cstNode?.text);
185
+ const element = this.resolveFqn(elementNode);
186
+ return astNode.isDescedants ? {
187
+ element,
185
188
  isDescedants: astNode.isDescedants
189
+ } : {
190
+ element
186
191
  };
187
192
  }
188
193
  nonexhaustive(astNode);
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.42.0",
4
+ "version": "0.42.2",
5
5
  "license": "MIT",
6
6
  "bugs": "https://github.com/likec4/likec4/issues",
7
7
  "homepage": "https://likec4.dev",
@@ -50,8 +50,8 @@
50
50
  "test": "vitest run"
51
51
  },
52
52
  "dependencies": {
53
- "@likec4/core": "0.42.0",
54
- "@likec4/graph": "0.42.0",
53
+ "@likec4/core": "0.42.2",
54
+ "@likec4/graph": "0.42.2",
55
55
  "langium": "^2.0.2",
56
56
  "object-hash": "^3.0.0",
57
57
  "p-debounce": "^4.0.0",