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

Further autocomplete improvements #442

Merged
merged 3 commits into from
Oct 26, 2022
Merged

Further autocomplete improvements #442

merged 3 commits into from
Oct 26, 2022

Conversation

dfreeman
Copy link
Member

As with #393, this still doesn't solve our underlying "only syntactically-valid templates can produce completions" problem, but it does resolve the main issue called out in #436.

At a high level, several different related issues were coming together to produce the behavior described in #436:

  • completions triggered as the result of typing a partial identifier are always considered CompletionTriggerKind.Invoked (this is per the LSP, not just a weird choice on Code's part)
  • we weren't forwarding TS's sorting information through the LSP, so items didn't necessarily display in order of relevance
  • standalone templates with a syntax error end up mapping to a 0-length span at the top level of the corresponding backing module, meaning that when we tried to produce completions for e.g. {{foo.}}, we'd return the full list of hundreds of available globals

Fixing those three errors, completion now looks like this:

Glint providing mostly-reasonable completion for a let-bound local value and one of its properties in a template

(Note that in a loose-mode template we can't provide completions for myHashObject, as we have to assume during emit that e.g. myH is referring to some global and not an incomplete reference to a local identifier)

@dfreeman dfreeman added the bug Something isn't working label Oct 26, 2022
@dfreeman dfreeman linked an issue Oct 26, 2022 that may be closed by this pull request
@dfreeman dfreeman merged commit 6ce323a into main Oct 26, 2022
@dfreeman dfreeman deleted the completion-weirdness branch October 26, 2022 18:44
@chriskrycho
Copy link
Member

This is a big improvement. Thank you, as ever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vague autocomplete weirdness
2 participants