Akuli / porcupine

A decent editor written in tkinter
MIT License
162 stars 49 forks source link

langserver gui #1071

Open Akuli opened 2 years ago

Akuli commented 2 years ago

Porcupine supports langservers pretty well (see wiki page). That's how hovering and autocompletions work.

Currently debugging langserver problems isn't great:

Ideally there would be:

@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 :)

Akuli commented 2 years ago

For the error popup, there's also #763

rdbende commented 2 years ago

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

Akuli commented 2 years ago

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.

benjamin-kirkbride commented 1 year ago

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.

Akuli commented 1 year ago

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.

Moosems commented 1 year ago

I still don't get how the langservers work :D.

Akuli commented 1 year ago

Ping me on irc some time and I'll explain :)

Moosems commented 1 year ago

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?

Akuli commented 1 year ago

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.