Ugh, add settingsForScopeDescriptor back

It’s used by language mode and autocomplete for different things
This commit is contained in:
Ben Ogle
2014-10-02 14:34:02 -07:00
parent aedf02a3e3
commit 3732bdf1e9
3 changed files with 16 additions and 5 deletions

View File

@@ -707,6 +707,17 @@ class Config
.join(' ')
@scopedSettingsStore.getPropertyValue(scopeChain, keyPath)
# TODO: figure out how to change / remove this. The return value is awkward.
# * language mode uses it for one thing.
# * autocomplete uses it for editor.completions
settingsForScopeDescriptor: (scopeDescriptor, keyPath) ->
scopeChain = scopeDescriptor
.map (scope) ->
scope = ".#{scope}" unless scope[0] is '.'
scope
.join(' ')
@scopedSettingsStore.getProperties(scopeChain, keyPath)
clearScopedSettings: ->
@scopedSettingsStore = new ScopedPropertyStore

View File

@@ -30,11 +30,11 @@ class LanguageMode
# Returns an {Array} of the commented {Ranges}.
toggleLineCommentsForBufferRows: (start, end) ->
scopes = @editor.scopesForBufferPosition([start, 0])
properties = atom.config.get(scopes, "editor")
return unless properties.commentStart
properties = atom.config.settingsForScopeDescriptor(scopes, "editor.commentStart")[0]
return unless properties
commentStartString = properties.commentStart
commentEndString = properties.commentEnd
commentStartString = _.valueForKeyPath(properties, 'editor.commentStart')
commentEndString = _.valueForKeyPath(properties, 'editor.commentEnd')
return unless commentStartString

View File

@@ -57,4 +57,4 @@ class Syntax extends GrammarRegistry
propertiesForScope: (scope, keyPath) ->
deprecate 'A direct (but private) replacement is available at atom.config.scopedSettingsForScopeDescriptor().'
atom.config.scopedSettingsForScopeDescriptor(scope, keyPath)
atom.config.settingsForScopeDescriptor(scope, keyPath)