From 6ab002d4bee63750e57aa3f0eb19ef2a44829159 Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 13 Oct 2014 16:14:31 -0700 Subject: [PATCH] Cursor::getScopes -> Cursor::getScopeDescriptor --- src/cursor.coffee | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cursor.coffee b/src/cursor.coffee index 2bda09219..873f7a17e 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -198,7 +198,7 @@ class Cursor extends Model [before, after] = @editor.getTextInBufferRange(range) return false if /\s/.test(before) or /\s/.test(after) - nonWordCharacters = atom.config.get(@getScopes(), 'editor.nonWordCharacters').split('') + nonWordCharacters = atom.config.get(@getScopeDescriptor(), 'editor.nonWordCharacters').split('') _.contains(nonWordCharacters, before) isnt _.contains(nonWordCharacters, after) # Public: Returns whether this cursor is between a word's start and end. @@ -214,11 +214,14 @@ class Cursor extends Model else @getBufferColumn() - # Public: Retrieves the grammar's token scopes for the line. + # Public: Retrieves the scope descriptor for the cursor's current position. # # Returns an {Array} of {String}s. + getScopeDescriptor: -> + @editor.scopeDescriptorForBufferPosition(@getBufferPosition()) getScopes: -> - @editor.scopesForBufferPosition(@getBufferPosition()) + deprecate 'Use Cursor::getScopeDescriptor() instead' + @getScopeDescriptor() # Public: Returns true if this cursor has no non-whitespace characters before # its current position. @@ -617,7 +620,7 @@ class Cursor extends Model # Returns a {RegExp}. wordRegExp: ({includeNonWordCharacters}={}) -> includeNonWordCharacters ?= true - nonWordCharacters = atom.config.get(@getScopes(), 'editor.nonWordCharacters') + nonWordCharacters = atom.config.get(@getScopeDescriptor(), 'editor.nonWordCharacters') segments = ["^[\t ]*$"] segments.push("[^\\s#{_.escapeRegExp(nonWordCharacters)}]+") if includeNonWordCharacters