diff --git a/rust/ql/lib/codeql/rust/controlflow/internal/PrintCfg.ql b/rust/ql/lib/ide-contextual-queries/PrintCfg.ql similarity index 100% rename from rust/ql/lib/codeql/rust/controlflow/internal/PrintCfg.ql rename to rust/ql/lib/ide-contextual-queries/PrintCfg.ql diff --git a/rust/ql/lib/ide-contextual-queries/localDefinitions.ql b/rust/ql/lib/ide-contextual-queries/localDefinitions.ql new file mode 100644 index 000000000000..5c2cb01f178c --- /dev/null +++ b/rust/ql/lib/ide-contextual-queries/localDefinitions.ql @@ -0,0 +1,23 @@ +/** + * @name Jump-to-definition links + * @description Generates use-definition pairs that provide the data + * for jump-to-definition in the code viewer. + * @kind definitions + * @id rus/ide-jump-to-definition + * @tags ide-contextual-queries/local-definitions + */ + +import codeql.IDEContextual +import codeql.rust.elements.Variable +import codeql.rust.elements.Locatable + +external string selectedSourceFile(); + +predicate localVariable(Locatable e, Variable def) { e = def.getAnAccess() } + +from Locatable e, Variable def, string kind +where + e.getLocation().getFile() = getFileBySourceArchiveName(selectedSourceFile()) and + localVariable(e, def) and + kind = "local variable" +select e, def, kind diff --git a/rust/ql/src/queries/ide-contextual-queries/printAst.ql b/rust/ql/lib/ide-contextual-queries/printAst.ql similarity index 100% rename from rust/ql/src/queries/ide-contextual-queries/printAst.ql rename to rust/ql/lib/ide-contextual-queries/printAst.ql