-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to correctly use collectCandidates()? #21
Comments
A token index is the index of the token in the token stream, not a character index. What you first have to do is to take your caret position and find the correct token index for that. You can do that by simply iterating over the token stream and find the token that encloses the caret position. |
Say I have this
|
Correct. |
I noticed that tokens are protected |
Easy, check the C3 source how it is done there. |
Say I have mysql grammar, and want to get autocomplete after
select
query.Simple grammar:
How should I correctly find
caretTokenIndex
?const candidates = core.collectCandidates('select'.length-1); OR const candidates = core.collectCandidates(0);
The text was updated successfully, but these errors were encountered: