-
Hello community, I'm trying langium to customize a DSL-interaction in VS Code. I added the messanger, works, But I need to resolve this position to the AST - and I guess via a service in the language server of that DSL. I found this blogpost @sailingKieler about source maps in the generation phase: Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hey @jhln, as you correctly pointed out, all the positions are stored on the CST nodes of every AST element. You can simply use langium/packages/langium/src/lsp/definition-provider.ts Lines 68 to 79 in 58ce261 |
Beta Was this translation helpful? Give feedback.
Hey @jhln,
as you correctly pointed out, all the positions are stored on the CST nodes of every AST element. You can simply use
node.$cstNode?.range
to get the range of any AST element. That's for example how our LSP services work. See as an example:langium/packages/langium/src/lsp/definition-provider.ts
Lines 68 to 79 in 58ce261