doomemacs / doomemacs

An Emacs framework for the stubborn martian hacker
MIT License
19.48k stars 3.06k forks source link

[BUG] Cannot restart lsp workspace: void-function #1965

Closed liaowang11 closed 5 years ago

liaowang11 commented 5 years ago

Describe the issue Running lsp-workspace-restart dumps errors:

LSP :: Restarting rust-analyzer:49832
Error running timer: (void-function \(setf\ lsp--workspace-shutdown-action\))
Debugger entered--Lisp error: (void-function \(setf\ lsp--workspace-shutdown-action\))
  (\(setf\ lsp--workspace-shutdown-action\) nil v)
  (let* ((v lsp--cur-workspace)) (\(setf\ lsp--workspace-shutdown-action\) nil v))
  (if (lsp--workspace-buffers lsp--cur-workspace) (let* ((v lsp--cur-workspace)) (\(setf\ lsp--workspace-shutdown-action\) nil v)) (funcall orig-fn))
  (let ((lsp--cur-workspace workspace)) (if (lsp--workspace-buffers lsp--cur-workspace) (let* ((v lsp--cur-workspace)) (\(setf\ lsp--workspace-shutdown-action\) nil v)) (funcall orig-fn)))
  (closure ((orig-fn . #f(compiled-function () #)) t) (workspace) (let ((lsp--cur-workspace workspace)) (if (lsp--workspace-buffers lsp--cur-workspace) (let* ((v lsp--cur-workspace)) (\(setf\ lsp--workspace-shutdown-action\) nil v)) (funcall orig-fn))))(#s(lsp--workspace :parser #s(lsp--parser :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "" :workspace #1) :server-capabilities # :registered-server-capabilities nil :root "/Users/wliao/Documents/Fiddle/rust/grrs/" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name) #) :test\? #f(compiled-function () #)) :ignore-regexps nil :ignore-messages nil :notification-handlers # :request-handlers # :response-handlers # :prefix-function nil :uri-handlers # :action-handlers # :major-modes (rust-mode rustic-mode) :activation-fn nil :priority 1 :server-id rust-analyzer :multi-root nil :initialization-options nil :custom-capabilities nil :library-folders-fn nil :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil :path->uri-fn nil :uri->path-fn nil) :host-root nil :proc # :cmd-proc # :buffers (#) :highlight-overlays # :semantic-highlighting-faces nil :extra-client-capabilities nil :status initialized :metadata # :watches # :workspace-folders nil :last-id 0 :status-string nil :shutdown-action restart :diagnostics # :ewoc nil))
  apply((closure ((orig-fn . #f(compiled-function () #)) t) (workspace) (let ((lsp--cur-workspace workspace)) (if (lsp--workspace-buffers lsp--cur-workspace) (let* ((v lsp--cur-workspace)) (\(setf\ lsp--workspace-shutdown-action\) nil v)) (funcall orig-fn)))) #s(lsp--workspace :parser #s(lsp--parser :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "" :workspace #2) :server-capabilities # :registered-server-capabilities nil :root "/Users/wliao/Documents/Fiddle/rust/grrs/" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name) #) :test\? #f(compiled-function () #)) :ignore-regexps nil :ignore-messages nil :notification-handlers # :request-handlers # :response-handlers # :prefix-function nil :uri-handlers # :action-handlers # :major-modes (rust-mode rustic-mode) :activation-fn nil :priority 1 :server-id rust-analyzer :multi-root nil :initialization-options nil :custom-capabilities nil :library-folders-fn nil :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil :path->uri-fn nil :uri->path-fn nil) :host-root nil :proc # :cmd-proc # :buffers (#) :highlight-overlays # :semantic-highlighting-faces nil :extra-client-capabilities nil :status initialized :metadata # :watches # :workspace-folders nil :last-id 0 :status-string nil :shutdown-action restart :diagnostics # :ewoc nil))
  timer-event-handler([t 23989 41270 837403 nil (closure ((orig-fn . #f(compiled-function () #)) t) (workspace) (let ((lsp--cur-workspace workspace)) (if (lsp--workspace-buffers lsp--cur-workspace) (let* ((v lsp--cur-workspace)) (\(setf\ lsp--workspace-shutdown-action\) nil v)) (funcall orig-fn)))) (#s(lsp--workspace :parser #s(lsp--parser :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "" :workspace #3) :server-capabilities # :registered-server-capabilities nil :root "/Users/wliao/Documents/Fiddle/rust/grrs/" :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name) #) :test\? #f(compiled-function () #)) :ignore-regexps nil :ignore-messages nil :notification-handlers # :request-handlers # :response-handlers # :prefix-function nil :uri-handlers # :action-handlers # :major-modes (rust-mode rustic-mode) :activation-fn nil :priority 1 :server-id rust-analyzer :multi-root nil :initialization-options nil :custom-capabilities nil :library-folders-fn nil :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil :path->uri-fn nil :uri->path-fn nil) :host-root nil :proc # :cmd-proc # :buffers (#) :highlight-overlays # :semantic-highlighting-faces nil :extra-client-capabilities nil :status initialized :metadata # :watches # :workspace-folders nil :last-id 0 :status-string nil :shutdown-action restart :diagnostics # :ewoc nil)) nil 0])

Most likely related to this:

  (defadvice! +lsp-defer-server-shutdown-a (orig-fn)
    "Defer server shutdown for a few seconds.
This gives the user a chance to open other project files before the server is
auto-killed (which is usually an expensive process)."
    :around #'lsp--shutdown-workspace
    (if lsp-keep-workspace-alive
        (funcall orig-fn)
      (when (timerp +lsp--deferred-shutdown-timer)
        (cancel-timer +lsp--deferred-shutdown-timer))
      (setq +lsp--deferred-shutdown-timer
            (run-at-time
             3 nil (lambda (workspace)
                     (let ((lsp--cur-workspace workspace))
                       (if (lsp--workspace-buffers lsp--cur-workspace)
                           (setf (lsp--workspace-shutdown-action lsp--cur-workspace) nil)
                         (funcall orig-fn))))
             lsp--cur-workspace))))

Steps to reproduce

  1. Start lsp
  2. M-x lsp-workspace-restart
  3. Wait and watch for errors.

System Info

``` emacs version 26.3 features NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS LCMS2 build Sep 01, 2019 buildopts (--enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs-mac/emacs-26.3-z-mac-7.7/share/info/emacs --prefix=/usr/local/Cellar/emacs-mac/emacs-26.3-z-mac-7.7 --with-mac --enable-mac-app=/usr/local/Cellar/emacs-mac/emacs-26.3-z-mac-7.7 --with-gnutls --with-modules) windowsys mac daemonp server-running doom version 2.0.9 build HEAD -> develop, origin/develop f6df21954 2019-10-26 02:13:40 -0400 system type darwin config x86_64-apple-darwin18.7.0 shell /usr/local/bin/fish uname Darwin 19.0.0 Darwin Kernel Version 19.0.0: Wed Sep 25 20:18:50 PDT 2019; root:xnu-6153.11.26~2/RELEASE_X86_64 x86_64 path (~/.cargo/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /Library/Apple/usr/bin /Library/Apple/bin /Library/Frameworks/Mono.framework/Versions/Current/Commands /Applications/Wireshark.app/Contents/MacOS /usr/local/Cellar/emacs-mac/emacs-26.3-z-mac-7.7/libexec/emacs/26.3/x86_64-apple-darwin18.7.0) config envfile envvar-file elc-files 0 modules (:completion company (ivy +fuzzy +icons) :ui doom doom-dashboard doom-quit hl-todo modeline nav-flash ophints (popup +all +defaults) (pretty-code +iosevka) treemacs vc-gutter vi-tilde-fringe window-select workspaces :editor (evil +everywhere) file-templates fold format lispy multiple-cursors rotate-text snippets word-wrap :emacs (dired +ranger +icons) electric vc :term eshell term :tools ansible docker editorconfig ein eval flycheck flyspell gist (lookup +docsets) lsp macos magit make rgb tmux upload :lang clojure crystal data elm emacs-lisp (go +lsp) (haskell +intero) java (javascript +lsp) markdown (org +dragndrop +hugo +ipython +pandoc +present) plantuml (python +ipython +lsp) rest (ruby +lsp) (rust +lsp) (scala +lsp) (sh +fish) web :config (default +bindings +smartparens) personal) packages (n/a) elpa (n/a) ```
hlissner commented 5 years ago

Please include your M-x doom/info

liaowang11 commented 5 years ago

Please include your M-x doom/info

Updated

hlissner commented 5 years ago

As of 196c716 this should be resolved. Let me know if that isn't the cause and I'll reopen the issue. Thanks for bringing it to my attention!