diff --git a/src/config.coffee b/src/config.coffee index 53c966d90..a77990975 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -337,7 +337,7 @@ class Config # # * `scopeDescriptor` (optional) {Array} of {String}s describing a path from # the root of the syntax tree to a token. Get one by calling - # {TextEditor::scopesAtCursor}. See {::get} for examples. + # {editor.getLastCursor().getScopeDescriptor()}. See {::get} for examples. # * `keyPath` {String} name of the key to observe # * `callback` {Function} to call when the value of the key changes. # * `value` the new value of the key @@ -373,7 +373,7 @@ class Config # # * `scopeDescriptor` (optional) {Array} of {String}s describing a path from # the root of the syntax tree to a token. Get one by calling - # {TextEditor::scopesAtCursor}. See {::get} for examples. + # {editor.getLastCursor().getScopeDescriptor()}. See {::get} for examples. # * `keyPath` (optional) {String} name of the key to observe. Must be # specified if `scopeDescriptor` is specified. # * `callback` {Function} to call when the value of the key changes. @@ -428,13 +428,13 @@ class Config # Additionally, you can get the setting at the specific cursor position. # # ```coffee - # scopeDescriptor = @editor.scopesAtCursor() + # scopeDescriptor = @editor.getLastCursor().getScopeDescriptor() # atom.config.get(scopeDescriptor, 'editor.tabLength') # => 2 # ``` # # * `scopeDescriptor` (optional) {Array} of {String}s describing a path from # the root of the syntax tree to a token. Get one by calling - # {TextEditor::scopesAtCursor} + # {editor.getLastCursor().getScopeDescriptor()} # * `keyPath` The {String} name of the key to retrieve. # # Returns the value from Atom's default settings, the user's configuration diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 000359077..3c9610261 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -2370,18 +2370,6 @@ class TextEditor extends Model Section: Managing Syntax Scopes ### - # Public: Get the syntactic scopes for the most recently added cursor's - # position. See {::scopesForBufferPosition} for more information. - # - # Returns an {Array} of {String}s. - scopesAtCursor: -> - if cursor = @getLastCursor() - cursor.getScopes() - else - @getRootScopeDescriptor() - getCursorScopes: -> - deprecate 'Use TextEditor::scopesAtCursor() instead' - @scopesAtCursor() # Essential: Get the syntactic scopes for the given position in buffer # coordinates. @@ -2421,6 +2409,17 @@ class TextEditor extends Model @commentScopeSelector ?= new TextMateScopeSelector('comment.*') @commentScopeSelector.matches(scopes) + + scopesAtCursor: -> + deprecate 'Use editor.getLastCursor().scopesAtCursor() instead' + if cursor = @getLastCursor() + cursor.getScopes() + else + @getRootScopeDescriptor() + getCursorScopes: -> + deprecate 'Use editor.getLastCursor().scopesAtCursor() instead' + @scopesAtCursor() + ### Section: Clipboard Operations ### @@ -2459,7 +2458,7 @@ class TextEditor extends Model return - else if atom.config.get(@scopesAtCursor(), "editor.normalizeIndentOnPaste") and metadata?.indentBasis? + else if atom.config.get(@getLastCursor().getScopeDescriptor(), "editor.normalizeIndentOnPaste") and metadata?.indentBasis? if !@getLastCursor().hasPrecedingCharactersOnLine() or containsNewlines options.indentBasis ?= metadata.indentBasis