@@ -87,32 +87,23 @@ class ProjectView extends FuzzyFinderView
8787 @loadingBadge .text (humanize .intComma (pathsFound))
8888
8989 projectRelativePathsForFilePaths : ->
90- projectRelativePaths = super
90+ @ getLastOpenedPaths (). concat super
9191
92- if lastOpenedPath = @ getLastOpenedPath ()
93- for {filePath}, index in projectRelativePaths
94- if filePath is lastOpenedPath
95- [entry ] = projectRelativePaths .splice (index, 1 )
96- projectRelativePaths .unshift (entry)
97- break
98-
99- projectRelativePaths
100-
101- getLastOpenedPath : ->
92+ getLastOpenedPaths : ->
10293 activePath = atom .workspace .getActivePaneItem ()? .getPath ? ()
94+ editors = atom .workspace .getTextEditors ()
10395
104- lastOpenedEditor = null
96+ recentEditors = editors . filter (editor) -> activePath isnt editor . getPath ()
10597
106- for editor in atom .workspace .getTextEditors ()
107- filePath = editor .getPath ()
108- continue unless filePath
109- continue if activePath is filePath
98+ recentEditors .sort (editorA, editorB) ->
99+ editorB .lastOpened - editorA .lastOpened
110100
111- lastOpenedEditor ?= editor
112- if editor .lastOpened > lastOpenedEditor .lastOpened
113- lastOpenedEditor = editor
101+ paths = recentEditors .map (editor) ->
102+ filePath = editor .getPath ()
103+ [rootPath , projectRelativePath ] = atom .project .relativizePath (filePath)
104+ {filePath, projectRelativePath}
114105
115- lastOpenedEditor ? . getPath ()
106+ paths
116107
117108 destroy : ->
118109 @loadPathsTask ? .terminate ()
0 commit comments