Skip to content

switch out lsp-types for gen-lsp-types#22115

Open
BenjaminBrienen wants to merge 5 commits into
rust-lang:masterfrom
BenjaminBrienen:gen-lsp-types
Open

switch out lsp-types for gen-lsp-types#22115
BenjaminBrienen wants to merge 5 commits into
rust-lang:masterfrom
BenjaminBrienen:gen-lsp-types

Conversation

@BenjaminBrienen

@BenjaminBrienen BenjaminBrienen commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 20, 2026
Comment thread crates/rust-analyzer/src/bin/main.rs Outdated
Comment thread crates/rust-analyzer/src/handlers/request.rs Outdated
@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@BenjaminBrienen BenjaminBrienen force-pushed the gen-lsp-types branch 2 times, most recently from 552f6d5 to b10f69c Compare April 23, 2026 13:35
@rustbot

This comment has been minimized.

@ribru17

ribru17 commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Heads up @BenjaminBrienen I just pushed v0.4.0, will probably affect this PR

@BenjaminBrienen

Copy link
Copy Markdown
Contributor Author

I already updated to it :)

@BenjaminBrienen BenjaminBrienen force-pushed the gen-lsp-types branch 2 times, most recently from fd865d7 to 90f1985 Compare April 24, 2026 00:47
@BenjaminBrienen

Copy link
Copy Markdown
Contributor Author

I'm assuming you would like a side of squash with this meal

@ribru17

ribru17 commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Comment on lines -2660 to -2661
// FIXME: Also detect the proposed lsp version at caps.workspace.workspaceEdit.snippetEditSupport
// once lsp-types has it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I already have a draft PR based on top of this one that implements the split and uses the capability properly, so I just removed the comment for now. Is that fine?

@DropDemBits DropDemBits left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Going through all of the it.method == R::METHOD changes made me realize that there's no request-equivalent helper function of notification_is 😅

My main concern though is if the file:// scheme is still required though, as I think the tests ensure that we're emitting self-consistent values rather than if those values actually make sense for the LS client.

View changes since this review

Comment thread crates/rust-analyzer/src/lsp/utils.rs Outdated
Comment thread crates/rust-analyzer/src/lsp/utils.rs Outdated
Comment thread crates/rust-analyzer/src/lsp/semantic_tokens.rs Outdated
Comment thread crates/rust-analyzer/src/lsp/ext.rs
Comment thread crates/rust-analyzer/src/diagnostics/test_data/rustc_range_map_lsp_position.txt Outdated
Comment thread crates/rust-analyzer/src/handlers/dispatch.rs Outdated
Comment thread crates/rust-analyzer/src/handlers/dispatch.rs Outdated
Comment thread crates/rust-analyzer/src/handlers/dispatch.rs Outdated
Comment thread crates/rust-analyzer/src/handlers/dispatch.rs Outdated
Comment on lines -2660 to -2661
// FIXME: Also detect the proposed lsp version at caps.workspace.workspaceEdit.snippetEditSupport
// once lsp-types has it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I hadn't known about the draft PR, sorry!

@rustbot

rustbot commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@BenjaminBrienen

BenjaminBrienen commented Apr 24, 2026

Copy link
Copy Markdown
Contributor Author

It is failing because of something to do with the difference between resource operation and document change, I think. It is just one slow test. I couldn't figure out the reason.

@BenjaminBrienen BenjaminBrienen force-pushed the gen-lsp-types branch 2 times, most recently from 4e097a1 to c7b031d Compare April 24, 2026 20:56
Comment thread crates/rust-analyzer/src/lsp/capabilities.rs
Comment thread crates/rust-analyzer/src/lsp/capabilities.rs Outdated
Comment thread crates/rust-analyzer/src/handlers/dispatch.rs
Comment thread crates/rust-analyzer/src/lsp/capabilities.rs
Comment thread crates/rust-analyzer/src/lsp/from_proto.rs Outdated
Comment thread crates/rust-analyzer/src/lsp/utils.rs
Comment thread crates/rust-analyzer/src/lsp/utils.rs
Comment thread Cargo.lock
Comment thread crates/rust-analyzer/src/lsp/from_proto.rs
Comment thread crates/rust-analyzer/src/lsp/ext.rs Outdated
Comment thread crates/rust-analyzer/src/lsp/semantic_tokens.rs Outdated
Comment thread crates/rust-analyzer/src/main_loop.rs
Comment thread crates/rust-analyzer/src/bin/main.rs Outdated
Comment thread crates/rust-analyzer/src/lsp/semantic_tokens.rs Outdated
Comment thread crates/rust-analyzer/src/lsp/semantic_tokens.rs Outdated
Comment thread crates/rust-analyzer/src/lsp/semantic_tokens.rs
Comment thread crates/rust-analyzer/Cargo.toml Outdated
Comment thread crates/rust-analyzer/src/lib.rs Outdated
ribru17 added a commit to ribru17/beancount-language-server that referenced this pull request May 1, 2026
[gen-lsp-types](https://github.com/ribru17/gen-lsp-types) is an
alternative to the lsp-types crate, with types generated via codegen
from the official LSP Metamodel for correctness and completeness.

lsp-types issues fixed in gen-lsp-types:

- gluon-lang/lsp-types#310
- gluon-lang/lsp-types#308
- gluon-lang/lsp-types#284
- gluon-lang/lsp-types#278
- gluon-lang/lsp-types#277
- gluon-lang/lsp-types#260
- gluon-lang/lsp-types#245
- gluon-lang/lsp-types#93

See: wgsl-analyzer/wgsl-analyzer#1090 and
rust-lang/rust-analyzer#22115
polarmutex pushed a commit to polarmutex/beancount-language-server that referenced this pull request May 1, 2026
[gen-lsp-types](https://github.com/ribru17/gen-lsp-types) is an
alternative to the lsp-types crate, with types generated via codegen
from the official LSP Metamodel for correctness and completeness.

lsp-types issues fixed in gen-lsp-types:

- gluon-lang/lsp-types#310
- gluon-lang/lsp-types#308
- gluon-lang/lsp-types#284
- gluon-lang/lsp-types#278
- gluon-lang/lsp-types#277
- gluon-lang/lsp-types#260
- gluon-lang/lsp-types#245
- gluon-lang/lsp-types#93

See: wgsl-analyzer/wgsl-analyzer#1090 and
rust-lang/rust-analyzer#22115
@rustbot

rustbot commented May 4, 2026

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (possibly #22284) made this pull request unmergeable. Please resolve the merge conflicts.

ribru17 added a commit to ribru17/htmx-lsp that referenced this pull request May 7, 2026
[gen-lsp-types](https://github.com/ribru17/gen-lsp-types) is an
alternative to the lsp-types crate, with types generated via codegen
from the official LSP Metamodel for correctness and completeness.

lsp-types issues fixed in gen-lsp-types:

- gluon-lang/lsp-types#310
- gluon-lang/lsp-types#308
- gluon-lang/lsp-types#284
- gluon-lang/lsp-types#278
- gluon-lang/lsp-types#277
- gluon-lang/lsp-types#260
- gluon-lang/lsp-types#245
- gluon-lang/lsp-types#93

See rust-lang/rust-analyzer#22115 and
wgsl-analyzer/wgsl-analyzer#1090 for other
migration considerations.
ribru17 added a commit to ribru17/gleam that referenced this pull request May 7, 2026
[gen-lsp-types](https://github.com/ribru17/gen-lsp-types) is an
alternative to the lsp-types crate, with types generated via codegen
from the official LSP Metamodel for correctness and completeness.

lsp-types issues fixed in gen-lsp-types:

- gluon-lang/lsp-types#310
- gluon-lang/lsp-types#308
- gluon-lang/lsp-types#284
- gluon-lang/lsp-types#278
- gluon-lang/lsp-types#277
- gluon-lang/lsp-types#260
- gluon-lang/lsp-types#245
- gluon-lang/lsp-types#93

See: wgsl-analyzer/wgsl-analyzer#1090 and
rust-lang/rust-analyzer#22115
lpil pushed a commit to ribru17/gleam that referenced this pull request May 12, 2026
[gen-lsp-types](https://github.com/ribru17/gen-lsp-types) is an
alternative to the lsp-types crate, with types generated via codegen
from the official LSP Metamodel for correctness and completeness.

lsp-types issues fixed in gen-lsp-types:

- gluon-lang/lsp-types#310
- gluon-lang/lsp-types#308
- gluon-lang/lsp-types#284
- gluon-lang/lsp-types#278
- gluon-lang/lsp-types#277
- gluon-lang/lsp-types#260
- gluon-lang/lsp-types#245
- gluon-lang/lsp-types#93

See: wgsl-analyzer/wgsl-analyzer#1090 and
rust-lang/rust-analyzer#22115
lpil pushed a commit to gleam-lang/gleam that referenced this pull request May 12, 2026
[gen-lsp-types](https://github.com/ribru17/gen-lsp-types) is an
alternative to the lsp-types crate, with types generated via codegen
from the official LSP Metamodel for correctness and completeness.

lsp-types issues fixed in gen-lsp-types:

- gluon-lang/lsp-types#310
- gluon-lang/lsp-types#308
- gluon-lang/lsp-types#284
- gluon-lang/lsp-types#278
- gluon-lang/lsp-types#277
- gluon-lang/lsp-types#260
- gluon-lang/lsp-types#245
- gluon-lang/lsp-types#93

See: wgsl-analyzer/wgsl-analyzer#1090 and
rust-lang/rust-analyzer#22115
@Veykril

Veykril commented May 25, 2026

Copy link
Copy Markdown
Member

If you could rebase once more, will get this merged then 🙏
Thanks!

@stothej

stothej commented May 26, 2026

Copy link
Copy Markdown

@Veykril If I can ask a question from the peanut gallery... Isn't there some inherent risk with swapping to a library that's less than 2 months old, from an (admittedly unmaintained) stable one? It's also not a drop-in replacement, unfortunately (hence the 2k line diff). As an example, the version in Cargo.toml is already 2 versions out of date (0.4.0 instead of 0.6.0).

I've seen @ribru17 send PRs of this library to a lot of other projects who are depending on gluon's lsp_types - and then referencing this PR as social proof for it going in. That feels gross to me - but OSS libs are a chicken/egg problem, so there's that.

Anyways, just raising a flag as someone who maintains a bunch of OSS projects and LSP servers (using lsp_server) - take this comment with whatever grains of salt are required.

Personally I was hoping that Microsoft's lsprotocol would have gone somewhere, and solved this problem. I've vendored Helix's lsp-types in my projects for now.

Edit: Changed spam to send - as the former sounded too much like a personal attack, while this is a comment about technical stability and long-term viability.

@lnicola

lnicola commented May 26, 2026

Copy link
Copy Markdown
Member

@stothej we're switching from a hand-written crate to an automatically generated one, which is somewhat we've wanted anyway. Even if the author goes away, we can take over or fork it, and it's going to be easier. Most of the 2000-line diff is to test outputs (because fields were missing in the old crate) and different module and struct names.

and then referencing this PR as social proof for it going in

Which seems totally fair, given that ribru17 listened to our feedback incorporated the changes we've requested.

rizaziz pushed a commit to mayhemheroes/wgsl-analyzer that referenced this pull request May 26, 2026
# Objective

Better correctness and use a maintained crate.

## Solution

Adapt rust-lang/rust-analyzer#22115

## Testing

Changes are 1:1 with r-a and the tests there were good. We don't have
those tests adapted yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants