@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.
Files changed (371) hide show
  1. package/README.md +24 -0
  2. package/out/file-path-rewrite.d.ts +25 -0
  3. package/out/file-path-rewrite.js +56 -0
  4. package/out/file-path-rewrite.js.map +1 -0
  5. package/out/generated/ast.d.ts +1157 -0
  6. package/out/generated/ast.js +980 -0
  7. package/out/generated/ast.js.map +1 -0
  8. package/out/generated/grammar.d.ts +7 -0
  9. package/out/generated/grammar.js +3071 -0
  10. package/out/generated/grammar.js.map +1 -0
  11. package/out/generated/module.d.ts +20 -0
  12. package/out/generated/module.js +32 -0
  13. package/out/generated/module.js.map +1 -0
  14. package/out/index.d.ts +34 -0
  15. package/out/index.js +35 -0
  16. package/out/index.js.map +1 -0
  17. package/out/reqlan-attribute-catalog.d.ts +19 -0
  18. package/out/reqlan-attribute-catalog.js +87 -0
  19. package/out/reqlan-attribute-catalog.js.map +1 -0
  20. package/out/reqlan-code-action-provider.d.ts +55 -0
  21. package/out/reqlan-code-action-provider.js +269 -0
  22. package/out/reqlan-code-action-provider.js.map +1 -0
  23. package/out/reqlan-code-lens-provider.d.ts +13 -0
  24. package/out/reqlan-code-lens-provider.js +27 -0
  25. package/out/reqlan-code-lens-provider.js.map +1 -0
  26. package/out/reqlan-code-lens-settings.d.ts +34 -0
  27. package/out/reqlan-code-lens-settings.js +12 -0
  28. package/out/reqlan-code-lens-settings.js.map +1 -0
  29. package/out/reqlan-comment-resolver.d.ts +35 -0
  30. package/out/reqlan-comment-resolver.js +308 -0
  31. package/out/reqlan-comment-resolver.js.map +1 -0
  32. package/out/reqlan-completion-context.d.ts +46 -0
  33. package/out/reqlan-completion-context.js +244 -0
  34. package/out/reqlan-completion-context.js.map +1 -0
  35. package/out/reqlan-completion-provider.d.ts +41 -0
  36. package/out/reqlan-completion-provider.js +317 -0
  37. package/out/reqlan-completion-provider.js.map +1 -0
  38. package/out/reqlan-definition-provider.d.ts +31 -0
  39. package/out/reqlan-definition-provider.js +240 -0
  40. package/out/reqlan-definition-provider.js.map +1 -0
  41. package/out/reqlan-document-highlight-provider.d.ts +10 -0
  42. package/out/reqlan-document-highlight-provider.js +11 -0
  43. package/out/reqlan-document-highlight-provider.js.map +1 -0
  44. package/out/reqlan-document-link-provider.d.ts +14 -0
  45. package/out/reqlan-document-link-provider.js +24 -0
  46. package/out/reqlan-document-link-provider.js.map +1 -0
  47. package/out/reqlan-embedded-file-references.d.ts +11 -0
  48. package/out/reqlan-embedded-file-references.js +50 -0
  49. package/out/reqlan-embedded-file-references.js.map +1 -0
  50. package/out/reqlan-file-link-resolver.d.ts +44 -0
  51. package/out/reqlan-file-link-resolver.js +347 -0
  52. package/out/reqlan-file-link-resolver.js.map +1 -0
  53. package/out/reqlan-file-references.d.ts +15 -0
  54. package/out/reqlan-file-references.js +72 -0
  55. package/out/reqlan-file-references.js.map +1 -0
  56. package/out/reqlan-grammar-config.d.ts +5 -0
  57. package/out/reqlan-grammar-config.js +9 -0
  58. package/out/reqlan-grammar-config.js.map +1 -0
  59. package/out/reqlan-idea-reference-site.d.ts +14 -0
  60. package/out/reqlan-idea-reference-site.js +47 -0
  61. package/out/reqlan-idea-reference-site.js.map +1 -0
  62. package/out/reqlan-idea-summary.d.ts +6 -0
  63. package/out/reqlan-idea-summary.js +134 -0
  64. package/out/reqlan-idea-summary.js.map +1 -0
  65. package/out/reqlan-ignore-error.d.ts +10 -0
  66. package/out/reqlan-ignore-error.js +42 -0
  67. package/out/reqlan-ignore-error.js.map +1 -0
  68. package/out/reqlan-import-bindings.d.ts +12 -0
  69. package/out/reqlan-import-bindings.js +65 -0
  70. package/out/reqlan-import-bindings.js.map +1 -0
  71. package/out/reqlan-import-edits.d.ts +17 -0
  72. package/out/reqlan-import-edits.js +96 -0
  73. package/out/reqlan-import-edits.js.map +1 -0
  74. package/out/reqlan-imports.d.ts +22 -0
  75. package/out/reqlan-imports.js +61 -0
  76. package/out/reqlan-imports.js.map +1 -0
  77. package/out/reqlan-inbound-reference-inlay-label.d.ts +27 -0
  78. package/out/reqlan-inbound-reference-inlay-label.js +142 -0
  79. package/out/reqlan-inbound-reference-inlay-label.js.map +1 -0
  80. package/out/reqlan-inlay-hint-provider.d.ts +15 -0
  81. package/out/reqlan-inlay-hint-provider.js +54 -0
  82. package/out/reqlan-inlay-hint-provider.js.map +1 -0
  83. package/out/reqlan-inlay-hint-settings.d.ts +10 -0
  84. package/out/reqlan-inlay-hint-settings.js +10 -0
  85. package/out/reqlan-inlay-hint-settings.js.map +1 -0
  86. package/out/reqlan-linker.d.ts +26 -0
  87. package/out/reqlan-linker.js +83 -0
  88. package/out/reqlan-linker.js.map +1 -0
  89. package/out/reqlan-markdown-links.d.ts +28 -0
  90. package/out/reqlan-markdown-links.js +113 -0
  91. package/out/reqlan-markdown-links.js.map +1 -0
  92. package/out/reqlan-module.d.ts +41 -0
  93. package/out/reqlan-module.js +78 -0
  94. package/out/reqlan-module.js.map +1 -0
  95. package/out/reqlan-name-catalog.d.ts +23 -0
  96. package/out/reqlan-name-catalog.js +63 -0
  97. package/out/reqlan-name-catalog.js.map +1 -0
  98. package/out/reqlan-name-provider.d.ts +10 -0
  99. package/out/reqlan-name-provider.js +38 -0
  100. package/out/reqlan-name-provider.js.map +1 -0
  101. package/out/reqlan-namespace-import-links.d.ts +10 -0
  102. package/out/reqlan-namespace-import-links.js +69 -0
  103. package/out/reqlan-namespace-import-links.js.map +1 -0
  104. package/out/reqlan-path-completion.d.ts +50 -0
  105. package/out/reqlan-path-completion.js +304 -0
  106. package/out/reqlan-path-completion.js.map +1 -0
  107. package/out/reqlan-path-references.d.ts +5 -0
  108. package/out/reqlan-path-references.js +124 -0
  109. package/out/reqlan-path-references.js.map +1 -0
  110. package/out/reqlan-path-resolve.d.ts +81 -0
  111. package/out/reqlan-path-resolve.js +245 -0
  112. package/out/reqlan-path-resolve.js.map +1 -0
  113. package/out/reqlan-quoted-strings.d.ts +9 -0
  114. package/out/reqlan-quoted-strings.js +26 -0
  115. package/out/reqlan-quoted-strings.js.map +1 -0
  116. package/out/reqlan-reference-at-position.d.ts +20 -0
  117. package/out/reqlan-reference-at-position.js +89 -0
  118. package/out/reqlan-reference-at-position.js.map +1 -0
  119. package/out/reqlan-reference-code-lens.d.ts +32 -0
  120. package/out/reqlan-reference-code-lens.js +240 -0
  121. package/out/reqlan-reference-code-lens.js.map +1 -0
  122. package/out/reqlan-reference-search-site.d.ts +34 -0
  123. package/out/reqlan-reference-search-site.js +136 -0
  124. package/out/reqlan-reference-search-site.js.map +1 -0
  125. package/out/reqlan-references.d.ts +16 -0
  126. package/out/reqlan-references.js +51 -0
  127. package/out/reqlan-references.js.map +1 -0
  128. package/out/reqlan-scope.d.ts +25 -0
  129. package/out/reqlan-scope.js +259 -0
  130. package/out/reqlan-scope.js.map +1 -0
  131. package/out/reqlan-semantic-token-provider.d.ts +8 -0
  132. package/out/reqlan-semantic-token-provider.js +91 -0
  133. package/out/reqlan-semantic-token-provider.js.map +1 -0
  134. package/out/reqlan-token-builder.d.ts +12 -0
  135. package/out/reqlan-token-builder.js +459 -0
  136. package/out/reqlan-token-builder.js.map +1 -0
  137. package/out/reqlan-validator.d.ts +25 -0
  138. package/out/reqlan-validator.js +119 -0
  139. package/out/reqlan-validator.js.map +1 -0
  140. package/out/reqlan-workspace-attribute-catalog.d.ts +6 -0
  141. package/out/reqlan-workspace-attribute-catalog.js +54 -0
  142. package/out/reqlan-workspace-attribute-catalog.js.map +1 -0
  143. package/out/src/file-path-rewrite.d.ts +25 -0
  144. package/out/src/file-path-rewrite.js +56 -0
  145. package/out/src/file-path-rewrite.js.map +1 -0
  146. package/out/src/generated/ast.d.ts +1173 -0
  147. package/out/src/generated/ast.js +994 -0
  148. package/out/src/generated/ast.js.map +1 -0
  149. package/out/src/generated/grammar.d.ts +7 -0
  150. package/out/src/generated/grammar.js +3045 -0
  151. package/out/src/generated/grammar.js.map +1 -0
  152. package/out/src/generated/module.d.ts +20 -0
  153. package/out/src/generated/module.js +32 -0
  154. package/out/src/generated/module.js.map +1 -0
  155. package/out/src/index.d.ts +29 -0
  156. package/out/src/index.js +30 -0
  157. package/out/src/index.js.map +1 -0
  158. package/out/src/reqlan-attribute-catalog.d.ts +19 -0
  159. package/out/src/reqlan-attribute-catalog.js +87 -0
  160. package/out/src/reqlan-attribute-catalog.js.map +1 -0
  161. package/out/src/reqlan-code-action-provider.d.ts +34 -0
  162. package/out/src/reqlan-code-action-provider.js +206 -0
  163. package/out/src/reqlan-code-action-provider.js.map +1 -0
  164. package/out/src/reqlan-comment-resolver.d.ts +35 -0
  165. package/out/src/reqlan-comment-resolver.js +308 -0
  166. package/out/src/reqlan-comment-resolver.js.map +1 -0
  167. package/out/src/reqlan-completion-context.d.ts +46 -0
  168. package/out/src/reqlan-completion-context.js +244 -0
  169. package/out/src/reqlan-completion-context.js.map +1 -0
  170. package/out/src/reqlan-completion-provider.d.ts +41 -0
  171. package/out/src/reqlan-completion-provider.js +320 -0
  172. package/out/src/reqlan-completion-provider.js.map +1 -0
  173. package/out/src/reqlan-definition-provider.d.ts +31 -0
  174. package/out/src/reqlan-definition-provider.js +240 -0
  175. package/out/src/reqlan-definition-provider.js.map +1 -0
  176. package/out/src/reqlan-document-highlight-provider.d.ts +10 -0
  177. package/out/src/reqlan-document-highlight-provider.js +11 -0
  178. package/out/src/reqlan-document-highlight-provider.js.map +1 -0
  179. package/out/src/reqlan-document-link-provider.d.ts +14 -0
  180. package/out/src/reqlan-document-link-provider.js +24 -0
  181. package/out/src/reqlan-document-link-provider.js.map +1 -0
  182. package/out/src/reqlan-embedded-file-references.d.ts +11 -0
  183. package/out/src/reqlan-embedded-file-references.js +50 -0
  184. package/out/src/reqlan-embedded-file-references.js.map +1 -0
  185. package/out/src/reqlan-file-link-resolver.d.ts +44 -0
  186. package/out/src/reqlan-file-link-resolver.js +347 -0
  187. package/out/src/reqlan-file-link-resolver.js.map +1 -0
  188. package/out/src/reqlan-file-references.d.ts +15 -0
  189. package/out/src/reqlan-file-references.js +72 -0
  190. package/out/src/reqlan-file-references.js.map +1 -0
  191. package/out/src/reqlan-grammar-config.d.ts +5 -0
  192. package/out/src/reqlan-grammar-config.js +9 -0
  193. package/out/src/reqlan-grammar-config.js.map +1 -0
  194. package/out/src/reqlan-idea-summary.d.ts +6 -0
  195. package/out/src/reqlan-idea-summary.js +78 -0
  196. package/out/src/reqlan-idea-summary.js.map +1 -0
  197. package/out/src/reqlan-ignore-error.d.ts +10 -0
  198. package/out/src/reqlan-ignore-error.js +42 -0
  199. package/out/src/reqlan-ignore-error.js.map +1 -0
  200. package/out/src/reqlan-import-bindings.d.ts +12 -0
  201. package/out/src/reqlan-import-bindings.js +65 -0
  202. package/out/src/reqlan-import-bindings.js.map +1 -0
  203. package/out/src/reqlan-import-edits.d.ts +17 -0
  204. package/out/src/reqlan-import-edits.js +96 -0
  205. package/out/src/reqlan-import-edits.js.map +1 -0
  206. package/out/src/reqlan-imports.d.ts +22 -0
  207. package/out/src/reqlan-imports.js +61 -0
  208. package/out/src/reqlan-imports.js.map +1 -0
  209. package/out/src/reqlan-inbound-reference-inlay-label.d.ts +23 -0
  210. package/out/src/reqlan-inbound-reference-inlay-label.js +128 -0
  211. package/out/src/reqlan-inbound-reference-inlay-label.js.map +1 -0
  212. package/out/src/reqlan-inlay-hint-provider.d.ts +15 -0
  213. package/out/src/reqlan-inlay-hint-provider.js +54 -0
  214. package/out/src/reqlan-inlay-hint-provider.js.map +1 -0
  215. package/out/src/reqlan-inlay-hint-settings.d.ts +10 -0
  216. package/out/src/reqlan-inlay-hint-settings.js +10 -0
  217. package/out/src/reqlan-inlay-hint-settings.js.map +1 -0
  218. package/out/src/reqlan-linker.d.ts +26 -0
  219. package/out/src/reqlan-linker.js +86 -0
  220. package/out/src/reqlan-linker.js.map +1 -0
  221. package/out/src/reqlan-markdown-links.d.ts +28 -0
  222. package/out/src/reqlan-markdown-links.js +113 -0
  223. package/out/src/reqlan-markdown-links.js.map +1 -0
  224. package/out/src/reqlan-module.d.ts +41 -0
  225. package/out/src/reqlan-module.js +76 -0
  226. package/out/src/reqlan-module.js.map +1 -0
  227. package/out/src/reqlan-name-catalog.d.ts +23 -0
  228. package/out/src/reqlan-name-catalog.js +63 -0
  229. package/out/src/reqlan-name-catalog.js.map +1 -0
  230. package/out/src/reqlan-name-provider.d.ts +10 -0
  231. package/out/src/reqlan-name-provider.js +38 -0
  232. package/out/src/reqlan-name-provider.js.map +1 -0
  233. package/out/src/reqlan-namespace-import-links.d.ts +10 -0
  234. package/out/src/reqlan-namespace-import-links.js +81 -0
  235. package/out/src/reqlan-namespace-import-links.js.map +1 -0
  236. package/out/src/reqlan-path-completion.d.ts +50 -0
  237. package/out/src/reqlan-path-completion.js +304 -0
  238. package/out/src/reqlan-path-completion.js.map +1 -0
  239. package/out/src/reqlan-path-references.d.ts +5 -0
  240. package/out/src/reqlan-path-references.js +124 -0
  241. package/out/src/reqlan-path-references.js.map +1 -0
  242. package/out/src/reqlan-path-resolve.d.ts +59 -0
  243. package/out/src/reqlan-path-resolve.js +173 -0
  244. package/out/src/reqlan-path-resolve.js.map +1 -0
  245. package/out/src/reqlan-quoted-strings.d.ts +9 -0
  246. package/out/src/reqlan-quoted-strings.js +26 -0
  247. package/out/src/reqlan-quoted-strings.js.map +1 -0
  248. package/out/src/reqlan-reference-at-position.d.ts +20 -0
  249. package/out/src/reqlan-reference-at-position.js +89 -0
  250. package/out/src/reqlan-reference-at-position.js.map +1 -0
  251. package/out/src/reqlan-references.d.ts +16 -0
  252. package/out/src/reqlan-references.js +51 -0
  253. package/out/src/reqlan-references.js.map +1 -0
  254. package/out/src/reqlan-scope.d.ts +25 -0
  255. package/out/src/reqlan-scope.js +266 -0
  256. package/out/src/reqlan-scope.js.map +1 -0
  257. package/out/src/reqlan-semantic-token-provider.d.ts +8 -0
  258. package/out/src/reqlan-semantic-token-provider.js +97 -0
  259. package/out/src/reqlan-semantic-token-provider.js.map +1 -0
  260. package/out/src/reqlan-token-builder.d.ts +12 -0
  261. package/out/src/reqlan-token-builder.js +459 -0
  262. package/out/src/reqlan-token-builder.js.map +1 -0
  263. package/out/src/reqlan-validator.d.ts +25 -0
  264. package/out/src/reqlan-validator.js +119 -0
  265. package/out/src/reqlan-validator.js.map +1 -0
  266. package/out/src/reqlan-workspace-attribute-catalog.d.ts +6 -0
  267. package/out/src/reqlan-workspace-attribute-catalog.js +54 -0
  268. package/out/src/reqlan-workspace-attribute-catalog.js.map +1 -0
  269. package/out/test/code-actions.test.d.ts +1 -0
  270. package/out/test/code-actions.test.js +126 -0
  271. package/out/test/code-actions.test.js.map +1 -0
  272. package/out/test/comment-in-string.test.d.ts +1 -0
  273. package/out/test/comment-in-string.test.js +100 -0
  274. package/out/test/comment-in-string.test.js.map +1 -0
  275. package/out/test/completion.test.d.ts +1 -0
  276. package/out/test/completion.test.js +467 -0
  277. package/out/test/completion.test.js.map +1 -0
  278. package/out/test/file-path-rewrite.test.d.ts +1 -0
  279. package/out/test/file-path-rewrite.test.js +64 -0
  280. package/out/test/file-path-rewrite.test.js.map +1 -0
  281. package/out/test/ignore-error.test.d.ts +1 -0
  282. package/out/test/ignore-error.test.js +87 -0
  283. package/out/test/ignore-error.test.js.map +1 -0
  284. package/out/test/implicit-import-extension.test.d.ts +1 -0
  285. package/out/test/implicit-import-extension.test.js +203 -0
  286. package/out/test/implicit-import-extension.test.js.map +1 -0
  287. package/out/test/import-edits.test.d.ts +1 -0
  288. package/out/test/import-edits.test.js +20 -0
  289. package/out/test/import-edits.test.js.map +1 -0
  290. package/out/test/inlay-hints.test.d.ts +1 -0
  291. package/out/test/inlay-hints.test.js +238 -0
  292. package/out/test/inlay-hints.test.js.map +1 -0
  293. package/out/test/linking.test.d.ts +1 -0
  294. package/out/test/linking.test.js +754 -0
  295. package/out/test/linking.test.js.map +1 -0
  296. package/out/test/naked-strings.test.d.ts +1 -0
  297. package/out/test/naked-strings.test.js +50 -0
  298. package/out/test/naked-strings.test.js.map +1 -0
  299. package/out/test/parsing.test.d.ts +1 -0
  300. package/out/test/parsing.test.js +773 -0
  301. package/out/test/parsing.test.js.map +1 -0
  302. package/out/test/path-resolve.test.d.ts +1 -0
  303. package/out/test/path-resolve.test.js +88 -0
  304. package/out/test/path-resolve.test.js.map +1 -0
  305. package/out/test/references.test.d.ts +1 -0
  306. package/out/test/references.test.js +168 -0
  307. package/out/test/references.test.js.map +1 -0
  308. package/out/test/rqconfig.test.d.ts +1 -0
  309. package/out/test/rqconfig.test.js +275 -0
  310. package/out/test/rqconfig.test.js.map +1 -0
  311. package/out/test/test-requirement-refs.d.ts +8 -0
  312. package/out/test/test-requirement-refs.js +35 -0
  313. package/out/test/test-requirement-refs.js.map +1 -0
  314. package/out/test/testing.test.d.ts +1 -0
  315. package/out/test/testing.test.js +23 -0
  316. package/out/test/testing.test.js.map +1 -0
  317. package/out/test/validating.test.d.ts +1 -0
  318. package/out/test/validating.test.js +117 -0
  319. package/out/test/validating.test.js.map +1 -0
  320. package/out/tsconfig.tsbuildinfo +1 -0
  321. package/package.json +54 -0
  322. package/src/chevrotain.d.ts +8 -0
  323. package/src/file-path-rewrite.ts +96 -0
  324. package/src/generated/ast.ts +1481 -0
  325. package/src/generated/grammar.ts +3074 -0
  326. package/src/generated/module.ts +38 -0
  327. package/src/index.ts +34 -0
  328. package/src/reqlan-attribute-catalog.ts +100 -0
  329. package/src/reqlan-code-action-provider.ts +385 -0
  330. package/src/reqlan-code-lens-provider.ts +54 -0
  331. package/src/reqlan-code-lens-settings.ts +42 -0
  332. package/src/reqlan-comment-resolver.ts +372 -0
  333. package/src/reqlan-comment.langium +23 -0
  334. package/src/reqlan-completion-context.ts +330 -0
  335. package/src/reqlan-completion-provider.ts +400 -0
  336. package/src/reqlan-definition-provider.ts +319 -0
  337. package/src/reqlan-document-highlight-provider.ts +21 -0
  338. package/src/reqlan-document-link-provider.ts +45 -0
  339. package/src/reqlan-embedded-file-references.ts +72 -0
  340. package/src/reqlan-file-link-resolver.ts +485 -0
  341. package/src/reqlan-file-references.ts +84 -0
  342. package/src/reqlan-grammar-config.ts +14 -0
  343. package/src/reqlan-idea-reference-site.ts +74 -0
  344. package/src/reqlan-idea-summary.ts +162 -0
  345. package/src/reqlan-ignore-error.ts +50 -0
  346. package/src/reqlan-import-bindings.ts +87 -0
  347. package/src/reqlan-import-edits.ts +124 -0
  348. package/src/reqlan-imports.ts +115 -0
  349. package/src/reqlan-inbound-reference-inlay-label.ts +194 -0
  350. package/src/reqlan-inlay-hint-provider.ts +88 -0
  351. package/src/reqlan-inlay-hint-settings.ts +15 -0
  352. package/src/reqlan-linker.ts +108 -0
  353. package/src/reqlan-markdown-links.ts +136 -0
  354. package/src/reqlan-module.ts +104 -0
  355. package/src/reqlan-name-catalog.ts +81 -0
  356. package/src/reqlan-name-provider.ts +56 -0
  357. package/src/reqlan-namespace-import-links.ts +92 -0
  358. package/src/reqlan-path-completion.ts +420 -0
  359. package/src/reqlan-path-references.ts +140 -0
  360. package/src/reqlan-path-resolve.ts +346 -0
  361. package/src/reqlan-quoted-strings.ts +30 -0
  362. package/src/reqlan-reference-at-position.ts +154 -0
  363. package/src/reqlan-reference-code-lens.ts +323 -0
  364. package/src/reqlan-reference-search-site.ts +202 -0
  365. package/src/reqlan-references.ts +76 -0
  366. package/src/reqlan-scope.ts +312 -0
  367. package/src/reqlan-semantic-token-provider.ts +113 -0
  368. package/src/reqlan-token-builder.ts +492 -0
  369. package/src/reqlan-validator.ts +149 -0
  370. package/src/reqlan-workspace-attribute-catalog.ts +62 -0
  371. package/src/reqlan.langium +236 -0
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Formats inbound reference lists for idea declaration inlay hints.
3
+ */
4
+ import { AstUtils, GrammarUtils } from 'langium';
5
+ import { Command, InlayHintLabelPart, Location, MarkupKind } from 'vscode-languageserver';
6
+ import { isIdea, isIdeaSet, isOneLinerIdea } from './generated/ast.js';
7
+ import { REQLAN_INBOUND_REFERENCES_SUMMARY_COMMAND } from './reqlan-inlay-hint-settings.js';
8
+ const MAX_INLINE_NAMES = 3;
9
+ export function collectInboundReferencers(services, declaration) {
10
+ const documents = services.shared.workspace.LangiumDocuments;
11
+ const locator = services.workspace.AstNodeLocator;
12
+ const referencers = new Map();
13
+ for (const reference of services.references.References.findReferences(declaration, { includeDeclaration: false }).toArray()) {
14
+ const sourceDocument = documents.getDocument(reference.sourceUri);
15
+ if (!sourceDocument) {
16
+ continue;
17
+ }
18
+ const sourceNode = locator.getAstNode(sourceDocument.parseResult.value, reference.sourcePath);
19
+ if (!sourceNode) {
20
+ continue;
21
+ }
22
+ const referrer = enclosingReferrerDeclaration(sourceNode);
23
+ if (!referrer || referrer.name === declaration.name) {
24
+ continue;
25
+ }
26
+ const location = locationForReferrer(referrer);
27
+ if (!location) {
28
+ continue;
29
+ }
30
+ referencers.set(locationKey(location), {
31
+ name: referrer.name,
32
+ location
33
+ });
34
+ }
35
+ return [...referencers.values()].sort((left, right) => left.name.localeCompare(right.name));
36
+ }
37
+ /** @deprecated Use {@link collectInboundReferencers} */
38
+ export function collectInboundReferencingNames(services, declaration) {
39
+ return collectInboundReferencers(services, declaration).map(referrer => referrer.name);
40
+ }
41
+ function enclosingReferrerDeclaration(node) {
42
+ let current = node;
43
+ while (current) {
44
+ if (isIdea(current) || isOneLinerIdea(current) || isIdeaSet(current)) {
45
+ return current;
46
+ }
47
+ current = current.$container;
48
+ }
49
+ return undefined;
50
+ }
51
+ function locationForReferrer(referrer) {
52
+ const nameNode = GrammarUtils.findNodeForProperty(referrer.$cstNode, 'name');
53
+ if (!nameNode?.range) {
54
+ return undefined;
55
+ }
56
+ const document = AstUtils.getDocument(referrer);
57
+ return Location.create(document.textDocument.uri, nameNode.range);
58
+ }
59
+ function locationKey(location) {
60
+ const range = location.range;
61
+ return `${location.uri}#${range.start.line}:${range.start.character}`;
62
+ }
63
+ export function referencerMarkdownLink(referrer) {
64
+ const line = referrer.location.range.start.line + 1;
65
+ const character = referrer.location.range.start.character + 1;
66
+ return `[${referrer.name}](${referrer.location.uri}#L${line},${character})`;
67
+ }
68
+ export function buildReferencersTooltipMarkup(referencers) {
69
+ const items = referencers.map(referrer => `- ${referencerMarkdownLink(referrer)}`).join('\n');
70
+ return {
71
+ kind: MarkupKind.Markdown,
72
+ value: `**Referenced by**\n\n${items}`
73
+ };
74
+ }
75
+ function referencerPartTooltip(referrer) {
76
+ return {
77
+ kind: MarkupKind.Markdown,
78
+ value: referencerMarkdownLink(referrer)
79
+ };
80
+ }
81
+ export function buildInboundReferencesInlayLabel(referencers, targetDocumentUri, targetName) {
82
+ if (referencers.length === 0) {
83
+ return undefined;
84
+ }
85
+ const tooltip = buildReferencersTooltipMarkup(referencers);
86
+ const inlineReferencers = referencers.slice(0, MAX_INLINE_NAMES);
87
+ const remainder = referencers.length - inlineReferencers.length;
88
+ const labelParts = [
89
+ InlayHintLabelPart.create('@referenced-by: (')
90
+ ];
91
+ for (let index = 0; index < inlineReferencers.length; index++) {
92
+ if (index > 0) {
93
+ labelParts.push(InlayHintLabelPart.create(', '));
94
+ }
95
+ labelParts.push({
96
+ value: inlineReferencers[index].name,
97
+ location: inlineReferencers[index].location,
98
+ tooltip: referencerPartTooltip(inlineReferencers[index])
99
+ });
100
+ }
101
+ if (remainder > 0) {
102
+ labelParts.push(InlayHintLabelPart.create(', '));
103
+ labelParts.push({
104
+ value: `+${remainder} more`,
105
+ tooltip,
106
+ command: Command.create('Show all inbound references', REQLAN_INBOUND_REFERENCES_SUMMARY_COMMAND, targetDocumentUri, targetName)
107
+ });
108
+ }
109
+ labelParts.push(InlayHintLabelPart.create(')'));
110
+ return {
111
+ labelParts,
112
+ tooltip
113
+ };
114
+ }
115
+ /** @deprecated Use {@link buildInboundReferencesInlayLabel} */
116
+ export function formatInboundReferencesInlayLabel(referencers) {
117
+ if (referencers.length === 0) {
118
+ return undefined;
119
+ }
120
+ const inlineNames = referencers.slice(0, MAX_INLINE_NAMES);
121
+ const remainder = referencers.length - inlineNames.length;
122
+ const suffix = remainder > 0 ? `, +${remainder} more` : '';
123
+ return {
124
+ label: `@referenced-by: (${inlineNames.join(', ')}${suffix})`,
125
+ tooltip: referencers.join('\n')
126
+ };
127
+ }
128
+ //# sourceMappingURL=reqlan-inbound-reference-inlay-label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reqlan-inbound-reference-inlay-label.js","sourceRoot":"","sources":["../../src/reqlan-inbound-reference-inlay-label.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAgB,MAAM,SAAS,CAAC;AAC/D,OAAO,EACH,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,UAAU,EAGb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAsC,MAAM,oBAAoB,CAAC;AAC3G,OAAO,EAAE,yCAAyC,EAAE,MAAM,iCAAiC,CAAC;AAe5F,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,MAAM,UAAU,yBAAyB,CACrC,QAAwB,EACxB,WAAkC;IAElC,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC;IAC7D,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC;IAClD,MAAM,WAAW,GAAG,IAAI,GAAG,EAA6B,CAAC;IAEzD,KAAK,MAAM,SAAS,IAAI,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,cAAc,CAAC,WAAW,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QAC1H,MAAM,cAAc,GAAG,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAClE,IAAI,CAAC,cAAc,EAAE,CAAC;YAClB,SAAS;QACb,CAAC;QACD,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,WAAW,CAAC,KAAK,EAAE,SAAS,C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AAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACjD,UAAU,CAAC,IAAI,CAAC;YACZ,KAAK,EAAE,IAAI,SAAS,OAAO;YAC3B,OAAO;YACP,OAAO,EAAE,OAAO,CAAC,MAAM,CACnB,6BAA6B,EAC7B,yCAAyC,EACzC,iBAAiB,EACjB,UAAU,CACb;SACJ,CAAC,CAAC;IACP,CAAC;IAED,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAEhD,OAAO;QACH,UAAU;QACV,OAAO;KACV,CAAC;AACN,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,iCAAiC,CAAC,WAAqB;IACnE,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,MAAM,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC;IAC3D,MAAM,SAAS,GAAG,WAAW,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAC1D,MAAM,MAAM,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,SAAS,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,OAAO;QACH,KAAK,EAAE,oBAAoB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG;QAC7D,OAAO,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;KAClC,CAAC;AACN,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Inlay hints showing inbound references on idea declarations as a computed attribute.
3
+ */
4
+ import { type AstNode, type LangiumDocument } from 'langium';
5
+ import { AbstractInlayHintProvider } from 'langium/lsp';
6
+ import type { CancellationToken } from 'vscode-languageserver';
7
+ import { type InlayHint, type InlayHintParams } from 'vscode-languageserver';
8
+ import type { ReqlanServices } from './reqlan-module.js';
9
+ export declare class ReqlanInlayHintProvider extends AbstractInlayHintProvider {
10
+ private readonly services;
11
+ constructor(services: ReqlanServices);
12
+ getInlayHints(document: LangiumDocument, params: InlayHintParams, cancelToken?: CancellationToken): Promise<InlayHint[] | undefined>;
13
+ computeInlayHint(node: AstNode, acceptor: (hint: InlayHint) => void): void;
14
+ private acceptInboundReferenceHint;
15
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Inlay hints showing inbound references on idea declarations as a computed attribute.
3
+ */
4
+ import { AstUtils, GrammarUtils } from 'langium';
5
+ import { AbstractInlayHintProvider } from 'langium/lsp';
6
+ import { InlayHintKind } from 'vscode-languageserver';
7
+ import { isIdea, isIdeaSet, isOneLinerIdea } from './generated/ast.js';
8
+ import { buildInboundReferencesInlayLabel, collectInboundReferencers } from './reqlan-inbound-reference-inlay-label.js';
9
+ import { REQLAN_REFERENCE_INLAY_HINTS_SETTING, referenceInlayHintsEnabled } from './reqlan-inlay-hint-settings.js';
10
+ export class ReqlanInlayHintProvider extends AbstractInlayHintProvider {
11
+ constructor(services) {
12
+ super();
13
+ this.services = services;
14
+ }
15
+ async getInlayHints(document, params, cancelToken) {
16
+ const settings = await this.services.shared.workspace.ConfigurationProvider.getConfiguration('reqlan', REQLAN_REFERENCE_INLAY_HINTS_SETTING);
17
+ if (!referenceInlayHintsEnabled(settings)) {
18
+ return [];
19
+ }
20
+ return super.getInlayHints(document, params, cancelToken);
21
+ }
22
+ computeInlayHint(node, acceptor) {
23
+ if (isIdea(node) || isOneLinerIdea(node)) {
24
+ this.acceptInboundReferenceHint(node, acceptor);
25
+ return;
26
+ }
27
+ if (isIdeaSet(node)) {
28
+ this.acceptInboundReferenceHint(node, acceptor);
29
+ }
30
+ }
31
+ acceptInboundReferenceHint(declaration, acceptor) {
32
+ const nameNode = GrammarUtils.findNodeForProperty(declaration.$cstNode, 'name');
33
+ if (!nameNode?.range) {
34
+ return;
35
+ }
36
+ const referencers = collectInboundReferencers(this.services, declaration);
37
+ const document = AstUtils.getDocument(declaration);
38
+ const formatted = buildInboundReferencesInlayLabel(referencers, document.textDocument.uri, declaration.name);
39
+ if (!formatted) {
40
+ return;
41
+ }
42
+ acceptor({
43
+ position: {
44
+ line: nameNode.range.end.line,
45
+ character: nameNode.range.end.character
46
+ },
47
+ label: formatted.labelParts,
48
+ tooltip: formatted.tooltip,
49
+ kind: InlayHintKind.Type,
50
+ paddingLeft: true
51
+ });
52
+ }
53
+ }
54
+ //# sourceMappingURL=reqlan-inlay-hint-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reqlan-inlay-hint-provider.js","sourceRoot":"","sources":["../../src/reqlan-inlay-hint-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAsC,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,aAAa,EAAwC,MAAM,uBAAuB,CAAC;AAC5F,OAAO,EACH,MAAM,EACN,SAAS,EACT,cAAc,EACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACH,gCAAgC,EAChC,yBAAyB,EAE5B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACH,oCAAoC,EACpC,0BAA0B,EAE7B,MAAM,iCAAiC,CAAC;AAGzC,MAAM,OAAO,uBAAwB,SAAQ,yBAAyB;IAIlE,YAAY,QAAwB;QAChC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAEQ,KAAK,CAAC,aAAa,CACxB,QAAyB,EACzB,MAAuB,EACvB,WAA+B;QAE/B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,qBAAqB,CAAC,gBAAgB,CACxF,QAAQ,EACR,oCAAoC,CACI,CAAC;QAC7C,IAAI,CAAC,0BAA0B,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxC,OAAO,EAAE,CAAC;Q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E,aAAa,CAAC,IAAI;YACxB,WAAW,EAAE,IAAI;SACpB,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Workspace settings for reference inlay hints.
3
+ */
4
+ export declare const REQLAN_REFERENCE_INLAY_HINTS_SETTING = "referencesInlayHints";
5
+ /** VS Code command invoked when clicking "+N more" on an inbound-reference inlay hint. */
6
+ export declare const REQLAN_INBOUND_REFERENCES_SUMMARY_COMMAND = "reqlan.openInboundReferencesSummary";
7
+ export interface ReferenceInlayHintsSettings {
8
+ enabled?: boolean;
9
+ }
10
+ export declare function referenceInlayHintsEnabled(settings: ReferenceInlayHintsSettings | undefined): boolean;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Workspace settings for reference inlay hints.
3
+ */
4
+ export const REQLAN_REFERENCE_INLAY_HINTS_SETTING = 'referencesInlayHints';
5
+ /** VS Code command invoked when clicking "+N more" on an inbound-reference inlay hint. */
6
+ export const REQLAN_INBOUND_REFERENCES_SUMMARY_COMMAND = 'reqlan.openInboundReferencesSummary';
7
+ export function referenceInlayHintsEnabled(settings) {
8
+ return settings?.enabled === true;
9
+ }
10
+ //# sourceMappingURL=reqlan-inlay-hint-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reqlan-inlay-hint-settings.js","sourceRoot":"","sources":["../../src/reqlan-inlay-hint-settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,sBAAsB,CAAC;AAE3E,0FAA0F;AAC1F,MAAM,CAAC,MAAM,yCAAyC,GAAG,qCAAqC,CAAC;AAM/F,MAAM,UAAU,0BAA0B,CAAC,QAAiD;IACxF,OAAO,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;AACtC,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Links anonymous qualified import paths without requiring a matching import declaration,
3
+ * and keeps bare namespace-alias references unlinked instead of reporting them as unresolved ideas.
4
+ * rq:["../../../reqlan rq/language/imports.rq".import_namespace]
5
+ */
6
+ import type { AstNode, LangiumDocument, ReferenceInfo } from 'langium';
7
+ import { DefaultLinker, type DefaultReference } from 'langium';
8
+ import type { ReqlanServices } from './reqlan-module.js';
9
+ /** Marks a reference that resolves to a file rather than to an AST node. */
10
+ export declare const UnlinkedFileTarget: unique symbol;
11
+ export declare class ReqlanLinker extends DefaultLinker {
12
+ private readonly documents;
13
+ private readonly fileSystem;
14
+ private readonly services;
15
+ constructor(services: ReqlanServices);
16
+ protected doLink(refInfo: ReferenceInfo, document: LangiumDocument): void;
17
+ /**
18
+ * `[alias]` on its own targets the imported file, not an idea inside it. The check stays syntactic
19
+ * because reading `ref` here would resolve the reference and record the linking error we avoid.
20
+ */
21
+ private isNamespaceAliasReference;
22
+ protected resolveReference(reference: DefaultReference, node: AstNode, property: string): AstNode | undefined;
23
+ private isAnonymousImportPathReference;
24
+ private resolvesAnonymousImportPath;
25
+ private markUnlinked;
26
+ }
@@ -0,0 +1,86 @@
1
+ import { AstUtils, DefaultLinker } from 'langium';
2
+ import { isLocalReference, isModel, isQualifiedReference } from './generated/ast.js';
3
+ import { isOpaqueFileReferencePath } from './reqlan-file-references.js';
4
+ import { findNamespaceImportByAlias } from './reqlan-import-bindings.js';
5
+ import { isResolvableImportPath } from './reqlan-imports.js';
6
+ import { pathResolveContextFromServices } from './reqlan-path-resolve.js';
7
+ import { unquoteReqlanString } from './reqlan-references.js';
8
+ /** Marks a reference that resolves to a file rather than to an AST node. */
9
+ export const UnlinkedFileTarget = Symbol('UnlinkedFileTarget');
10
+ export class ReqlanLinker extends DefaultLinker {
11
+ constructor(services) {
12
+ super(services);
13
+ this.documents = services.shared.workspace.LangiumDocuments;
14
+ this.fileSystem = services.shared.workspace.FileSystemProvider;
15
+ this.services = services;
16
+ }
17
+ doLink(refInfo, document) {
18
+ if (this.isAnonymousImportPathReference(refInfo)) {
19
+ const scope = this.scopeProvider.getScope(refInfo);
20
+ if (scope.getElement(refInfo.reference.$refText)) {
21
+ super.doLink(refInfo, document);
22
+ return;
23
+ }
24
+ const path = unquoteReqlanString(refInfo.reference.$refText);
25
+ if (isOpaqueFileReferencePath(path)) {
26
+ return;
27
+ }
28
+ if (this.resolvesAnonymousImportPath(path, document)) {
29
+ this.markUnlinked(refInfo, document);
30
+ return;
31
+ }
32
+ }
33
+ if (this.isNamespaceAliasReference(refInfo)) {
34
+ this.markUnlinked(refInfo, document);
35
+ return;
36
+ }
37
+ super.doLink(refInfo, document);
38
+ }
39
+ /**
40
+ * `[alias]` on its own targets the imported file, not an idea inside it. The check stays syntactic
41
+ * because reading `ref` here would resolve the reference and record the linking error we avoid.
42
+ */
43
+ isNamespaceAliasReference(refInfo) {
44
+ const container = refInfo.container;
45
+ if (!isLocalReference(container)) {
46
+ return false;
47
+ }
48
+ if (refInfo.property !== 'idea' && refInfo.property !== 'ideaset') {
49
+ return false;
50
+ }
51
+ if (container.idea !== undefined && container.ideaset !== undefined) {
52
+ return false;
53
+ }
54
+ const model = AstUtils.getDocument(container).parseResult.value;
55
+ if (!isModel(model)) {
56
+ return false;
57
+ }
58
+ const name = refInfo.reference.$refText;
59
+ if (model.elements.some(element => element.name === name)) {
60
+ return false;
61
+ }
62
+ return findNamespaceImportByAlias(model.imports, name) !== undefined;
63
+ }
64
+ resolveReference(reference, node, property) {
65
+ if (reference._ref === UnlinkedFileTarget) {
66
+ return undefined;
67
+ }
68
+ return super.resolveReference(reference, node, property);
69
+ }
70
+ isAnonymousImportPathReference(refInfo) {
71
+ return isQualifiedReference(refInfo.container)
72
+ && refInfo.property === 'path'
73
+ && refInfo.container.path === refInfo.reference;
74
+ }
75
+ resolvesAnonymousImportPath(path, document) {
76
+ return isResolvableImportPath(path, document, this.documents, this.fileSystem, pathResolveContextFromServices(this.services));
77
+ }
78
+ markUnlinked(refInfo, document) {
79
+ const ref = refInfo.reference;
80
+ if ('_ref' in ref && ref._ref === undefined) {
81
+ ref._ref = UnlinkedFileTarget;
82
+ document.references.push(ref);
83
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AAC;QAClC,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Helpers for markdown-style links `[label](target)` in requirement prose.
3
+ */
4
+ import type { LangiumDocument } from 'langium';
5
+ import type { Position } from 'vscode-languageserver';
6
+ export declare function markdownLinkLabelRange(raw: string, linkOffset: number): {
7
+ start: number;
8
+ end: number;
9
+ } | undefined;
10
+ export declare function markdownLinkTargetRange(raw: string, linkOffset: number): {
11
+ start: number;
12
+ end: number;
13
+ } | undefined;
14
+ export declare function isOffsetInsideRange(offset: number, start: number, end: number): boolean;
15
+ export declare function isMarkdownLinkLabelPosition(document: LangiumDocument, position: Position): boolean;
16
+ export declare function isMarkdownLinkTargetPosition(document: LangiumDocument, position: Position): boolean;
17
+ export declare function isMarkdownLinkLabelOffsetInText(text: string, offset: number): boolean;
18
+ export declare function isRangeInsideMarkdownLinkLabel(text: string, start: number, end: number): boolean;
19
+ export interface MarkdownLinkSpan {
20
+ rawStart: number;
21
+ rawEnd: number;
22
+ labelStart: number;
23
+ labelEnd: number;
24
+ targetStart: number;
25
+ targetEnd: number;
26
+ }
27
+ export declare function iterateMarkdownLinkSpans(text: string): MarkdownLinkSpan[];
28
+ export declare function linePrefixBeforeMarkdownLinkTarget(document: LangiumDocument, position: Position): boolean;
@@ -0,0 +1,113 @@
1
+ import { CstUtils } from 'langium';
2
+ import { isMarkdownLink } from './generated/ast.js';
3
+ import { parseMarkdownLink } from './reqlan-references.js';
4
+ const MARKDOWN_LINK_IN_TEXT_PATTERN = /\[([^\]]+)\]\(([^)]+)\)/g;
5
+ export function markdownLinkLabelRange(raw, linkOffset) {
6
+ const parsed = parseMarkdownLink(raw);
7
+ if (!parsed) {
8
+ return undefined;
9
+ }
10
+ return {
11
+ start: linkOffset + 1,
12
+ end: linkOffset + 1 + parsed.label.length
13
+ };
14
+ }
15
+ export function markdownLinkTargetRange(raw, linkOffset) {
16
+ const parsed = parseMarkdownLink(raw);
17
+ if (!parsed) {
18
+ return undefined;
19
+ }
20
+ const targetStart = raw.indexOf('](') + 2;
21
+ return {
22
+ start: linkOffset + targetStart,
23
+ end: linkOffset + targetStart + parsed.target.length
24
+ };
25
+ }
26
+ export function isOffsetInsideRange(offset, start, end) {
27
+ return offset >= start && offset < end;
28
+ }
29
+ export function isMarkdownLinkLabelPosition(document, position) {
30
+ const offset = document.textDocument.offsetAt(position);
31
+ const root = document.parseResult.value.$cstNode;
32
+ if (root) {
33
+ const leaf = CstUtils.findLeafNodeAtOffset(root, offset);
34
+ let current = leaf;
35
+ while (current) {
36
+ if (isMarkdownLink(current.astNode)) {
37
+ const labelRange = markdownLinkLabelRange(current.astNode.raw, current.offset);
38
+ if (labelRange && isOffsetInsideRange(offset, labelRange.start, labelRange.end)) {
39
+ return true;
40
+ }
41
+ return false;
42
+ }
43
+ current = current.container;
44
+ }
45
+ }
46
+ return isMarkdownLinkLabelOffsetInText(document.textDocument.getText(), offset);
47
+ }
48
+ export function isMarkdownLinkTargetPosition(document, position) {
49
+ const offset = document.textDocument.offsetAt(position);
50
+ const root = document.parseResult.value.$cstNode;
51
+ if (!root) {
52
+ return false;
53
+ }
54
+ const leaf = CstUtils.findLeafNodeAtOffset(root, offset);
55
+ let current = leaf;
56
+ while (current) {
57
+ if (isMarkdownLink(current.astNode)) {
58
+ const targetRange = markdownLinkTargetRange(current.astNode.raw, current.offset);
59
+ return targetRange ? isOffsetInsideRange(offset, targetRange.start, targetRange.end) : false;
60
+ }
61
+ current = current.container;
62
+ }
63
+ return false;
64
+ }
65
+ export function isMarkdownLinkLabelOffsetInText(text, offset) {
66
+ for (const span of iterateMarkdownLinkSpans(text)) {
67
+ if (isOffsetInsideRange(offset, span.labelStart, span.labelEnd)) {
68
+ return true;
69
+ }
70
+ }
71
+ return false;
72
+ }
73
+ export function isRangeInsideMarkdownLinkLabel(text, start, end) {
74
+ for (const span of iterateMarkdownLinkSpans(text)) {
75
+ if (start >= span.labelStart && end <= span.labelEnd) {
76
+ return true;
77
+ }
78
+ }
79
+ return false;
80
+ }
81
+ export function iterateMarkdownLinkSpans(text) {
82
+ const spans = [];
83
+ MARKDOWN_LINK_IN_TEXT_PATTERN.lastIndex = 0;
84
+ let match;
85
+ while ((match = MARKDOWN_LINK_IN_TEXT_PATTERN.exec(text)) !== null) {
86
+ const rawStart = match.index;
87
+ const labelStart = rawStart + 1;
88
+ const labelEnd = labelStart + match[1].length;
89
+ const targetStart = labelEnd + 2;
90
+ const targetEnd = targetStart + match[2].length;
91
+ spans.push({
92
+ rawStart,
93
+ rawEnd: targetEnd + 1,
94
+ labelStart,
95
+ labelEnd,
96
+ targetStart,
97
+ targetEnd
98
+ });
99
+ }
100
+ return spans;
101
+ }
102
+ export function linePrefixBeforeMarkdownLinkTarget(document, position) {
103
+ const linePrefix = document.textDocument.getText({
104
+ start: { line: position.line, character: 0 },
105
+ end: position
106
+ });
107
+ const afterCursor = document.textDocument.getText({
108
+ start: position,
109
+ end: { line: position.line, character: Number.MAX_SAFE_INTEGER }
110
+ });
111
+ return /\[[^\]]*$/.test(linePrefix) && /^\]\(/.test(afterCursor);
112
+ }
113
+ //# sourceMappingURL=reqlan-markdown-links.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reqlan-markdown-links.js","sourceRoot":"","sources":["../../src/reqlan-markdown-links.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,6BAA6B,GAAG,0BAA0B,CAAC;AAEjE,MAAM,UAAU,sBAAsB,CAAC,GAAW,EAAE,UAAkB;IAClE,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO;QACH,KAAK,EAAE,UAAU,GAAG,CA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AAC;AACjB,CAAC;AAED,MAAM,UAAU,kCAAkC,CAAC,QAAyB,EAAE,QAAkB;IAC5F,MAAM,UAAU,GAAG,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC;QAC7C,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE;QAC5C,GAAG,EAAE,QAAQ;KAChB,CAAC,CAAC;IACH,MAAM,WAAW,GAAG,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC;QAC9C,KAAK,EAAE,QAAQ;QACf,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,gBAAgB,EAAE;KACnE,CAAC,CAAC;IACH,OAAO,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACrE,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { type Module } from 'langium';
2
+ import { type DefaultSharedModuleContext, type LangiumServices, type LangiumSharedServices, type PartialLangiumServices } from 'langium/lsp';
3
+ import { ReqlanValidator } from './reqlan-validator.js';
4
+ /**
5
+ * Declaration of custom services - add your own service classes here.
6
+ */
7
+ export type ReqlanAddedServices = {
8
+ validation: {
9
+ ReqlanValidator: ReqlanValidator;
10
+ };
11
+ };
12
+ /**
13
+ * Union of Langium default services and your custom services - use this as constructor parameter
14
+ * of custom service classes.
15
+ */
16
+ export type ReqlanServices = LangiumServices & ReqlanAddedServices;
17
+ /**
18
+ * Dependency injection module that overrides Langium default services and contributes the
19
+ * declared custom services. The Langium defaults can be partially specified to override only
20
+ * selected services, while the custom services must be fully specified.
21
+ */
22
+ export declare const ReqlanModule: Module<ReqlanServices, PartialLangiumServices & ReqlanAddedServices>;
23
+ /**
24
+ * Create the full set of services required by Langium.
25
+ *
26
+ * First inject the shared services by merging two modules:
27
+ * - Langium default shared services
28
+ * - Services generated by langium-cli
29
+ *
30
+ * Then inject the language-specific services by merging three modules:
31
+ * - Langium default language-specific services
32
+ * - Services generated by langium-cli
33
+ * - Services specified in this file
34
+ *
35
+ * @param context Optional module context with the LSP connection
36
+ * @returns An object wrapping the shared services and the language-specific services
37
+ */
38
+ export declare function createReqlanServices(context: DefaultSharedModuleContext): {
39
+ shared: LangiumSharedServices;
40
+ Reqlan: ReqlanServices;
41
+ };
@@ -0,0 +1,76 @@
1
+ import { inject } from 'langium';
2
+ import { createDefaultModule, createDefaultSharedModule } from 'langium/lsp';
3
+ import { ReqlanGeneratedModule, ReqlanGeneratedSharedModule } from './generated/module.js';
4
+ import { ReqlanDefinitionProvider } from './reqlan-definition-provider.js';
5
+ import { ReqlanDocumentHighlightProvider } from './reqlan-document-highlight-provider.js';
6
+ import { ReqlanDocumentLinkProvider } from './reqlan-document-link-provider.js';
7
+ import { createReqlanGrammarConfig } from './reqlan-grammar-config.js';
8
+ import { ReqlanNameProvider } from './reqlan-name-provider.js';
9
+ import { ReqlanLinker } from './reqlan-linker.js';
10
+ import { ReqlanScopeComputation, ReqlanScopeProvider } from './reqlan-scope.js';
11
+ import { ReqlanCompletionProvider } from './reqlan-completion-provider.js';
12
+ import { ReqlanCodeActionProvider } from './reqlan-code-action-provider.js';
13
+ import { sharedAttributeCatalog } from './reqlan-attribute-catalog.js';
14
+ import { ReqlanInlayHintProvider } from './reqlan-inlay-hint-provider.js';
15
+ import { ReqlanSemanticTokenProvider } from './reqlan-semantic-token-provider.js';
16
+ import { ReqlanTokenBuilder } from './reqlan-token-builder.js';
17
+ import { registerRqIgnoreErrorFiltering } from './reqlan-ignore-error.js';
18
+ import { ReqlanValidator, registerValidationChecks } from './reqlan-validator.js';
19
+ /**
20
+ * Dependency injection module that overrides Langium default services and contributes the
21
+ * declared custom services. The Langium defaults can be partially specified to override only
22
+ * selected services, while the custom services must be fully specified.
23
+ */
24
+ export const ReqlanModule = {
25
+ validation: {
26
+ ReqlanValidator: services => new ReqlanValidator(services)
27
+ },
28
+ references: {
29
+ Linker: services => new ReqlanLinker(services),
30
+ NameProvider: () => new ReqlanNameProvider(),
31
+ ScopeComputation: services => new ReqlanScopeComputation(services),
32
+ ScopeProvider: services => new ReqlanScopeProvider(services)
33
+ },
34
+ parser: {
35
+ GrammarConfig: createReqlanGrammarConfig,
36
+ TokenBuilder: () => new ReqlanTokenBuilder()
37
+ },
38
+ lsp: {
39
+ DefinitionProvider: services => new ReqlanDefinitionProvider(services),
40
+ DocumentHighlightProvider: services => new ReqlanDocumentHighlightProvider(services),
41
+ DocumentLinkProvider: services => new ReqlanDocumentLinkProvider(services),
42
+ SemanticTokenProvider: services => new ReqlanSemanticTokenProvider(services),
43
+ InlayHintProvider: services => new ReqlanInlayHintProvider(services),
44
+ CompletionProvider: services => new ReqlanCompletionProvider(services, sharedAttributeCatalog),
45
+ CodeActionProvider: services => new ReqlanCodeActionProvider(services)
46
+ }
47
+ };
48
+ /**
49
+ * Create the full set of services required by Langium.
50
+ *
51
+ * First inject the shared services by merging two modules:
52
+ * - Langium default shared services
53
+ * - Services generated by langium-cli
54
+ *
55
+ * Then inject the language-specific services by merging three modules:
56
+ * - Langium default language-specific services
57
+ * - Services generated by langium-cli
58
+ * - Services specified in this file
59
+ *
60
+ * @param context Optional module context with the LSP connection
61
+ * @returns An object wrapping the shared services and the language-specific services
62
+ */
63
+ export function createReqlanServices(context) {
64
+ const shared = inject(createDefaultSharedModule(context), ReqlanGeneratedSharedModule);
65
+ const Reqlan = inject(createDefaultModule({ shared }), ReqlanGeneratedModule, ReqlanModule);
66
+ shared.ServiceRegistry.register(Reqlan);
67
+ registerValidationChecks(Reqlan);
68
+ registerRqIgnoreErrorFiltering(shared);
69
+ if (!context.connection) {
70
+ // We don't run inside a language server
71
+ // Therefore, initialize the configuration provider instantly
72
+ shared.workspace.ConfigurationProvider.initialized({});
73
+ }
74
+ return { shared, Reqlan };
75
+ }
76
+ //# sourceMappingURL=reqlan-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reqlan-module.js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