@@ -113,6 +113,11 @@ This only takes effect when `lsp-ui-doc-position' is 'top or 'bottom."
113
113
:type 'integer
114
114
:group 'lsp-ui-doc )
115
115
116
+ (defcustom lsp-ui-doc-webkit-max-width-px 600
117
+ " Maximum width in pixels for the webkit frame."
118
+ :type 'integer
119
+ :group 'lsp-ui-doc )
120
+
116
121
(defcustom lsp-ui-doc-max-height 13
117
122
" Maximum number of lines in the frame."
118
123
:type 'integer
@@ -305,7 +310,9 @@ Because some variables are buffer local.")
305
310
(markdown-hr-display-char nil ))
306
311
(cond
307
312
(lsp-ui-doc-use-webkit
308
- (if (and language (not (string= " text" language)))
313
+ (if (and language
314
+ (not (string= " text" language))
315
+ (not (string= lsp/markup-kind-markdown language)))
309
316
(format " ```%s \n %s \n ``` " language string)
310
317
string))
311
318
; ; For other programming languages
@@ -364,9 +371,16 @@ We don't extract the string that `lps-line' is already displaying."
364
371
(xwidget-webkit-mode)
365
372
(xwidget-webkit-goto-uri (xwidget-at 1 )
366
373
lsp-ui-doc-webkit-client-path)
374
+ (lsp-ui-doc--webkit-set-width)
367
375
(lsp-ui-doc--webkit-set-background)
368
376
(lsp-ui-doc--webkit-set-foreground)))))
369
377
378
+ (defun lsp-ui-doc--webkit-set-width ()
379
+ " Set webkit document max-width CSS property."
380
+ (lsp-ui-doc--webkit-execute-script
381
+ (format " document.documentElement.style.setProperty('--webkit-max-width-px', %d + 'px'); "
382
+ lsp-ui-doc-webkit-max-width-px)))
383
+
370
384
(defun lsp-ui-doc--webkit-set-background ()
371
385
" Set background color of the WebKit widget."
372
386
(lsp-ui-doc--webkit-execute-script
0 commit comments