-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Fixes #2608 (Quick Open shows red on first use) #3184
Changes from 3 commits
e423527
a34d98c
7641f18
9384b87
f419483
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -391,7 +391,7 @@ define(function (require, exports, module) { | |
*/ | ||
QuickNavigateDialog.prototype._handleResultsReady = function (e, results) { | ||
// Give visual clue when there are no results | ||
var isNoResults = (results.length === 0 && !this._isValidLineNumberQuery(this.$searchField.val())); | ||
var isNoResults = (results.length === 0 && (fileList || currentPlugin) && !this._isValidLineNumberQuery(this.$searchField.val())); | ||
this.$searchField.toggleClass("no-results", isNoResults); | ||
}; | ||
|
||
|
@@ -786,12 +786,12 @@ define(function (require, exports, module) { | |
|
||
// Start fetching the file list, which will be needed the first time the user enters an un-prefixed query. If FileIndexManager's | ||
// caches are out of date, this list might take some time to asynchronously build. See searchFileList() for how this is handled. | ||
fileList = null; | ||
fileListPromise = FileIndexManager.getFileInfoList("all") | ||
.done(function (files) { | ||
fileList = files; | ||
fileListPromise = null; | ||
}); | ||
this._filenameMatcher.reset(); | ||
}.bind(this)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So if I understand this right, nothing will actually refresh the results list once the new index has been built... but the next time the user changes the query text, even within the same Quick Open session, the results will start reflecting the new index? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also... do we need both this _filenameMatcher.reset() and matcher.reset() above? I think they will always be the same object. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, you're right that there's no automatic refresh until the user changes the query string. You're also right that only one call to Do you think it's worthwhile to force a refresh when the file list updates? It's not immediately obvious to me how we'd do that, but I'm guessing there's got to be a way we can prod the smartautocomplete widget into acting as if the query changed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I don't think we need to bother with a forced refresh... just wanted to make sure I understood the intent of the code. |
||
}; | ||
|
||
function getCurrentEditorSelectedText() { | ||
|
@@ -833,8 +833,11 @@ define(function (require, exports, module) { | |
beginSearch("@", getCurrentEditorSelectedText()); | ||
} | ||
} | ||
|
||
|
||
|
||
// Listen for a change of project to invalidate our file list | ||
$(ProjectManager).on("projectOpen", function () { | ||
fileList = null; | ||
}); | ||
|
||
// TODO: allow QuickOpenJS to register it's own commands and key bindings | ||
CommandManager.register(Strings.CMD_QUICK_OPEN, Commands.NAVIGATE_QUICK_OPEN, doFileSearch); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, while you're making another commit... could you add something here to clarify what we mean by "no results"? E.g. "...when there are no results - unless we're in 'Go to Line' mode, where there are never results; or when we're in file search mode and still waiting for the index to get rebuilt."