-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gopls/protocol: Allow AnnotatedTextEdits
In the LSP specification, the Edits fields of a TextdocumentEdit are a union type TextEdit | AnnotatedTextEdit. The latter has an extra field that might be useful. This CL contains one way of allowing AnnotatedTextEdits in this context. The systematic naming of union type provides this one with a long name, Or_TextDocumentEdit_edits_Elem. Fortunately this name appears in very few places. Fitting the new type in the existing gopls code requires 1. Conversions between []newtype and []TextEdit. This code is AsTextEdits() and AsAnnotatedTextEdits() in protocol/edits.go 1a. Because gopls does not insist on go1.20, slices of the new type cannot be used as the argument to protocol.NonNilSlice(), so the second function cannot return nil, but must return a slice. 2. There are some places where previously a TextEdit was built. These now require explicitly constructing an element of the new type. This CL does not make any use of AnnotatedTextEdits, but it does make their use possible. Change-Id: Ib167f057068a5921c77572c43dc985da0e6b19bc Reviewed-on: https://go-review.googlesource.com/c/tools/+/547295 Run-TryBot: Peter Weinberger <pjw@google.com> Reviewed-by: Suzy Mueller <suzmue@golang.org> TryBot-Bypass: Peter Weinberger <pjw@google.com>
- Loading branch information
Showing
13 changed files
with
63 additions
and
20 deletions.
There are no files selected for viewing
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
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
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
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