Lsp v3 - #767
Draft
irevoire wants to merge 8 commits into
Draft
Conversation
irevoire
force-pushed
the
lsp3
branch
2 times, most recently
from
October 22, 2025 21:41
5b2fac0 to
3bccf98
Compare
irevoire
force-pushed
the
lsp3
branch
2 times, most recently
from
October 25, 2025 14:51
a106a13 to
fad7235
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Superseed #538
Target of this PR:
What works
Unsafe use
I defined a "File" like that:
I need to store the statements for code action, and as you can see, they have a lifetime of
'static.In numbat-cli, that's not a big deal, as we can
Box::leakthe file. But in the lsp where each file modification generates an entirely new file, that's not possible.Since the statements depend on the content, which is stored in the same struct, that also means we're doing a self-referential thingy.
I solved the issue by:
Pinning the content so we're sure it never moves, and the ref stays valid in the statementsoriginal_stmtswe have to "cast" their slice to'staticwith an unsafemem::transmuteWhat needs to be fixed
usestmts we sometimes have to emit errors, and sometimes we must override the current env