You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
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
For #1705. Builds on @sagarsane's original pull request (#1706) to update the dialog label if the user changes the mode by editing the query string.
This ended up being a little complicated because we find out about changes to the query string through the _handleFilter callback to smart-autocomplete. This callback originally was just a module function, so didn't have the context of the dialog available. (We could have just directly looked up the ID in the global DOM, which other code in QuickOpen currently does, but it seems cleaner to actually look for it in the context of the dialog element.) So I changed this and some other related functions to be methods of QuickNavigateDialog instead.
…er changes the first character. As part of this, changed some module functions so they're methods of QuickNavigateDialog instead, and added a module var to track the currently open dialog.
The reason will be displayed to describe this comment to others. Learn more.
This use of this and that in showDialog() is a bit confusing now. On top of that, some of the event handlers are bound and others aren't: _handleItemSelect, _handleItemFocus, _handleKeyUp, _handleKeyDown, _handleResultsReady.
Also, just for consistency, I noticed _handleFilter and _handleResultsFormatter aren't wrapped in a wrapper function like the event handlers are. I'd actually prefer if we remove all the wrapper event handler functions (line 927-932) and change the signatures instead. It might be worth renaming _handleFilter and _handleResultsFormatter too since they aren't actually event handlers.
This is probably more refactoring than necessary, but I think at least we should fix the first issue with this/that and bind.
BTW, this code definitely could use some overall cleanup, but I'm hesitant to do a bunch more without unit tests. We should probably do it at the point where we work on the "official" Quick Open card.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
3 participants
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.
For #1705. Builds on @sagarsane's original pull request (#1706) to update the dialog label if the user changes the mode by editing the query string.
This ended up being a little complicated because we find out about changes to the query string through the
_handleFilter
callback to smart-autocomplete. This callback originally was just a module function, so didn't have the context of the dialog available. (We could have just directly looked up the ID in the global DOM, which other code in QuickOpen currently does, but it seems cleaner to actually look for it in the context of the dialog element.) So I changed this and some other related functions to be methods of QuickNavigateDialog instead.