@reqlan/language 1.8.2 → 1.9.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 (39) hide show
  1. package/README.md +17 -0
  2. package/out/generated/ast.d.ts +7 -7
  3. package/out/generated/ast.js +4 -4
  4. package/out/generated/grammar.js +2 -2
  5. package/out/generated/grammar.js.map +1 -1
  6. package/out/generated/module.d.ts +1 -1
  7. package/out/generated/module.js +3 -3
  8. package/out/reqlan-async-parser.js +1 -3
  9. package/out/reqlan-async-parser.js.map +1 -1
  10. package/out/reqlan-comment-resolver.d.ts +3 -0
  11. package/out/reqlan-comment-resolver.js.map +1 -1
  12. package/out/reqlan-file-link-resolver.js +27 -10
  13. package/out/reqlan-file-link-resolver.js.map +1 -1
  14. package/out/reqlan-imports.d.ts +1 -0
  15. package/out/reqlan-imports.js.map +1 -1
  16. package/out/reqlan-module.js +2 -2
  17. package/out/reqlan-path-resolve.d.ts +11 -0
  18. package/out/reqlan-path-resolve.js +29 -6
  19. package/out/reqlan-path-resolve.js.map +1 -1
  20. package/out/reqlan-reference-search-site.d.ts +5 -0
  21. package/out/reqlan-reference-search-site.js +8 -0
  22. package/out/reqlan-reference-search-site.js.map +1 -1
  23. package/out/reqlan-token-builder.js +5 -1
  24. package/out/reqlan-token-builder.js.map +1 -1
  25. package/package.json +1 -1
  26. package/src/generated/ast.ts +9 -9
  27. package/src/generated/grammar.ts +2 -2
  28. package/src/generated/module.ts +3 -3
  29. package/src/reqlan-async-parser.ts +4 -5
  30. package/src/reqlan-comment-resolver.ts +3 -0
  31. package/src/reqlan-comment.langium +2 -0
  32. package/src/reqlan-file-link-resolver.ts +29 -10
  33. package/src/reqlan-imports.ts +1 -0
  34. package/src/reqlan-module.ts +2 -2
  35. package/src/reqlan-path-resolve.ts +34 -7
  36. package/src/reqlan-reference-search-site.ts +13 -0
  37. package/src/reqlan-token-builder.ts +5 -1
  38. package/src/reqlan-validator.ts +2 -2
  39. package/src/reqlan.langium +6 -0
@@ -60,6 +60,19 @@ export function toReferenceSearchCommandArgs(
60
60
  };
61
61
  }
62
62
 
63
+ /**
64
+ * Shared path for the LSP `reqlan/referenceSearchSite` handler and the
65
+ * extension-host fallback when the language client is not yet running.
66
+ */
67
+ export function resolveReferenceSearchSiteFromDocument(
68
+ documentUri: string,
69
+ document: LangiumDocument,
70
+ range: Range
71
+ ): ReferenceSearchSiteRequestResult | undefined {
72
+ const site = findReferenceSearchSite(document, range);
73
+ return site ? toReferenceSearchCommandArgs(documentUri, site) : undefined;
74
+ }
75
+
63
76
  /**
64
77
  * Prefer an existing [reference]/[[wikilink]] under the cursor; otherwise a
65
78
  * selection or word in idea-body prose that can be wrapped as `[name]`.
@@ -164,7 +164,11 @@ function isStructuralOpenBraceAtDepth(text: string, offset: number, depth: numbe
164
164
  if (depth === 0 && (blockOpenerLine.test(before) || (isLineStartAt(text, offset) && before.trim().length === 0))) {
165
165
  return true;
166
166
  }
167
- if (/@[A-Za-z_][\w-]*(?::)?\s*$/.test(before)) {
167
+ // `@name {` opens an attribute block only when `@` is the first non-whitespace
168
+ // on the line — same contract as the `@` token and Rust `is_attribute_opener`.
169
+ // Mid-line prose such as `code @plan { goal: … }` must stay a prose brace so
170
+ // nested `@slides` lists (tutorials.rq) do not abort the rest of the file.
171
+ if (/^[ \t]*@[A-Za-z_][\w-]*(?::)?\s*$/.test(before)) {
168
172
  return true;
169
173
  }
170
174
  if (depth >= 1 && isLineStartAt(text, offset)) {
@@ -1,6 +1,6 @@
1
1
  import type { AstNode, ValidationAcceptor, ValidationChecks } from 'langium';
2
2
  import { AstUtils } from 'langium';
3
- import type { ReqlanAstType } from './generated/ast.js';
3
+ import type { reqlanAstType } from './generated/ast.js';
4
4
  import {
5
5
  isFromImport,
6
6
  isIdea,
@@ -40,7 +40,7 @@ import {
40
40
  export function registerValidationChecks(services: ReqlanServices) {
41
41
  const registry = services.validation.ValidationRegistry;
42
42
  const validator = services.validation.ReqlanValidator;
43
- const checks: ValidationChecks<ReqlanAstType> = {
43
+ const checks: ValidationChecks<reqlanAstType> = {
44
44
  Model: validator.checkModelDuplicates,
45
45
  AnonymousBlock: validator.checkNamelessIdeaBlock
46
46
  };
@@ -1,5 +1,11 @@
1
1
  /**
2
2
  * Implementation of the rules described in reqlan rq/language/syntax.rq.
3
+ * rq:["../../../reqlan rq/ontology.rq".grammar_rule]
4
+ * rq:["../../../reqlan rq/ontology.rq".idea]
5
+ * rq:["../../../reqlan rq/ontology.rq".ideaset]
6
+ * rq:["../../../reqlan rq/ontology.rq".keyword]
7
+ * rq:["../../../reqlan rq/ontology.rq".import_statement]
8
+ * rq:["../../../reqlan rq/ontology.rq".reference]
3
9
  *
4
10
  * Design:
5
11
  * - Imports and top-level declarations are line-oriented; import/from/as are keywords only there.