We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0b78575 commit cf29578Copy full SHA for cf29578
src/commands.ts
@@ -401,7 +401,11 @@ export const selectLine: StateCommand = ({state, dispatch}) => {
401
/// syntax tree.
402
export const selectParentSyntax: StateCommand = ({state, dispatch}) => {
403
let selection = updateSel(state.selection, range => {
404
- let stack = syntaxTree(state).resolveStack(range.from, 1)
+ let tree = syntaxTree(state), stack = tree.resolveStack(range.from, 1)
405
+ if (range.empty) {
406
+ let stackBefore = tree.resolveStack(range.from, -1)
407
+ if (stackBefore.node.from >= stack.node.from && stackBefore.node.to <= stack.node.to) stack = stackBefore
408
+ }
409
for (let cur: typeof stack | null = stack; cur; cur = cur.next) {
410
let {node} = cur
411
if (((node.from < range.from && node.to >= range.to) ||
0 commit comments