From 30302ce684f300ce5cf4de0997aeb27d2d3b8594 Mon Sep 17 00:00:00 2001 From: idillon Date: Mon, 22 Jan 2024 13:59:46 -0500 Subject: [PATCH] Fix: detection of Bash or Python region on the last character of the region --- server/src/tree-sitter/analyzer.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/tree-sitter/analyzer.ts b/server/src/tree-sitter/analyzer.ts index e6446b17..431d9e6d 100644 --- a/server/src/tree-sitter/analyzer.ts +++ b/server/src/tree-sitter/analyzer.ts @@ -262,8 +262,8 @@ export default class Analyzer { ): boolean { let n = this.nodeAtPoint(uri, line, column) - while (n?.parent !== null && n?.parent !== undefined) { - if (TreeSitterUtils.isShellDefinition(n.parent)) { + while (n !== null) { + if (TreeSitterUtils.isShellDefinition(n)) { return true } n = n.parent @@ -278,8 +278,8 @@ export default class Analyzer { column: number ): boolean { let n = this.nodeAtPoint(uri, line, column) - while (n?.parent !== null && n?.parent !== undefined) { - if (TreeSitterUtils.isInlinePython(n.parent) || TreeSitterUtils.isPythonDefinition(n.parent)) { + while (n !== null) { + if (TreeSitterUtils.isInlinePython(n) || TreeSitterUtils.isPythonDefinition(n)) { return true } n = n.parent