-
Notifications
You must be signed in to change notification settings - Fork 12.8k
SyntaxTree and SyntaxWalker in new compiler #254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi ashwinr. We're currently coming up with a plan for how things will work in the new compiler. We don't have an ETA when this information will be ready. |
Thanks @CyrusNajmabadi Can you please give us a heads-up when there is a plan on how the new compiler will be structured? As you're well aware, there's an open-source ecosystem already built up around language services, and we'd very much appreciate it if there was sufficient communication made for breaking changes 😄 |
We know TypeScript compiler API (aka LanguageService) is not documented. |
Can you confirm that generation of the syntax tree of .ts source will be exposed publicly? |
As @CyrusNajmabadi mentioned, we are still in the planning phase. We would like to have a public interface that allows access to compiler internal structures like nodes, symbols and types. There is no ETA on when this is going to happen though. |
Just exposing |
This is not the same issue as exposing a `ts`` API from the compiler. That issue is #372. This is making sure we have access to the compiler's internal data structures so that the community can keep building (just like it has with the older compiler) better third-party support on top of the core compiler. |
Is there any news about this? Will we be able to walk an AST with a visitor? Thanks. |
We no longer use the Instead of visitors/walkers, we use function getAllBinaryExpressions(root: ts.Node) {
var result: ts.BinaryExpression[] = [];
aggregate(root);
return result;
function aggregate(node: ts.Node): void {
if (node.kind === ts.SyntaxKind.BinaryExpression) {
result.push(<BinaryExpression>node);
}
ts.forEachChild(node, aggregate);
}
} If you need tokens, use the We are planning to expose a preview of our API as mentioned in #372. |
How do we get a |
Great idea guys, feels much nicer ❤️ |
Hi: tslint uses SyntaxTree and tree walkers extensively for implementing linter rules on top of the compiler (e.g. https://github.com/palantir/tslint/blob/master/src/rules/classNameRule.ts). It looks like the visitor pattern is not present in the new compiler (at least I couldn't find it in the master branch). But languageService-v2 still has it. Can someone please explain if the syntax tree will be present in the new compiler? Because otherwise tslint needs to completely rethink its existing rule implementations for the new compiler. Thanks!
The text was updated successfully, but these errors were encountered: