refactor(language-service): find expression ASTs using absolute spans (#33387)
Moves to using the absolute span of an expression AST (relative to an entire template) rather than a relative span (relative to the start of the expression) to find an expression AST given a position in a template. This is part of the changes needed to support text replacement in templates (#33091). PR Close #33387
This commit is contained in:

committed by
Andrew Kushnir

parent
3f195fefa9
commit
ee4fc12e42
@ -18,7 +18,8 @@ function findAstAt(ast: AST, position: number, excludeEmpty: boolean = false): A
|
||||
const path: AST[] = [];
|
||||
const visitor = new class extends NullAstVisitor {
|
||||
visit(ast: AST) {
|
||||
if ((!excludeEmpty || ast.span.start < ast.span.end) && inSpan(position, ast.span)) {
|
||||
if ((!excludeEmpty || ast.sourceSpan.start < ast.sourceSpan.end) &&
|
||||
inSpan(position, ast.sourceSpan)) {
|
||||
path.push(ast);
|
||||
visitAstChildren(ast, this);
|
||||
}
|
||||
|
Reference in New Issue
Block a user