WIP: Adding find all matches in project command

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-07-17 14:26:12 -06:00
parent c3fe9aa0b3
commit 34e96fb8d7
8 changed files with 65 additions and 15 deletions

View File

@@ -77,13 +77,7 @@ class Project
setSoftWrap: (@softWrap) ->
open: (filePath, editSessionOptions={}) ->
if filePath?
filePath = @resolve(filePath)
buffer = @bufferWithPath(filePath) ? @buildBuffer(filePath)
else
buffer = @buildBuffer()
@buildEditSession(buffer, editSessionOptions)
@buildEditSession(@bufferForPath(filePath), editSessionOptions)
buildEditSession: (buffer, editSessionOptions) ->
options = _.extend(@defaultEditSessionOptions(), editSessionOptions)
@@ -116,8 +110,13 @@ class Project
buffers
bufferWithPath: (path) ->
return editSession.buffer for editSession in @editSessions when editSession.buffer.getPath() == path
bufferForPath: (filePath) ->
if filePath?
filePath = @resolve(filePath)
return editSession.buffer for editSession in @editSessions when editSession.buffer.getPath() == filePath
@buildBuffer(filePath)
else
@buildBuffer()
buildBuffer: (filePath) ->
buffer = new Buffer(filePath)