emacs-lsp / lsp-ui

UI integrations for lsp-mode
https://emacs-lsp.github.io/lsp-ui
GNU General Public License v3.0
1.04k stars 139 forks source link

lsp-ui-doc: send hover request only for supported servers #506

Closed leungbk closed 3 years ago

leungbk commented 3 years ago

#

sebastiencs commented 3 years ago

@leungbk Thanks !

@yyoncho lsp--capability does not seem to be a function that return quickly, considering that lsp-ui-doc--handle-mouse-movement will be call on every mouse movement.

Can the return value of (lsp--capability :hoverProvider) changed during the session ? Or we can cache it in a variable.

Or we could make that check in lsp-ui-doc--mouse-display, when the idle timer is triggered

yyoncho commented 3 years ago

Can the return value of (lsp--capability :hoverProvider) changed during the session ? Or we can cache it in a variable.

It can if you have 2 servers connected to the buffer and kill one of them it might change. Not sure if we should be concerned about this case.

BTW it is better to use lsp-feature? instead of lsp--capability. lsp-feature? can be optimized a lot as it is.

yyoncho commented 3 years ago

And one more case - I think that might lsp-ui will be initialized before the server has returned its capabilities.

sebastiencs commented 3 years ago

@yyoncho Right, thanks !

@leungbk Can you move that check to lsp-ui-doc--mouse-display. lsp-ui-doc--handle-mouse-movement should remains as fast as possible.

sebastiencs commented 3 years ago

Thank you @leungbk