Open Akuli opened 2 years ago
For the error popup, there's also #763
Yes, I'd gladly work on this!
Could be e.g. a popup or something in the status bar.
I don't like popups, they're annoying, i'd stick with the statusbar (if yes: #956 )
Some kind of view that shows all currently running and crashed langservers. For each langserver, it should show
So imo the statusbar could show the langserver's state when it's working, and then show the error and a restart button when crashed. The only problem is that the statusbar can't hold as much content as you've listed here
When the langserver is working, you probably don't really care about it and you don't want it to take up space in the status bar. If we still need to be able to see its PID, log output, launch command etc easily, we can add something in the menubar at top.
When the langserver has crashed, the status bar could display "Langserver crashed. Click here
for details", where here
is a link (see aboutdialog plugin). The status bar can already display warnings, and that happens e.g. if a file is changed on disk while you have unsaved changes in Porcupine. The "details" view would open as a separate window, similar to plugin manager and settings, and it can contain as much info as we like.
To get started with this, the statusbar API could be super simple: a function that takes no arguments, adds a ttk.Frame
somewhere into the status bar, and returns the frame.
VSCode uses toasts (AKA popups) at the bottom right corner for things like this, as well as errors when extensions fail or are missing dependencies, etc.
It is annoying, but also this is something that really only is done in dire times, so I actually think the "annoyance" is justified. If the langserver crashes, there should be something in the users face. They aren't going to go hunting for tiny text in the statusbar. Also, toasts let you take actions; they can have buttons, like a "Restart LangServer" for instance, or "Install Mypy" or whatever.
I think it would be enough to restart the langserver automatically, maybe with exponential backoff so that you won't get insane CPU usage when it gets stuck in a restart loop. So wait 1 second to restart, if it crashes again soon then wait 2 seconds, if it crashes again then 4 seconds, then 8 seconds, and so on.
I still don't get how the langservers work :D.
Ping me on irc some time and I'll explain :)
I didn't see you online today. I probably won't be on much this week though. Would you be able to email me at moosems.j@gmail.com?
I won't have much time during this week. If I'm going to write an explanation that is nice enough for email, then it is also nice enough for documentation in the Porcupine repo and belongs there instead of a private email.
Porcupine supports langservers pretty well (see wiki page). That's how hovering and autocompletions work.
Currently debugging langserver problems isn't great:
If a langserver crashes unexpectedly, it isn't restarted automatically. To restart, you have to either restart Porcupine or close and reopen all files that used the langserver (e.g. all Python files of your currently opened project). A warning is logged though:
But Windows users don't have a terminal where they just see the logging output, and log files are noisy and hard to find. Also, without looking at
filetypes.toml
, you can't even know what command Porcupine ran. Not ideal.stream_to_log()
in porcupine/plugins/langserver.py).Ideally there would be:
ps aux | grep pyls
for the Python language server) and send Ctrl+C to it (kill -2 12345
where12345
is the pid).@rdbende Interested in working on some of this? You obviously don't have to implement all of it, just part restarting crashed langservers would be awesome :)