Skip to content
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

Implement better completions #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ThatXliner
Copy link

No description provided.

@ThatXliner ThatXliner marked this pull request as draft May 13, 2021 18:19
@erezsh
Copy link
Member

erezsh commented May 13, 2021

I think a Visitor is a bit of an overkill for this. You can use Tree.find_pred() or even Tree.iter_subtrees() instead.

@ThatXliner
Copy link
Author

Can you help with getting the document's source? Looking at the other ones, I think it's

get_locals_for(ls.workspace.get_document(params.textDocument.uri)).source

instead, right?

I think a Visitor is a bit of an overkill for this. You can use Tree.find_pred() or even Tree.iter_subtrees() instead.

So,

return [
    definition[0] if not definition[0][0] =="!" else definition[0][1:]
    for definition in
    lark_grammar.lark_grammar_parser.parse(doc).find_pred(lambda node: node.rule in {"rule", "token"})
]

(yes, I love one-liners)

What's the thing with CompletionItem right here?

@erezsh erezsh requested a review from rmcgregor1990 May 13, 2021 18:53
@erezsh
Copy link
Member

erezsh commented May 13, 2021

Maybe @rmcgregor1990 can answer these.

@ThatXliner
Copy link
Author

The start up time is kind of slow
Screen Shot 2021-05-13 at 2 35 34 PM

@ThatXliner ThatXliner marked this pull request as ready for review May 19, 2021 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants