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

Improved struct completion #181

Merged
merged 1 commit into from
May 25, 2023
Merged

Improved struct completion #181

merged 1 commit into from
May 25, 2023

Conversation

scohen
Copy link
Collaborator

@scohen scohen commented May 24, 2023

Struct completion under elixir sense was extremely inconsistent from context to context and even file to file. This was extremely frustrating, as structs might or might not complete depending, seemingly on the time of day.

On the other hand, module completion was pretty consistent, so to fix the issue, prior to sending a document for completion, if we're in a struct reference, we strip it out to get the original module reference back. This means we'll only get module completions from elixir_sense, but we already check for struct references and if we detect that we're in one, turn module completions into struct completions.

I've played around with this and it does seem to fix the problems I was having prior.

Struct completion under elixir sense was extremely inconsistent from
context to context and even file to file. This was extremely
frustrating, as structs might or might not complete depending,
seemingly on the time of day.

On the other hand, module completion was pretty consistent, so to fix
the issue, prior to sending a document for completion, if we're in a
struct reference, we strip it out to get the original module reference
back. This means we'll only get module completions from elixir_sense,
but we already check for struct references and if we detect that we're
in one, turn module completions into struct completions.

I've played around with this and it does seem to fix the problems I
was having prior.
@scohen scohen merged commit 2a51f10 into main May 25, 2023
@scohen scohen deleted the improve-struct-completion branch May 25, 2023 00:38
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