I've run into a problem with the StartOffset and EndOffset values for nodes in a nested structure that I cannot seem to figure out. I'm writing the Intellisense logic for my SQL-like language that allows a sub-query in the WHERE clause. When I'm traversing the AST to set Context, the process fails because the StartOffset values are incorrect. Here's an example:
Given this query:
SELECT Name FROM Table WHERE TypeId IN (SELECT id FROM FieldTypes)
Produces this AST:
Document[
Query[
Select[
AstField[
AstRelationship
]
] 0-11
AstFrom[
AstObject
] 12-33
Where[
SubSelectExpr[
AstField[
AstRelationship
] 40-52
Operator[
"in"
] 40-83 s/b 53-55
SubQuery[
Select[
AstField[
AstRelationship
]
] 57-66
AstFrom[
AstObject 72-82
] 56-83 s/b 67-82
] 40-83 s/b 57-83
] 40-83
] 34-83
""
]
]
As you can see, the offset values of the AstNodes in the SubSelectExpr node are incorrect, except for the first node. I have a screenshot from the VS debugger showing the incorrect values. I can send that to you if you want.
The behavior was the same in 25.1.3. I also want to note that 26.1 doesn't provide the TextRange values of AstNodes like prior version did with
parseData.Ast.ToTreeString
You can see this behavior in the Sample App. Would be nice to get that back as it's very useful.
Regards, Rick Brown