fix: "goto > Declaration or Usages" to show references when ⌘B on definitions#1402
Open
aridclown wants to merge 2 commits intoredhat-developer:mainfrom
Open
fix: "goto > Declaration or Usages" to show references when ⌘B on definitions#1402aridclown wants to merge 2 commits intoredhat-developer:mainfrom
aridclown wants to merge 2 commits intoredhat-developer:mainfrom
Conversation
Contributor
|
Thanks so much for your contribution. Let me some times to test and study your PR. Please fix your commit message by adding first fix: |
9a97c03 to
a834b88
Compare
Author
|
Hey @angelozerr, did you happen to have a chance to look this up? Sorry for pushing on this, but it would be a very welcome addition to the plugin for our setup over here 🙏 |
Contributor
|
@aridclown I am sorry I am super busy with other topics but I promise you I will try your PR. The only thing which is really annoying is that it doesn't follow the standard behavior of IJ since IJ should consume references autoamticly but for some reason it doesn't use it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IntelliJ's "Go to > Declaration or Usages" (⌘B) shortcut is a commonly used shortcut that, in general, should display usages when triggered from the declaration itself.
In the LSP handler, we only call
textDocument/definition, so pressing⌘Bon a declaration has no effect (tested with LuaLS).A few things to note:
LSPGotoDeclarationHandlerto fall back totextDocument/references: if the definition we receive overlaps the caret, we reuse the same reference list and popup that the "Go to → LSP References" command uses.LSPReferenceCollectorhelper and pointed both the standalone reference action and the new fallback at it.