manateelazycat / lsp-bridge

A blazingly fast LSP client for Emacs
GNU General Public License v3.0
1.36k stars 197 forks source link

Using eldoc & xref for finding references & showing function signature #910

Closed ovistoica closed 2 months ago

ovistoica commented 2 months ago

Hey, thanks for this excellent package. In terms of performance, it's miles ahead of eglot and lsp-mode.

Is there a way to use eldoc for showing the function signature & xref for showing references?

I tried to search the repository but couldn't find anything. Some old PRs were merged (xref support here: https://github.com/manateelazycat/lsp-bridge/pull/114), but I guess in the meantime, they were removed?

manateelazycat commented 2 months ago

xref and eldoc are synchronous. These two libraries do not support asynchronous calls. If lsp-bridge uses xref and eldoc, lsp-bridge will be stuck due to these two libraries. We have experimented before, and it greatly affects performance. So I finally deleted it。

ovistoica commented 2 months ago

I see. Is there any way that you know to show the function signature in the minibuffer (under modeling) when cursor is over for example the function name?

manateelazycat commented 2 months ago

lsp-bridge-signature-show-function

ovistoica commented 2 months ago

Hey @manateelazycat , sorry to be persistent, I know you are a busy man

I tried setting lsp-bridge-signature-show-function as the docs say but it doesn't show the signature

My config:

(use-package lsp-bridge
  :after (evil)
  :defines
  lsp-bridge-show-documentation
  lsp-bridge-signature-show-with-frame
  :straight '(lsp-bridge :type git :host github :repo "manateelazycat/lsp-bridge"
                         :files (:defaults "*.el" "*.py" "acm" "core" "langserver" "multiserver" "resources")
                         :build (:not compile))
  :init
  (global-lsp-bridge-mode)
  :config
  (setq lsp-bridge-enable-hover-diagnostic t
        acm-enable-doc t
        acm-enable-doc-markdown-render t
        lsp-bridge-enable-inlay-hint t
        lsp-bridge-signature-show-function 'lsp-bridge-signature-show-with-frame)
  :bind
  (:map lsp-bridge-mode-map
        ("C-c c a" . lsp-bridge-code-action)
        ("C-c c r" . lsp-bridge-rename)
        ("C-c c f" . lsp-bridge-code-format))
  :os/bind ((:map (lsp-bridge-mode-map . normal)
                  ("gr" . lsp-bridge-find-references)
                  ("gd" . lsp-bridge-find-def)
                  ("K" . lsp-bridge-show-documentation))))

And when I inspect value for lsp-bridge-signature-show-function it's defined correctly but nothing shows in the minibuffer.

Can you guide me in the correct direction here?

ovistoica commented 2 months ago

Actually, sorry, the correct function to display signature in minibuffer, is message which is the default, however, when the point is over a symbol or function, the signature is not displayed in minibuffer even when lsp-bridge-signature-show-function is message

I see lsp-bridge does the correct request whenever I move cursor to a symbol

--- [09:20:06.562594] Send textDocument/signatureHelp request (25212) to 'typescript' for project SQ2020-Frontend

--- [09:20:06.563739] Recv textDocument/signatureHelp response (25212) from 'typescript' for project SQ2020-Frontend

--- [09:20:08.847370] Send textDocument/signatureHelp request (40425) to 'typescript' for project SQ2020-Frontend

--- [09:20:08.848998] Recv textDocument/signatureHelp response (40425) from 'typescript' for project SQ2020-Frontend

--- [09:20:12.129343] Send textDocument/signatureHelp request (34733) to 'typescript' for project SQ2020-Frontend

--- [09:20:12.131022] Recv textDocument/signatureHelp response (34733) from 'typescript' for project SQ2020-Frontend

--- [09:20:29.864978] Send textDocument/signatureHelp request (56025) to 'typescript' for project SQ2020-Frontend

--- [09:20:29.868687] Recv textDocument/signatureHelp response (56025) from 'typescript' for project SQ2020-Frontend

Any ideas?

ovistoica commented 2 months ago

Continued the discussion in https://github.com/manateelazycat/lsp-bridge/issues/911 to avoid multiple topics here

manateelazycat commented 2 months ago

If lsp-bridge calls elisp functions to Emacs, please use emacs -Q and load only the lsp-bridge configuration for testing. I think it is your Emacs configuration that is affecting it, causing you to be unable to display the results returned by lsp-bridge in the minibuffer. information