|
Print AST command is used in vscode-codeql extension where it uses the printast query in qlpack and displays the results. printAst.ql implements a configuration to print ast for a single file (with |
Answered by
hvitved
Nov 15, 2021
Replies: 2 comments 6 replies
|
This query is specifically written to be executed in the context of VS Code (because of the import javascript
import semmle.javascript.PrintAst
import definitionswill print out the AST for all files, but you could also restrict it import javascript
import semmle.javascript.PrintAst
import definitions
private File relevantSourceFile() { ... }
class PrintAstConfigurationOverride extends PrintAstConfiguration {
override predicate shouldPrint(Locatable e, Location l) {
super.shouldPrint(e, l) and
l.getFile() = relevantSourceFile()
}
} |
6 replies
Answer selected by
Naman-ntc
|
Hello there, Can I get the AST from the AST viewer in the VScode extension as a file? |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This query is specifically written to be executed in the context of VS Code (because of the
external string selectedSourceFilepredicate). If you want to run it externally, you can make your own query:will print out the AST for all files, but you could also restrict it