@@ -540,16 +540,42 @@ var completionItemKindName = map[CompletionItemKind]string{
540
540
}
541
541
542
542
type CompletionItem struct {
543
- Label string `json:"label"`
544
- Kind CompletionItemKind `json:"kind,omitempty"`
545
- Detail string `json:"detail,omitempty"`
546
- Documentation string `json:"documentation,omitempty"`
547
- SortText string `json:"sortText,omitempty"`
548
- FilterText string `json:"filterText,omitempty"`
549
- InsertText string `json:"insertText,omitempty"`
550
- InsertTextFormat InsertTextFormat `json:"insertTextFormat,omitempty"`
551
- TextEdit * TextEdit `json:"textEdit,omitempty"`
552
- Data interface {} `json:"data,omitempty"`
543
+ Label string `json:"label"`
544
+ Kind CompletionItemKind `json:"kind,omitempty"`
545
+ Detail string `json:"detail,omitempty"`
546
+ Documentation * StringOrMarkupContent `json:"documentation,omitempty"`
547
+ SortText string `json:"sortText,omitempty"`
548
+ FilterText string `json:"filterText,omitempty"`
549
+ InsertText string `json:"insertText,omitempty"`
550
+ InsertTextFormat InsertTextFormat `json:"insertTextFormat,omitempty"`
551
+ TextEdit * TextEdit `json:"textEdit,omitempty"`
552
+ Data interface {} `json:"data,omitempty"`
553
+ }
554
+
555
+ type StringOrMarkupContent struct {
556
+ String * string
557
+ MarkupContent * MarkupContent
558
+ }
559
+
560
+ // MarshalJSON implements json.Marshaler.
561
+ func (v * StringOrMarkupContent ) MarshalJSON () ([]byte , error ) {
562
+ if v .String != nil {
563
+ return json .Marshal (v .String )
564
+ }
565
+ return json .Marshal (v .MarkupContent )
566
+ }
567
+
568
+ // UnmarshalJSON implements json.Unmarshaler.
569
+ func (v * StringOrMarkupContent ) UnmarshalJSON (data []byte ) error {
570
+ var s string
571
+ if err := json .Unmarshal (data , & s ); err == nil {
572
+ v .String = & s
573
+ v .MarkupContent = nil
574
+ return nil
575
+ }
576
+ v .String = nil
577
+ err := json .Unmarshal (data , & v .MarkupContent )
578
+ return err
553
579
}
554
580
555
581
type CompletionList struct {
0 commit comments