Skip to content

(fix) don't trigger html completions inside moustache tags #90

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

Merged
merged 1 commit into from
May 16, 2020

Conversation

dummdidumm
Copy link
Member

Fixes #89

@jasonlyu123 does this seem like a reasonable fix for you?

@jasonlyu123
Copy link
Member

I think it could be moved to HTMLPlugin's doTagComplete. Also, there's also another thing that could trigger this tag close.

<input type="checkbox" checked={ a > b } />

Maybe using a solution similar to what you did to find last open tag to find if there is any unended { before > . And just play it safe and disabling the auto close even if { or } is possibly in a string literal.

@dummdidumm
Copy link
Member Author

You are right with both things. Will do, thanks!

@jasonlyu123
Copy link
Member

jasonlyu123 commented May 16, 2020

Find the advantage of doing it in the HtmlPlugin. we could utilize HTML language service's AST to find where the current node start and also get the attribute of the current tag.

const node = html.findNodeAt(offsetAt(position, document.getText()));

I tried this attribute :

<Foo a={a >} />

and it gets parsed as

{
   a:"{a"
}

@dummdidumm
Copy link
Member Author

Good find! I will try to add it to the logic.

@dummdidumm
Copy link
Member Author

I did add your suggestions, works really well. Thanks again!

@dummdidumm dummdidumm changed the title (fix) don't trigger auto close for arrow functions (fix) don't trigger html completions inside moustache tags May 16, 2020
@dummdidumm dummdidumm merged commit c2bb07a into sveltejs:master May 16, 2020
@dummdidumm dummdidumm deleted the fix-autoclose branch May 17, 2020 13:22
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.

Autocompletion inside on:click arrowfunction
2 participants