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

Terminal freezes every time try to quit editor when LSP is launching #2059

Open
anzhi0708 opened this issue Apr 10, 2022 · 5 comments
Open
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug

Comments

@anzhi0708
Copy link

Summary

Add this line to ~/.config/helix/config.toml:

[editor.lsp]
display-messages = true

Then edit any source file with LSP support enabled, you see language server's messages (e.g. "fetching...", "25%", "3/4" and a circle-like animation) shown on the left conner.

Once you see the messages (obviously it means your language server is starting), immediately type :wq and your terminal freezes until the language server is completely booted up.

Try this on an old machine. It takes even longer for the language server to boot up and you can easily get a frozen terminal.

Reproduction Steps

See above.

Helix log

See #2003.

Platform

macOS, Termux

Terminal Emulator

iTerm2, Termux

Helix Version

helix 22.03 (d4e45fd)

@anzhi0708 anzhi0708 added the C-bug Category: This is a bug label Apr 10, 2022
@anzhi0708 anzhi0708 changed the title Terminal frozen every time try to quit editor when LSP is launching Terminal freezes every time try to quit editor when LSP is launching Apr 10, 2022
@the-mikedavis the-mikedavis added the A-helix-term Area: Helix term improvements label Apr 10, 2022
@archseer
Copy link
Member

This is because we are trying to wait for the formatter, :q is instant.

See also #1639

@hazeycode
Copy link
Contributor

hazeycode commented May 25, 2022

This is because we are trying to wait for the formatter, :q is instant.

See also #1639

‘:q’ is not instant, it can be interrupted. also see #2570

In my opinion, waiting for the LS in general is not a good idea. If the language server hangs, formatting should be abandoned at the earliest opportunity. I don’t care about formatting 95% of the time, I just want to compile source code I’m editing, like, immediately. And if my language server can do some stuff, great, if it missed the opportunity, whatever.

@pppKin
Copy link
Contributor

pppKin commented May 26, 2022

Maybe we should have a timeout here? Like if the LS didn't respond in 200ms, write the file anyway.

@archseer
Copy link
Member

If the language server hangs, formatting should be abandoned at the earliest opportunity.

Agreed, I'd accept a patch that implements this. Might be easier to do once #2267 is merged

@hhhapz
Copy link

hhhapz commented Aug 31, 2023

To add to this, :cq should also never wait for the LS. It should instantly abort all actions, instead right now it hangs until the LS responds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

6 participants