-
Notifications
You must be signed in to change notification settings - Fork 185
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
refactor: make LspApplyDocumentEditCommand take plain TextEdits #2393
Merged
Conversation
This file contains 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
jwortmann
reviewed
Jan 14, 2024
This was referenced Jan 14, 2024
When I saw the PR, I immediately wrote a list of plugins affected by this change:
... I continued to read the PR description only to find out that this work had already been done :) |
I guess it's good that you've double checked. I might be missing some repos although it seems like we are aligned in this case. |
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.
Refactor per discussion in #2389 (comment)
lsp_apply_document_edit
take[TextEdit]
rather than parsed custom structure.LSP.plugin.core.edit.apply_workspace_edit
function (usesession.apply_workspace_edit_async
instead)LSP.plugin.formatting.apply_text_edits_to_view
function (useLSP.plugin.apply_text_edits
instead)LSP.plugin.core.edit.parse_text_edit
toLSP.plugin.edit._parse_text_edit
(and make "private")LSP.plugin.core.edit.parse_workspace_edit
function (returns unparsed edits)apply_text_edits
as a public APIIn one test I had to change the test for overflow handling from passing
sys.maxsize + 1
offset toUINT_MAX + 1
offset because ST API won't allowsys.maxsize + 1
. I guess this could be one minor reason why parsing before triggeringlsp_apply_document_edit
was there but since LSP spec limits toUINT_MAX
anyway, it should be fine.Note that changes to those private APIs would break a couple of LSP packages so I'll be creating PRs for those and linking here.
Also note that I've exposed
apply_text_edits
as a public API since I am very much in favor of exposing an API function rather than LSP packages calling the ST command directly since the latter is not type-checked.Needs to be released simultaneously with: