Introduce TextEditorRegistry::build

This way, we can construct text editors with the right parameters from the start
This commit is contained in:
Max Brunsfeld
2016-08-12 12:21:51 -07:00
parent 65f385c0a4
commit 09d232ba41
4 changed files with 68 additions and 17 deletions

View File

@@ -561,10 +561,7 @@ class Workspace extends Model
throw error
@project.bufferForPath(filePath, options).then (buffer) =>
new TextEditor(Object.assign(
{@clipboard, @assert, buffer, largeFileMode},
options
))
@textEditorRegistry.build(Object.assign({buffer, largeFileMode}, options))
handleGrammarUsed: (grammar) ->
return unless grammar?
@@ -581,7 +578,7 @@ class Workspace extends Model
#
# Returns a {TextEditor}.
buildTextEditor: (params) ->
editor = new TextEditor(Object.assign({@clipboard, @assert}, params))
editor = @textEditorRegistry.build(params)
subscriptions = new CompositeDisposable(
@textEditorRegistry.maintainGrammar(editor)
@textEditorRegistry.maintainConfig(editor),