lsp-ui icon indicating copy to clipboard operation
lsp-ui copied to clipboard

[Discussion] Change lsp-ui-doc default behavior

Open yyoncho opened this issue 4 years ago • 5 comments

I am recently testing some vanilla lsp-mode configurations with only the base components installed with no other configuration. IMO the default experience of lsp-ui-doc is not good because often(especially when you are writing code at the beginning of the file) the UI help dialog is hiding the company-mode popup dialog. I would propose lsp-ui-doc by default to be activated on mouse hover(using tooltip-mode) or by key command. Current behaviour to be activated by setting flag or enabling a minor mode.

yyoncho avatar Jun 16 '20 20:06 yyoncho

I have this in my personal configuration:

(setq lsp-ui-doc-enable nil)
:bind (:map lsp-mode-map
                ("C-c C-b" . lsp-ui-doc-glance))

Disabling by default would make it less discoverable. With tooltip-mode we would also show it on mouse hover.

Another possibility is to show the documentation box in the upper right corner (like before), but I prefer how it's shown now (also good for people familiar with VS Code).

So I prefer the tooltip-mode approach. Does it support the customisation we need for lsp-ui-doc?

danielmartin avatar Jun 16 '20 20:06 danielmartin

Does it support the customisation we need for lsp-ui-doc?

I think yes, you can provide a function that will be called with mouse location.

yyoncho avatar Jun 17 '20 05:06 yyoncho

I'd be in in favour of showing documentation tooltips on mouse hover, as long as we can keep the current "show on point hover" behaviour as well (I prefer to move the point over the token and have the documentation appear in the corner with lsp-ui-doc-position).

Sorixelle avatar Jun 17 '20 16:06 Sorixelle

I do agree that showing tooltip all the time is too much distracting, I have to put this in my config to prevent that.

  ;; Don't request doc after every command
  (add-hook 'lsp-ui-doc-mode-hook
            (lambda ()
              (when lsp-ui-doc-mode
                (remove-hook 'post-command-hook #'lsp-ui-doc--make-request t))))

Showing only on mouse hover is nice, but it may conflict with posframe-mouse-banish and we may need to go extra mile to make both of them work together.

kiennq avatar Jun 28 '20 01:06 kiennq

One more thing here: I suggest having a fixed default width(something like 60/80 symbols) and also fixed max height.

yyoncho avatar Aug 31 '20 17:08 yyoncho