Switch to tower_lsp_server - #1362
Merged
Merged
Conversation
lionel-
force-pushed
the
tower-lsp-server
branch
from
July 28, 2026 09:32
dfcba0a to
c3c95ec
Compare
jmcphers
approved these changes
Jul 29, 2026
jmcphers
left a comment
Contributor
There was a problem hiding this comment.
Nice to get onto a more maintained version of this crate!
| @@ -0,0 +1,122 @@ | |||
| // Utilites for converting internal types to LSP types | |||
Contributor
There was a problem hiding this comment.
Here and elsewhere: do these new files need Posit copyright headers?
Contributor
Author
There was a problem hiding this comment.
I'd say no because Oak and Aether crates will soon move to their own repo, where we'll follow the Rust community convention of headerless files, which we already follow in Air.
lionel-
force-pushed
the
tower-lsp-server
branch
from
July 30, 2026 10:41
c3c95ec to
f0f7b88
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1361
Test suite passed at posit-dev/positron#15174
Because
tower_lspdoesn't handleexitnotifications and is unmaintained, we've pinned it to a fork that includes a patch forexit: https://github.com/lionel-/tower-lsp/tree/bugfix/patches. However it turns out this patch is buggy in case of unexpected disconnections.To fix both the exit handling and the unexpected disconnection issue, this PR switches us to
tower_lsp_server, a maintained community fork oftower_lsp(https://github.com/tower-lsp-community/tower-lsp-server/). It's used by Biome, which indicates reliability.tower_lsp_server and the disconnection fix
The first two commits add integration tests for shutdown and disconnection. The failing test output with our current version of tower-lsp matches the panics documented in the linked issue:
The third commit is the mechanical switch to the community fork, and it fixes the failing test.
The third commit also copies
aether_lsp_utilsfrom the Air repo, because the latter uses a different incompatiblelsp_typescrate (from tower-lsp). Ideally we'd move it to posit-dev/aether and update it to use the community fork, then point both Ark and Air to it, but this can wait until later.tower_lsp_server and the
UritypeThe fourth commit streamlines the Uri/FilePath boundary. The main change from switching to
tower_lsp_serveris that LSP URLs are represented byls_types::Uriwhich wraps https://docs.rs/fluent-uri/latest/fluent_uri. Thistype has different properties than
url::Url, which we use for Jupyter andtower_lspused to use for LSP.Uriimplements RFC 3986, which is recommended by the LSP protocol, whereasUrlimplements WHATWG. The maindifferences are:
Urldoes some normalisation, whereasUristores bytes as is.Urlaccepts| [ ] ^characters,Urirejects them.Given that
Uridoesn't do any normalisation, it's a better representation of wire URLs which we were already tracking for sending back URLs to the frontend exactly as we got them in requests. It's a good thing that we had to switch to followtower_lsp_server.Here are the principles that guided this refactor (these already existed, but we are reinforcing them):
FilePath, not by any kind of URLs. For non-virtual paths, this wrapsAbsPathBuf.Urinow plays that role.UriandFilePathare converted at the LSP boundary.AbsPathBuf(unwrapped fromFilePath).