-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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 history navigation for file include/exclude patterns in the search pane. Remember history between sessions. #27476
Conversation
@stringham, thanks for your PR! By analyzing the history of the files in this pull request, we identified @sandy081 and @roblourens to be potential reviewers. |
@stringham, |
@stringham Changes look good to me. Can you please resolve the conflicts so that I will make a merge? Thanks |
It appears that this commit: bdc326b broke history.ts, because the native |
@stringham Native So, I do not think, adopting to native Thanks. |
Okay, I saw a couple of weird things. 1 of them was that I was adding the empty string to the history and showPrevious and showNext make sure you get a truthy value back from the history. I fixed that by checking before adding to the history (should the empty string be allowed in the history?) this._register(this.onSubmit(() => {
let value = this.getValue();
if(value.length > 0) {
this.history.add(this.getValue());
}
})); the issue with history can be seen with this unit test: test('adding existing should move it to the end', function() {
let testObject = new HistoryNavigator([], 5);
testObject.add('1');
testObject.add('2');
assert.equal('2', testObject.current());
testObject.add('1');
assert.equal('1', testObject.current());
}); and can be fixed by doing this in history.ts: public add(t: T) {
this._history.add(t);
this._onChange();
} ArraySet was previously handling this: set(element: T): void {
this.unset(element);
this._elements.push(element);
} |
I've resolved merge conflicts for this feature and it should be ready to merge when you're ready. |
@sandy081 I believe this is good to go. Do you want me to open a pull request to fix history.ts? |
@stringham Thanks for the changes.. We froze changes for this milestone, this Monday and I will merge this PR when the master is open which is mostly next Monday. Regarding issue with history, please open a separate issue. We can discuss there. I like to have one fix per issue. Thanks. |
@sandy081 is this waiting on anything else? |
@stringham No.. it is waiting for my time :). Sorry, Its in my list and will merge this soon. Thanks. |
Does this or any other PR adds history to the "Replace" feature as well? |
@brunolemos Not yet. Feel free to contribute. |
Having the search history that is present right now is very helpful, thank you to all who work on these features. However, I think it is a bit awkward still. It appears that each "supported" field (the search field and the file include and file exclude fields) seems to have an independent history. But that is not how I, at least, use search. When I search, I work a while to construct a proper search, which includes decisions about the search term, the modifications of the search (case sensitivity and such), the appropriate replacements, and the files to include/exclude. It is really a package deal, all of it together is what represents a search, not any one field alone. Right now I have to arrow in at least three fields to sync up a package search that was all in sync at the time I last used it. And even then, the replace field and the search attributes (case, grep, etc) are left out and not recalled from history. So if anyone is still working on this, it would be really great to create a search history that remembers the whole package, everything that went into a given search, and pulls it all back at once. I think the logic of saving the history only once it is navigated is fine, though I would also see a benefit in an explicit choice to "save search" from a new mini-icon at the top of the search panel that could also pop down a list of past saved searches. My model for this might be how BBEdit on the Mac saves searches, with both a history and a more intentional named list of searches. I apologize for not diving in and building this. I know not the first thing about Electron apps or how VS Code fits together. Maybe someday! But I just wanted to share the idea. Maybe someone who knows more will be inspired. |
That request would be covered by #16488 |
This implements #20547 for both the include and exclude patterns.
It also remembers the history for the search terms and the include/exclude patterns on shutdown and startup.