manateelazycat / lsp-bridge

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

lsp-bridge-peek-mode with errors #979

Closed gchape closed 3 months ago

gchape commented 3 months ago

The following error occurs when I try to activate peek-mode.

Lsp-Bridge-Peek mode enabled in current buffer
Error in post-command-hook (lsp-bridge-peek--show): (wrong-type-argument integerp nil)

Error causes the cursor to freeze, and it accumulates with each movement: Wrong type argument: integerp, nil [10 times]

manateelazycat commented 3 months ago

M-x toggle-debug-on-error

And paste *backtrace* content to me, thanks!

gchape commented 3 months ago

Debugger entered--Lisp error: (wrong-type-argument integerp nil) nth(nil nil) (nth 3 (nth lsp-bridge-peek-selected-symbol lsp-bridge-peek-symbol-tree))

 (if (nth 3 (nth lsp-bridge-peek-selected-symbol lsp-bridge-peek-symbol-tree))
    (if (nth 5 (nth (nth 3 (nth lsp-bridge-peek-selected-symbol lsp-bridge-peek-symbol-tree)) lsp-bridge-peek-symbol-tree))
        (progn
          (setq already-changed nil)
          (if (or (< (+ num (nth 5 (nth (nth 3 (nth lsp-bridge-peek-selected-symbol lsp-bridge-peek-symbol-tree)) lsp-bridge-peek-symbol-tree))) 0)
                  (> (+ num (nth 5 (nth (nth 3 (nth lsp-bridge-peek-selected-symbol lsp-bridge-peek-symbol-tree)) lsp-bridge-peek-symbol-tree)))
                     (1- (length (nth 4 (nth (nth 3 (nth lsp-bridge-peek-selected-symbol lsp-bridge-peek-symbol-tree)) lsp-bridge-peek-symbol-tree))))))
              nil
            (let* ((c (nthcdr 5 (nth (nth 3 (nth lsp-bridge-peek-selected-symbol lsp-bridge-peek-symbol-tree)) lsp-bridge-peek-symbol-tree))))
              (setcar c (+ num (nth 5 (nth (nth 3 (nth lsp-bridge-peek-selected-symbol lsp-bridge-peek-symbol-tree)) lsp-bridge-peek-symbol-tree)))))
            (setq already-changed t))
      (if already-changed
          nil
        (if (< (+ num (nth 5 (nth (nth 3 (nth lsp-bridge-peek-selected-symbol lsp-bridge-peek-symbol-tree)) lsp-bridge-peek-symbol-tree))) 0)
            (progn
              (let* ((c (nthcdr 5 (nth (nth 3 (nth lsp-bridge-peek-selected-symbol lsp-bridge-peek-symbol-tree)) lsp-bridge-peek-symbol-tree))))
                (setcar c (1- (length (nth 4 (nth (nth 3 (nth lsp-bridge-peek-selected-symbol lsp-bridge-peek-symbol-tree)) lsp-bridge-peek-symbol-tree)))))))
          (setq already-changed t))))
    (if already-changed
        nil
      (if (> (+ num (nth 5 (nth (nth 3 (nth lsp-bridge-peek-selected-symbol lsp-bridge-peek-symbol-tree)) lsp-bridge-peek-symbol-tree)))
             (1- (length (nth 4 (nth (nth 3 (nth lsp-bridge-peek-selected-symbol lsp-bridge-peek-symbol-tree)) lsp-bridge-peek-symbol-tree)))))
          (let* ((c (nthcdr 5 (nth (nth 3 (nth lsp-bridge-peek-selected-symbol lsp-bridge-peek-symbol-tree)) lsp-bridge-peek-symbol-tree))))
            (setcar c 0))))
    (setq lsp-bridge-peek-selected-symbol
          (nth (nth 5 (nth (nth 3 (nth lsp-bridge-peek-selected-symbol lsp-bridge-peek-symbol-tree)) lsp-bridge-peek-symbol-tree))
               (nth 4 (nth (nth 3 (nth lsp-bridge-peek-selected-symbol lsp-bridge-peek-symbol-tree)) lsp-bridge-peek-symbol-tree))))
    (setq lsp-bridge-peek--content-update t))

lsp-bridge-peek-tree-change-branch(-1) lsp-bridge-peek-tree-next-branch() funcall-interactively(lsp-bridge-peek-tree-next-branch) command-execute(lsp-bridge-peek-tree-next-branch)

AllTheLife commented 3 months ago

I guess this error is caused by lsp-bridge-peek-define--return receiving too many arguments

I pushed https://github.com/manateelazycat/lsp-bridge/pull/982 to try to fix this, and it worked on my computer. I hope it solves your problem.

Have fun :)