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: Add LSP stub #5197

Merged
merged 7 commits into from
Mar 27, 2025
Merged

feat: Add LSP stub #5197

merged 7 commits into from
Mar 27, 2025

Conversation

vanillajonathan
Copy link
Collaborator

Adds a stub implementations of a basic Language Server Protocol (LSP) to prqlc. LSP clients can connect to it and disconnect from it.

It use the lsp-server crate used by the official rust-analyzer.

The LSP specification is at https://microsoft.github.io/language-server-protocol/specifications/specification-current

@max-sixty
Copy link
Member

looks cool, would be great to build this out in time!

to reduce dependencies in there meantime, could we add an optional lsp feature?

@vanillajonathan
Copy link
Collaborator Author

Okay, I made the dependency optional.

Yes it would be cool build this out in time. The next steps we need to do is to create match statements for DidOpenTextDocument, DidChangeTextDocument and DidCloseTextDocument then proceed with Completion, Formatting and HoverRequest.

@max-sixty
Copy link
Member

Looks good! May need some refining on the tests outputs but good to go otherwise

@vanillajonathan
Copy link
Collaborator Author

I think no more tests are needed for now because we shouldn't test the lsp-server crate. We can add more tests later when we add more handlers such as DidOpenTextDocument, DidChangeTextDocument and DidCloseTextDocument.

The test fails on some test-deps-min-version (verify Rust minimum version) thing.

Can you merge this?

@max-sixty
Copy link
Member

The test fails on some test-deps-min-version (verify Rust minimum version) thing.

OK, but we can't have main failing, so we need to fix that...

It seems to additionally be failing because the completion snapshot files need updating: https://github.com/PRQL/prql/actions/runs/14046209187/job/39327515449?pr=5197

@vanillajonathan
Copy link
Collaborator Author

Okay, I updated shell completion snapshots.

@@ -22,12 +22,14 @@ cli = [
"color-eyre",
"colorchoice-clap",
"is-terminal",
"lsp",
Copy link
Member

Choose a reason for hiding this comment

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

but lsp shouldn't be in cli by default, then we're including features that introduce dependencies without any functionality

does that make sense? I think you can recognize this!

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 possible that fixing this undoes the changes to the tests, apologies if so — they should all reset with the standard test commands at least)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, that makes sense.

Copy link
Member

@max-sixty max-sixty left a comment

Choose a reason for hiding this comment

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

lgtm!

@vanillajonathan vanillajonathan merged commit 603ee15 into main Mar 27, 2025
79 checks passed
@vanillajonathan vanillajonathan deleted the feat-lsp branch March 27, 2025 23:46
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