Skip to content

Commit f7026e5

Browse files
committed
plugin/emacs: add lsp-quicklintjs Emacs command
Unlike M-x lsp, M-x lsp-quicklintjs doesn't prompt for a root folder. It does this by always before calling (lsp) saving on its own state file the buffer default directory as a project root. Signed-off-by: wagner riffel <[email protected]>
1 parent c2149fc commit f7026e5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

plugin/emacs/lsp-quicklintjs.el

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,21 @@
4343
(require 'lsp-mode)
4444
(require 'quicklintjs)
4545

46+
;;;###autoload
47+
(defun lsp-quicklintjs ()
48+
"Like `lsp', but set root folder to `default-directory' to avoid project root\
49+
prompts."
50+
(interactive)
51+
;; Don't mess with user's session state file
52+
(set (make-local-variable 'lsp-session-file)
53+
(expand-file-name (locate-user-emacs-file
54+
".lsp-quicklintjs-session-v1")))
55+
(let* ((session (lsp-session)))
56+
(cl-pushnew (expand-file-name default-directory)
57+
(lsp-session-folders session) :test 'equal)
58+
(lsp--persist-session session))
59+
(lsp))
60+
4661
;;;###autoload
4762
(with-eval-after-load 'lsp-mode
4863
(lsp-register-client

0 commit comments

Comments
 (0)