@reqlan/language 1.4.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 +24 -0
- package/out/file-path-rewrite.d.ts +25 -0
- package/out/file-path-rewrite.js +56 -0
- package/out/file-path-rewrite.js.map +1 -0
- package/out/generated/ast.d.ts +1157 -0
- package/out/generated/ast.js +980 -0
- package/out/generated/ast.js.map +1 -0
- package/out/generated/grammar.d.ts +7 -0
- package/out/generated/grammar.js +3071 -0
- package/out/generated/grammar.js.map +1 -0
- package/out/generated/module.d.ts +20 -0
- package/out/generated/module.js +32 -0
- package/out/generated/module.js.map +1 -0
- package/out/index.d.ts +34 -0
- package/out/index.js +35 -0
- package/out/index.js.map +1 -0
- package/out/reqlan-attribute-catalog.d.ts +19 -0
- package/out/reqlan-attribute-catalog.js +87 -0
- package/out/reqlan-attribute-catalog.js.map +1 -0
- package/out/reqlan-code-action-provider.d.ts +55 -0
- package/out/reqlan-code-action-provider.js +269 -0
- package/out/reqlan-code-action-provider.js.map +1 -0
- package/out/reqlan-code-lens-provider.d.ts +13 -0
- package/out/reqlan-code-lens-provider.js +27 -0
- package/out/reqlan-code-lens-provider.js.map +1 -0
- package/out/reqlan-code-lens-settings.d.ts +34 -0
- package/out/reqlan-code-lens-settings.js +12 -0
- package/out/reqlan-code-lens-settings.js.map +1 -0
- package/out/reqlan-comment-resolver.d.ts +35 -0
- package/out/reqlan-comment-resolver.js +308 -0
- package/out/reqlan-comment-resolver.js.map +1 -0
- package/out/reqlan-completion-context.d.ts +46 -0
- package/out/reqlan-completion-context.js +244 -0
- package/out/reqlan-completion-context.js.map +1 -0
- package/out/reqlan-completion-provider.d.ts +41 -0
- package/out/reqlan-completion-provider.js +317 -0
- package/out/reqlan-completion-provider.js.map +1 -0
- package/out/reqlan-definition-provider.d.ts +31 -0
- package/out/reqlan-definition-provider.js +240 -0
- package/out/reqlan-definition-provider.js.map +1 -0
- package/out/reqlan-document-highlight-provider.d.ts +10 -0
- package/out/reqlan-document-highlight-provider.js +11 -0
- package/out/reqlan-document-highlight-provider.js.map +1 -0
- package/out/reqlan-document-link-provider.d.ts +14 -0
- package/out/reqlan-document-link-provider.js +24 -0
- package/out/reqlan-document-link-provider.js.map +1 -0
- package/out/reqlan-embedded-file-references.d.ts +11 -0
- package/out/reqlan-embedded-file-references.js +50 -0
- package/out/reqlan-embedded-file-references.js.map +1 -0
- package/out/reqlan-file-link-resolver.d.ts +44 -0
- package/out/reqlan-file-link-resolver.js +347 -0
- package/out/reqlan-file-link-resolver.js.map +1 -0
- package/out/reqlan-file-references.d.ts +15 -0
- package/out/reqlan-file-references.js +72 -0
- package/out/reqlan-file-references.js.map +1 -0
- package/out/reqlan-grammar-config.d.ts +5 -0
- package/out/reqlan-grammar-config.js +9 -0
- package/out/reqlan-grammar-config.js.map +1 -0
- package/out/reqlan-idea-reference-site.d.ts +14 -0
- package/out/reqlan-idea-reference-site.js +47 -0
- package/out/reqlan-idea-reference-site.js.map +1 -0
- package/out/reqlan-idea-summary.d.ts +6 -0
- package/out/reqlan-idea-summary.js +134 -0
- package/out/reqlan-idea-summary.js.map +1 -0
- package/out/reqlan-ignore-error.d.ts +10 -0
- package/out/reqlan-ignore-error.js +42 -0
- package/out/reqlan-ignore-error.js.map +1 -0
- package/out/reqlan-import-bindings.d.ts +12 -0
- package/out/reqlan-import-bindings.js +65 -0
- package/out/reqlan-import-bindings.js.map +1 -0
- package/out/reqlan-import-edits.d.ts +17 -0
- package/out/reqlan-import-edits.js +96 -0
- package/out/reqlan-import-edits.js.map +1 -0
- package/out/reqlan-imports.d.ts +22 -0
- package/out/reqlan-imports.js +61 -0
- package/out/reqlan-imports.js.map +1 -0
- package/out/reqlan-inbound-reference-inlay-label.d.ts +27 -0
- package/out/reqlan-inbound-reference-inlay-label.js +142 -0
- package/out/reqlan-inbound-reference-inlay-label.js.map +1 -0
- package/out/reqlan-inlay-hint-provider.d.ts +15 -0
- package/out/reqlan-inlay-hint-provider.js +54 -0
- package/out/reqlan-inlay-hint-provider.js.map +1 -0
- package/out/reqlan-inlay-hint-settings.d.ts +10 -0
- package/out/reqlan-inlay-hint-settings.js +10 -0
- package/out/reqlan-inlay-hint-settings.js.map +1 -0
- package/out/reqlan-linker.d.ts +26 -0
- package/out/reqlan-linker.js +83 -0
- package/out/reqlan-linker.js.map +1 -0
- package/out/reqlan-markdown-links.d.ts +28 -0
- package/out/reqlan-markdown-links.js +113 -0
- package/out/reqlan-markdown-links.js.map +1 -0
- package/out/reqlan-module.d.ts +41 -0
- package/out/reqlan-module.js +78 -0
- package/out/reqlan-module.js.map +1 -0
- package/out/reqlan-name-catalog.d.ts +23 -0
- package/out/reqlan-name-catalog.js +63 -0
- package/out/reqlan-name-catalog.js.map +1 -0
- package/out/reqlan-name-provider.d.ts +10 -0
- package/out/reqlan-name-provider.js +38 -0
- package/out/reqlan-name-provider.js.map +1 -0
- package/out/reqlan-namespace-import-links.d.ts +10 -0
- package/out/reqlan-namespace-import-links.js +69 -0
- package/out/reqlan-namespace-import-links.js.map +1 -0
- package/out/reqlan-path-completion.d.ts +50 -0
- package/out/reqlan-path-completion.js +304 -0
- package/out/reqlan-path-completion.js.map +1 -0
- package/out/reqlan-path-references.d.ts +5 -0
- package/out/reqlan-path-references.js +124 -0
- package/out/reqlan-path-references.js.map +1 -0
- package/out/reqlan-path-resolve.d.ts +81 -0
- package/out/reqlan-path-resolve.js +245 -0
- package/out/reqlan-path-resolve.js.map +1 -0
- package/out/reqlan-quoted-strings.d.ts +9 -0
- package/out/reqlan-quoted-strings.js +26 -0
- package/out/reqlan-quoted-strings.js.map +1 -0
- package/out/reqlan-reference-at-position.d.ts +20 -0
- package/out/reqlan-reference-at-position.js +89 -0
- package/out/reqlan-reference-at-position.js.map +1 -0
- package/out/reqlan-reference-code-lens.d.ts +32 -0
- package/out/reqlan-reference-code-lens.js +240 -0
- package/out/reqlan-reference-code-lens.js.map +1 -0
- package/out/reqlan-reference-search-site.d.ts +34 -0
- package/out/reqlan-reference-search-site.js +136 -0
- package/out/reqlan-reference-search-site.js.map +1 -0
- package/out/reqlan-references.d.ts +16 -0
- package/out/reqlan-references.js +51 -0
- package/out/reqlan-references.js.map +1 -0
- package/out/reqlan-scope.d.ts +25 -0
- package/out/reqlan-scope.js +259 -0
- package/out/reqlan-scope.js.map +1 -0
- package/out/reqlan-semantic-token-provider.d.ts +8 -0
- package/out/reqlan-semantic-token-provider.js +91 -0
- package/out/reqlan-semantic-token-provider.js.map +1 -0
- package/out/reqlan-token-builder.d.ts +12 -0
- package/out/reqlan-token-builder.js +459 -0
- package/out/reqlan-token-builder.js.map +1 -0
- package/out/reqlan-validator.d.ts +25 -0
- package/out/reqlan-validator.js +119 -0
- package/out/reqlan-validator.js.map +1 -0
- package/out/reqlan-workspace-attribute-catalog.d.ts +6 -0
- package/out/reqlan-workspace-attribute-catalog.js +54 -0
- package/out/reqlan-workspace-attribute-catalog.js.map +1 -0
- package/out/src/file-path-rewrite.d.ts +25 -0
- package/out/src/file-path-rewrite.js +56 -0
- package/out/src/file-path-rewrite.js.map +1 -0
- package/out/src/generated/ast.d.ts +1173 -0
- package/out/src/generated/ast.js +994 -0
- package/out/src/generated/ast.js.map +1 -0
- package/out/src/generated/grammar.d.ts +7 -0
- package/out/src/generated/grammar.js +3045 -0
- package/out/src/generated/grammar.js.map +1 -0
- package/out/src/generated/module.d.ts +20 -0
- package/out/src/generated/module.js +32 -0
- package/out/src/generated/module.js.map +1 -0
- package/out/src/index.d.ts +29 -0
- package/out/src/index.js +30 -0
- package/out/src/index.js.map +1 -0
- package/out/src/reqlan-attribute-catalog.d.ts +19 -0
- package/out/src/reqlan-attribute-catalog.js +87 -0
- package/out/src/reqlan-attribute-catalog.js.map +1 -0
- package/out/src/reqlan-code-action-provider.d.ts +34 -0
- package/out/src/reqlan-code-action-provider.js +206 -0
- package/out/src/reqlan-code-action-provider.js.map +1 -0
- package/out/src/reqlan-comment-resolver.d.ts +35 -0
- package/out/src/reqlan-comment-resolver.js +308 -0
- package/out/src/reqlan-comment-resolver.js.map +1 -0
- package/out/src/reqlan-completion-context.d.ts +46 -0
- package/out/src/reqlan-completion-context.js +244 -0
- package/out/src/reqlan-completion-context.js.map +1 -0
- package/out/src/reqlan-completion-provider.d.ts +41 -0
- package/out/src/reqlan-completion-provider.js +320 -0
- package/out/src/reqlan-completion-provider.js.map +1 -0
- package/out/src/reqlan-definition-provider.d.ts +31 -0
- package/out/src/reqlan-definition-provider.js +240 -0
- package/out/src/reqlan-definition-provider.js.map +1 -0
- package/out/src/reqlan-document-highlight-provider.d.ts +10 -0
- package/out/src/reqlan-document-highlight-provider.js +11 -0
- package/out/src/reqlan-document-highlight-provider.js.map +1 -0
- package/out/src/reqlan-document-link-provider.d.ts +14 -0
- package/out/src/reqlan-document-link-provider.js +24 -0
- package/out/src/reqlan-document-link-provider.js.map +1 -0
- package/out/src/reqlan-embedded-file-references.d.ts +11 -0
- package/out/src/reqlan-embedded-file-references.js +50 -0
- package/out/src/reqlan-embedded-file-references.js.map +1 -0
- package/out/src/reqlan-file-link-resolver.d.ts +44 -0
- package/out/src/reqlan-file-link-resolver.js +347 -0
- package/out/src/reqlan-file-link-resolver.js.map +1 -0
- package/out/src/reqlan-file-references.d.ts +15 -0
- package/out/src/reqlan-file-references.js +72 -0
- package/out/src/reqlan-file-references.js.map +1 -0
- package/out/src/reqlan-grammar-config.d.ts +5 -0
- package/out/src/reqlan-grammar-config.js +9 -0
- package/out/src/reqlan-grammar-config.js.map +1 -0
- package/out/src/reqlan-idea-summary.d.ts +6 -0
- package/out/src/reqlan-idea-summary.js +78 -0
- package/out/src/reqlan-idea-summary.js.map +1 -0
- package/out/src/reqlan-ignore-error.d.ts +10 -0
- package/out/src/reqlan-ignore-error.js +42 -0
- package/out/src/reqlan-ignore-error.js.map +1 -0
- package/out/src/reqlan-import-bindings.d.ts +12 -0
- package/out/src/reqlan-import-bindings.js +65 -0
- package/out/src/reqlan-import-bindings.js.map +1 -0
- package/out/src/reqlan-import-edits.d.ts +17 -0
- package/out/src/reqlan-import-edits.js +96 -0
- package/out/src/reqlan-import-edits.js.map +1 -0
- package/out/src/reqlan-imports.d.ts +22 -0
- package/out/src/reqlan-imports.js +61 -0
- package/out/src/reqlan-imports.js.map +1 -0
- package/out/src/reqlan-inbound-reference-inlay-label.d.ts +23 -0
- package/out/src/reqlan-inbound-reference-inlay-label.js +128 -0
- package/out/src/reqlan-inbound-reference-inlay-label.js.map +1 -0
- package/out/src/reqlan-inlay-hint-provider.d.ts +15 -0
- package/out/src/reqlan-inlay-hint-provider.js +54 -0
- package/out/src/reqlan-inlay-hint-provider.js.map +1 -0
- package/out/src/reqlan-inlay-hint-settings.d.ts +10 -0
- package/out/src/reqlan-inlay-hint-settings.js +10 -0
- package/out/src/reqlan-inlay-hint-settings.js.map +1 -0
- package/out/src/reqlan-linker.d.ts +26 -0
- package/out/src/reqlan-linker.js +86 -0
- package/out/src/reqlan-linker.js.map +1 -0
- package/out/src/reqlan-markdown-links.d.ts +28 -0
- package/out/src/reqlan-markdown-links.js +113 -0
- package/out/src/reqlan-markdown-links.js.map +1 -0
- package/out/src/reqlan-module.d.ts +41 -0
- package/out/src/reqlan-module.js +76 -0
- package/out/src/reqlan-module.js.map +1 -0
- package/out/src/reqlan-name-catalog.d.ts +23 -0
- package/out/src/reqlan-name-catalog.js +63 -0
- package/out/src/reqlan-name-catalog.js.map +1 -0
- package/out/src/reqlan-name-provider.d.ts +10 -0
- package/out/src/reqlan-name-provider.js +38 -0
- package/out/src/reqlan-name-provider.js.map +1 -0
- package/out/src/reqlan-namespace-import-links.d.ts +10 -0
- package/out/src/reqlan-namespace-import-links.js +81 -0
- package/out/src/reqlan-namespace-import-links.js.map +1 -0
- package/out/src/reqlan-path-completion.d.ts +50 -0
- package/out/src/reqlan-path-completion.js +304 -0
- package/out/src/reqlan-path-completion.js.map +1 -0
- package/out/src/reqlan-path-references.d.ts +5 -0
- package/out/src/reqlan-path-references.js +124 -0
- package/out/src/reqlan-path-references.js.map +1 -0
- package/out/src/reqlan-path-resolve.d.ts +59 -0
- package/out/src/reqlan-path-resolve.js +173 -0
- package/out/src/reqlan-path-resolve.js.map +1 -0
- package/out/src/reqlan-quoted-strings.d.ts +9 -0
- package/out/src/reqlan-quoted-strings.js +26 -0
- package/out/src/reqlan-quoted-strings.js.map +1 -0
- package/out/src/reqlan-reference-at-position.d.ts +20 -0
- package/out/src/reqlan-reference-at-position.js +89 -0
- package/out/src/reqlan-reference-at-position.js.map +1 -0
- package/out/src/reqlan-references.d.ts +16 -0
- package/out/src/reqlan-references.js +51 -0
- package/out/src/reqlan-references.js.map +1 -0
- package/out/src/reqlan-scope.d.ts +25 -0
- package/out/src/reqlan-scope.js +266 -0
- package/out/src/reqlan-scope.js.map +1 -0
- package/out/src/reqlan-semantic-token-provider.d.ts +8 -0
- package/out/src/reqlan-semantic-token-provider.js +97 -0
- package/out/src/reqlan-semantic-token-provider.js.map +1 -0
- package/out/src/reqlan-token-builder.d.ts +12 -0
- package/out/src/reqlan-token-builder.js +459 -0
- package/out/src/reqlan-token-builder.js.map +1 -0
- package/out/src/reqlan-validator.d.ts +25 -0
- package/out/src/reqlan-validator.js +119 -0
- package/out/src/reqlan-validator.js.map +1 -0
- package/out/src/reqlan-workspace-attribute-catalog.d.ts +6 -0
- package/out/src/reqlan-workspace-attribute-catalog.js +54 -0
- package/out/src/reqlan-workspace-attribute-catalog.js.map +1 -0
- package/out/test/code-actions.test.d.ts +1 -0
- package/out/test/code-actions.test.js +126 -0
- package/out/test/code-actions.test.js.map +1 -0
- package/out/test/comment-in-string.test.d.ts +1 -0
- package/out/test/comment-in-string.test.js +100 -0
- package/out/test/comment-in-string.test.js.map +1 -0
- package/out/test/completion.test.d.ts +1 -0
- package/out/test/completion.test.js +467 -0
- package/out/test/completion.test.js.map +1 -0
- package/out/test/file-path-rewrite.test.d.ts +1 -0
- package/out/test/file-path-rewrite.test.js +64 -0
- package/out/test/file-path-rewrite.test.js.map +1 -0
- package/out/test/ignore-error.test.d.ts +1 -0
- package/out/test/ignore-error.test.js +87 -0
- package/out/test/ignore-error.test.js.map +1 -0
- package/out/test/implicit-import-extension.test.d.ts +1 -0
- package/out/test/implicit-import-extension.test.js +203 -0
- package/out/test/implicit-import-extension.test.js.map +1 -0
- package/out/test/import-edits.test.d.ts +1 -0
- package/out/test/import-edits.test.js +20 -0
- package/out/test/import-edits.test.js.map +1 -0
- package/out/test/inlay-hints.test.d.ts +1 -0
- package/out/test/inlay-hints.test.js +238 -0
- package/out/test/inlay-hints.test.js.map +1 -0
- package/out/test/linking.test.d.ts +1 -0
- package/out/test/linking.test.js +754 -0
- package/out/test/linking.test.js.map +1 -0
- package/out/test/naked-strings.test.d.ts +1 -0
- package/out/test/naked-strings.test.js +50 -0
- package/out/test/naked-strings.test.js.map +1 -0
- package/out/test/parsing.test.d.ts +1 -0
- package/out/test/parsing.test.js +773 -0
- package/out/test/parsing.test.js.map +1 -0
- package/out/test/path-resolve.test.d.ts +1 -0
- package/out/test/path-resolve.test.js +88 -0
- package/out/test/path-resolve.test.js.map +1 -0
- package/out/test/references.test.d.ts +1 -0
- package/out/test/references.test.js +168 -0
- package/out/test/references.test.js.map +1 -0
- package/out/test/rqconfig.test.d.ts +1 -0
- package/out/test/rqconfig.test.js +275 -0
- package/out/test/rqconfig.test.js.map +1 -0
- package/out/test/test-requirement-refs.d.ts +8 -0
- package/out/test/test-requirement-refs.js +35 -0
- package/out/test/test-requirement-refs.js.map +1 -0
- package/out/test/testing.test.d.ts +1 -0
- package/out/test/testing.test.js +23 -0
- package/out/test/testing.test.js.map +1 -0
- package/out/test/validating.test.d.ts +1 -0
- package/out/test/validating.test.js +117 -0
- package/out/test/validating.test.js.map +1 -0
- package/out/tsconfig.tsbuildinfo +1 -0
- package/package.json +54 -0
- package/src/chevrotain.d.ts +8 -0
- package/src/file-path-rewrite.ts +96 -0
- package/src/generated/ast.ts +1481 -0
- package/src/generated/grammar.ts +3074 -0
- package/src/generated/module.ts +38 -0
- package/src/index.ts +34 -0
- package/src/reqlan-attribute-catalog.ts +100 -0
- package/src/reqlan-code-action-provider.ts +385 -0
- package/src/reqlan-code-lens-provider.ts +54 -0
- package/src/reqlan-code-lens-settings.ts +42 -0
- package/src/reqlan-comment-resolver.ts +372 -0
- package/src/reqlan-comment.langium +23 -0
- package/src/reqlan-completion-context.ts +330 -0
- package/src/reqlan-completion-provider.ts +400 -0
- package/src/reqlan-definition-provider.ts +319 -0
- package/src/reqlan-document-highlight-provider.ts +21 -0
- package/src/reqlan-document-link-provider.ts +45 -0
- package/src/reqlan-embedded-file-references.ts +72 -0
- package/src/reqlan-file-link-resolver.ts +485 -0
- package/src/reqlan-file-references.ts +84 -0
- package/src/reqlan-grammar-config.ts +14 -0
- package/src/reqlan-idea-reference-site.ts +74 -0
- package/src/reqlan-idea-summary.ts +162 -0
- package/src/reqlan-ignore-error.ts +50 -0
- package/src/reqlan-import-bindings.ts +87 -0
- package/src/reqlan-import-edits.ts +124 -0
- package/src/reqlan-imports.ts +115 -0
- package/src/reqlan-inbound-reference-inlay-label.ts +194 -0
- package/src/reqlan-inlay-hint-provider.ts +88 -0
- package/src/reqlan-inlay-hint-settings.ts +15 -0
- package/src/reqlan-linker.ts +108 -0
- package/src/reqlan-markdown-links.ts +136 -0
- package/src/reqlan-module.ts +104 -0
- package/src/reqlan-name-catalog.ts +81 -0
- package/src/reqlan-name-provider.ts +56 -0
- package/src/reqlan-namespace-import-links.ts +92 -0
- package/src/reqlan-path-completion.ts +420 -0
- package/src/reqlan-path-references.ts +140 -0
- package/src/reqlan-path-resolve.ts +346 -0
- package/src/reqlan-quoted-strings.ts +30 -0
- package/src/reqlan-reference-at-position.ts +154 -0
- package/src/reqlan-reference-code-lens.ts +323 -0
- package/src/reqlan-reference-search-site.ts +202 -0
- package/src/reqlan-references.ts +76 -0
- package/src/reqlan-scope.ts +312 -0
- package/src/reqlan-semantic-token-provider.ts +113 -0
- package/src/reqlan-token-builder.ts +492 -0
- package/src/reqlan-validator.ts +149 -0
- package/src/reqlan-workspace-attribute-catalog.ts +62 -0
- package/src/reqlan.langium +236 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { findCommentReferencesInText } from './reqlan-comment-resolver.js';
|
|
2
|
+
import { findEmbeddedFileReferencesInText } from './reqlan-embedded-file-references.js';
|
|
3
|
+
import { parseFileReferenceString } from './reqlan-file-references.js';
|
|
4
|
+
import { parseReqlanQuotedString, REQLAN_QUOTED_STRING_CAPTURE } from './reqlan-quoted-strings.js';
|
|
5
|
+
const IMPORT_PATH_PATTERN = new RegExp(`(?:\\bfrom|\\bimport)\\s+(${REQLAN_QUOTED_STRING_CAPTURE})`, 'g');
|
|
6
|
+
export function findImportPathReferencesInText(text, lineOffset = 0) {
|
|
7
|
+
const references = [];
|
|
8
|
+
const lines = text.split(/\r?\n/);
|
|
9
|
+
for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
|
|
10
|
+
const line = lines[lineIndex];
|
|
11
|
+
for (const match of line.matchAll(IMPORT_PATH_PATTERN)) {
|
|
12
|
+
const quoted = match[1];
|
|
13
|
+
const path = parseReqlanQuotedString(quoted);
|
|
14
|
+
const start = match.index + match[0].indexOf(quoted);
|
|
15
|
+
references.push({
|
|
16
|
+
path,
|
|
17
|
+
range: {
|
|
18
|
+
start: { line: lineOffset + lineIndex, character: start },
|
|
19
|
+
end: { line: lineOffset + lineIndex, character: start + quoted.length }
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return references;
|
|
25
|
+
}
|
|
26
|
+
export function findEmbeddedPathReferencesInText(text, lineOffset = 0) {
|
|
27
|
+
const references = [];
|
|
28
|
+
for (const embedded of findEmbeddedFileReferencesInText(text, lineOffset)) {
|
|
29
|
+
const parsed = parseFileReferenceString(embedded.file);
|
|
30
|
+
if (!parsed.filePath) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const quotedPattern = new RegExp(REQLAN_QUOTED_STRING_CAPTURE);
|
|
34
|
+
const embeddedText = text.slice(textOffsetAtPosition(text, embedded.range.start), textOffsetAtPosition(text, embedded.range.end));
|
|
35
|
+
const quotedMatch = quotedPattern.exec(embeddedText);
|
|
36
|
+
if (!quotedMatch) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const quoted = quotedMatch[0];
|
|
40
|
+
const pathIndex = quotedMatch.index ?? embeddedText.indexOf(quoted);
|
|
41
|
+
const absoluteStart = textOffsetAtPosition(text, embedded.range.start) + pathIndex;
|
|
42
|
+
const startPos = offsetToPosition(text, absoluteStart);
|
|
43
|
+
references.push({
|
|
44
|
+
path: parsed.filePath,
|
|
45
|
+
range: {
|
|
46
|
+
start: startPos,
|
|
47
|
+
end: { line: startPos.line, character: startPos.character + quoted.length }
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return references;
|
|
52
|
+
}
|
|
53
|
+
export function findCommentPathReferencesInText(text, lineOffset = 0) {
|
|
54
|
+
const references = [];
|
|
55
|
+
for (const commentRef of findCommentReferencesInText(text, lineOffset)) {
|
|
56
|
+
if (!commentRef.path) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
const quotedPattern = new RegExp(REQLAN_QUOTED_STRING_CAPTURE);
|
|
60
|
+
const segmentStart = textOffsetAtPosition(text, commentRef.range.start);
|
|
61
|
+
const segmentEnd = textOffsetAtPosition(text, commentRef.range.end);
|
|
62
|
+
const segment = text.slice(segmentStart, segmentEnd);
|
|
63
|
+
const quotedMatch = quotedPattern.exec(segment);
|
|
64
|
+
if (!quotedMatch) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const quoted = quotedMatch[0];
|
|
68
|
+
const pathIndex = quotedMatch.index ?? segment.indexOf(quoted);
|
|
69
|
+
const absoluteStart = segmentStart + pathIndex;
|
|
70
|
+
const startPos = offsetToPosition(text, absoluteStart);
|
|
71
|
+
references.push({
|
|
72
|
+
path: commentRef.path,
|
|
73
|
+
range: {
|
|
74
|
+
start: startPos,
|
|
75
|
+
end: { line: startPos.line, character: startPos.character + quoted.length }
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return references;
|
|
80
|
+
}
|
|
81
|
+
export function findPathReferencesInMovedFile(text, isRqFile) {
|
|
82
|
+
const references = isRqFile
|
|
83
|
+
? [...findImportPathReferencesInText(text), ...findEmbeddedPathReferencesInText(text)]
|
|
84
|
+
: findCommentPathReferencesInText(text);
|
|
85
|
+
return dedupePathReferences(references);
|
|
86
|
+
}
|
|
87
|
+
function dedupePathReferences(references) {
|
|
88
|
+
const seen = new Set();
|
|
89
|
+
const unique = [];
|
|
90
|
+
for (const reference of references) {
|
|
91
|
+
const key = [
|
|
92
|
+
reference.range.start.line,
|
|
93
|
+
reference.range.start.character,
|
|
94
|
+
reference.range.end.line,
|
|
95
|
+
reference.range.end.character
|
|
96
|
+
].join(':');
|
|
97
|
+
if (seen.has(key)) {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
seen.add(key);
|
|
101
|
+
unique.push(reference);
|
|
102
|
+
}
|
|
103
|
+
return unique;
|
|
104
|
+
}
|
|
105
|
+
function textOffsetAtLine(text, lineIndex) {
|
|
106
|
+
const lines = text.split(/\r?\n/);
|
|
107
|
+
let offset = 0;
|
|
108
|
+
for (let index = 0; index < lineIndex; index++) {
|
|
109
|
+
offset += lines[index].length + 1;
|
|
110
|
+
}
|
|
111
|
+
return offset;
|
|
112
|
+
}
|
|
113
|
+
function textOffsetAtPosition(text, position) {
|
|
114
|
+
return textOffsetAtLine(text, position.line) + position.character;
|
|
115
|
+
}
|
|
116
|
+
function offsetToPosition(text, offset) {
|
|
117
|
+
const before = text.slice(0, offset);
|
|
118
|
+
const lines = before.split(/\r?\n/);
|
|
119
|
+
return {
|
|
120
|
+
line: lines.length - 1,
|
|
121
|
+
character: lines[lines.length - 1].length
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=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O,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY,EAAE,SAAiB;IACrD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAClC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CAAC,KAAK,CAAE,CAAC,MAAM,GAAG,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAY,EAAE,QAAwB;IAChE,OAAO,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC;AACtE,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY,EAAE,MAAc;IAClD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO;QACH,IAAI,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC;QACtB,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,MAAM;KAC7C,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves document-relative and import-root-aliased paths (default `@/`).
|
|
3
|
+
* rq:["../../../reqlan rq/extension/configuration.rq".configuration_location]
|
|
4
|
+
* rq:["../../../reqlan rq/extension/configuration.rq".configuration_import_roots]
|
|
5
|
+
* rq:["../../../reqlan rq/language/imports.rq".configuration_import_root_alias]
|
|
6
|
+
*/
|
|
7
|
+
import type { FileSystemProvider, LangiumDocument, URI } from 'langium';
|
|
8
|
+
export declare const DEFAULT_IMPORT_ROOT_ALIAS = "@";
|
|
9
|
+
export declare const RQCONFIG_FILENAME = ".rqconfig.json";
|
|
10
|
+
export interface ImportRootMapping {
|
|
11
|
+
alias: string;
|
|
12
|
+
/** Absolute URI of that alias’s import-root directory, when set. */
|
|
13
|
+
rootUri?: URI;
|
|
14
|
+
}
|
|
15
|
+
export interface RqConfig {
|
|
16
|
+
importRoots: ImportRootMapping[];
|
|
17
|
+
}
|
|
18
|
+
export interface PathResolveContext {
|
|
19
|
+
/** Workspace folders that contain documents (longest match wins). */
|
|
20
|
+
workspaceFolderUris?: readonly URI[];
|
|
21
|
+
/** Explicit workspace folder for tests; preferred over list lookup when set. */
|
|
22
|
+
workspaceFolderUri?: URI;
|
|
23
|
+
fileSystem?: FileSystemProvider;
|
|
24
|
+
/**
|
|
25
|
+
* Preloaded config. `undefined` loads nearest `.rqconfig.json` when fileSystem is set.
|
|
26
|
+
* `null` skips loading and uses defaults only.
|
|
27
|
+
*/
|
|
28
|
+
config?: RqConfig | null;
|
|
29
|
+
}
|
|
30
|
+
export declare function defaultRqConfig(): RqConfig;
|
|
31
|
+
export declare function matchImportRootAlias(path: string, alias: string): string | undefined;
|
|
32
|
+
/** Longest matching alias wins when several mappings could apply. */
|
|
33
|
+
export declare function matchImportRootMapping(path: string, mappings: readonly ImportRootMapping[]): {
|
|
34
|
+
mapping: ImportRootMapping;
|
|
35
|
+
remainder: string;
|
|
36
|
+
} | undefined;
|
|
37
|
+
export declare function findWorkspaceFolderUri(documentUri: URI, folderUris: readonly URI[] | undefined): URI | undefined;
|
|
38
|
+
export declare function loadApplyingRqConfig(startDirUri: URI, fileSystem: FileSystemProvider): RqConfig | undefined;
|
|
39
|
+
export declare function resolveRqConfig(document: LangiumDocument, context?: PathResolveContext): RqConfig;
|
|
40
|
+
export declare function resolveImportRootUri(document: LangiumDocument, context: PathResolveContext | undefined, mapping: ImportRootMapping): URI | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Resolves a path string against the document directory, or against an import root when aliased.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveDocumentPathUri(path: string, document: LangiumDocument, context?: PathResolveContext): URI;
|
|
45
|
+
export declare function workspaceFolderUrisFromManager(folders: ReadonlyArray<{
|
|
46
|
+
uri: string;
|
|
47
|
+
}> | undefined): URI[];
|
|
48
|
+
export declare function pathResolveContextFromServices(services: {
|
|
49
|
+
shared: {
|
|
50
|
+
workspace: {
|
|
51
|
+
WorkspaceManager: {
|
|
52
|
+
workspaceFolders?: ReadonlyArray<{
|
|
53
|
+
uri: string;
|
|
54
|
+
}>;
|
|
55
|
+
};
|
|
56
|
+
FileSystemProvider: FileSystemProvider;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
}): PathResolveContext;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { URI as UriCtor, UriUtils } from 'langium';
|
|
2
|
+
export const DEFAULT_IMPORT_ROOT_ALIAS = '@';
|
|
3
|
+
export const RQCONFIG_FILENAME = '.rqconfig.json';
|
|
4
|
+
export function defaultRqConfig() {
|
|
5
|
+
return { importRoots: [{ alias: DEFAULT_IMPORT_ROOT_ALIAS }] };
|
|
6
|
+
}
|
|
7
|
+
export function matchImportRootAlias(path, alias) {
|
|
8
|
+
if (!alias || !path.startsWith(alias)) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
const afterAlias = path.slice(alias.length);
|
|
12
|
+
if (!afterAlias.startsWith('/')) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
return afterAlias.slice(1);
|
|
16
|
+
}
|
|
17
|
+
/** Longest matching alias wins when several mappings could apply. */
|
|
18
|
+
export function matchImportRootMapping(path, mappings) {
|
|
19
|
+
const ordered = [...mappings]
|
|
20
|
+
.filter(mapping => mapping.alias.length > 0)
|
|
21
|
+
.sort((left, right) => right.alias.length - left.alias.length);
|
|
22
|
+
for (const mapping of ordered) {
|
|
23
|
+
const remainder = matchImportRootAlias(path, mapping.alias);
|
|
24
|
+
if (remainder !== undefined) {
|
|
25
|
+
return { mapping, remainder };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
export function findWorkspaceFolderUri(documentUri, folderUris) {
|
|
31
|
+
if (!folderUris || folderUris.length === 0) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
const documentPath = documentUri.toString();
|
|
35
|
+
let best;
|
|
36
|
+
let bestLength = -1;
|
|
37
|
+
for (const folder of folderUris) {
|
|
38
|
+
const folderPath = folder.path.endsWith('/')
|
|
39
|
+
? folder.toString()
|
|
40
|
+
: `${folder.toString()}/`;
|
|
41
|
+
const folderBase = folder.toString();
|
|
42
|
+
if (documentPath === folderBase || documentPath.startsWith(folderPath)) {
|
|
43
|
+
const length = folderBase.length;
|
|
44
|
+
if (length > bestLength) {
|
|
45
|
+
best = folder;
|
|
46
|
+
bestLength = length;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return best;
|
|
51
|
+
}
|
|
52
|
+
export function loadApplyingRqConfig(startDirUri, fileSystem) {
|
|
53
|
+
let dir = startDirUri;
|
|
54
|
+
for (;;) {
|
|
55
|
+
const configUri = UriUtils.joinPath(dir, RQCONFIG_FILENAME);
|
|
56
|
+
if (fileSystem.existsSync(configUri) && !fileSystem.statSync(configUri).isDirectory) {
|
|
57
|
+
return parseRqConfig(configUri, fileSystem);
|
|
58
|
+
}
|
|
59
|
+
const parent = UriUtils.dirname(dir);
|
|
60
|
+
if (UriUtils.equals(parent, dir)) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
dir = parent;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function parseRqConfig(configUri, fileSystem) {
|
|
67
|
+
let raw;
|
|
68
|
+
try {
|
|
69
|
+
raw = JSON.parse(fileSystem.readFileSync(configUri));
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
const record = raw;
|
|
78
|
+
if (!('importRoots' in record)) {
|
|
79
|
+
return defaultRqConfig();
|
|
80
|
+
}
|
|
81
|
+
if (!Array.isArray(record.importRoots)) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
const configDir = UriUtils.dirname(configUri);
|
|
85
|
+
const importRoots = [];
|
|
86
|
+
for (const entry of record.importRoots) {
|
|
87
|
+
const mapping = parseImportRootEntry(entry, configDir);
|
|
88
|
+
if (mapping) {
|
|
89
|
+
importRoots.push(mapping);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (importRoots.length === 0) {
|
|
93
|
+
return defaultRqConfig();
|
|
94
|
+
}
|
|
95
|
+
return { importRoots };
|
|
96
|
+
}
|
|
97
|
+
function parseImportRootEntry(entry, configDir) {
|
|
98
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
const record = entry;
|
|
102
|
+
if (typeof record.alias !== 'string' || record.alias.length === 0) {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
const mapping = { alias: record.alias };
|
|
106
|
+
if (typeof record.root === 'string' && record.root.length > 0) {
|
|
107
|
+
mapping.rootUri = isAbsoluteUriOrPath(record.root)
|
|
108
|
+
? toDirectoryUri(record.root)
|
|
109
|
+
: UriUtils.resolvePath(configDir, record.root);
|
|
110
|
+
}
|
|
111
|
+
return mapping;
|
|
112
|
+
}
|
|
113
|
+
function isAbsoluteUriOrPath(value) {
|
|
114
|
+
return /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(value) || value.startsWith('/');
|
|
115
|
+
}
|
|
116
|
+
function toDirectoryUri(value) {
|
|
117
|
+
if (/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(value)) {
|
|
118
|
+
return UriCtor.parse(value);
|
|
119
|
+
}
|
|
120
|
+
return UriCtor.file(value);
|
|
121
|
+
}
|
|
122
|
+
export function resolveRqConfig(document, context) {
|
|
123
|
+
if (context?.config === null) {
|
|
124
|
+
return defaultRqConfig();
|
|
125
|
+
}
|
|
126
|
+
if (context?.config) {
|
|
127
|
+
return context.config;
|
|
128
|
+
}
|
|
129
|
+
if (context?.fileSystem) {
|
|
130
|
+
const loaded = loadApplyingRqConfig(UriUtils.dirname(document.uri), context.fileSystem);
|
|
131
|
+
if (loaded) {
|
|
132
|
+
return loaded;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return defaultRqConfig();
|
|
136
|
+
}
|
|
137
|
+
export function resolveImportRootUri(document, context, mapping) {
|
|
138
|
+
if (mapping.rootUri) {
|
|
139
|
+
return mapping.rootUri;
|
|
140
|
+
}
|
|
141
|
+
if (context?.workspaceFolderUri) {
|
|
142
|
+
return context.workspaceFolderUri;
|
|
143
|
+
}
|
|
144
|
+
return findWorkspaceFolderUri(document.uri, context?.workspaceFolderUris);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Resolves a path string against the document directory, or against an import root when aliased.
|
|
148
|
+
*/
|
|
149
|
+
export function resolveDocumentPathUri(path, document, context) {
|
|
150
|
+
const config = resolveRqConfig(document, context);
|
|
151
|
+
const matched = matchImportRootMapping(path, config.importRoots);
|
|
152
|
+
if (!matched) {
|
|
153
|
+
return UriUtils.resolvePath(UriUtils.dirname(document.uri), path);
|
|
154
|
+
}
|
|
155
|
+
const importRoot = resolveImportRootUri(document, context, matched.mapping);
|
|
156
|
+
if (!importRoot) {
|
|
157
|
+
return UriUtils.resolvePath(UriUtils.dirname(document.uri), path);
|
|
158
|
+
}
|
|
159
|
+
return UriUtils.resolvePath(importRoot, matched.remainder);
|
|
160
|
+
}
|
|
161
|
+
export function workspaceFolderUrisFromManager(folders) {
|
|
162
|
+
if (!folders) {
|
|
163
|
+
return [];
|
|
164
|
+
}
|
|
165
|
+
return folders.map(folder => UriCtor.parse(folder.uri));
|
|
166
|
+
}
|
|
167
|
+
export function pathResolveContextFromServices(services) {
|
|
168
|
+
return {
|
|
169
|
+
fileSystem: services.shared.workspace.FileSystemProvider,
|
|
170
|
+
workspaceFolderUris: workspaceFolderUrisFromManager(services.shared.workspace.WorkspaceManager.workspaceFolders)
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=reqlan-path-resolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reqlan-path-resolve.js","sourceRoot":"","sources":["../../src/reqlan-path-resolve.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAC7C,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAyBlD,MAAM,UAAU,eAAe;IAC3B,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE,KAAK,EAAE,yBAAyB,EAAE,CAAC,EAAE,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAY,EAAE,KAAa;IAC5D,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACpC,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,sBAAsB,CAClC,IAAY,EACZ,QAAsC;IAEtC,MAAM,OAAO,GAAG,CAAC,GAAG,QAAQ,CAAC;SACxB,MAA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;IACG,OAAO;QACH,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,kBAAkB;QACxD,mBAAmB,EAAE,8BAA8B,CAC/C,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,gBAAgB,CAC9D;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for reqlan double- and single-quoted string literals.
|
|
3
|
+
*/
|
|
4
|
+
/** Capturing group for one quoted string (double or single). */
|
|
5
|
+
export declare const REQLAN_QUOTED_STRING_CAPTURE = "(?:\"(?:\\\\.|[^\"\\\\])*\"|'(?:\\\\.|[^'\\\\])*')";
|
|
6
|
+
export declare const REQLAN_QUOTED_STRING_PATTERN: RegExp;
|
|
7
|
+
export declare function reqlanStringDelimiter(text: string): '"' | "'" | undefined;
|
|
8
|
+
export declare function unquoteReqlanString(text: string): string;
|
|
9
|
+
export declare function parseReqlanQuotedString(quoted: string): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for reqlan double- and single-quoted string literals.
|
|
3
|
+
*/
|
|
4
|
+
/** Capturing group for one quoted string (double or single). */
|
|
5
|
+
export const REQLAN_QUOTED_STRING_CAPTURE = '(?:"(?:\\\\.|[^"\\\\])*"|\'(?:\\\\.|[^\'\\\\])*\')';
|
|
6
|
+
export const REQLAN_QUOTED_STRING_PATTERN = new RegExp(REQLAN_QUOTED_STRING_CAPTURE, 'g');
|
|
7
|
+
export function reqlanStringDelimiter(text) {
|
|
8
|
+
if (text.startsWith('"')) {
|
|
9
|
+
return '"';
|
|
10
|
+
}
|
|
11
|
+
if (text.startsWith("'")) {
|
|
12
|
+
return "'";
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
export function unquoteReqlanString(text) {
|
|
17
|
+
const delimiter = reqlanStringDelimiter(text);
|
|
18
|
+
if (!delimiter || !text.endsWith(delimiter)) {
|
|
19
|
+
return text;
|
|
20
|
+
}
|
|
21
|
+
return text.slice(1, -1).replace(/\\(.)/g, '$1');
|
|
22
|
+
}
|
|
23
|
+
export function parseReqlanQuotedString(quoted) {
|
|
24
|
+
return unquoteReqlanString(quoted);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=reqlan-quoted-strings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reqlan-quoted-strings.js","sourceRoot":"","sources":["../../src/reqlan-quoted-strings.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,gEAAgE;AAChE,MAAM,CAAC,MAAM,4BAA4B,GAAG,oDAAoD,CAAC;AAEjG,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,MAAM,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;AAE1F,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAC9C,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC;IACf,CAAC;IACD,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC;IACf,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC5C,MAAM,SAAS,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,MAAc;IAClD,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locates file path references at a cursor position and resolves them to files, folders, or missing paths.
|
|
3
|
+
*/
|
|
4
|
+
import type { FileSystemProvider, LangiumDocument, LangiumDocuments } from 'langium';
|
|
5
|
+
import type { Position, LocationLink } from 'vscode-languageserver';
|
|
6
|
+
import { type ReferenceResolution, type ResolvedFileLink } from './reqlan-file-link-resolver.js';
|
|
7
|
+
import type { PathResolveContext } from './reqlan-path-resolve.js';
|
|
8
|
+
export declare const REQLAN_OPEN_FOLDER_COMMAND = "reqlan.openFolderReference";
|
|
9
|
+
export declare const REQLAN_FILE_REFERENCE_AT_REQUEST = "reqlan/fileReferenceAt";
|
|
10
|
+
export declare const REQLAN_COMMENT_DEFINITION_REQUEST = "reqlan/commentDefinition";
|
|
11
|
+
export declare function folderReferenceCommandTarget(folderUri: string): string;
|
|
12
|
+
export declare function findFileReferenceAtPosition(document: LangiumDocument, position: Position, documents: LangiumDocuments, fileSystem: FileSystemProvider, context?: PathResolveContext): ResolvedFileLink | undefined;
|
|
13
|
+
export interface FileReferenceAtRequestResult {
|
|
14
|
+
sourceRange: ResolvedFileLink['sourceRange'];
|
|
15
|
+
targetUri: string;
|
|
16
|
+
resolution: ReferenceResolution;
|
|
17
|
+
folderFiles?: string[];
|
|
18
|
+
}
|
|
19
|
+
export declare function findCommentDefinitionAtPosition(document: LangiumDocument, position: Position, documents: LangiumDocuments, context?: PathResolveContext): LocationLink[] | undefined;
|
|
20
|
+
export declare function fileReferenceAtRequestResult(link: ResolvedFileLink): FileReferenceAtRequestResult;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { CstUtils, GrammarUtils } from 'langium';
|
|
2
|
+
import { findCommentReferencePartAt, resolveCommentDefinitionLinks, resolveFileUri } from './reqlan-comment-resolver.js';
|
|
3
|
+
import { findEmbeddedFileReferenceAt } from './reqlan-embedded-file-references.js';
|
|
4
|
+
import { classifyReferenceUri, listFolderFileNames, resolveEmbeddedFileReferenceLink, resolveFileReferenceLink } from './reqlan-file-link-resolver.js';
|
|
5
|
+
import { isFileReference, isFileSymbolReference } from './generated/ast.js';
|
|
6
|
+
export const REQLAN_OPEN_FOLDER_COMMAND = 'reqlan.openFolderReference';
|
|
7
|
+
export const REQLAN_FILE_REFERENCE_AT_REQUEST = 'reqlan/fileReferenceAt';
|
|
8
|
+
export const REQLAN_COMMENT_DEFINITION_REQUEST = 'reqlan/commentDefinition';
|
|
9
|
+
export function folderReferenceCommandTarget(folderUri) {
|
|
10
|
+
return `command:${REQLAN_OPEN_FOLDER_COMMAND}?${encodeURIComponent(JSON.stringify([folderUri]))}`;
|
|
11
|
+
}
|
|
12
|
+
export function findFileReferenceAtPosition(document, position, documents, fileSystem, context) {
|
|
13
|
+
const pathContext = { ...context, fileSystem: context?.fileSystem ?? fileSystem };
|
|
14
|
+
const commentPart = findCommentReferencePartAt(document, position);
|
|
15
|
+
if (commentPart?.property === 'path' && commentPart.reference.path) {
|
|
16
|
+
return resolvePathReference(document, commentPart.reference.path, commentPart.reference.range, documents, fileSystem, pathContext);
|
|
17
|
+
}
|
|
18
|
+
const embeddedReference = findEmbeddedFileReferenceAt(document, position);
|
|
19
|
+
if (embeddedReference) {
|
|
20
|
+
return resolveEmbeddedFileReferenceLink(embeddedReference, document, documents, fileSystem, pathContext);
|
|
21
|
+
}
|
|
22
|
+
const fileReference = findFileReferenceNodeAtPosition(document, position);
|
|
23
|
+
if (fileReference) {
|
|
24
|
+
return resolveFileReferenceLink(fileReference.node, documents, fileSystem, pathContext);
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
function resolvePathReference(document, path, sourceRange, documents, fileSystem, context) {
|
|
29
|
+
const targetUri = resolveFileUri(path, document, context);
|
|
30
|
+
const resolution = classifyReferenceUri(targetUri, documents, fileSystem);
|
|
31
|
+
if (resolution === 'missing') {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
if (resolution === 'folder') {
|
|
35
|
+
return {
|
|
36
|
+
sourceRange,
|
|
37
|
+
targetUri: targetUri.toString(),
|
|
38
|
+
resolution,
|
|
39
|
+
folderFiles: listFolderFileNames(fileSystem, targetUri)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const targetDocument = documents.getDocument(targetUri);
|
|
43
|
+
const target = targetDocument?.parseResult.value.$cstNode;
|
|
44
|
+
if (!targetDocument || !target) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
sourceRange,
|
|
49
|
+
targetUri: targetDocument.textDocument.uri,
|
|
50
|
+
targetRange: target.range,
|
|
51
|
+
resolution: 'file'
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function findFileReferenceNodeAtPosition(document, position) {
|
|
55
|
+
const root = document.parseResult.value.$cstNode;
|
|
56
|
+
if (!root) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const offset = document.textDocument.offsetAt(position);
|
|
60
|
+
let current = CstUtils.findLeafNodeAtOffset(root, offset);
|
|
61
|
+
while (current) {
|
|
62
|
+
const assignment = GrammarUtils.findAssignment(current);
|
|
63
|
+
const container = current.astNode;
|
|
64
|
+
if ((isFileReference(container) || isFileSymbolReference(container)) && assignment?.feature === 'file') {
|
|
65
|
+
const pathNode = GrammarUtils.findNodeForProperty(container.$cstNode, 'file');
|
|
66
|
+
if (pathNode) {
|
|
67
|
+
return { node: container, pathNode };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
current = current.container;
|
|
71
|
+
}
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
export function findCommentDefinitionAtPosition(document, position, documents, context) {
|
|
75
|
+
const commentPart = findCommentReferencePartAt(document, position);
|
|
76
|
+
if (commentPart?.property !== 'idea') {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
return resolveCommentDefinitionLinks(commentPart.reference, document, documents, context);
|
|
80
|
+
}
|
|
81
|
+
export function fileReferenceAtRequestResult(link) {
|
|
82
|
+
return {
|
|
83
|
+
sourceRange: link.sourceRange,
|
|
84
|
+
targetUri: link.targetUri,
|
|
85
|
+
resolution: link.resolution ?? 'file',
|
|
86
|
+
folderFiles: link.folderFiles
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=reqlan-reference-at-position.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reqlan-reference-at-position.js","sourceRoot":"","sources":["../../src/reqlan-reference-at-position.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EACH,0BAA0B,EAC1B,6BAA6B,EAC7B,cAAc,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EACH,oBAAoB,EACpB,mBAAmB,EACnB,gCAAgC,EAChC,wBAAwB,EAG3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACH,eAAe,EACf,qBAAqB,EAGxB,MAAM,oBAAoB,CAAC;AAG5B,MAAM,CAAC,MAAM,0BAA0B,GAAG,4BAA4B,CAAC;AACvE,MAAM,CAAC,MAAM,gCAAgC,GAAG,wBAAwB,CAAC;AACzE,MAAM,CAAC,MAAM,iCAAiC,GAAG,0BAA0B,CAAC;AAE5E,MAAM,UAAU,4BAA4B,CAAC,SAAiB;IAC1D,OAAO,WAAW,0BAA0B,IAAI,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;AACtG,CAAC;AAED,MAAM,UAAU,2BAA2B,CACvC,QAAyB,EACzB,QAAkB,EAClB,SAA2B,EAC3B,UAA8B,EAC9B,OAA4B;IAE5B,MAAM,WAAW,GAAG,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,IAAI,UAAU,EAAE,CAAC;IAClF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ACX,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;YACzC,CAAC;QACL,CAAC;QACD,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;IAChC,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AASD,MAAM,UAAU,+BAA+B,CAC3C,QAAyB,EACzB,QAAkB,EAClB,SAA2B,EAC3B,OAA4B;IAE5B,MAAM,WAAW,GAAG,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACnE,IAAI,WAAW,EAAE,QAAQ,KAAK,MAAM,EAAE,CAAC;QACnC,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,6BAA6B,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAC9F,CAAC;AAED,MAAM,UAAU,4BAA4B,CACxC,IAAsB;IAEtB,OAAO;QACH,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,MAAM;QACrC,WAAW,EAAE,IAAI,CAAC,WAAW;KAChC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for the reference target union types.
|
|
3
|
+
*/
|
|
4
|
+
import type { Reference } from 'langium';
|
|
5
|
+
import { type IdeaDeclaration, type Import, type QualifiedReference, type ReferenceTarget } from './generated/ast.js';
|
|
6
|
+
export declare function referenceImport(target: ReferenceTarget): Reference<Import> | undefined;
|
|
7
|
+
export declare function referenceIdea(target: ReferenceTarget): Reference<IdeaDeclaration> | undefined;
|
|
8
|
+
export declare function referenceFilePath(target: ReferenceTarget): string | undefined;
|
|
9
|
+
export declare function qualifiedReferenceImportPath(reference: QualifiedReference): string | undefined;
|
|
10
|
+
export declare function isAnonymousQualifiedReference(reference: QualifiedReference): boolean;
|
|
11
|
+
export { unquoteReqlanString } from './reqlan-quoted-strings.js';
|
|
12
|
+
export interface ParsedMarkdownLink {
|
|
13
|
+
label: string;
|
|
14
|
+
target: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function parseMarkdownLink(raw: string): ParsedMarkdownLink | undefined;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { isFileReference, isFileSymbolReference, isLocalReference, isQualifiedReference } from './generated/ast.js';
|
|
2
|
+
import { unquoteReqlanString } from './reqlan-quoted-strings.js';
|
|
3
|
+
export function referenceImport(target) {
|
|
4
|
+
if (isQualifiedReference(target)) {
|
|
5
|
+
return target.path?.ref || target.qualifier?.ref ? (target.path ?? target.qualifier) : undefined;
|
|
6
|
+
}
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
export function referenceIdea(target) {
|
|
10
|
+
if (isQualifiedReference(target) || isLocalReference(target)) {
|
|
11
|
+
return target.idea;
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
export function referenceFilePath(target) {
|
|
16
|
+
if (isFileReference(target) || isFileSymbolReference(target)) {
|
|
17
|
+
return target.file;
|
|
18
|
+
}
|
|
19
|
+
if (isQualifiedReference(target)) {
|
|
20
|
+
return qualifiedReferenceImportPath(target);
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
export function qualifiedReferenceImportPath(reference) {
|
|
25
|
+
if (reference.qualifier?.ref) {
|
|
26
|
+
return reference.qualifier.ref.path;
|
|
27
|
+
}
|
|
28
|
+
if (reference.path?.ref) {
|
|
29
|
+
return reference.path.ref.path;
|
|
30
|
+
}
|
|
31
|
+
if (reference.path?.$refText) {
|
|
32
|
+
return unquoteReqlanString(reference.path.$refText);
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
export function isAnonymousQualifiedReference(reference) {
|
|
37
|
+
return reference.path !== undefined && reference.path.ref === undefined && reference.qualifier === undefined;
|
|
38
|
+
}
|
|
39
|
+
export { unquoteReqlanString } from './reqlan-quoted-strings.js';
|
|
40
|
+
const MARKDOWN_LINK_PATTERN = /^\[([^\]]+)\]\(([^)]+)\)$/;
|
|
41
|
+
export function parseMarkdownLink(raw) {
|
|
42
|
+
const match = MARKDOWN_LINK_PATTERN.exec(raw);
|
|
43
|
+
if (!match) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
label: match[1],
|
|
48
|
+
target: match[2]
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=reqlan-references.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reqlan-references.js","sourceRoot":"","sources":["../../src/reqlan-references.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EAKvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,UAAU,eAAe,CAAC,MAAuB;IACnD,IAAI,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/B,OAAO,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACrG,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAuB;IACjD,IAAI,oBAAoB,CAAC,MAAM,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3D,OAAO,MAAM,CAAC,IAAI,CAAC;IACvB,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAuB;IACrD,IAAI,eAAe,CAAC,MAAM,CAAC,IAAI,qBAAqB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AAE;KACpB,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Publishes idea and ideaset declarations for file-local and cross-file reference resolution.
|
|
3
|
+
*/
|
|
4
|
+
import type { AstNodeDescription, LangiumDocument, ReferenceInfo } from 'langium';
|
|
5
|
+
import { DefaultScopeComputation, DefaultScopeProvider, type Scope } from 'langium';
|
|
6
|
+
import type { ReqlanServices } from './reqlan-module.js';
|
|
7
|
+
export declare class ReqlanScopeComputation extends DefaultScopeComputation {
|
|
8
|
+
collectExportedSymbols(document: LangiumDocument): Promise<AstNodeDescription[]>;
|
|
9
|
+
}
|
|
10
|
+
export declare class ReqlanScopeProvider extends DefaultScopeProvider {
|
|
11
|
+
protected readonly documents: ReqlanServices['shared']['workspace']['LangiumDocuments'];
|
|
12
|
+
private readonly services;
|
|
13
|
+
constructor(services: ReqlanServices);
|
|
14
|
+
getScope(context: ReferenceInfo): Scope;
|
|
15
|
+
private scopeForFileIdeas;
|
|
16
|
+
private scopeForIdeasetMembers;
|
|
17
|
+
private scopeForIdeasets;
|
|
18
|
+
private scopeForReferenceQualifiers;
|
|
19
|
+
private scopeForImportPaths;
|
|
20
|
+
private scopeForImportDeclaration;
|
|
21
|
+
private scopeForImportAliasName;
|
|
22
|
+
private scopeForImportPath;
|
|
23
|
+
private findImportedDocument;
|
|
24
|
+
private documentForQualifiedReference;
|
|
25
|
+
}
|