-
Notifications
You must be signed in to change notification settings - Fork 25
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
completion-at-point
freezes emacs when REPL is busy
#123
Comments
Yes, this happens because Snail just uses the REPL thread. This problem should go away once #104 is fixed, which I'm starting to think needs to be a priority improvement. |
Thank you for looking into this! It seems like it works when no computation is involved, but it still hangs when there's computation. For instance, completion pops up when running the following:
But it hangs when running something like the following:
|
It probably happens because Snail uses Julia tasks internally to manage concurrency. I will look into converting to (native) threads. I didn't do this initially because I've run into problems with |
I see. Did that happen even with |
Oh wow. I didn't know about the I'll definitely look into converting Snail from tasks to threads, then. Not exactly sure how much work it'll take. Do you think I should also make Snail default to using the |
Happy to help! It seems like the |
I have threads kind of working on this branch: https://github.com/gcv/julia-snail/tree/experimental-threads It seems to avoid locking up, but it has another problem: task interruption stopped working (from #104 and a88755d). The trick I used to stop a task on the current thread ( I'm not sure what to do about it. Interrupting computation seems pretty important, but I don't see a robust way to implement it with Julia's current multithreading primitives. |
This could change too many things, but is it possible to have another Julia process for code completion? I'm not quite familiar with how VS Code's Julia extension works, but it seems like it uses SymbolServer.jl to obtain info about packages without loading them. |
A two-process solution is out of scope for Snail, but it should be possible to combine it with existing LSP tooling. You can disable Snail's non-REPL features as documented on the wiki (someone asked about this before). Then enable LanguageServer.jl. Emacs 29 comes with Eglot pre-installed, or you can try lsp-mode. For Snail, I think the right solution is to introduce strict separation between computational commands sent to Julia by Snail itself and those sent by the user. The former would go into the That requires changing the Snail wire protocol to support tagging commands as |
Thanks for the suggestion and explanation. I've been using task interruption and find it very useful, so I will look into the language server option for now. |
I often run functions that take a lot of time to evaluate (such as simulation and optimization) in Julia's REPL. When REPL is busy, emacs can hang up when
company-mode
automatically tries completion or if I manually invokecompletion-at-point
. I have to repeatedly pressC-g
to unfreeze emacs. I imagine this happens because completion relies on REPL? Is there a way to avoid this other than disablingcompany-mode
?The text was updated successfully, but these errors were encountered: