Skip to content

Commit 32c4d1d

Browse files
Robert Macomberbrotzeit
authored andcommitted
Handle string inlay hints
Also show a message if we get an inlay hint of an unexpected type.
1 parent 06c28ca commit 32c4d1d

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

clients/lsp-rust.el

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,8 @@ meaning."
13231323
:group 'lsp-rust-analyzer
13241324
:package-version '(lsp-mode . "8.0.0"))
13251325

1326+
(defvar lsp-rust-analyzer-already-warned-about-inlay-hint-type nil)
1327+
13261328
(defun lsp-rust-analyzer-update-inlay-hints (buffer)
13271329
(if (and (lsp-rust-analyzer-initialized?)
13281330
(eq buffer (current-buffer)))
@@ -1340,12 +1342,21 @@ meaning."
13401342
(pos (lsp--position-to-point position))
13411343
(overlay (make-overlay pos pos nil 'front-advance 'end-advance)))
13421344
(let ((concat-label
1343-
(string-join
1344-
(mapcar
1345-
(lambda (label)
1346-
(when (lsp-structure-p label)
1347-
(gethash "value" label "")))
1348-
label))))
1345+
(cl-typecase label
1346+
(vector
1347+
(string-join
1348+
(mapcar
1349+
(lambda (label)
1350+
(when (lsp-structure-p label)
1351+
(gethash "value" label "")))
1352+
label)))
1353+
(string
1354+
label)
1355+
(t
1356+
(unless lsp-rust-analyzer-already-warned-about-inlay-hint-type
1357+
(message "Unexpected type for inlay hint: %s" (type-of label))
1358+
(setq lsp-rust-analyzer-already-warned-about-inlay-hint-type t))
1359+
""))))
13491360
(overlay-put overlay 'lsp-rust-analyzer-inlay-hint t)
13501361
(overlay-put overlay 'before-string
13511362
(format "%s%s%s"

0 commit comments

Comments
 (0)