github / vscode-codeql

An extension for Visual Studio Code that adds rich language support for CodeQL
https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-codeql
MIT License
421 stars 185 forks source link

Allow for multiple `ide-contextual-queries/print-ast` queries #923

Open hvitved opened 3 years ago

hvitved commented 3 years ago

Is your feature request related to a problem? Please describe. For Ruby, we have two views of the AST: The rich AST, and the desugared AST. The AST viewer (that is, the underlying ide-contextual-queries/print-ast query) displays the former, but sometimes it would be nice to see the desugared view.

Describe the solution you'd like Add a drop-down to the AST viewer where one can select among multiple ide-contextual-queries/print-ast queries (when multiple queries are present).

Describe alternatives you've considered

Additional context

aeisenberg commented 3 years ago

Perhaps this isn't possible, but could you always return both asts? They could be created as two top level nodes and the user would be able to see both at the same time.

hvitved commented 3 years ago

Perhaps this isn't possible, but could you always return both asts? They could be created as two top level nodes and the user would be able to see both at the same time.

In this case the output would not be a tree, as some AST nodes would appear in both trees, and I am not sure that the viewer handles that well (and the test output, where we use @kind graph certainly doesn't). As a user, I also think it would be weird to have the same element appear multiple times; which one should we jump to, when selecting some code?

aeisenberg commented 3 years ago

Yes. Good points. Not sure my suggestion makes sense.