Add 'View DFG' command, similar to 'View CFG'#4305
Add 'View DFG' command, similar to 'View CFG'#4305asgerf wants to merge 1 commit intogithub:mainfrom
Conversation
| const viewGraph = ( | ||
| provider: TemplatePrintGraphProvider, | ||
| title: string, | ||
| ) => { |
Check failure
Code scanning / ESLint
Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
| const viewDfg = viewGraph( | ||
| dfgTemplateProvider, | ||
| "Calculating Data Flow Graph", | ||
| ); |
Check failure
Code scanning / ESLint
Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Error
There was a problem hiding this comment.
Pull request overview
Adds a new “View DFG” command to the CodeQL VS Code extension, implemented to mirror the existing “View CFG” workflow but selecting a different contextual-query tag (print-dfg).
Changes:
- Generalize the CFG template provider into a graph template provider parameterized by
KeyType(CFG vs DFG). - Add
PrintDfgQuerykey type and tag/name mappings for contextual query resolution. - Register new VS Code commands/menu contributions for “View DFG” and wire them into extension activation.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| extensions/ql-vscode/src/language-support/contextual/template-provider.ts | Renames/generalizes CFG provider into a graph provider supporting CFG/DFG via injected KeyType/display name. |
| extensions/ql-vscode/src/language-support/contextual/key-type.ts | Adds PrintDfgQuery and maps it to ide-contextual-queries/print-dfg. |
| extensions/ql-vscode/src/language-support/ast-viewer/ast-cfg-commands.ts | Refactors CFG execution into a reusable viewGraph helper and adds DFG command handlers. |
| extensions/ql-vscode/src/extension.ts | Instantiates CFG + DFG graph providers and registers the new commands. |
| extensions/ql-vscode/src/common/commands.ts | Extends AstCfgCommands type with the new DFG command IDs. |
| extensions/ql-vscode/package.json | Adds codeQL.viewDfg* commands and menu/command-palette contributions (canary-gated). |
Comments suppressed due to low confidence (1)
extensions/ql-vscode/src/language-support/contextual/template-provider.ts:355
- These error messages report
tag ${this.keyType}, butthis.keyTypeis the enum value (e.g.PrintDfgQuery), not the actual CodeQL query tag string. Consider usingtagOfKeyType(this.keyType)(or otherwise including the resolved tag, likeide-contextual-queries/print-dfg) so the guidance is actionable.
Also, "exacly" is misspelled (should be "exactly").
`Found multiple Print ${this.displayName} queries. Can't continue. Make sure there is exacly one query with the tag ${this.keyType}`,
);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| `Did not find any Print ${this.displayName} queries. Can't continue. Make sure there is exacly one query with the tag ${this.keyType}`, | ||
| ); |
There was a problem hiding this comment.
Same issue here as above: the message uses tag ${this.keyType} (enum value) rather than the actual tag string used for lookup. Using tagOfKeyType(this.keyType) would make the error actionable, and "exacly" should be corrected to "exactly".
This issue also appears on line 354 of the same file.
Adds a
View DFGcommand alongside theView CFGcommand:It behaves the exact same way as
View CFG, except the tag it uses to identify the CodeQL query ends withprint-dfginstead ofprint-cfg. (For context, DFG stands for data flow graph, and CFG stands for control flow graph)