From 7d4b5864e95d98958e2d644b5c37b06eec8e7099 Mon Sep 17 00:00:00 2001 From: "Chris J. Shull" Date: Sat, 3 Feb 2018 00:53:17 -0800 Subject: [PATCH 1/4] Document TextEditor::bufferRangeForScopeAtBufferPosition Also rename from "bufferRangeForScopeAtPosition" to match similar method names. --- src/text-editor.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/text-editor.js b/src/text-editor.js index 7debe33cef8..4c7fb7b9a66 100644 --- a/src/text-editor.js +++ b/src/text-editor.js @@ -4577,11 +4577,19 @@ module.exports = class TextEditor { this.getCursorBufferPosition() ); } - - bufferRangeForScopeAtPosition(scopeSelector, position) { - return this.buffer - .getLanguageMode() - .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.bufferRangeForScopeAtBufferPosition(".string.quoted", this.getCursorBufferPosition())`. + // + // * `scopeSelector` {String} selector. e.g. `'.source.ruby'` + // * `bufferPosition` A {Point} or {Array} of [row, column] + // + // Returns a {Range}. + bufferRangeForScopeAtBufferPosition (scopeSelector, bufferPosition) { + return this.buffer.getLanguageMode().bufferRangeForScopeAtPosition(scopeSelector, bufferPosition) } // Extended: Determine if the given row is entirely a comment From 9f9de12aa18590b67bb46252169a5be2daeff2eb Mon Sep 17 00:00:00 2001 From: "Chris J. Shull" Date: Sat, 3 Feb 2018 20:34:46 -0800 Subject: [PATCH 2/4] fix trailing spaces --- src/text-editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text-editor.js b/src/text-editor.js index 4c7fb7b9a66..bc56e62faeb 100644 --- a/src/text-editor.js +++ b/src/text-editor.js @@ -4577,7 +4577,7 @@ module.exports = class TextEditor { this.getCursorBufferPosition() ); } - + // Extended: Get the range in buffer coordinates of all tokens surrounding the // given position in buffer coordinates that match the given scope selector. // From aa766c24ad39790d701ad1822d2a17a38196ee13 Mon Sep 17 00:00:00 2001 From: "Chris J. Shull" Date: Sun, 14 Oct 2018 08:47:16 -0700 Subject: [PATCH 3/4] s/bufferRangeForScopeAtBufferPosition/bufferRangeForScopeAtPosition/ --- src/text-editor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/text-editor.js b/src/text-editor.js index bc56e62faeb..c589936231c 100644 --- a/src/text-editor.js +++ b/src/text-editor.js @@ -4582,13 +4582,13 @@ module.exports = class TextEditor { // 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.bufferRangeForScopeAtBufferPosition(".string.quoted", this.getCursorBufferPosition())`. + // 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}. - bufferRangeForScopeAtBufferPosition (scopeSelector, bufferPosition) { + bufferRangeForScopeAtPosition (scopeSelector, bufferPosition) { return this.buffer.getLanguageMode().bufferRangeForScopeAtPosition(scopeSelector, bufferPosition) } From 59b467eb192a1763fb273e53f45d7576832ab63a Mon Sep 17 00:00:00 2001 From: sadick254 Date: Mon, 24 May 2021 18:12:38 +0300 Subject: [PATCH 4/4] Fix linting --- src/text-editor.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/text-editor.js b/src/text-editor.js index c589936231c..ed6b0e68f8d 100644 --- a/src/text-editor.js +++ b/src/text-editor.js @@ -4588,8 +4588,10 @@ module.exports = class TextEditor { // * `bufferPosition` A {Point} or {Array} of [row, column] // // Returns a {Range}. - bufferRangeForScopeAtPosition (scopeSelector, bufferPosition) { - return this.buffer.getLanguageMode().bufferRangeForScopeAtPosition(scopeSelector, bufferPosition) + bufferRangeForScopeAtPosition(scopeSelector, bufferPosition) { + return this.buffer + .getLanguageMode() + .bufferRangeForScopeAtPosition(scopeSelector, bufferPosition); } // Extended: Determine if the given row is entirely a comment