Replies: 1 comment
-
Hey @knpwrs, generally, the existing content assist functionality in Chevrotain is fairly barebones. The recommended solution is actually to build a specific parser for content assist, see a pretty extensive answer here. Content assist in general is a pretty complicated topic and I've spent weeks working on the implementation in Langium (based on Chevrotain) to create something that works most of the time. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a working lexer and parser for the liquid templating language that I built using Chevrotain, and I am able to get completion suggestions using
computeContentAssist
, which is really cool! However, looking at this example (chevrotain/examples/parser/content_assist/content_assist_complex.js
Line 137 in 4272462
With the cursor at
|
, I want to suggest the variablei
. I've been attempting to find a way to find variables defined in scope based on the CST or any other data I have available, but I'm at a loss. I've even tried setting global state usingthis.ACTION
butthis.ACTION
doesn't appear to run while callingcomputeContentAssist
(and thinking about it I understand why this is, multiple paths are traversed to find suggestions and so the global state would not be reliable).Is there any way to get a partial cst of any sort or any contextual structure I can traverse to determine what variables are defined in scope?
The rule stack for the first suggestion from above is:
A great start would be the ability to look at the structure of that
controlFor
, since a variable can be defined there, but it would also be great to be able to look at the structure of siblingassign
rules.Beta Was this translation helpful? Give feedback.
All reactions