-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
Code completion for expressions in the markup doesn't work properly #1302
Comments
This is a limitation we currently have. The syntax transformation under the hooks relies on the AST the svelte compiler returned. So it won't work if there's a syntax error in the markup. See sveltejs/svelte#4818. It should be working again once there's no syntax error. Like if you have at least an identifier after This won't be completely fixed anytime soon. What we can do is find a workaround for each case to slightly improve it. |
Related to #538, #786 and #1302 This PR added a utility to check if there's trailing property access behind an expression. The Reason we needed this is that we blank the operators before parsing. So the operator won't exist in the AST. We need to check it so that the expression transformation also include it. This should only be called with an expression that is a direct child of a template node. And since we only go backwards from the end of the moustache (}), it only makes sense to call this with the expression that might end directly before the end of the moustache.
Funny enough autocompletion works if you try it with brackets. Type And even more funny: if you simply put There is some black magic going on here. 🤷♂️ |
Describe the bug
Code completion in JavaScript expressions in the markup doesn't work (as least as reliably) as it does in the script tag.
To Reproduce
I have a
client
object that contains various functions that send fetch requests, when I'm in the<script>
and I typeclient
and then hit.
, this is the list of suggestions that appears, exactly what's expected:But when I do the same thing in an
{#await}
block, for example, this is the list of suggestions:As you can see, there is all sorts of unrelated stuff in there. I'm assuming this has something to do with this extension or the Svelte language server.
I've had this problem since the beginning, but I always thought "it's probably gonna be fixed soon", and I assumed there was an already-existing issue for it or something.
Expected behavior
I expect to see the members of the
client
objects properly as they are shown when I doclient.
in the script tag.System (please complete the following information):
The text was updated successfully, but these errors were encountered: