This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Find within TextEditors within non-editor pane items #1068
Merged
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.
Requirements
Description of the Change
In atom/github, we open several pane items that embed TextEditor elements, but are not TextEditors themselves: ChangedFileItems for single file diffs (stage and unchanged), CommitPreviewItems for commit previews, and the "Files Changed" tab within the pull request detail item. Cmd-F doesn't search them, which is inconvenient, because especially the last two can be large.
To accommodate them, and any other packages that created pane items with internal TextEditors, I'm allowing pane items to implement a
getEmbeddedTextEditor()method. If present on the active pane item, when the find view is opened, that embedded item will be searched.Alternate Designs
I thought about making the method
getEmbeddedTextEditors(), plural, and allowing a pane item to return multiple editors and search across all of them. It would have been a fair bit more work and we didn't actually need it for atom/github, so I held off to keep the scope small.Benefits
find-and-replace:showwill be able to be used to search buffers embedded in custom pane items as well as core TextEditors.Possible Drawbacks
It's possible that there are items in third-party packages that already implement a method with that name. Although this is kind of a bonus too?
Applicable Issues
N/A