diff --git a/lib/fuzzy-finder-view.coffee b/lib/fuzzy-finder-view.coffee index e569b412..af639055 100644 --- a/lib/fuzzy-finder-view.coffee +++ b/lib/fuzzy-finder-view.coffee @@ -175,6 +175,10 @@ class FuzzyFinderView extends SelectListView else filteredItems = @items + normalizedQuery = fs.normalize(filterQuery) + if fs.isFileSync(normalizedQuery) + filteredItems.push(filePath: normalizedQuery, projectRelativePath: normalizedQuery) + @list.empty() if filteredItems.length @setError(null) diff --git a/spec/fuzzy-finder-spec.coffee b/spec/fuzzy-finder-spec.coffee index cef500ee..9d8a110d 100644 --- a/spec/fuzzy-finder-spec.coffee +++ b/spec/fuzzy-finder-spec.coffee @@ -585,6 +585,34 @@ describe 'FuzzyFinder', -> expect(atom.workspace.panelForItem(projectView).isVisible()).toBe false expect(inputView).toHaveFocus() + describe "when the filter text contains an absolute path", -> + it "matches the given path", -> + dispatchCommand('toggle-file-finder') + expect(atom.workspace.panelForItem(projectView).isVisible()).toBe true + expectedPath = path.join(rootDir2, "sample.html") + + projectView.filterEditorView.getModel().insertText(expectedPath) + projectView.populateList() + waitForPathsToDisplay projectView + + runs -> + {filePath} = projectView.getSelectedItem() + expect(atom.project.getDirectories()[0].resolve(filePath)).toBe expectedPath + + it "accepts not normalized path", -> + dispatchCommand('toggle-file-finder') + expect(atom.workspace.panelForItem(projectView).isVisible()).toBe true + expectedPath = path.join(rootDir2, "sample.html") + searched = path.join(rootDir2, "..", "sample.html") + + projectView.filterEditorView.getModel().insertText(expectedPath) + projectView.populateList() + waitForPathsToDisplay projectView + + runs -> + {filePath} = projectView.getSelectedItem() + expect(atom.project.getDirectories()[0].resolve(filePath)).toBe expectedPath + describe "cached file paths", -> beforeEach -> spyOn(PathLoader, "startTask").andCallThrough()