mirror of
https://github.com/atom/atom.git
synced 2026-02-16 01:25:13 -05:00
Hook TextEditorRegistry to editors created by splitting panes
This commit is contained in:
@@ -124,6 +124,10 @@ export default class TextEditorRegistry {
|
||||
}
|
||||
|
||||
maintainGrammar (editor) {
|
||||
if (this.editorsWithMaintainedGrammar.has(editor)) {
|
||||
return
|
||||
}
|
||||
|
||||
this.editorsWithMaintainedGrammar.add(editor)
|
||||
this.selectGrammarForEditor(editor)
|
||||
this.subscriptions.add(editor.onDidChangePath(() => {
|
||||
@@ -148,6 +152,10 @@ export default class TextEditorRegistry {
|
||||
}
|
||||
|
||||
maintainConfig (editor) {
|
||||
if (this.editorsWithMaintainedConfig.has(editor)) {
|
||||
return
|
||||
}
|
||||
|
||||
this.editorsWithMaintainedConfig.add(editor)
|
||||
this.subscribeToSettingsForEditorScope(editor)
|
||||
editor.setScopedSettingsDelegate(this.scopedSettingsDelegate)
|
||||
|
||||
@@ -84,10 +84,12 @@ class Workspace extends Model
|
||||
@openers = []
|
||||
@destroyedItemURIs = []
|
||||
@consumeServices(@packageManager)
|
||||
@subscribeToAddedItems()
|
||||
|
||||
subscribeToEvents: ->
|
||||
@subscribeToActiveItem()
|
||||
@subscribeToFontSize()
|
||||
@subscribeToAddedItems()
|
||||
|
||||
consumeServices: ({serviceHub}) ->
|
||||
@directorySearchers = []
|
||||
@@ -160,6 +162,13 @@ class Workspace extends Model
|
||||
@activeItemSubscriptions.add(titleSubscription) if titleSubscription?
|
||||
@activeItemSubscriptions.add(modifiedSubscription) if modifiedSubscription?
|
||||
|
||||
subscribeToAddedItems: ->
|
||||
@onDidAddPaneItem ({item, pane, index}) =>
|
||||
if item instanceof TextEditor
|
||||
# @textEditorRegistry.maintainConfig(item)
|
||||
# @textEditorRegistry.maintainGrammar(item)
|
||||
@emitter.emit 'did-add-text-editor', {textEditor: item, pane, index}
|
||||
|
||||
# Updates the application's title and proxy icon based on whichever file is
|
||||
# open.
|
||||
updateWindowTitle: =>
|
||||
@@ -383,8 +392,7 @@ class Workspace extends Model
|
||||
#
|
||||
# Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
|
||||
onDidAddTextEditor: (callback) ->
|
||||
@onDidAddPaneItem ({item, pane, index}) ->
|
||||
callback({textEditor: item, pane, index}) if item instanceof TextEditor
|
||||
@emitter.on 'did-add-text-editor', callback
|
||||
|
||||
###
|
||||
Section: Opening
|
||||
|
||||
Reference in New Issue
Block a user