Revert changes to codeQLModelEditor.jumpToMethod to allow jumping to usages other than the first usage#2977
Merged
robertbrignull merged 3 commits intomainfrom Oct 16, 2023
Merged
Conversation
This was referenced Oct 16, 2023
koesie10
reviewed
Oct 16, 2023
| } | ||
|
|
||
| public setSelectedMethod(dbItem: DatabaseItem, methodSignature: string) { | ||
| public setSelectedMethod(dbItem: DatabaseItem, method: Method, usage: Usage) { |
Member
There was a problem hiding this comment.
Should we add a comment to this method to specify that the method and usage need to have been retrieved from the modeling store? Theoretically you could pass in a usage received from the webview which might cause other code relying on object referential identity to break.
Contributor
Author
There was a problem hiding this comment.
That's a good point. I'll add a comment about that.
It might be nice if we could avoid pitfalls like this, but I'm not fully convinced yet if other approaches are better.
koesie10
approved these changes
Oct 16, 2023
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.
In #2926 I was trying to simplify the code as much as possible, but I accidentally changed the
codeQLModelEditor.jumpToMethodcommand which does need to be able to jump to usages other than the first usage.This PR reverts the changes to that command and makes it work again. This does require adding a new
getMethodmethod to the modeling store.I did consider another way of implementing this which was to add a
usageIndex: numberfield to the command. That also worked, but I decided it was safer to just revert the changes from the earlier PR and stick more closely to the original state of the code.Checklist
ready-for-doc-reviewlabel there.