@likec4/language-server 1.4.0 → 1.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/README.md +1 -1
- package/contrib/likec4.tmLanguage.json +1 -1
- package/package.json +26 -14
- package/src/Rpc.ts +25 -2
- package/src/ast.ts +19 -15
- package/src/generated/ast.ts +390 -203
- package/src/generated/grammar.ts +1 -1
- package/src/generated-lib/icons.ts +952 -0
- package/src/like-c4.langium +120 -64
- package/src/likec4lib.ts +7 -0
- package/src/lsp/DocumentSymbolProvider.ts +28 -1
- package/src/lsp/SemanticTokenProvider.ts +41 -22
- package/src/model/fqn-computation.ts +29 -7
- package/src/model/fqn-index.ts +18 -31
- package/src/model/model-builder.ts +13 -9
- package/src/model/model-locator.ts +7 -7
- package/src/model/model-parser.ts +166 -69
- package/src/model-change/changeElementStyle.ts +6 -6
- package/src/model-graph/compute-view/__test__/fixture.ts +52 -24
- package/src/model-graph/compute-view/compute.ts +51 -20
- package/src/model-graph/compute-view/predicates.ts +6 -1
- package/src/model-graph/dynamic-view/__test__/fixture.ts +2 -2
- package/src/model-graph/dynamic-view/compute.ts +2 -2
- package/src/model-graph/utils/{applyElementCustomProperties.ts → applyCustomElementProperties.ts} +5 -3
- package/src/model-graph/utils/applyCustomRelationProperties.ts +50 -0
- package/src/model-graph/utils/applyViewRuleStyles.ts +11 -34
- package/src/model-graph/utils/elementExpressionToPredicate.ts +32 -0
- package/src/references/scope-computation.ts +113 -60
- package/src/references/scope-provider.ts +3 -23
- package/src/shared/NodeKindProvider.ts +1 -0
- package/src/shared/WorkspaceManager.ts +15 -6
- package/src/validation/dynamic-view-rule.ts +19 -26
- package/src/validation/element.ts +8 -4
- package/src/validation/index.ts +9 -6
- package/src/validation/property-checks.ts +23 -1
- package/src/validation/view-predicates/custom-element-expr.ts +21 -8
- package/src/validation/view-predicates/custom-relation-expr.ts +16 -0
- package/src/validation/view-predicates/expanded-element.ts +13 -24
- package/src/validation/view-predicates/incoming.ts +5 -5
- package/src/validation/view-predicates/index.ts +1 -0
- package/src/validation/view-predicates/outgoing.ts +5 -5
- package/src/view-utils/assignNavigateTo.ts +2 -2
- package/src/view-utils/manual-layout.ts +4 -2
- package/src/view-utils/resolve-extended-views.ts +2 -2
- package/src/view-utils/resolve-relative-paths.ts +3 -3
|
@@ -29,8 +29,10 @@ export namespace CompactViewManualLayout {
|
|
|
29
29
|
export function pack(layout: ViewManualLayout): CompactViewManualLayout {
|
|
30
30
|
return [
|
|
31
31
|
1,
|
|
32
|
-
entries
|
|
33
|
-
entries
|
|
32
|
+
entries(layout.nodes).map(([id, { x, y, width, height }]) => [id as Fqn, x, y, width, height]),
|
|
33
|
+
entries(layout.edges).map((
|
|
34
|
+
[id, { controlPoints }]
|
|
35
|
+
) => [id as EdgeId, controlPoints.flatMap(({ x, y }) => [x, y])])
|
|
34
36
|
]
|
|
35
37
|
}
|
|
36
38
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import graphlib from '@dagrejs/graphlib'
|
|
2
|
-
import { isExtendsElementView, type
|
|
2
|
+
import { isExtendsElementView, type LikeC4View } from '@likec4/core'
|
|
3
3
|
|
|
4
4
|
// '@dagrejs/graphlib' is a CommonJS module
|
|
5
5
|
// Here is a workaround to import it
|
|
@@ -10,7 +10,7 @@ const { Graph, alg } = graphlib
|
|
|
10
10
|
* (Removes invalid views)
|
|
11
11
|
*/
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
-
export function resolveRulesExtendedViews<V extends Record<any,
|
|
13
|
+
export function resolveRulesExtendedViews<V extends Record<any, LikeC4View>>(
|
|
14
14
|
unresolvedViews: V
|
|
15
15
|
): V {
|
|
16
16
|
const g = new Graph({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LikeC4View } from '@likec4/core'
|
|
2
2
|
import { invariant } from '@likec4/core'
|
|
3
3
|
import { hasAtLeast, unique, zip } from 'remeda'
|
|
4
4
|
|
|
5
|
-
function commonAncestorPath(views:
|
|
5
|
+
function commonAncestorPath(views: LikeC4View[], sep = '/') {
|
|
6
6
|
if (views.length <= 1) return ''
|
|
7
7
|
const uniqURIs = unique(views.flatMap(({ docUri }) => (docUri ? [docUri] : [])))
|
|
8
8
|
if (uniqURIs.length === 0) return ''
|
|
@@ -30,7 +30,7 @@ function commonAncestorPath(views: View[], sep = '/') {
|
|
|
30
30
|
return prefix.endsWith(sep) ? prefix : prefix + sep
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export function resolveRelativePaths(views:
|
|
33
|
+
export function resolveRelativePaths(views: LikeC4View[]): LikeC4View[] {
|
|
34
34
|
const commonPrefix = commonAncestorPath(views)
|
|
35
35
|
return (
|
|
36
36
|
views
|