summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ravi-init-lsp.el9
-rw-r--r--lisp/ravi-init-python.el2
2 files changed, 7 insertions, 4 deletions
diff --git a/lisp/ravi-init-lsp.el b/lisp/ravi-init-lsp.el
index dc41f98..2bf105a 100644
--- a/lisp/ravi-init-lsp.el
+++ b/lisp/ravi-init-lsp.el
@@ -30,9 +30,12 @@
(use-package lsp-mode
:init
(setq lsp-keymap-prefix "H-l")
- :hook ((c-mode-hook . lsp-deferred)
- (c++-mode-hook . lsp-deferred)
- ;; (python-mode . lsp-deferred)
+ (defun ravi/add-lsp-with-local-variables ()
+ ;; The t at the end is to make hack-local-variables-hook buffer-local
+ (add-hook 'hack-local-variables-hook 'lsp-deferred 0 t))
+ :hook ((c-mode-hook . ravi/add-lsp-with-local-variables)
+ (c++-mode-hook . ravi/add-lsp-with-local-variables)
+ ;; (python-mode . ravi/add-lsp-with-local-variables)
(lsp-mode-hook . lsp-enable-which-key-integration))
:commands (lsp lsp-deferred)
:bind (:map lsp-mode-map
diff --git a/lisp/ravi-init-python.el b/lisp/ravi-init-python.el
index 154cfdc..3878db3 100644
--- a/lisp/ravi-init-python.el
+++ b/lisp/ravi-init-python.el
@@ -66,7 +66,7 @@
in-site-lisp)))
(when (file-exists-p pyright-executable)
(lsp-dependency 'pyright `(:system ,pyright-executable))))
- (lsp-deferred))
+ (ravi/add-lsp-with-local-variables))
:hook (python-mode-hook . ravi/start-lsp-pyright))
(bind-key "<return>" 'newline-and-indent python-mode-map)