Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does Python LSP integration work? #783

Open
cbarrete opened this issue Sep 23, 2024 · 1 comment
Open

How does Python LSP integration work? #783

cbarrete opened this issue Sep 23, 2024 · 1 comment

Comments

@cbarrete
Copy link
Contributor

My understanding is that Python LSP integration is supposed to be built using the source-db subtargets (and accompanying BXL scripts in the prelude), but I cannot find any mentions of "source db" in language server docs.
I'm very unfamiliar with the Python ecosystem, could somebody give me some pointers for where to start looking?

My understanding is that in the Bazel world, this is achieved by making venvs that contain both third-party and local dependencies. Is it similar in the Buck2 world?

I've looked at the git log for prelude/python/sourcedb/ide.bxl, but it's not quite enough context I believe.

@connernilsen
Copy link
Contributor

Hey @cbarrete, I have an understanding of how this works internally for the Pyre type checker, but let me see if I understand your question correctly. Are you looking to build the source-db and use it in some other language server? Which Python LSP integration do you mean?

The source-db is a mapping from files on disk to where files would end up in a par (so essentially how files get remapped in the resulting executable). It also makes sure any other generated files are 'ensured', so they exist on disk for you to utilize. Depending on what you're looking for here, one of the other sourcedb scripts might be more useful to you, or this may be doing something other than what you're expecting.

For Pyre, we use the resulting sourcedb to understand what file an import in a Python file actually points to, and to make sure something like a .pyi file generated from specific c(++) rules exist for us to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants