How to achieve soft keywords? #1012
-
Hi, My Langium schema contains keywords that are contextual. I.e., only has special meaning when used in an expression. For example: Is there a way to achieve this in Langium? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The usual solution is to use a "data type rule" for regular IDs:
That includes the listed keywords where a regular ID is possible. However, that's not considered in syntax highlighting, so |
Beta Was this translation helpful? Give feedback.
-
Thank you! I found I've already done this in another place, just wasn't sure if it's the right solution 😄. Yes, the default highlighting behavior is not ideal. I'll look into the solution. 🙏 |
Beta Was this translation helpful? Give feedback.
The usual solution is to use a "data type rule" for regular IDs:
That includes the listed keywords where a regular ID is possible. However, that's not considered in syntax highlighting, so
in
would still be highlighted as keyword regardless where it's used. To avoid that, you can turn off generating the highlighting file and manually remove the keyword.