Skip to content

x/tools/gopls: update protocol generation to support unions #52969

Closed
@findleyr

Description

@findleyr

In the implementation of #41567, it is likely that we will need to extend our support for workspace edits.

Specifically, the WorkspaceEdit protocol type supports resource operations creating, renaming, and deleting files:

documentChanges?: (
		[TextDocumentEdit](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentEdit)[] |
		([TextDocumentEdit](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentEdit) | [CreateFile](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#createFile) | [RenameFile](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#renameFile) | [DeleteFile](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#deleteFile))[]
	);

However, our protocol generation only supports []TextDocumentEdit:
https://cs.opensource.google/go/x/tools/+/master:internal/lsp/protocol/tsprotocol.go;l=5702;drc=b7d757405fe14c924baefbdedd785e4c6a7a0f88

In order to implement package renaming, we'll want to rename directories, and so will need to be able to express this in our WorkspaceEdit response.

CC @dle8 @pjweinb

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions