Open editors when applying text edits via code actions#925
Merged
dzhou121 merged 2 commits intolapce:masterfrom Aug 4, 2022
Merged
Open editors when applying text edits via code actions#925dzhou121 merged 2 commits intolapce:masterfrom
dzhou121 merged 2 commits intolapce:masterfrom
Conversation
7b90727 to
a8de24e
Compare
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.
This makes so when applying edits via code actions it will open files that it references.
Previously, we would just ignore edits that reference other files, which was incorrect.
One example where this occurs is:
Ctrl+.inside that new file gives code actions to addmod filename;to thelib.rs/main.rsfile so that it is recognized as part of the rust project.The first commit switches to using a structure for
InitBufferContent, since they were sharing literally all fields (and I was going to be adding yet another). It also moves the behavior function onto the structure, since it is obviously related to it.The second commit adds a callback parameter which is executed when the buffer is finally loaded. It is called immediately if the file is already open, otherwise given to the
InitBufferContentstructure and called when it finished. This then lets us just wait until the buffer is loaded and editor is opened, and then applies the edits.