This repository has been archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlsp-volar.el
121 lines (100 loc) · 4.51 KB
/
lsp-volar.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
;;; lsp-volar.el --- description -*- lexical-binding: t; -*-
;; Copyright (C) 2021 Yuta Fujita
;; Author: Yuta Fujita <ofnhwx@komunan.net>
;; Keywords: lsp, languages
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; lsp-volar client
;;; Code:
(require 'lsp-mode)
(defgroup lsp-volar nil
"Volar language server group."
:group 'lsp-mode
:link '(url-link "https://github.com/johnsoncodehk/volar"))
(lsp-dependency 'volar-server
'(:system "volar-server")
'(:npm :package "@volar/server" :path "volar-server"))
(lsp-register-custom-settings
'(("volar.typescript.serverPath" (lambda ()
(expand-file-name "node_modules/typescript/lib/tsserverlibrary.js"
(lsp-workspace-root))))
("volar-api.languageFeatures.callHierarchy" t t)
("volar-api.languageFeatures.codeAction" t t)
("volar-api.languageFeatures.completion.getDocumentNameCasesRequest" nil t)
("volar-api.languageFeatures.completion.getDocumentSelectionRequest" nil t)
("volar-api.languageFeatures.completions.defaultAttrNameCase" "kebabCase")
("volar-api.languageFeatures.completions.defaultTagNameCase" "both")
("volar-api.languageFeatures.definition" t t)
("volar-api.languageFeatures.hover" t t)
("volar-api.languageFeatures.references" t t)
("volar-api.languageFeatures.rename" t t)
("volar-api.languageFeatures.renameFileRefactoring" t t)
("volar-api.languageFeatures.schemaRequestService" t t)
("volar-api.languageFeatures.signatureHelp" t t)
("volar-api.languageFeatures.typeDefinition" t t)
("volar-api.languageFeatures.workspaceSymbol" t t)
("volar-doc.languageFeatures.codeLens" t t)
("volar-doc.languageFeatures.diagnostics" t t)
("volar-doc.languageFeatures.documentHighlight" t t)
("volar-doc.languageFeatures.documentLink" t t)
("volar-doc.languageFeatures.semanticTokens" t t)
("volar-html.documentFeatures.documentColor" t t)
("volar-html.documentFeatures.selectionRange" t t)
("volar-html.documentFeatures.foldingRange" t t)
("volar-html.documentFeatures.linkedEditingRange" t t)
("volar-html.documentFeatures.documentSymbol" t t)
("volar-html.documentFeatures.documentFormatting.defaultPrintWidth" 100)
("volar-html.documentFeatures.documentFormatting.getDocumentPrintWidthRequest" nil t)
))
(defun volar-api-options ()
(ht-merge (ht-get (lsp-configuration-section "volar") "volar")
(ht-get (lsp-configuration-section "volar-api") "volar-api")))
(defun volar-doc-options ()
(ht-merge (ht-get (lsp-configuration-section "volar") "volar")
(ht-get (lsp-configuration-section "volar-doc") "volar-doc")))
(defun volar-html-options ()
(ht-merge (ht-get (lsp-configuration-section "volar") "volar")
(ht-get (lsp-configuration-section "volar-html") "volar-html")))
(defun volar-new-connection ()
(cons (lsp-package-path 'volar-server)
'("--stdio")))
(defun volar-download-server-fn (_client callback error-callback _update?)
(lsp-package-ensure 'volar-server
callback error-callback))
(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection 'volar-new-connection)
:major-modes '(vue-mode)
:server-id 'volar-api
:multi-root t
:initialization-options 'volar-api-options
:download-server-fn 'volar-download-server-fn))
(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection 'volar-new-connection)
:major-modes '(vue-mode)
:server-id 'volar-doc
:multi-root t
:add-on? t
:initialization-options 'volar-doc-options
:download-server-fn 'volar-download-server-fn))
(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection 'volar-new-connection)
:major-modes '(vue-mode)
:server-id 'volar-html
:multi-root t
:add-on? t
:initialization-options 'volar-html-options
:download-server-fn 'volar-download-server-fn))
(provide 'lsp-volar)
;;; lsp-volar.el ends here