@@ -284,7 +284,7 @@ function! s:align_preview(options) abort
284
284
endif
285
285
endfunction
286
286
287
- function ! lsp#ui#vim#output#preview (data, options ) abort
287
+ function ! lsp#ui#vim#output#preview (server, data, options ) abort
288
288
if s: winid && type (s: preview_data ) == type (a: data )
289
289
\ && s: preview_data == a: data
290
290
\ && type (g: lsp_preview_doubletap ) == 3
@@ -302,12 +302,22 @@ function! lsp#ui#vim#output#preview(data, options) abort
302
302
303
303
let s: preview_data = a: data
304
304
let l: lines = []
305
- let l: ft = s: append (a: data , l: lines )
305
+ let l: syntax_lines = []
306
+ let l: ft = s: append (a: data , l: lines , l: syntax_lines )
306
307
307
308
if has_key (a: options , ' filetype' )
308
309
let l: ft = a: options [' filetype' ]
309
310
endif
310
311
312
+ let l: server_info = lsp#get_server_info (a: server )
313
+ try
314
+ let l: do_conceal = l: server_info [' config' ][' hover_conceal' ]
315
+ catch
316
+ let l: do_conceal = g: lsp_hover_conceal
317
+ endtry
318
+
319
+ call setbufvar (winbufnr (s: winid ), ' lsp_syntax_highlights' , l: syntax_lines )
320
+ call setbufvar (winbufnr (s: winid ), ' lsp_do_conceal' , l: do_conceal )
311
321
call s: setcontent (l: lines , l: ft )
312
322
313
323
" Get size information while still having the buffer active
@@ -361,10 +371,10 @@ function! lsp#ui#vim#output#preview(data, options) abort
361
371
return ' '
362
372
endfunction
363
373
364
- function ! s: append (data, lines ) abort
374
+ function ! s: append (data, lines , syntax_lines ) abort
365
375
if type (a: data ) == type ([])
366
376
for l: entry in a: data
367
- call s: append (entry, a: lines )
377
+ call s: append (entry, a: lines, a: syntax_lines )
368
378
endfor
369
379
370
380
return ' markdown'
@@ -373,9 +383,15 @@ function! s:append(data, lines) abort
373
383
374
384
return ' markdown'
375
385
elseif type (a: data ) == type ({}) && has_key (a: data , ' language' )
376
- call add (a: lines , ' ```' .a: data .language )
377
- call extend (a: lines , split (a: data .value, ' \n' ))
378
- call add (a: lines , ' ```' )
386
+ let l: new_lines = split (a: data .value, ' \n' )
387
+
388
+ let l: i = 1
389
+ while l: i <= len (l: new_lines )
390
+ call add (a: syntax_lines , { ' line' : len (a: lines ) + l: i , ' language' : a: data .language })
391
+ let l: i += 1
392
+ endwhile
393
+
394
+ call extend (a: lines , l: new_lines )
379
395
380
396
return ' markdown'
381
397
elseif type (a: data ) == type ({}) && has_key (a: data , ' kind' )
0 commit comments