Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get back built-in Sublime Text hover popup #1967

Closed
rusproject opened this issue May 18, 2022 · 7 comments · Fixed by #2316
Closed

Get back built-in Sublime Text hover popup #1967

rusproject opened this issue May 18, 2022 · 7 comments · Fixed by #2316

Comments

@rusproject
Copy link

rusproject commented May 18, 2022

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:

  1. 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.

  2. 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 my LSP.sublime-settings but popups are still here.

@rusproject rusproject changed the title Return built-in sublime text definitions popup hover Return built-in sublime text references popup hover May 18, 2022
@rusproject rusproject changed the title Return built-in sublime text references popup hover Get back built-in Sublime Text hover popup May 18, 2022
@jwortmann
Copy link
Member

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:

for session in listener.sessions_async('hoverProvider'):

Perhaps there should be another setting to turn on/off popups on mouse hover.

Also related: #1184

@rusproject
Copy link
Author

rusproject commented May 19, 2022

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?

@rusproject
Copy link
Author

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:

image

@rchl
Copy link
Member

rchl commented May 19, 2022

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.

@rusproject
Copy link
Author

rusproject commented May 19, 2022

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 ST Preferences.

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.

@rchl
Copy link
Member

rchl commented May 19, 2022

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 it True 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.

@rusproject
Copy link
Author

rusproject commented May 19, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants