x/tools/gopls/internal/lsp/protocol: use AnnotatedTextEdit for TextDocumentEdit.Edits #58583
Labels
FeatureRequest
gopls
Issues related to the Go language server, gopls.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
In 3.16, LSP introduced support for
AnnotatedTextEdit
that allows annotations to a text edit andsupports UX that optionally asks user for confirmation before applying the change.
TextDocumentEdit.Edits
is defined an array ofTextEdit | AnnotatedTextEdit
according to the spec,but Gopls is currently accepting only
TextEdit
type. It would be nice if gopls uses AnnotatedTextEdit instead of TextEditso we can experiment and start developing features with the AnnotatedTextEdit.
Given that
AnnotatedTextEdit
is a simple extension ofTextEdit
with one extra field (annotationId
),I think we can consider to replace all references of TextEdit in gopls with AnnotatedTextEdit while marking the annotatedId field omitempty.
Alternatively, I saw some internal non-TS/JS LSP implementations work around this OR type issue by a type corresponding to TextEdit
cc @pjweinb
The text was updated successfully, but these errors were encountered: