mirror of
https://github.com/atom/atom.git
synced 2026-02-08 21:55:05 -05:00
Project.getFilePaths returns full urls.
FileFinder.initialize takes a 'selected' callback.
This commit is contained in:
@@ -14,7 +14,7 @@ class FileFinder extends Template
|
||||
urls: null
|
||||
maxResults: null
|
||||
|
||||
initialize: ({@urls}) ->
|
||||
initialize: ({@urls, @selected}) ->
|
||||
@maxResults = 10
|
||||
|
||||
@populateUrlList()
|
||||
@@ -34,8 +34,7 @@ class FileFinder extends Template
|
||||
|
||||
select: ->
|
||||
filePath = @findSelectedLi().text()
|
||||
atom.open filePath if filePath
|
||||
|
||||
@selected(filePath) if filePath and @selected
|
||||
|
||||
moveUp: ->
|
||||
@findSelectedLi()
|
||||
|
||||
@@ -8,6 +8,5 @@ class Project
|
||||
getFilePaths: ->
|
||||
projectUrl = @url
|
||||
fs.async.list(@url, true).pipe (urls) ->
|
||||
urls = (url.replace(projectUrl, "") for url in urls when fs.isFile(url))
|
||||
urls
|
||||
url for url in urls when fs.isFile(url)
|
||||
|
||||
|
||||
@@ -43,6 +43,6 @@ class RootView extends Template
|
||||
@fileFinder = null
|
||||
else
|
||||
@project.getFilePaths().done (urls) =>
|
||||
@fileFinder = FileFinder.build({urls})
|
||||
@fileFinder = FileFinder.build({urls, selected: (url) => @editor.open(url)})
|
||||
@addPane(@fileFinder)
|
||||
@fileFinder.input.focus()
|
||||
|
||||
Reference in New Issue
Block a user