Skip to content

Commit 5fb7501

Browse files
committed
getHeadBufferPosition todo
- code formatting
1 parent 1afa561 commit 5fb7501

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib_src/misc/blocks.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,19 @@ function isBlank({ line, scope }: LineInfo, allowDocstrings = false) {
2727
}
2828
return /^\s*(#.*)?$/.test(line)
2929
}
30+
3031
function isEnd(lineInfo: LineInfo) {
3132
if (isStringEnd(lineInfo)) {
3233
return true
3334
}
3435
return /^(end\b|\)|\]|\})/.test(lineInfo.line)
3536
}
37+
3638
function isStringEnd(lineInfo: LineInfo) {
3739
const scope = lineInfo.scope.join(" ")
3840
return /\bstring\.multiline\.end\b/.test(scope) || (/\bstring\.end\b/.test(scope) && /\bbacktick\b/.test(scope))
3941
}
42+
4043
function isCont(lineInfo: LineInfo) {
4144
const scope = lineInfo.scope.join(" ")
4245
if (/\bstring\b/.test(scope) && !/\bpunctuation\.definition\.string\b/.test(scope)) {
@@ -142,8 +145,11 @@ function getRanges(editor: TextEditor) {
142145
const ranges = editor.getSelections().map(selection => {
143146
return {
144147
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)
146151
}
152+
// TODO: replace with getBufferRowRange? (getHeadBufferPosition isn't a public API)
147153
})
148154
return ranges.filter(({ range }) => {
149155
return range && editor.getTextInBufferRange(range).trim()
@@ -183,4 +189,5 @@ export function select(editor = atom.workspace.getActiveTextEditor()) {
183189
selection.setBufferRange(range)
184190
}
185191
})
192+
// TODO: replace with getBufferRowRange? (getHeadBufferPosition isn't a public API)
186193
}

0 commit comments

Comments
 (0)