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

Add LSP functionality to Rover #2272

Merged
merged 10 commits into from
Jan 20, 2025
Merged

Add LSP functionality to Rover #2272

merged 10 commits into from
Jan 20, 2025

Conversation

jonathanrainer
Copy link
Contributor

@jonathanrainer jonathanrainer commented Nov 24, 2024

Now that the LSP has been finalised, and composition has been refactored such that it can consume events in the same way that rover dev does we can unify the two together.

This has been tested by running a custom build version of Rover against VSCode and it seems to function as intended. We will need to hash out a few more things in the review overall but this is a very positive step forwards

@jonathanrainer jonathanrainer requested a review from a team as a code owner November 24, 2024 08:51
@svc-apollo-docs
Copy link
Collaborator

svc-apollo-docs commented Nov 24, 2024

✅ Docs preview has no changes

The preview was not built because there were no changes.

Build ID: 78e8da5fde3c5380079965a8

@jonathanrainer jonathanrainer force-pushed the jr/task/ROVER-245 branch 2 times, most recently from 9d740fa to 91bbdc6 Compare November 24, 2024 08:54
Comment on lines 123 to 192
// TODO: Let the supergraph binary exist inside its own task that can respond to being re-installed etc.
let supergraph_binary =
InstallSupergraph::new(federation_version.clone(), client_config.clone())
.install(
None,
lsp_opts.plugin_opts.elv2_license_accepter,
lsp_opts.plugin_opts.skip_update,
)
.await?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

One of the features (I think) of the old PR is that it allows people to update the version of Federation inside the supergraph.yaml while it's running. When doing the dev refactor we made an explicit decision that we didn't want to support that behaviour. Is that a dealbreaker for the LSP? Or could we ship this as is and see if there's sufficient demand after the fact to implement that?

Copy link
Member

Choose a reason for hiding this comment

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

It's a pretty bad UX to not watch supergraph.yaml because the way to manually restart the language server underneath VS Code is really clunky—and it's not at all obvious when you should do that. If someone modifies their supergraph.yaml file and still sees out of date validations, it's going to be frustrating.

@jonathanrainer
Copy link
Contributor Author

Also a general comment:

@dylan-apollo I couldn't see a way to inject a profile into the Rover invocation for the LSP, which meant I had to mess around to get my default profile set up. Is this intentional or did I miss something?

src/cli.rs Show resolved Hide resolved
src/command/lsp/README.md Outdated Show resolved Hide resolved
src/command/lsp/mod.rs Outdated Show resolved Hide resolved
src/command/lsp/mod.rs Outdated Show resolved Hide resolved
src/command/lsp/mod.rs Outdated Show resolved Hide resolved
src/composition/supergraph/config/resolve/mod.rs Outdated Show resolved Hide resolved
src/composition/supergraph/config/resolve/mod.rs Outdated Show resolved Hide resolved
src/composition/supergraph/config/resolve/subgraph.rs Outdated Show resolved Hide resolved
src/composition/supergraph/config/resolve/subgraph.rs Outdated Show resolved Hide resolved
src/composition/supergraph/config/resolve/subgraph.rs Outdated Show resolved Hide resolved
@dylan-apollo
Copy link
Member

@dylan-apollo I couldn't see a way to inject a profile into the Rover invocation for the LSP, which meant I had to mess around to get my default profile set up. Is this intentional or did I miss something?

@jonathanrainer there is an extraArgs that can be put in the VS Code extension's config to pass a list of arbitrary extra things to Rover... like profile. That's really a catch-all workaround right now, though, we should probably make profile it's own, top-level option in the extension's config.

Copy link
Contributor

@aaronArinder aaronArinder left a comment

Choose a reason for hiding this comment

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

slapping a like & subscribe on this bad boy because I think it's mergeable as-is, though I know you'll make certain changes here and there (request re-review if you want); I haven't actually tried this out in the wild, though, but not sure that's really on our team to do

@jonathanrainer jonathanrainer force-pushed the jr/task/ROVER-245 branch 6 times, most recently from 7311712 to e443b00 Compare December 20, 2024 13:58
@jonathanrainer jonathanrainer force-pushed the jr/task/ROVER-245 branch 5 times, most recently from 24ba4ff to f993ef7 Compare January 8, 2025 06:13
src/command/lsp/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@dylan-apollo dylan-apollo left a comment

Choose a reason for hiding this comment

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

Looks good to me (ignoring the couple tickets we're tracking separately)! I think we're basically at the point where we need to start using it regularly to find any edge cases. Thanks all for powering through this epic 🫶

src/command/lsp/mod.rs Outdated Show resolved Hide resolved
@jonathanrainer jonathanrainer force-pushed the jr/task/ROVER-245 branch 3 times, most recently from dcaa3a6 to 487336e Compare January 15, 2025 11:07
Clumps together other minor fixes without them
dirtying other bits of the commit history.
Takes the approach of dumping the existing LSP
code straight into what we have and integrating
it to the point of compilation.
We need to emit extra events here such that the LSP can react
to them
At present, we only support 2 composition output targets, this
adds a third, which means that the output of composition only
exists in memory. This means we don't have to write/manage temporary
files, and we don't compete with the LSP for usage of stdout.
We want to set a sensible default here (5 seconds), while giving
users the ability to override it if that becomes problematic.
Copy link
Contributor

@aaronArinder aaronArinder left a comment

Choose a reason for hiding this comment

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

lgtm!

@@ -73,6 +73,8 @@ apollo-encoder = "0.8"
# https://github.com/apollographql/federation-rs
apollo-federation-types = "0.14.1"

apollo-language-server = { version = "0.3.4", default-features = false, features = ["tokio"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

is the latest version? I want to say I saw a bump recently; might be worth a follow-up with it, if there was one

Copy link
Member

Choose a reason for hiding this comment

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

@jonathanrainer jonathanrainer merged commit 58ea754 into main Jan 20, 2025
32 checks passed
@jonathanrainer jonathanrainer deleted the jr/task/ROVER-245 branch January 20, 2025 15:37
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.

6 participants