@likec4/language-server 0.5.0 → 0.6.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/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { createLanguageServices } from './module';
2
+ export type { LikeC4Services } from './module';
2
3
  export { LikeC4LanguageMetaData as LanguageMetaData } from './generated/module';
3
4
  export { Rpc } from './protocol';
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // import { type DefaultSharedModuleContext, startLanguageServer as startLangiumLanguageServer } from 'langium'
2
2
  export { createLanguageServices } from './module';
3
- // export type { C4XServices }
4
3
  // export type { C4XModel } from './c4x-model'
5
4
  // export type { C4XLangiumDocument } from './ast'
6
5
  // export {
@@ -3,7 +3,6 @@
3
3
  * This program and the accompanying materials are made available under the
4
4
  * terms of the MIT License, which is available in the project root.
5
5
  ******************************************************************************/
6
- /// <reference types="react" />
7
6
  import { type DocumentSymbolProvider, type MaybePromise } from 'langium';
8
7
  import { type DocumentSymbol } from 'vscode-languageserver-protocol';
9
8
  import { type LikeC4LangiumDocument, ast } from '../ast';
@@ -15,17 +15,8 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
15
15
  property: 'el',
16
16
  type: isElementRefHead(node) ? SemanticTokenTypes.variable : SemanticTokenTypes.property
17
17
  });
18
- // acceptor({
19
- // node,
20
- // property: 'el',
21
- // type: SemanticTokenTypes.variable,
22
- // })
23
18
  return;
24
19
  }
25
- // if (ast.isSpec(node)) {
26
- // keyword('spec')
27
- // return
28
- // }
29
20
  if (ast.isWildcardExpression(node)) {
30
21
  acceptor({
31
22
  node,
@@ -56,21 +47,6 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
56
47
  }
57
48
  return;
58
49
  }
59
- // if (ast.isDynamicViewStep(node)) {
60
- // keyword(node.isReverse ? '<-' : '->')
61
- // if (hasTitle(node)) {
62
- // acceptor({
63
- // node,
64
- // property: 'title',
65
- // type: SemanticTokenTypes.string
66
- // })
67
- // }
68
- // return
69
- // }
70
- // if (ast.isStyleProperties(node)) {
71
- // keyword('style')
72
- // return
73
- // }
74
50
  if (ast.isElementKind(node)) {
75
51
  acceptor({
76
52
  node,
@@ -122,7 +98,7 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
122
98
  });
123
99
  return;
124
100
  }
125
- if (ast.isColorProperty(node) || ast.isShapeProperty(node)) {
101
+ if (ast.isAStyleProperty(node)) {
126
102
  acceptor({
127
103
  node,
128
104
  property: 'key',
@@ -135,36 +111,34 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
135
111
  });
136
112
  return;
137
113
  }
138
- if (ast.isElementProperty(node) || ast.isRelationProperty(node) || ast.isViewProperty(node)) {
114
+ if (ast.isAnyStringProperty(node)) {
139
115
  acceptor({
140
116
  node,
141
117
  property: 'key',
142
118
  type: SemanticTokenTypes.keyword
143
119
  });
144
- if ('value' in node) {
145
- acceptor({
146
- node,
147
- property: 'value',
148
- type: SemanticTokenTypes.string
149
- });
150
- }
151
- return;
152
- }
153
- if (ast.isModel(node)) {
154
- keyword('model');
155
- return;
156
- }
157
- if (ast.isModelViews(node)) {
158
- keyword('views');
120
+ acceptor({
121
+ node,
122
+ property: 'value',
123
+ type: SemanticTokenTypes.string
124
+ });
159
125
  return;
160
126
  }
127
+ // if (ast.isModel(node)) {
128
+ // keyword('model')
129
+ // return
130
+ // }
131
+ // if (ast.isModelViews(node)) {
132
+ // keyword('views')
133
+ // return
134
+ // }
161
135
  if (ast.isElement(node)) {
162
136
  return this.highlightAstElement(node, acceptor);
163
137
  }
164
- if (ast.isExtendElement(node)) {
165
- keyword('extend');
166
- return;
167
- }
138
+ // if (ast.isExtendElement(node)) {
139
+ // keyword('extend')
140
+ // return
141
+ // }
168
142
  // if (ast.isElementProperty(node) || ast.isRelationProperty(node) || ast.isViewProperty(node)) {
169
143
  // acceptor({
170
144
  // node,
@@ -188,19 +162,19 @@ export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
188
162
  // keyword('steps')
189
163
  // return
190
164
  // }
191
- if (ast.isViewRuleAutoLayout(node)) {
192
- keyword('autoLayout');
193
- return;
194
- }
195
- if (ast.isViewRuleStyle(node)) {
196
- keyword('style');
197
- return;
198
- }
199
- if (ast.isViewRuleExpression(node)) {
200
- keyword(node.isInclude ? 'include' : 'exclude');
201
- return;
202
- }
203
- //
165
+ // if (ast.isViewRuleAutoLayout(node)) {
166
+ // keyword('autoLayout')
167
+ // return
168
+ // }
169
+ // if (ast.isViewRuleStyle(node)) {
170
+ // keyword('style')
171
+ // return
172
+ // }
173
+ // if (ast.isViewRuleExpression(node)) {
174
+ // keyword(node.isInclude ? 'include' : 'exclude')
175
+ // return
176
+ // }
177
+ // //
204
178
  }
205
179
  highlightAstElement(node, acceptor) {
206
180
  acceptor({
@@ -6,6 +6,7 @@ import { DocumentState, getDocument, interruptAndCheck } from 'langium';
6
6
  import objectHash from 'object-hash';
7
7
  import { clone, isNil, mergeDeepRight, omit, reduce } from 'rambdax';
8
8
  import invariant from 'tiny-invariant';
9
+ import { toAutoLayout } from '../ast';
9
10
  import { ElementViewOps, ast, c4hash, cleanParsedModel, isLikeC4LangiumDocument, isParsedLikeC4LangiumDocument, resolveRelationPoints, streamModel, toElementStyle } from '../ast';
10
11
  import { elementRef, strictElementRefFqn } from '../elementRef';
11
12
  import { logger } from '../logger';
@@ -277,7 +278,7 @@ export class LikeC4ModelBuilder {
277
278
  }
278
279
  if (ast.isViewRuleAutoLayout(astNode)) {
279
280
  return {
280
- autoLayout: astNode.direction
281
+ autoLayout: toAutoLayout(astNode.direction)
281
282
  };
282
283
  }
283
284
  failExpectedNever(astNode);
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { ValidationCheck } from 'langium';
3
2
  import type { ast } from '../ast';
4
3
  import type { LikeC4Services } from '../module';
package/package.json CHANGED
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "name": "@likec4/language-server",
3
- "version": "0.5.0",
3
+ "description": "LikeC4 Language Server",
4
+ "version": "0.6.0",
5
+ "license": "MIT",
4
6
  "type": "module",
5
7
  "bugs": "https://github.com/likec4/likec4/issues",
6
8
  "homepage": "https://like-c4.dev",
@@ -10,7 +12,8 @@
10
12
  ],
11
13
  "repository": {
12
14
  "type": "git",
13
- "url": "https://github.com/likec4/likec4.git"
15
+ "url": "https://github.com/likec4/likec4.git",
16
+ "directory": "packages/language-server"
14
17
  },
15
18
  "main": "./dist/index.js",
16
19
  "types": "./dist/index.d.ts",
@@ -70,7 +73,7 @@
70
73
  "test:watch": "vitest"
71
74
  },
72
75
  "dependencies": {
73
- "@likec4/core": "0.5.0",
76
+ "@likec4/core": "0.6.0",
74
77
  "@mobily/ts-belt": "^3.13.1",
75
78
  "langium": "^1.1.0",
76
79
  "nanoid": "^4.0.2",
@@ -88,7 +91,7 @@
88
91
  "langium-cli": "^1.1.0",
89
92
  "npm-run-all": "^4.1.5",
90
93
  "typescript": "^5.0.4",
91
- "vite": "^4.2.1",
94
+ "vite": "^4.2.2",
92
95
  "vitest": "^0.30.1"
93
96
  }
94
97
  }