mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
With this change, users are now able to run View AST command in vscode within vscode workspaces that do not include the core libraries. The relevant core library only needs to be installed in the package cache.
28 lines
728 B
Plaintext
28 lines
728 B
Plaintext
/**
|
|
* @name Print AST
|
|
* @description Produces a representation of a file's Abstract Syntax Tree.
|
|
* This query is used by the VS Code extension.
|
|
* @id rb/print-ast
|
|
* @kind graph
|
|
* @tags ide-contextual-queries/print-ast
|
|
*/
|
|
|
|
private import codeql.IDEContextual
|
|
private import codeql.ruby.AST
|
|
private import codeql.ruby.printAst
|
|
|
|
/**
|
|
* The source file to generate an AST from.
|
|
*/
|
|
external string selectedSourceFile();
|
|
|
|
/**
|
|
* A configuration that only prints nodes in the selected source file.
|
|
*/
|
|
class Cfg extends PrintAstConfiguration {
|
|
override predicate shouldPrintNode(AstNode n) {
|
|
super.shouldPrintNode(n) and
|
|
n.getLocation().getFile() = getFileBySourceArchiveName(selectedSourceFile())
|
|
}
|
|
}
|