diff --git a/ql/lib/codeql/bicep/ideContextual/printAstAst.qll b/ql/lib/codeql/bicep/ideContextual/PrintAstNode.qll similarity index 96% rename from ql/lib/codeql/bicep/ideContextual/printAstAst.qll rename to ql/lib/codeql/bicep/ideContextual/PrintAstNode.qll index 0d9399c..2678db1 100644 --- a/ql/lib/codeql/bicep/ideContextual/printAstAst.qll +++ b/ql/lib/codeql/bicep/ideContextual/PrintAstNode.qll @@ -66,7 +66,11 @@ class PrintAstNode extends AstNode { /** * Gets the child node that is accessed using the predicate `edgeName`. */ - PrintAstNode getChild(string edgeName) { result = this.getAChild(edgeName) } + PrintAstNode getChild(string edgeName) { + result = this.getAChild() + and + edgeName = "semmle.label" +} } private predicate shouldPrintNode(AstNode n) { diff --git a/ql/lib/ide-contextual-queries/printAst.ql b/ql/lib/ide-contextual-queries/printAst.ql index 57cc279..6031fd5 100644 --- a/ql/lib/ide-contextual-queries/printAst.ql +++ b/ql/lib/ide-contextual-queries/printAst.ql @@ -7,21 +7,21 @@ * @tags ide-contextual-queries/print-ast */ -private import codeql.IDEContextual -private import codeql.bicep.AST -private import codeql.bicep.ideContextual.printAstAst - -/** - * 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()) - } -} \ No newline at end of file + private import codeql.IDEContextual + private import codeql.bicep.AST + private import codeql.bicep.ideContextual.PrintAstNode + + /** + * 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()) + } + } \ No newline at end of file