From 1778b26ba4a9b10ee501868f2bd74252564276c6 Mon Sep 17 00:00:00 2001 From: Ravi R Kiran Date: Fri, 23 Apr 2021 11:15:16 -0500 Subject: Want to specify lsp parameters via local variables 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 "" 'newline-and-indent python-mode-map) -- cgit v0.10.1