@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,194 @@
1
+ /**
2
+ * Formats inbound reference lists for idea declaration inlay hints.
3
+ */
4
+ import { AstUtils, GrammarUtils, type AstNode } from 'langium';
5
+ import {
6
+ Command,
7
+ InlayHintLabelPart,
8
+ Location,
9
+ MarkupKind,
10
+ type InlayHintLabelPart as InlayHintLabelPartType,
11
+ type MarkupContent
12
+ } from 'vscode-languageserver';
13
+ import { isIdea, isIdeaSet, isOneLinerIdea, type IdeaDeclaration, type IdeaSet } from './generated/ast.js';
14
+ import { REQLAN_INBOUND_REFERENCES_SUMMARY_COMMAND } from './reqlan-inlay-hint-settings.js';
15
+ import type { ReqlanServices } from './reqlan-module.js';
16
+
17
+ export interface InboundReferenceInlayLabel {
18
+ labelParts: InlayHintLabelPartType[];
19
+ tooltip?: MarkupContent;
20
+ }
21
+
22
+ export interface InboundReferencer {
23
+ name: string;
24
+ location: Location;
25
+ }
26
+
27
+ export type ReferencedDeclaration = IdeaDeclaration | IdeaSet;
28
+
29
+ const MAX_INLINE_NAMES = 3;
30
+
31
+ /**
32
+ * Collect inbound idea referencers from the whole Langium workspace index
33
+ * (every indexed `.rq` document), not only the declaration's file.
34
+ */
35
+ export function collectInboundReferencers(
36
+ services: ReqlanServices,
37
+ declaration: ReferencedDeclaration
38
+ ): InboundReferencer[] {
39
+ const documents = services.shared.workspace.LangiumDocuments;
40
+ const locator = services.workspace.AstNodeLocator;
41
+ const referencers = new Map<string, InboundReferencer>();
42
+
43
+ // findReferences without documentUri walks IndexManager across the workspace.
44
+ for (const reference of services.references.References.findReferences(declaration, { includeDeclaration: false }).toArray()) {
45
+ const sourceDocument = documents.getDocument(reference.sourceUri);
46
+ if (!sourceDocument) {
47
+ continue;
48
+ }
49
+ const sourceNode = locator.getAstNode(sourceDocument.parseResult.value, reference.sourcePath);
50
+ if (!sourceNode) {
51
+ continue;
52
+ }
53
+ const referrer = enclosingReferrerDeclaration(sourceNode);
54
+ if (!referrer || isSameDeclaration(referrer, declaration)) {
55
+ continue;
56
+ }
57
+ const location = locationForReferrer(referrer);
58
+ if (!location) {
59
+ continue;
60
+ }
61
+ referencers.set(locationKey(location), {
62
+ name: referrer.name,
63
+ location
64
+ });
65
+ }
66
+
67
+ return [...referencers.values()].sort((left, right) => left.name.localeCompare(right.name));
68
+ }
69
+
70
+ /** @deprecated Use {@link collectInboundReferencers} */
71
+ export function collectInboundReferencingNames(
72
+ services: ReqlanServices,
73
+ declaration: ReferencedDeclaration
74
+ ): string[] {
75
+ return collectInboundReferencers(services, declaration).map(referrer => referrer.name);
76
+ }
77
+
78
+ function enclosingReferrerDeclaration(node: AstNode): ReferencedDeclaration | undefined {
79
+ let current: AstNode | undefined = node;
80
+ while (current) {
81
+ if (isIdea(current) || isOneLinerIdea(current) || isIdeaSet(current)) {
82
+ return current;
83
+ }
84
+ current = current.$container;
85
+ }
86
+ return undefined;
87
+ }
88
+
89
+ function isSameDeclaration(left: ReferencedDeclaration, right: ReferencedDeclaration): boolean {
90
+ if (left === right) {
91
+ return true;
92
+ }
93
+ if (left.name !== right.name) {
94
+ return false;
95
+ }
96
+ return AstUtils.getDocument(left).uri.toString() === AstUtils.getDocument(right).uri.toString();
97
+ }
98
+
99
+ function locationForReferrer(referrer: ReferencedDeclaration): Location | undefined {
100
+ const nameNode = GrammarUtils.findNodeForProperty(referrer.$cstNode, 'name');
101
+ if (!nameNode?.range) {
102
+ return undefined;
103
+ }
104
+ const document = AstUtils.getDocument(referrer);
105
+ return Location.create(document.textDocument.uri, nameNode.range);
106
+ }
107
+
108
+ function locationKey(location: Location): string {
109
+ const range = location.range;
110
+ return `${location.uri}#${range.start.line}:${range.start.character}`;
111
+ }
112
+
113
+ export function referencerMarkdownLink(referrer: InboundReferencer): string {
114
+ const line = referrer.location.range.start.line + 1;
115
+ const character = referrer.location.range.start.character + 1;
116
+ return `[${referrer.name}](${referrer.location.uri}#L${line},${character})`;
117
+ }
118
+
119
+ export function buildReferencersTooltipMarkup(referencers: InboundReferencer[]): MarkupContent {
120
+ const items = referencers.map(referrer => `- ${referencerMarkdownLink(referrer)}`).join('\n');
121
+ return {
122
+ kind: MarkupKind.Markdown,
123
+ value: `**Referenced by**\n\n${items}`
124
+ };
125
+ }
126
+
127
+ function referencerPartTooltip(referrer: InboundReferencer): MarkupContent {
128
+ return {
129
+ kind: MarkupKind.Markdown,
130
+ value: referencerMarkdownLink(referrer)
131
+ };
132
+ }
133
+
134
+ export function buildInboundReferencesInlayLabel(
135
+ referencers: InboundReferencer[],
136
+ targetDocumentUri: string,
137
+ targetName: string
138
+ ): InboundReferenceInlayLabel | undefined {
139
+ if (referencers.length === 0) {
140
+ return undefined;
141
+ }
142
+ const tooltip = buildReferencersTooltipMarkup(referencers);
143
+ const inlineReferencers = referencers.slice(0, MAX_INLINE_NAMES);
144
+ const remainder = referencers.length - inlineReferencers.length;
145
+ const labelParts: InlayHintLabelPartType[] = [
146
+ InlayHintLabelPart.create('@referenced-by: (')
147
+ ];
148
+
149
+ for (let index = 0; index < inlineReferencers.length; index++) {
150
+ if (index > 0) {
151
+ labelParts.push(InlayHintLabelPart.create(', '));
152
+ }
153
+ labelParts.push({
154
+ value: inlineReferencers[index].name,
155
+ location: inlineReferencers[index].location,
156
+ tooltip: referencerPartTooltip(inlineReferencers[index])
157
+ });
158
+ }
159
+
160
+ if (remainder > 0) {
161
+ labelParts.push(InlayHintLabelPart.create(', '));
162
+ labelParts.push({
163
+ value: `+${remainder} more`,
164
+ tooltip,
165
+ command: Command.create(
166
+ 'Show all inbound references',
167
+ REQLAN_INBOUND_REFERENCES_SUMMARY_COMMAND,
168
+ targetDocumentUri,
169
+ targetName
170
+ )
171
+ });
172
+ }
173
+
174
+ labelParts.push(InlayHintLabelPart.create(')'));
175
+
176
+ return {
177
+ labelParts,
178
+ tooltip
179
+ };
180
+ }
181
+
182
+ /** @deprecated Use {@link buildInboundReferencesInlayLabel} */
183
+ export function formatInboundReferencesInlayLabel(referencers: string[]): { label: string; tooltip?: string } | undefined {
184
+ if (referencers.length === 0) {
185
+ return undefined;
186
+ }
187
+ const inlineNames = referencers.slice(0, MAX_INLINE_NAMES);
188
+ const remainder = referencers.length - inlineNames.length;
189
+ const suffix = remainder > 0 ? `, +${remainder} more` : '';
190
+ return {
191
+ label: `@referenced-by: (${inlineNames.join(', ')}${suffix})`,
192
+ tooltip: referencers.join('\n')
193
+ };
194
+ }
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Inlay hints showing inbound references on idea declarations as a computed attribute.
3
+ */
4
+ import { AstUtils, GrammarUtils, type AstNode, type LangiumDocument } from 'langium';
5
+ import { AbstractInlayHintProvider } from 'langium/lsp';
6
+ import type { CancellationToken } from 'vscode-languageserver';
7
+ import { InlayHintKind, type InlayHint, type InlayHintParams } from 'vscode-languageserver';
8
+ import {
9
+ isIdea,
10
+ isIdeaSet,
11
+ isOneLinerIdea
12
+ } from './generated/ast.js';
13
+ import {
14
+ buildInboundReferencesInlayLabel,
15
+ collectInboundReferencers,
16
+ type ReferencedDeclaration
17
+ } from './reqlan-inbound-reference-inlay-label.js';
18
+ import {
19
+ REQLAN_REFERENCE_INLAY_HINTS_SETTING,
20
+ referenceInlayHintsEnabled,
21
+ type ReferenceInlayHintsSettings
22
+ } from './reqlan-inlay-hint-settings.js';
23
+ import type { ReqlanServices } from './reqlan-module.js';
24
+
25
+ export class ReqlanInlayHintProvider extends AbstractInlayHintProvider {
26
+
27
+ private readonly services: ReqlanServices;
28
+
29
+ constructor(services: ReqlanServices) {
30
+ super();
31
+ this.services = services;
32
+ }
33
+
34
+ override async getInlayHints(
35
+ document: LangiumDocument,
36
+ params: InlayHintParams,
37
+ cancelToken?: CancellationToken
38
+ ): Promise<InlayHint[] | undefined> {
39
+ const settings = await this.services.shared.workspace.ConfigurationProvider.getConfiguration(
40
+ 'reqlan',
41
+ REQLAN_REFERENCE_INLAY_HINTS_SETTING
42
+ ) as ReferenceInlayHintsSettings | undefined;
43
+ if (!referenceInlayHintsEnabled(settings)) {
44
+ return [];
45
+ }
46
+ return super.getInlayHints(document, params, cancelToken);
47
+ }
48
+
49
+ computeInlayHint(node: AstNode, acceptor: (hint: InlayHint) => void): void {
50
+ if (isIdea(node) || isOneLinerIdea(node)) {
51
+ this.acceptInboundReferenceHint(node, acceptor);
52
+ return;
53
+ }
54
+ if (isIdeaSet(node)) {
55
+ this.acceptInboundReferenceHint(node, acceptor);
56
+ }
57
+ }
58
+
59
+ private acceptInboundReferenceHint(
60
+ declaration: ReferencedDeclaration,
61
+ acceptor: (hint: InlayHint) => void
62
+ ): void {
63
+ const nameNode = GrammarUtils.findNodeForProperty(declaration.$cstNode, 'name');
64
+ if (!nameNode?.range) {
65
+ return;
66
+ }
67
+ const referencers = collectInboundReferencers(this.services, declaration);
68
+ const document = AstUtils.getDocument(declaration);
69
+ const formatted = buildInboundReferencesInlayLabel(
70
+ referencers,
71
+ document.textDocument.uri,
72
+ declaration.name
73
+ );
74
+ if (!formatted) {
75
+ return;
76
+ }
77
+ acceptor({
78
+ position: {
79
+ line: nameNode.range.end.line,
80
+ character: nameNode.range.end.character
81
+ },
82
+ label: formatted.labelParts,
83
+ tooltip: formatted.tooltip,
84
+ kind: InlayHintKind.Type,
85
+ paddingLeft: true
86
+ });
87
+ }
88
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Workspace settings for reference inlay hints.
3
+ */
4
+ export const REQLAN_REFERENCE_INLAY_HINTS_SETTING = 'referencesInlayHints';
5
+
6
+ /** VS Code command invoked when clicking "+N more" on an inbound-reference inlay hint. */
7
+ export const REQLAN_INBOUND_REFERENCES_SUMMARY_COMMAND = 'reqlan.openInboundReferencesSummary';
8
+
9
+ export interface ReferenceInlayHintsSettings {
10
+ enabled?: boolean;
11
+ }
12
+
13
+ export function referenceInlayHintsEnabled(settings: ReferenceInlayHintsSettings | undefined): boolean {
14
+ return settings?.enabled === true;
15
+ }
@@ -0,0 +1,108 @@
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, FileSystemProvider, LangiumDocument, LangiumDocuments, ReferenceInfo } from 'langium';
7
+ import { AstUtils, DefaultLinker, type DefaultReference } from 'langium';
8
+ import { isLocalReference, isModel, isQualifiedReference } from './generated/ast.js';
9
+ import { isOpaqueFileReferencePath } from './reqlan-file-references.js';
10
+ import { findNamespaceImportByAlias } from './reqlan-import-bindings.js';
11
+ import { isResolvableImportPath } from './reqlan-imports.js';
12
+ import type { ReqlanServices } from './reqlan-module.js';
13
+ import { pathResolveContextFromServices } from './reqlan-path-resolve.js';
14
+ import { unquoteReqlanString } from './reqlan-references.js';
15
+
16
+ /** Marks a reference that resolves to a file rather than to an AST node. */
17
+ export const UnlinkedFileTarget = Symbol('UnlinkedFileTarget');
18
+
19
+ export class ReqlanLinker extends DefaultLinker {
20
+
21
+ private readonly documents: LangiumDocuments;
22
+ private readonly fileSystem: FileSystemProvider;
23
+ private readonly services: ReqlanServices;
24
+
25
+ constructor(services: ReqlanServices) {
26
+ super(services);
27
+ this.documents = services.shared.workspace.LangiumDocuments;
28
+ this.fileSystem = services.shared.workspace.FileSystemProvider;
29
+ this.services = services;
30
+ }
31
+
32
+ protected override doLink(refInfo: ReferenceInfo, document: LangiumDocument): void {
33
+ if (this.isAnonymousImportPathReference(refInfo)) {
34
+ const scope = this.scopeProvider.getScope(refInfo);
35
+ if (scope.getElement(refInfo.reference.$refText)) {
36
+ super.doLink(refInfo, document);
37
+ return;
38
+ }
39
+ const path = unquoteReqlanString(refInfo.reference.$refText);
40
+ if (isOpaqueFileReferencePath(path)) {
41
+ return;
42
+ }
43
+ if (this.resolvesAnonymousImportPath(path, document)) {
44
+ this.markUnlinked(refInfo, document);
45
+ return;
46
+ }
47
+ }
48
+ if (this.isNamespaceAliasReference(refInfo)) {
49
+ this.markUnlinked(refInfo, document);
50
+ return;
51
+ }
52
+ super.doLink(refInfo, document);
53
+ }
54
+
55
+ /**
56
+ * `[alias]` on its own targets the imported file, not an idea inside it. The check stays syntactic
57
+ * because reading `ref` here would resolve the reference and record the linking error we avoid.
58
+ */
59
+ private isNamespaceAliasReference(refInfo: ReferenceInfo): boolean {
60
+ const container = refInfo.container;
61
+ if (!isLocalReference(container)) {
62
+ return false;
63
+ }
64
+ if (refInfo.property !== 'idea') {
65
+ return false;
66
+ }
67
+ const model = AstUtils.getDocument(container).parseResult.value;
68
+ if (!isModel(model)) {
69
+ return false;
70
+ }
71
+ const name = refInfo.reference.$refText;
72
+ if (model.elements.some(element => element.name === name)) {
73
+ return false;
74
+ }
75
+ return findNamespaceImportByAlias(model.imports, name) !== undefined;
76
+ }
77
+
78
+ protected override resolveReference(reference: DefaultReference, node: AstNode, property: string): AstNode | undefined {
79
+ if ((reference as { _ref?: unknown })._ref === UnlinkedFileTarget) {
80
+ return undefined;
81
+ }
82
+ return super.resolveReference(reference, node, property);
83
+ }
84
+
85
+ private isAnonymousImportPathReference(refInfo: ReferenceInfo): boolean {
86
+ return isQualifiedReference(refInfo.container)
87
+ && refInfo.property === 'path'
88
+ && refInfo.container.path === refInfo.reference;
89
+ }
90
+
91
+ private resolvesAnonymousImportPath(path: string, document: LangiumDocument): boolean {
92
+ return isResolvableImportPath(
93
+ path,
94
+ document,
95
+ this.documents,
96
+ this.fileSystem,
97
+ pathResolveContextFromServices(this.services)
98
+ );
99
+ }
100
+
101
+ private markUnlinked(refInfo: ReferenceInfo, document: LangiumDocument): void {
102
+ const ref = refInfo.reference;
103
+ if ('_ref' in ref && ref._ref === undefined) {
104
+ ref._ref = UnlinkedFileTarget;
105
+ document.references.push(ref);
106
+ }
107
+ }
108
+ }
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Helpers for markdown-style links `[label](target)` in requirement prose.
3
+ */
4
+ import type { CstNode, LangiumDocument } from 'langium';
5
+ import { CstUtils } from 'langium';
6
+ import type { Position } from 'vscode-languageserver';
7
+ import { isMarkdownLink } from './generated/ast.js';
8
+ import { parseMarkdownLink } from './reqlan-references.js';
9
+
10
+ const MARKDOWN_LINK_IN_TEXT_PATTERN = /\[([^\]]+)\]\(([^)]+)\)/g;
11
+
12
+ export function markdownLinkLabelRange(raw: string, linkOffset: number): { start: number; end: number } | undefined {
13
+ const parsed = parseMarkdownLink(raw);
14
+ if (!parsed) {
15
+ return undefined;
16
+ }
17
+ return {
18
+ start: linkOffset + 1,
19
+ end: linkOffset + 1 + parsed.label.length
20
+ };
21
+ }
22
+
23
+ export function markdownLinkTargetRange(raw: string, linkOffset: number): { start: number; end: number } | undefined {
24
+ const parsed = parseMarkdownLink(raw);
25
+ if (!parsed) {
26
+ return undefined;
27
+ }
28
+ const targetStart = raw.indexOf('](') + 2;
29
+ return {
30
+ start: linkOffset + targetStart,
31
+ end: linkOffset + targetStart + parsed.target.length
32
+ };
33
+ }
34
+
35
+ export function isOffsetInsideRange(offset: number, start: number, end: number): boolean {
36
+ return offset >= start && offset < end;
37
+ }
38
+
39
+ export function isMarkdownLinkLabelPosition(document: LangiumDocument, position: Position): boolean {
40
+ const offset = document.textDocument.offsetAt(position);
41
+ const root = document.parseResult.value.$cstNode;
42
+ if (root) {
43
+ const leaf = CstUtils.findLeafNodeAtOffset(root, offset);
44
+ let current: CstNode | undefined = leaf;
45
+ while (current) {
46
+ if (isMarkdownLink(current.astNode)) {
47
+ const labelRange = markdownLinkLabelRange(current.astNode.raw, current.offset);
48
+ if (labelRange && isOffsetInsideRange(offset, labelRange.start, labelRange.end)) {
49
+ return true;
50
+ }
51
+ return false;
52
+ }
53
+ current = current.container;
54
+ }
55
+ }
56
+ return isMarkdownLinkLabelOffsetInText(document.textDocument.getText(), offset);
57
+ }
58
+
59
+ export function isMarkdownLinkTargetPosition(document: LangiumDocument, position: Position): boolean {
60
+ const offset = document.textDocument.offsetAt(position);
61
+ const root = document.parseResult.value.$cstNode;
62
+ if (!root) {
63
+ return false;
64
+ }
65
+ const leaf = CstUtils.findLeafNodeAtOffset(root, offset);
66
+ let current: CstNode | undefined = leaf;
67
+ while (current) {
68
+ if (isMarkdownLink(current.astNode)) {
69
+ const targetRange = markdownLinkTargetRange(current.astNode.raw, current.offset);
70
+ return targetRange ? isOffsetInsideRange(offset, targetRange.start, targetRange.end) : false;
71
+ }
72
+ current = current.container;
73
+ }
74
+ return false;
75
+ }
76
+
77
+ export function isMarkdownLinkLabelOffsetInText(text: string, offset: number): boolean {
78
+ for (const span of iterateMarkdownLinkSpans(text)) {
79
+ if (isOffsetInsideRange(offset, span.labelStart, span.labelEnd)) {
80
+ return true;
81
+ }
82
+ }
83
+ return false;
84
+ }
85
+
86
+ export function isRangeInsideMarkdownLinkLabel(text: string, start: number, end: number): boolean {
87
+ for (const span of iterateMarkdownLinkSpans(text)) {
88
+ if (start >= span.labelStart && end <= span.labelEnd) {
89
+ return true;
90
+ }
91
+ }
92
+ return false;
93
+ }
94
+
95
+ export interface MarkdownLinkSpan {
96
+ rawStart: number;
97
+ rawEnd: number;
98
+ labelStart: number;
99
+ labelEnd: number;
100
+ targetStart: number;
101
+ targetEnd: number;
102
+ }
103
+
104
+ export function iterateMarkdownLinkSpans(text: string): MarkdownLinkSpan[] {
105
+ const spans: MarkdownLinkSpan[] = [];
106
+ MARKDOWN_LINK_IN_TEXT_PATTERN.lastIndex = 0;
107
+ let match: RegExpExecArray | null;
108
+ while ((match = MARKDOWN_LINK_IN_TEXT_PATTERN.exec(text)) !== null) {
109
+ const rawStart = match.index;
110
+ const labelStart = rawStart + 1;
111
+ const labelEnd = labelStart + match[1]!.length;
112
+ const targetStart = labelEnd + 2;
113
+ const targetEnd = targetStart + match[2]!.length;
114
+ spans.push({
115
+ rawStart,
116
+ rawEnd: targetEnd + 1,
117
+ labelStart,
118
+ labelEnd,
119
+ targetStart,
120
+ targetEnd
121
+ });
122
+ }
123
+ return spans;
124
+ }
125
+
126
+ export function linePrefixBeforeMarkdownLinkTarget(document: LangiumDocument, position: Position): boolean {
127
+ const linePrefix = document.textDocument.getText({
128
+ start: { line: position.line, character: 0 },
129
+ end: position
130
+ });
131
+ const afterCursor = document.textDocument.getText({
132
+ start: position,
133
+ end: { line: position.line, character: Number.MAX_SAFE_INTEGER }
134
+ });
135
+ return /\[[^\]]*$/.test(linePrefix) && /^\]\(/.test(afterCursor);
136
+ }
@@ -0,0 +1,104 @@
1
+ import { type Module, inject } from 'langium';
2
+ import { createDefaultModule, createDefaultSharedModule, type DefaultSharedModuleContext, type LangiumServices, type LangiumSharedServices, type PartialLangiumServices } 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 { ReqlanCodeLensProvider } from './reqlan-code-lens-provider.js';
15
+ import { ReqlanInlayHintProvider } from './reqlan-inlay-hint-provider.js';
16
+ import { ReqlanSemanticTokenProvider } from './reqlan-semantic-token-provider.js';
17
+ import { ReqlanTokenBuilder } from './reqlan-token-builder.js';
18
+ import { registerRqIgnoreErrorFiltering } from './reqlan-ignore-error.js';
19
+ import { ReqlanValidator, registerValidationChecks } from './reqlan-validator.js';
20
+
21
+ /**
22
+ * Declaration of custom services - add your own service classes here.
23
+ */
24
+ export type ReqlanAddedServices = {
25
+ validation: {
26
+ ReqlanValidator: ReqlanValidator
27
+ }
28
+ }
29
+
30
+ /**
31
+ * Union of Langium default services and your custom services - use this as constructor parameter
32
+ * of custom service classes.
33
+ */
34
+ export type ReqlanServices = LangiumServices & ReqlanAddedServices
35
+
36
+ /**
37
+ * Dependency injection module that overrides Langium default services and contributes the
38
+ * declared custom services. The Langium defaults can be partially specified to override only
39
+ * selected services, while the custom services must be fully specified.
40
+ */
41
+ export const ReqlanModule: Module<ReqlanServices, PartialLangiumServices & ReqlanAddedServices> = {
42
+ validation: {
43
+ ReqlanValidator: services => new ReqlanValidator(services)
44
+ },
45
+ references: {
46
+ Linker: services => new ReqlanLinker(services),
47
+ NameProvider: () => new ReqlanNameProvider(),
48
+ ScopeComputation: services => new ReqlanScopeComputation(services),
49
+ ScopeProvider: services => new ReqlanScopeProvider(services)
50
+ },
51
+ parser: {
52
+ GrammarConfig: createReqlanGrammarConfig,
53
+ TokenBuilder: () => new ReqlanTokenBuilder()
54
+ },
55
+ lsp: {
56
+ DefinitionProvider: services => new ReqlanDefinitionProvider(services),
57
+ DocumentHighlightProvider: services => new ReqlanDocumentHighlightProvider(services),
58
+ DocumentLinkProvider: services => new ReqlanDocumentLinkProvider(services),
59
+ SemanticTokenProvider: services => new ReqlanSemanticTokenProvider(services),
60
+ InlayHintProvider: services => new ReqlanInlayHintProvider(services),
61
+ CodeLensProvider: services => new ReqlanCodeLensProvider(services),
62
+ CompletionProvider: services => new ReqlanCompletionProvider(services, sharedAttributeCatalog),
63
+ CodeActionProvider: services => new ReqlanCodeActionProvider(services)
64
+ }
65
+ };
66
+
67
+ /**
68
+ * Create the full set of services required by Langium.
69
+ *
70
+ * First inject the shared services by merging two modules:
71
+ * - Langium default shared services
72
+ * - Services generated by langium-cli
73
+ *
74
+ * Then inject the language-specific services by merging three modules:
75
+ * - Langium default language-specific services
76
+ * - Services generated by langium-cli
77
+ * - Services specified in this file
78
+ *
79
+ * @param context Optional module context with the LSP connection
80
+ * @returns An object wrapping the shared services and the language-specific services
81
+ */
82
+ export function createReqlanServices(context: DefaultSharedModuleContext): {
83
+ shared: LangiumSharedServices,
84
+ Reqlan: ReqlanServices
85
+ } {
86
+ const shared = inject(
87
+ createDefaultSharedModule(context),
88
+ ReqlanGeneratedSharedModule
89
+ );
90
+ const Reqlan = inject(
91
+ createDefaultModule({ shared }),
92
+ ReqlanGeneratedModule,
93
+ ReqlanModule
94
+ );
95
+ shared.ServiceRegistry.register(Reqlan);
96
+ registerValidationChecks(Reqlan);
97
+ registerRqIgnoreErrorFiltering(shared);
98
+ if (!context.connection) {
99
+ // We don't run inside a language server
100
+ // Therefore, initialize the configuration provider instantly
101
+ shared.workspace.ConfigurationProvider.initialized({});
102
+ }
103
+ return { shared, Reqlan };
104
+ }