@likec4/language-server 1.2.1 → 1.3.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.
Files changed (36) hide show
  1. package/package.json +19 -8
  2. package/src/ast.ts +2 -0
  3. package/src/generated/ast.ts +157 -123
  4. package/src/generated/grammar.ts +2 -2
  5. package/src/generated/module.ts +1 -1
  6. package/src/like-c4.langium +53 -34
  7. package/src/logger.ts +21 -7
  8. package/src/lsp/CompletionProvider.ts +7 -0
  9. package/src/lsp/SemanticTokenProvider.ts +78 -17
  10. package/src/lsp/index.ts +1 -0
  11. package/src/model/model-builder.ts +3 -39
  12. package/src/model/model-parser.ts +19 -4
  13. package/src/model-change/ModelChanges.ts +58 -53
  14. package/src/model-change/changeElementStyle.ts +5 -6
  15. package/src/model-change/saveManualLayout.ts +43 -0
  16. package/src/model-graph/LikeC4ModelGraph.ts +304 -0
  17. package/src/model-graph/compute-view/__test__/fixture.ts +438 -0
  18. package/src/model-graph/compute-view/compute.ts +430 -0
  19. package/src/model-graph/compute-view/index.ts +33 -0
  20. package/src/model-graph/compute-view/predicates.ts +404 -0
  21. package/src/model-graph/dynamic-view/__test__/fixture.ts +56 -0
  22. package/src/model-graph/dynamic-view/compute.ts +198 -0
  23. package/src/model-graph/dynamic-view/index.ts +29 -0
  24. package/src/model-graph/index.ts +3 -0
  25. package/src/model-graph/utils/applyElementCustomProperties.ts +49 -0
  26. package/src/model-graph/utils/applyViewRuleStyles.ts +68 -0
  27. package/src/model-graph/utils/buildComputeNodes.ts +61 -0
  28. package/src/model-graph/utils/sortNodes.ts +105 -0
  29. package/src/module.ts +3 -0
  30. package/src/protocol.ts +3 -18
  31. package/src/references/scope-computation.ts +29 -11
  32. package/src/references/scope-provider.ts +22 -16
  33. package/src/validation/view.ts +9 -4
  34. package/src/view-utils/manual-layout.ts +93 -0
  35. package/contrib/likec4.monarch.ts +0 -41
  36. package/src/lsp/DocumentLinkProvider.test.ts +0 -66
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@likec4/language-server",
3
3
  "description": "LikeC4 Language Server",
4
- "version": "1.2.1",
4
+ "version": "1.3.0",
5
5
  "license": "MIT",
6
6
  "bugs": "https://github.com/likec4/likec4/issues",
7
7
  "homepage": "https://likec4.dev",
@@ -37,6 +37,10 @@
37
37
  "./node": {
38
38
  "types": "./dist/node/index.d.ts",
39
39
  "default": "./dist/node/index.js"
40
+ },
41
+ "./model-graph": {
42
+ "types": "./dist/model-graph/index.d.ts",
43
+ "default": "./dist/model-graph/index.js"
40
44
  }
41
45
  },
42
46
  "publishConfig": {
@@ -58,6 +62,10 @@
58
62
  "./node": {
59
63
  "types": "./dist/node/index.d.ts",
60
64
  "default": "./dist/node/index.js"
65
+ },
66
+ "./model-graph": {
67
+ "types": "./dist/model-graph/index.d.ts",
68
+ "default": "./dist/model-graph/index.js"
61
69
  }
62
70
  }
63
71
  },
@@ -69,14 +77,17 @@
69
77
  "dev": "run-p 'watch:*'",
70
78
  "lint": "run -T eslint src/ --fix",
71
79
  "clean": "run -T rimraf dist contrib",
72
- "test": "vitest run"
80
+ "test": "vitest run --no-isolate",
81
+ "test:watch": "vitest"
73
82
  },
74
83
  "dependencies": {
75
- "@likec4/core": "1.2.1",
76
- "@likec4/graph": "1.2.1",
84
+ "@dagrejs/graphlib": "^2.2.2",
85
+ "@likec4/core": "1.3.0",
77
86
  "@total-typescript/ts-reset": "^0.5.1",
78
87
  "fast-equals": "^5.0.1",
79
- "langium": "^3.0.0",
88
+ "indent-string": "^5.0.0",
89
+ "json5": "^2.2.3",
90
+ "langium": "3.1.0",
80
91
  "object-hash": "^3.0.0",
81
92
  "p-debounce": "^4.0.0",
82
93
  "rambdax": "^9.1.1",
@@ -90,12 +101,12 @@
90
101
  "vscode-uri": "3.0.8"
91
102
  },
92
103
  "devDependencies": {
93
- "@likec4/tsconfig": "1.2.1",
104
+ "@likec4/tsconfig": "1.3.0",
94
105
  "@types/node": "^20.14.2",
95
106
  "@types/object-hash": "^3.0.6",
96
- "@types/string-hash": "^1",
107
+ "@types/string-hash": "^1.1.3",
97
108
  "execa": "^9.1.0",
98
- "langium-cli": "3.0.3",
109
+ "langium-cli": "3.1.0",
99
110
  "npm-run-all2": "^6.1.2",
100
111
  "typescript": "^5.4.5",
101
112
  "vitest": "~1.5.3"
package/src/ast.ts CHANGED
@@ -92,6 +92,7 @@ export interface ParsedAstElementView {
92
92
  tags: c4.NonEmptyArray<c4.Tag> | null
93
93
  links: c4.NonEmptyArray<string> | null
94
94
  rules: c4.ViewRule[]
95
+ manualLayout?: c4.ViewManualLayout
95
96
  }
96
97
 
97
98
  export interface ParsedAstDynamicView {
@@ -104,6 +105,7 @@ export interface ParsedAstDynamicView {
104
105
  links: c4.NonEmptyArray<string> | null
105
106
  steps: c4.DynamicViewStep[]
106
107
  rules: Array<c4.DynamicViewRule>
108
+ manualLayout?: c4.ViewManualLayout
107
109
  }
108
110
 
109
111
  export type ParsedAstView = ParsedAstElementView | ParsedAstDynamicView