Closed
Description
π Search Terms
semicolon findAncestor
asi findAncestor
π Version & Regression Information
5.8.3
β― Playground Link
No response
π» Code
// Reference to the VSCode extension
import * as ts from 'typescript'
// The target JS code to analyze
const a = 1
const b = 2
const c = 3
(a + b) - c
// β²
// β
// node: ts.Node
// Get the parent binary expression
ts.findAncestor(node, ts.isBinaryExpression).getFullText()
π Actual behavior
It shouldn't include 3.
β
βΌ
' 3
(a + b) - c'
π Expected behavior
'
(a + b) - c'
Additional information about the issue
I'm planning to develop a VSCode extension, and one of its features involves parsing the AST of JavaScript code.
Most of the target JavaScript code uses ASI (Automatic Semicolon Insertion), which causes unexpected behavior when calling ts.findAncestor.
Metadata
Metadata
Assignees
Labels
No labels