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

Add VimShowHoverInfo action #715

Closed

Conversation

citizenmatt
Copy link
Member

The ShowHoverInfo action has just been added to the 2023.3 wave of releases (233.8745 and above). This action will show a combined tooltip of highlighting info and quick documentation, exactly the same as shown when hovering over a code element. This can be mapped to keys, such as nmap gh <Action>(ShowHoverInfo).

This PR adds a safe workaround for 2023.1 and 2023.2. It adds a VimShowHoverInfo action that will defer to ShowHoverInfo if it exists, and calls an appropriate platform API if not. This API is intended to show the tooltip in response to an EditorMouseEvent, so this action simply creates a fake instance for the location of the text caret.

It also bumps the since-build value in plugin.xml to match 2023.1 RTM, to allow using this platform API (it was previously on an earlier 231 build).

Fixes VIM-2106

@AlexPl292
Copy link
Member

What is the intended use of this action? Like the users should add nmap gh <Action>(VimShowHoverInfo) to the config? If yes, it seems to me that we'll have trouble getting rid of this workaround even if we'll get a 233 as a minimal supported version.

@citizenmatt
Copy link
Member Author

Yep. It's to allow hover to work in 231 + 232, but it will be an action that we'll keep forever to maintain compatibility. Or we could introduce a mapping so that the VimShowHoverInfo action is automatically mapped to ShowHoverInfo, but we'd have some kind of code like this forever.

@AlexPl292
Copy link
Member

I don't think we should add any tricks here. This is a feature of IntelliJ IDEA and not of IdeaVim, so we can just write to the docs that there is such action available, but only if you use IJ >= 233.

Also, there is a very good chance that we'll increase the minimal version of IJ for IdeaVim to 233 because of code compatibility issues. So, this code won't cover 231 and 232 versions.

@citizenmatt
Copy link
Member Author

OK. Happy to go with whatever you decide.

As a side note, if we did take this and then want to deprecate it when we move to 233, we could add a default/builtin mapping of:

map <Action>(VimShowHoverInfo) <Action>(ShowHoverInfo)

which is a nice workaround to invoke the ShowHoverInfo action from an existing map that's intending to invoke VimShowHoverInfo.

@AlexPl292 AlexPl292 closed this Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants