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

feat(lsp): Allow passing environment variables to the language server #438

Merged
merged 1 commit into from
Feb 15, 2025

Conversation

cameron-martin
Copy link
Collaborator

This adds an extra configuration option, bazel.lsp.env, which passes extra environment variables to the language server. This is useful to enable logging, for example.

This adds an extra configuration option, `bazel.lsp.env`, which passes extra environment variables to the language server. This is useful to enable logging, for example.
@vogelsgesang
Copy link
Collaborator

By the way: I have been wondering...
Should we keep everything in a monolithic extension? Or should we distribute it across multiple extensions? E.g. should the language server maybe be a separate VSCode extension?

For the current functionality in this extension (which centers around calling into Bazel into various ways), it makes sense to have it all in one place. Otherwise, code sharing would be pretty hard. But the LSP (both your Starlark language server and my bazelrc-lsp rarely invoke the Bazel binary, and don't need to share much code with this extension here.

Also see #435. WDYT? Should we work towards splitting off the language servers from this extension?

@cameron-martin
Copy link
Collaborator Author

cameron-martin commented Feb 15, 2025

I'm not too familiar with the trade-offs here. What would be the motivation for splitting this up?

One thing to consider is that this extension disables some inbuilt functionality if the language server is enabled, on the basis that the language server is likely to provide this. Is this sort of interaction between extensions possible? This wouldn't be an issue if this functionality was removed entirely from the bazel extension and expected to be provided by a language server.

Would each language server be expected to provide it's own extension when there are multiple implementations? If so, this would have the disadvantage of multiple similar extensions, with associated release processes etc, but the advantage of being able to do things specific to the language server, such as shipping the language server with the extension, or auto-downloading it.

User experience is another consideration. Having everything in one extension is nice from that perspective, so the user installs one extension and gets all the features in one go.

@cameron-martin cameron-martin merged commit 0dc2684 into bazel-contrib:master Feb 15, 2025
1 check passed
@cameron-martin cameron-martin deleted the lsp-env branch February 15, 2025 19:08
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

Successfully merging this pull request may close these issues.

2 participants