manateelazycat / lsp-bridge

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

LSP signature help does not display for most symbols, only when point is inside function parameters [Typescript] #911

Closed ovistoica closed 2 months ago

ovistoica commented 2 months ago

Hello,

Initially I thought the function to display signature was wrong but now I see that the results from the LSP server aren't coming.

Example:

const [level, setLevel] = useState(initialLevel)
const [level┃, setLevel] = useState(initialLevel) //=> signature should show sth like `level: string`, shows nothing
const [level, setLevel┃] = useState(initialLevel) //=> signature should show sth like `setLevel: Dispatch<SetStateAction<string>`, shows nothing
const [level, setLevel] = useState(┃initialLevel) //=> signature shows correct information: initialState: "site-group" | "ac-node" etc...

I enabled epc-debug and indeed a response comes from the server only in the 3rd scenario described. The first 2 scenarios issue a signature_help request but the server answers with empty.

1st & second:

>> SEND : ["00009d(call 1582 signature_help (\"/Users/ovistoica/workspace/3e/SQ2020-Frontend/packages/views/src/hooks/useViewParameterSelection.tsx\" (:line 213 :character 9)))
"]

INCOMING: [lsp-bridge-epc con 4] ["000011(return 1582 ())
"]

<< RECV [(return 1582 nil)]

3rd example (function parameter)


>> SEND : ["00009e(call 1585 signature_help (\"/Users/ovistoica/workspace/3e/SQ2020-Frontend/packages/views/src/hooks/useViewParameterSelection.tsx\" (:line 213 :character 37)))
"]

INCOMING: [lsp-bridge-epc con 3] ["0001b8(call 165 eval-in-emacs (\"(lsp-bridge-signature-help--update '(\\\"initialState: \\\\\\\"site-group\\\\\\\" | \\\\\\\"site\\\\\\\" | \\\\\\\"ac-node\\\\\\\" | \\\\\\\"ac-input\\\\\\\" | \\\\\\\"ac-phase\\\\\\\" | \\\\\\\"connection\\\\\\\" | \\\\\\\"dc-input\\\\\\\" | \\\\\\\"dc-node\\\\\\\" | \\\\\\\"inverter\\\\\\\" | \\\\\\\"inverter-device\\\\\\\" | \\\\\\\"logger\\\\\\\" | \\\\\\\"mppt\\\\\\\" | \\\\\\\"module-group\\\\\\\" | \\\\\\\"power-unit\\\\\\\" | ... 4 more ... | (() => \\\\\\\"site-group\\\\\\\" | ... 16 more ... | \\\\\\\"turbine\\\\\\\")\\\") '0)\"))
"]

Normally the LSP server should return for many more symbols. Example for same code from VSCode image

Any idea what could be wrong?

Here's my current lsp-bridge 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 'message
        lsp-bridge-epc-debug t)
  :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))))
ovistoica commented 2 months ago

Nevermind, what I was doing in VSCode was requesting documentation for thing at point which I can directly replicate with lsp-bridge

image

I'm closing this and I will play around more with ideally showing the type in the signature when point is over a symbol