@@ -27,16 +27,19 @@ function isBlank({ line, scope }: LineInfo, allowDocstrings = false) {
27
27
}
28
28
return / ^ \s * ( # .* ) ? $ / . test ( line )
29
29
}
30
+
30
31
function isEnd ( lineInfo : LineInfo ) {
31
32
if ( isStringEnd ( lineInfo ) ) {
32
33
return true
33
34
}
34
35
return / ^ ( e n d \b | \) | \] | \} ) / . test ( lineInfo . line )
35
36
}
37
+
36
38
function isStringEnd ( lineInfo : LineInfo ) {
37
39
const scope = lineInfo . scope . join ( " " )
38
40
return / \b s t r i n g \. m u l t i l i n e \. e n d \b / . test ( scope ) || ( / \b s t r i n g \. e n d \b / . test ( scope ) && / \b b a c k t i c k \b / . test ( scope ) )
39
41
}
42
+
40
43
function isCont ( lineInfo : LineInfo ) {
41
44
const scope = lineInfo . scope . join ( " " )
42
45
if ( / \b s t r i n g \b / . test ( scope ) && ! / \b p u n c t u a t i o n \. d e f i n i t i o n \. s t r i n g \b / . test ( scope ) ) {
@@ -142,8 +145,11 @@ function getRanges(editor: TextEditor) {
142
145
const ranges = editor . getSelections ( ) . map ( selection => {
143
146
return {
144
147
selection : selection ,
145
- range : selection . isEmpty ( ) ? getRange ( editor , selection . getHeadBufferPosition ( ) . row ) : getSelection ( editor , selection )
148
+ range : selection . isEmpty ( )
149
+ ? getRange ( editor , selection . getHeadBufferPosition ( ) . row )
150
+ : getSelection ( editor , selection )
146
151
}
152
+ // TODO: replace with getBufferRowRange? (getHeadBufferPosition isn't a public API)
147
153
} )
148
154
return ranges . filter ( ( { range } ) => {
149
155
return range && editor . getTextInBufferRange ( range ) . trim ( )
@@ -183,4 +189,5 @@ export function select(editor = atom.workspace.getActiveTextEditor()) {
183
189
selection . setBufferRange ( range )
184
190
}
185
191
} )
192
+ // TODO: replace with getBufferRowRange? (getHeadBufferPosition isn't a public API)
186
193
}
0 commit comments