Skip to content

Move python contextual queries to lib folders#9838

Merged
aeisenberg merged 1 commit intomainfrom
aeisenberg/python-local-ref-def
Jul 25, 2022
Merged

Move python contextual queries to lib folders#9838
aeisenberg merged 1 commit intomainfrom
aeisenberg/python-local-ref-def

Conversation

@aeisenberg
Copy link
Contributor

@aeisenberg aeisenberg commented Jul 15, 2022

This will ensure that python projects can use jump to ref/def in
vscode when the core libraries are not installed.

See also #9744. This PR does the same for python queries.

@aeisenberg aeisenberg requested a review from a team as a code owner July 15, 2022 20:07
@aeisenberg aeisenberg force-pushed the aeisenberg/python-local-ref-def branch from 148c57d to a25df96 Compare July 15, 2022 20:10
@aeisenberg aeisenberg requested a review from a team as a code owner July 15, 2022 20:10
@aeisenberg aeisenberg removed the request for review from a team July 15, 2022 20:11
This will ensure that python projects can use jump to ref/def in
vscode when the core libraries are not installed.
@aeisenberg aeisenberg force-pushed the aeisenberg/python-local-ref-def branch from a25df96 to b897a40 Compare July 15, 2022 20:12
@github-actions github-actions bot removed the Go label Jul 15, 2022
Copy link
Contributor

@tausbn tausbn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy with the move, but slightly confused as to the setup here. This PR only moves the Local... versions, leaving e.g. Definitions.ql in src/analysis/ (unless I've misread this somehow). Presumably Definitions.ql should also move into /lib?

@aeisenberg
Copy link
Contributor Author

Thanks for the review. Definitions.ql must remain in src in order for lgtm to be able to discover them. Also, ql files in *-all qlpacks are not pre-compiled.

@aeisenberg
Copy link
Contributor Author

That comment was written from my phone. Here is a deeper explanation:

The vscode extension requires the LocalDefs/Refs files to be in the lib folders (ie- *-all qlpacks) so that when the core libraries are not in the workspace, the appropriate contextual queries can still be resolved. This is because we can presume that if you are working with python queries, you will have codeql/python-all transitively available from the qlpacks in the workspace.

For LGTM, we need the Definitions.qll in the *-queries qlpacks because these are the only packs that LGTM can resolve. Also, if we did change LGTM so that it can resolve *-all qlpacks, we would still have a problem in that these queries are not pre-compiled in library packs.

@aeisenberg aeisenberg merged commit 43ae5d4 into main Jul 25, 2022
@aeisenberg aeisenberg deleted the aeisenberg/python-local-ref-def branch July 25, 2022 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants