Skip to content

Improved lsp-completion--get-documentation option  #3905

@nice

Description

@nice

Is your feature related or already mentioned on the wishlist?
Mentioned briefly in the second point of : #2892 (comment)

First of all, thanks to all the contributors of lsp-mode.

Feature request:
Option to include/prefix lsp:completion-item-detail text to lsp:completion-item-documentation?.
It currently clutters the completion popup, especially with typescript language server.
I have added an advice to merge the detail and the documentation, which solves the problem for me, but would be good to have this as a configuration if possible.

Please refer to before and after screenshots below:

Before

(setq lsp-completion-show-detail t)
(company-posframe-mode 1)

lsp-completion-before

After

(setq lsp-completion-show-detail nil)
(company-posframe-mode 1)

(defun improved-completion-quick-help (orig item &rest args)
  (let ((doc (apply orig item args))
        (detail
         (-some->> item
           (get-text-property 0 'lsp-completion-item)
           (lsp:completion-item-detail?)))
        )
    (concat "\n" detail "\n\n" doc)))
  
(advice-add 'lsp-completion--get-documentation :around #'improved-completion-quick-help)

lsp-completion-after

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions