emacs: LSP doesn't clean up its own mess

Signed-off-by: magic_rb <magic_rb@redalder.org>
This commit is contained in:
magic_rb 2024-11-09 22:15:03 +01:00
parent bf78a7d618
commit 941df7e990
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E

View file

@ -17,6 +17,24 @@ Disable server downloading suggestions, and other features.
lsp-enable-on-type-formatting nil)
#+end_src
Sometimes LSP mode failes to clean up after itself, so clean up its mess.
#+begin_src emacs-lisp
(defun vherrmann/cleanup-lsp-mode-post-command-hook()
"Cleans up lsp-modes mess."
(when (bound-and-true-p lsp-mode)
(setq-default post-command-hook
(--filter (not (and (consp it)
(eq (car it) 'closure)
(not (-difference
'(cancel-callback method buf hook workspaces id)
(-map #'car (cadr it))))))
(default-value 'post-command-hook)))))
(add-hook 'kill-buffer-hook #'vherrmann/cleanup-lsp-mode-post-command-hook)
#+end_src
* Python
Using the Microsoft language server as it's the best afaik. It's weird because it doesn't lookup the path to itself via PATH but has to be statically set.