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

Wrong autocomplete for Components nested in objects #776

Closed
pushkine opened this issue Jan 22, 2021 · 2 comments · Fixed by #2631
Closed

Wrong autocomplete for Components nested in objects #776

pushkine opened this issue Jan 22, 2021 · 2 comments · Fixed by #2631
Labels
bug Something isn't working limitation Constraints of the existing architecture make this hard to fix

Comments

@pushkine
Copy link
Contributor

pushkine commented Jan 22, 2021

Code_2021-01-22_18-09-46

Code_2021-01-22_18-09-07

Expected autocomplete to show properties, got every global variable instead

edit: actions nested in objects have the same issue (use:object.action)

@pushkine pushkine added the bug Something isn't working label Jan 22, 2021
@jasonlyu123
Copy link
Member

jasonlyu123 commented Feb 2, 2021

This is the same cause of #538. But because the tag is not closed. One workaround is to self close it first like this.

<Slot />

or

<Slot. />

And then trigger completion

@dummdidumm
Copy link
Member

Possible solution: Try to parse it with svelte2tsx. If that fails, get the position where the autocompletion should happen and backtrack up until specific delimiters like whitespace, { or <, take everything inbetween and append it to the fallback-document.
So this:

<script>
   import { Hi } from './hi'
   let foo = 'bar';
</script>
<Hi.

becomes

import { Hi } from './hi'
let foo = 'bar';
Hi.

(the Hi. part is new)

This could also solve other cases where intellisense is not working properly currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working limitation Constraints of the existing architecture make this hard to fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants