emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.72k stars 861 forks source link

wrong type argument in lsp-file-process-event for rust-analyzer #4402

Closed dwuggh closed 3 months ago

dwuggh commented 3 months ago

Thank you for the bug report

Bug description

in function lsp--file-process-event at lsp-mode.el:3763, the glob-pattern in (lsp-glob-to-regexps glob-pattern) becomes a hash-table for rust-analyzer.

clangd doesn't has such problem.

Steps to reproduce

open a cargo project and start rust-analyzer, then edit and save.

Expected behavior

no such error message shown

Which Language Server did you use?

rust-analyzer

OS

Linux

Error callstack

Debugger entered--Lisp error: (wrong-type-argument stringp #<hash-table equal 2/2 0x1234265e5749 ...>)
  string-trim-right(#<hash-table equal 2/2 0x1234265e5749 ...> nil)
  string-trim(#<hash-table equal 2/2 0x1234265e5749 ...>)
  lsp-glob-to-regexps(#<hash-table equal 2/2 0x1234265e5749 ...>)
  #f(compiled-function (input0) #<bytecode 0x1b0b038eb0ee0160>)(#<hash-table equal 1/1 0x1234265e576c ...>)
  #f(compiled-function (elt) #<bytecode 0xcd9778b6ce3312d>)(#<hash-table equal 1/1 0x1234265e576c ...>)
  mapc(#f(compiled-function (elt) #<bytecode 0xcd9778b6ce3312d>) [#<hash-table equal 1/1 0x1234265e576c ...> #<hash-table equal 1/1 0x1234265e575f ...> #<hash-table equal 1/1 0x1234265e5722 ...> #<hash-table equal 1/1 0x1234265e5705 ...> #<hash-table equal 1/1 0x1234265e5118 ...> #<hash-table equal 1/1 0x1234265e5153 ...> #<hash-table equal 1/1 0x1234265e517e ...> #<hash-table equal 1/1 0x1234265e51a9 ...> #<hash-table equal 1/1 0x1234265fc618 ...> #<hash-table equal 1/1 0x1234265fc653 ...> #<hash-table equal 1/1 0x1234265fc67e ...> #<hash-table equal 1/1 0x1234265fc6a9 ...> #<hash-table equal 1/1 0x1234265fc684 ...> #<hash-table equal 1/1 0x1234265fc6e7 ...> #<hash-table equal 1/1 0x1234265fc6ca ...> #<hash-table equal 1/1 0x1234265e7fee ...>])
  seq-do(#f(compiled-function (elt) #<bytecode 0xcd9778b6ce3312d>) [#<hash-table equal 1/1 0x1234265e576c ...> #<hash-table equal 1/1 0x1234265e575f ...> #<hash-table equal 1/1 0x1234265e5722 ...> #<hash-table equal 1/1 0x1234265e5705 ...> #<hash-table equal 1/1 0x1234265e5118 ...> #<hash-table equal 1/1 0x1234265e5153 ...> #<hash-table equal 1/1 0x1234265e517e ...> #<hash-table equal 1/1 0x1234265e51a9 ...> #<hash-table equal 1/1 0x1234265fc618 ...> #<hash-table equal 1/1 0x1234265fc653 ...> #<hash-table equal 1/1 0x1234265fc67e ...> #<hash-table equal 1/1 0x1234265fc6a9 ...> #<hash-table equal 1/1 0x1234265fc684 ...> #<hash-table equal 1/1 0x1234265fc6e7 ...> #<hash-table equal 1/1 0x1234265fc6ca ...> #<hash-table equal 1/1 0x1234265e7fee ...>])
  seq-find(#f(compiled-function (input0) #<bytecode 0x1b0b038eb0ee0160>) [#<hash-table equal 1/1 0x1234265e576c ...> #<hash-table equal 1/1 0x1234265e575f ...> #<hash-table equal 1/1 0x1234265e5722 ...> #<hash-table equal 1/1 0x1234265e5705 ...> #<hash-table equal 1/1 0x1234265e5118 ...> #<hash-table equal 1/1 0x1234265e5153 ...> #<hash-table equal 1/1 0x1234265e517e ...> #<hash-table equal 1/1 0x1234265e51a9 ...> #<hash-table equal 1/1 0x1234265fc618 ...> #<hash-table equal 1/1 0x1234265fc653 ...> #<hash-table equal 1/1 0x1234265fc67e ...> #<hash-table equal 1/1 0x1234265fc6a9 ...> #<hash-table equal 1/1 0x1234265fc684 ...> #<hash-table equal 1/1 0x1234265fc6e7 ...> #<hash-table equal 1/1 0x1234265fc6ca ...> #<hash-table equal 1/1 0x1234265e7fee ...>])
  #f(compiled-function (capability) #<bytecode -0x72a22d35fd9ebb4>)(#s(lsp--registered-capability :id "workspace/didChangeWatchedFiles" :method "workspace/didChangeWatchedFiles" :options #<hash-table equal 1/1 0x1234265e578d ...>))
  -any?(#f(compiled-function (capability) #<bytecode -0x72a22d35fd9ebb4>) (#s(lsp--registered-capability :id "workspace/didChangeWatchedFiles" :method "workspace/didChangeWatchedFiles" :options #<hash-table equal 1/1 0x1234265e578d ...>) #s(lsp--registered-capability :id "workspace/didChangeWatchedFiles" :method "workspace/didChangeWatchedFiles" :options #<hash-table equal 1/1 0x12342a28f0a5 ...>)))
  #f(compiled-function (workspace) #<bytecode 0x1b8764cb931da350>)(#s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 26/26 0x12342a216891 ...> :registered-server-capabilities (#s(lsp--registered-capability :id "workspace/didChangeWatchedFiles" :method "workspace/didChangeWatchedFiles" :options #<hash-table equal 1/1 0x1234265e578d ...>) #s(lsp--registered-capability :id "workspace/didChangeWatchedFiles" :method "workspace/didChangeWatchedFiles" :options #<hash-table equal 1/1 0x12342a28f0a5 ...>)) :root "/home/dwuggh/Projects/egui2" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn workspace) #<bytecode -0x19059c317927cab0>) :test? #f(compiled-function () #<bytecode 0xec607c9fd7daeff>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/6 0x12342ba44ce3 ...> :request-handlers #<hash-table equal 0/0 0x12342ba454a3 ...> :response-handlers #<hash-table eql 0/6 0x12342ba454b5 ...> :prefix-function nil :uri-handlers #<hash-table equal 0/0 0x12342ba454de ...> :action-handlers #<hash-table equal 4/6 0x12342ba44cf0 ...> :major-modes nil :activation-fn #f(compiled-function (file-name mode) #<bytecode -0x65332d5f4c579cf>) :priority 1 :server-id rust-analyzer :multi-root nil :initialization-options lsp-rust-analyzer--make-init-options :semantic-tokens-faces-overrides (:discard-default-modifiers t :modifiers (("documentation" . lsp-rust-analyzer-documentation-modifier-face) ("declaration" . lsp-rust-analyzer-declaration-modifier-face) ("definition" . lsp-rust-analyzer-definition-modifier-face) ("static" . lsp-rust-analyzer-static-modifier-face) ("abstract" . lsp-rust-analyzer-abstract-modifier-face) ("deprecated" . lsp-rust-analyzer-deprecated-modifier-face) ("readonly" . lsp-rust-analyzer-readonly-modifier-face) ("default_library" . lsp-rust-analyzer-default-library-modifier-face) ("async" . lsp-rust-analyzer-async-modifier-face) ("attribute" . lsp-rust-analyzer-attribute-modifier-face) ("callable" . lsp-rust-analyzer-callable-modifier-face) ("constant" . lsp-rust-analyzer-constant-modifier-face) ("consuming" . lsp-rust-analyzer-consuming-modifier-face) ("control_flow" . lsp-rust-analyzer-control-flow-modifier-face) ("crate_root" . lsp-rust-analyzer-crate-root-modifier-face) ("injected" . lsp-rust-analyzer-injected-modifier-face) ("intra_doc_link" . lsp-rust-analyzer-intra-doc-link-modifier-face) ("library" . lsp-rust-analyzer-library-modifier-face) ("mutable" . lsp-rust-analyzer-mutable-modifier-face) ("public" . lsp-rust-analyzer-public-modifier-face) ("reference" . lsp-rust-analyzer-reference-modifier-face) ("trait" . lsp-rust-analyzer-trait-modifier-face) ("unsafe" . lsp-rust-analyzer-unsafe-modifier-face))) :custom-capabilities ((experimental (snippetTextEdit . t))) :library-folders-fn #f(compiled-function (workspace) #<bytecode 0x83eb8fa02f50819>) :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/0 0x12342ba454c8 ...> :download-server-fn #f(compiled-function (client callback error-callback update?) #<bytecode -0x7f26ce6aa8d4a50>) :download-in-progress? nil :buffers nil :synchronize-sections nil) :host-root nil :proc #<process rust-analyzer<1>> :cmd-proc #<process rust-analyzer<1>> :buffers (#<buffer face.rs>) :semantic-tokens-faces nil :semantic-tokens-modifier-faces nil :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/0 0x12342a3dfddb ...> :watches #<hash-table equal 0/0 0x12342a3dfdc8 ...> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 3/6 0x12342a3dd482 ...> :work-done-tokens #<hash-table equal 0/6 0x12342a3df7c8 ...>))
  mapc(#f(compiled-function (workspace) #<bytecode 0x1b8764cb931da350>) (#s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 26/26 0x12342a216891 ...> :registered-server-capabilities (#s(lsp--registered-capability :id "workspace/didChangeWatchedFiles" :method "workspace/didChangeWatchedFiles" :options #<hash-table equal 1/1 0x1234265e578d ...>) #s(lsp--registered-capability :id "workspace/didChangeWatchedFiles" :method "workspace/didChangeWatchedFiles" :options #<hash-table equal 1/1 0x12342a28f0a5 ...>)) :root "/home/dwuggh/Projects/egui2" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn workspace) #<bytecode -0x19059c317927cab0>) :test? #f(compiled-function () #<bytecode 0xec607c9fd7daeff>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/6 0x12342ba44ce3 ...> :request-handlers #<hash-table equal 0/0 0x12342ba454a3 ...> :response-handlers #<hash-table eql 0/6 0x12342ba454b5 ...> :prefix-function nil :uri-handlers #<hash-table equal 0/0 0x12342ba454de ...> :action-handlers #<hash-table equal 4/6 0x12342ba44cf0 ...> :major-modes nil :activation-fn #f(compiled-function (file-name mode) #<bytecode -0x65332d5f4c579cf>) :priority 1 :server-id rust-analyzer :multi-root nil :initialization-options lsp-rust-analyzer--make-init-options :semantic-tokens-faces-overrides (:discard-default-modifiers t :modifiers (("documentation" . lsp-rust-analyzer-documentation-modifier-face) ("declaration" . lsp-rust-analyzer-declaration-modifier-face) ("definition" . lsp-rust-analyzer-definition-modifier-face) ("static" . lsp-rust-analyzer-static-modifier-face) ("abstract" . lsp-rust-analyzer-abstract-modifier-face) ("deprecated" . lsp-rust-analyzer-deprecated-modifier-face) ("readonly" . lsp-rust-analyzer-readonly-modifier-face) ("default_library" . lsp-rust-analyzer-default-library-modifier-face) ("async" . lsp-rust-analyzer-async-modifier-face) ("attribute" . lsp-rust-analyzer-attribute-modifier-face) ("callable" . lsp-rust-analyzer-callable-modifier-face) ("constant" . lsp-rust-analyzer-constant-modifier-face) ("consuming" . lsp-rust-analyzer-consuming-modifier-face) ("control_flow" . lsp-rust-analyzer-control-flow-modifier-face) ("crate_root" . lsp-rust-analyzer-crate-root-modifier-face) ("injected" . lsp-rust-analyzer-injected-modifier-face) ("intra_doc_link" . lsp-rust-analyzer-intra-doc-link-modifier-face) ("library" . lsp-rust-analyzer-library-modifier-face) ("mutable" . lsp-rust-analyzer-mutable-modifier-face) ("public" . lsp-rust-analyzer-public-modifier-face) ("reference" . lsp-rust-analyzer-reference-modifier-face) ("trait" . lsp-rust-analyzer-trait-modifier-face) ("unsafe" . lsp-rust-analyzer-unsafe-modifier-face))) :custom-capabilities ((experimental (snippetTextEdit . t))) :library-folders-fn #f(compiled-function (workspace) #<bytecode 0x83eb8fa02f50819>) :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/0 0x12342ba454c8 ...> :download-server-fn #f(compiled-function (client callback error-callback update?) #<bytecode -0x7f26ce6aa8d4a50>) :download-in-progress? nil :buffers nil :synchronize-sections nil) :host-root nil :proc #<process rust-analyzer<1>> :cmd-proc #<process rust-analyzer<1>> :buffers (#<buffer face.rs>) :semantic-tokens-faces nil :semantic-tokens-modifier-faces nil :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/0 0x12342a3dfddb ...> :watches #<hash-table equal 0/0 0x12342a3dfdc8 ...> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 3/6 0x12342a3dd482 ...> :work-done-tokens #<hash-table equal 0/6 0x12342a3df7c8 ...>)))
  seq-do(#f(compiled-function (workspace) #<bytecode 0x1b8764cb931da350>) (#s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 26/26 0x12342a216891 ...> :registered-server-capabilities (#s(lsp--registered-capability :id "workspace/didChangeWatchedFiles" :method "workspace/didChangeWatchedFiles" :options #<hash-table equal 1/1 0x1234265e578d ...>) #s(lsp--registered-capability :id "workspace/didChangeWatchedFiles" :method "workspace/didChangeWatchedFiles" :options #<hash-table equal 1/1 0x12342a28f0a5 ...>)) :root "/home/dwuggh/Projects/egui2" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn workspace) #<bytecode -0x19059c317927cab0>) :test? #f(compiled-function () #<bytecode 0xec607c9fd7daeff>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/6 0x12342ba44ce3 ...> :request-handlers #<hash-table equal 0/0 0x12342ba454a3 ...> :response-handlers #<hash-table eql 0/6 0x12342ba454b5 ...> :prefix-function nil :uri-handlers #<hash-table equal 0/0 0x12342ba454de ...> :action-handlers #<hash-table equal 4/6 0x12342ba44cf0 ...> :major-modes nil :activation-fn #f(compiled-function (file-name mode) #<bytecode -0x65332d5f4c579cf>) :priority 1 :server-id rust-analyzer :multi-root nil :initialization-options lsp-rust-analyzer--make-init-options :semantic-tokens-faces-overrides (:discard-default-modifiers t :modifiers (("documentation" . lsp-rust-analyzer-documentation-modifier-face) ("declaration" . lsp-rust-analyzer-declaration-modifier-face) ("definition" . lsp-rust-analyzer-definition-modifier-face) ("static" . lsp-rust-analyzer-static-modifier-face) ("abstract" . lsp-rust-analyzer-abstract-modifier-face) ("deprecated" . lsp-rust-analyzer-deprecated-modifier-face) ("readonly" . lsp-rust-analyzer-readonly-modifier-face) ("default_library" . lsp-rust-analyzer-default-library-modifier-face) ("async" . lsp-rust-analyzer-async-modifier-face) ("attribute" . lsp-rust-analyzer-attribute-modifier-face) ("callable" . lsp-rust-analyzer-callable-modifier-face) ("constant" . lsp-rust-analyzer-constant-modifier-face) ("consuming" . lsp-rust-analyzer-consuming-modifier-face) ("control_flow" . lsp-rust-analyzer-control-flow-modifier-face) ("crate_root" . lsp-rust-analyzer-crate-root-modifier-face) ("injected" . lsp-rust-analyzer-injected-modifier-face) ("intra_doc_link" . lsp-rust-analyzer-intra-doc-link-modifier-face) ("library" . lsp-rust-analyzer-library-modifier-face) ("mutable" . lsp-rust-analyzer-mutable-modifier-face) ("public" . lsp-rust-analyzer-public-modifier-face) ("reference" . lsp-rust-analyzer-reference-modifier-face) ("trait" . lsp-rust-analyzer-trait-modifier-face) ("unsafe" . lsp-rust-analyzer-unsafe-modifier-face))) :custom-capabilities ((experimental (snippetTextEdit . t))) :library-folders-fn #f(compiled-function (workspace) #<bytecode 0x83eb8fa02f50819>) :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/0 0x12342ba454c8 ...> :download-server-fn #f(compiled-function (client callback error-callback update?) #<bytecode -0x7f26ce6aa8d4a50>) :download-in-progress? nil :buffers nil :synchronize-sections nil) :host-root nil :proc #<process rust-analyzer<1>> :cmd-proc #<process rust-analyzer<1>> :buffers (#<buffer face.rs>) :semantic-tokens-faces nil :semantic-tokens-modifier-faces nil :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/0 0x12342a3dfddb ...> :watches #<hash-table equal 0/0 0x12342a3dfdc8 ...> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 3/6 0x12342a3dd482 ...> :work-done-tokens #<hash-table equal 0/6 0x12342a3df7c8 ...>)))
  lsp--file-process-event(#s(lsp-session :folders ("/home/dwuggh/Projects/egui2" "/home/dwuggh/aur/emacs-native-comp-git/src/emacs-git" "/home/dwuggh/Projects/rune") :folders-blocklist nil :server-id->folders #<hash-table equal 0/0 0x12342b877f6a ...> :folder->servers #<hash-table equal 2/6 0x12342b877fab ...> :metadata #<hash-table equal 1/6 0x12342b877fbd ...>) "/home/dwuggh/Projects/egui2" ((33 . 0) changed "/home/dwuggh/Projects/egui2/src/face.rs"))
  apply(lsp--file-process-event (#s(lsp-session :folders ("/home/dwuggh/Projects/egui2" "/home/dwuggh/aur/emacs-native-comp-git/src/emacs-git" "/home/dwuggh/Projects/rune") :folders-blocklist nil :server-id->folders #<hash-table equal 0/0 0x12342b877f6a ...> :folder->servers #<hash-table equal 2/6 0x12342b877fab ...> :metadata #<hash-table equal 1/6 0x12342b877fbd ...>) "/home/dwuggh/Projects/egui2" ((33 . 0) changed "/home/dwuggh/Projects/egui2/src/face.rs")))
  #f(compiled-function (&rest args2) #<bytecode 0x8a0d388fa77db89>)(((33 . 0) changed "/home/dwuggh/Projects/egui2/src/face.rs"))
  lsp--folder-watch-callback(((33 . 0) changed "/home/dwuggh/Projects/egui2/src/face.rs") #f(compiled-function (&rest args2) #<bytecode 0x8a0d388fa77db89>) #s(lsp-watch :descriptors #<hash-table equal 4/6 0x12342a28918a ...> :root-directory "/home/dwuggh/Projects/egui2") ("[/\\\\]flycheck_[^/\\\\]+\\'" "[/\\\\]\\.#[^/\\\\]+\\'" "[/\\\\][^/\\\\]+~\\'") ("[/\\\\]\\.git\\'" "[/\\\\]\\.github\\'" "[/\\\\]\\.gitlab\\'" "[/\\\\]\\.circleci\\'" "[/\\\\]\\.hg\\'" "[/\\\\]\\.bzr\\'" "[/\\\\]_darcs\\'" "[/\\\\]\\.svn\\'" "[/\\\\]_FOSSIL_\\'" "[/\\\\]\\.idea\\'" "[/\\\\]\\.ensime_cache\\'" "[/\\\\]\\.eunit\\'" "[/\\\\]node_modules" "[/\\\\]\\.yarn\\'" "[/\\\\]\\.fslckout\\'" "[/\\\\]\\.tox\\'" "[/\\\\]\\.nox\\'" "[/\\\\]dist\\'" "[/\\\\]dist-newstyle\\'" "[/\\\\]\\.stack-work\\'" "[/\\\\]\\.bloop\\'" "[/\\\\]\\.metals\\'" "[/\\\\]target\\'" "[/\\\\]\\.ccls-cache\\'" "[/\\\\]\\.vscode\\'" "[/\\\\]\\.venv\\'" "[/\\\\]\\.mypy_cache\\'" "[/\\\\]\\.pytest_cache\\'" "[/\\\\]\\.build\\'" "[/\\\\]__pycache__\\'" "[/\\\\]\\.deps\\'" "[/\\\\]build-aux\\'" "[/\\\\]autom4te.cache\\'" "[/\\\\]\\.reference\\'" "[/\\\\]bazel-[^/\\\\]+\\'" "[/\\\\]\\.meta\\'" "[/\\\\]Library\\'" "[/\\\\]\\.lsp\\'" "[/\\\\]\\.clj-kondo\\'" "[/\\\\]\\.shadow-cljs\\'" "[/\\\\]\\.babel_cache\\'" "[/\\\\]\\.cpcache\\'" "[/\\\\]\\checkouts\\'" "[/\\\\]\\.gradle\\'" "[/\\\\]\\.m2\\'" "[/\\\\]bin/Debug\\'" "[/\\\\]obj\\'" "[/\\\\]_opam\\'" "[/\\\\]_build\\'" "[/\\\\]\\.elixir_ls\\'" ...))
  #f(compiled-function (event) #<bytecode -0x5f781505050e423>)(((33 . 0) changed "/home/dwuggh/Projects/egui2/src/face.rs"))
  file-notify--call-handler(#s(file-notify--watch :directory "/home/dwuggh/Projects/egui2/src" :filename nil :callback #f(compiled-function (event) #<bytecode -0x5f781505050e423>)) (33 . 0) changed "/home/dwuggh/Projects/egui2/src/face.rs" nil)
  file-notify--handle-event((33 . 0) (changed) "face.rs" 0)
  file-notify--callback-inotify(((33 . 0) (modify) "face.rs" 0))
  file-notify-handle-event((file-notify ((33 . 0) (modify) "face.rs" 0) file-notify--callback-inotify))
  funcall-interactively(file-notify-handle-event (file-notify ((33 . 0) (modify) "face.rs" 0) file-notify--callback-inotify))
  command-execute(file-notify-handle-event nil [(file-notify ((33 . 0) (modify) "face.rs" 0) file-notify--callback-inotify)] t)


### Anything else?

_No response_
dwuggh commented 3 months ago

seems to be a rust-analyzer's bug, maybe fixed by https://github.com/rust-lang/rust-analyzer/commit/8f9a58c73d4181f137f92a83377cd4ca0a9b0259

jcs090218 commented 3 months ago

It does look like an upstream bug. 🤔

dwuggh commented 3 months ago

thanks! RA with version 2024-02-04 does not have that problem, likely to come up after version 2024-03-24. I'm closing it now, hopefully be fixed upstream next week