save the position/location of node #1044
-
Hi there! I'm planning to create a parser and a linter using Langium. But I want the position or location of the node, which might be helpful for linting and making consistent code style. So, is it possible to save the position or location of a node? like saving the start and end of the node and so on? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@Yokozuna59 What do you mean by saving it? Storing it in a variable? You can always access the positional data of any AST node by accessing it's |
Beta Was this translation helpful? Give feedback.
@Yokozuna59 What do you mean by saving it? Storing it in a variable? You can always access the positional data of any AST node by accessing it's
$cstNode
property. To get fine grained results for certain properties of the AST node, the functionsfindNodeForProperty
andfindNodeForKeyword
can be called.