Skip to content

lsp--document-highlight fails if textDocument/documentHighlight is not supported #2378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jo-so opened this issue Dec 5, 2020 · 18 comments
Closed

Comments

@jo-so
Copy link

jo-so commented Dec 5, 2020

Describe the bug

I get this error message for a Rust file that uses rls:

The connected server(s) does not support method textDocument/documentHighlight.
To find out what capabilities support your server use ‘M-x lsp-describe-session’
and expand the capabilities section

This is the backtrace of the error:

Debugger entered--Lisp error: (error "The connected server(s) does not support method te...")
  signal(error ("The connected server(s) does not support method te..."))
  error("The connected server(s) does not support method %s..." "textDocument/documentHighlight")
  lsp--send-request-async((:jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/daheme/daheme/build-sp...") :position (:line 697 :character 26))) lsp--document-highlight-callback tick nil nil nil :highlights)
  lsp-request-async("textDocument/documentHighlight" (:textDocument (:uri "file:///home/joerg/Projekte/daheme/daheme/build-sp...") :position (:line 697 :character 26)) lsp--document-highlight-callback :mode tick :cancel-token :highlights)
  lsp--document-highlight()
  run-hooks(lsp-on-idle-hook)
  lsp--on-idle(#<buffer main.rs<build-spec-tests>>)

Which Language Server did you use
Rust

OS
Linux/Debian, GNU Emacs 27.1, lsp-mode 20201129.1832 (from melpa)

Suggested fix

commit db9a7ca6bbb0dfb2f582bf5f8087f2b18ff15bc9 (HEAD -> master)
Author: Jörg Sommer <[email protected]>
Date:   Sat Dec 5 10:49:48 2020 +0100

    document-highlight: Check if highlighting is possible
    
    Don't call the language server if textDocument/documentHighlight is not
    supported.

diff --git a/lsp-mode.el b/lsp-mode.el
index 8d0d5e99..1b146b59 100644
--- a/lsp-mode.el
+++ b/lsp-mode.el
@@ -4616,6 +4616,7 @@ If INCLUDE-DECLARATION is non-nil, request the server to include declarations."
   (let ((curr-sym-bounds (bounds-of-thing-at-point 'symbol)))
     (unless (or (looking-at "[[:space:]\n]")
                 (not lsp-enable-symbol-highlighting)
+                (not (lsp-feature? "textDocument/documentHighlight"))
                 (and lsp--have-document-highlights
                      curr-sym-bounds
                      (equal curr-sym-bounds
@yyoncho
Copy link
Member

yyoncho commented Dec 5, 2020

Willing to open a PR?

In general, we are not supposed to call that method at all when (lsp-feature? "textDocument/documentHighlight") is nil. It seems like there is a path that allows that.

@jo-so
Copy link
Author

jo-so commented Dec 5, 2020

Yes, I would send a PR.

I've dug a little bit deeper and I think this is the code path that adds the function:

Debugger entered--Lisp error: (error "Format specifier doesn’t match argument type")
  message("x= %d y = %d; %d" t t (#s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 15/15 0x15625d0156e1> :registered-server-capabilities (#s(lsp--registered-capability :id "rls-watch" :method "workspace/didChangeWatchedFiles" :options #<hash-table equal 1/1 0x15625d09b86d>)) :root "/home/joerg/Projekte/word-dist" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn) #<bytecode 0x15625c5af3f1>) :test\? #f(compiled-function () #<bytecode 0x15625c5b0735>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/65 0x15625c5b0741> :request-handlers #<hash-table equal 0/65 0x15625c5b0991> :response-handlers #<hash-table eql 0/65 0x15625c5b09b1> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x15625c5b09d1> :action-handlers #<hash-table equal 1/65 0x15625c5b0971> :major-modes (rust-mode rustic-mode) :activation-fn nil :priority -1 :server-id rls :multi-root nil :initialization-options ((omitInitBuild . t) (cmdRun . t)) :custom-capabilities nil :library-folders-fn #f(compiled-function (workspace) #<bytecode 0x15625c5ac715>) :before-file-open-fn nil :initialized-fn #f(compiled-function (workspace) #<bytecode 0x15625c5ac72d>) :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 0x15625c5b11bd> :download-server-fn nil :download-in-progress? nil :buffers nil) :host-root nil :proc #<process rls<6>> :cmd-proc #<process rls<6>> :buffers (#<buffer main.rs<word-dist>>) :semantic-highlighting-faces nil :semantic-highlighting-modifier-faces nil :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/65 0x15625c7208b1> :watches #<hash-table equal 0/65 0x15625c6633e5> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 0/65 0x15625c737f25> :work-done-tokens #<hash-table equal 0/65 0x15625c73ae3d>)))
  (let ((x lsp-enable-symbol-highlighting) (y (lsp-feature\? "textDocument/documentHighlight"))) (message "x= %d y = %d; %d" x (and y t) (and x y)) (and x y))
  (if (let ((x lsp-enable-symbol-highlighting) (y (lsp-feature\? "textDocument/documentHighlight"))) (message "x= %d y = %d; %d" x (and y t) (and x y)) (and x y)) (progn (add-hook 'lsp-on-idle-hook #'lsp--document-highlight nil t)))
  (progn (if (and lsp-enable-text-document-color (lsp-feature\? "textDocument/documentColor")) (progn (add-hook 'lsp-on-change-hook #'lsp--document-color nil t))) (if (and lsp-enable-imenu (lsp-feature\? "textDocument/documentSymbol")) (progn (lsp-enable-imenu))) (if (and lsp-enable-indentation (lsp-feature\? "textDocument/rangeFormatting")) (progn (set (make-local-variable 'indent-region-function) #'lsp-format-region))) (if (let ((x lsp-enable-symbol-highlighting) (y (lsp-feature\? "textDocument/documentHighlight"))) (message "x= %d y = %d; %d" x (and y t) (and x y)) (and x y)) (progn (add-hook 'lsp-on-idle-hook #'lsp--document-highlight nil t))) (if (and lsp-enable-links (lsp-feature\? "textDocument/documentLink")) (progn (add-hook 'lsp-on-idle-hook #'lsp--document-links nil t))) (if (and lsp-enable-dap-auto-configure (functionp 'dap-mode)) (progn (dap-auto-configure-mode 1))) (if (and lsp-enable-semantic-highlighting (lsp-feature\? "textDocument/semanticTokens")) (progn (mapc #'lsp--semantic-tokens-initialize-workspace (lsp--find-workspaces-for "textDocument/semanticTokens")) (lsp--semantic-tokens-initialize-buffer (lsp-feature\? "textDocument/semanticTokensRangeProvider")))))
  (if lsp-auto-configure (progn (if (and lsp-enable-text-document-color (lsp-feature\? "textDocument/documentColor")) (progn (add-hook 'lsp-on-change-hook #'lsp--document-color nil t))) (if (and lsp-enable-imenu (lsp-feature\? "textDocument/documentSymbol")) (progn (lsp-enable-imenu))) (if (and lsp-enable-indentation (lsp-feature\? "textDocument/rangeFormatting")) (progn (set (make-local-variable 'indent-region-function) #'lsp-format-region))) (if (let ((x lsp-enable-symbol-highlighting) (y (lsp-feature\? "textDocument/documentHighlight"))) (message "x= %d y = %d; %d" x (and y t) (and x y)) (and x y)) (progn (add-hook 'lsp-on-idle-hook #'lsp--document-highlight nil t))) (if (and lsp-enable-links (lsp-feature\? "textDocument/documentLink")) (progn (add-hook 'lsp-on-idle-hook #'lsp--document-links nil t))) (if (and lsp-enable-dap-auto-configure (functionp 'dap-mode)) (progn (dap-auto-configure-mode 1))) (if (and lsp-enable-semantic-highlighting (lsp-feature\? "textDocument/semanticTokens")) (progn (mapc #'lsp--semantic-tokens-initialize-workspace (lsp--find-workspaces-for "textDocument/semanticTokens")) (lsp--semantic-tokens-initialize-buffer (lsp-feature\? "textDocument/semanticTokensRangeProvider"))))))
  (let ((lsp--buffer-workspaces (cond (lsp--buffer-workspaces) (lsp--cur-workspace (list lsp--cur-workspace)))) lsp--cur-workspace) (if lsp-auto-configure (progn (if (and lsp-enable-text-document-color (lsp-feature\? "textDocument/documentColor")) (progn (add-hook 'lsp-on-change-hook #'lsp--document-color nil t))) (if (and lsp-enable-imenu (lsp-feature\? "textDocument/documentSymbol")) (progn (lsp-enable-imenu))) (if (and lsp-enable-indentation (lsp-feature\? "textDocument/rangeFormatting")) (progn (set (make-local-variable 'indent-region-function) #'lsp-format-region))) (if (let ((x lsp-enable-symbol-highlighting) (y (lsp-feature\? "textDocument/documentHighlight"))) (message "x= %d y = %d; %d" x (and y t) (and x y)) (and x y)) (progn (add-hook 'lsp-on-idle-hook #'lsp--document-highlight nil t))) (if (and lsp-enable-links (lsp-feature\? "textDocument/documentLink")) (progn (add-hook 'lsp-on-idle-hook #'lsp--document-links nil t))) (if (and lsp-enable-dap-auto-configure (functionp 'dap-mode)) (progn (dap-auto-configure-mode 1))) (if (and lsp-enable-semantic-highlighting (lsp-feature\? "textDocument/semanticTokens")) (progn (mapc #'lsp--semantic-tokens-initialize-workspace (lsp--find-workspaces-for "textDocument/semanticTokens")) (lsp--semantic-tokens-initialize-buffer (lsp-feature\? "textDocument/semanticTokensRangeProvider")))))) (run-hooks 'lsp-configure-hook))
  lsp-configure-buffer()
  lsp-managed-mode(1)
  lsp--text-document-did-open()
  lsp--open-in-workspace(#s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 15/15 0x15625d0156e1> :registered-server-capabilities (#s(lsp--registered-capability :id "rls-watch" :method "workspace/didChangeWatchedFiles" :options #<hash-table equal 1/1 0x15625d09b86d>)) :root "/home/joerg/Projekte/word-dist" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn) #<bytecode 0x15625c5af3f1>) :test\? #f(compiled-function () #<bytecode 0x15625c5b0735>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/65 0x15625c5b0741> :request-handlers #<hash-table equal 0/65 0x15625c5b0991> :response-handlers #<hash-table eql 0/65 0x15625c5b09b1> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x15625c5b09d1> :action-handlers #<hash-table equal 1/65 0x15625c5b0971> :major-modes (rust-mode rustic-mode) :activation-fn nil :priority -1 :server-id rls :multi-root nil :initialization-options ((omitInitBuild . t) (cmdRun . t)) :custom-capabilities nil :library-folders-fn #f(compiled-function (workspace) #<bytecode 0x15625c5ac715>) :before-file-open-fn nil :initialized-fn #f(compiled-function (workspace) #<bytecode 0x15625c5ac72d>) :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 0x15625c5b11bd> :download-server-fn nil :download-in-progress? nil :buffers nil) :host-root nil :proc #<process rls<6>> :cmd-proc #<process rls<6>> :buffers (#<buffer main.rs<word-dist>>) :semantic-highlighting-faces nil :semantic-highlighting-modifier-faces nil :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/65 0x15625c7208b1> :watches #<hash-table equal 0/65 0x15625c6633e5> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 0/65 0x15625c737f25> :work-done-tokens #<hash-table equal 0/65 0x15625c73ae3d>))
  lsp--find-workspace(#s(lsp-session :folders ("/tmp/gittest" "/home/joerg/Projekte/word-dist" "/tmp/gittest/src" "/tmp/sort-test/src" "/home/joerg/.cargo/registry/src/gb.xjqchip.workers.dev-1ecc629..." "/home/joerg/.cargo/registry/src/gb.xjqchip.workers.dev-1ecc629..." "/home/joerg/Projekte/gitlog2rss" "/home/joerg/Projekte/daheme" "/home/joerg/Projekte/firma/riafulon" "/home/joerg/Projekte/firma/riafulon/builder" "/home/joerg/Projekte/daheme/daheme-cli" "/home/joerg/Projekte/daheme/daheme-cli/temp-2" "/home/joerg/Projekte/daheme/daheme" "/home/joerg/Projekte/daheme/daheme/build-spec-test...") :folders-blacklist nil :server-id->folders #<hash-table equal 0/65 0x15625c4a1a81> :folder->servers #<hash-table equal 7/65 0x15625c52395d> :metadata #<hash-table equal 1/65 0x15625c5a16a5>) #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn) #<bytecode 0x15625c5af3f1>) :test\? #f(compiled-function () #<bytecode 0x15625c5b0735>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/65 0x15625c5b0741> :request-handlers #<hash-table equal 0/65 0x15625c5b0991> :response-handlers #<hash-table eql 0/65 0x15625c5b09b1> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x15625c5b09d1> :action-handlers #<hash-table equal 1/65 0x15625c5b0971> :major-modes (rust-mode rustic-mode) :activation-fn nil :priority -1 :server-id rls :multi-root nil :initialization-options ((omitInitBuild . t) (cmdRun . t)) :custom-capabilities nil :library-folders-fn #f(compiled-function (workspace) #<bytecode 0x15625c5ac715>) :before-file-open-fn nil :initialized-fn #f(compiled-function (workspace) #<bytecode 0x15625c5ac72d>) :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 0x15625c5b11bd> :download-server-fn nil :download-in-progress? nil :buffers nil) "/home/joerg/Projekte/word-dist")
  #f(compiled-function (client) #<bytecode 0x15625d0a8f8d>)(#s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn) #<bytecode 0x15625c5af3f1>) :test\? #f(compiled-function () #<bytecode 0x15625c5b0735>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/65 0x15625c5b0741> :request-handlers #<hash-table equal 0/65 0x15625c5b0991> :response-handlers #<hash-table eql 0/65 0x15625c5b09b1> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x15625c5b09d1> :action-handlers #<hash-table equal 1/65 0x15625c5b0971> :major-modes (rust-mode rustic-mode) :activation-fn nil :priority -1 :server-id rls :multi-root nil :initialization-options ((omitInitBuild . t) (cmdRun . t)) :custom-capabilities nil :library-folders-fn #f(compiled-function (workspace) #<bytecode 0x15625c5ac715>) :before-file-open-fn nil :initialized-fn #f(compiled-function (workspace) #<bytecode 0x15625c5ac72d>) :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 0x15625c5b11bd> :download-server-fn nil :download-in-progress? nil :buffers nil))
  mapcar(#f(compiled-function (client) #<bytecode 0x15625d0a8f8d>) (#s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn) #<bytecode 0x15625c5af3f1>) :test\? #f(compiled-function () #<bytecode 0x15625c5b0735>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/65 0x15625c5b0741> :request-handlers #<hash-table equal 0/65 0x15625c5b0991> :response-handlers #<hash-table eql 0/65 0x15625c5b09b1> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x15625c5b09d1> :action-handlers #<hash-table equal 1/65 0x15625c5b0971> :major-modes (rust-mode rustic-mode) :activation-fn nil :priority -1 :server-id rls :multi-root nil :initialization-options ((omitInitBuild . t) (cmdRun . t)) :custom-capabilities nil :library-folders-fn #f(compiled-function (workspace) #<bytecode 0x15625c5ac715>) :before-file-open-fn nil :initialized-fn #f(compiled-function (workspace) #<bytecode 0x15625c5ac72d>) :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 0x15625c5b11bd> :download-server-fn nil :download-in-progress? nil :buffers nil)))
  -map(#f(compiled-function (client) #<bytecode 0x15625d0a8f8d>) (#s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn) #<bytecode 0x15625c5af3f1>) :test\? #f(compiled-function () #<bytecode 0x15625c5b0735>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/65 0x15625c5b0741> :request-handlers #<hash-table equal 0/65 0x15625c5b0991> :response-handlers #<hash-table eql 0/65 0x15625c5b09b1> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x15625c5b09d1> :action-handlers #<hash-table equal 1/65 0x15625c5b0971> :major-modes (rust-mode rustic-mode) :activation-fn nil :priority -1 :server-id rls :multi-root nil :initialization-options ((omitInitBuild . t) (cmdRun . t)) :custom-capabilities nil :library-folders-fn #f(compiled-function (workspace) #<bytecode 0x15625c5ac715>) :before-file-open-fn nil :initialized-fn #f(compiled-function (workspace) #<bytecode 0x15625c5ac72d>) :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 0x15625c5b11bd> :download-server-fn nil :download-in-progress? nil :buffers nil)))
  lsp--ensure-lsp-servers(#s(lsp-session :folders ("/tmp/gittest" "/home/joerg/Projekte/word-dist" "/tmp/gittest/src" "/tmp/sort-test/src" "/home/joerg/.cargo/registry/src/gb.xjqchip.workers.dev-1ecc629..." "/home/joerg/.cargo/registry/src/gb.xjqchip.workers.dev-1ecc629..." "/home/joerg/Projekte/gitlog2rss" "/home/joerg/Projekte/daheme" "/home/joerg/Projekte/firma/riafulon" "/home/joerg/Projekte/firma/riafulon/builder" "/home/joerg/Projekte/daheme/daheme-cli" "/home/joerg/Projekte/daheme/daheme-cli/temp-2" "/home/joerg/Projekte/daheme/daheme" "/home/joerg/Projekte/daheme/daheme/build-spec-test...") :folders-blacklist nil :server-id->folders #<hash-table equal 0/65 0x15625c4a1a81> :folder->servers #<hash-table equal 7/65 0x15625c52395d> :metadata #<hash-table equal 1/65 0x15625c5a16a5>) (#s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn) #<bytecode 0x15625c5af3f1>) :test\? #f(compiled-function () #<bytecode 0x15625c5b0735>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/65 0x15625c5b0741> :request-handlers #<hash-table equal 0/65 0x15625c5b0991> :response-handlers #<hash-table eql 0/65 0x15625c5b09b1> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x15625c5b09d1> :action-handlers #<hash-table equal 1/65 0x15625c5b0971> :major-modes (rust-mode rustic-mode) :activation-fn nil :priority -1 :server-id rls :multi-root nil :initialization-options ((omitInitBuild . t) (cmdRun . t)) :custom-capabilities nil :library-folders-fn #f(compiled-function (workspace) #<bytecode 0x15625c5ac715>) :before-file-open-fn nil :initialized-fn #f(compiled-function (workspace) #<bytecode 0x15625c5ac72d>) :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 0x15625c5b11bd> :download-server-fn nil :download-in-progress? nil :buffers nil)) "/home/joerg/Projekte/word-dist" nil)
  lsp--try-project-root-workspaces(nil nil)
  lsp()
  rustic-setup-lsp()
  rustic-mode()
  set-auto-mode-0(rustic-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer main.rs<word-dist>> "~/Projekte/word-dist/src/main.rs" nil nil "~/Projekte/word-dist/src/main.rs" (4379522 65026))
  find-file-noselect("~/Projekte/word-dist/src/main.rs" nil nil t)
  find-file("~/Projekte/word-dist/src/main.rs" t)
  funcall-interactively(find-file "~/Projekte/word-dist/src/main.rs" t)
  call-interactively(find-file nil nil)
  command-execute(find-file)

Don't care about the error. Is caused by my debugging code.

This is the return value of (lsp-feature? "textDocument/documentHighlight"):

(#s(lsp--workspace nil #s(hash-table size 15 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("textDocumentSync" 2 "hoverProvider" t "completionProvider" #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("resolveProvider" t "triggerCharacters" ["." ":"])) "definitionProvider" t "implementationProvider" t "referencesProvider" t "documentHighlightProvider" t "documentSymbolProvider" t "workspaceSymbolProvider" t "codeActionProvider" t "codeLensProvider" #s(hash-table size 1 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("resolveProvider" nil)) "documentFormattingProvider" t "documentRangeFormattingProvider" nil "renameProvider" t "executeCommandProvider" #s(hash-table size 1 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("commands" ["rls.applySuggestion-1818405" "rls.deglobImports-1818405"])))) (#s(lsp--registered-capability "rls-watch" "workspace/didChangeWatchedFiles" #s(hash-table size 1 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("watchers" [#s(hash-table size 1 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("globPattern" "/home/joerg/Projekte/firma/riafulon/builder/Cargo.lock")) #s(hash-table size 2 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("globPattern" "/home/joerg/Projekte/firma/riafulon/builder/target" "kind" 4)) #s(hash-table size 1 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("globPattern" "/home/joerg/Projekte/firma/riafulon/builder/Cargo.toml"))])))) "/home/joerg/Projekte/firma/riafulon/builder" #s(lsp--client nil nil (:connect (closure ((test-command) (command . #[0 "�\207" [lsp-rust-rls-server-command] 1]) company-mode cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (filter sentinel name environment-fn) (let ((final-command (lsp-resolve-final-function command)) (process-name (generate-new-buffer-name name)) (process-environment (lsp--compute-process-environment environment-fn))) (let* ((stderr-buf (format "*%s::stderr*" process-name)) (proc (make-process :name process-name :connection-type 'pipe :buffer (format "*%s*" process-name) :coding 'no-conversion :command final-command :filter filter :sentinel sentinel :stderr stderr-buf :noquery t))) (set-process-query-on-exit-flag proc nil) (set-process-query-on-exit-flag (get-buffer-process stderr-buf) nil) (save-current-buffer (set-buffer (get-buffer stderr-buf)) (special-mode)) (cons proc proc)))) :test\? (closure ((test-command) (command . #[0 "�\207" [lsp-rust-rls-server-command] 1]) company-mode cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) nil (lsp-server-present\? (lsp-resolve-final-function command)))) nil nil #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("window/progress" lsp-clients--rust-window-progress)) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data (2 ((closure ((callback closure ((errors) (results) (workspaces #1) (no-merge) (method . "textDocument/codeAction") (callback . lsp--modeline-update-code-actions) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (result) (let* ((v (cons lsp--cur-workspace result))) (if (eq result :error) (setq errors (cons v errors)) (setq results (cons v results)))) (if (and (not (eq (length errors) (length workspaces))) (eq (+ (length errors) (length results)) (length workspaces))) (progn (funcall callback (if no-merge results (lsp--merge-results (-map #'cl-rest results) method)))))) (callback . lsp--modeline-update-code-actions) (cleanup-hooks closure ((buf . #<buffer sql.rs>) (hooks (after-change-functions . t) (post-command-hook)) (id . 2) (method . "textDocument/codeAction") (start-time 24523 38044 370722 370000) (target-workspaces #1) (cancel-token . :lsp-modeline-code-actions) (no-merge) (cancel-callback) (error-callback) (mode . unchanged) (callback . lsp--modeline-update-code-actions) (body :jsonrpc "2.0" :method "textDocument/codeAction" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :context (:diagnostics [])) :id 2) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) nil (mapc #'(lambda (input0) (let* ((--dash-source-21-- input0) (hook (car-safe (prog1 --dash-source-21-- (setq --dash-source-21-- (cdr --dash-source-21--))))) (local --dash-source-21--)) (if local (if (buffer-live-p buf) (progn (save-current-buffer (set-buffer buf) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback) t)))) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback))))) hooks) (remhash cancel-token lsp--cancelable-requests)) (buf . #<buffer sql.rs>) (hooks (after-change-functions . t) (post-command-hook)) (id . 2) (method . "textDocument/codeAction") (start-time 24523 38044 370722 370000) (target-workspaces #1) (cancel-token . :lsp-modeline-code-actions) (no-merge) (cancel-callback) (error-callback) (mode . unchanged) (callback . lsp--modeline-update-code-actions) (body :jsonrpc "2.0" :method "textDocument/codeAction" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :context (:diagnostics [])) :id 2) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (result) (lsp--request-cleanup-hooks id) (funcall callback result)) (closure ((error-callback closure ((errors) (results) (workspaces #1) (no-merge) (method . "textDocument/codeAction") (callback closure ((method . "textDocument/codeAction") cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (error) (lsp--warn "%s" (or (lsp--error-string error) (format "%s Request has failed" method)))) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (result) (let* ((v (cons lsp--cur-workspace result))) (if (eq result :error) (setq errors (cons v errors)) (setq results (cons v results)))) (if (and (not (eq (length errors) (length workspaces))) (eq (+ (length errors) (length results)) (length workspaces))) (progn (funcall callback (if no-merge results (lsp--merge-results (-map #'cl-rest results) method)))))) (callback closure ((callback closure ((errors) (results) (workspaces #1) (no-merge) (method . "textDocument/codeAction") (callback . lsp--modeline-update-code-actions) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (result) (let* ((v (cons lsp--cur-workspace result))) (if (eq result :error) (setq errors (cons v errors)) (setq results (cons v results)))) (if (and (not (eq (length errors) (length workspaces))) (eq (+ (length errors) (length results)) (length workspaces))) (progn (funcall callback (if no-merge results (lsp--merge-results (-map #'cl-rest results) method)))))) (callback . lsp--modeline-update-code-actions) (cleanup-hooks closure ((buf . #<buffer sql.rs>) (hooks (after-change-functions . t) (post-command-hook)) (id . 2) (method . "textDocument/codeAction") (start-time 24523 38044 370722 370000) (target-workspaces #1) (cancel-token . :lsp-modeline-code-actions) (no-merge) (cancel-callback) (error-callback) (mode . unchanged) (callback . lsp--modeline-update-code-actions) (body :jsonrpc "2.0" :method "textDocument/codeAction" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :context (:diagnostics [])) :id 2) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) nil (mapc #'(lambda (input0) (let* ((--dash-source-21-- input0) (hook (car-safe (prog1 --dash-source-21-- (setq --dash-source-21-- (cdr --dash-source-21--))))) (local --dash-source-21--)) (if local (if (buffer-live-p buf) (progn (save-current-buffer (set-buffer buf) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback) t)))) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback))))) hooks) (remhash cancel-token lsp--cancelable-requests)) (buf . #<buffer sql.rs>) (hooks (after-change-functions . t) (post-command-hook)) (id . 2) (method . "textDocument/codeAction") (start-time 24523 38044 370722 370000) (target-workspaces #1) (cancel-token . :lsp-modeline-code-actions) (no-merge) (cancel-callback) (error-callback) (mode . unchanged) (callback . lsp--modeline-update-code-actions) (body :jsonrpc "2.0" :method "textDocument/codeAction" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :context (:diagnostics [])) :id 2) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (result) (lsp--request-cleanup-hooks id) (funcall callback result)) (callback closure ((errors) (results) (workspaces #1) (no-merge) (method . "textDocument/codeAction") (callback . lsp--modeline-update-code-actions) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (result) (let* ((v (cons lsp--cur-workspace result))) (if (eq result :error) (setq errors (cons v errors)) (setq results (cons v results)))) (if (and (not (eq (length errors) (length workspaces))) (eq (+ (length errors) (length results)) (length workspaces))) (progn (funcall callback (if no-merge results (lsp--merge-results (-map #'cl-rest results) method)))))) (callback . lsp--modeline-update-code-actions) (cleanup-hooks closure ((buf . #<buffer sql.rs>) (hooks (after-change-functions . t) (post-command-hook)) (id . 2) (method . "textDocument/codeAction") (start-time 24523 38044 370722 370000) (target-workspaces #1) (cancel-token . :lsp-modeline-code-actions) (no-merge) (cancel-callback) (error-callback) (mode . unchanged) (callback . lsp--modeline-update-code-actions) (body :jsonrpc "2.0" :method "textDocument/codeAction" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :context (:diagnostics [])) :id 2) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) nil (mapc #'(lambda (input0) (let* ((--dash-source-21-- input0) (hook (car-safe (prog1 --dash-source-21-- (setq --dash-source-21-- (cdr --dash-source-21--))))) (local --dash-source-21--)) (if local (if (buffer-live-p buf) (progn (save-current-buffer (set-buffer buf) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback) t)))) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback))))) hooks) (remhash cancel-token lsp--cancelable-requests)) (buf . #<buffer sql.rs>) (hooks (after-change-functions . t) (post-command-hook)) (id . 2) (method . "textDocument/codeAction") (start-time 24523 38044 370722 370000) (target-workspaces #1) (cancel-token . :lsp-modeline-code-actions) (no-merge) (cancel-callback) (error-callback) (mode . unchanged) (callback . lsp--modeline-update-code-actions) (body :jsonrpc "2.0" :method "textDocument/codeAction" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :range (:start (:line 0 :character 0) :end (:line 0 :character 0)) :context (:diagnostics [])) :id 2) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (error) (funcall callback :error) (lsp--request-cleanup-hooks id) (funcall error-callback error)) "textDocument/codeAction" (24523 38044 370722 370000) (24523 38044 370863 598000)) 3 ((closure ((callback closure ((errors) (results) (workspaces #1) (no-merge) (method . "textDocument/documentHighlight") (callback closure ((cleanup-hooks closure ((buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) nil (mapc #'(lambda (input0) (let* ((--dash-source-21-- input0) (hook (car-safe (prog1 --dash-source-21-- (setq --dash-source-21-- (cdr --dash-source-21--))))) (local --dash-source-21--)) (if local (if (buffer-live-p buf) (progn (save-current-buffer (set-buffer buf) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback) t)))) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback))))) hooks) (remhash cancel-token lsp--cancelable-requests)) (buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (&rest args) (save-current-buffer (set-buffer buf) (apply callback args))) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (result) (let* ((v (cons lsp--cur-workspace result))) (if (eq result :error) (setq errors (cons v errors)) (setq results (cons v results)))) (if (and (not (eq (length errors) (length workspaces))) (eq (+ (length errors) (length results)) (length workspaces))) (progn (funcall callback (if no-merge results (lsp--merge-results (-map #'cl-rest results) method)))))) (callback closure ((cleanup-hooks closure ((buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) nil (mapc #'(lambda (input0) (let* ((--dash-source-21-- input0) (hook (car-safe (prog1 --dash-source-21-- (setq --dash-source-21-- (cdr --dash-source-21--))))) (local --dash-source-21--)) (if local (if (buffer-live-p buf) (progn (save-current-buffer (set-buffer buf) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback) t)))) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback))))) hooks) (remhash cancel-token lsp--cancelable-requests)) (buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (&rest args) (save-current-buffer (set-buffer buf) (apply callback args))) (cleanup-hooks closure ((buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) nil (mapc #'(lambda (input0) (let* ((--dash-source-21-- input0) (hook (car-safe (prog1 --dash-source-21-- (setq --dash-source-21-- (cdr --dash-source-21--))))) (local --dash-source-21--)) (if local (if (buffer-live-p buf) (progn (save-current-buffer (set-buffer buf) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback) t)))) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback))))) hooks) (remhash cancel-token lsp--cancelable-requests)) (buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (result) (lsp--request-cleanup-hooks id) (funcall callback result)) (closure ((error-callback closure ((errors) (results) (workspaces #1) (no-merge) (method . "textDocument/documentHighlight") (callback closure ((method . "textDocument/documentHighlight") cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (error) (lsp--warn "%s" (or (lsp--error-string error) (format "%s Request has failed" method)))) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (result) (let* ((v (cons lsp--cur-workspace result))) (if (eq result :error) (setq errors (cons v errors)) (setq results (cons v results)))) (if (and (not (eq (length errors) (length workspaces))) (eq (+ (length errors) (length results)) (length workspaces))) (progn (funcall callback (if no-merge results (lsp--merge-results (-map #'cl-rest results) method)))))) (callback closure ((callback closure ((errors) (results) (workspaces #1) (no-merge) (method . "textDocument/documentHighlight") (callback closure ((cleanup-hooks closure ((buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) nil (mapc #'(lambda (input0) (let* ((--dash-source-21-- input0) (hook (car-safe (prog1 --dash-source-21-- (setq --dash-source-21-- (cdr --dash-source-21--))))) (local --dash-source-21--)) (if local (if (buffer-live-p buf) (progn (save-current-buffer (set-buffer buf) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback) t)))) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback))))) hooks) (remhash cancel-token lsp--cancelable-requests)) (buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (&rest args) (save-current-buffer (set-buffer buf) (apply callback args))) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (result) (let* ((v (cons lsp--cur-workspace result))) (if (eq result :error) (setq errors (cons v errors)) (setq results (cons v results)))) (if (and (not (eq (length errors) (length workspaces))) (eq (+ (length errors) (length results)) (length workspaces))) (progn (funcall callback (if no-merge results (lsp--merge-results (-map #'cl-rest results) method)))))) (callback closure ((cleanup-hooks closure ((buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) nil (mapc #'(lambda (input0) (let* ((--dash-source-21-- input0) (hook (car-safe (prog1 --dash-source-21-- (setq --dash-source-21-- (cdr --dash-source-21--))))) (local --dash-source-21--)) (if local (if (buffer-live-p buf) (progn (save-current-buffer (set-buffer buf) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback) t)))) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback))))) hooks) (remhash cancel-token lsp--cancelable-requests)) (buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (&rest args) (save-current-buffer (set-buffer buf) (apply callback args))) (cleanup-hooks closure ((buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) nil (mapc #'(lambda (input0) (let* ((--dash-source-21-- input0) (hook (car-safe (prog1 --dash-source-21-- (setq --dash-source-21-- (cdr --dash-source-21--))))) (local --dash-source-21--)) (if local (if (buffer-live-p buf) (progn (save-current-buffer (set-buffer buf) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback) t)))) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback))))) hooks) (remhash cancel-token lsp--cancelable-requests)) (buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (result) (lsp--request-cleanup-hooks id) (funcall callback result)) (callback closure ((errors) (results) (workspaces #1) (no-merge) (method . "textDocument/documentHighlight") (callback closure ((cleanup-hooks closure ((buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) nil (mapc #'(lambda (input0) (let* ((--dash-source-21-- input0) (hook (car-safe (prog1 --dash-source-21-- (setq --dash-source-21-- (cdr --dash-source-21--))))) (local --dash-source-21--)) (if local (if (buffer-live-p buf) (progn (save-current-buffer (set-buffer buf) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback) t)))) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback))))) hooks) (remhash cancel-token lsp--cancelable-requests)) (buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (&rest args) (save-current-buffer (set-buffer buf) (apply callback args))) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (result) (let* ((v (cons lsp--cur-workspace result))) (if (eq result :error) (setq errors (cons v errors)) (setq results (cons v results)))) (if (and (not (eq (length errors) (length workspaces))) (eq (+ (length errors) (length results)) (length workspaces))) (progn (funcall callback (if no-merge results (lsp--merge-results (-map #'cl-rest results) method)))))) (callback closure ((cleanup-hooks closure ((buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) nil (mapc #'(lambda (input0) (let* ((--dash-source-21-- input0) (hook (car-safe (prog1 --dash-source-21-- (setq --dash-source-21-- (cdr --dash-source-21--))))) (local --dash-source-21--)) (if local (if (buffer-live-p buf) (progn (save-current-buffer (set-buffer buf) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback) t)))) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback))))) hooks) (remhash cancel-token lsp--cancelable-requests)) (buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (&rest args) (save-current-buffer (set-buffer buf) (apply callback args))) (cleanup-hooks closure ((buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) nil (mapc #'(lambda (input0) (let* ((--dash-source-21-- input0) (hook (car-safe (prog1 --dash-source-21-- (setq --dash-source-21-- (cdr --dash-source-21--))))) (local --dash-source-21--)) (if local (if (buffer-live-p buf) (progn (save-current-buffer (set-buffer buf) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback) t)))) (remove-hook hook (lsp--create-request-cancel id target-workspaces hook buf method cancel-callback))))) hooks) (remhash cancel-token lsp--cancelable-requests)) (buf . #<buffer sql.rs>) (hooks (kill-buffer-hook . t) (after-change-functions . t)) (id . 3) (method . "textDocument/documentHighlight") (start-time 24523 38044 371137 323000) (target-workspaces #1) (cancel-token . :highlights) (no-merge) (cancel-callback) (error-callback) (mode . tick) (callback . lsp--document-highlight-callback) (body :jsonrpc "2.0" :method "textDocument/documentHighlight" :params (:textDocument (:uri "file:///home/joerg/Projekte/firma/riafulon/builder/src/sql.rs") :position (:line 0 :character 0)) :id 3) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode company-backends t) (error) (funcall callback :error) (lsp--request-cleanup-hooks id) (funcall error-callback error)) "textDocument/documentHighlight" (24523 38044 371137 323000) (24523 38044 371236 17000)))) nil #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("rls.run" lsp-rust--rls-run)) (rust-mode rustic-mode) nil -1 rls nil ((omitInitBuild . t) (cmdRun . t)) nil #[257 "�\207" [lsp-rust-library-directories] 2 "

(fn WORKSPACE)"] nil #[257 "\211�\301\302\303!!)\207" [lsp--cur-workspace lsp--set-configuration lsp-configuration-section "rust"] 4 "

(fn WORKSPACE)"] nil nil nil nil nil nil #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) nil nil nil) nil #<process rls> #<process rls> (#<buffer sql.rs>) nil nil nil initialized #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) nil 0 nil nil #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ()) #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ())))

Does the detection of a not available feature happen after the first request? Must the function get unbound from the hook when this happens?

@yyoncho
Copy link
Member

yyoncho commented Dec 5, 2020

This is the return value of (lsp-feature? "textDocument/documentHighlight"):

This means that highlights are supported.

Does the detection of a not available feature happen after the first request? Must the function get unbound from the hook when this happens?

Can you elaborate?

I am interested in the value of (lsp-workspaces) when the issue happens. I suspect that we somehow subscribe the hook with the feature available and then somehow the hook runs in a buffer withtout language server connection. But I was unable to find a reproducer for the issue.

@jo-so
Copy link
Author

jo-so commented Dec 6, 2020

This case is very difficult, but after a long research I've got all pieces together. The core of the problem is desktop-save-mode. In desktop-restore-file-buffer it does:

	(let* ((auto-insert nil) ; Disable auto insertion
	       (coding-system-for-read
		(or coding-system-for-read
		    (cdr (assq 'buffer-file-coding-system
			       desktop-buffer-locals))))
	       (buf (find-file-noselect buffer-filename :nowarn)))
	  (condition-case nil
	      (switch-to-buffer buf)
	    (error (pop-to-buffer buf)))
	  (and (not (eq major-mode desktop-buffer-major-mode))
	       (functionp desktop-buffer-major-mode)
	       (funcall desktop-buffer-major-mode))

It opens the file and if the major-mode do not match the saved major mode, it switches. A few weeks ago, I've installed rustic-mode and lsp-mode via package-list-packages. Rustic sets itself as the major mode for rs files and starts lsp on startup. Some of my open buffers are still using rust-mode. Hence, desktop-mode reopens a file that triggers rustic and lsp. Lsp starts the rls and sets the buffer local variable lsp--buffer-workspaces. But because the major mode mismatch desktop-mode switches to rust-mode and this calls (prog-modefundamental-mode →) kill-all-local-variables which removes lsp--buffer-workspaces, while the timer stay active. And the rest of the story is obvious: the timer gets triggered, pulls lsp--buffer-workspaces and ends with error in lsp--send-request-async.

At least, I would suggest the following change to detect such missettings, but I'm not really familiar with Emacs and would hope there's a hook where lsp can get a message to unset it's timer or bind the timer to a local variable that becomes killed, too.

diff --git i/lsp-mode.el w/lsp-mode.el
index 8d0d5e99..b7b9c2cd 100644
--- i/lsp-mode.el
+++ w/lsp-mode.el
@@ -4284,6 +4284,7 @@ Added to `after-change-functions'."
              (equal buffer (current-buffer))
              (not lsp-inhibit-lsp-hooks)
              lsp-managed-mode)
+    (lsp--cur-workspace-check)
     (run-hooks 'lsp-on-idle-hook)))
 
 (defun lsp--on-change-debounce (buffer)

@yyoncho
Copy link
Member

yyoncho commented Dec 6, 2020

Thank you, this is was a really tricky thing to find!

It seems to me that we should use change-major-mode-hook which is called in kill-all-local-variables to call lsp-disconnect.

@jo-so
Copy link
Author

jo-so commented Dec 8, 2020

What do you think about this change? Is it right?

diff --git i/lsp-mode.el w/lsp-mode.el
index 63fafe02..dbc63036 100644
--- i/lsp-mode.el
+++ w/lsp-mode.el
@@ -4284,6 +4284,7 @@ Added to `after-change-functions'."
              (equal buffer (current-buffer))
              (not lsp-inhibit-lsp-hooks)
              lsp-managed-mode)
+    (lsp--cur-workspace-check)
     (run-hooks 'lsp-on-idle-hook)))
 
 (defun lsp--on-change-debounce (buffer)
@@ -7820,6 +7821,7 @@ argument ask the user to select which language server to start."
                         (lsp--try-project-root-workspaces (equal arg '(4))
                                                           (and arg (not (equal arg 1))))))
           (lsp-mode 1)
+          (add-hook 'change-major-mode-hook 'lsp-disconnect t t)
           (when lsp-auto-configure (lsp--auto-configure))
           (setq lsp-buffer-uri (lsp--buffer-uri))
           (lsp--info "Connected to %s."

@yyoncho
Copy link
Member

yyoncho commented Dec 8, 2020

Looks good to me. I would put it in lsp-managed-mode and add also remove-hook when lsp-managed mode is turned off.

@yyoncho
Copy link
Member

yyoncho commented Dec 15, 2020

Pushed a fix. Please let me know if it works. Thank you for your analysis once again, it was really helpful.

@spacekitteh
Copy link

I'm getting this error with Haskell. It works fine on the first .hs file I open, but every other .hs file in the workspace after that first one, I get this error. I don't use desktop-save-mode, btw.

@yyoncho
Copy link
Member

yyoncho commented Jan 1, 2021

I'm getting this error with Haskell. It works fine on the first .hs file I open, but every other .hs file in the workspace after that first one, I get this error. I don't use desktop-save-mode, btw.

are you on the latest melpa version?

@spacekitteh
Copy link

Yep.

@jo-so
Copy link
Author

jo-so commented Jan 2, 2021

@spacekitteh I've written up my research for the cause of this bug. https://jo-so.de/2020-12/Emacs-CPU-Verbrauch.html#verbrauchersucheimemacs Maybe you can use a translator to read it. In the end, I used this code in my init.el to analyze what's happening. This creates large logs, so maybe only use lsp-mode in one buffer.

(require 'lsp-mode)
(with-eval-after-load 'lsp-mode
  (let ((trace-buf "*trace*")
        (ctx
         (lambda ()
           (format
            " <+<%s|+|%s|+|%s|+|%s|+|%s>+>"
            (buffer-name)
            (local-variable-p 'lsp--cur-workspace)
            (local-variable-p 'lsp--buffer-workspaces)
            lsp--cur-workspace lsp--buffer-workspaces)))
        (watcher
         (lambda (symbol newval operation where)
          (let ((buf (buffer-name)))
            (with-current-buffer "*trace*"
              (goto-char (point-max))
              (insert (format "==>> %s|-|%s|-|%s|-|%s|-|%s|-|%s\n"
                              buf where symbol
                              (local-variable-p symbol)
                              operation (if newval "*val*")))
              ;; (when (and (not (string-match-p "\.rs$" buf))
              ;;            )
              ;;   (error "open back trace 1"))
              ))
          ;; (when (string= operation "makunbound")
          ;;   (error "open back trace 2"))
          ;; (when (and (eq symbol 'lsp--buffer-workspaces)
          ;;            (string= operation "set")
          ;;            (if newval t))
          ;;   (error "open back trace 3"))
          ))
        )

    (get-buffer-create trace-buf)

    (trace-function-background 'lsp-feature? trace-buf ctx)
    (trace-function-background 'lsp--find-workspaces-for trace-buf ctx)
    (add-variable-watcher 'lsp--cur-workspace watcher)
    (add-variable-watcher 'lsp--buffer-workspaces watcher)
    ))

@nbfalcon
Copy link
Member

nbfalcon commented Jan 2, 2021

@spacekitteh do you use lsp-lens-mode? It breaks in empty haskell files, and the error might prevent lsp-mode from initializing properly (#2441). Can you try the following and see if it fixes your problem?

(advice-add 'lsp-lens-mode :around 'ignore) ; NOTE: prevents lsp-lens-mode from turning on
(advice-remove 'lsp-lens-mode 'ignore) ; undo the effects later

@spacekitteh
Copy link

I don't, but I tried anyway, and that didn't fix it (also, the files I'm opening aren't empty).

@yyoncho
Copy link
Member

yyoncho commented Jan 3, 2021

@spacekitteh are you able to reproduce with lsp-start-plain.el? If yes, can you give us exact steps to reproduce?

@nbfalcon
Copy link
Member

nbfalcon commented Jan 4, 2021

@spacekitteh try removing the haskell workspace and adding it again: M-x lsp-workspace-folders-remove followed by M-x lsp.

@spacekitteh
Copy link

spacekitteh commented Jan 4, 2021

@spacekitteh try removing the haskell workspace and adding it again: M-x lsp-workspace-folders-remove followed by M-x lsp.

That didn't work. I did notice this though:

LSP :: Connected to [lsp-haskell:1672 status:starting].
Error processing message (void-function lsp-headerline-breadcrumb-mode). [2 times]

and

Error running timer: (void-function lsp-headerline-breadcrumb-mode)
Error running timer ‘lsp--on-idle’: (error "The connected server(s) does not support method textDocument/documentHighlight.

@spacekitteh
Copy link

@spacekitteh are you able to reproduce with lsp-start-plain.el? If yes, can you give us exact steps to reproduce?

I'll try in the next few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants