Open betaprior opened 3 years ago
I am having a similar problem.
On a similar platform: Spacemacs (devel), lsp-python with pyright on Linux (fedora-34)
Question As a temporary workaround, is there a way to manually erase the bad entry? (or simply all entries?)
lsp-workspace-folders-remove
How does one invoke that effectively? In this case I have several project roots missing, so do I have to go through them and clean them up?
Or delete lsp-session-file before starting emacd
I worked around this myself:
(defun offby1/lsp-workspace-remove-missing-projects ()
(interactive)
(dolist (dead-project (seq-filter (lambda (x) (not (file-directory-p x))) (lsp-session-folders (lsp-session))))
(lsp-workspace-folders-remove dead-project)))
Question As a temporary workaround, is there a way to manually erase the bad entry? (or simply all entries?)
Using lsp-workspace-folders-remove
for this wasn't possible in my case as the bad entry wasn't available there. Instead, I was able to remove that entry by checking the value of lsp-session-file
and then, with emacs and lsp closed, manually editing that file to remove the bad entry.
Thank you for the bug report
lsp-mode
related packages.where
lsp-start-plain.el
can be downloaded here.Bug description
After renaming a directory containing the source file, LSP throws errors on startup:
This path shows up when I do
M-x lsp-describe-session
and there appears to be no way of deleting it. Elsewhere on the internet, it is suggested to delete the session cache file and restart Emacs ([https://www.baozi.technology/spacemacs-fixing-lsp-mode-whining-about-not-finding-your-directory](see here)), but surely you don't expect users to restart emacs after doing some minor file operations!Steps to reproduce
Consider a simple python project with a single file, edited w/ the help of LSP, e.g.
/tmp/foo/main.py
. Close the file, then in a terminalmv foo bar
, and open/tmp/bar/main.py
. LSP will complain about the missing file.Expected behavior
Defunct/missing directories to be cleaned up automatically, or at least offer the user the option of removing the defunct directory from whatever session cache it is stored in.
Which Language Server did you use?
lsp-python with pyright
OS
Linux
Error callstack
Anything else?
No response