LSP
LSP copied to clipboard
Get back built-in Sublime Text hover popup
Hello!
LSP popup doesn't show list of references and definitions, it only shows definitions
and references
links which I found unhandy.
I only want to see LSP popup when I press some hotkey, but not on mouse hover. On mouse hover I want to see built-in Sublime Text 4 popup hover, but there is 2 problems:
-
If I turn on Sublime Text popups back by setting
view.settings().set("show_definitions", True)
, it automatically sets to False again after sublime text restart. -
Solution for disabling LSP popup, which was provided in #574 doesn't works for me at all: I tried to add
"disabled_capabilities": ["hover"],
in myLSP.sublime-settings
but popups are still here.
You need to use
{
"disabled_capabilities": {
"hoverProvider": true
},
}
in the client settings (i.e. per server) to disable LSP's hover popups. But at the same time, this will prevent to use a user-keybinding for the lsp_hover
command, because when the command runs, it will also check whether this capability is enabled: https://github.com/sublimelsp/LSP/blob/e14bf5de0cacabea9545cf88f27cea7fa8e4e840/plugin/hover.py#L146
Perhaps there should be another setting to turn on/off popups on mouse hover.
Also related: #1184
It would be great if such feature was released.
Is here temporarily workaround? Maybe we could use console commands for enabling and disabling "hoverProvider", and bind them to hotkeys?
Can you please provide information on the second question: Is there a way to prevent LSP to automatically set "show_definitions" to False after ST4 restart?
You need to use
{ "disabled_capabilities": { "hoverProvider": true }, }
It doesn't work, popups still appears, what am I doing wrong? Screenshot of my LSP.sublime-settings file:
It doesn't work, popups still appears, what am I doing wrong? Screenshot of my LSP.sublime-settings file:
It needs to be set per-server. So in LSP-typescript settings (or whatever server you are using).
Can you please provide information on the second question: Is there a way to prevent LSP to automatically set "show_definitions" to False after ST4 restart?
Setting stuff on the view is only gonna persist until that file is closed. That's ST behavior, not really LSP.
show_definitions
is a normal ST setting so you can just set it in ST Preferences
.
Thank you, now it works.
I wrote a comment in #1184 with use-cases and my vision on working with native/LSP popups alongside. Should I create a feature request or this is enough for you to consider these features implementation?
show_definitions
is a normal ST setting so you can just set it in STPreferences
.
For some reason it doesn't work for me: if LSP hover-popup is turned on, after each start of Sublime Text, this setting resets to false
until I manually set it True
through the console.
For some reason it doesn't work for me: if an LSP hover-popup is turned on, after each start of Sublime Text, this setting resets to
false
until I manually set itTrue
through the console.
True, I can see now that LSP modifies that setting before showing the hover popup. It only does it when the server supports hoverProvider
though so if you disable it for all servers that run on a given file then it should not do that anymore.
True, I can see now that LSP modifies that setting before showing the hover popup. It only does it when the server supports
hoverProvider
though so if you disable it for all servers that run on a given file then it should not do that anymore.
Yes it helps but occasionally it returns back to False, didn't figured out circumstances yet, but maybe it happens after viewing file with other language server, probably... (although I have installed only one, LSP-intelephense)
By the way, I almost found a solution for my initial question, since I can set keybinding for default ST "show_definition" command, to hop between LSP and ST hovers, I could:
Using user-defined key bindings disable ST "show_definition"
first, then enable LSP "hoverProvider"
, and vise-versa.
It would be an acceptable workaround for me, but I don't know what command should I bind to hotkey to disable or enable LSP hoverProvider, can you please help with it?