🎨 Use only id

This commit is contained in:
Antonio Scandurra
2015-12-07 19:01:54 +01:00
parent 0fa62d23ed
commit a8a9581ef4
3 changed files with 6 additions and 8 deletions

View File

@@ -337,9 +337,6 @@ class Project extends Model
else
@buildBuffer(absoluteFilePath)
bufferForId: (id) ->
_.find @buffers, (buffer) -> buffer.id is id
# Still needed when deserializing a tokenized buffer
buildBufferSync: (absoluteFilePath) ->
buffer = new TextBuffer({filePath: absoluteFilePath})

View File

@@ -22,10 +22,11 @@ class TokenizedBuffer extends Model
changeCount: 0
@deserialize: (state, atomEnvironment) ->
if state.bufferPath
state.buffer = atomEnvironment.project.bufferForPathSync(state.bufferPath)
else
if state.bufferId
state.buffer = atomEnvironment.project.bufferForIdSync(state.bufferId)
else
# TODO: remove this fallback after everyone transitions to the latest version.
state.buffer = atomEnvironment.project.bufferForPathSync(state.bufferPath)
state.config = atomEnvironment.config
state.grammarRegistry = atomEnvironment.grammars
state.packageManager = atomEnvironment.packages