Skip to content

LSP call stream emptiness check is incorrect (?) #5413

Closed
@jakubDoka

Description

@jakubDoka

Summary

When testing lsp for my language, is noticed that spinner stays frozen and no diagnostics show up on screen until I move cursor which is different from what rust extension does. I thought I am missing something, so i looked into source code.

I found this:

                self.handle_language_server_message(call, id).await;
                // limit render calls for fast language server messages
                let last = self.editor.language_servers.incoming.is_empty();

                if last || self.last_render.elapsed() > LSP_DEADLINE {
                    self.render().await;
                    self.last_render = Instant::now();
                }

is_empty will return true if there are no streams present.
Since lsp_servers holds the stream until client with UnboundedSender is dropped, last will only be true when there is no server active.

LSP_DEADLINE is 16ms but My language server can update reliably faster. By adding thread::sleep to server code i managed to fix it, though It was not very easy to figure out.

My expectations were that upon progress end notification, editor would clear the spinners but it, only stops them (possible fix).

Reproduction Steps

No response

Helix log

No response

Platform

Linux

Terminal Emulator

Ubuntu 20.04.5 LTS

Helix Version

helix 22.12 (6c95411)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-language-serverArea: Language server clientC-bugCategory: This is a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions