mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Marks paths for reload on focus and config events
Show the last loaded paths and load the latest in the background when the FuzzyFinder is opened after a config or focus event has been fired. Previously the paths were completely cleared and the indexing message was displayed while the latest paths were loaded.
This commit is contained in:
@@ -243,11 +243,6 @@ describe 'FuzzyFinder', ->
|
||||
$(window).trigger 'focus'
|
||||
rootView.trigger 'fuzzy-finder:toggle-file-finder'
|
||||
rootView.trigger 'fuzzy-finder:toggle-file-finder'
|
||||
|
||||
waitsFor ->
|
||||
finder.list.children('li').length > 0
|
||||
|
||||
runs ->
|
||||
expect(rootView.project.getFilePaths).toHaveBeenCalled()
|
||||
|
||||
describe "path ignoring", ->
|
||||
|
||||
@@ -17,12 +17,13 @@ class FuzzyFinder extends SelectList
|
||||
allowActiveEditorChange: null
|
||||
maxItems: 10
|
||||
projectPaths: null
|
||||
reloadProjectPaths: true
|
||||
|
||||
initialize: (@rootView) ->
|
||||
super
|
||||
@subscribe $(window), 'focus', => @projectPaths = null
|
||||
@observeConfig 'fuzzy-finder.ignoredNames', (ignoredNames) =>
|
||||
@projectPaths = null
|
||||
|
||||
@subscribe $(window), 'focus', => @reloadProjectPaths = true
|
||||
@observeConfig 'fuzzy-finder.ignoredNames', => @reloadProjectPaths = true
|
||||
|
||||
@miniEditor.command 'editor:split-left', =>
|
||||
@splitOpenPath (editor, session) -> editor.splitLeft(session)
|
||||
@@ -93,6 +94,8 @@ class FuzzyFinder extends SelectList
|
||||
@setArray(@projectPaths)
|
||||
else
|
||||
@setLoading("Indexing...")
|
||||
|
||||
if @reloadProjectPaths
|
||||
@rootView.project.getFilePaths().done (paths) =>
|
||||
ignoredNames = config.get("fuzzyFinder.ignoredNames") or []
|
||||
ignoredNames = ignoredNames.concat(config.get("core.ignoredNames") or [])
|
||||
@@ -103,6 +106,7 @@ class FuzzyFinder extends SelectList
|
||||
return false if _.contains(ignoredNames, segment)
|
||||
return true
|
||||
|
||||
@reloadProjectPaths = false
|
||||
@setArray(@projectPaths)
|
||||
|
||||
populateOpenBufferPaths: ->
|
||||
|
||||
Reference in New Issue
Block a user