Skip to content

Commit

Permalink
Fix: detection of Bash or Python region on the last character of the …
Browse files Browse the repository at this point in the history
…region
  • Loading branch information
idillon-sfl committed Feb 2, 2024
1 parent a6aa013 commit 30302ce
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/src/tree-sitter/analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 30302ce

Please sign in to comment.