-
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 |
Beta Was this translation helpful? Give feedback.
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 definitions will 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()
}
} |
Beta Was this translation helpful? Give feedback.
-
Hello there, Can I get the AST from the AST viewer in the VScode extension as a file? |
Beta Was this translation helpful? Give feedback.
This query is specifically written to be executed in the context of VS Code (because of the
external string selectedSourceFile
predicate). 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