emacs-lsp / lsp-treemacs

lsp-mode :heart: treemacs
GNU General Public License v3.0
393 stars 46 forks source link

Error processing message (void-function icon). #157

Open msateri opened 1 year ago

msateri commented 1 year ago

I get the error message "Error processing message (void-function icon)" when attempting to use lsp-treemacs functions. I have used it before, but I upgraded (to 20230504.516 from melpa), and now it doesn't seem to work for me.

msateri commented 1 year ago

Additional info: I moved the lsp-treemacs-20230504.516 directory out of my elpa dir and went back to my previous version (20221001.1958), and now it works again. So there is something with the new version.

yyoncho commented 1 year ago

Can you check if you are reproducing it when using M-x lsp-start-plain?

msateri commented 1 year ago

Thanks for the very quick response! M-x lsp-start-plain first generates another error ("Debugger entered--Lisp error: (void-function clang-format+-mode)"), but when I manage to open a file, lsp-treemacs works.

yyoncho commented 1 year ago

Then try to delete the elpa dir + restart emacs + reinstalling the packages.

msateri commented 1 year ago

Alright, I'll try it on Monday. I've left the office for the day now.

msateri commented 1 year ago

I tried to delete my elpa directory, but I still get the same error.

msateri commented 1 year ago

Is there anything else that I can test to figure out what is causing this?

yyoncho commented 1 year ago

did you restart before reinstalling? Can you give me the callstack for the error?

msateri commented 1 year ago

Yes. I killed emacs, removed the elpa directory and let it reinstall all the packages from scratch when starting up.

Debugger entered--Lisp error: (void-function icon) icon(class) lsp-treemacs--generic-icon((:label #("A class" 1 7 (face lsp-signature-face)) :key "A" :icon class :kind 5 :location #<hash-table equal 2/2 0xdd10cd> :children ((:label #("foo bool (int, std::string, double)" 3 35 (face lsp-signature-face)) :key "foo" :icon method :kind 6 :location #<hash-table equal 2/2 0x409aa79> :ret-action lsp-treemacs-symbols-goto-symbol)) :ret-action lsp-treemacs-symbols-goto-symbol) nil)

f(compiled-function (&optional btn item) #<bytecode 0x1471f31>)(#<marker at 1 in LSP Symbols List> (:label #("A class" 1 7 (face lsp-signature-face)) :key "A" :icon class :kind 5 :location #<hash-table equal 2/2 0xdd10cd> :children ((:label #("foo bool (int, std::string, double)" 3 35 (face lsp-signature-face)) :key "foo" :icon method :kind 6 :location #<hash-table equal 2/2 0x409aa79> :ret-action lsp-treemacs-symbols-goto-symbol)) :ret-action lsp-treemacs-symbols-goto-symbol))

treemacs--do-expand-variadic-parent(#<marker at 1 in LSP Symbols List> #s(treemacs-extension :name lsp-treemacs-generic-root :closed-state #f(compiled-function () #<bytecode 0x14d65a9>) :open-state #f(compiled-function () #<bytecode 0x14d65b5>) :closed-icon #f(compiled-function (&optional btn item) #<bytecode 0x14d65c1>) :open-icon #f(compiled-function (&optional btn item) #<bytecode 0x147ce51>) :children #f(compiled-function (&optional btn item) #<bytecode 0x147ce5d>) :key #f(compiled-function (&optional btn item) #<bytecode 0x147ce69>) :label #f(compiled-function (&optional btn item) #<bytecode 0x147ce75>) :more-properties #f(compiled-function (&optional btn item) #<bytecode 0x147ce81>) :child-type #f(compiled-function () #<bytecode 0x147ce8d>) :variadic? t :async? nil :entry-point? t) 999) treemacs--variadic-extension-entry-render(#s(treemacs-extension :name lsp-treemacs-generic-root :closed-state #f(compiled-function () #<bytecode 0x14d65a9>) :open-state #f(compiled-function () #<bytecode 0x14d65b5>) :closed-icon #f(compiled-function (&optional btn item) #<bytecode 0x14d65c1>) :open-icon #f(compiled-function (&optional btn item) #<bytecode 0x147ce51>) :children #f(compiled-function (&optional btn item) #<bytecode 0x147ce5d>) :key #f(compiled-function (&optional btn item) #<bytecode 0x147ce69>) :label #f(compiled-function (&optional btn item) #<bytecode 0x147ce75>) :more-properties #f(compiled-function (&optional btn item) #<bytecode 0x147ce81>) :child-type #f(compiled-function () #<bytecode 0x147ce8d>) :variadic? t :async? nil :entry-point? t) 999) treemacs--render-extension(#s(treemacs-extension :name lsp-treemacs-generic-root :closed-state #f(compiled-function () #<bytecode 0x14d65a9>) :open-state #f(compiled-function () #<bytecode 0x14d65b5>) :closed-icon #f(compiled-function (&optional btn item) #<bytecode 0x14d65c1>) :open-icon #f(compiled-function (&optional btn item) #<bytecode 0x147ce51>) :children #f(compiled-function (&optional btn item) #<bytecode 0x147ce5d>) :key #f(compiled-function (&optional btn item) #<bytecode 0x147ce69>) :label #f(compiled-function (&optional btn item) #<bytecode 0x147ce75>) :more-properties #f(compiled-function (&optional btn item) #<bytecode 0x147ce81>) :child-type #f(compiled-function () #<bytecode 0x147ce8d>) :variadic? t :async? nil :entry-point? t) 999) lsp-treemacs-render(((:label #("A class" 1 7 (face lsp-signature-face)) :key "A" :icon class :kind 5 :location #<hash-table equal 2/2 0xdd10cd> :children ((:label #("foo bool (int, std::string, double)" 3 35 (face lsp-signature-face)) :key "foo" :icon method :kind 6 :location #<hash-table equal 2/2 0x409aa79> :ret-action lsp-treemacs-symbols-goto-symbol)) :ret-action lsp-treemacs-symbols-goto-symbol) (:label #("A::foo bool (const int, std::string, const double)" 6 50 (face lsp-signature-face)) :key "A::foo" :icon method :kind 6 :location #<hash-table equal 2/2 0x1a1c855> :ret-action lsp-treemacs-symbols-goto-symbol) (:label #("E enum" 1 6 (face lsp-signature-face)) :key "E" :icon enumerator :kind 10 :location #<hash-table equal 2/2 0x16c1e65> :children ((:label #("E_1 E" 3 5 (face lsp-signature-face)) :key "E_1" :icon enumitem :kind 22 :location #<hash-table equal 2/2 0x19d1735> :ret-action lsp-treemacs-symbols-goto-symbol) (:label #("E_2 E" 3 5 (face lsp-signature-face)) :key "E_2" :icon enumitem :kind 22 :location #<hash-table equal 2/2 0x194e11d> :ret-action lsp-treemacs-symbols-goto-symbol)) :ret-action lsp-treemacs-symbols-goto-symbol) (:label #("E_struct struct" 8 15 (face lsp-signature-face)) :key "E_struct" :icon structure :kind 23 :location #<hash-table equal 2/2 0x3fff295> :children ((:label #("a int" 1 5 (face lsp-signature-face)) :key "a" :icon field :kind 8 :location #<hash-table equal 2/2 0x40b0cb1> :ret-action lsp-treemacs-symbols-goto-symbol) (:label #("e enum E" 1 8 (face lsp-signature-face)) :key "e" :icon field :kind 8 :location #<hash-table equal 2/2 0x18864a9> :ret-action lsp-treemacs-symbols-goto-symbol)) :ret-action lsp-treemacs-symbols-goto-symbol) (:label #("main int (int, char *)" 4 23 (face lsp-signature-face)) :key "main" :icon method :kind 12 :location #<hash-table equal 2/2 0x15ebcdd> :ret-action lsp-treemacs-symbols-goto-symbol)) " LSP Symbols " t "LSP Symbols List*") lsp-treemacs--update-symbols()

f(compiled-function (document-symbols) #<bytecode 0x14c8701>)((#<hash-table equal 6/6 0x11705a5> #<hash-table equal 5/5 0xdd10ed> #<hash-table equal 6/6 0x1a1c875> #<hash-table equal 6/6 0x16c1e85> #<hash-table equal 5/5 0x3fff2b5>))

apply(#f(compiled-function (document-symbols) #<bytecode 0x14c8701>) (#<hash-table equal 6/6 0x11705a5> #<hash-table equal 5/5 0xdd10ed> #<hash-table equal 6/6 0x1a1c875> #<hash-table equal 6/6 0x16c1e85> #<hash-table equal 5/5 0x3fff2b5>))

f(compiled-function (&rest args) #<bytecode 0x176b2cd>)((#<hash-table equal 6/6 0x11705a5> #<hash-table equal 5/5 0xdd10ed> #<hash-table equal 6/6 0x1a1c875> #<hash-table equal 6/6 0x16c1e85> #<hash-table equal 5/5 0x3fff2b5>))

f(compiled-function (result) #<bytecode 0x197b269>)([#<hash-table equal 6/6 0x11705a5> #<hash-table equal 5/5 0xdd10ed> #<hash-table equal 6/6 0x1a1c875> #<hash-table equal 6/6 0x16c1e85> #<hash-table equal 5/5 0x3fff2b5>])

f(compiled-function (result) #<bytecode 0x16aead9>)([#<hash-table equal 6/6 0x11705a5> #<hash-table equal 5/5 0xdd10ed> #<hash-table equal 6/6 0x1a1c875> #<hash-table equal 6/6 0x16c1e85> #<hash-table equal 5/5 0x3fff2b5>])

lsp--parser-on-message(#<hash-table equal 3/3 0x1170585> #s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 29/29 0x131ac45> :registered-server-capabilities nil :root "/home/msateri/slask" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn workspace) #<bytecode 0x1542d89>) :test\? #f(compiled-function () #<bytecode 0x1542da1>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 0/65 0x1542dc5> :request-handlers #<hash-table equal 0/65 0x15424b1> :response-handlers #<hash-table eql 0/65 0x1542fad> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x15432a5> :action-handlers #<hash-table equal 0/65 0x154357d> :major-modes nil :activation-fn #f(compiled-function (file-name mode) #<bytecode 0x1542db9>) :priority -1 :server-id clangd :multi-root nil :initialization-options nil :semantic-tokens-faces-overrides nil :custom-capabilities nil :library-folders-fn #f(compiled-function (workspace) #<bytecode 0x1542cfd>) :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil :path->uri-fn nil :uri->path-fn nil :environment-fn nil :after-open-fn nil :async-request-handlers #<hash-table equal 0/65 0x154359d> :download-server-fn #f(compiled-function (client callback error-callback update\?) #<bytecode 0x1542d11>) :download-in-progress? nil :buffers nil :synchronize-sections nil) :host-root nil :proc #<process clangd<2>> :cmd-proc #<process clangd<2>> :buffers (#) :semantic-tokens-faces [lsp-face-semhl-variable lsp-face-semhl-variable lsp-face-semhl-parameter lsp-face-semhl-function lsp-face-semhl-method lsp-face-semhl-function lsp-face-semhl-property lsp-face-semhl-variable lsp-face-semhl-class lsp-face-semhl-interface lsp-face-semhl-enum lsp-face-semhl-constant lsp-face-semhl-type lsp-face-semhl-type nil lsp-face-semhl-namespace lsp-face-semhl-type-parameter lsp-face-semhl-interface lsp-face-semhl-type lsp-face-semhl-macro lsp-face-semhl-comment] :semantic-tokens-modifier-faces [lsp-face-semhl-interface lsp-face-semhl-deprecated nil lsp-face-semhl-constant lsp-face-semhl-static lsp-face-semhl-keyword nil nil lsp-face-semhl-default-library nil nil nil nil nil] :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/65 0x1b14f05> :watches #<hash-table equal 0/65 0x1b151dd> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 0/65 0x12fc179> :work-done-tokens #<hash-table equal 0/65 0x116d549>))

f(compiled-function (msg) #<bytecode 0x11cd569>)(#<hash-table equal 3/3 0x1170585>)

mapc(#f(compiled-function (msg) #<bytecode 0x11cd569>) (#<hash-table equal 3/3 0x1170585>))

f(compiled-function (proc input) #<bytecode 0x12fc325>)(#<process clangd<2>> "Content-Length: 2174\15\n\15\n{\"id\":421260,\"jsonrpc\":\"2....")

yyoncho commented 1 year ago

If you change the function like that it will most likely work:

(defun lsp-treemacs--generic-icon (item expanded?)
  "Get the symbol for the the kind."
  (concat
   (if (or (plist-get item :children)
           (plist-get item :children-async))
       (if expanded?  "▾ " "▸ ")
     "  ")
   (or (plist-get item :icon-literal)
       (-if-let ((icon (plist-get item :icon)))
           (treemacs-get-icon-value
            icon
            nil
            lsp-treemacs-theme)
         "   "))))

I will try to fix it later today.

msateri commented 1 year ago

I get a warning: lsp-treemacs-generic.el:104:40:Warning: attempt to let-bind constant ‘:icon’

But it works. Thank you so much for your help, this is world class support! :-)