Skip to content

Commit 9292d7d

Browse files
authored
feat(cmake/nginx): Support auto install lanugage server (#4273)
1 parent abe41f1 commit 9292d7d

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

clients/lsp-cmake.el

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;;; lsp-cmake.el --- description -*- lexical-binding: t; -*-
22

3-
;; Copyright (C) 2020 emacs-lsp maintainers
3+
;; Copyright (C) 2020-2023 emacs-lsp maintainers
44

55
;; Author: emacs-lsp maintainers
66
;; Keywords: lsp, cmake
@@ -37,13 +37,24 @@
3737
:group 'lsp-cmake
3838
:package-version '(lsp-mode . "8.0.1"))
3939

40+
(defun lsp-cmake--download-server (_client callback error-callback update?)
41+
"Install/update CMake language server using `pip
42+
43+
Will invoke CALLBACK or ERROR-CALLBACK based on result.
44+
Will update if UPDATE? is t."
45+
(lsp-async-start-process
46+
callback
47+
error-callback
48+
"pip" "install" "cmake-language-server" (when update? "-U")))
49+
4050
(lsp-register-client
4151
(make-lsp-client :new-connection (lsp-stdio-connection
4252
(lambda ()
4353
lsp-cmake-server-command))
4454
:activation-fn (lsp-activate-on "cmake")
4555
:priority -1
46-
:server-id 'cmakels))
56+
:server-id 'cmakels
57+
:download-server-fn #'lsp-cmake--download-server))
4758

4859
(lsp-consistency-check lsp-cmake)
4960

clients/lsp-nginx.el

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;;; lsp-nginx.el --- Nginx Client settings -*- lexical-binding: t; -*-
22

3-
;; Copyright (C) 2021 Shen, Jen-Chieh
3+
;; Copyright (C) 2021-2023 Shen, Jen-Chieh
44

55
;; Author: Jen-Chieh Shen <[email protected]>
66
;; Keywords: nginx lsp
@@ -40,12 +40,23 @@
4040
:type '(repeat string)
4141
:package-version `(lsp-mode . "8.0.1"))
4242

43+
(defun lsp-nginx--download-server (_client callback error-callback update?)
44+
"Install/update Nginx language server using `pip
45+
46+
Will invoke CALLBACK or ERROR-CALLBACK based on result.
47+
Will update if UPDATE? is t."
48+
(lsp-async-start-process
49+
callback
50+
error-callback
51+
"pip" "install" "nginx-language-server" (when update? "-U")))
52+
4353
(lsp-register-client
4454
(make-lsp-client :new-connection (lsp-stdio-connection
4555
(lambda () lsp-nginx-server-command))
4656
:major-modes '(nginx-mode)
4757
:priority -1
48-
:server-id 'nginx-ls))
58+
:server-id 'nginx-ls
59+
:download-server-fn #'lsp-nginx--download-server))
4960

5061
(lsp-consistency-check lsp-nginx)
5162

0 commit comments

Comments
 (0)