mirror of
https://github.com/atom/atom.git
synced 2026-02-07 05:05:02 -05:00
🐎 Avoid building unnecessary scope chains
This commit is contained in:
@@ -47,3 +47,11 @@ class ScopeDescriptor
|
||||
|
||||
toString: ->
|
||||
@getScopeChain()
|
||||
|
||||
isEqual: (other) ->
|
||||
if @scopes.length isnt other.scopes.length
|
||||
return false
|
||||
for scope, i in @scopes
|
||||
if scope isnt other.scopes[i]
|
||||
return false
|
||||
true
|
||||
|
||||
@@ -116,7 +116,7 @@ export default class TextEditorRegistry {
|
||||
this.subscriptions.add(
|
||||
this.config.onDidChange(settingKey, configOptions, ({newValue}) => {
|
||||
this.editorsWithMaintainedConfig.forEach(editor => {
|
||||
if (editor.getRootScopeDescriptor().getScopeChain() === scopeChain) {
|
||||
if (editor.getRootScopeDescriptor().isEqual(scopeDescriptor)) {
|
||||
editor[setterName](newValue)
|
||||
}
|
||||
})
|
||||
@@ -129,7 +129,7 @@ export default class TextEditorRegistry {
|
||||
const softTabs = this.config.get('editor.softTabs', configOptions)
|
||||
|
||||
this.editorsWithMaintainedConfig.forEach(editor => {
|
||||
if (editor.getRootScopeDescriptor().getScopeChain() === scopeChain) {
|
||||
if (editor.getRootScopeDescriptor().isEqual(scopeDescriptor)) {
|
||||
editor.setSoftTabs(shouldEditorUseSoftTabs(editor, tabType, softTabs))
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user