Skip to content

Get Function Body when in output of select #858

Answered by aibaars
akanksha1131 asked this question in Q&A
Discussion options

You must be logged in to vote

If I understand correctly, you need the source code text to pass it to a LLM. CodeQL normally returns the location (file path + start position + end position) and not the actual text of the source code. While it is possible to write a predicate string toText(AstNode n), this is quite a bit of work.

Would the following option (for SARIF output only) be helpful in your case ?

      --sarif-add-snippets
                             [SARIF formats only] Include code snippets for
                               each location mentioned in the results, with two
                               lines of context before and after the reported
                               location.

Alternatively you…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by akanksha1131
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants