Skip to content

Feature request: generate AST for code snippet on LGTM.com #5314

@adriaanjacobs

Description

@adriaanjacobs

Sometimes I want to see how CodeQL's AST would represent a certain syntactical construct. I was wondering if it was on the roadmap for LGTM.com to have a feature where you could paste a small code snippet and the site would show you the AST for that snippet right now?

To experiment with this kind of thing, I have a small VSCode CodeQL workspace set up now with a Makefile that can generate CodeQL databases using the CLI. I noticed it causes problems though if I regenerate the database while it is still selected as the active database in the CodeQL extension. So I deselect the database in the extension, remove the database, then reroll the database (using the brutal mode), then select it again in the extension and then I can view the AST/run queries on files again. Even then (but that might be because I left some files open from the zipped source archive, not sure) it (rarely, yet sometimes) still won't run/cause issues (due to missing cached files etc).

If, on the other hand, I could just put some code snippets on LGTM.com and generate the AST from that, that would be such a useful way of checking how CodeQL represents a certain code pattern and improve my queries accordingly.

Is something like that in the works or is there any way I could contribute to such a feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions