@likec4/language-server 1.19.1 → 1.19.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.
@@ -620,10 +620,13 @@ DeploymentViewRulePredicateExpression:
620
620
  ;
621
621
 
622
622
  ExpressionV2:
623
- RelationExpr |
623
+ RelationPredicateOrWhereV2 |
624
624
  FqnExpr
625
625
  ;
626
626
 
627
+ RelationPredicateOrWhereV2:
628
+ RelationExpr ({infer RelationPredicateWhereV2.subject=current} 'where' where=WhereRelationExpression?)?
629
+ ;
627
630
 
628
631
  FqnExpr:
629
632
  {infer WildcardExpression} isWildcard?='*' |
@@ -1,7 +1,7 @@
1
1
  import type * as c4 from '@likec4/core'
2
- import { FqnExpr, invariant, isNonEmptyArray, nonexhaustive } from '@likec4/core'
2
+ import { invariant, isNonEmptyArray, nonexhaustive } from '@likec4/core'
3
3
  import { isNonNullish } from 'remeda'
4
- import { ast, type ParsedAstDeploymentView, toAutoLayout, toElementStyle, ViewOps } from '../../ast'
4
+ import { type ParsedAstDeploymentView, ast, toAutoLayout, toElementStyle, ViewOps } from '../../ast'
5
5
  import { logWarnError } from '../../logger'
6
6
  import { stringHash } from '../../utils'
7
7
  import { parseViewManualLayout } from '../../view-utils/manual-layout'
@@ -14,7 +14,7 @@ export type WithDeploymentView = ReturnType<typeof DeploymentViewParser>
14
14
  export function DeploymentViewParser<TBase extends WithExpressionV2 & WithDeploymentModel>(B: TBase) {
15
15
  return class DeploymentViewParser extends B {
16
16
  parseDeploymentView(
17
- astNode: ast.DeploymentView
17
+ astNode: ast.DeploymentView,
18
18
  ): ParsedAstDeploymentView {
19
19
  const body = astNode.body
20
20
  invariant(body, 'DynamicElementView body is not defined')
@@ -26,7 +26,7 @@ export function DeploymentViewParser<TBase extends WithExpressionV2 & WithDeploy
26
26
  if (!id) {
27
27
  id = 'deployment_' + stringHash(
28
28
  this.doc.uri.toString(),
29
- astPath
29
+ astPath,
30
30
  ) as c4.ViewId
31
31
  }
32
32
 
@@ -56,7 +56,7 @@ export function DeploymentViewParser<TBase extends WithExpressionV2 & WithDeploy
56
56
  return []
57
57
  }
58
58
  }),
59
- ...(manualLayout && { manualLayout })
59
+ ...(manualLayout && { manualLayout }),
60
60
  }
61
61
  }
62
62
 
@@ -87,6 +87,9 @@ export function DeploymentViewParser<TBase extends WithExpressionV2 & WithDeploy
87
87
  case ast.isRelationExpr(expr):
88
88
  exprs.unshift(this.parseRelationExpr(expr))
89
89
  break
90
+ case ast.isRelationPredicateWhereV2(expr):
91
+ exprs.unshift(this.parseRelationWhereExpr(expr))
92
+ break
90
93
  default:
91
94
  nonexhaustive(expr)
92
95
  }
@@ -108,8 +111,8 @@ export function DeploymentViewParser<TBase extends WithExpressionV2 & WithDeploy
108
111
  targets,
109
112
  ...(notation && { notation }),
110
113
  style: {
111
- ...toElementStyle(styleProps, this.isValid)
112
- }
114
+ ...toElementStyle(styleProps, this.isValid),
115
+ },
113
116
  }
114
117
  }
115
118
  }
@@ -4,6 +4,7 @@ import { isNonNullish } from 'remeda'
4
4
  import { ast } from '../../ast'
5
5
  import { logWarnError } from '../../logger'
6
6
  import { instanceRef } from '../../utils/fqnRef'
7
+ import { parseWhereClause } from '../model-parser-where'
7
8
  import type { Base } from './Base'
8
9
 
9
10
  export type WithExpressionV2 = ReturnType<typeof ExpressionV2Parser>
@@ -89,7 +90,20 @@ export function ExpressionV2Parser<TBase extends Base>(B: TBase) {
89
90
  return exprs.reverse()
90
91
  }
91
92
 
93
+ parseRelationWhereExpr(astNode: ast.RelationPredicateWhereV2): c4.RelationExpr {
94
+ return {
95
+ where: {
96
+ expr: this.parseRelationExpr(astNode.subject as ast.RelationExpr),
97
+ condition: astNode.where ? parseWhereClause(astNode.where) : {
98
+ kind: { neq: '--always-true--' },
99
+ },
100
+ },
101
+ }
102
+ }
103
+
92
104
  parseRelationExpr(astNode: ast.RelationExpr): c4.RelationExpr {
105
+ if (ast.isRelationPredicateWhere(astNode)) {
106
+ }
93
107
  if (ast.isDirectedRelationExpr(astNode)) {
94
108
  return {
95
109
  source: this.parseFqnExpr(astNode.source.from),