Skip to content

Handle create/rename/delete TextDocumentEdits#1607

Open
Lazzer64 wants to merge 13 commits into
prabirshrestha:masterfrom
Lazzer64:lazzer64/text_document_edits
Open

Handle create/rename/delete TextDocumentEdits#1607
Lazzer64 wants to merge 13 commits into
prabirshrestha:masterfrom
Lazzer64:lazzer64/text_document_edits

Conversation

@Lazzer64
Copy link
Copy Markdown

Not all WorkspaceEdits are text document changes. Add support for create/rename/delete edits.

@mattn
Copy link
Copy Markdown
Collaborator

mattn commented Jan 1, 2026

Thank you. Can you add tests?

@Lazzer64
Copy link
Copy Markdown
Author

Lazzer64 commented Jan 8, 2026

Added the following

lsp#utils#workspace_edit
  lsp#utils#text_edit#apply_workspace_edit
    [o] should create a new file if kind is create
    [o] should rename a new file if kind is rename
    [o] should delete the file if kind is delete
integration#go#text_document_edits
  [o] should create a new test file

@mattn
Copy link
Copy Markdown
Collaborator

mattn commented Jan 27, 2026

@Lazzer64 Some tests seems failing with double slash issue. Please take a look.

gopls v0.17.0 introduces source.addTest used in the
integration#go#text_document_edits test case.
@Lazzer64
Copy link
Copy Markdown
Author

@mattn fixed up those test cases, but don't have a windows machine to verify there at the moment.

I also bumped gopls to v0.17.0 since it adds the codeaction I wanted to use in the integration test (source.addTest).

@Lazzer64
Copy link
Copy Markdown
Author

Looks like go needed a bump to install the newer gopls, updated that too now.

@mattn
Copy link
Copy Markdown
Collaborator

mattn commented Jan 28, 2026

It seems there are still issues with Windows.

LspCodeActionSync hangs on neovim switching to LspCodeAction plus a
brief sleep until it is resolved.
@Lazzer64
Copy link
Copy Markdown
Author

@mattn updated to use lsp#utils#path_to_uri instead of a fixed string.

I also saw that, even before this change, the LspCodeActionSync command is hanging in neovim. For the integration test I swapped to using LspCodeAction and a short sleep instead. I think the LspCodeActionSync issue is deserving of its own issue.

@Lazzer64 Lazzer64 requested a review from mattn January 28, 2026 18:27
@mattn
Copy link
Copy Markdown
Collaborator

mattn commented Mar 8, 2026

Test seems still not working.

integration#go#text_document_edits

  [x] should create a new test file

      Error occurred line:

       16:         Assert Equals(expand("%:p:t"), "math_test.go")

      The equivalent values were expected, but it was not the case.

      

          expected: 'math_test.go'

               got: 'math.go'

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