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

Toggle Shortcut for Switching Between LSP Hover and Native Sublime Text Hover #2315

Closed
rusproject opened this issue Aug 29, 2023 · 0 comments · Fixed by #2316
Closed

Toggle Shortcut for Switching Between LSP Hover and Native Sublime Text Hover #2315

rusproject opened this issue Aug 29, 2023 · 0 comments · Fixed by #2316

Comments

@rusproject
Copy link

Is your feature request related to a problem? Please describe.

LSP hovers replace native Sublime Text hovers, but sometimes this is unwanted.
Related issues: #1184, #1967 (the last one is mine, but now I have come up with a different question).

I work with a legacy PHP project and have noticed that in many cases, LSP-intelephense either doesn't find the full list of references to some methods or simply fails to find any references at all. Meanwhile, the built-in Sublime Text hover shows all references perfectly. The second thing is that even when LSP successfully finds all references, it doesn't show them in the hover pop-up. You have to press the "show references" button or hotkey, and then they are displayed at the bottom panel (or the Sublime quick panel if the respective LSP setting is set to true), but not in the hover popup. Feel the difference:

Native Sublime Text popup shows all definitions & references across the project LSP references show only what is recognized by the Language server, which misses a lot for some projects
image image

Multiple definitions aren't shown at all. References in Smarty HTML templates aren't shown either—there is no way to add this to any PHP language server.

Some might say there is no sense in using such a hover provider in these circumstances at all, and I kind of agree with that, so I disabled hover capabilities and have worked like that for a long time. But I still suffer because of it, as the LSP hover provider has a significant advantage: it can render php-doc-blocks, which the native Sublime Text hover pop-up can't do:

image image
The native Sublime Text hover doesn't show too much... ...and the LSP hover helps a lot ♥

Describe the solution you'd like

This inquiry is related to having one of these options:

  1. Have a hotkey to show LSP "hover" popup (so that we can disable mouse hover popup capability but invoke it with a hotkey).
  2. (less likely, but still workable) Any ability to quickly switch between LSP hover and the built-in Sublime Text hover.

The second one could be achieved by creating a Sublime plugin with a custom command that would toggle the ST "show definitions" setting on and off, simultaneously toggling the LSP setting "disabled_capabilities: {"hoverProvider"}". This command could be bound to a hotkey. However, I can't figure out how to do that. I managed to find out that there was Pull Request #2033, which would add the ability to toggle LSP capability with a command, but it was closed as "not very useful."

Describe alternatives you've considered

Unfortunately, there are only two alternatives (as far as I know):

  • Either use native Sublime Text's ability to show symbol references across the project in all files.
  • Or use LSP hover, which can show detailed symbol descriptions but can't show truly ALL definitions and references in many cases.

Any help with how we could work around this (to not make a hard choice between these two options but somehow make use of both) would be greatly appreciated.

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.

1 participant