don't allow edit on sketches with no variable declaration (#3292)

don't allow edit on sketches with no variable decleration
This commit is contained in:
Kurt Hutten
2024-08-06 16:17:30 +10:00
committed by GitHub
parent d27afb8c74
commit ffe0da6dcd
3 changed files with 4 additions and 0 deletions

View File

@ -791,6 +791,7 @@ export function isSingleCursorInPipe(
const pathToNode = getNodePathFromSourceRange(ast, selection.range)
const nodeTypes = pathToNode.map(([, type]) => type)
if (nodeTypes.includes('FunctionExpression')) return false
if (!nodeTypes.includes('VariableDeclaration')) return false
if (nodeTypes.includes('PipeExpression')) return true
return false
}