techee / geany-lsp

LSP plugin for the Geany editor
GNU General Public License v2.0
11 stars 1 forks source link

Starting servers inconsistent #30

Closed elextr closed 1 week ago

elextr commented 9 months ago

If I start Geany with a Python file as the current document pylsp doesn't start, but if I switch from the python file to something else and back pylsp is started.

If I start Geany with a C file as current document clangd does start immediately.

techee commented 8 months ago

I think it rather happens when you start Geany (or open a project) with the first document's tab selected, isn't it the case?

I try to avoid unnecessary server starting so I try not to start servers for all filetypes of open files but only for the file that is in the current tab. If I started servers in "document-open" signal, I'd get them started all because the signal is delivered for all open documents during session opening. I used "document-activate" which is typically invoked after loading a session but in this case it isn't fired - I'm not sure if it is an intended behavior or a bug in Geany, but it also causes https://github.com/geany/geany/issues/3684.

If this signal cannot be used as an indicator of the end of Geany session loading, I'll probably have to introduce a special signal for that.

techee commented 8 months ago

I added "session-opening" signal for the purpose of detection of session loading in

https://github.com/geany/geany/pull/3707

and hopefully this issue is fixed now. @elextr can you confirm this?

elextr commented 8 months ago

Seems to work for me, having a signal for that seems to be the way to go.

elextr commented 8 months ago

Although could this do the job?

Right click "goto definition" here and its even commented :-)

techee commented 8 months ago

Although could this do the job?

The signal in https://github.com/geany/geany/pull/3707 is implemented using opening_session_files. It's just that opening_session_files isn't public to plugins and also there's no event that would notify you when this value gets larger than 0 or drops back to 0 which the signal does.

elextr commented 8 months ago

Ok, maybe add the explanation to the PR that its edge triggered from the flag to provide notification when it changes and that it avoids making geany_status visible to plugins.

techee commented 1 week ago

I believe this is fixed so closing. Feel free to reopen if you still experience the problem.