(mapcar
(jsonrpc-lambda
(&rest item &key label insertText insertTextFormat
- &allow-other-keys)
+ textEdit &allow-other-keys)
(let ((proxy
- (cond ((and (eql insertTextFormat 2)
- (eglot--snippet-expansion-fn))
+ ;; Snippet or textEdit, it's safe to
+ ;; display/insert the label since
+ ;; it'll be adjusted. If no usable
+ ;; insertText at all, label is best,
+ ;; too.
+ (cond ((or (and (eql insertTextFormat 2)
+ (eglot--snippet-expansion-fn))
+ textEdit
+ (null insertText)
+ (string-empty-p insertText))
(string-trim-left label))
- ((and insertText
- (not (string-empty-p insertText)))
- insertText)
- (t
- (string-trim-left label)))))
+ (t insertText))))
(unless (zerop (length proxy))
(put-text-property 0 1 'eglot--lsp-item item proxy))
proxy))