-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Svelte duplicated auto-imports on tab #6261
Comments
Could you try out if you can reproduce this with the latest master? There have been a few completion related fixes recently |
I just build from master and the glitch is still there, but I found something interesting, apparently the glitch only happens if I let the docs to pop up, btw I am only "circling" around with With pop up:Screencast.from.2023-03-131.webmWithout popup:Screencast.from.2023-03-132.webm |
I've also tried to replicate the glitch in plain TS, but there nothing happens, only using Svelte (SvelteKit exactly), so it can be something related to the Svelte LSP, maybe? |
Could you run helix with |
I ran |
Hey @pascalkuthe, I just trested your PR #6511 and the glitch is still there, I don't know if I am doing something wrong with my buildings, but if you want me to help you find a more detail description of the glitch, let me know and I will do exactly what you say me to find the problem. |
The editor has, also, been panicking while trying move (while deleting or auto-importing) the line right bellow the
This bug was already described here #3283, maybe these two bugs are related? |
Could you retry with #6594? I can not reproduce this but I never used (or heard of) sevelte before so I might be missing some setup (nothing is imported for me). I tested on TS directly (were more or less the same bug occurs) and there it's fixed now (I previously missed something). If the problem persists please post a minimal reproducible example so I can test this locally. The crash seems to be #3283 and related to TS highlighting (probably a language specific issue). Not something to do with completions (probably just a coincidence you ran into this at the same time) |
@pascalkuthe I tried the new one and is still the same, so I updated the reproduction steps (at the top of the issue) trying to be as clear as possible, and I am not gona lie, I am kind of worried there is something wrong with my machine and this only happens to me, but we will see, hopefully you can reproduce it. |
@pascalkuthe I don't know if you got to try it, but I made a mistake with the reproduction steps, but it should be fixed now. |
I was reproduce now after a while it took me a few times turns out I need to tab quite a bit. The reason for this bug seems to be that the svelte language servers adds an additional auto-import each time we resolve the completion. VSCode only resolves completions once but the LSP standard does not specify that clients can not resolve a completion multiple times. It makes sense to me tough to be more careful here since the point of resolving completions is to avoid expensive calculations so repeating them isn't exactly desirable. I added a commit to #6594 that makes helix remember which completions it requested (and avoid rerequesting) |
Yeah, I only ran into it once while coding casually and I discovered it because I got distracted and kept tabbing. I just tried your commit and it seems fixed, thanks for your contributions, you all are making an amazing tool. BTW, how did you find out? I know a little Rust, but once I saw the error log I knew I was not ready to solve the issue myself, maybe in the future I can start making small contributions. |
I have done a lot of work on the completions recently (and fixed other similar bugs in #6594) so I had a rough idea what it was related to. Once I had a reproduction case I simply looked at the logs and found that the problem occurred if completion resolving (what happens when you however over a completion item) happened multiple times and each time one more additionalTextEdit (what generates the import statement) was generated. So I looked at how vscode does things (vscode is basically the reference implementation for a LSP client) and noticed a comment saying that they are careful to only resolve completions once which confirmed my suspicions. Implementing the fix was almost trivial: just keep an additional For any LSP related issue it's basically always good to look at the log and check if the request helix sends/recives line up with the LSP standard/the way VSCode does things (since the standard is kind of incomplete sometimes) |
Very interesting, next time I will try to explore the problem a little more, and hopefully I can fix the problem or at least give a more detailed explanation of the error, thanks. |
Summary
SvelteKit auto-generates types, so I had to make a few rounds over the options in the popup with tab, and it duplicated the import as many times as I tabbed.
See video below:
Screencast from 2023-03-10 .webm
Screencast.from.2023-03-10.18-32-07.webm
Reproduction Steps
Run
npm create svelte@latest
then select the following options:Which Svelte app template?
Skeleton project
Add type checking with Typescript?
Yes, using Typescript syntax
Make sure to install the dependencies AND start the dev server.
Create
src/routes/+page.ts
whit the following content:Go to
src/routes/+page.svelte
insert<script lang="ts"></script>
While still in
src/routes/+page.svelte
, inside the script tag writeexport let data: ActionData
and here cycle, withTAB
, through auto-completion options a couple times, making sure you let the docs to popup and hitENTER
Helix log
~/.cache/helix/helix.log
Platform
Fedora Linux 37 (Workstation Edition)
Terminal Emulator
gnome-terminal
Helix Version
helix 22.12
The text was updated successfully, but these errors were encountered: