diff --git a/src/text-editor.js b/src/text-editor.js index 7debe33cef8..ed6b0e68f8d 100644 --- a/src/text-editor.js +++ b/src/text-editor.js @@ -4578,10 +4578,20 @@ module.exports = class TextEditor { ); } - bufferRangeForScopeAtPosition(scopeSelector, position) { + // Extended: Get the range in buffer coordinates of all tokens surrounding the + // given position in buffer coordinates that match the given scope selector. + // + // For example, if you wanted to find the string surrounding the cursor, you + // could call `editor.bufferRangeForScopeAtPosition(".string.quoted", this.getCursorBufferPosition())`. + // + // * `scopeSelector` {String} selector. e.g. `'.source.ruby'` + // * `bufferPosition` A {Point} or {Array} of [row, column] + // + // Returns a {Range}. + bufferRangeForScopeAtPosition(scopeSelector, bufferPosition) { return this.buffer .getLanguageMode() - .bufferRangeForScopeAtPosition(scopeSelector, position); + .bufferRangeForScopeAtPosition(scopeSelector, bufferPosition); } // Extended: Determine if the given row is entirely a comment