30
30
:link '(url-link " https://github.com/microsoft/vscode/tree/main/extensions/html-language-features/server" )
31
31
:package-version '(lsp-mode . " 6.1" ))
32
32
33
- (defcustom lsp-html-experimental- custom-data nil
33
+ (defcustom lsp-html-custom-data []
34
34
" A list of JSON file paths that define custom tags, properties and other HTML
35
- syntax constructs. Only workspace folder setting will be read."
36
- :type '(choice (const nil ) string)
35
+ syntax constructs. Only workspace folder setting will be read.
36
+ All json file paths should be relative to your workspace folder."
37
+ :type 'lsp-repeatable-vector
37
38
:group 'lsp-html
38
- :package-version '(lsp-mode . " 6 .1" ))
39
+ :package-version '(lsp-mode . " 8.0 .1" ))
39
40
40
41
(defcustom lsp-html-format-enable t
41
42
" Enable/disable default HTML formatter."
@@ -137,6 +138,18 @@ styles."
137
138
:group 'lsp-html
138
139
:package-version '(lsp-mode . " 6.1" ))
139
140
141
+ (defcustom lsp-html-hover-documentation t
142
+ " Whether to show documentation strings on hover or not."
143
+ :type 'boolean
144
+ :group 'lsp-html
145
+ :package-version '(lsp-mode . " 8.0.1" ))
146
+
147
+ (defcustom lsp-html-hover-references t
148
+ " Whether to show MDN references in documentation popups."
149
+ :type 'boolean
150
+ :group 'lsp-html
151
+ :package-version '(lsp-mode . " 8.0.1" ))
152
+
140
153
(defcustom lsp-html-trace-server " off"
141
154
" Traces the communication between VS Code and the HTML language server."
142
155
:type '(choice
@@ -163,14 +176,24 @@ styles."
163
176
(" html.format.unformatted" lsp-html-format-unformatted)
164
177
(" html.format.wrapLineLength" lsp-html-format-wrap-line-length)
165
178
(" html.format.enable" lsp-html-format-enable t )
166
- (" html.experimental.customData" lsp-html-experimental-custom-data)))
179
+ (" html.hover.documentation" lsp-html-hover-documentation t )
180
+ (" html.hover.references" lsp-html-hover-references t )
181
+ (" html.customData" lsp-html-custom-data)))
167
182
168
183
(defcustom lsp-html-server-command-args '(" --stdio" )
169
184
" Command to start html-languageserver."
170
185
:type '(repeat string)
171
186
:group 'lsp-html
172
187
:package-version '(lsp-mode . " 6.3" ))
173
188
189
+ ; ; Caveat: uri seems to be sent as a single length vector.
190
+ (defun lsp-html--get-content (_workspace files callback )
191
+ " Helper function for getting the content of a URI/filename."
192
+ (let* ((filename (aref files 0 ))
193
+ (uri (f-join (lsp-workspace-root) filename))
194
+ (file-content (f-read-text uri)))
195
+ (funcall callback file-content)))
196
+
174
197
(lsp-dependency 'html-language-server
175
198
'(:system " vscode-html-language-server" )
176
199
'(:npm :package " vscode-langservers-extracted"
@@ -185,6 +208,9 @@ styles."
185
208
:priority -4
186
209
:completion-in-comments? t
187
210
:server-id 'html-ls
211
+ :initialization-options (lambda ()
212
+ (list :dataPaths lsp-html-custom-data))
213
+ :async-request-handlers (ht (" html/customDataContent" #'lsp-html--get-content ))
188
214
:initialized-fn (lambda (w )
189
215
(with-lsp-workspace w
190
216
(lsp--set-configuration
0 commit comments