diff --git a/src/scope-descriptor.coffee b/src/scope-descriptor.coffee index 89c13d13f..ca97a2a43 100644 --- a/src/scope-descriptor.coffee +++ b/src/scope-descriptor.coffee @@ -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 diff --git a/src/text-editor-registry.js b/src/text-editor-registry.js index c0e5ac9ff..0742a8477 100644 --- a/src/text-editor-registry.js +++ b/src/text-editor-registry.js @@ -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)) } })