Fork me on GitHub
#lsp
<
2024-06-14
>
karlis15:06:39

There's a small annoyance that I can't seem to fix in my Emacs setup. Whenever I open a new file for the first time I get a (wrong-type-argument hash-table-p nil) error & I'd like to silence it. After looking through debugger messages, it seems that this comes from lsp-diagnostics--update-path. More details in thread:

🎉 1
karlis15:06:14

Here's the debug log I get:

Debugger entered--Lisp error: (wrong-type-argument hash-table-p nil)
  gethash("newly-opened-file-path" nil)
  (and t (gethash path lsp-diagnostic-stats))
  (let* ((old-data (and t (gethash path lsp-diagnostic-stats))))
    (if old-data
        (let ((upper-bound 5) (counter 0))
          (while (< counter upper-bound)
            (let ((idx counter))
              (let* ((v old-data) (v idx))
                (aset v v (+ (aref v v) (aref new-stats idx))))) (setq counter (1+ counter))))
        (puthash path new-stats lsp-diagnostic-stats)))
  (let ((new-stats (copy-sequence new-stats))
        (path (lsp--fix-path-casing (directory-file-name path))))
    (let* ((old-data (and t (gethash path lsp-diagnostic-stats))))
      (if old-data
          (let ((upper-bound 5) (counter 0))
            (while (< counter upper-bound)
              (let ((idx counter))
                (let* ((v old-data) (v idx))
                  (aset v v (+ (aref v v) (aref new-stats idx))))) (setq counter (1+ counter))))
          (puthash path new-stats lsp-diagnostic-stats))))
  lsp-diagnostics--update-path("newly-opened-file-path" [0 0 1 0 1])
This is not specific to a certain language, the same error is thrown when both working in Rust & Clojure.

ericdallo12:06:51

never saw that, but I'd guess it's a bad elisp compilation, I never faced that with lsp-mode

Dimitar Uzunov15:07:40

I have the same noise

Dimitar Uzunov15:07:33

@U0CKR20TW I fixed my issue by unsetting this snippet that I had added to appease lsp-doctor:

(setq lsp-use-plists t)