Ensure that all opened editors' buffers are added to the project

Assigning a language mode happens when adding a buffer to the project,
so we need to guarantee this happens to all buffers used by visible editors.
This commit is contained in:
Max Brunsfeld
2017-12-01 09:58:19 -08:00
parent 49d8d94218
commit 6e2ac3548f
2 changed files with 16 additions and 0 deletions

View File

@@ -497,6 +497,9 @@ module.exports = class Workspace extends Model {
this.textEditorRegistry.maintainConfig(item),
item.observeGrammar(this.handleGrammarUsed.bind(this))
)
if (!this.project.findBufferForId(item.buffer.id)) {
this.project.addBuffer(item.buffer)
}
item.onDidDestroy(() => { subscriptions.dispose() })
this.emitter.emit('did-add-text-editor', {textEditor: item, pane, index})
}