mirror of https://github.com/golang/go.git
internal/lsp: change the type of CompletionItem.TextEdit back
The recent LPS protocol change made the definition of textEdit into
a union type, so the generated code made TextEdit an interface{},
which broke govim. This CL reverts it to a *TextEdit. The code
generator will be fixed in another CL.
We can revisit this when gopls wants to start using the new
InsertReplaceEdit type.
Change-Id: I4d7a14b3746b747f34b0907f72ecbc3593706a05
Reviewed-on: https://go-review.googlesource.com/c/tools/+/222765
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
b84001dd64
commit
3e041465cc
|
|
@ -674,7 +674,7 @@ type CompletionItem struct {
|
|||
*
|
||||
* @since 3.16.0 additional type `InsertReplaceEdit` - Proposed state
|
||||
*/
|
||||
TextEdit interface{}/*TextEdit | InsertReplaceEdit*/ `json:"textEdit,omitempty"`
|
||||
TextEdit *TextEdit/*TextEdit | InsertReplaceEdit*/ `json:"textEdit,omitempty"`
|
||||
/**
|
||||
* An optional array of additional [text edits](#TextEdit) that are applied when
|
||||
* selecting this completion. Edits must not overlap (including the same insert position)
|
||||
|
|
|
|||
|
|
@ -428,14 +428,14 @@ func CheckCompletionOrder(want, got []protocol.CompletionItem, strictScores bool
|
|||
func DiffSnippets(want string, got *protocol.CompletionItem) string {
|
||||
if want == "" {
|
||||
if got != nil {
|
||||
x := got.TextEdit.(*protocol.TextEdit)
|
||||
x := got.TextEdit
|
||||
return fmt.Sprintf("expected no snippet but got %s", x.NewText)
|
||||
}
|
||||
} else {
|
||||
if got == nil {
|
||||
return fmt.Sprintf("couldn't find completion matching %q", want)
|
||||
}
|
||||
x := got.TextEdit.(*protocol.TextEdit)
|
||||
x := got.TextEdit
|
||||
if want != x.NewText {
|
||||
return fmt.Sprintf("expected snippet %q, got %q", want, x.NewText)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue