// Code generated by generate.mts; DO NOT EDIT. package lsproto import ( "fmt" "github.com/go-json-experiment/json" "github.com/go-json-experiment/json/jsontext" ) // Meta model version 3.17.0 // Structures type ImplementationParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position inside the text document. Position Position `json:"position"` // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` } func (s *ImplementationParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*ImplementationParams)(nil) func (s *ImplementationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } return nil } // Represents a location inside a resource, such as a line // inside a text file. type Location struct { Uri DocumentUri `json:"uri"` Range Range `json:"range"` } var _ json.UnmarshalerFrom = (*Location)(nil) func (s *Location) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenUri bool seenRange bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } if !seenRange { return fmt.Errorf("required property 'range' is missing") } return nil } type ImplementationRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } var _ json.UnmarshalerFrom = (*ImplementationRegistrationOptions)(nil) func (s *ImplementationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"id"`: if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } type TypeDefinitionParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position inside the text document. Position Position `json:"position"` // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` } func (s *TypeDefinitionParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*TypeDefinitionParams)(nil) func (s *TypeDefinitionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } return nil } type TypeDefinitionRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } var _ json.UnmarshalerFrom = (*TypeDefinitionRegistrationOptions)(nil) func (s *TypeDefinitionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"id"`: if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // A workspace folder inside a client. type WorkspaceFolder struct { // The associated URI for this workspace folder. Uri URI `json:"uri"` // The name of the workspace folder. Used to refer to this // workspace folder in the user interface. Name string `json:"name"` } var _ json.UnmarshalerFrom = (*WorkspaceFolder)(nil) func (s *WorkspaceFolder) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenUri bool seenName bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"name"`: seenName = true if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } if !seenName { return fmt.Errorf("required property 'name' is missing") } return nil } // The parameters of a `workspace/didChangeWorkspaceFolders` notification. type DidChangeWorkspaceFoldersParams struct { // The actual workspace folder change event. Event *WorkspaceFoldersChangeEvent `json:"event"` } var _ json.UnmarshalerFrom = (*DidChangeWorkspaceFoldersParams)(nil) func (s *DidChangeWorkspaceFoldersParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenEvent bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"event"`: seenEvent = true if err := json.UnmarshalDecode(dec, &s.Event); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenEvent { return fmt.Errorf("required property 'event' is missing") } return nil } // The parameters of a configuration request. type ConfigurationParams struct { Items []*ConfigurationItem `json:"items"` } var _ json.UnmarshalerFrom = (*ConfigurationParams)(nil) func (s *ConfigurationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenItems bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"items"`: seenItems = true if err := json.UnmarshalDecode(dec, &s.Items); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenItems { return fmt.Errorf("required property 'items' is missing") } return nil } // Parameters for a DocumentColorRequest. type DocumentColorParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` } func (s *DocumentColorParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*DocumentColorParams)(nil) func (s *DocumentColorParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenTextDocument bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } return nil } // Represents a color range from a document. type ColorInformation struct { // The range in the document where this color appears. Range Range `json:"range"` // The actual color value for this color range. Color Color `json:"color"` } var _ json.UnmarshalerFrom = (*ColorInformation)(nil) func (s *ColorInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenRange bool seenColor bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"color"`: seenColor = true if err := json.UnmarshalDecode(dec, &s.Color); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRange { return fmt.Errorf("required property 'range' is missing") } if !seenColor { return fmt.Errorf("required property 'color' is missing") } return nil } type DocumentColorRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } var _ json.UnmarshalerFrom = (*DocumentColorRegistrationOptions)(nil) func (s *DocumentColorRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"id"`: if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // Parameters for a ColorPresentationRequest. type ColorPresentationParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The color to request presentations for. Color Color `json:"color"` // The range where the color would be inserted. Serves as a context. Range Range `json:"range"` } func (s *ColorPresentationParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*ColorPresentationParams)(nil) func (s *ColorPresentationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenColor bool seenRange bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"color"`: seenColor = true if err := json.UnmarshalDecode(dec, &s.Color); err != nil { return err } case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenColor { return fmt.Errorf("required property 'color' is missing") } if !seenRange { return fmt.Errorf("required property 'range' is missing") } return nil } type ColorPresentation struct { // The label of this color presentation. It will be shown on the color // picker header. By default this is also the text that is inserted when selecting // this color presentation. Label string `json:"label"` // An edit which is applied to a document when selecting // this presentation for the color. When `falsy` the label // is used. TextEdit *TextEdit `json:"textEdit,omitzero"` // An optional array of additional edits that are applied when // selecting this color presentation. Edits must not overlap with the main edit nor with themselves. AdditionalTextEdits *[]*TextEdit `json:"additionalTextEdits,omitzero"` } var _ json.UnmarshalerFrom = (*ColorPresentation)(nil) func (s *ColorPresentation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenLabel bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"label"`: seenLabel = true if err := json.UnmarshalDecode(dec, &s.Label); err != nil { return err } case `"textEdit"`: if err := json.UnmarshalDecode(dec, &s.TextEdit); err != nil { return err } case `"additionalTextEdits"`: if err := json.UnmarshalDecode(dec, &s.AdditionalTextEdits); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenLabel { return fmt.Errorf("required property 'label' is missing") } return nil } type WorkDoneProgressOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } // General text document registration options. type TextDocumentRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` } var _ json.UnmarshalerFrom = (*TextDocumentRegistrationOptions)(nil) func (s *TextDocumentRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // Parameters for a FoldingRangeRequest. type FoldingRangeParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` } func (s *FoldingRangeParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*FoldingRangeParams)(nil) func (s *FoldingRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenTextDocument bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } return nil } // Represents a folding range. To be valid, start and end line must be bigger than zero and smaller // than the number of lines in the document. Clients are free to ignore invalid ranges. type FoldingRange struct { // The zero-based start line of the range to fold. The folded area starts after the line's last character. // To be valid, the end must be zero or larger and smaller than the number of lines in the document. StartLine uint32 `json:"startLine"` // The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line. StartCharacter *uint32 `json:"startCharacter,omitzero"` // The zero-based end line of the range to fold. The folded area ends with the line's last character. // To be valid, the end must be zero or larger and smaller than the number of lines in the document. EndLine uint32 `json:"endLine"` // The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line. EndCharacter *uint32 `json:"endCharacter,omitzero"` // Describes the kind of the folding range such as 'comment' or 'region'. The kind // is used to categorize folding ranges and used by commands like 'Fold all comments'. // See FoldingRangeKind for an enumeration of standardized kinds. Kind *FoldingRangeKind `json:"kind,omitzero"` // The text that the client should show when the specified range is // collapsed. If not defined or not supported by the client, a default // will be chosen by the client. // // Since: 3.17.0 CollapsedText *string `json:"collapsedText,omitzero"` } var _ json.UnmarshalerFrom = (*FoldingRange)(nil) func (s *FoldingRange) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenStartLine bool seenEndLine bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"startLine"`: seenStartLine = true if err := json.UnmarshalDecode(dec, &s.StartLine); err != nil { return err } case `"startCharacter"`: if err := json.UnmarshalDecode(dec, &s.StartCharacter); err != nil { return err } case `"endLine"`: seenEndLine = true if err := json.UnmarshalDecode(dec, &s.EndLine); err != nil { return err } case `"endCharacter"`: if err := json.UnmarshalDecode(dec, &s.EndCharacter); err != nil { return err } case `"kind"`: if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"collapsedText"`: if err := json.UnmarshalDecode(dec, &s.CollapsedText); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenStartLine { return fmt.Errorf("required property 'startLine' is missing") } if !seenEndLine { return fmt.Errorf("required property 'endLine' is missing") } return nil } type FoldingRangeRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } var _ json.UnmarshalerFrom = (*FoldingRangeRegistrationOptions)(nil) func (s *FoldingRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"id"`: if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } type DeclarationParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position inside the text document. Position Position `json:"position"` // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` } func (s *DeclarationParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*DeclarationParams)(nil) func (s *DeclarationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } return nil } type DeclarationRegistrationOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } var _ json.UnmarshalerFrom = (*DeclarationRegistrationOptions)(nil) func (s *DeclarationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"id"`: if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // A parameter literal used in selection range requests. type SelectionRangeParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The positions inside the text document. Positions []Position `json:"positions"` } func (s *SelectionRangeParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*SelectionRangeParams)(nil) func (s *SelectionRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPositions bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"positions"`: seenPositions = true if err := json.UnmarshalDecode(dec, &s.Positions); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPositions { return fmt.Errorf("required property 'positions' is missing") } return nil } // A selection range represents a part of a selection hierarchy. A selection range // may have a parent selection range that contains it. type SelectionRange struct { // The range of this selection range. Range Range `json:"range"` // The parent selection range containing this range. Therefore `parent.range` must contain `this.range`. Parent *SelectionRange `json:"parent,omitzero"` } var _ json.UnmarshalerFrom = (*SelectionRange)(nil) func (s *SelectionRange) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenRange bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"parent"`: if err := json.UnmarshalDecode(dec, &s.Parent); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRange { return fmt.Errorf("required property 'range' is missing") } return nil } type SelectionRangeRegistrationOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } var _ json.UnmarshalerFrom = (*SelectionRangeRegistrationOptions)(nil) func (s *SelectionRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"id"`: if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } type WorkDoneProgressCreateParams struct { // The token to be used to report progress. Token IntegerOrString `json:"token"` } var _ json.UnmarshalerFrom = (*WorkDoneProgressCreateParams)(nil) func (s *WorkDoneProgressCreateParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenToken bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"token"`: seenToken = true if err := json.UnmarshalDecode(dec, &s.Token); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenToken { return fmt.Errorf("required property 'token' is missing") } return nil } type WorkDoneProgressCancelParams struct { // The token to be used to report progress. Token IntegerOrString `json:"token"` } var _ json.UnmarshalerFrom = (*WorkDoneProgressCancelParams)(nil) func (s *WorkDoneProgressCancelParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenToken bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"token"`: seenToken = true if err := json.UnmarshalDecode(dec, &s.Token); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenToken { return fmt.Errorf("required property 'token' is missing") } return nil } // The parameter of a `textDocument/prepareCallHierarchy` request. // // Since: 3.16.0 type CallHierarchyPrepareParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position inside the text document. Position Position `json:"position"` // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` } func (s *CallHierarchyPrepareParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*CallHierarchyPrepareParams)(nil) func (s *CallHierarchyPrepareParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } return nil } // Represents programming constructs like functions or constructors in the context // of call hierarchy. // // Since: 3.16.0 type CallHierarchyItem struct { // The name of this item. Name string `json:"name"` // The kind of this item. Kind SymbolKind `json:"kind"` // Tags for this item. Tags *[]SymbolTag `json:"tags,omitzero"` // More detail for this item, e.g. the signature of a function. Detail *string `json:"detail,omitzero"` // The resource identifier of this item. Uri DocumentUri `json:"uri"` // The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code. Range Range `json:"range"` // The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function. // Must be contained by the `range`. SelectionRange Range `json:"selectionRange"` // A data entry field that is preserved between a call hierarchy prepare and // incoming calls or outgoing calls requests. Data *any `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*CallHierarchyItem)(nil) func (s *CallHierarchyItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenName bool seenKind bool seenUri bool seenRange bool seenSelectionRange bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"name"`: seenName = true if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"tags"`: if err := json.UnmarshalDecode(dec, &s.Tags); err != nil { return err } case `"detail"`: if err := json.UnmarshalDecode(dec, &s.Detail); err != nil { return err } case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"selectionRange"`: seenSelectionRange = true if err := json.UnmarshalDecode(dec, &s.SelectionRange); err != nil { return err } case `"data"`: if err := json.UnmarshalDecode(dec, &s.Data); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenName { return fmt.Errorf("required property 'name' is missing") } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } if !seenRange { return fmt.Errorf("required property 'range' is missing") } if !seenSelectionRange { return fmt.Errorf("required property 'selectionRange' is missing") } return nil } // Call hierarchy options used during static or dynamic registration. // // Since: 3.16.0 type CallHierarchyRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } var _ json.UnmarshalerFrom = (*CallHierarchyRegistrationOptions)(nil) func (s *CallHierarchyRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"id"`: if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // The parameter of a `callHierarchy/incomingCalls` request. // // Since: 3.16.0 type CallHierarchyIncomingCallsParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` Item *CallHierarchyItem `json:"item"` } var _ json.UnmarshalerFrom = (*CallHierarchyIncomingCallsParams)(nil) func (s *CallHierarchyIncomingCallsParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenItem bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"item"`: seenItem = true if err := json.UnmarshalDecode(dec, &s.Item); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenItem { return fmt.Errorf("required property 'item' is missing") } return nil } // Represents an incoming call, e.g. a caller of a method or constructor. // // Since: 3.16.0 type CallHierarchyIncomingCall struct { // The item that makes the call. From *CallHierarchyItem `json:"from"` // The ranges at which the calls appear. This is relative to the caller // denoted by `this.from`. FromRanges []Range `json:"fromRanges"` } var _ json.UnmarshalerFrom = (*CallHierarchyIncomingCall)(nil) func (s *CallHierarchyIncomingCall) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenFrom bool seenFromRanges bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"from"`: seenFrom = true if err := json.UnmarshalDecode(dec, &s.From); err != nil { return err } case `"fromRanges"`: seenFromRanges = true if err := json.UnmarshalDecode(dec, &s.FromRanges); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenFrom { return fmt.Errorf("required property 'from' is missing") } if !seenFromRanges { return fmt.Errorf("required property 'fromRanges' is missing") } return nil } // The parameter of a `callHierarchy/outgoingCalls` request. // // Since: 3.16.0 type CallHierarchyOutgoingCallsParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` Item *CallHierarchyItem `json:"item"` } var _ json.UnmarshalerFrom = (*CallHierarchyOutgoingCallsParams)(nil) func (s *CallHierarchyOutgoingCallsParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenItem bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"item"`: seenItem = true if err := json.UnmarshalDecode(dec, &s.Item); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenItem { return fmt.Errorf("required property 'item' is missing") } return nil } // Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc. // // Since: 3.16.0 type CallHierarchyOutgoingCall struct { // The item that is called. To *CallHierarchyItem `json:"to"` // The range at which this item is called. This is the range relative to the caller, e.g the item // passed to `provideCallHierarchyOutgoingCalls` // and not `this.to`. FromRanges []Range `json:"fromRanges"` } var _ json.UnmarshalerFrom = (*CallHierarchyOutgoingCall)(nil) func (s *CallHierarchyOutgoingCall) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTo bool seenFromRanges bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"to"`: seenTo = true if err := json.UnmarshalDecode(dec, &s.To); err != nil { return err } case `"fromRanges"`: seenFromRanges = true if err := json.UnmarshalDecode(dec, &s.FromRanges); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTo { return fmt.Errorf("required property 'to' is missing") } if !seenFromRanges { return fmt.Errorf("required property 'fromRanges' is missing") } return nil } // Since: 3.16.0 type SemanticTokensParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` } func (s *SemanticTokensParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*SemanticTokensParams)(nil) func (s *SemanticTokensParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenTextDocument bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } return nil } // Since: 3.16.0 type SemanticTokens struct { // An optional result id. If provided and clients support delta updating // the client will include the result id in the next semantic token request. // A server can then instead of computing all semantic tokens again simply // send a delta. ResultId *string `json:"resultId,omitzero"` // The actual tokens. Data []uint32 `json:"data"` } var _ json.UnmarshalerFrom = (*SemanticTokens)(nil) func (s *SemanticTokens) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenData bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"resultId"`: if err := json.UnmarshalDecode(dec, &s.ResultId); err != nil { return err } case `"data"`: seenData = true if err := json.UnmarshalDecode(dec, &s.Data); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenData { return fmt.Errorf("required property 'data' is missing") } return nil } // Since: 3.16.0 type SemanticTokensPartialResult struct { Data []uint32 `json:"data"` } var _ json.UnmarshalerFrom = (*SemanticTokensPartialResult)(nil) func (s *SemanticTokensPartialResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenData bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"data"`: seenData = true if err := json.UnmarshalDecode(dec, &s.Data); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenData { return fmt.Errorf("required property 'data' is missing") } return nil } // Since: 3.16.0 type SemanticTokensRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // The legend used by the server Legend *SemanticTokensLegend `json:"legend"` // Server supports providing semantic tokens for a specific range // of a document. Range *BooleanOrEmptyObject `json:"range,omitzero"` // Server supports providing semantic tokens for a full document. Full *BooleanOrSemanticTokensFullDelta `json:"full,omitzero"` // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } var _ json.UnmarshalerFrom = (*SemanticTokensRegistrationOptions)(nil) func (s *SemanticTokensRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenDocumentSelector bool seenLegend bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"legend"`: seenLegend = true if err := json.UnmarshalDecode(dec, &s.Legend); err != nil { return err } case `"range"`: if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"full"`: if err := json.UnmarshalDecode(dec, &s.Full); err != nil { return err } case `"id"`: if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } if !seenLegend { return fmt.Errorf("required property 'legend' is missing") } return nil } // Since: 3.16.0 type SemanticTokensDeltaParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The result id of a previous response. The result Id can either point to a full response // or a delta response depending on what was received last. PreviousResultId string `json:"previousResultId"` } func (s *SemanticTokensDeltaParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*SemanticTokensDeltaParams)(nil) func (s *SemanticTokensDeltaParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPreviousResultId bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"previousResultId"`: seenPreviousResultId = true if err := json.UnmarshalDecode(dec, &s.PreviousResultId); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPreviousResultId { return fmt.Errorf("required property 'previousResultId' is missing") } return nil } // Since: 3.16.0 type SemanticTokensDelta struct { ResultId *string `json:"resultId,omitzero"` // The semantic token edits to transform a previous result into a new result. Edits []*SemanticTokensEdit `json:"edits"` } var _ json.UnmarshalerFrom = (*SemanticTokensDelta)(nil) func (s *SemanticTokensDelta) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenEdits bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"resultId"`: if err := json.UnmarshalDecode(dec, &s.ResultId); err != nil { return err } case `"edits"`: seenEdits = true if err := json.UnmarshalDecode(dec, &s.Edits); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenEdits { return fmt.Errorf("required property 'edits' is missing") } return nil } // Since: 3.16.0 type SemanticTokensDeltaPartialResult struct { Edits []*SemanticTokensEdit `json:"edits"` } var _ json.UnmarshalerFrom = (*SemanticTokensDeltaPartialResult)(nil) func (s *SemanticTokensDeltaPartialResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenEdits bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"edits"`: seenEdits = true if err := json.UnmarshalDecode(dec, &s.Edits); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenEdits { return fmt.Errorf("required property 'edits' is missing") } return nil } // Since: 3.16.0 type SemanticTokensRangeParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The range the semantic tokens are requested for. Range Range `json:"range"` } func (s *SemanticTokensRangeParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*SemanticTokensRangeParams)(nil) func (s *SemanticTokensRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenRange bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenRange { return fmt.Errorf("required property 'range' is missing") } return nil } // Params to show a resource in the UI. // // Since: 3.16.0 type ShowDocumentParams struct { // The uri to show. Uri URI `json:"uri"` // Indicates to show the resource in an external program. // To show, for example, `https://code.visualstudio.com/` // in the default WEB browser set `external` to `true`. External *bool `json:"external,omitzero"` // An optional property to indicate whether the editor // showing the document should take focus or not. // Clients might ignore this property if an external // program is started. TakeFocus *bool `json:"takeFocus,omitzero"` // An optional selection range if the document is a text // document. Clients might ignore the property if an // external program is started or the file is not a text // file. Selection *Range `json:"selection,omitzero"` } var _ json.UnmarshalerFrom = (*ShowDocumentParams)(nil) func (s *ShowDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenUri bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"external"`: if err := json.UnmarshalDecode(dec, &s.External); err != nil { return err } case `"takeFocus"`: if err := json.UnmarshalDecode(dec, &s.TakeFocus); err != nil { return err } case `"selection"`: if err := json.UnmarshalDecode(dec, &s.Selection); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } return nil } // The result of a showDocument request. // // Since: 3.16.0 type ShowDocumentResult struct { // A boolean indicating if the show was successful. Success bool `json:"success"` } var _ json.UnmarshalerFrom = (*ShowDocumentResult)(nil) func (s *ShowDocumentResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenSuccess bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"success"`: seenSuccess = true if err := json.UnmarshalDecode(dec, &s.Success); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenSuccess { return fmt.Errorf("required property 'success' is missing") } return nil } type LinkedEditingRangeParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position inside the text document. Position Position `json:"position"` // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` } func (s *LinkedEditingRangeParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*LinkedEditingRangeParams)(nil) func (s *LinkedEditingRangeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } return nil } // The result of a linked editing range request. // // Since: 3.16.0 type LinkedEditingRanges struct { // A list of ranges that can be edited together. The ranges must have // identical length and contain identical text content. The ranges cannot overlap. Ranges []Range `json:"ranges"` // An optional word pattern (regular expression) that describes valid contents for // the given ranges. If no pattern is provided, the client configuration's word // pattern will be used. WordPattern *string `json:"wordPattern,omitzero"` } var _ json.UnmarshalerFrom = (*LinkedEditingRanges)(nil) func (s *LinkedEditingRanges) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenRanges bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"ranges"`: seenRanges = true if err := json.UnmarshalDecode(dec, &s.Ranges); err != nil { return err } case `"wordPattern"`: if err := json.UnmarshalDecode(dec, &s.WordPattern); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRanges { return fmt.Errorf("required property 'ranges' is missing") } return nil } type LinkedEditingRangeRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } var _ json.UnmarshalerFrom = (*LinkedEditingRangeRegistrationOptions)(nil) func (s *LinkedEditingRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"id"`: if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // The parameters sent in notifications/requests for user-initiated creation of // files. // // Since: 3.16.0 type CreateFilesParams struct { // An array of all files/folders created in this operation. Files []*FileCreate `json:"files"` } var _ json.UnmarshalerFrom = (*CreateFilesParams)(nil) func (s *CreateFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenFiles bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"files"`: seenFiles = true if err := json.UnmarshalDecode(dec, &s.Files); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenFiles { return fmt.Errorf("required property 'files' is missing") } return nil } // A workspace edit represents changes to many resources managed in the workspace. The edit // should either provide `changes` or `documentChanges`. If documentChanges are present // they are preferred over `changes` if the client can handle versioned document edits. // // Since version 3.13.0 a workspace edit can contain resource operations as well. If resource // operations are present clients need to execute the operations in the order in which they // are provided. So a workspace edit for example can consist of the following two changes: // (1) a create file a.txt and (2) a text document edit which insert text into file a.txt. // // An invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will // cause failure of the operation. How the client recovers from the failure is described by // the client capability: `workspace.workspaceEdit.failureHandling` type WorkspaceEdit struct { // Holds changes to existing resources. Changes *map[DocumentUri][]*TextEdit `json:"changes,omitzero"` // Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes // are either an array of `TextDocumentEdit`s to express changes to n different text documents // where each text document edit addresses a specific version of a text document. Or it can contain // above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations. // // Whether a client supports versioned document edits is expressed via // `workspace.workspaceEdit.documentChanges` client capability. // // If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then // only plain `TextEdit`s using the `changes` property are supported. DocumentChanges *[]TextDocumentEditOrCreateFileOrRenameFileOrDeleteFile `json:"documentChanges,omitzero"` // A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and // delete file / folder operations. // // Whether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`. // // Since: 3.16.0 ChangeAnnotations *map[string]*ChangeAnnotation `json:"changeAnnotations,omitzero"` } // The options to register for file operations. // // Since: 3.16.0 type FileOperationRegistrationOptions struct { // The actual filters. Filters []*FileOperationFilter `json:"filters"` } var _ json.UnmarshalerFrom = (*FileOperationRegistrationOptions)(nil) func (s *FileOperationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenFilters bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"filters"`: seenFilters = true if err := json.UnmarshalDecode(dec, &s.Filters); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenFilters { return fmt.Errorf("required property 'filters' is missing") } return nil } // The parameters sent in notifications/requests for user-initiated renames of // files. // // Since: 3.16.0 type RenameFilesParams struct { // An array of all files/folders renamed in this operation. When a folder is renamed, only // the folder will be included, and not its children. Files []*FileRename `json:"files"` } var _ json.UnmarshalerFrom = (*RenameFilesParams)(nil) func (s *RenameFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenFiles bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"files"`: seenFiles = true if err := json.UnmarshalDecode(dec, &s.Files); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenFiles { return fmt.Errorf("required property 'files' is missing") } return nil } // The parameters sent in notifications/requests for user-initiated deletes of // files. // // Since: 3.16.0 type DeleteFilesParams struct { // An array of all files/folders deleted in this operation. Files []*FileDelete `json:"files"` } var _ json.UnmarshalerFrom = (*DeleteFilesParams)(nil) func (s *DeleteFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenFiles bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"files"`: seenFiles = true if err := json.UnmarshalDecode(dec, &s.Files); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenFiles { return fmt.Errorf("required property 'files' is missing") } return nil } type MonikerParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position inside the text document. Position Position `json:"position"` // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` } func (s *MonikerParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*MonikerParams)(nil) func (s *MonikerParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } return nil } // Moniker definition to match LSIF 0.5 moniker definition. // // Since: 3.16.0 type Moniker struct { // The scheme of the moniker. For example tsc or .Net Scheme string `json:"scheme"` // The identifier of the moniker. The value is opaque in LSIF however // schema owners are allowed to define the structure if they want. Identifier string `json:"identifier"` // The scope in which the moniker is unique Unique UniquenessLevel `json:"unique"` // The moniker kind if known. Kind *MonikerKind `json:"kind,omitzero"` } var _ json.UnmarshalerFrom = (*Moniker)(nil) func (s *Moniker) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenScheme bool seenIdentifier bool seenUnique bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"scheme"`: seenScheme = true if err := json.UnmarshalDecode(dec, &s.Scheme); err != nil { return err } case `"identifier"`: seenIdentifier = true if err := json.UnmarshalDecode(dec, &s.Identifier); err != nil { return err } case `"unique"`: seenUnique = true if err := json.UnmarshalDecode(dec, &s.Unique); err != nil { return err } case `"kind"`: if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenScheme { return fmt.Errorf("required property 'scheme' is missing") } if !seenIdentifier { return fmt.Errorf("required property 'identifier' is missing") } if !seenUnique { return fmt.Errorf("required property 'unique' is missing") } return nil } type MonikerRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } var _ json.UnmarshalerFrom = (*MonikerRegistrationOptions)(nil) func (s *MonikerRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // The parameter of a `textDocument/prepareTypeHierarchy` request. // // Since: 3.17.0 type TypeHierarchyPrepareParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position inside the text document. Position Position `json:"position"` // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` } func (s *TypeHierarchyPrepareParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*TypeHierarchyPrepareParams)(nil) func (s *TypeHierarchyPrepareParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } return nil } // Since: 3.17.0 type TypeHierarchyItem struct { // The name of this item. Name string `json:"name"` // The kind of this item. Kind SymbolKind `json:"kind"` // Tags for this item. Tags *[]SymbolTag `json:"tags,omitzero"` // More detail for this item, e.g. the signature of a function. Detail *string `json:"detail,omitzero"` // The resource identifier of this item. Uri DocumentUri `json:"uri"` // The range enclosing this symbol not including leading/trailing whitespace // but everything else, e.g. comments and code. Range Range `json:"range"` // The range that should be selected and revealed when this symbol is being // picked, e.g. the name of a function. Must be contained by the // `range`. SelectionRange Range `json:"selectionRange"` // A data entry field that is preserved between a type hierarchy prepare and // supertypes or subtypes requests. It could also be used to identify the // type hierarchy in the server, helping improve the performance on // resolving supertypes and subtypes. Data *any `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*TypeHierarchyItem)(nil) func (s *TypeHierarchyItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenName bool seenKind bool seenUri bool seenRange bool seenSelectionRange bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"name"`: seenName = true if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"tags"`: if err := json.UnmarshalDecode(dec, &s.Tags); err != nil { return err } case `"detail"`: if err := json.UnmarshalDecode(dec, &s.Detail); err != nil { return err } case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"selectionRange"`: seenSelectionRange = true if err := json.UnmarshalDecode(dec, &s.SelectionRange); err != nil { return err } case `"data"`: if err := json.UnmarshalDecode(dec, &s.Data); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenName { return fmt.Errorf("required property 'name' is missing") } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } if !seenRange { return fmt.Errorf("required property 'range' is missing") } if !seenSelectionRange { return fmt.Errorf("required property 'selectionRange' is missing") } return nil } // Type hierarchy options used during static or dynamic registration. // // Since: 3.17.0 type TypeHierarchyRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } var _ json.UnmarshalerFrom = (*TypeHierarchyRegistrationOptions)(nil) func (s *TypeHierarchyRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"id"`: if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // The parameter of a `typeHierarchy/supertypes` request. // // Since: 3.17.0 type TypeHierarchySupertypesParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` Item *TypeHierarchyItem `json:"item"` } var _ json.UnmarshalerFrom = (*TypeHierarchySupertypesParams)(nil) func (s *TypeHierarchySupertypesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenItem bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"item"`: seenItem = true if err := json.UnmarshalDecode(dec, &s.Item); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenItem { return fmt.Errorf("required property 'item' is missing") } return nil } // The parameter of a `typeHierarchy/subtypes` request. // // Since: 3.17.0 type TypeHierarchySubtypesParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` Item *TypeHierarchyItem `json:"item"` } var _ json.UnmarshalerFrom = (*TypeHierarchySubtypesParams)(nil) func (s *TypeHierarchySubtypesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenItem bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"item"`: seenItem = true if err := json.UnmarshalDecode(dec, &s.Item); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenItem { return fmt.Errorf("required property 'item' is missing") } return nil } // A parameter literal used in inline value requests. // // Since: 3.17.0 type InlineValueParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The document range for which inline values should be computed. Range Range `json:"range"` // Additional information about the context in which inline values were // requested. Context *InlineValueContext `json:"context"` } func (s *InlineValueParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*InlineValueParams)(nil) func (s *InlineValueParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenRange bool seenContext bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"context"`: seenContext = true if err := json.UnmarshalDecode(dec, &s.Context); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenRange { return fmt.Errorf("required property 'range' is missing") } if !seenContext { return fmt.Errorf("required property 'context' is missing") } return nil } // Inline value options used during static or dynamic registration. // // Since: 3.17.0 type InlineValueRegistrationOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } var _ json.UnmarshalerFrom = (*InlineValueRegistrationOptions)(nil) func (s *InlineValueRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"id"`: if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // A parameter literal used in inlay hint requests. // // Since: 3.17.0 type InlayHintParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The document range for which inlay hints should be computed. Range Range `json:"range"` } func (s *InlayHintParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*InlayHintParams)(nil) func (s *InlayHintParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenRange bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenRange { return fmt.Errorf("required property 'range' is missing") } return nil } // Inlay hint information. // // Since: 3.17.0 type InlayHint struct { // The position of this hint. // // If multiple hints have the same position, they will be shown in the order // they appear in the response. Position Position `json:"position"` // The label of this hint. A human readable string or an array of // InlayHintLabelPart label parts. // // *Note* that neither the string nor the label part can be empty. Label StringOrInlayHintLabelParts `json:"label"` // The kind of this hint. Can be omitted in which case the client // should fall back to a reasonable default. Kind *InlayHintKind `json:"kind,omitzero"` // Optional text edits that are performed when accepting this inlay hint. // // *Note* that edits are expected to change the document so that the inlay // hint (or its nearest variant) is now part of the document and the inlay // hint itself is now obsolete. TextEdits *[]*TextEdit `json:"textEdits,omitzero"` // The tooltip text when you hover over this item. Tooltip *StringOrMarkupContent `json:"tooltip,omitzero"` // Render padding before the hint. // // Note: Padding should use the editor's background color, not the // background color of the hint itself. That means padding can be used // to visually align/separate an inlay hint. PaddingLeft *bool `json:"paddingLeft,omitzero"` // Render padding after the hint. // // Note: Padding should use the editor's background color, not the // background color of the hint itself. That means padding can be used // to visually align/separate an inlay hint. PaddingRight *bool `json:"paddingRight,omitzero"` // A data entry field that is preserved on an inlay hint between // a `textDocument/inlayHint` and a `inlayHint/resolve` request. Data *any `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*InlayHint)(nil) func (s *InlayHint) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenPosition bool seenLabel bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"label"`: seenLabel = true if err := json.UnmarshalDecode(dec, &s.Label); err != nil { return err } case `"kind"`: if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"textEdits"`: if err := json.UnmarshalDecode(dec, &s.TextEdits); err != nil { return err } case `"tooltip"`: if err := json.UnmarshalDecode(dec, &s.Tooltip); err != nil { return err } case `"paddingLeft"`: if err := json.UnmarshalDecode(dec, &s.PaddingLeft); err != nil { return err } case `"paddingRight"`: if err := json.UnmarshalDecode(dec, &s.PaddingRight); err != nil { return err } case `"data"`: if err := json.UnmarshalDecode(dec, &s.Data); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } if !seenLabel { return fmt.Errorf("required property 'label' is missing") } return nil } // Inlay hint options used during static or dynamic registration. // // Since: 3.17.0 type InlayHintRegistrationOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // The server provides support to resolve additional // information for an inlay hint item. ResolveProvider *bool `json:"resolveProvider,omitzero"` // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } var _ json.UnmarshalerFrom = (*InlayHintRegistrationOptions)(nil) func (s *InlayHintRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"resolveProvider"`: if err := json.UnmarshalDecode(dec, &s.ResolveProvider); err != nil { return err } case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"id"`: if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // Parameters of the document diagnostic request. // // Since: 3.17.0 type DocumentDiagnosticParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The additional identifier provided during registration. Identifier *string `json:"identifier,omitzero"` // The result id of a previous response if provided. PreviousResultId *string `json:"previousResultId,omitzero"` } func (s *DocumentDiagnosticParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*DocumentDiagnosticParams)(nil) func (s *DocumentDiagnosticParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenTextDocument bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"identifier"`: if err := json.UnmarshalDecode(dec, &s.Identifier); err != nil { return err } case `"previousResultId"`: if err := json.UnmarshalDecode(dec, &s.PreviousResultId); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } return nil } // A partial result for a document diagnostic report. // // Since: 3.17.0 type DocumentDiagnosticReportPartialResult struct { RelatedDocuments map[DocumentUri]FullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport `json:"relatedDocuments"` } var _ json.UnmarshalerFrom = (*DocumentDiagnosticReportPartialResult)(nil) func (s *DocumentDiagnosticReportPartialResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenRelatedDocuments bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"relatedDocuments"`: seenRelatedDocuments = true if err := json.UnmarshalDecode(dec, &s.RelatedDocuments); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRelatedDocuments { return fmt.Errorf("required property 'relatedDocuments' is missing") } return nil } // Cancellation data returned from a diagnostic request. // // Since: 3.17.0 type DiagnosticServerCancellationData struct { RetriggerRequest bool `json:"retriggerRequest"` } var _ json.UnmarshalerFrom = (*DiagnosticServerCancellationData)(nil) func (s *DiagnosticServerCancellationData) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenRetriggerRequest bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"retriggerRequest"`: seenRetriggerRequest = true if err := json.UnmarshalDecode(dec, &s.RetriggerRequest); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRetriggerRequest { return fmt.Errorf("required property 'retriggerRequest' is missing") } return nil } // Diagnostic registration options. // // Since: 3.17.0 type DiagnosticRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // An optional identifier under which the diagnostics are // managed by the client. Identifier *string `json:"identifier,omitzero"` // Whether the language has inter file dependencies meaning that // editing code in one file can result in a different diagnostic // set in another file. Inter file dependencies are common for // most programming languages and typically uncommon for linters. InterFileDependencies bool `json:"interFileDependencies"` // The server provides support for workspace diagnostics as well. WorkspaceDiagnostics bool `json:"workspaceDiagnostics"` // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } var _ json.UnmarshalerFrom = (*DiagnosticRegistrationOptions)(nil) func (s *DiagnosticRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenDocumentSelector bool seenInterFileDependencies bool seenWorkspaceDiagnostics bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"identifier"`: if err := json.UnmarshalDecode(dec, &s.Identifier); err != nil { return err } case `"interFileDependencies"`: seenInterFileDependencies = true if err := json.UnmarshalDecode(dec, &s.InterFileDependencies); err != nil { return err } case `"workspaceDiagnostics"`: seenWorkspaceDiagnostics = true if err := json.UnmarshalDecode(dec, &s.WorkspaceDiagnostics); err != nil { return err } case `"id"`: if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } if !seenInterFileDependencies { return fmt.Errorf("required property 'interFileDependencies' is missing") } if !seenWorkspaceDiagnostics { return fmt.Errorf("required property 'workspaceDiagnostics' is missing") } return nil } // Parameters of the workspace diagnostic request. // // Since: 3.17.0 type WorkspaceDiagnosticParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` // The additional identifier provided during registration. Identifier *string `json:"identifier,omitzero"` // The currently known diagnostic reports with their // previous result ids. PreviousResultIds []PreviousResultId `json:"previousResultIds"` } var _ json.UnmarshalerFrom = (*WorkspaceDiagnosticParams)(nil) func (s *WorkspaceDiagnosticParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenPreviousResultIds bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"identifier"`: if err := json.UnmarshalDecode(dec, &s.Identifier); err != nil { return err } case `"previousResultIds"`: seenPreviousResultIds = true if err := json.UnmarshalDecode(dec, &s.PreviousResultIds); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenPreviousResultIds { return fmt.Errorf("required property 'previousResultIds' is missing") } return nil } // A workspace diagnostic report. // // Since: 3.17.0 type WorkspaceDiagnosticReport struct { Items []WorkspaceFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport `json:"items"` } var _ json.UnmarshalerFrom = (*WorkspaceDiagnosticReport)(nil) func (s *WorkspaceDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenItems bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"items"`: seenItems = true if err := json.UnmarshalDecode(dec, &s.Items); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenItems { return fmt.Errorf("required property 'items' is missing") } return nil } // A partial result for a workspace diagnostic report. // // Since: 3.17.0 type WorkspaceDiagnosticReportPartialResult struct { Items []WorkspaceFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport `json:"items"` } var _ json.UnmarshalerFrom = (*WorkspaceDiagnosticReportPartialResult)(nil) func (s *WorkspaceDiagnosticReportPartialResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenItems bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"items"`: seenItems = true if err := json.UnmarshalDecode(dec, &s.Items); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenItems { return fmt.Errorf("required property 'items' is missing") } return nil } // The params sent in an open notebook document notification. // // Since: 3.17.0 type DidOpenNotebookDocumentParams struct { // The notebook document that got opened. NotebookDocument *NotebookDocument `json:"notebookDocument"` // The text documents that represent the content // of a notebook cell. CellTextDocuments []*TextDocumentItem `json:"cellTextDocuments"` } var _ json.UnmarshalerFrom = (*DidOpenNotebookDocumentParams)(nil) func (s *DidOpenNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenNotebookDocument bool seenCellTextDocuments bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"notebookDocument"`: seenNotebookDocument = true if err := json.UnmarshalDecode(dec, &s.NotebookDocument); err != nil { return err } case `"cellTextDocuments"`: seenCellTextDocuments = true if err := json.UnmarshalDecode(dec, &s.CellTextDocuments); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenNotebookDocument { return fmt.Errorf("required property 'notebookDocument' is missing") } if !seenCellTextDocuments { return fmt.Errorf("required property 'cellTextDocuments' is missing") } return nil } // Registration options specific to a notebook. // // Since: 3.17.0 type NotebookDocumentSyncRegistrationOptions struct { // The notebooks to be synced NotebookSelector []NotebookDocumentFilterWithNotebookOrCells `json:"notebookSelector"` // Whether save notification should be forwarded to // the server. Will only be honored if mode === `notebook`. Save *bool `json:"save,omitzero"` // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } var _ json.UnmarshalerFrom = (*NotebookDocumentSyncRegistrationOptions)(nil) func (s *NotebookDocumentSyncRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenNotebookSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"notebookSelector"`: seenNotebookSelector = true if err := json.UnmarshalDecode(dec, &s.NotebookSelector); err != nil { return err } case `"save"`: if err := json.UnmarshalDecode(dec, &s.Save); err != nil { return err } case `"id"`: if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenNotebookSelector { return fmt.Errorf("required property 'notebookSelector' is missing") } return nil } // The params sent in a change notebook document notification. // // Since: 3.17.0 type DidChangeNotebookDocumentParams struct { // The notebook document that did change. The version number points // to the version after all provided changes have been applied. If // only the text document content of a cell changes the notebook version // doesn't necessarily have to change. NotebookDocument VersionedNotebookDocumentIdentifier `json:"notebookDocument"` // The actual changes to the notebook document. // // The changes describe single state changes to the notebook document. // So if there are two changes c1 (at array index 0) and c2 (at array // index 1) for a notebook in state S then c1 moves the notebook from // S to S' and c2 from S' to S''. So c1 is computed on the state S and // c2 is computed on the state S'. // // To mirror the content of a notebook using change events use the following approach: // - start with the same initial content // - apply the 'notebookDocument/didChange' notifications in the order you receive them. // - apply the `NotebookChangeEvent`s in a single notification in the order // you receive them. Change *NotebookDocumentChangeEvent `json:"change"` } var _ json.UnmarshalerFrom = (*DidChangeNotebookDocumentParams)(nil) func (s *DidChangeNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenNotebookDocument bool seenChange bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"notebookDocument"`: seenNotebookDocument = true if err := json.UnmarshalDecode(dec, &s.NotebookDocument); err != nil { return err } case `"change"`: seenChange = true if err := json.UnmarshalDecode(dec, &s.Change); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenNotebookDocument { return fmt.Errorf("required property 'notebookDocument' is missing") } if !seenChange { return fmt.Errorf("required property 'change' is missing") } return nil } // The params sent in a save notebook document notification. // // Since: 3.17.0 type DidSaveNotebookDocumentParams struct { // The notebook document that got saved. NotebookDocument NotebookDocumentIdentifier `json:"notebookDocument"` } var _ json.UnmarshalerFrom = (*DidSaveNotebookDocumentParams)(nil) func (s *DidSaveNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenNotebookDocument bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"notebookDocument"`: seenNotebookDocument = true if err := json.UnmarshalDecode(dec, &s.NotebookDocument); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenNotebookDocument { return fmt.Errorf("required property 'notebookDocument' is missing") } return nil } // The params sent in a close notebook document notification. // // Since: 3.17.0 type DidCloseNotebookDocumentParams struct { // The notebook document that got closed. NotebookDocument NotebookDocumentIdentifier `json:"notebookDocument"` // The text documents that represent the content // of a notebook cell that got closed. CellTextDocuments []TextDocumentIdentifier `json:"cellTextDocuments"` } var _ json.UnmarshalerFrom = (*DidCloseNotebookDocumentParams)(nil) func (s *DidCloseNotebookDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenNotebookDocument bool seenCellTextDocuments bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"notebookDocument"`: seenNotebookDocument = true if err := json.UnmarshalDecode(dec, &s.NotebookDocument); err != nil { return err } case `"cellTextDocuments"`: seenCellTextDocuments = true if err := json.UnmarshalDecode(dec, &s.CellTextDocuments); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenNotebookDocument { return fmt.Errorf("required property 'notebookDocument' is missing") } if !seenCellTextDocuments { return fmt.Errorf("required property 'cellTextDocuments' is missing") } return nil } // A parameter literal used in inline completion requests. // // Since: 3.18.0 // // Proposed. type InlineCompletionParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position inside the text document. Position Position `json:"position"` // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // Additional information about the context in which inline completions were // requested. Context *InlineCompletionContext `json:"context"` } func (s *InlineCompletionParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*InlineCompletionParams)(nil) func (s *InlineCompletionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool seenContext bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"context"`: seenContext = true if err := json.UnmarshalDecode(dec, &s.Context); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } if !seenContext { return fmt.Errorf("required property 'context' is missing") } return nil } // Represents a collection of items to be presented in the editor. // // Since: 3.18.0 // // Proposed. type InlineCompletionList struct { // The inline completion items Items []*InlineCompletionItem `json:"items"` } var _ json.UnmarshalerFrom = (*InlineCompletionList)(nil) func (s *InlineCompletionList) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenItems bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"items"`: seenItems = true if err := json.UnmarshalDecode(dec, &s.Items); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenItems { return fmt.Errorf("required property 'items' is missing") } return nil } // An inline completion item represents a text snippet that is proposed inline to complete text that is being typed. // // Since: 3.18.0 // // Proposed. type InlineCompletionItem struct { // The text to replace the range with. Must be set. InsertText StringOrStringValue `json:"insertText"` // A text that is used to decide if this inline completion should be shown. When `falsy` the InlineCompletionItem.insertText is used. FilterText *string `json:"filterText,omitzero"` // The range to replace. Must begin and end on the same line. Range *Range `json:"range,omitzero"` // An optional Command that is executed *after* inserting this completion. Command *Command `json:"command,omitzero"` } var _ json.UnmarshalerFrom = (*InlineCompletionItem)(nil) func (s *InlineCompletionItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenInsertText bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"insertText"`: seenInsertText = true if err := json.UnmarshalDecode(dec, &s.InsertText); err != nil { return err } case `"filterText"`: if err := json.UnmarshalDecode(dec, &s.FilterText); err != nil { return err } case `"range"`: if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"command"`: if err := json.UnmarshalDecode(dec, &s.Command); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenInsertText { return fmt.Errorf("required property 'insertText' is missing") } return nil } // Inline completion options used during static or dynamic registration. // // Since: 3.18.0 // // Proposed. type InlineCompletionRegistrationOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } var _ json.UnmarshalerFrom = (*InlineCompletionRegistrationOptions)(nil) func (s *InlineCompletionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"id"`: if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // Parameters for the `workspace/textDocumentContent` request. // // Since: 3.18.0 // // Proposed. type TextDocumentContentParams struct { // The uri of the text document. Uri DocumentUri `json:"uri"` } var _ json.UnmarshalerFrom = (*TextDocumentContentParams)(nil) func (s *TextDocumentContentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenUri bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } return nil } // Result of the `workspace/textDocumentContent` request. // // Since: 3.18.0 // // Proposed. type TextDocumentContentResult struct { // The text content of the text document. Please note, that the content of // any subsequent open notifications for the text document might differ // from the returned content due to whitespace and line ending // normalizations done on the client Text string `json:"text"` } var _ json.UnmarshalerFrom = (*TextDocumentContentResult)(nil) func (s *TextDocumentContentResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenText bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"text"`: seenText = true if err := json.UnmarshalDecode(dec, &s.Text); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenText { return fmt.Errorf("required property 'text' is missing") } return nil } // Text document content provider registration options. // // Since: 3.18.0 // // Proposed. type TextDocumentContentRegistrationOptions struct { // The schemes for which the server provides content. Schemes []string `json:"schemes"` // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } var _ json.UnmarshalerFrom = (*TextDocumentContentRegistrationOptions)(nil) func (s *TextDocumentContentRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenSchemes bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"schemes"`: seenSchemes = true if err := json.UnmarshalDecode(dec, &s.Schemes); err != nil { return err } case `"id"`: if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenSchemes { return fmt.Errorf("required property 'schemes' is missing") } return nil } // Parameters for the `workspace/textDocumentContent/refresh` request. // // Since: 3.18.0 // // Proposed. type TextDocumentContentRefreshParams struct { // The uri of the text document to refresh. Uri DocumentUri `json:"uri"` } var _ json.UnmarshalerFrom = (*TextDocumentContentRefreshParams)(nil) func (s *TextDocumentContentRefreshParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenUri bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } return nil } type RegistrationParams struct { Registrations []*Registration `json:"registrations"` } var _ json.UnmarshalerFrom = (*RegistrationParams)(nil) func (s *RegistrationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenRegistrations bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"registrations"`: seenRegistrations = true if err := json.UnmarshalDecode(dec, &s.Registrations); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRegistrations { return fmt.Errorf("required property 'registrations' is missing") } return nil } type UnregistrationParams struct { Unregisterations []*Unregistration `json:"unregisterations"` } var _ json.UnmarshalerFrom = (*UnregistrationParams)(nil) func (s *UnregistrationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenUnregisterations bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"unregisterations"`: seenUnregisterations = true if err := json.UnmarshalDecode(dec, &s.Unregisterations); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUnregisterations { return fmt.Errorf("required property 'unregisterations' is missing") } return nil } type InitializeParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // The process Id of the parent process that started // the server. // // Is `null` if the process has not been started by another process. // If the parent process is not alive then the server should exit. ProcessId IntegerOrNull `json:"processId"` // Information about the client // // Since: 3.15.0 ClientInfo *ClientInfo `json:"clientInfo,omitzero"` // The locale the client is currently showing the user interface // in. This must not necessarily be the locale of the operating // system. // // Uses IETF language tags as the value's syntax // (See https://en.wikipedia.org/wiki/IETF_language_tag) // // Since: 3.16.0 Locale *string `json:"locale,omitzero"` // The rootPath of the workspace. Is null // if no folder is open. // // Deprecated: in favour of rootUri. RootPath *StringOrNull `json:"rootPath,omitzero"` // The rootUri of the workspace. Is null if no // folder is open. If both `rootPath` and `rootUri` are set // `rootUri` wins. // // Deprecated: in favour of workspaceFolders. RootUri DocumentUriOrNull `json:"rootUri"` // The capabilities provided by the client (editor or tool) Capabilities *ClientCapabilities `json:"capabilities"` // User provided initialization options. InitializationOptions *any `json:"initializationOptions,omitzero"` // The initial trace setting. If omitted trace is disabled ('off'). Trace *TraceValue `json:"trace,omitzero"` // The workspace folders configured in the client when the server starts. // // This property is only available if the client supports workspace folders. // It can be `null` if the client supports workspace folders but none are // configured. // // Since: 3.6.0 WorkspaceFolders *WorkspaceFoldersOrNull `json:"workspaceFolders,omitzero"` } var _ json.UnmarshalerFrom = (*InitializeParams)(nil) func (s *InitializeParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenProcessId bool seenRootUri bool seenCapabilities bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"processId"`: seenProcessId = true if err := json.UnmarshalDecode(dec, &s.ProcessId); err != nil { return err } case `"clientInfo"`: if err := json.UnmarshalDecode(dec, &s.ClientInfo); err != nil { return err } case `"locale"`: if err := json.UnmarshalDecode(dec, &s.Locale); err != nil { return err } case `"rootPath"`: if err := json.UnmarshalDecode(dec, &s.RootPath); err != nil { return err } case `"rootUri"`: seenRootUri = true if err := json.UnmarshalDecode(dec, &s.RootUri); err != nil { return err } case `"capabilities"`: seenCapabilities = true if err := json.UnmarshalDecode(dec, &s.Capabilities); err != nil { return err } case `"initializationOptions"`: if err := json.UnmarshalDecode(dec, &s.InitializationOptions); err != nil { return err } case `"trace"`: if err := json.UnmarshalDecode(dec, &s.Trace); err != nil { return err } case `"workspaceFolders"`: if err := json.UnmarshalDecode(dec, &s.WorkspaceFolders); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenProcessId { return fmt.Errorf("required property 'processId' is missing") } if !seenRootUri { return fmt.Errorf("required property 'rootUri' is missing") } if !seenCapabilities { return fmt.Errorf("required property 'capabilities' is missing") } return nil } // The result returned from an initialize request. type InitializeResult struct { // The capabilities the language server provides. Capabilities *ServerCapabilities `json:"capabilities"` // Information about the server. // // Since: 3.15.0 ServerInfo *ServerInfo `json:"serverInfo,omitzero"` } var _ json.UnmarshalerFrom = (*InitializeResult)(nil) func (s *InitializeResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenCapabilities bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"capabilities"`: seenCapabilities = true if err := json.UnmarshalDecode(dec, &s.Capabilities); err != nil { return err } case `"serverInfo"`: if err := json.UnmarshalDecode(dec, &s.ServerInfo); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenCapabilities { return fmt.Errorf("required property 'capabilities' is missing") } return nil } // The data type of the ResponseError if the // initialize request fails. type InitializeError struct { // Indicates whether the client execute the following retry logic: // (1) show the message provided by the ResponseError to the user // (2) user selects retry or cancel // (3) if user selected retry the initialize method is sent again. Retry bool `json:"retry"` } var _ json.UnmarshalerFrom = (*InitializeError)(nil) func (s *InitializeError) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenRetry bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"retry"`: seenRetry = true if err := json.UnmarshalDecode(dec, &s.Retry); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRetry { return fmt.Errorf("required property 'retry' is missing") } return nil } type InitializedParams struct{} // The parameters of a change configuration notification. type DidChangeConfigurationParams struct { // The actual changed settings Settings any `json:"settings"` } var _ json.UnmarshalerFrom = (*DidChangeConfigurationParams)(nil) func (s *DidChangeConfigurationParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenSettings bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"settings"`: seenSettings = true if err := json.UnmarshalDecode(dec, &s.Settings); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenSettings { return fmt.Errorf("required property 'settings' is missing") } return nil } type DidChangeConfigurationRegistrationOptions struct { Section *StringOrStrings `json:"section,omitzero"` } // The parameters of a notification message. type ShowMessageParams struct { // The message type. See MessageType Type MessageType `json:"type"` // The actual message. Message string `json:"message"` } var _ json.UnmarshalerFrom = (*ShowMessageParams)(nil) func (s *ShowMessageParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenType bool seenMessage bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"type"`: seenType = true if err := json.UnmarshalDecode(dec, &s.Type); err != nil { return err } case `"message"`: seenMessage = true if err := json.UnmarshalDecode(dec, &s.Message); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenType { return fmt.Errorf("required property 'type' is missing") } if !seenMessage { return fmt.Errorf("required property 'message' is missing") } return nil } type ShowMessageRequestParams struct { // The message type. See MessageType Type MessageType `json:"type"` // The actual message. Message string `json:"message"` // The message action items to present. Actions *[]*MessageActionItem `json:"actions,omitzero"` } var _ json.UnmarshalerFrom = (*ShowMessageRequestParams)(nil) func (s *ShowMessageRequestParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenType bool seenMessage bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"type"`: seenType = true if err := json.UnmarshalDecode(dec, &s.Type); err != nil { return err } case `"message"`: seenMessage = true if err := json.UnmarshalDecode(dec, &s.Message); err != nil { return err } case `"actions"`: if err := json.UnmarshalDecode(dec, &s.Actions); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenType { return fmt.Errorf("required property 'type' is missing") } if !seenMessage { return fmt.Errorf("required property 'message' is missing") } return nil } type MessageActionItem struct { // A short title like 'Retry', 'Open Log' etc. Title string `json:"title"` } var _ json.UnmarshalerFrom = (*MessageActionItem)(nil) func (s *MessageActionItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenTitle bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"title"`: seenTitle = true if err := json.UnmarshalDecode(dec, &s.Title); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTitle { return fmt.Errorf("required property 'title' is missing") } return nil } // The log message parameters. type LogMessageParams struct { // The message type. See MessageType Type MessageType `json:"type"` // The actual message. Message string `json:"message"` } var _ json.UnmarshalerFrom = (*LogMessageParams)(nil) func (s *LogMessageParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenType bool seenMessage bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"type"`: seenType = true if err := json.UnmarshalDecode(dec, &s.Type); err != nil { return err } case `"message"`: seenMessage = true if err := json.UnmarshalDecode(dec, &s.Message); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenType { return fmt.Errorf("required property 'type' is missing") } if !seenMessage { return fmt.Errorf("required property 'message' is missing") } return nil } // The parameters sent in an open text document notification type DidOpenTextDocumentParams struct { // The document that was opened. TextDocument *TextDocumentItem `json:"textDocument"` } var _ json.UnmarshalerFrom = (*DidOpenTextDocumentParams)(nil) func (s *DidOpenTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenTextDocument bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } return nil } // The change text document notification's parameters. type DidChangeTextDocumentParams struct { // The document that did change. The version number points // to the version after all provided content changes have // been applied. TextDocument VersionedTextDocumentIdentifier `json:"textDocument"` // The actual content changes. The content changes describe single state changes // to the document. So if there are two content changes c1 (at array index 0) and // c2 (at array index 1) for a document in state S then c1 moves the document from // S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed // on the state S'. // // To mirror the content of a document using change events use the following approach: // - start with the same initial content // - apply the 'textDocument/didChange' notifications in the order you receive them. // - apply the `TextDocumentContentChangeEvent`s in a single notification in the order // you receive them. ContentChanges []TextDocumentContentChangePartialOrWholeDocument `json:"contentChanges"` } var _ json.UnmarshalerFrom = (*DidChangeTextDocumentParams)(nil) func (s *DidChangeTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenContentChanges bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"contentChanges"`: seenContentChanges = true if err := json.UnmarshalDecode(dec, &s.ContentChanges); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenContentChanges { return fmt.Errorf("required property 'contentChanges' is missing") } return nil } // Describe options to be used when registered for text document change events. type TextDocumentChangeRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` // How documents are synced to the server. SyncKind TextDocumentSyncKind `json:"syncKind"` } var _ json.UnmarshalerFrom = (*TextDocumentChangeRegistrationOptions)(nil) func (s *TextDocumentChangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenDocumentSelector bool seenSyncKind bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"syncKind"`: seenSyncKind = true if err := json.UnmarshalDecode(dec, &s.SyncKind); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } if !seenSyncKind { return fmt.Errorf("required property 'syncKind' is missing") } return nil } // The parameters sent in a close text document notification type DidCloseTextDocumentParams struct { // The document that was closed. TextDocument TextDocumentIdentifier `json:"textDocument"` } func (s *DidCloseTextDocumentParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*DidCloseTextDocumentParams)(nil) func (s *DidCloseTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenTextDocument bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } return nil } // The parameters sent in a save text document notification type DidSaveTextDocumentParams struct { // The document that was saved. TextDocument TextDocumentIdentifier `json:"textDocument"` // Optional the content when saved. Depends on the includeText value // when the save notification was requested. Text *string `json:"text,omitzero"` } func (s *DidSaveTextDocumentParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*DidSaveTextDocumentParams)(nil) func (s *DidSaveTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenTextDocument bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"text"`: if err := json.UnmarshalDecode(dec, &s.Text); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } return nil } // Save registration options. type TextDocumentSaveRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` // The client is supposed to include the content on save. IncludeText *bool `json:"includeText,omitzero"` } var _ json.UnmarshalerFrom = (*TextDocumentSaveRegistrationOptions)(nil) func (s *TextDocumentSaveRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"includeText"`: if err := json.UnmarshalDecode(dec, &s.IncludeText); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // The parameters sent in a will save text document notification. type WillSaveTextDocumentParams struct { // The document that will be saved. TextDocument TextDocumentIdentifier `json:"textDocument"` // The 'TextDocumentSaveReason'. Reason TextDocumentSaveReason `json:"reason"` } func (s *WillSaveTextDocumentParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*WillSaveTextDocumentParams)(nil) func (s *WillSaveTextDocumentParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenReason bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"reason"`: seenReason = true if err := json.UnmarshalDecode(dec, &s.Reason); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenReason { return fmt.Errorf("required property 'reason' is missing") } return nil } // A text edit applicable to a text document. type TextEdit struct { // The range of the text document to be manipulated. To insert // text into a document create a range where start === end. Range Range `json:"range"` // The string to be inserted. For delete operations use an // empty string. NewText string `json:"newText"` } var _ json.UnmarshalerFrom = (*TextEdit)(nil) func (s *TextEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenRange bool seenNewText bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"newText"`: seenNewText = true if err := json.UnmarshalDecode(dec, &s.NewText); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRange { return fmt.Errorf("required property 'range' is missing") } if !seenNewText { return fmt.Errorf("required property 'newText' is missing") } return nil } // The watched files change notification's parameters. type DidChangeWatchedFilesParams struct { // The actual file events. Changes []*FileEvent `json:"changes"` } var _ json.UnmarshalerFrom = (*DidChangeWatchedFilesParams)(nil) func (s *DidChangeWatchedFilesParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenChanges bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"changes"`: seenChanges = true if err := json.UnmarshalDecode(dec, &s.Changes); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenChanges { return fmt.Errorf("required property 'changes' is missing") } return nil } // Describe options to be used when registered for text document change events. type DidChangeWatchedFilesRegistrationOptions struct { // The watchers to register. Watchers []*FileSystemWatcher `json:"watchers"` } var _ json.UnmarshalerFrom = (*DidChangeWatchedFilesRegistrationOptions)(nil) func (s *DidChangeWatchedFilesRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenWatchers bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"watchers"`: seenWatchers = true if err := json.UnmarshalDecode(dec, &s.Watchers); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenWatchers { return fmt.Errorf("required property 'watchers' is missing") } return nil } // The publish diagnostic notification's parameters. type PublishDiagnosticsParams struct { // The URI for which diagnostic information is reported. Uri DocumentUri `json:"uri"` // Optional the version number of the document the diagnostics are published for. // // Since: 3.15.0 Version *int32 `json:"version,omitzero"` // An array of diagnostic information items. Diagnostics []*Diagnostic `json:"diagnostics"` } var _ json.UnmarshalerFrom = (*PublishDiagnosticsParams)(nil) func (s *PublishDiagnosticsParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenUri bool seenDiagnostics bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"version"`: if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } case `"diagnostics"`: seenDiagnostics = true if err := json.UnmarshalDecode(dec, &s.Diagnostics); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } if !seenDiagnostics { return fmt.Errorf("required property 'diagnostics' is missing") } return nil } // Completion parameters type CompletionParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position inside the text document. Position Position `json:"position"` // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` // The completion context. This is only available it the client specifies // to send this using the client capability `textDocument.completion.contextSupport === true` Context *CompletionContext `json:"context,omitzero"` } func (s *CompletionParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*CompletionParams)(nil) func (s *CompletionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"context"`: if err := json.UnmarshalDecode(dec, &s.Context); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } return nil } // A completion item represents a text snippet that is // proposed to complete text that is being typed. type CompletionItem struct { // The label of this completion item. // // The label property is also by default the text that // is inserted when selecting this completion. // // If label details are provided the label itself should // be an unqualified name of the completion item. Label string `json:"label"` // Additional details for the label // // Since: 3.17.0 LabelDetails *CompletionItemLabelDetails `json:"labelDetails,omitzero"` // The kind of this completion item. Based of the kind // an icon is chosen by the editor. Kind *CompletionItemKind `json:"kind,omitzero"` // Tags for this completion item. // // Since: 3.15.0 Tags *[]CompletionItemTag `json:"tags,omitzero"` // A human-readable string with additional information // about this item, like type or symbol information. Detail *string `json:"detail,omitzero"` // A human-readable string that represents a doc-comment. Documentation *StringOrMarkupContent `json:"documentation,omitzero"` // Indicates if this item is deprecated. // // Deprecated: Use `tags` instead. Deprecated *bool `json:"deprecated,omitzero"` // Select this item when showing. // // *Note* that only one completion item can be selected and that the // tool / client decides which item that is. The rule is that the *first* // item of those that match best is selected. Preselect *bool `json:"preselect,omitzero"` // A string that should be used when comparing this item // with other items. When `falsy` the label // is used. SortText *string `json:"sortText,omitzero"` // A string that should be used when filtering a set of // completion items. When `falsy` the label // is used. FilterText *string `json:"filterText,omitzero"` // A string that should be inserted into a document when selecting // this completion. When `falsy` the label // is used. // // The `insertText` is subject to interpretation by the client side. // Some tools might not take the string literally. For example // VS Code when code complete is requested in this example // `con` and a completion item with an `insertText` of // `console` is provided it will only insert `sole`. Therefore it is // recommended to use `textEdit` instead since it avoids additional client // side interpretation. InsertText *string `json:"insertText,omitzero"` // The format of the insert text. The format applies to both the // `insertText` property and the `newText` property of a provided // `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`. // // Please note that the insertTextFormat doesn't apply to // `additionalTextEdits`. InsertTextFormat *InsertTextFormat `json:"insertTextFormat,omitzero"` // How whitespace and indentation is handled during completion // item insertion. If not provided the clients default value depends on // the `textDocument.completion.insertTextMode` client capability. // // Since: 3.16.0 InsertTextMode *InsertTextMode `json:"insertTextMode,omitzero"` // An edit which is applied to a document when selecting // this completion. When an edit is provided the value of // insertText is ignored. // // Most editors support two different operations when accepting a completion // item. One is to insert a completion text and the other is to replace an // existing text with a completion text. Since this can usually not be // predetermined by a server it can report both ranges. Clients need to // signal support for `InsertReplaceEdits` via the // `textDocument.completion.insertReplaceSupport` client capability // property. // // *Note 1:* The text edit's range as well as both ranges from an insert // replace edit must be a [single line] and they must contain the position // at which completion has been requested. // *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range // must be a prefix of the edit's replace range, that means it must be // contained and starting at the same position. // // Since: 3.16.0 additional type `InsertReplaceEdit` TextEdit *TextEditOrInsertReplaceEdit `json:"textEdit,omitzero"` // The edit text used if the completion item is part of a CompletionList and // CompletionList defines an item default for the text edit range. // // Clients will only honor this property if they opt into completion list // item defaults using the capability `completionList.itemDefaults`. // // If not provided and a list's default range is provided the label // property is used as a text. // // Since: 3.17.0 TextEditText *string `json:"textEditText,omitzero"` // An optional array of additional edits that are applied when // selecting this completion. Edits must not overlap (including the same insert position) // with the main edit nor with themselves. // // Additional text edits should be used to change text unrelated to the current cursor position // (for example adding an import statement at the top of the file if the completion item will // insert an unqualified type). AdditionalTextEdits *[]*TextEdit `json:"additionalTextEdits,omitzero"` // An optional set of characters that when pressed while this completion is active will accept it first and // then type that character. *Note* that all commit characters should have `length=1` and that superfluous // characters will be ignored. CommitCharacters *[]string `json:"commitCharacters,omitzero"` // An optional command that is executed *after* inserting this completion. *Note* that // additional modifications to the current document should be described with the // additionalTextEdits-property. Command *Command `json:"command,omitzero"` // A data entry field that is preserved on a completion item between a // CompletionRequest and a CompletionResolveRequest. Data *any `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*CompletionItem)(nil) func (s *CompletionItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenLabel bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"label"`: seenLabel = true if err := json.UnmarshalDecode(dec, &s.Label); err != nil { return err } case `"labelDetails"`: if err := json.UnmarshalDecode(dec, &s.LabelDetails); err != nil { return err } case `"kind"`: if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"tags"`: if err := json.UnmarshalDecode(dec, &s.Tags); err != nil { return err } case `"detail"`: if err := json.UnmarshalDecode(dec, &s.Detail); err != nil { return err } case `"documentation"`: if err := json.UnmarshalDecode(dec, &s.Documentation); err != nil { return err } case `"deprecated"`: if err := json.UnmarshalDecode(dec, &s.Deprecated); err != nil { return err } case `"preselect"`: if err := json.UnmarshalDecode(dec, &s.Preselect); err != nil { return err } case `"sortText"`: if err := json.UnmarshalDecode(dec, &s.SortText); err != nil { return err } case `"filterText"`: if err := json.UnmarshalDecode(dec, &s.FilterText); err != nil { return err } case `"insertText"`: if err := json.UnmarshalDecode(dec, &s.InsertText); err != nil { return err } case `"insertTextFormat"`: if err := json.UnmarshalDecode(dec, &s.InsertTextFormat); err != nil { return err } case `"insertTextMode"`: if err := json.UnmarshalDecode(dec, &s.InsertTextMode); err != nil { return err } case `"textEdit"`: if err := json.UnmarshalDecode(dec, &s.TextEdit); err != nil { return err } case `"textEditText"`: if err := json.UnmarshalDecode(dec, &s.TextEditText); err != nil { return err } case `"additionalTextEdits"`: if err := json.UnmarshalDecode(dec, &s.AdditionalTextEdits); err != nil { return err } case `"commitCharacters"`: if err := json.UnmarshalDecode(dec, &s.CommitCharacters); err != nil { return err } case `"command"`: if err := json.UnmarshalDecode(dec, &s.Command); err != nil { return err } case `"data"`: if err := json.UnmarshalDecode(dec, &s.Data); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenLabel { return fmt.Errorf("required property 'label' is missing") } return nil } // Represents a collection of items to be presented // in the editor. type CompletionList struct { // This list it not complete. Further typing results in recomputing this list. // // Recomputed lists have all their items replaced (not appended) in the // incomplete completion sessions. IsIncomplete bool `json:"isIncomplete"` // In many cases the items of an actual completion result share the same // value for properties like `commitCharacters` or the range of a text // edit. A completion list can therefore define item defaults which will // be used if a completion item itself doesn't specify the value. // // If a completion list specifies a default value and a completion item // also specifies a corresponding value, the rules for combining these are // defined by `applyKinds` (if the client supports it), defaulting to // ApplyKind.Replace. // // Servers are only allowed to return default values if the client // signals support for this via the `completionList.itemDefaults` // capability. // // Since: 3.17.0 ItemDefaults *CompletionItemDefaults `json:"itemDefaults,omitzero"` // Specifies how fields from a completion item should be combined with those // from `completionList.itemDefaults`. // // If unspecified, all fields will be treated as ApplyKind.Replace. // // If a field's value is ApplyKind.Replace, the value from a completion item // (if provided and not `null`) will always be used instead of the value // from `completionItem.itemDefaults`. // // If a field's value is ApplyKind.Merge, the values will be merged using // the rules defined against each field below. // // Servers are only allowed to return `applyKind` if the client // signals support for this via the `completionList.applyKindSupport` // capability. // // Since: 3.18.0 ApplyKind *CompletionItemApplyKinds `json:"applyKind,omitzero"` // The completion items. Items []*CompletionItem `json:"items"` } var _ json.UnmarshalerFrom = (*CompletionList)(nil) func (s *CompletionList) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenIsIncomplete bool seenItems bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"isIncomplete"`: seenIsIncomplete = true if err := json.UnmarshalDecode(dec, &s.IsIncomplete); err != nil { return err } case `"itemDefaults"`: if err := json.UnmarshalDecode(dec, &s.ItemDefaults); err != nil { return err } case `"applyKind"`: if err := json.UnmarshalDecode(dec, &s.ApplyKind); err != nil { return err } case `"items"`: seenItems = true if err := json.UnmarshalDecode(dec, &s.Items); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenIsIncomplete { return fmt.Errorf("required property 'isIncomplete' is missing") } if !seenItems { return fmt.Errorf("required property 'items' is missing") } return nil } // Registration options for a CompletionRequest. type CompletionRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // Most tools trigger completion request automatically without explicitly requesting // it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user // starts to type an identifier. For example if the user types `c` in a JavaScript file // code complete will automatically pop up present `console` besides others as a // completion item. Characters that make up identifiers don't need to be listed here. // // If code complete should automatically be trigger on characters not being valid inside // an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. TriggerCharacters *[]string `json:"triggerCharacters,omitzero"` // The list of all possible characters that commit a completion. This field can be used // if clients don't support individual commit characters per completion item. See // `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` // // If a server provides both `allCommitCharacters` and commit characters on an individual // completion item the ones on the completion item win. // // Since: 3.2.0 AllCommitCharacters *[]string `json:"allCommitCharacters,omitzero"` // The server provides support to resolve additional // information for a completion item. ResolveProvider *bool `json:"resolveProvider,omitzero"` // The server supports the following `CompletionItem` specific // capabilities. // // Since: 3.17.0 CompletionItem *ServerCompletionItemOptions `json:"completionItem,omitzero"` } var _ json.UnmarshalerFrom = (*CompletionRegistrationOptions)(nil) func (s *CompletionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"triggerCharacters"`: if err := json.UnmarshalDecode(dec, &s.TriggerCharacters); err != nil { return err } case `"allCommitCharacters"`: if err := json.UnmarshalDecode(dec, &s.AllCommitCharacters); err != nil { return err } case `"resolveProvider"`: if err := json.UnmarshalDecode(dec, &s.ResolveProvider); err != nil { return err } case `"completionItem"`: if err := json.UnmarshalDecode(dec, &s.CompletionItem); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // Parameters for a HoverRequest. type HoverParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position inside the text document. Position Position `json:"position"` // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` } func (s *HoverParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*HoverParams)(nil) func (s *HoverParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } return nil } // The result of a hover request. type Hover struct { // The hover's content Contents MarkupContentOrStringOrMarkedStringWithLanguageOrMarkedStrings `json:"contents"` // An optional range inside the text document that is used to // visualize the hover, e.g. by changing the background color. Range *Range `json:"range,omitzero"` } var _ json.UnmarshalerFrom = (*Hover)(nil) func (s *Hover) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenContents bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"contents"`: seenContents = true if err := json.UnmarshalDecode(dec, &s.Contents); err != nil { return err } case `"range"`: if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenContents { return fmt.Errorf("required property 'contents' is missing") } return nil } // Registration options for a HoverRequest. type HoverRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } var _ json.UnmarshalerFrom = (*HoverRegistrationOptions)(nil) func (s *HoverRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // Parameters for a SignatureHelpRequest. type SignatureHelpParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position inside the text document. Position Position `json:"position"` // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // The signature help context. This is only available if the client specifies // to send this using the client capability `textDocument.signatureHelp.contextSupport === true` // // Since: 3.15.0 Context *SignatureHelpContext `json:"context,omitzero"` } func (s *SignatureHelpParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*SignatureHelpParams)(nil) func (s *SignatureHelpParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"context"`: if err := json.UnmarshalDecode(dec, &s.Context); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } return nil } // Signature help represents the signature of something // callable. There can be multiple signature but only one // active and only one active parameter. type SignatureHelp struct { // One or more signatures. Signatures []*SignatureInformation `json:"signatures"` // The active signature. If omitted or the value lies outside the // range of `signatures` the value defaults to zero or is ignored if // the `SignatureHelp` has no signatures. // // Whenever possible implementors should make an active decision about // the active signature and shouldn't rely on a default value. // // In future version of the protocol this property might become // mandatory to better express this. ActiveSignature *uint32 `json:"activeSignature,omitzero"` // The active parameter of the active signature. // // If `null`, no parameter of the signature is active (for example a named // argument that does not match any declared parameters). This is only valid // if the client specifies the client capability // `textDocument.signatureHelp.noActiveParameterSupport === true` // // If omitted or the value lies outside the range of // `signatures[activeSignature].parameters` defaults to 0 if the active // signature has parameters. // // If the active signature has no parameters it is ignored. // // In future version of the protocol this property might become // mandatory (but still nullable) to better express the active parameter if // the active signature does have any. ActiveParameter *UintegerOrNull `json:"activeParameter,omitzero"` } var _ json.UnmarshalerFrom = (*SignatureHelp)(nil) func (s *SignatureHelp) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenSignatures bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"signatures"`: seenSignatures = true if err := json.UnmarshalDecode(dec, &s.Signatures); err != nil { return err } case `"activeSignature"`: if err := json.UnmarshalDecode(dec, &s.ActiveSignature); err != nil { return err } case `"activeParameter"`: if err := json.UnmarshalDecode(dec, &s.ActiveParameter); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenSignatures { return fmt.Errorf("required property 'signatures' is missing") } return nil } // Registration options for a SignatureHelpRequest. type SignatureHelpRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // List of characters that trigger signature help automatically. TriggerCharacters *[]string `json:"triggerCharacters,omitzero"` // List of characters that re-trigger signature help. // // These trigger characters are only active when signature help is already showing. All trigger characters // are also counted as re-trigger characters. // // Since: 3.15.0 RetriggerCharacters *[]string `json:"retriggerCharacters,omitzero"` } var _ json.UnmarshalerFrom = (*SignatureHelpRegistrationOptions)(nil) func (s *SignatureHelpRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"triggerCharacters"`: if err := json.UnmarshalDecode(dec, &s.TriggerCharacters); err != nil { return err } case `"retriggerCharacters"`: if err := json.UnmarshalDecode(dec, &s.RetriggerCharacters); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // Parameters for a DefinitionRequest. type DefinitionParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position inside the text document. Position Position `json:"position"` // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` } func (s *DefinitionParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*DefinitionParams)(nil) func (s *DefinitionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } return nil } // Registration options for a DefinitionRequest. type DefinitionRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } var _ json.UnmarshalerFrom = (*DefinitionRegistrationOptions)(nil) func (s *DefinitionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // Parameters for a ReferencesRequest. type ReferenceParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position inside the text document. Position Position `json:"position"` // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` Context *ReferenceContext `json:"context"` } func (s *ReferenceParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*ReferenceParams)(nil) func (s *ReferenceParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool seenContext bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"context"`: seenContext = true if err := json.UnmarshalDecode(dec, &s.Context); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } if !seenContext { return fmt.Errorf("required property 'context' is missing") } return nil } // Registration options for a ReferencesRequest. type ReferenceRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } var _ json.UnmarshalerFrom = (*ReferenceRegistrationOptions)(nil) func (s *ReferenceRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // Parameters for a DocumentHighlightRequest. type DocumentHighlightParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position inside the text document. Position Position `json:"position"` // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` } func (s *DocumentHighlightParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*DocumentHighlightParams)(nil) func (s *DocumentHighlightParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } return nil } // A document highlight is a range inside a text document which deserves // special attention. Usually a document highlight is visualized by changing // the background color of its range. type DocumentHighlight struct { // The range this highlight applies to. Range Range `json:"range"` // The highlight kind, default is text. Kind *DocumentHighlightKind `json:"kind,omitzero"` } var _ json.UnmarshalerFrom = (*DocumentHighlight)(nil) func (s *DocumentHighlight) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenRange bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"kind"`: if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRange { return fmt.Errorf("required property 'range' is missing") } return nil } // Registration options for a DocumentHighlightRequest. type DocumentHighlightRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } var _ json.UnmarshalerFrom = (*DocumentHighlightRegistrationOptions)(nil) func (s *DocumentHighlightRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // Parameters for a DocumentSymbolRequest. type DocumentSymbolParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` } func (s *DocumentSymbolParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*DocumentSymbolParams)(nil) func (s *DocumentSymbolParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenTextDocument bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } return nil } // Represents information about programming constructs like variables, classes, // interfaces etc. type SymbolInformation struct { // The name of this symbol. Name string `json:"name"` // The kind of this symbol. Kind SymbolKind `json:"kind"` // Tags for this symbol. // // Since: 3.16.0 Tags *[]SymbolTag `json:"tags,omitzero"` // The name of the symbol containing this symbol. This information is for // user interface purposes (e.g. to render a qualifier in the user interface // if necessary). It can't be used to re-infer a hierarchy for the document // symbols. ContainerName *string `json:"containerName,omitzero"` // Indicates if this symbol is deprecated. // // Deprecated: Use tags instead Deprecated *bool `json:"deprecated,omitzero"` // The location of this symbol. The location's range is used by a tool // to reveal the location in the editor. If the symbol is selected in the // tool the range's start information is used to position the cursor. So // the range usually spans more than the actual symbol's name and does // normally include things like visibility modifiers. // // The range doesn't have to denote a node range in the sense of an abstract // syntax tree. It can therefore not be used to re-construct a hierarchy of // the symbols. Location Location `json:"location"` } var _ json.UnmarshalerFrom = (*SymbolInformation)(nil) func (s *SymbolInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenName bool seenKind bool seenLocation bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"name"`: seenName = true if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"tags"`: if err := json.UnmarshalDecode(dec, &s.Tags); err != nil { return err } case `"containerName"`: if err := json.UnmarshalDecode(dec, &s.ContainerName); err != nil { return err } case `"deprecated"`: if err := json.UnmarshalDecode(dec, &s.Deprecated); err != nil { return err } case `"location"`: seenLocation = true if err := json.UnmarshalDecode(dec, &s.Location); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenName { return fmt.Errorf("required property 'name' is missing") } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenLocation { return fmt.Errorf("required property 'location' is missing") } return nil } // Represents programming constructs like variables, classes, interfaces etc. // that appear in a document. Document symbols can be hierarchical and they // have two ranges: one that encloses its definition and one that points to // its most interesting range, e.g. the range of an identifier. type DocumentSymbol struct { // The name of this symbol. Will be displayed in the user interface and therefore must not be // an empty string or a string only consisting of white spaces. Name string `json:"name"` // More detail for this symbol, e.g the signature of a function. Detail *string `json:"detail,omitzero"` // The kind of this symbol. Kind SymbolKind `json:"kind"` // Tags for this document symbol. // // Since: 3.16.0 Tags *[]SymbolTag `json:"tags,omitzero"` // Indicates if this symbol is deprecated. // // Deprecated: Use tags instead Deprecated *bool `json:"deprecated,omitzero"` // The range enclosing this symbol not including leading/trailing whitespace but everything else // like comments. This information is typically used to determine if the clients cursor is // inside the symbol to reveal in the symbol in the UI. Range Range `json:"range"` // The range that should be selected and revealed when this symbol is being picked, e.g the name of a function. // Must be contained by the `range`. SelectionRange Range `json:"selectionRange"` // Children of this symbol, e.g. properties of a class. Children *[]*DocumentSymbol `json:"children,omitzero"` } var _ json.UnmarshalerFrom = (*DocumentSymbol)(nil) func (s *DocumentSymbol) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenName bool seenKind bool seenRange bool seenSelectionRange bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"name"`: seenName = true if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } case `"detail"`: if err := json.UnmarshalDecode(dec, &s.Detail); err != nil { return err } case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"tags"`: if err := json.UnmarshalDecode(dec, &s.Tags); err != nil { return err } case `"deprecated"`: if err := json.UnmarshalDecode(dec, &s.Deprecated); err != nil { return err } case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"selectionRange"`: seenSelectionRange = true if err := json.UnmarshalDecode(dec, &s.SelectionRange); err != nil { return err } case `"children"`: if err := json.UnmarshalDecode(dec, &s.Children); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenName { return fmt.Errorf("required property 'name' is missing") } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenRange { return fmt.Errorf("required property 'range' is missing") } if !seenSelectionRange { return fmt.Errorf("required property 'selectionRange' is missing") } return nil } // Registration options for a DocumentSymbolRequest. type DocumentSymbolRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // A human-readable string that is shown when multiple outlines trees // are shown for the same document. // // Since: 3.16.0 Label *string `json:"label,omitzero"` } var _ json.UnmarshalerFrom = (*DocumentSymbolRegistrationOptions)(nil) func (s *DocumentSymbolRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"label"`: if err := json.UnmarshalDecode(dec, &s.Label); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // The parameters of a CodeActionRequest. type CodeActionParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` // The document in which the command was invoked. TextDocument TextDocumentIdentifier `json:"textDocument"` // The range for which the command was invoked. Range Range `json:"range"` // Context carrying additional information. Context *CodeActionContext `json:"context"` } func (s *CodeActionParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*CodeActionParams)(nil) func (s *CodeActionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenRange bool seenContext bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"context"`: seenContext = true if err := json.UnmarshalDecode(dec, &s.Context); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenRange { return fmt.Errorf("required property 'range' is missing") } if !seenContext { return fmt.Errorf("required property 'context' is missing") } return nil } // Represents a reference to a command. Provides a title which // will be used to represent a command in the UI and, optionally, // an array of arguments which will be passed to the command handler // function when invoked. type Command struct { // Title of the command, like `save`. Title string `json:"title"` // An optional tooltip. // // Since: 3.18.0 // // Proposed. Tooltip *string `json:"tooltip,omitzero"` // The identifier of the actual command handler. Command string `json:"command"` // Arguments that the command handler should be // invoked with. Arguments *[]any `json:"arguments,omitzero"` } var _ json.UnmarshalerFrom = (*Command)(nil) func (s *Command) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTitle bool seenCommand bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"title"`: seenTitle = true if err := json.UnmarshalDecode(dec, &s.Title); err != nil { return err } case `"tooltip"`: if err := json.UnmarshalDecode(dec, &s.Tooltip); err != nil { return err } case `"command"`: seenCommand = true if err := json.UnmarshalDecode(dec, &s.Command); err != nil { return err } case `"arguments"`: if err := json.UnmarshalDecode(dec, &s.Arguments); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTitle { return fmt.Errorf("required property 'title' is missing") } if !seenCommand { return fmt.Errorf("required property 'command' is missing") } return nil } // A code action represents a change that can be performed in code, e.g. to fix a problem or // to refactor code. // // A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed. type CodeAction struct { // A short, human-readable, title for this code action. Title string `json:"title"` // The kind of the code action. // // Used to filter code actions. Kind *CodeActionKind `json:"kind,omitzero"` // The diagnostics that this code action resolves. Diagnostics *[]*Diagnostic `json:"diagnostics,omitzero"` // Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted // by keybindings. // // A quick fix should be marked preferred if it properly addresses the underlying error. // A refactoring should be marked preferred if it is the most reasonable choice of actions to take. // // Since: 3.15.0 IsPreferred *bool `json:"isPreferred,omitzero"` // Marks that the code action cannot currently be applied. // // Clients should follow the following guidelines regarding disabled code actions: // // - Disabled code actions are not shown in automatic [lightbulbs](https://code.visualstudio.com/docs/editor/editingevolved#_code-action) // code action menus. // // - Disabled actions are shown as faded out in the code action menu when the user requests a more specific type // of code action, such as refactorings. // // - If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions) // that auto applies a code action and only disabled code actions are returned, the client should show the user an // error message with `reason` in the editor. // // Since: 3.16.0 Disabled *CodeActionDisabled `json:"disabled,omitzero"` // The workspace edit this code action performs. Edit *WorkspaceEdit `json:"edit,omitzero"` // A command this code action executes. If a code action // provides an edit and a command, first the edit is // executed and then the command. Command *Command `json:"command,omitzero"` // A data entry field that is preserved on a code action between // a `textDocument/codeAction` and a `codeAction/resolve` request. // // Since: 3.16.0 Data *any `json:"data,omitzero"` // Tags for this code action. // // Since: 3.18.0 - proposed Tags *[]CodeActionTag `json:"tags,omitzero"` } var _ json.UnmarshalerFrom = (*CodeAction)(nil) func (s *CodeAction) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenTitle bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"title"`: seenTitle = true if err := json.UnmarshalDecode(dec, &s.Title); err != nil { return err } case `"kind"`: if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"diagnostics"`: if err := json.UnmarshalDecode(dec, &s.Diagnostics); err != nil { return err } case `"isPreferred"`: if err := json.UnmarshalDecode(dec, &s.IsPreferred); err != nil { return err } case `"disabled"`: if err := json.UnmarshalDecode(dec, &s.Disabled); err != nil { return err } case `"edit"`: if err := json.UnmarshalDecode(dec, &s.Edit); err != nil { return err } case `"command"`: if err := json.UnmarshalDecode(dec, &s.Command); err != nil { return err } case `"data"`: if err := json.UnmarshalDecode(dec, &s.Data); err != nil { return err } case `"tags"`: if err := json.UnmarshalDecode(dec, &s.Tags); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTitle { return fmt.Errorf("required property 'title' is missing") } return nil } // Registration options for a CodeActionRequest. type CodeActionRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // CodeActionKinds that this server may return. // // The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server // may list out every specific kind they provide. CodeActionKinds *[]CodeActionKind `json:"codeActionKinds,omitzero"` // Static documentation for a class of code actions. // // Documentation from the provider should be shown in the code actions menu if either: // // - Code actions of `kind` are requested by the editor. In this case, the editor will show the documentation that // most closely matches the requested code action kind. For example, if a provider has documentation for // both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`, // the editor will use the documentation for `RefactorExtract` instead of the documentation for `Refactor`. // // - Any code actions of `kind` are returned by the provider. // // At most one documentation entry should be shown per provider. // // Since: 3.18.0 // // Proposed. Documentation *[]*CodeActionKindDocumentation `json:"documentation,omitzero"` // The server provides support to resolve additional // information for a code action. // // Since: 3.16.0 ResolveProvider *bool `json:"resolveProvider,omitzero"` } var _ json.UnmarshalerFrom = (*CodeActionRegistrationOptions)(nil) func (s *CodeActionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"codeActionKinds"`: if err := json.UnmarshalDecode(dec, &s.CodeActionKinds); err != nil { return err } case `"documentation"`: if err := json.UnmarshalDecode(dec, &s.Documentation); err != nil { return err } case `"resolveProvider"`: if err := json.UnmarshalDecode(dec, &s.ResolveProvider); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // The parameters of a WorkspaceSymbolRequest. type WorkspaceSymbolParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` // A query string to filter symbols by. Clients may send an empty // string here to request all symbols. // // The `query`-parameter should be interpreted in a *relaxed way* as editors // will apply their own highlighting and scoring on the results. A good rule // of thumb is to match case-insensitive and to simply check that the // characters of *query* appear in their order in a candidate symbol. // Servers shouldn't use prefix, substring, or similar strict matching. Query string `json:"query"` } var _ json.UnmarshalerFrom = (*WorkspaceSymbolParams)(nil) func (s *WorkspaceSymbolParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenQuery bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"query"`: seenQuery = true if err := json.UnmarshalDecode(dec, &s.Query); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenQuery { return fmt.Errorf("required property 'query' is missing") } return nil } // A special workspace symbol that supports locations without a range. // // See also SymbolInformation. // // Since: 3.17.0 type WorkspaceSymbol struct { // The name of this symbol. Name string `json:"name"` // The kind of this symbol. Kind SymbolKind `json:"kind"` // Tags for this symbol. // // Since: 3.16.0 Tags *[]SymbolTag `json:"tags,omitzero"` // The name of the symbol containing this symbol. This information is for // user interface purposes (e.g. to render a qualifier in the user interface // if necessary). It can't be used to re-infer a hierarchy for the document // symbols. ContainerName *string `json:"containerName,omitzero"` // The location of the symbol. Whether a server is allowed to // return a location without a range depends on the client // capability `workspace.symbol.resolveSupport`. // // See SymbolInformation#location for more details. Location LocationOrLocationUriOnly `json:"location"` // A data entry field that is preserved on a workspace symbol between a // workspace symbol request and a workspace symbol resolve request. Data *any `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*WorkspaceSymbol)(nil) func (s *WorkspaceSymbol) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenName bool seenKind bool seenLocation bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"name"`: seenName = true if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"tags"`: if err := json.UnmarshalDecode(dec, &s.Tags); err != nil { return err } case `"containerName"`: if err := json.UnmarshalDecode(dec, &s.ContainerName); err != nil { return err } case `"location"`: seenLocation = true if err := json.UnmarshalDecode(dec, &s.Location); err != nil { return err } case `"data"`: if err := json.UnmarshalDecode(dec, &s.Data); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenName { return fmt.Errorf("required property 'name' is missing") } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenLocation { return fmt.Errorf("required property 'location' is missing") } return nil } // Registration options for a WorkspaceSymbolRequest. type WorkspaceSymbolRegistrationOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // The server provides support to resolve additional // information for a workspace symbol. // // Since: 3.17.0 ResolveProvider *bool `json:"resolveProvider,omitzero"` } // The parameters of a CodeLensRequest. type CodeLensParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` // The document to request code lens for. TextDocument TextDocumentIdentifier `json:"textDocument"` } func (s *CodeLensParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*CodeLensParams)(nil) func (s *CodeLensParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenTextDocument bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } return nil } // A code lens represents a command that should be shown along with // source text, like the number of references, a way to run tests, etc. // // A code lens is _unresolved_ when no command is associated to it. For performance // reasons the creation of a code lens and resolving should be done in two stages. type CodeLens struct { // The range in which this code lens is valid. Should only span a single line. Range Range `json:"range"` // The command this code lens represents. Command *Command `json:"command,omitzero"` // A data entry field that is preserved on a code lens item between // a CodeLensRequest and a CodeLensResolveRequest Data *any `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*CodeLens)(nil) func (s *CodeLens) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenRange bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"command"`: if err := json.UnmarshalDecode(dec, &s.Command); err != nil { return err } case `"data"`: if err := json.UnmarshalDecode(dec, &s.Data); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRange { return fmt.Errorf("required property 'range' is missing") } return nil } // Registration options for a CodeLensRequest. type CodeLensRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // Code lens has a resolve provider as well. ResolveProvider *bool `json:"resolveProvider,omitzero"` } var _ json.UnmarshalerFrom = (*CodeLensRegistrationOptions)(nil) func (s *CodeLensRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"resolveProvider"`: if err := json.UnmarshalDecode(dec, &s.ResolveProvider); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // The parameters of a DocumentLinkRequest. type DocumentLinkParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` // The document to provide document links for. TextDocument TextDocumentIdentifier `json:"textDocument"` } func (s *DocumentLinkParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*DocumentLinkParams)(nil) func (s *DocumentLinkParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenTextDocument bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"partialResultToken"`: if err := json.UnmarshalDecode(dec, &s.PartialResultToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } return nil } // A document link is a range in a text document that links to an internal or external resource, like another // text document or a web site. type DocumentLink struct { // The range this link applies to. Range Range `json:"range"` // The uri this link points to. If missing a resolve request is sent later. Target *URI `json:"target,omitzero"` // The tooltip text when you hover over this link. // // If a tooltip is provided, is will be displayed in a string that includes instructions on how to // trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS, // user settings, and localization. // // Since: 3.15.0 Tooltip *string `json:"tooltip,omitzero"` // A data entry field that is preserved on a document link between a // DocumentLinkRequest and a DocumentLinkResolveRequest. Data *any `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*DocumentLink)(nil) func (s *DocumentLink) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenRange bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"target"`: if err := json.UnmarshalDecode(dec, &s.Target); err != nil { return err } case `"tooltip"`: if err := json.UnmarshalDecode(dec, &s.Tooltip); err != nil { return err } case `"data"`: if err := json.UnmarshalDecode(dec, &s.Data); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRange { return fmt.Errorf("required property 'range' is missing") } return nil } // Registration options for a DocumentLinkRequest. type DocumentLinkRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // Document links have a resolve provider as well. ResolveProvider *bool `json:"resolveProvider,omitzero"` } var _ json.UnmarshalerFrom = (*DocumentLinkRegistrationOptions)(nil) func (s *DocumentLinkRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"resolveProvider"`: if err := json.UnmarshalDecode(dec, &s.ResolveProvider); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // The parameters of a DocumentFormattingRequest. type DocumentFormattingParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // The document to format. TextDocument TextDocumentIdentifier `json:"textDocument"` // The format options. Options *FormattingOptions `json:"options"` } func (s *DocumentFormattingParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*DocumentFormattingParams)(nil) func (s *DocumentFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenOptions bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"options"`: seenOptions = true if err := json.UnmarshalDecode(dec, &s.Options); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenOptions { return fmt.Errorf("required property 'options' is missing") } return nil } // Registration options for a DocumentFormattingRequest. type DocumentFormattingRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } var _ json.UnmarshalerFrom = (*DocumentFormattingRegistrationOptions)(nil) func (s *DocumentFormattingRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // The parameters of a DocumentRangeFormattingRequest. type DocumentRangeFormattingParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // The document to format. TextDocument TextDocumentIdentifier `json:"textDocument"` // The range to format Range Range `json:"range"` // The format options Options *FormattingOptions `json:"options"` } func (s *DocumentRangeFormattingParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*DocumentRangeFormattingParams)(nil) func (s *DocumentRangeFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenRange bool seenOptions bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"options"`: seenOptions = true if err := json.UnmarshalDecode(dec, &s.Options); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenRange { return fmt.Errorf("required property 'range' is missing") } if !seenOptions { return fmt.Errorf("required property 'options' is missing") } return nil } // Registration options for a DocumentRangeFormattingRequest. type DocumentRangeFormattingRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // Whether the server supports formatting multiple ranges at once. // // Since: 3.18.0 // // Proposed. RangesSupport *bool `json:"rangesSupport,omitzero"` } var _ json.UnmarshalerFrom = (*DocumentRangeFormattingRegistrationOptions)(nil) func (s *DocumentRangeFormattingRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"rangesSupport"`: if err := json.UnmarshalDecode(dec, &s.RangesSupport); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } // The parameters of a DocumentRangesFormattingRequest. // // Since: 3.18.0 // // Proposed. type DocumentRangesFormattingParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // The document to format. TextDocument TextDocumentIdentifier `json:"textDocument"` // The ranges to format Ranges []Range `json:"ranges"` // The format options Options *FormattingOptions `json:"options"` } func (s *DocumentRangesFormattingParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*DocumentRangesFormattingParams)(nil) func (s *DocumentRangesFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenRanges bool seenOptions bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"ranges"`: seenRanges = true if err := json.UnmarshalDecode(dec, &s.Ranges); err != nil { return err } case `"options"`: seenOptions = true if err := json.UnmarshalDecode(dec, &s.Options); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenRanges { return fmt.Errorf("required property 'ranges' is missing") } if !seenOptions { return fmt.Errorf("required property 'options' is missing") } return nil } // The parameters of a DocumentOnTypeFormattingRequest. type DocumentOnTypeFormattingParams struct { // The document to format. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position around which the on type formatting should happen. // This is not necessarily the exact position where the character denoted // by the property `ch` got typed. Position Position `json:"position"` // The character that has been typed that triggered the formatting // on type request. That is not necessarily the last character that // got inserted into the document since the client could auto insert // characters as well (e.g. like automatic brace completion). Ch string `json:"ch"` // The formatting options. Options *FormattingOptions `json:"options"` } func (s *DocumentOnTypeFormattingParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*DocumentOnTypeFormattingParams)(nil) func (s *DocumentOnTypeFormattingParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool seenCh bool seenOptions bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"ch"`: seenCh = true if err := json.UnmarshalDecode(dec, &s.Ch); err != nil { return err } case `"options"`: seenOptions = true if err := json.UnmarshalDecode(dec, &s.Options); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } if !seenCh { return fmt.Errorf("required property 'ch' is missing") } if !seenOptions { return fmt.Errorf("required property 'options' is missing") } return nil } // Registration options for a DocumentOnTypeFormattingRequest. type DocumentOnTypeFormattingRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` // A character on which formatting should be triggered, like `{`. FirstTriggerCharacter string `json:"firstTriggerCharacter"` // More trigger characters. MoreTriggerCharacter *[]string `json:"moreTriggerCharacter,omitzero"` } var _ json.UnmarshalerFrom = (*DocumentOnTypeFormattingRegistrationOptions)(nil) func (s *DocumentOnTypeFormattingRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenDocumentSelector bool seenFirstTriggerCharacter bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"firstTriggerCharacter"`: seenFirstTriggerCharacter = true if err := json.UnmarshalDecode(dec, &s.FirstTriggerCharacter); err != nil { return err } case `"moreTriggerCharacter"`: if err := json.UnmarshalDecode(dec, &s.MoreTriggerCharacter); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } if !seenFirstTriggerCharacter { return fmt.Errorf("required property 'firstTriggerCharacter' is missing") } return nil } // The parameters of a RenameRequest. type RenameParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // The document to rename. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position at which this request was sent. Position Position `json:"position"` // The new name of the symbol. If the given name is not valid the // request must return a ResponseError with an // appropriate message set. NewName string `json:"newName"` } func (s *RenameParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*RenameParams)(nil) func (s *RenameParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool seenNewName bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"newName"`: seenNewName = true if err := json.UnmarshalDecode(dec, &s.NewName); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } if !seenNewName { return fmt.Errorf("required property 'newName' is missing") } return nil } // Registration options for a RenameRequest. type RenameRegistrationOptions struct { // A document selector to identify the scope of the registration. If set to null // the document selector provided on the client side will be used. DocumentSelector DocumentSelectorOrNull `json:"documentSelector"` WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // Renames should be checked and tested before being executed. // // Since: version 3.12.0 PrepareProvider *bool `json:"prepareProvider,omitzero"` } var _ json.UnmarshalerFrom = (*RenameRegistrationOptions)(nil) func (s *RenameRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDocumentSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"documentSelector"`: seenDocumentSelector = true if err := json.UnmarshalDecode(dec, &s.DocumentSelector); err != nil { return err } case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"prepareProvider"`: if err := json.UnmarshalDecode(dec, &s.PrepareProvider); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocumentSelector { return fmt.Errorf("required property 'documentSelector' is missing") } return nil } type PrepareRenameParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position inside the text document. Position Position `json:"position"` // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` } func (s *PrepareRenameParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*PrepareRenameParams)(nil) func (s *PrepareRenameParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } return nil } // The parameters of a ExecuteCommandRequest. type ExecuteCommandParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // The identifier of the actual command handler. Command string `json:"command"` // Arguments that the command should be invoked with. Arguments *[]any `json:"arguments,omitzero"` } var _ json.UnmarshalerFrom = (*ExecuteCommandParams)(nil) func (s *ExecuteCommandParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenCommand bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"command"`: seenCommand = true if err := json.UnmarshalDecode(dec, &s.Command); err != nil { return err } case `"arguments"`: if err := json.UnmarshalDecode(dec, &s.Arguments); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenCommand { return fmt.Errorf("required property 'command' is missing") } return nil } // Registration options for a ExecuteCommandRequest. type ExecuteCommandRegistrationOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // The commands to be executed on the server Commands []string `json:"commands"` } var _ json.UnmarshalerFrom = (*ExecuteCommandRegistrationOptions)(nil) func (s *ExecuteCommandRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenCommands bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"commands"`: seenCommands = true if err := json.UnmarshalDecode(dec, &s.Commands); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenCommands { return fmt.Errorf("required property 'commands' is missing") } return nil } // The parameters passed via an apply workspace edit request. type ApplyWorkspaceEditParams struct { // An optional label of the workspace edit. This label is // presented in the user interface for example on an undo // stack to undo the workspace edit. Label *string `json:"label,omitzero"` // The edits to apply. Edit *WorkspaceEdit `json:"edit"` // Additional data about the edit. // // Since: 3.18.0 // // Proposed. Metadata *WorkspaceEditMetadata `json:"metadata,omitzero"` } var _ json.UnmarshalerFrom = (*ApplyWorkspaceEditParams)(nil) func (s *ApplyWorkspaceEditParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenEdit bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"label"`: if err := json.UnmarshalDecode(dec, &s.Label); err != nil { return err } case `"edit"`: seenEdit = true if err := json.UnmarshalDecode(dec, &s.Edit); err != nil { return err } case `"metadata"`: if err := json.UnmarshalDecode(dec, &s.Metadata); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenEdit { return fmt.Errorf("required property 'edit' is missing") } return nil } // The result returned from the apply workspace edit request. // // Since: 3.17 renamed from ApplyWorkspaceEditResponse type ApplyWorkspaceEditResult struct { // Indicates whether the edit was applied or not. Applied bool `json:"applied"` // An optional textual description for why the edit was not applied. // This may be used by the server for diagnostic logging or to provide // a suitable error for a request that triggered the edit. FailureReason *string `json:"failureReason,omitzero"` // Depending on the client's failure handling strategy `failedChange` might // contain the index of the change that failed. This property is only available // if the client signals a `failureHandlingStrategy` in its client capabilities. FailedChange *uint32 `json:"failedChange,omitzero"` } var _ json.UnmarshalerFrom = (*ApplyWorkspaceEditResult)(nil) func (s *ApplyWorkspaceEditResult) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenApplied bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"applied"`: seenApplied = true if err := json.UnmarshalDecode(dec, &s.Applied); err != nil { return err } case `"failureReason"`: if err := json.UnmarshalDecode(dec, &s.FailureReason); err != nil { return err } case `"failedChange"`: if err := json.UnmarshalDecode(dec, &s.FailedChange); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenApplied { return fmt.Errorf("required property 'applied' is missing") } return nil } type WorkDoneProgressBegin struct { Kind StringLiteralBegin `json:"kind"` // Mandatory title of the progress operation. Used to briefly inform about // the kind of operation being performed. // // Examples: "Indexing" or "Linking dependencies". Title string `json:"title"` // Controls if a cancel button should show to allow the user to cancel the // long running operation. Clients that don't support cancellation are allowed // to ignore the setting. Cancellable *bool `json:"cancellable,omitzero"` // Optional, more detailed associated progress message. Contains // complementary information to the `title`. // // Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". // If unset, the previous progress message (if any) is still valid. Message *string `json:"message,omitzero"` // Optional progress percentage to display (value 100 is considered 100%). // If not provided infinite progress is assumed and clients are allowed // to ignore the `percentage` value in subsequent in report notifications. // // The value should be steadily rising. Clients are free to ignore values // that are not following this rule. The value range is [0, 100]. Percentage *uint32 `json:"percentage,omitzero"` } var _ json.UnmarshalerFrom = (*WorkDoneProgressBegin)(nil) func (s *WorkDoneProgressBegin) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenKind bool seenTitle bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"title"`: seenTitle = true if err := json.UnmarshalDecode(dec, &s.Title); err != nil { return err } case `"cancellable"`: if err := json.UnmarshalDecode(dec, &s.Cancellable); err != nil { return err } case `"message"`: if err := json.UnmarshalDecode(dec, &s.Message); err != nil { return err } case `"percentage"`: if err := json.UnmarshalDecode(dec, &s.Percentage); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenTitle { return fmt.Errorf("required property 'title' is missing") } return nil } type WorkDoneProgressReport struct { Kind StringLiteralReport `json:"kind"` // Controls enablement state of a cancel button. // // Clients that don't support cancellation or don't support controlling the button's // enablement state are allowed to ignore the property. Cancellable *bool `json:"cancellable,omitzero"` // Optional, more detailed associated progress message. Contains // complementary information to the `title`. // // Examples: "3/25 files", "project/src/module2", "node_modules/some_dep". // If unset, the previous progress message (if any) is still valid. Message *string `json:"message,omitzero"` // Optional progress percentage to display (value 100 is considered 100%). // If not provided infinite progress is assumed and clients are allowed // to ignore the `percentage` value in subsequent in report notifications. // // The value should be steadily rising. Clients are free to ignore values // that are not following this rule. The value range is [0, 100] Percentage *uint32 `json:"percentage,omitzero"` } var _ json.UnmarshalerFrom = (*WorkDoneProgressReport)(nil) func (s *WorkDoneProgressReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenKind bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"cancellable"`: if err := json.UnmarshalDecode(dec, &s.Cancellable); err != nil { return err } case `"message"`: if err := json.UnmarshalDecode(dec, &s.Message); err != nil { return err } case `"percentage"`: if err := json.UnmarshalDecode(dec, &s.Percentage); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } return nil } type WorkDoneProgressEnd struct { Kind StringLiteralEnd `json:"kind"` // Optional, a final message indicating to for example indicate the outcome // of the operation. Message *string `json:"message,omitzero"` } var _ json.UnmarshalerFrom = (*WorkDoneProgressEnd)(nil) func (s *WorkDoneProgressEnd) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenKind bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"message"`: if err := json.UnmarshalDecode(dec, &s.Message); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } return nil } type SetTraceParams struct { Value TraceValue `json:"value"` } var _ json.UnmarshalerFrom = (*SetTraceParams)(nil) func (s *SetTraceParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenValue bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"value"`: seenValue = true if err := json.UnmarshalDecode(dec, &s.Value); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenValue { return fmt.Errorf("required property 'value' is missing") } return nil } type LogTraceParams struct { Message string `json:"message"` Verbose *string `json:"verbose,omitzero"` } var _ json.UnmarshalerFrom = (*LogTraceParams)(nil) func (s *LogTraceParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenMessage bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"message"`: seenMessage = true if err := json.UnmarshalDecode(dec, &s.Message); err != nil { return err } case `"verbose"`: if err := json.UnmarshalDecode(dec, &s.Verbose); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenMessage { return fmt.Errorf("required property 'message' is missing") } return nil } type CancelParams struct { // The request id to cancel. Id IntegerOrString `json:"id"` } var _ json.UnmarshalerFrom = (*CancelParams)(nil) func (s *CancelParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenId bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"id"`: seenId = true if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenId { return fmt.Errorf("required property 'id' is missing") } return nil } type ProgressParams struct { // The progress token provided by the client or server. Token IntegerOrString `json:"token"` // The progress data. Value any `json:"value"` } var _ json.UnmarshalerFrom = (*ProgressParams)(nil) func (s *ProgressParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenToken bool seenValue bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"token"`: seenToken = true if err := json.UnmarshalDecode(dec, &s.Token); err != nil { return err } case `"value"`: seenValue = true if err := json.UnmarshalDecode(dec, &s.Value); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenToken { return fmt.Errorf("required property 'token' is missing") } if !seenValue { return fmt.Errorf("required property 'value' is missing") } return nil } // A parameter literal used in requests to pass a text document and a position inside that // document. type TextDocumentPositionParams struct { // The text document. TextDocument TextDocumentIdentifier `json:"textDocument"` // The position inside the text document. Position Position `json:"position"` } func (s *TextDocumentPositionParams) TextDocumentURI() DocumentUri { return s.TextDocument.Uri } var _ json.UnmarshalerFrom = (*TextDocumentPositionParams)(nil) func (s *TextDocumentPositionParams) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenPosition bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"position"`: seenPosition = true if err := json.UnmarshalDecode(dec, &s.Position); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenPosition { return fmt.Errorf("required property 'position' is missing") } return nil } type WorkDoneProgressParams struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` } type PartialResultParams struct { // An optional token that a server can use to report partial results (e.g. streaming) to // the client. PartialResultToken *IntegerOrString `json:"partialResultToken,omitzero"` } // Represents the connection of two locations. Provides additional metadata over normal locations, // including an origin range. type LocationLink struct { // Span of the origin of this link. // // Used as the underlined span for mouse interaction. Defaults to the word range at // the definition position. OriginSelectionRange *Range `json:"originSelectionRange,omitzero"` // The target resource identifier of this link. TargetUri DocumentUri `json:"targetUri"` // The full target range of this link. If the target for example is a symbol then target range is the // range enclosing this symbol not including leading/trailing whitespace but everything else // like comments. This information is typically used to highlight the range in the editor. TargetRange Range `json:"targetRange"` // The range that should be selected and revealed when this link is being followed, e.g the name of a function. // Must be contained by the `targetRange`. See also `DocumentSymbol#range` TargetSelectionRange Range `json:"targetSelectionRange"` } var _ json.UnmarshalerFrom = (*LocationLink)(nil) func (s *LocationLink) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTargetUri bool seenTargetRange bool seenTargetSelectionRange bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"originSelectionRange"`: if err := json.UnmarshalDecode(dec, &s.OriginSelectionRange); err != nil { return err } case `"targetUri"`: seenTargetUri = true if err := json.UnmarshalDecode(dec, &s.TargetUri); err != nil { return err } case `"targetRange"`: seenTargetRange = true if err := json.UnmarshalDecode(dec, &s.TargetRange); err != nil { return err } case `"targetSelectionRange"`: seenTargetSelectionRange = true if err := json.UnmarshalDecode(dec, &s.TargetSelectionRange); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTargetUri { return fmt.Errorf("required property 'targetUri' is missing") } if !seenTargetRange { return fmt.Errorf("required property 'targetRange' is missing") } if !seenTargetSelectionRange { return fmt.Errorf("required property 'targetSelectionRange' is missing") } return nil } // A range in a text document expressed as (zero-based) start and end positions. // // If you want to specify a range that contains a line including the line ending // character(s) then use an end position denoting the start of the next line. // For example: // ```ts // // { // start: { line: 5, character: 23 } // end : { line 6, character : 0 } // } // // ``` type Range struct { // The range's start position. Start Position `json:"start"` // The range's end position. End Position `json:"end"` } var _ json.UnmarshalerFrom = (*Range)(nil) func (s *Range) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenStart bool seenEnd bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"start"`: seenStart = true if err := json.UnmarshalDecode(dec, &s.Start); err != nil { return err } case `"end"`: seenEnd = true if err := json.UnmarshalDecode(dec, &s.End); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenStart { return fmt.Errorf("required property 'start' is missing") } if !seenEnd { return fmt.Errorf("required property 'end' is missing") } return nil } type ImplementationOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } // Static registration options to be returned in the initialize // request. type StaticRegistrationOptions struct { // The id used to register the request. The id can be used to deregister // the request again. See also Registration#id. Id *string `json:"id,omitzero"` } type TypeDefinitionOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } // The workspace folder change event. type WorkspaceFoldersChangeEvent struct { // The array of added workspace folders Added []*WorkspaceFolder `json:"added"` // The array of the removed workspace folders Removed []*WorkspaceFolder `json:"removed"` } var _ json.UnmarshalerFrom = (*WorkspaceFoldersChangeEvent)(nil) func (s *WorkspaceFoldersChangeEvent) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenAdded bool seenRemoved bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"added"`: seenAdded = true if err := json.UnmarshalDecode(dec, &s.Added); err != nil { return err } case `"removed"`: seenRemoved = true if err := json.UnmarshalDecode(dec, &s.Removed); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenAdded { return fmt.Errorf("required property 'added' is missing") } if !seenRemoved { return fmt.Errorf("required property 'removed' is missing") } return nil } type ConfigurationItem struct { // The scope to get the configuration section for. ScopeUri *URI `json:"scopeUri,omitzero"` // The configuration section asked for. Section *string `json:"section,omitzero"` } // A literal to identify a text document in the client. type TextDocumentIdentifier struct { // The text document's uri. Uri DocumentUri `json:"uri"` } var _ json.UnmarshalerFrom = (*TextDocumentIdentifier)(nil) func (s *TextDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenUri bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } return nil } // Represents a color in RGBA space. type Color struct { // The red component of this color in the range [0-1]. Red float64 `json:"red"` // The green component of this color in the range [0-1]. Green float64 `json:"green"` // The blue component of this color in the range [0-1]. Blue float64 `json:"blue"` // The alpha component of this color in the range [0-1]. Alpha float64 `json:"alpha"` } var _ json.UnmarshalerFrom = (*Color)(nil) func (s *Color) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenRed bool seenGreen bool seenBlue bool seenAlpha bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"red"`: seenRed = true if err := json.UnmarshalDecode(dec, &s.Red); err != nil { return err } case `"green"`: seenGreen = true if err := json.UnmarshalDecode(dec, &s.Green); err != nil { return err } case `"blue"`: seenBlue = true if err := json.UnmarshalDecode(dec, &s.Blue); err != nil { return err } case `"alpha"`: seenAlpha = true if err := json.UnmarshalDecode(dec, &s.Alpha); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRed { return fmt.Errorf("required property 'red' is missing") } if !seenGreen { return fmt.Errorf("required property 'green' is missing") } if !seenBlue { return fmt.Errorf("required property 'blue' is missing") } if !seenAlpha { return fmt.Errorf("required property 'alpha' is missing") } return nil } type DocumentColorOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } type FoldingRangeOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } type DeclarationOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } // Position in a text document expressed as zero-based line and character // offset. Prior to 3.17 the offsets were always based on a UTF-16 string // representation. So a string of the form `a𐐀b` the character offset of the // character `a` is 0, the character offset of `𐐀` is 1 and the character // offset of b is 3 since `𐐀` is represented using two code units in UTF-16. // Since 3.17 clients and servers can agree on a different string encoding // representation (e.g. UTF-8). The client announces it's supported encoding // via the client capability [`general.positionEncodings`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#clientCapabilities). // The value is an array of position encodings the client supports, with // decreasing preference (e.g. the encoding at index `0` is the most preferred // one). To stay backwards compatible the only mandatory encoding is UTF-16 // represented via the string `utf-16`. The server can pick one of the // encodings offered by the client and signals that encoding back to the // client via the initialize result's property // [`capabilities.positionEncoding`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverCapabilities). If the string value // `utf-16` is missing from the client's capability `general.positionEncodings` // servers can safely assume that the client supports UTF-16. If the server // omits the position encoding in its initialize result the encoding defaults // to the string value `utf-16`. Implementation considerations: since the // conversion from one encoding into another requires the content of the // file / line the conversion is best done where the file is read which is // usually on the server side. // // Positions are line end character agnostic. So you can not specify a position // that denotes `\r|\n` or `\n|` where `|` represents the character offset. // // Since: 3.17.0 - support for negotiated position encoding. type Position struct { // Line position in a document (zero-based). Line uint32 `json:"line"` // Character offset on a line in a document (zero-based). // // The meaning of this offset is determined by the negotiated // `PositionEncodingKind`. Character uint32 `json:"character"` } var _ json.UnmarshalerFrom = (*Position)(nil) func (s *Position) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenLine bool seenCharacter bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"line"`: seenLine = true if err := json.UnmarshalDecode(dec, &s.Line); err != nil { return err } case `"character"`: seenCharacter = true if err := json.UnmarshalDecode(dec, &s.Character); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenLine { return fmt.Errorf("required property 'line' is missing") } if !seenCharacter { return fmt.Errorf("required property 'character' is missing") } return nil } type SelectionRangeOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } // Call hierarchy options used during static registration. // // Since: 3.16.0 type CallHierarchyOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } // Since: 3.16.0 type SemanticTokensOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // The legend used by the server Legend *SemanticTokensLegend `json:"legend"` // Server supports providing semantic tokens for a specific range // of a document. Range *BooleanOrEmptyObject `json:"range,omitzero"` // Server supports providing semantic tokens for a full document. Full *BooleanOrSemanticTokensFullDelta `json:"full,omitzero"` } var _ json.UnmarshalerFrom = (*SemanticTokensOptions)(nil) func (s *SemanticTokensOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenLegend bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"legend"`: seenLegend = true if err := json.UnmarshalDecode(dec, &s.Legend); err != nil { return err } case `"range"`: if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"full"`: if err := json.UnmarshalDecode(dec, &s.Full); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenLegend { return fmt.Errorf("required property 'legend' is missing") } return nil } // Since: 3.16.0 type SemanticTokensEdit struct { // The start offset of the edit. Start uint32 `json:"start"` // The count of elements to remove. DeleteCount uint32 `json:"deleteCount"` // The elements to insert. Data *[]uint32 `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*SemanticTokensEdit)(nil) func (s *SemanticTokensEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenStart bool seenDeleteCount bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"start"`: seenStart = true if err := json.UnmarshalDecode(dec, &s.Start); err != nil { return err } case `"deleteCount"`: seenDeleteCount = true if err := json.UnmarshalDecode(dec, &s.DeleteCount); err != nil { return err } case `"data"`: if err := json.UnmarshalDecode(dec, &s.Data); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenStart { return fmt.Errorf("required property 'start' is missing") } if !seenDeleteCount { return fmt.Errorf("required property 'deleteCount' is missing") } return nil } type LinkedEditingRangeOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } // Represents information on a file/folder create. // // Since: 3.16.0 type FileCreate struct { // A file:// URI for the location of the file/folder being created. Uri string `json:"uri"` } var _ json.UnmarshalerFrom = (*FileCreate)(nil) func (s *FileCreate) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenUri bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } return nil } // Describes textual changes on a text document. A TextDocumentEdit describes all changes // on a document version Si and after they are applied move the document to version Si+1. // So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any // kind of ordering. However the edits must be non overlapping. type TextDocumentEdit struct { // The text document to change. TextDocument OptionalVersionedTextDocumentIdentifier `json:"textDocument"` // The edits to be applied. // // Since: 3.16.0 - support for AnnotatedTextEdit. This is guarded using a // client capability. // // Since: 3.18.0 - support for SnippetTextEdit. This is guarded using a // client capability. Edits []TextEditOrAnnotatedTextEditOrSnippetTextEdit `json:"edits"` } var _ json.UnmarshalerFrom = (*TextDocumentEdit)(nil) func (s *TextDocumentEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTextDocument bool seenEdits bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"textDocument"`: seenTextDocument = true if err := json.UnmarshalDecode(dec, &s.TextDocument); err != nil { return err } case `"edits"`: seenEdits = true if err := json.UnmarshalDecode(dec, &s.Edits); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTextDocument { return fmt.Errorf("required property 'textDocument' is missing") } if !seenEdits { return fmt.Errorf("required property 'edits' is missing") } return nil } // Create file operation. type CreateFile struct { // A create Kind StringLiteralCreate `json:"kind"` // An optional annotation identifier describing the operation. // // Since: 3.16.0 AnnotationId *string `json:"annotationId,omitzero"` // The resource to create. Uri DocumentUri `json:"uri"` // Additional options Options *CreateFileOptions `json:"options,omitzero"` } var _ json.UnmarshalerFrom = (*CreateFile)(nil) func (s *CreateFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenKind bool seenUri bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"annotationId"`: if err := json.UnmarshalDecode(dec, &s.AnnotationId); err != nil { return err } case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"options"`: if err := json.UnmarshalDecode(dec, &s.Options); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } return nil } // Rename file operation type RenameFile struct { // A rename Kind StringLiteralRename `json:"kind"` // An optional annotation identifier describing the operation. // // Since: 3.16.0 AnnotationId *string `json:"annotationId,omitzero"` // The old (existing) location. OldUri DocumentUri `json:"oldUri"` // The new location. NewUri DocumentUri `json:"newUri"` // Rename options. Options *RenameFileOptions `json:"options,omitzero"` } var _ json.UnmarshalerFrom = (*RenameFile)(nil) func (s *RenameFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenKind bool seenOldUri bool seenNewUri bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"annotationId"`: if err := json.UnmarshalDecode(dec, &s.AnnotationId); err != nil { return err } case `"oldUri"`: seenOldUri = true if err := json.UnmarshalDecode(dec, &s.OldUri); err != nil { return err } case `"newUri"`: seenNewUri = true if err := json.UnmarshalDecode(dec, &s.NewUri); err != nil { return err } case `"options"`: if err := json.UnmarshalDecode(dec, &s.Options); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenOldUri { return fmt.Errorf("required property 'oldUri' is missing") } if !seenNewUri { return fmt.Errorf("required property 'newUri' is missing") } return nil } // Delete file operation type DeleteFile struct { // A delete Kind StringLiteralDelete `json:"kind"` // An optional annotation identifier describing the operation. // // Since: 3.16.0 AnnotationId *string `json:"annotationId,omitzero"` // The file to delete. Uri DocumentUri `json:"uri"` // Delete options. Options *DeleteFileOptions `json:"options,omitzero"` } var _ json.UnmarshalerFrom = (*DeleteFile)(nil) func (s *DeleteFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenKind bool seenUri bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"annotationId"`: if err := json.UnmarshalDecode(dec, &s.AnnotationId); err != nil { return err } case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"options"`: if err := json.UnmarshalDecode(dec, &s.Options); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } return nil } // Additional information that describes document changes. // // Since: 3.16.0 type ChangeAnnotation struct { // A human-readable string describing the actual change. The string // is rendered prominent in the user interface. Label string `json:"label"` // A flag which indicates that user confirmation is needed // before applying the change. NeedsConfirmation *bool `json:"needsConfirmation,omitzero"` // A human-readable string which is rendered less prominent in // the user interface. Description *string `json:"description,omitzero"` } var _ json.UnmarshalerFrom = (*ChangeAnnotation)(nil) func (s *ChangeAnnotation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenLabel bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"label"`: seenLabel = true if err := json.UnmarshalDecode(dec, &s.Label); err != nil { return err } case `"needsConfirmation"`: if err := json.UnmarshalDecode(dec, &s.NeedsConfirmation); err != nil { return err } case `"description"`: if err := json.UnmarshalDecode(dec, &s.Description); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenLabel { return fmt.Errorf("required property 'label' is missing") } return nil } // A filter to describe in which file operation requests or notifications // the server is interested in receiving. // // Since: 3.16.0 type FileOperationFilter struct { // A Uri scheme like `file` or `untitled`. Scheme *string `json:"scheme,omitzero"` // The actual file operation pattern. Pattern *FileOperationPattern `json:"pattern"` } var _ json.UnmarshalerFrom = (*FileOperationFilter)(nil) func (s *FileOperationFilter) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenPattern bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"scheme"`: if err := json.UnmarshalDecode(dec, &s.Scheme); err != nil { return err } case `"pattern"`: seenPattern = true if err := json.UnmarshalDecode(dec, &s.Pattern); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenPattern { return fmt.Errorf("required property 'pattern' is missing") } return nil } // Represents information on a file/folder rename. // // Since: 3.16.0 type FileRename struct { // A file:// URI for the original location of the file/folder being renamed. OldUri string `json:"oldUri"` // A file:// URI for the new location of the file/folder being renamed. NewUri string `json:"newUri"` } var _ json.UnmarshalerFrom = (*FileRename)(nil) func (s *FileRename) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenOldUri bool seenNewUri bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"oldUri"`: seenOldUri = true if err := json.UnmarshalDecode(dec, &s.OldUri); err != nil { return err } case `"newUri"`: seenNewUri = true if err := json.UnmarshalDecode(dec, &s.NewUri); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenOldUri { return fmt.Errorf("required property 'oldUri' is missing") } if !seenNewUri { return fmt.Errorf("required property 'newUri' is missing") } return nil } // Represents information on a file/folder delete. // // Since: 3.16.0 type FileDelete struct { // A file:// URI for the location of the file/folder being deleted. Uri string `json:"uri"` } var _ json.UnmarshalerFrom = (*FileDelete)(nil) func (s *FileDelete) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenUri bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } return nil } type MonikerOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } // Type hierarchy options used during static registration. // // Since: 3.17.0 type TypeHierarchyOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } // Since: 3.17.0 type InlineValueContext struct { // The stack frame (as a DAP Id) where the execution has stopped. FrameId int32 `json:"frameId"` // The document range where execution has stopped. // Typically the end position of the range denotes the line where the inline values are shown. StoppedLocation Range `json:"stoppedLocation"` } var _ json.UnmarshalerFrom = (*InlineValueContext)(nil) func (s *InlineValueContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenFrameId bool seenStoppedLocation bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"frameId"`: seenFrameId = true if err := json.UnmarshalDecode(dec, &s.FrameId); err != nil { return err } case `"stoppedLocation"`: seenStoppedLocation = true if err := json.UnmarshalDecode(dec, &s.StoppedLocation); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenFrameId { return fmt.Errorf("required property 'frameId' is missing") } if !seenStoppedLocation { return fmt.Errorf("required property 'stoppedLocation' is missing") } return nil } // Provide inline value as text. // // Since: 3.17.0 type InlineValueText struct { // The document range for which the inline value applies. Range Range `json:"range"` // The text of the inline value. Text string `json:"text"` } var _ json.UnmarshalerFrom = (*InlineValueText)(nil) func (s *InlineValueText) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenRange bool seenText bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"text"`: seenText = true if err := json.UnmarshalDecode(dec, &s.Text); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRange { return fmt.Errorf("required property 'range' is missing") } if !seenText { return fmt.Errorf("required property 'text' is missing") } return nil } // Provide inline value through a variable lookup. // If only a range is specified, the variable name will be extracted from the underlying document. // An optional variable name can be used to override the extracted name. // // Since: 3.17.0 type InlineValueVariableLookup struct { // The document range for which the inline value applies. // The range is used to extract the variable name from the underlying document. Range Range `json:"range"` // If specified the name of the variable to look up. VariableName *string `json:"variableName,omitzero"` // How to perform the lookup. CaseSensitiveLookup bool `json:"caseSensitiveLookup"` } var _ json.UnmarshalerFrom = (*InlineValueVariableLookup)(nil) func (s *InlineValueVariableLookup) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenRange bool seenCaseSensitiveLookup bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"variableName"`: if err := json.UnmarshalDecode(dec, &s.VariableName); err != nil { return err } case `"caseSensitiveLookup"`: seenCaseSensitiveLookup = true if err := json.UnmarshalDecode(dec, &s.CaseSensitiveLookup); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRange { return fmt.Errorf("required property 'range' is missing") } if !seenCaseSensitiveLookup { return fmt.Errorf("required property 'caseSensitiveLookup' is missing") } return nil } // Provide an inline value through an expression evaluation. // If only a range is specified, the expression will be extracted from the underlying document. // An optional expression can be used to override the extracted expression. // // Since: 3.17.0 type InlineValueEvaluatableExpression struct { // The document range for which the inline value applies. // The range is used to extract the evaluatable expression from the underlying document. Range Range `json:"range"` // If specified the expression overrides the extracted expression. Expression *string `json:"expression,omitzero"` } var _ json.UnmarshalerFrom = (*InlineValueEvaluatableExpression)(nil) func (s *InlineValueEvaluatableExpression) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenRange bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"expression"`: if err := json.UnmarshalDecode(dec, &s.Expression); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRange { return fmt.Errorf("required property 'range' is missing") } return nil } // Inline value options used during static registration. // // Since: 3.17.0 type InlineValueOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } // An inlay hint label part allows for interactive and composite labels // of inlay hints. // // Since: 3.17.0 type InlayHintLabelPart struct { // The value of this label part. Value string `json:"value"` // The tooltip text when you hover over this label part. Depending on // the client capability `inlayHint.resolveSupport` clients might resolve // this property late using the resolve request. Tooltip *StringOrMarkupContent `json:"tooltip,omitzero"` // An optional source code location that represents this // label part. // // The editor will use this location for the hover and for code navigation // features: This part will become a clickable link that resolves to the // definition of the symbol at the given location (not necessarily the // location itself), it shows the hover that shows at the given location, // and it shows a context menu with further code navigation commands. // // Depending on the client capability `inlayHint.resolveSupport` clients // might resolve this property late using the resolve request. Location *Location `json:"location,omitzero"` // An optional command for this label part. // // Depending on the client capability `inlayHint.resolveSupport` clients // might resolve this property late using the resolve request. Command *Command `json:"command,omitzero"` } var _ json.UnmarshalerFrom = (*InlayHintLabelPart)(nil) func (s *InlayHintLabelPart) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenValue bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"value"`: seenValue = true if err := json.UnmarshalDecode(dec, &s.Value); err != nil { return err } case `"tooltip"`: if err := json.UnmarshalDecode(dec, &s.Tooltip); err != nil { return err } case `"location"`: if err := json.UnmarshalDecode(dec, &s.Location); err != nil { return err } case `"command"`: if err := json.UnmarshalDecode(dec, &s.Command); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenValue { return fmt.Errorf("required property 'value' is missing") } return nil } // A `MarkupContent` literal represents a string value which content is interpreted base on its // kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds. // // If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues. // See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting // // Here is an example how such a string can be constructed using JavaScript / TypeScript: // ```ts // // let markdown: MarkdownContent = { // kind: MarkupKind.Markdown, // value: [ // '# Header', // 'Some text', // '```typescript', // 'someCode();', // '```' // ].join('\n') // }; // // ``` // // *Please Note* that clients might sanitize the return markdown. A client could decide to // remove HTML from the markdown to avoid script execution. type MarkupContent struct { // The type of the Markup Kind MarkupKind `json:"kind"` // The content itself Value string `json:"value"` } var _ json.UnmarshalerFrom = (*MarkupContent)(nil) func (s *MarkupContent) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenKind bool seenValue bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"value"`: seenValue = true if err := json.UnmarshalDecode(dec, &s.Value); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenValue { return fmt.Errorf("required property 'value' is missing") } return nil } // Inlay hint options used during static registration. // // Since: 3.17.0 type InlayHintOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // The server provides support to resolve additional // information for an inlay hint item. ResolveProvider *bool `json:"resolveProvider,omitzero"` } // A full diagnostic report with a set of related documents. // // Since: 3.17.0 type RelatedFullDocumentDiagnosticReport struct { // A full document diagnostic report. Kind StringLiteralFull `json:"kind"` // An optional result id. If provided it will // be sent on the next diagnostic request for the // same document. ResultId *string `json:"resultId,omitzero"` // The actual items. Items []*Diagnostic `json:"items"` // Diagnostics of related documents. This information is useful // in programming languages where code in a file A can generate // diagnostics in a file B which A depends on. An example of // such a language is C/C++ where marco definitions in a file // a.cpp and result in errors in a header file b.hpp. // // Since: 3.17.0 RelatedDocuments *map[DocumentUri]FullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport `json:"relatedDocuments,omitzero"` } var _ json.UnmarshalerFrom = (*RelatedFullDocumentDiagnosticReport)(nil) func (s *RelatedFullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenKind bool seenItems bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"resultId"`: if err := json.UnmarshalDecode(dec, &s.ResultId); err != nil { return err } case `"items"`: seenItems = true if err := json.UnmarshalDecode(dec, &s.Items); err != nil { return err } case `"relatedDocuments"`: if err := json.UnmarshalDecode(dec, &s.RelatedDocuments); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenItems { return fmt.Errorf("required property 'items' is missing") } return nil } // An unchanged diagnostic report with a set of related documents. // // Since: 3.17.0 type RelatedUnchangedDocumentDiagnosticReport struct { // A document diagnostic report indicating // no changes to the last result. A server can // only return `unchanged` if result ids are // provided. Kind StringLiteralUnchanged `json:"kind"` // A result id which will be sent on the next // diagnostic request for the same document. ResultId string `json:"resultId"` // Diagnostics of related documents. This information is useful // in programming languages where code in a file A can generate // diagnostics in a file B which A depends on. An example of // such a language is C/C++ where marco definitions in a file // a.cpp and result in errors in a header file b.hpp. // // Since: 3.17.0 RelatedDocuments *map[DocumentUri]FullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport `json:"relatedDocuments,omitzero"` } var _ json.UnmarshalerFrom = (*RelatedUnchangedDocumentDiagnosticReport)(nil) func (s *RelatedUnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenKind bool seenResultId bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"resultId"`: seenResultId = true if err := json.UnmarshalDecode(dec, &s.ResultId); err != nil { return err } case `"relatedDocuments"`: if err := json.UnmarshalDecode(dec, &s.RelatedDocuments); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenResultId { return fmt.Errorf("required property 'resultId' is missing") } return nil } // A diagnostic report with a full set of problems. // // Since: 3.17.0 type FullDocumentDiagnosticReport struct { // A full document diagnostic report. Kind StringLiteralFull `json:"kind"` // An optional result id. If provided it will // be sent on the next diagnostic request for the // same document. ResultId *string `json:"resultId,omitzero"` // The actual items. Items []*Diagnostic `json:"items"` } var _ json.UnmarshalerFrom = (*FullDocumentDiagnosticReport)(nil) func (s *FullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenKind bool seenItems bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"resultId"`: if err := json.UnmarshalDecode(dec, &s.ResultId); err != nil { return err } case `"items"`: seenItems = true if err := json.UnmarshalDecode(dec, &s.Items); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenItems { return fmt.Errorf("required property 'items' is missing") } return nil } // A diagnostic report indicating that the last returned // report is still accurate. // // Since: 3.17.0 type UnchangedDocumentDiagnosticReport struct { // A document diagnostic report indicating // no changes to the last result. A server can // only return `unchanged` if result ids are // provided. Kind StringLiteralUnchanged `json:"kind"` // A result id which will be sent on the next // diagnostic request for the same document. ResultId string `json:"resultId"` } var _ json.UnmarshalerFrom = (*UnchangedDocumentDiagnosticReport)(nil) func (s *UnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenKind bool seenResultId bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"resultId"`: seenResultId = true if err := json.UnmarshalDecode(dec, &s.ResultId); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenResultId { return fmt.Errorf("required property 'resultId' is missing") } return nil } // Diagnostic options. // // Since: 3.17.0 type DiagnosticOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // An optional identifier under which the diagnostics are // managed by the client. Identifier *string `json:"identifier,omitzero"` // Whether the language has inter file dependencies meaning that // editing code in one file can result in a different diagnostic // set in another file. Inter file dependencies are common for // most programming languages and typically uncommon for linters. InterFileDependencies bool `json:"interFileDependencies"` // The server provides support for workspace diagnostics as well. WorkspaceDiagnostics bool `json:"workspaceDiagnostics"` } var _ json.UnmarshalerFrom = (*DiagnosticOptions)(nil) func (s *DiagnosticOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenInterFileDependencies bool seenWorkspaceDiagnostics bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"identifier"`: if err := json.UnmarshalDecode(dec, &s.Identifier); err != nil { return err } case `"interFileDependencies"`: seenInterFileDependencies = true if err := json.UnmarshalDecode(dec, &s.InterFileDependencies); err != nil { return err } case `"workspaceDiagnostics"`: seenWorkspaceDiagnostics = true if err := json.UnmarshalDecode(dec, &s.WorkspaceDiagnostics); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenInterFileDependencies { return fmt.Errorf("required property 'interFileDependencies' is missing") } if !seenWorkspaceDiagnostics { return fmt.Errorf("required property 'workspaceDiagnostics' is missing") } return nil } // A previous result id in a workspace pull request. // // Since: 3.17.0 type PreviousResultId struct { // The URI for which the client knowns a // result id. Uri DocumentUri `json:"uri"` // The value of the previous result id. Value string `json:"value"` } var _ json.UnmarshalerFrom = (*PreviousResultId)(nil) func (s *PreviousResultId) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenUri bool seenValue bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"value"`: seenValue = true if err := json.UnmarshalDecode(dec, &s.Value); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } if !seenValue { return fmt.Errorf("required property 'value' is missing") } return nil } // A notebook document. // // Since: 3.17.0 type NotebookDocument struct { // The notebook document's uri. Uri URI `json:"uri"` // The type of the notebook. NotebookType string `json:"notebookType"` // The version number of this document (it will increase after each // change, including undo/redo). Version int32 `json:"version"` // Additional metadata stored with the notebook // document. // // Note: should always be an object literal (e.g. LSPObject) Metadata *map[string]any `json:"metadata,omitzero"` // The cells of a notebook. Cells []*NotebookCell `json:"cells"` } var _ json.UnmarshalerFrom = (*NotebookDocument)(nil) func (s *NotebookDocument) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenUri bool seenNotebookType bool seenVersion bool seenCells bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"notebookType"`: seenNotebookType = true if err := json.UnmarshalDecode(dec, &s.NotebookType); err != nil { return err } case `"version"`: seenVersion = true if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } case `"metadata"`: if err := json.UnmarshalDecode(dec, &s.Metadata); err != nil { return err } case `"cells"`: seenCells = true if err := json.UnmarshalDecode(dec, &s.Cells); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } if !seenNotebookType { return fmt.Errorf("required property 'notebookType' is missing") } if !seenVersion { return fmt.Errorf("required property 'version' is missing") } if !seenCells { return fmt.Errorf("required property 'cells' is missing") } return nil } // An item to transfer a text document from the client to the // server. type TextDocumentItem struct { // The text document's uri. Uri DocumentUri `json:"uri"` // The text document's language identifier. LanguageId LanguageKind `json:"languageId"` // The version number of this document (it will increase after each // change, including undo/redo). Version int32 `json:"version"` // The content of the opened text document. Text string `json:"text"` } var _ json.UnmarshalerFrom = (*TextDocumentItem)(nil) func (s *TextDocumentItem) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenUri bool seenLanguageId bool seenVersion bool seenText bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"languageId"`: seenLanguageId = true if err := json.UnmarshalDecode(dec, &s.LanguageId); err != nil { return err } case `"version"`: seenVersion = true if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } case `"text"`: seenText = true if err := json.UnmarshalDecode(dec, &s.Text); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } if !seenLanguageId { return fmt.Errorf("required property 'languageId' is missing") } if !seenVersion { return fmt.Errorf("required property 'version' is missing") } if !seenText { return fmt.Errorf("required property 'text' is missing") } return nil } // Options specific to a notebook plus its cells // to be synced to the server. // // If a selector provides a notebook document // filter but no cell selector all cells of a // matching notebook document will be synced. // // If a selector provides no notebook document // filter but only a cell selector all notebook // document that contain at least one matching // cell will be synced. // // Since: 3.17.0 type NotebookDocumentSyncOptions struct { // The notebooks to be synced NotebookSelector []NotebookDocumentFilterWithNotebookOrCells `json:"notebookSelector"` // Whether save notification should be forwarded to // the server. Will only be honored if mode === `notebook`. Save *bool `json:"save,omitzero"` } var _ json.UnmarshalerFrom = (*NotebookDocumentSyncOptions)(nil) func (s *NotebookDocumentSyncOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenNotebookSelector bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"notebookSelector"`: seenNotebookSelector = true if err := json.UnmarshalDecode(dec, &s.NotebookSelector); err != nil { return err } case `"save"`: if err := json.UnmarshalDecode(dec, &s.Save); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenNotebookSelector { return fmt.Errorf("required property 'notebookSelector' is missing") } return nil } // A versioned notebook document identifier. // // Since: 3.17.0 type VersionedNotebookDocumentIdentifier struct { // The version number of this notebook document. Version int32 `json:"version"` // The notebook document's uri. Uri URI `json:"uri"` } var _ json.UnmarshalerFrom = (*VersionedNotebookDocumentIdentifier)(nil) func (s *VersionedNotebookDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenVersion bool seenUri bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"version"`: seenVersion = true if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenVersion { return fmt.Errorf("required property 'version' is missing") } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } return nil } // A change event for a notebook document. // // Since: 3.17.0 type NotebookDocumentChangeEvent struct { // The changed meta data if any. // // Note: should always be an object literal (e.g. LSPObject) Metadata *map[string]any `json:"metadata,omitzero"` // Changes to cells Cells *NotebookDocumentCellChanges `json:"cells,omitzero"` } // A literal to identify a notebook document in the client. // // Since: 3.17.0 type NotebookDocumentIdentifier struct { // The notebook document's uri. Uri URI `json:"uri"` } var _ json.UnmarshalerFrom = (*NotebookDocumentIdentifier)(nil) func (s *NotebookDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenUri bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } return nil } // Provides information about the context in which an inline completion was requested. // // Since: 3.18.0 // // Proposed. type InlineCompletionContext struct { // Describes how the inline completion was triggered. TriggerKind InlineCompletionTriggerKind `json:"triggerKind"` // Provides information about the currently selected item in the autocomplete widget if it is visible. SelectedCompletionInfo *SelectedCompletionInfo `json:"selectedCompletionInfo,omitzero"` } var _ json.UnmarshalerFrom = (*InlineCompletionContext)(nil) func (s *InlineCompletionContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenTriggerKind bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"triggerKind"`: seenTriggerKind = true if err := json.UnmarshalDecode(dec, &s.TriggerKind); err != nil { return err } case `"selectedCompletionInfo"`: if err := json.UnmarshalDecode(dec, &s.SelectedCompletionInfo); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTriggerKind { return fmt.Errorf("required property 'triggerKind' is missing") } return nil } // A string value used as a snippet is a template which allows to insert text // and to control the editor cursor when insertion happens. // // A snippet can define tab stops and placeholders with `$1`, `$2` // and `${3:foo}`. `$0` defines the final tab stop, it defaults to // the end of the snippet. Variables are defined with `$name` and // `${name:default value}`. // // Since: 3.18.0 // // Proposed. type StringValue struct { // The kind of string value. Kind StringLiteralSnippet `json:"kind"` // The snippet string. Value string `json:"value"` } var _ json.UnmarshalerFrom = (*StringValue)(nil) func (s *StringValue) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenKind bool seenValue bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"value"`: seenValue = true if err := json.UnmarshalDecode(dec, &s.Value); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenValue { return fmt.Errorf("required property 'value' is missing") } return nil } // Inline completion options used during static registration. // // Since: 3.18.0 // // Proposed. type InlineCompletionOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } // Text document content provider options. // // Since: 3.18.0 // // Proposed. type TextDocumentContentOptions struct { // The schemes for which the server provides content. Schemes []string `json:"schemes"` } var _ json.UnmarshalerFrom = (*TextDocumentContentOptions)(nil) func (s *TextDocumentContentOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenSchemes bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"schemes"`: seenSchemes = true if err := json.UnmarshalDecode(dec, &s.Schemes); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenSchemes { return fmt.Errorf("required property 'schemes' is missing") } return nil } // General parameters to register for a notification or to register a provider. type Registration struct { // The id used to register the request. The id can be used to deregister // the request again. Id string `json:"id"` // The method / capability to register for. Method string `json:"method"` // Options necessary for the registration. RegisterOptions *any `json:"registerOptions,omitzero"` } var _ json.UnmarshalerFrom = (*Registration)(nil) func (s *Registration) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenId bool seenMethod bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"id"`: seenId = true if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } case `"method"`: seenMethod = true if err := json.UnmarshalDecode(dec, &s.Method); err != nil { return err } case `"registerOptions"`: if err := json.UnmarshalDecode(dec, &s.RegisterOptions); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenId { return fmt.Errorf("required property 'id' is missing") } if !seenMethod { return fmt.Errorf("required property 'method' is missing") } return nil } // General parameters to unregister a request or notification. type Unregistration struct { // The id used to unregister the request or notification. Usually an id // provided during the register request. Id string `json:"id"` // The method to unregister for. Method string `json:"method"` } var _ json.UnmarshalerFrom = (*Unregistration)(nil) func (s *Unregistration) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenId bool seenMethod bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"id"`: seenId = true if err := json.UnmarshalDecode(dec, &s.Id); err != nil { return err } case `"method"`: seenMethod = true if err := json.UnmarshalDecode(dec, &s.Method); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenId { return fmt.Errorf("required property 'id' is missing") } if !seenMethod { return fmt.Errorf("required property 'method' is missing") } return nil } // The initialize parameters type InitializeParamsBase struct { // An optional token that a server can use to report work done progress. WorkDoneToken *IntegerOrString `json:"workDoneToken,omitzero"` // The process Id of the parent process that started // the server. // // Is `null` if the process has not been started by another process. // If the parent process is not alive then the server should exit. ProcessId IntegerOrNull `json:"processId"` // Information about the client // // Since: 3.15.0 ClientInfo *ClientInfo `json:"clientInfo,omitzero"` // The locale the client is currently showing the user interface // in. This must not necessarily be the locale of the operating // system. // // Uses IETF language tags as the value's syntax // (See https://en.wikipedia.org/wiki/IETF_language_tag) // // Since: 3.16.0 Locale *string `json:"locale,omitzero"` // The rootPath of the workspace. Is null // if no folder is open. // // Deprecated: in favour of rootUri. RootPath *StringOrNull `json:"rootPath,omitzero"` // The rootUri of the workspace. Is null if no // folder is open. If both `rootPath` and `rootUri` are set // `rootUri` wins. // // Deprecated: in favour of workspaceFolders. RootUri DocumentUriOrNull `json:"rootUri"` // The capabilities provided by the client (editor or tool) Capabilities *ClientCapabilities `json:"capabilities"` // User provided initialization options. InitializationOptions *any `json:"initializationOptions,omitzero"` // The initial trace setting. If omitted trace is disabled ('off'). Trace *TraceValue `json:"trace,omitzero"` } var _ json.UnmarshalerFrom = (*InitializeParamsBase)(nil) func (s *InitializeParamsBase) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenProcessId bool seenRootUri bool seenCapabilities bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneToken"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneToken); err != nil { return err } case `"processId"`: seenProcessId = true if err := json.UnmarshalDecode(dec, &s.ProcessId); err != nil { return err } case `"clientInfo"`: if err := json.UnmarshalDecode(dec, &s.ClientInfo); err != nil { return err } case `"locale"`: if err := json.UnmarshalDecode(dec, &s.Locale); err != nil { return err } case `"rootPath"`: if err := json.UnmarshalDecode(dec, &s.RootPath); err != nil { return err } case `"rootUri"`: seenRootUri = true if err := json.UnmarshalDecode(dec, &s.RootUri); err != nil { return err } case `"capabilities"`: seenCapabilities = true if err := json.UnmarshalDecode(dec, &s.Capabilities); err != nil { return err } case `"initializationOptions"`: if err := json.UnmarshalDecode(dec, &s.InitializationOptions); err != nil { return err } case `"trace"`: if err := json.UnmarshalDecode(dec, &s.Trace); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenProcessId { return fmt.Errorf("required property 'processId' is missing") } if !seenRootUri { return fmt.Errorf("required property 'rootUri' is missing") } if !seenCapabilities { return fmt.Errorf("required property 'capabilities' is missing") } return nil } type WorkspaceFoldersInitializeParams struct { // The workspace folders configured in the client when the server starts. // // This property is only available if the client supports workspace folders. // It can be `null` if the client supports workspace folders but none are // configured. // // Since: 3.6.0 WorkspaceFolders *WorkspaceFoldersOrNull `json:"workspaceFolders,omitzero"` } // Defines the capabilities provided by a language // server. type ServerCapabilities struct { // The position encoding the server picked from the encodings offered // by the client via the client capability `general.positionEncodings`. // // If the client didn't provide any position encodings the only valid // value that a server can return is 'utf-16'. // // If omitted it defaults to 'utf-16'. // // Since: 3.17.0 PositionEncoding *PositionEncodingKind `json:"positionEncoding,omitzero"` // Defines how text documents are synced. Is either a detailed structure // defining each notification or for backwards compatibility the // TextDocumentSyncKind number. TextDocumentSync *TextDocumentSyncOptionsOrKind `json:"textDocumentSync,omitzero"` // Defines how notebook documents are synced. // // Since: 3.17.0 NotebookDocumentSync *NotebookDocumentSyncOptionsOrRegistrationOptions `json:"notebookDocumentSync,omitzero"` // The server provides completion support. CompletionProvider *CompletionOptions `json:"completionProvider,omitzero"` // The server provides hover support. HoverProvider *BooleanOrHoverOptions `json:"hoverProvider,omitzero"` // The server provides signature help support. SignatureHelpProvider *SignatureHelpOptions `json:"signatureHelpProvider,omitzero"` // The server provides Goto Declaration support. DeclarationProvider *BooleanOrDeclarationOptionsOrDeclarationRegistrationOptions `json:"declarationProvider,omitzero"` // The server provides goto definition support. DefinitionProvider *BooleanOrDefinitionOptions `json:"definitionProvider,omitzero"` // The server provides Goto Type Definition support. TypeDefinitionProvider *BooleanOrTypeDefinitionOptionsOrTypeDefinitionRegistrationOptions `json:"typeDefinitionProvider,omitzero"` // The server provides Goto Implementation support. ImplementationProvider *BooleanOrImplementationOptionsOrImplementationRegistrationOptions `json:"implementationProvider,omitzero"` // The server provides find references support. ReferencesProvider *BooleanOrReferenceOptions `json:"referencesProvider,omitzero"` // The server provides document highlight support. DocumentHighlightProvider *BooleanOrDocumentHighlightOptions `json:"documentHighlightProvider,omitzero"` // The server provides document symbol support. DocumentSymbolProvider *BooleanOrDocumentSymbolOptions `json:"documentSymbolProvider,omitzero"` // The server provides code actions. CodeActionOptions may only be // specified if the client states that it supports // `codeActionLiteralSupport` in its initial `initialize` request. CodeActionProvider *BooleanOrCodeActionOptions `json:"codeActionProvider,omitzero"` // The server provides code lens. CodeLensProvider *CodeLensOptions `json:"codeLensProvider,omitzero"` // The server provides document link support. DocumentLinkProvider *DocumentLinkOptions `json:"documentLinkProvider,omitzero"` // The server provides color provider support. ColorProvider *BooleanOrDocumentColorOptionsOrDocumentColorRegistrationOptions `json:"colorProvider,omitzero"` // The server provides workspace symbol support. WorkspaceSymbolProvider *BooleanOrWorkspaceSymbolOptions `json:"workspaceSymbolProvider,omitzero"` // The server provides document formatting. DocumentFormattingProvider *BooleanOrDocumentFormattingOptions `json:"documentFormattingProvider,omitzero"` // The server provides document range formatting. DocumentRangeFormattingProvider *BooleanOrDocumentRangeFormattingOptions `json:"documentRangeFormattingProvider,omitzero"` // The server provides document formatting on typing. DocumentOnTypeFormattingProvider *DocumentOnTypeFormattingOptions `json:"documentOnTypeFormattingProvider,omitzero"` // The server provides rename support. RenameOptions may only be // specified if the client states that it supports // `prepareSupport` in its initial `initialize` request. RenameProvider *BooleanOrRenameOptions `json:"renameProvider,omitzero"` // The server provides folding provider support. FoldingRangeProvider *BooleanOrFoldingRangeOptionsOrFoldingRangeRegistrationOptions `json:"foldingRangeProvider,omitzero"` // The server provides selection range support. SelectionRangeProvider *BooleanOrSelectionRangeOptionsOrSelectionRangeRegistrationOptions `json:"selectionRangeProvider,omitzero"` // The server provides execute command support. ExecuteCommandProvider *ExecuteCommandOptions `json:"executeCommandProvider,omitzero"` // The server provides call hierarchy support. // // Since: 3.16.0 CallHierarchyProvider *BooleanOrCallHierarchyOptionsOrCallHierarchyRegistrationOptions `json:"callHierarchyProvider,omitzero"` // The server provides linked editing range support. // // Since: 3.16.0 LinkedEditingRangeProvider *BooleanOrLinkedEditingRangeOptionsOrLinkedEditingRangeRegistrationOptions `json:"linkedEditingRangeProvider,omitzero"` // The server provides semantic tokens support. // // Since: 3.16.0 SemanticTokensProvider *SemanticTokensOptionsOrRegistrationOptions `json:"semanticTokensProvider,omitzero"` // The server provides moniker support. // // Since: 3.16.0 MonikerProvider *BooleanOrMonikerOptionsOrMonikerRegistrationOptions `json:"monikerProvider,omitzero"` // The server provides type hierarchy support. // // Since: 3.17.0 TypeHierarchyProvider *BooleanOrTypeHierarchyOptionsOrTypeHierarchyRegistrationOptions `json:"typeHierarchyProvider,omitzero"` // The server provides inline values. // // Since: 3.17.0 InlineValueProvider *BooleanOrInlineValueOptionsOrInlineValueRegistrationOptions `json:"inlineValueProvider,omitzero"` // The server provides inlay hints. // // Since: 3.17.0 InlayHintProvider *BooleanOrInlayHintOptionsOrInlayHintRegistrationOptions `json:"inlayHintProvider,omitzero"` // The server has support for pull model diagnostics. // // Since: 3.17.0 DiagnosticProvider *DiagnosticOptionsOrRegistrationOptions `json:"diagnosticProvider,omitzero"` // Inline completion options used during static registration. // // Since: 3.18.0 // // Proposed. InlineCompletionProvider *BooleanOrInlineCompletionOptions `json:"inlineCompletionProvider,omitzero"` // Workspace specific server capabilities. Workspace *WorkspaceOptions `json:"workspace,omitzero"` // Experimental server capabilities. Experimental *any `json:"experimental,omitzero"` } // Information about the server // // Since: 3.15.0 // // Since: 3.18.0 ServerInfo type name added. type ServerInfo struct { // The name of the server as defined by the server. Name string `json:"name"` // The server's version as defined by the server. Version *string `json:"version,omitzero"` } var _ json.UnmarshalerFrom = (*ServerInfo)(nil) func (s *ServerInfo) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenName bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"name"`: seenName = true if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } case `"version"`: if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenName { return fmt.Errorf("required property 'name' is missing") } return nil } // A text document identifier to denote a specific version of a text document. type VersionedTextDocumentIdentifier struct { // The text document's uri. Uri DocumentUri `json:"uri"` // The version number of this document. Version int32 `json:"version"` } var _ json.UnmarshalerFrom = (*VersionedTextDocumentIdentifier)(nil) func (s *VersionedTextDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenUri bool seenVersion bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"version"`: seenVersion = true if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } if !seenVersion { return fmt.Errorf("required property 'version' is missing") } return nil } // Save options. type SaveOptions struct { // The client is supposed to include the content on save. IncludeText *bool `json:"includeText,omitzero"` } // An event describing a file change. type FileEvent struct { // The file's uri. Uri DocumentUri `json:"uri"` // The change type. Type FileChangeType `json:"type"` } var _ json.UnmarshalerFrom = (*FileEvent)(nil) func (s *FileEvent) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenUri bool seenType bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"type"`: seenType = true if err := json.UnmarshalDecode(dec, &s.Type); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } if !seenType { return fmt.Errorf("required property 'type' is missing") } return nil } type FileSystemWatcher struct { // The glob pattern to watch. See pattern for more detail. // // Since: 3.17.0 support for relative patterns. GlobPattern PatternOrRelativePattern `json:"globPattern"` // The kind of events of interest. If omitted it defaults // to WatchKind.Create | WatchKind.Change | WatchKind.Delete // which is 7. Kind *WatchKind `json:"kind,omitzero"` } var _ json.UnmarshalerFrom = (*FileSystemWatcher)(nil) func (s *FileSystemWatcher) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenGlobPattern bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"globPattern"`: seenGlobPattern = true if err := json.UnmarshalDecode(dec, &s.GlobPattern); err != nil { return err } case `"kind"`: if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenGlobPattern { return fmt.Errorf("required property 'globPattern' is missing") } return nil } // Represents a diagnostic, such as a compiler error or warning. Diagnostic objects // are only valid in the scope of a resource. type Diagnostic struct { // The range at which the message applies Range Range `json:"range"` // The diagnostic's severity. To avoid interpretation mismatches when a // server is used with different clients it is highly recommended that servers // always provide a severity value. Severity *DiagnosticSeverity `json:"severity,omitzero"` // The diagnostic's code, which usually appear in the user interface. Code *IntegerOrString `json:"code,omitzero"` // An optional property to describe the error code. // Requires the code field (above) to be present/not null. // // Since: 3.16.0 CodeDescription *CodeDescription `json:"codeDescription,omitzero"` // A human-readable string describing the source of this // diagnostic, e.g. 'typescript' or 'super lint'. It usually // appears in the user interface. Source *string `json:"source,omitzero"` // The diagnostic's message. It usually appears in the user interface Message string `json:"message"` // Additional metadata about the diagnostic. // // Since: 3.15.0 Tags *[]DiagnosticTag `json:"tags,omitzero"` // An array of related diagnostic information, e.g. when symbol-names within // a scope collide all definitions can be marked via this property. RelatedInformation *[]*DiagnosticRelatedInformation `json:"relatedInformation,omitzero"` // A data entry field that is preserved between a `textDocument/publishDiagnostics` // notification and `textDocument/codeAction` request. // // Since: 3.16.0 Data *any `json:"data,omitzero"` } var _ json.UnmarshalerFrom = (*Diagnostic)(nil) func (s *Diagnostic) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenRange bool seenMessage bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"severity"`: if err := json.UnmarshalDecode(dec, &s.Severity); err != nil { return err } case `"code"`: if err := json.UnmarshalDecode(dec, &s.Code); err != nil { return err } case `"codeDescription"`: if err := json.UnmarshalDecode(dec, &s.CodeDescription); err != nil { return err } case `"source"`: if err := json.UnmarshalDecode(dec, &s.Source); err != nil { return err } case `"message"`: seenMessage = true if err := json.UnmarshalDecode(dec, &s.Message); err != nil { return err } case `"tags"`: if err := json.UnmarshalDecode(dec, &s.Tags); err != nil { return err } case `"relatedInformation"`: if err := json.UnmarshalDecode(dec, &s.RelatedInformation); err != nil { return err } case `"data"`: if err := json.UnmarshalDecode(dec, &s.Data); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRange { return fmt.Errorf("required property 'range' is missing") } if !seenMessage { return fmt.Errorf("required property 'message' is missing") } return nil } // Contains additional information about the context in which a completion request is triggered. type CompletionContext struct { // How the completion was triggered. TriggerKind CompletionTriggerKind `json:"triggerKind"` // The trigger character (a single character) that has trigger code complete. // Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter` TriggerCharacter *string `json:"triggerCharacter,omitzero"` } var _ json.UnmarshalerFrom = (*CompletionContext)(nil) func (s *CompletionContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenTriggerKind bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"triggerKind"`: seenTriggerKind = true if err := json.UnmarshalDecode(dec, &s.TriggerKind); err != nil { return err } case `"triggerCharacter"`: if err := json.UnmarshalDecode(dec, &s.TriggerCharacter); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTriggerKind { return fmt.Errorf("required property 'triggerKind' is missing") } return nil } // Additional details for a completion item label. // // Since: 3.17.0 type CompletionItemLabelDetails struct { // An optional string which is rendered less prominently directly after label, // without any spacing. Should be used for function signatures and type annotations. Detail *string `json:"detail,omitzero"` // An optional string which is rendered less prominently after CompletionItem.detail. Should be used // for fully qualified names and file paths. Description *string `json:"description,omitzero"` } // A special text edit to provide an insert and a replace operation. // // Since: 3.16.0 type InsertReplaceEdit struct { // The string to be inserted. NewText string `json:"newText"` // The range if the insert is requested Insert Range `json:"insert"` // The range if the replace is requested. Replace Range `json:"replace"` } var _ json.UnmarshalerFrom = (*InsertReplaceEdit)(nil) func (s *InsertReplaceEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenNewText bool seenInsert bool seenReplace bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"newText"`: seenNewText = true if err := json.UnmarshalDecode(dec, &s.NewText); err != nil { return err } case `"insert"`: seenInsert = true if err := json.UnmarshalDecode(dec, &s.Insert); err != nil { return err } case `"replace"`: seenReplace = true if err := json.UnmarshalDecode(dec, &s.Replace); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenNewText { return fmt.Errorf("required property 'newText' is missing") } if !seenInsert { return fmt.Errorf("required property 'insert' is missing") } if !seenReplace { return fmt.Errorf("required property 'replace' is missing") } return nil } // In many cases the items of an actual completion result share the same // value for properties like `commitCharacters` or the range of a text // edit. A completion list can therefore define item defaults which will // be used if a completion item itself doesn't specify the value. // // If a completion list specifies a default value and a completion item // also specifies a corresponding value, the rules for combining these are // defined by `applyKinds` (if the client supports it), defaulting to // ApplyKind.Replace. // // Servers are only allowed to return default values if the client // signals support for this via the `completionList.itemDefaults` // capability. // // Since: 3.17.0 type CompletionItemDefaults struct { // A default commit character set. // // Since: 3.17.0 CommitCharacters *[]string `json:"commitCharacters,omitzero"` // A default edit range. // // Since: 3.17.0 EditRange *RangeOrEditRangeWithInsertReplace `json:"editRange,omitzero"` // A default insert text format. // // Since: 3.17.0 InsertTextFormat *InsertTextFormat `json:"insertTextFormat,omitzero"` // A default insert text mode. // // Since: 3.17.0 InsertTextMode *InsertTextMode `json:"insertTextMode,omitzero"` // A default data value. // // Since: 3.17.0 Data *any `json:"data,omitzero"` } // Specifies how fields from a completion item should be combined with those // from `completionList.itemDefaults`. // // If unspecified, all fields will be treated as ApplyKind.Replace. // // If a field's value is ApplyKind.Replace, the value from a completion item (if // provided and not `null`) will always be used instead of the value from // `completionItem.itemDefaults`. // // If a field's value is ApplyKind.Merge, the values will be merged using the rules // defined against each field below. // // Servers are only allowed to return `applyKind` if the client // signals support for this via the `completionList.applyKindSupport` // capability. // // Since: 3.18.0 type CompletionItemApplyKinds struct { // Specifies whether commitCharacters on a completion will replace or be // merged with those in `completionList.itemDefaults.commitCharacters`. // // If ApplyKind.Replace, the commit characters from the completion item will // always be used unless not provided, in which case those from // `completionList.itemDefaults.commitCharacters` will be used. An // empty list can be used if a completion item does not have any commit // characters and also should not use those from // `completionList.itemDefaults.commitCharacters`. // // If ApplyKind.Merge the commitCharacters for the completion will be the // union of all values in both `completionList.itemDefaults.commitCharacters` // and the completion's own `commitCharacters`. // // Since: 3.18.0 CommitCharacters *ApplyKind `json:"commitCharacters,omitzero"` // Specifies whether the `data` field on a completion will replace or // be merged with data from `completionList.itemDefaults.data`. // // If ApplyKind.Replace, the data from the completion item will be used if // provided (and not `null`), otherwise // `completionList.itemDefaults.data` will be used. An empty object can // be used if a completion item does not have any data but also should // not use the value from `completionList.itemDefaults.data`. // // If ApplyKind.Merge, a shallow merge will be performed between // `completionList.itemDefaults.data` and the completion's own data // using the following rules: // // - If a completion's `data` field is not provided (or `null`), the // entire `data` field from `completionList.itemDefaults.data` will be // used as-is. // - If a completion's `data` field is provided, each field will // overwrite the field of the same name in // `completionList.itemDefaults.data` but no merging of nested fields // within that value will occur. // // Since: 3.18.0 Data *ApplyKind `json:"data,omitzero"` } // Completion options. type CompletionOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // Most tools trigger completion request automatically without explicitly requesting // it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user // starts to type an identifier. For example if the user types `c` in a JavaScript file // code complete will automatically pop up present `console` besides others as a // completion item. Characters that make up identifiers don't need to be listed here. // // If code complete should automatically be trigger on characters not being valid inside // an identifier (for example `.` in JavaScript) list them in `triggerCharacters`. TriggerCharacters *[]string `json:"triggerCharacters,omitzero"` // The list of all possible characters that commit a completion. This field can be used // if clients don't support individual commit characters per completion item. See // `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport` // // If a server provides both `allCommitCharacters` and commit characters on an individual // completion item the ones on the completion item win. // // Since: 3.2.0 AllCommitCharacters *[]string `json:"allCommitCharacters,omitzero"` // The server provides support to resolve additional // information for a completion item. ResolveProvider *bool `json:"resolveProvider,omitzero"` // The server supports the following `CompletionItem` specific // capabilities. // // Since: 3.17.0 CompletionItem *ServerCompletionItemOptions `json:"completionItem,omitzero"` } // Hover options. type HoverOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } // Additional information about the context in which a signature help request was triggered. // // Since: 3.15.0 type SignatureHelpContext struct { // Action that caused signature help to be triggered. TriggerKind SignatureHelpTriggerKind `json:"triggerKind"` // Character that caused signature help to be triggered. // // This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter` TriggerCharacter *string `json:"triggerCharacter,omitzero"` // `true` if signature help was already showing when it was triggered. // // Retriggers occurs when the signature help is already active and can be caused by actions such as // typing a trigger character, a cursor move, or document content changes. IsRetrigger bool `json:"isRetrigger"` // The currently active `SignatureHelp`. // // The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on // the user navigating through available signatures. ActiveSignatureHelp *SignatureHelp `json:"activeSignatureHelp,omitzero"` } var _ json.UnmarshalerFrom = (*SignatureHelpContext)(nil) func (s *SignatureHelpContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTriggerKind bool seenIsRetrigger bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"triggerKind"`: seenTriggerKind = true if err := json.UnmarshalDecode(dec, &s.TriggerKind); err != nil { return err } case `"triggerCharacter"`: if err := json.UnmarshalDecode(dec, &s.TriggerCharacter); err != nil { return err } case `"isRetrigger"`: seenIsRetrigger = true if err := json.UnmarshalDecode(dec, &s.IsRetrigger); err != nil { return err } case `"activeSignatureHelp"`: if err := json.UnmarshalDecode(dec, &s.ActiveSignatureHelp); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTriggerKind { return fmt.Errorf("required property 'triggerKind' is missing") } if !seenIsRetrigger { return fmt.Errorf("required property 'isRetrigger' is missing") } return nil } // Represents the signature of something callable. A signature // can have a label, like a function-name, a doc-comment, and // a set of parameters. type SignatureInformation struct { // The label of this signature. Will be shown in // the UI. Label string `json:"label"` // The human-readable doc-comment of this signature. Will be shown // in the UI but can be omitted. Documentation *StringOrMarkupContent `json:"documentation,omitzero"` // The parameters of this signature. Parameters *[]*ParameterInformation `json:"parameters,omitzero"` // The index of the active parameter. // // If `null`, no parameter of the signature is active (for example a named // argument that does not match any declared parameters). This is only valid // if the client specifies the client capability // `textDocument.signatureHelp.noActiveParameterSupport === true` // // If provided (or `null`), this is used in place of // `SignatureHelp.activeParameter`. // // Since: 3.16.0 ActiveParameter *UintegerOrNull `json:"activeParameter,omitzero"` } var _ json.UnmarshalerFrom = (*SignatureInformation)(nil) func (s *SignatureInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenLabel bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"label"`: seenLabel = true if err := json.UnmarshalDecode(dec, &s.Label); err != nil { return err } case `"documentation"`: if err := json.UnmarshalDecode(dec, &s.Documentation); err != nil { return err } case `"parameters"`: if err := json.UnmarshalDecode(dec, &s.Parameters); err != nil { return err } case `"activeParameter"`: if err := json.UnmarshalDecode(dec, &s.ActiveParameter); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenLabel { return fmt.Errorf("required property 'label' is missing") } return nil } // Server Capabilities for a SignatureHelpRequest. type SignatureHelpOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // List of characters that trigger signature help automatically. TriggerCharacters *[]string `json:"triggerCharacters,omitzero"` // List of characters that re-trigger signature help. // // These trigger characters are only active when signature help is already showing. All trigger characters // are also counted as re-trigger characters. // // Since: 3.15.0 RetriggerCharacters *[]string `json:"retriggerCharacters,omitzero"` } // Server Capabilities for a DefinitionRequest. type DefinitionOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } // Value-object that contains additional information when // requesting references. type ReferenceContext struct { // Include the declaration of the current symbol. IncludeDeclaration bool `json:"includeDeclaration"` } var _ json.UnmarshalerFrom = (*ReferenceContext)(nil) func (s *ReferenceContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenIncludeDeclaration bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"includeDeclaration"`: seenIncludeDeclaration = true if err := json.UnmarshalDecode(dec, &s.IncludeDeclaration); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenIncludeDeclaration { return fmt.Errorf("required property 'includeDeclaration' is missing") } return nil } // Reference options. type ReferenceOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } // Provider options for a DocumentHighlightRequest. type DocumentHighlightOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } // A base for all symbol information. type BaseSymbolInformation struct { // The name of this symbol. Name string `json:"name"` // The kind of this symbol. Kind SymbolKind `json:"kind"` // Tags for this symbol. // // Since: 3.16.0 Tags *[]SymbolTag `json:"tags,omitzero"` // The name of the symbol containing this symbol. This information is for // user interface purposes (e.g. to render a qualifier in the user interface // if necessary). It can't be used to re-infer a hierarchy for the document // symbols. ContainerName *string `json:"containerName,omitzero"` } var _ json.UnmarshalerFrom = (*BaseSymbolInformation)(nil) func (s *BaseSymbolInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenName bool seenKind bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"name"`: seenName = true if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"tags"`: if err := json.UnmarshalDecode(dec, &s.Tags); err != nil { return err } case `"containerName"`: if err := json.UnmarshalDecode(dec, &s.ContainerName); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenName { return fmt.Errorf("required property 'name' is missing") } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } return nil } // Provider options for a DocumentSymbolRequest. type DocumentSymbolOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // A human-readable string that is shown when multiple outlines trees // are shown for the same document. // // Since: 3.16.0 Label *string `json:"label,omitzero"` } // Contains additional diagnostic information about the context in which // a action is run. type CodeActionContext struct { // An array of diagnostics known on the client side overlapping the range provided to the // `textDocument/codeAction` request. They are provided so that the server knows which // errors are currently presented to the user for the given range. There is no guarantee // that these accurately reflect the error state of the resource. The primary parameter // to compute code actions is the provided range. Diagnostics []*Diagnostic `json:"diagnostics"` // Requested kind of actions to return. // // Actions not of this kind are filtered out by the client before being shown. So servers // can omit computing them. Only *[]CodeActionKind `json:"only,omitzero"` // The reason why code actions were requested. // // Since: 3.17.0 TriggerKind *CodeActionTriggerKind `json:"triggerKind,omitzero"` } var _ json.UnmarshalerFrom = (*CodeActionContext)(nil) func (s *CodeActionContext) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDiagnostics bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"diagnostics"`: seenDiagnostics = true if err := json.UnmarshalDecode(dec, &s.Diagnostics); err != nil { return err } case `"only"`: if err := json.UnmarshalDecode(dec, &s.Only); err != nil { return err } case `"triggerKind"`: if err := json.UnmarshalDecode(dec, &s.TriggerKind); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDiagnostics { return fmt.Errorf("required property 'diagnostics' is missing") } return nil } // Captures why the code action is currently disabled. // // Since: 3.18.0 type CodeActionDisabled struct { // Human readable description of why the code action is currently disabled. // // This is displayed in the code actions UI. Reason string `json:"reason"` } var _ json.UnmarshalerFrom = (*CodeActionDisabled)(nil) func (s *CodeActionDisabled) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenReason bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"reason"`: seenReason = true if err := json.UnmarshalDecode(dec, &s.Reason); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenReason { return fmt.Errorf("required property 'reason' is missing") } return nil } // Provider options for a CodeActionRequest. type CodeActionOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // CodeActionKinds that this server may return. // // The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server // may list out every specific kind they provide. CodeActionKinds *[]CodeActionKind `json:"codeActionKinds,omitzero"` // Static documentation for a class of code actions. // // Documentation from the provider should be shown in the code actions menu if either: // // - Code actions of `kind` are requested by the editor. In this case, the editor will show the documentation that // most closely matches the requested code action kind. For example, if a provider has documentation for // both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`, // the editor will use the documentation for `RefactorExtract` instead of the documentation for `Refactor`. // // - Any code actions of `kind` are returned by the provider. // // At most one documentation entry should be shown per provider. // // Since: 3.18.0 // // Proposed. Documentation *[]*CodeActionKindDocumentation `json:"documentation,omitzero"` // The server provides support to resolve additional // information for a code action. // // Since: 3.16.0 ResolveProvider *bool `json:"resolveProvider,omitzero"` } // Location with only uri and does not include range. // // Since: 3.18.0 type LocationUriOnly struct { Uri DocumentUri `json:"uri"` } var _ json.UnmarshalerFrom = (*LocationUriOnly)(nil) func (s *LocationUriOnly) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenUri bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } return nil } // Server capabilities for a WorkspaceSymbolRequest. type WorkspaceSymbolOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // The server provides support to resolve additional // information for a workspace symbol. // // Since: 3.17.0 ResolveProvider *bool `json:"resolveProvider,omitzero"` } // Code Lens provider options of a CodeLensRequest. type CodeLensOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // Code lens has a resolve provider as well. ResolveProvider *bool `json:"resolveProvider,omitzero"` } // Provider options for a DocumentLinkRequest. type DocumentLinkOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // Document links have a resolve provider as well. ResolveProvider *bool `json:"resolveProvider,omitzero"` } // Value-object describing what options formatting should use. type FormattingOptions struct { // Size of a tab in spaces. TabSize uint32 `json:"tabSize"` // Prefer spaces over tabs. InsertSpaces bool `json:"insertSpaces"` // Trim trailing whitespace on a line. // // Since: 3.15.0 TrimTrailingWhitespace *bool `json:"trimTrailingWhitespace,omitzero"` // Insert a newline character at the end of the file if one does not exist. // // Since: 3.15.0 InsertFinalNewline *bool `json:"insertFinalNewline,omitzero"` // Trim all newlines after the final newline at the end of the file. // // Since: 3.15.0 TrimFinalNewlines *bool `json:"trimFinalNewlines,omitzero"` } var _ json.UnmarshalerFrom = (*FormattingOptions)(nil) func (s *FormattingOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTabSize bool seenInsertSpaces bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"tabSize"`: seenTabSize = true if err := json.UnmarshalDecode(dec, &s.TabSize); err != nil { return err } case `"insertSpaces"`: seenInsertSpaces = true if err := json.UnmarshalDecode(dec, &s.InsertSpaces); err != nil { return err } case `"trimTrailingWhitespace"`: if err := json.UnmarshalDecode(dec, &s.TrimTrailingWhitespace); err != nil { return err } case `"insertFinalNewline"`: if err := json.UnmarshalDecode(dec, &s.InsertFinalNewline); err != nil { return err } case `"trimFinalNewlines"`: if err := json.UnmarshalDecode(dec, &s.TrimFinalNewlines); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTabSize { return fmt.Errorf("required property 'tabSize' is missing") } if !seenInsertSpaces { return fmt.Errorf("required property 'insertSpaces' is missing") } return nil } // Provider options for a DocumentFormattingRequest. type DocumentFormattingOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` } // Provider options for a DocumentRangeFormattingRequest. type DocumentRangeFormattingOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // Whether the server supports formatting multiple ranges at once. // // Since: 3.18.0 // // Proposed. RangesSupport *bool `json:"rangesSupport,omitzero"` } // Provider options for a DocumentOnTypeFormattingRequest. type DocumentOnTypeFormattingOptions struct { // A character on which formatting should be triggered, like `{`. FirstTriggerCharacter string `json:"firstTriggerCharacter"` // More trigger characters. MoreTriggerCharacter *[]string `json:"moreTriggerCharacter,omitzero"` } var _ json.UnmarshalerFrom = (*DocumentOnTypeFormattingOptions)(nil) func (s *DocumentOnTypeFormattingOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenFirstTriggerCharacter bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"firstTriggerCharacter"`: seenFirstTriggerCharacter = true if err := json.UnmarshalDecode(dec, &s.FirstTriggerCharacter); err != nil { return err } case `"moreTriggerCharacter"`: if err := json.UnmarshalDecode(dec, &s.MoreTriggerCharacter); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenFirstTriggerCharacter { return fmt.Errorf("required property 'firstTriggerCharacter' is missing") } return nil } // Provider options for a RenameRequest. type RenameOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // Renames should be checked and tested before being executed. // // Since: version 3.12.0 PrepareProvider *bool `json:"prepareProvider,omitzero"` } // Since: 3.18.0 type PrepareRenamePlaceholder struct { Range Range `json:"range"` Placeholder string `json:"placeholder"` } var _ json.UnmarshalerFrom = (*PrepareRenamePlaceholder)(nil) func (s *PrepareRenamePlaceholder) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenRange bool seenPlaceholder bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"placeholder"`: seenPlaceholder = true if err := json.UnmarshalDecode(dec, &s.Placeholder); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRange { return fmt.Errorf("required property 'range' is missing") } if !seenPlaceholder { return fmt.Errorf("required property 'placeholder' is missing") } return nil } // Since: 3.18.0 type PrepareRenameDefaultBehavior struct { DefaultBehavior bool `json:"defaultBehavior"` } var _ json.UnmarshalerFrom = (*PrepareRenameDefaultBehavior)(nil) func (s *PrepareRenameDefaultBehavior) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenDefaultBehavior bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"defaultBehavior"`: seenDefaultBehavior = true if err := json.UnmarshalDecode(dec, &s.DefaultBehavior); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDefaultBehavior { return fmt.Errorf("required property 'defaultBehavior' is missing") } return nil } // The server capabilities of a ExecuteCommandRequest. type ExecuteCommandOptions struct { WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // The commands to be executed on the server Commands []string `json:"commands"` } var _ json.UnmarshalerFrom = (*ExecuteCommandOptions)(nil) func (s *ExecuteCommandOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenCommands bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"workDoneProgress"`: if err := json.UnmarshalDecode(dec, &s.WorkDoneProgress); err != nil { return err } case `"commands"`: seenCommands = true if err := json.UnmarshalDecode(dec, &s.Commands); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenCommands { return fmt.Errorf("required property 'commands' is missing") } return nil } // Additional data about a workspace edit. // // Since: 3.18.0 // // Proposed. type WorkspaceEditMetadata struct { // Signal to the editor that this edit is a refactoring. IsRefactoring *bool `json:"isRefactoring,omitzero"` } // Since: 3.16.0 type SemanticTokensLegend struct { // The token types a server uses. TokenTypes []string `json:"tokenTypes"` // The token modifiers a server uses. TokenModifiers []string `json:"tokenModifiers"` } var _ json.UnmarshalerFrom = (*SemanticTokensLegend)(nil) func (s *SemanticTokensLegend) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenTokenTypes bool seenTokenModifiers bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"tokenTypes"`: seenTokenTypes = true if err := json.UnmarshalDecode(dec, &s.TokenTypes); err != nil { return err } case `"tokenModifiers"`: seenTokenModifiers = true if err := json.UnmarshalDecode(dec, &s.TokenModifiers); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenTokenTypes { return fmt.Errorf("required property 'tokenTypes' is missing") } if !seenTokenModifiers { return fmt.Errorf("required property 'tokenModifiers' is missing") } return nil } // Semantic tokens options to support deltas for full documents // // Since: 3.18.0 type SemanticTokensFullDelta struct { // The server supports deltas for full documents. Delta *bool `json:"delta,omitzero"` } // A text document identifier to optionally denote a specific version of a text document. type OptionalVersionedTextDocumentIdentifier struct { // The text document's uri. Uri DocumentUri `json:"uri"` // The version number of this document. If a versioned text document identifier // is sent from the server to the client and the file is not open in the editor // (the server has not received an open notification before) the server can send // `null` to indicate that the version is unknown and the content on disk is the // truth (as specified with document content ownership). Version IntegerOrNull `json:"version"` } var _ json.UnmarshalerFrom = (*OptionalVersionedTextDocumentIdentifier)(nil) func (s *OptionalVersionedTextDocumentIdentifier) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenUri bool seenVersion bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"version"`: seenVersion = true if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } if !seenVersion { return fmt.Errorf("required property 'version' is missing") } return nil } // A special text edit with an additional change annotation. // // Since: 3.16.0. type AnnotatedTextEdit struct { // The range of the text document to be manipulated. To insert // text into a document create a range where start === end. Range Range `json:"range"` // The string to be inserted. For delete operations use an // empty string. NewText string `json:"newText"` // The actual identifier of the change annotation AnnotationId string `json:"annotationId"` } var _ json.UnmarshalerFrom = (*AnnotatedTextEdit)(nil) func (s *AnnotatedTextEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenRange bool seenNewText bool seenAnnotationId bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"newText"`: seenNewText = true if err := json.UnmarshalDecode(dec, &s.NewText); err != nil { return err } case `"annotationId"`: seenAnnotationId = true if err := json.UnmarshalDecode(dec, &s.AnnotationId); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRange { return fmt.Errorf("required property 'range' is missing") } if !seenNewText { return fmt.Errorf("required property 'newText' is missing") } if !seenAnnotationId { return fmt.Errorf("required property 'annotationId' is missing") } return nil } // An interactive text edit. // // Since: 3.18.0 // // Proposed. type SnippetTextEdit struct { // The range of the text document to be manipulated. Range Range `json:"range"` // The snippet to be inserted. Snippet *StringValue `json:"snippet"` // The actual identifier of the snippet edit. AnnotationId *string `json:"annotationId,omitzero"` } var _ json.UnmarshalerFrom = (*SnippetTextEdit)(nil) func (s *SnippetTextEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenRange bool seenSnippet bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"snippet"`: seenSnippet = true if err := json.UnmarshalDecode(dec, &s.Snippet); err != nil { return err } case `"annotationId"`: if err := json.UnmarshalDecode(dec, &s.AnnotationId); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRange { return fmt.Errorf("required property 'range' is missing") } if !seenSnippet { return fmt.Errorf("required property 'snippet' is missing") } return nil } // A generic resource operation. type ResourceOperation struct { // The resource operation kind. Kind string `json:"kind"` // An optional annotation identifier describing the operation. // // Since: 3.16.0 AnnotationId *string `json:"annotationId,omitzero"` } var _ json.UnmarshalerFrom = (*ResourceOperation)(nil) func (s *ResourceOperation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenKind bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"annotationId"`: if err := json.UnmarshalDecode(dec, &s.AnnotationId); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } return nil } // Options to create a file. type CreateFileOptions struct { // Overwrite existing file. Overwrite wins over `ignoreIfExists` Overwrite *bool `json:"overwrite,omitzero"` // Ignore if exists. IgnoreIfExists *bool `json:"ignoreIfExists,omitzero"` } // Rename file options type RenameFileOptions struct { // Overwrite target if existing. Overwrite wins over `ignoreIfExists` Overwrite *bool `json:"overwrite,omitzero"` // Ignores if target exists. IgnoreIfExists *bool `json:"ignoreIfExists,omitzero"` } // Delete file options type DeleteFileOptions struct { // Delete the content recursively if a folder is denoted. Recursive *bool `json:"recursive,omitzero"` // Ignore the operation if the file doesn't exist. IgnoreIfNotExists *bool `json:"ignoreIfNotExists,omitzero"` } // A pattern to describe in which file operation requests or notifications // the server is interested in receiving. // // Since: 3.16.0 type FileOperationPattern struct { // The glob pattern to match. Glob patterns can have the following syntax: // - `*` to match one or more characters in a path segment // - `?` to match on one character in a path segment // - `**` to match any number of path segments, including none // - `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files) // - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) // - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`) Glob string `json:"glob"` // Whether to match files or folders with this pattern. // // Matches both if undefined. Matches *FileOperationPatternKind `json:"matches,omitzero"` // Additional options used during matching. Options *FileOperationPatternOptions `json:"options,omitzero"` } var _ json.UnmarshalerFrom = (*FileOperationPattern)(nil) func (s *FileOperationPattern) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenGlob bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"glob"`: seenGlob = true if err := json.UnmarshalDecode(dec, &s.Glob); err != nil { return err } case `"matches"`: if err := json.UnmarshalDecode(dec, &s.Matches); err != nil { return err } case `"options"`: if err := json.UnmarshalDecode(dec, &s.Options); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenGlob { return fmt.Errorf("required property 'glob' is missing") } return nil } // A full document diagnostic report for a workspace diagnostic result. // // Since: 3.17.0 type WorkspaceFullDocumentDiagnosticReport struct { // A full document diagnostic report. Kind StringLiteralFull `json:"kind"` // An optional result id. If provided it will // be sent on the next diagnostic request for the // same document. ResultId *string `json:"resultId,omitzero"` // The actual items. Items []*Diagnostic `json:"items"` // The URI for which diagnostic information is reported. Uri DocumentUri `json:"uri"` // The version number for which the diagnostics are reported. // If the document is not marked as open `null` can be provided. Version IntegerOrNull `json:"version"` } var _ json.UnmarshalerFrom = (*WorkspaceFullDocumentDiagnosticReport)(nil) func (s *WorkspaceFullDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenKind bool seenItems bool seenUri bool seenVersion bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"resultId"`: if err := json.UnmarshalDecode(dec, &s.ResultId); err != nil { return err } case `"items"`: seenItems = true if err := json.UnmarshalDecode(dec, &s.Items); err != nil { return err } case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"version"`: seenVersion = true if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenItems { return fmt.Errorf("required property 'items' is missing") } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } if !seenVersion { return fmt.Errorf("required property 'version' is missing") } return nil } // An unchanged document diagnostic report for a workspace diagnostic result. // // Since: 3.17.0 type WorkspaceUnchangedDocumentDiagnosticReport struct { // A document diagnostic report indicating // no changes to the last result. A server can // only return `unchanged` if result ids are // provided. Kind StringLiteralUnchanged `json:"kind"` // A result id which will be sent on the next // diagnostic request for the same document. ResultId string `json:"resultId"` // The URI for which diagnostic information is reported. Uri DocumentUri `json:"uri"` // The version number for which the diagnostics are reported. // If the document is not marked as open `null` can be provided. Version IntegerOrNull `json:"version"` } var _ json.UnmarshalerFrom = (*WorkspaceUnchangedDocumentDiagnosticReport)(nil) func (s *WorkspaceUnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenKind bool seenResultId bool seenUri bool seenVersion bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"resultId"`: seenResultId = true if err := json.UnmarshalDecode(dec, &s.ResultId); err != nil { return err } case `"uri"`: seenUri = true if err := json.UnmarshalDecode(dec, &s.Uri); err != nil { return err } case `"version"`: seenVersion = true if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenResultId { return fmt.Errorf("required property 'resultId' is missing") } if !seenUri { return fmt.Errorf("required property 'uri' is missing") } if !seenVersion { return fmt.Errorf("required property 'version' is missing") } return nil } // A notebook cell. // // A cell's document URI must be unique across ALL notebook // cells and can therefore be used to uniquely identify a // notebook cell or the cell's text document. // // Since: 3.17.0 type NotebookCell struct { // The cell's kind Kind NotebookCellKind `json:"kind"` // The URI of the cell's text document // content. Document DocumentUri `json:"document"` // Additional metadata stored with the cell. // // Note: should always be an object literal (e.g. LSPObject) Metadata *map[string]any `json:"metadata,omitzero"` // Additional execution summary information // if supported by the client. ExecutionSummary *ExecutionSummary `json:"executionSummary,omitzero"` } var _ json.UnmarshalerFrom = (*NotebookCell)(nil) func (s *NotebookCell) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenKind bool seenDocument bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"document"`: seenDocument = true if err := json.UnmarshalDecode(dec, &s.Document); err != nil { return err } case `"metadata"`: if err := json.UnmarshalDecode(dec, &s.Metadata); err != nil { return err } case `"executionSummary"`: if err := json.UnmarshalDecode(dec, &s.ExecutionSummary); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenDocument { return fmt.Errorf("required property 'document' is missing") } return nil } // Since: 3.18.0 type NotebookDocumentFilterWithNotebook struct { // The notebook to be synced If a string // value is provided it matches against the // notebook type. '*' matches every notebook. Notebook StringOrNotebookDocumentFilterNotebookTypeOrNotebookDocumentFilterSchemeOrNotebookDocumentFilterPattern `json:"notebook"` // The cells of the matching notebook to be synced. Cells *[]*NotebookCellLanguage `json:"cells,omitzero"` } var _ json.UnmarshalerFrom = (*NotebookDocumentFilterWithNotebook)(nil) func (s *NotebookDocumentFilterWithNotebook) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenNotebook bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"notebook"`: seenNotebook = true if err := json.UnmarshalDecode(dec, &s.Notebook); err != nil { return err } case `"cells"`: if err := json.UnmarshalDecode(dec, &s.Cells); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenNotebook { return fmt.Errorf("required property 'notebook' is missing") } return nil } // Since: 3.18.0 type NotebookDocumentFilterWithCells struct { // The notebook to be synced If a string // value is provided it matches against the // notebook type. '*' matches every notebook. Notebook *StringOrNotebookDocumentFilterNotebookTypeOrNotebookDocumentFilterSchemeOrNotebookDocumentFilterPattern `json:"notebook,omitzero"` // The cells of the matching notebook to be synced. Cells []*NotebookCellLanguage `json:"cells"` } var _ json.UnmarshalerFrom = (*NotebookDocumentFilterWithCells)(nil) func (s *NotebookDocumentFilterWithCells) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenCells bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"notebook"`: if err := json.UnmarshalDecode(dec, &s.Notebook); err != nil { return err } case `"cells"`: seenCells = true if err := json.UnmarshalDecode(dec, &s.Cells); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenCells { return fmt.Errorf("required property 'cells' is missing") } return nil } // Cell changes to a notebook document. // // Since: 3.18.0 type NotebookDocumentCellChanges struct { // Changes to the cell structure to add or // remove cells. Structure *NotebookDocumentCellChangeStructure `json:"structure,omitzero"` // Changes to notebook cells properties like its // kind, execution summary or metadata. Data *[]*NotebookCell `json:"data,omitzero"` // Changes to the text content of notebook cells. TextContent *[]*NotebookDocumentCellContentChanges `json:"textContent,omitzero"` } // Describes the currently selected completion item. // // Since: 3.18.0 // // Proposed. type SelectedCompletionInfo struct { // The range that will be replaced if this completion item is accepted. Range Range `json:"range"` // The text the range will be replaced with if this completion is accepted. Text string `json:"text"` } var _ json.UnmarshalerFrom = (*SelectedCompletionInfo)(nil) func (s *SelectedCompletionInfo) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenRange bool seenText bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"text"`: seenText = true if err := json.UnmarshalDecode(dec, &s.Text); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRange { return fmt.Errorf("required property 'range' is missing") } if !seenText { return fmt.Errorf("required property 'text' is missing") } return nil } // Information about the client // // Since: 3.15.0 // // Since: 3.18.0 ClientInfo type name added. type ClientInfo struct { // The name of the client as defined by the client. Name string `json:"name"` // The client's version as defined by the client. Version *string `json:"version,omitzero"` } var _ json.UnmarshalerFrom = (*ClientInfo)(nil) func (s *ClientInfo) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenName bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"name"`: seenName = true if err := json.UnmarshalDecode(dec, &s.Name); err != nil { return err } case `"version"`: if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenName { return fmt.Errorf("required property 'name' is missing") } return nil } // Defines the capabilities provided by the client. type ClientCapabilities struct { // Workspace specific client capabilities. Workspace *WorkspaceClientCapabilities `json:"workspace,omitzero"` // Text document specific client capabilities. TextDocument *TextDocumentClientCapabilities `json:"textDocument,omitzero"` // Capabilities specific to the notebook document support. // // Since: 3.17.0 NotebookDocument *NotebookDocumentClientCapabilities `json:"notebookDocument,omitzero"` // Window specific client capabilities. Window *WindowClientCapabilities `json:"window,omitzero"` // General client capabilities. // // Since: 3.16.0 General *GeneralClientCapabilities `json:"general,omitzero"` // Experimental client capabilities. Experimental *any `json:"experimental,omitzero"` } type TextDocumentSyncOptions struct { // Open and close notifications are sent to the server. If omitted open close notification should not // be sent. OpenClose *bool `json:"openClose,omitzero"` // Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full // and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None. Change *TextDocumentSyncKind `json:"change,omitzero"` // If present will save notifications are sent to the server. If omitted the notification should not be // sent. WillSave *bool `json:"willSave,omitzero"` // If present will save wait until requests are sent to the server. If omitted the request should not be // sent. WillSaveWaitUntil *bool `json:"willSaveWaitUntil,omitzero"` // If present save notifications are sent to the server. If omitted the notification should not be // sent. Save *BooleanOrSaveOptions `json:"save,omitzero"` } // Defines workspace specific capabilities of the server. // // Since: 3.18.0 type WorkspaceOptions struct { // The server supports workspace folder. // // Since: 3.6.0 WorkspaceFolders *WorkspaceFoldersServerCapabilities `json:"workspaceFolders,omitzero"` // The server is interested in notifications/requests for operations on files. // // Since: 3.16.0 FileOperations *FileOperationOptions `json:"fileOperations,omitzero"` // The server supports the `workspace/textDocumentContent` request. // // Since: 3.18.0 // // Proposed. TextDocumentContent *TextDocumentContentOptionsOrRegistrationOptions `json:"textDocumentContent,omitzero"` } // Since: 3.18.0 type TextDocumentContentChangePartial struct { // The range of the document that changed. Range Range `json:"range"` // The optional length of the range that got replaced. // // Deprecated: use range instead. RangeLength *uint32 `json:"rangeLength,omitzero"` // The new text for the provided range. Text string `json:"text"` } var _ json.UnmarshalerFrom = (*TextDocumentContentChangePartial)(nil) func (s *TextDocumentContentChangePartial) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenRange bool seenText bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"range"`: seenRange = true if err := json.UnmarshalDecode(dec, &s.Range); err != nil { return err } case `"rangeLength"`: if err := json.UnmarshalDecode(dec, &s.RangeLength); err != nil { return err } case `"text"`: seenText = true if err := json.UnmarshalDecode(dec, &s.Text); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRange { return fmt.Errorf("required property 'range' is missing") } if !seenText { return fmt.Errorf("required property 'text' is missing") } return nil } // Since: 3.18.0 type TextDocumentContentChangeWholeDocument struct { // The new text of the whole document. Text string `json:"text"` } var _ json.UnmarshalerFrom = (*TextDocumentContentChangeWholeDocument)(nil) func (s *TextDocumentContentChangeWholeDocument) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenText bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"text"`: seenText = true if err := json.UnmarshalDecode(dec, &s.Text); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenText { return fmt.Errorf("required property 'text' is missing") } return nil } // Structure to capture a description for an error code. // // Since: 3.16.0 type CodeDescription struct { // An URI to open with more information about the diagnostic error. Href URI `json:"href"` } var _ json.UnmarshalerFrom = (*CodeDescription)(nil) func (s *CodeDescription) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenHref bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"href"`: seenHref = true if err := json.UnmarshalDecode(dec, &s.Href); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenHref { return fmt.Errorf("required property 'href' is missing") } return nil } // Represents a related message and source code location for a diagnostic. This should be // used to point to code locations that cause or related to a diagnostics, e.g when duplicating // a symbol in a scope. type DiagnosticRelatedInformation struct { // The location of this related diagnostic information. Location Location `json:"location"` // The message of this related diagnostic information. Message string `json:"message"` } var _ json.UnmarshalerFrom = (*DiagnosticRelatedInformation)(nil) func (s *DiagnosticRelatedInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenLocation bool seenMessage bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"location"`: seenLocation = true if err := json.UnmarshalDecode(dec, &s.Location); err != nil { return err } case `"message"`: seenMessage = true if err := json.UnmarshalDecode(dec, &s.Message); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenLocation { return fmt.Errorf("required property 'location' is missing") } if !seenMessage { return fmt.Errorf("required property 'message' is missing") } return nil } // Edit range variant that includes ranges for insert and replace operations. // // Since: 3.18.0 type EditRangeWithInsertReplace struct { Insert Range `json:"insert"` Replace Range `json:"replace"` } var _ json.UnmarshalerFrom = (*EditRangeWithInsertReplace)(nil) func (s *EditRangeWithInsertReplace) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenInsert bool seenReplace bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"insert"`: seenInsert = true if err := json.UnmarshalDecode(dec, &s.Insert); err != nil { return err } case `"replace"`: seenReplace = true if err := json.UnmarshalDecode(dec, &s.Replace); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenInsert { return fmt.Errorf("required property 'insert' is missing") } if !seenReplace { return fmt.Errorf("required property 'replace' is missing") } return nil } // Since: 3.18.0 type ServerCompletionItemOptions struct { // The server has support for completion item label // details (see also `CompletionItemLabelDetails`) when // receiving a completion item in a resolve call. // // Since: 3.17.0 LabelDetailsSupport *bool `json:"labelDetailsSupport,omitzero"` } // Since: 3.18.0 // // Deprecated: use MarkupContent instead. type MarkedStringWithLanguage struct { Language string `json:"language"` Value string `json:"value"` } var _ json.UnmarshalerFrom = (*MarkedStringWithLanguage)(nil) func (s *MarkedStringWithLanguage) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenLanguage bool seenValue bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"language"`: seenLanguage = true if err := json.UnmarshalDecode(dec, &s.Language); err != nil { return err } case `"value"`: seenValue = true if err := json.UnmarshalDecode(dec, &s.Value); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenLanguage { return fmt.Errorf("required property 'language' is missing") } if !seenValue { return fmt.Errorf("required property 'value' is missing") } return nil } // Represents a parameter of a callable-signature. A parameter can // have a label and a doc-comment. type ParameterInformation struct { // The label of this parameter information. // // Either a string or an inclusive start and exclusive end offsets within its containing // signature label. (see SignatureInformation.label). The offsets are based on a UTF-16 // string representation as `Position` and `Range` does. // // To avoid ambiguities a server should use the [start, end] offset value instead of using // a substring. Whether a client support this is controlled via `labelOffsetSupport` client // capability. // // *Note*: a label of type string should be a substring of its containing signature label. // Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`. Label StringOrTuple `json:"label"` // The human-readable doc-comment of this parameter. Will be shown // in the UI but can be omitted. Documentation *StringOrMarkupContent `json:"documentation,omitzero"` } var _ json.UnmarshalerFrom = (*ParameterInformation)(nil) func (s *ParameterInformation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenLabel bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"label"`: seenLabel = true if err := json.UnmarshalDecode(dec, &s.Label); err != nil { return err } case `"documentation"`: if err := json.UnmarshalDecode(dec, &s.Documentation); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenLabel { return fmt.Errorf("required property 'label' is missing") } return nil } // Documentation for a class of code actions. // // Since: 3.18.0 // // Proposed. type CodeActionKindDocumentation struct { // The kind of the code action being documented. // // If the kind is generic, such as `CodeActionKind.Refactor`, the documentation will be shown whenever any // refactorings are returned. If the kind if more specific, such as `CodeActionKind.RefactorExtract`, the // documentation will only be shown when extract refactoring code actions are returned. Kind CodeActionKind `json:"kind"` // Command that is ued to display the documentation to the user. // // The title of this documentation code action is taken from Command.title Command *Command `json:"command"` } var _ json.UnmarshalerFrom = (*CodeActionKindDocumentation)(nil) func (s *CodeActionKindDocumentation) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenKind bool seenCommand bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"kind"`: seenKind = true if err := json.UnmarshalDecode(dec, &s.Kind); err != nil { return err } case `"command"`: seenCommand = true if err := json.UnmarshalDecode(dec, &s.Command); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenKind { return fmt.Errorf("required property 'kind' is missing") } if !seenCommand { return fmt.Errorf("required property 'command' is missing") } return nil } // A notebook cell text document filter denotes a cell text // document by different properties. // // Since: 3.17.0 type NotebookCellTextDocumentFilter struct { // A filter that matches against the notebook // containing the notebook cell. If a string // value is provided it matches against the // notebook type. '*' matches every notebook. Notebook StringOrNotebookDocumentFilterNotebookTypeOrNotebookDocumentFilterSchemeOrNotebookDocumentFilterPattern `json:"notebook"` // A language id like `python`. // // Will be matched against the language id of the // notebook cell document. '*' matches every language. Language *string `json:"language,omitzero"` } var _ json.UnmarshalerFrom = (*NotebookCellTextDocumentFilter)(nil) func (s *NotebookCellTextDocumentFilter) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenNotebook bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"notebook"`: seenNotebook = true if err := json.UnmarshalDecode(dec, &s.Notebook); err != nil { return err } case `"language"`: if err := json.UnmarshalDecode(dec, &s.Language); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenNotebook { return fmt.Errorf("required property 'notebook' is missing") } return nil } // Matching options for the file operation pattern. // // Since: 3.16.0 type FileOperationPatternOptions struct { // The pattern should be matched ignoring casing. IgnoreCase *bool `json:"ignoreCase,omitzero"` } type ExecutionSummary struct { // A strict monotonically increasing value // indicating the execution order of a cell // inside a notebook. ExecutionOrder uint32 `json:"executionOrder"` // Whether the execution was successful or // not if known by the client. Success *bool `json:"success,omitzero"` } var _ json.UnmarshalerFrom = (*ExecutionSummary)(nil) func (s *ExecutionSummary) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenExecutionOrder bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"executionOrder"`: seenExecutionOrder = true if err := json.UnmarshalDecode(dec, &s.ExecutionOrder); err != nil { return err } case `"success"`: if err := json.UnmarshalDecode(dec, &s.Success); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenExecutionOrder { return fmt.Errorf("required property 'executionOrder' is missing") } return nil } // Since: 3.18.0 type NotebookCellLanguage struct { Language string `json:"language"` } var _ json.UnmarshalerFrom = (*NotebookCellLanguage)(nil) func (s *NotebookCellLanguage) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenLanguage bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"language"`: seenLanguage = true if err := json.UnmarshalDecode(dec, &s.Language); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenLanguage { return fmt.Errorf("required property 'language' is missing") } return nil } // Structural changes to cells in a notebook document. // // Since: 3.18.0 type NotebookDocumentCellChangeStructure struct { // The change to the cell array. Array *NotebookCellArrayChange `json:"array"` // Additional opened cell text documents. DidOpen *[]*TextDocumentItem `json:"didOpen,omitzero"` // Additional closed cell text documents. DidClose *[]TextDocumentIdentifier `json:"didClose,omitzero"` } var _ json.UnmarshalerFrom = (*NotebookDocumentCellChangeStructure)(nil) func (s *NotebookDocumentCellChangeStructure) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenArray bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"array"`: seenArray = true if err := json.UnmarshalDecode(dec, &s.Array); err != nil { return err } case `"didOpen"`: if err := json.UnmarshalDecode(dec, &s.DidOpen); err != nil { return err } case `"didClose"`: if err := json.UnmarshalDecode(dec, &s.DidClose); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenArray { return fmt.Errorf("required property 'array' is missing") } return nil } // Content changes to a cell in a notebook document. // // Since: 3.18.0 type NotebookDocumentCellContentChanges struct { Document VersionedTextDocumentIdentifier `json:"document"` Changes []TextDocumentContentChangePartialOrWholeDocument `json:"changes"` } var _ json.UnmarshalerFrom = (*NotebookDocumentCellContentChanges)(nil) func (s *NotebookDocumentCellContentChanges) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenDocument bool seenChanges bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"document"`: seenDocument = true if err := json.UnmarshalDecode(dec, &s.Document); err != nil { return err } case `"changes"`: seenChanges = true if err := json.UnmarshalDecode(dec, &s.Changes); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenDocument { return fmt.Errorf("required property 'document' is missing") } if !seenChanges { return fmt.Errorf("required property 'changes' is missing") } return nil } // Workspace specific client capabilities. type WorkspaceClientCapabilities struct { // The client supports applying batch edits // to the workspace by supporting the request // 'workspace/applyEdit' ApplyEdit *bool `json:"applyEdit,omitzero"` // Capabilities specific to `WorkspaceEdit`s. WorkspaceEdit *WorkspaceEditClientCapabilities `json:"workspaceEdit,omitzero"` // Capabilities specific to the `workspace/didChangeConfiguration` notification. DidChangeConfiguration *DidChangeConfigurationClientCapabilities `json:"didChangeConfiguration,omitzero"` // Capabilities specific to the `workspace/didChangeWatchedFiles` notification. DidChangeWatchedFiles *DidChangeWatchedFilesClientCapabilities `json:"didChangeWatchedFiles,omitzero"` // Capabilities specific to the `workspace/symbol` request. Symbol *WorkspaceSymbolClientCapabilities `json:"symbol,omitzero"` // Capabilities specific to the `workspace/executeCommand` request. ExecuteCommand *ExecuteCommandClientCapabilities `json:"executeCommand,omitzero"` // The client has support for workspace folders. // // Since: 3.6.0 WorkspaceFolders *bool `json:"workspaceFolders,omitzero"` // The client supports `workspace/configuration` requests. // // Since: 3.6.0 Configuration *bool `json:"configuration,omitzero"` // Capabilities specific to the semantic token requests scoped to the // workspace. // // Since: 3.16.0. SemanticTokens *SemanticTokensWorkspaceClientCapabilities `json:"semanticTokens,omitzero"` // Capabilities specific to the code lens requests scoped to the // workspace. // // Since: 3.16.0. CodeLens *CodeLensWorkspaceClientCapabilities `json:"codeLens,omitzero"` // The client has support for file notifications/requests for user operations on files. // // Since 3.16.0 FileOperations *FileOperationClientCapabilities `json:"fileOperations,omitzero"` // Capabilities specific to the inline values requests scoped to the // workspace. // // Since: 3.17.0. InlineValue *InlineValueWorkspaceClientCapabilities `json:"inlineValue,omitzero"` // Capabilities specific to the inlay hint requests scoped to the // workspace. // // Since: 3.17.0. InlayHint *InlayHintWorkspaceClientCapabilities `json:"inlayHint,omitzero"` // Capabilities specific to the diagnostic requests scoped to the // workspace. // // Since: 3.17.0. Diagnostics *DiagnosticWorkspaceClientCapabilities `json:"diagnostics,omitzero"` // Capabilities specific to the folding range requests scoped to the workspace. // // Since: 3.18.0 // // Proposed. FoldingRange *FoldingRangeWorkspaceClientCapabilities `json:"foldingRange,omitzero"` // Capabilities specific to the `workspace/textDocumentContent` request. // // Since: 3.18.0 // // Proposed. TextDocumentContent *TextDocumentContentClientCapabilities `json:"textDocumentContent,omitzero"` } // Text document specific client capabilities. type TextDocumentClientCapabilities struct { // Defines which synchronization capabilities the client supports. Synchronization *TextDocumentSyncClientCapabilities `json:"synchronization,omitzero"` // Defines which filters the client supports. // // Since: 3.18.0 Filters *TextDocumentFilterClientCapabilities `json:"filters,omitzero"` // Capabilities specific to the `textDocument/completion` request. Completion *CompletionClientCapabilities `json:"completion,omitzero"` // Capabilities specific to the `textDocument/hover` request. Hover *HoverClientCapabilities `json:"hover,omitzero"` // Capabilities specific to the `textDocument/signatureHelp` request. SignatureHelp *SignatureHelpClientCapabilities `json:"signatureHelp,omitzero"` // Capabilities specific to the `textDocument/declaration` request. // // Since: 3.14.0 Declaration *DeclarationClientCapabilities `json:"declaration,omitzero"` // Capabilities specific to the `textDocument/definition` request. Definition *DefinitionClientCapabilities `json:"definition,omitzero"` // Capabilities specific to the `textDocument/typeDefinition` request. // // Since: 3.6.0 TypeDefinition *TypeDefinitionClientCapabilities `json:"typeDefinition,omitzero"` // Capabilities specific to the `textDocument/implementation` request. // // Since: 3.6.0 Implementation *ImplementationClientCapabilities `json:"implementation,omitzero"` // Capabilities specific to the `textDocument/references` request. References *ReferenceClientCapabilities `json:"references,omitzero"` // Capabilities specific to the `textDocument/documentHighlight` request. DocumentHighlight *DocumentHighlightClientCapabilities `json:"documentHighlight,omitzero"` // Capabilities specific to the `textDocument/documentSymbol` request. DocumentSymbol *DocumentSymbolClientCapabilities `json:"documentSymbol,omitzero"` // Capabilities specific to the `textDocument/codeAction` request. CodeAction *CodeActionClientCapabilities `json:"codeAction,omitzero"` // Capabilities specific to the `textDocument/codeLens` request. CodeLens *CodeLensClientCapabilities `json:"codeLens,omitzero"` // Capabilities specific to the `textDocument/documentLink` request. DocumentLink *DocumentLinkClientCapabilities `json:"documentLink,omitzero"` // Capabilities specific to the `textDocument/documentColor` and the // `textDocument/colorPresentation` request. // // Since: 3.6.0 ColorProvider *DocumentColorClientCapabilities `json:"colorProvider,omitzero"` // Capabilities specific to the `textDocument/formatting` request. Formatting *DocumentFormattingClientCapabilities `json:"formatting,omitzero"` // Capabilities specific to the `textDocument/rangeFormatting` request. RangeFormatting *DocumentRangeFormattingClientCapabilities `json:"rangeFormatting,omitzero"` // Capabilities specific to the `textDocument/onTypeFormatting` request. OnTypeFormatting *DocumentOnTypeFormattingClientCapabilities `json:"onTypeFormatting,omitzero"` // Capabilities specific to the `textDocument/rename` request. Rename *RenameClientCapabilities `json:"rename,omitzero"` // Capabilities specific to the `textDocument/foldingRange` request. // // Since: 3.10.0 FoldingRange *FoldingRangeClientCapabilities `json:"foldingRange,omitzero"` // Capabilities specific to the `textDocument/selectionRange` request. // // Since: 3.15.0 SelectionRange *SelectionRangeClientCapabilities `json:"selectionRange,omitzero"` // Capabilities specific to the `textDocument/publishDiagnostics` notification. PublishDiagnostics *PublishDiagnosticsClientCapabilities `json:"publishDiagnostics,omitzero"` // Capabilities specific to the various call hierarchy requests. // // Since: 3.16.0 CallHierarchy *CallHierarchyClientCapabilities `json:"callHierarchy,omitzero"` // Capabilities specific to the various semantic token request. // // Since: 3.16.0 SemanticTokens *SemanticTokensClientCapabilities `json:"semanticTokens,omitzero"` // Capabilities specific to the `textDocument/linkedEditingRange` request. // // Since: 3.16.0 LinkedEditingRange *LinkedEditingRangeClientCapabilities `json:"linkedEditingRange,omitzero"` // Client capabilities specific to the `textDocument/moniker` request. // // Since: 3.16.0 Moniker *MonikerClientCapabilities `json:"moniker,omitzero"` // Capabilities specific to the various type hierarchy requests. // // Since: 3.17.0 TypeHierarchy *TypeHierarchyClientCapabilities `json:"typeHierarchy,omitzero"` // Capabilities specific to the `textDocument/inlineValue` request. // // Since: 3.17.0 InlineValue *InlineValueClientCapabilities `json:"inlineValue,omitzero"` // Capabilities specific to the `textDocument/inlayHint` request. // // Since: 3.17.0 InlayHint *InlayHintClientCapabilities `json:"inlayHint,omitzero"` // Capabilities specific to the diagnostic pull model. // // Since: 3.17.0 Diagnostic *DiagnosticClientCapabilities `json:"diagnostic,omitzero"` // Client capabilities specific to inline completions. // // Since: 3.18.0 // // Proposed. InlineCompletion *InlineCompletionClientCapabilities `json:"inlineCompletion,omitzero"` } // Capabilities specific to the notebook document support. // // Since: 3.17.0 type NotebookDocumentClientCapabilities struct { // Capabilities specific to notebook document synchronization // // Since: 3.17.0 Synchronization *NotebookDocumentSyncClientCapabilities `json:"synchronization"` } var _ json.UnmarshalerFrom = (*NotebookDocumentClientCapabilities)(nil) func (s *NotebookDocumentClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenSynchronization bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"synchronization"`: seenSynchronization = true if err := json.UnmarshalDecode(dec, &s.Synchronization); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenSynchronization { return fmt.Errorf("required property 'synchronization' is missing") } return nil } type WindowClientCapabilities struct { // It indicates whether the client supports server initiated // progress using the `window/workDoneProgress/create` request. // // The capability also controls Whether client supports handling // of progress notifications. If set servers are allowed to report a // `workDoneProgress` property in the request specific server // capabilities. // // Since: 3.15.0 WorkDoneProgress *bool `json:"workDoneProgress,omitzero"` // Capabilities specific to the showMessage request. // // Since: 3.16.0 ShowMessage *ShowMessageRequestClientCapabilities `json:"showMessage,omitzero"` // Capabilities specific to the showDocument request. // // Since: 3.16.0 ShowDocument *ShowDocumentClientCapabilities `json:"showDocument,omitzero"` } // General client capabilities. // // Since: 3.16.0 type GeneralClientCapabilities struct { // Client capability that signals how the client // handles stale requests (e.g. a request // for which the client will not process the response // anymore since the information is outdated). // // Since: 3.17.0 StaleRequestSupport *StaleRequestSupportOptions `json:"staleRequestSupport,omitzero"` // Client capabilities specific to regular expressions. // // Since: 3.16.0 RegularExpressions *RegularExpressionsClientCapabilities `json:"regularExpressions,omitzero"` // Client capabilities specific to the client's markdown parser. // // Since: 3.16.0 Markdown *MarkdownClientCapabilities `json:"markdown,omitzero"` // The position encodings supported by the client. Client and server // have to agree on the same position encoding to ensure that offsets // (e.g. character position in a line) are interpreted the same on both // sides. // // To keep the protocol backwards compatible the following applies: if // the value 'utf-16' is missing from the array of position encodings // servers can assume that the client supports UTF-16. UTF-16 is // therefore a mandatory encoding. // // If omitted it defaults to ['utf-16']. // // Implementation considerations: since the conversion from one encoding // into another requires the content of the file / line the conversion // is best done where the file is read which is usually on the server // side. // // Since: 3.17.0 PositionEncodings *[]PositionEncodingKind `json:"positionEncodings,omitzero"` } type WorkspaceFoldersServerCapabilities struct { // The server has support for workspace folders Supported *bool `json:"supported,omitzero"` // Whether the server wants to receive workspace folder // change notifications. // // If a string is provided the string is treated as an ID // under which the notification is registered on the client // side. The ID can be used to unregister for these events // using the `client/unregisterCapability` request. ChangeNotifications *StringOrBoolean `json:"changeNotifications,omitzero"` } // Options for notifications/requests for user operations on files. // // Since: 3.16.0 type FileOperationOptions struct { // The server is interested in receiving didCreateFiles notifications. DidCreate *FileOperationRegistrationOptions `json:"didCreate,omitzero"` // The server is interested in receiving willCreateFiles requests. WillCreate *FileOperationRegistrationOptions `json:"willCreate,omitzero"` // The server is interested in receiving didRenameFiles notifications. DidRename *FileOperationRegistrationOptions `json:"didRename,omitzero"` // The server is interested in receiving willRenameFiles requests. WillRename *FileOperationRegistrationOptions `json:"willRename,omitzero"` // The server is interested in receiving didDeleteFiles file notifications. DidDelete *FileOperationRegistrationOptions `json:"didDelete,omitzero"` // The server is interested in receiving willDeleteFiles file requests. WillDelete *FileOperationRegistrationOptions `json:"willDelete,omitzero"` } // A relative pattern is a helper to construct glob patterns that are matched // relatively to a base URI. The common value for a `baseUri` is a workspace // folder root, but it can be another absolute URI as well. // // Since: 3.17.0 type RelativePattern struct { // A workspace folder or a base URI to which this pattern will be matched // against relatively. BaseUri WorkspaceFolderOrURI `json:"baseUri"` // The actual glob pattern; Pattern string `json:"pattern"` } var _ json.UnmarshalerFrom = (*RelativePattern)(nil) func (s *RelativePattern) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenBaseUri bool seenPattern bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"baseUri"`: seenBaseUri = true if err := json.UnmarshalDecode(dec, &s.BaseUri); err != nil { return err } case `"pattern"`: seenPattern = true if err := json.UnmarshalDecode(dec, &s.Pattern); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenBaseUri { return fmt.Errorf("required property 'baseUri' is missing") } if !seenPattern { return fmt.Errorf("required property 'pattern' is missing") } return nil } // A document filter where `language` is required field. // // Since: 3.18.0 type TextDocumentFilterLanguage struct { // A language id, like `typescript`. Language string `json:"language"` // A Uri scheme, like `file` or `untitled`. Scheme *string `json:"scheme,omitzero"` // A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples. // // Since: 3.18.0 - support for relative patterns. Whether clients support // relative patterns depends on the client capability // `textDocuments.filters.relativePatternSupport`. Pattern *PatternOrRelativePattern `json:"pattern,omitzero"` } var _ json.UnmarshalerFrom = (*TextDocumentFilterLanguage)(nil) func (s *TextDocumentFilterLanguage) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenLanguage bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"language"`: seenLanguage = true if err := json.UnmarshalDecode(dec, &s.Language); err != nil { return err } case `"scheme"`: if err := json.UnmarshalDecode(dec, &s.Scheme); err != nil { return err } case `"pattern"`: if err := json.UnmarshalDecode(dec, &s.Pattern); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenLanguage { return fmt.Errorf("required property 'language' is missing") } return nil } // A document filter where `scheme` is required field. // // Since: 3.18.0 type TextDocumentFilterScheme struct { // A language id, like `typescript`. Language *string `json:"language,omitzero"` // A Uri scheme, like `file` or `untitled`. Scheme string `json:"scheme"` // A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples. // // Since: 3.18.0 - support for relative patterns. Whether clients support // relative patterns depends on the client capability // `textDocuments.filters.relativePatternSupport`. Pattern *PatternOrRelativePattern `json:"pattern,omitzero"` } var _ json.UnmarshalerFrom = (*TextDocumentFilterScheme)(nil) func (s *TextDocumentFilterScheme) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenScheme bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"language"`: if err := json.UnmarshalDecode(dec, &s.Language); err != nil { return err } case `"scheme"`: seenScheme = true if err := json.UnmarshalDecode(dec, &s.Scheme); err != nil { return err } case `"pattern"`: if err := json.UnmarshalDecode(dec, &s.Pattern); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenScheme { return fmt.Errorf("required property 'scheme' is missing") } return nil } // A document filter where `pattern` is required field. // // Since: 3.18.0 type TextDocumentFilterPattern struct { // A language id, like `typescript`. Language *string `json:"language,omitzero"` // A Uri scheme, like `file` or `untitled`. Scheme *string `json:"scheme,omitzero"` // A glob pattern, like **​/*.{ts,js}. See TextDocumentFilter for examples. // // Since: 3.18.0 - support for relative patterns. Whether clients support // relative patterns depends on the client capability // `textDocuments.filters.relativePatternSupport`. Pattern PatternOrRelativePattern `json:"pattern"` } var _ json.UnmarshalerFrom = (*TextDocumentFilterPattern)(nil) func (s *TextDocumentFilterPattern) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenPattern bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"language"`: if err := json.UnmarshalDecode(dec, &s.Language); err != nil { return err } case `"scheme"`: if err := json.UnmarshalDecode(dec, &s.Scheme); err != nil { return err } case `"pattern"`: seenPattern = true if err := json.UnmarshalDecode(dec, &s.Pattern); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenPattern { return fmt.Errorf("required property 'pattern' is missing") } return nil } // A notebook document filter where `notebookType` is required field. // // Since: 3.18.0 type NotebookDocumentFilterNotebookType struct { // The type of the enclosing notebook. NotebookType string `json:"notebookType"` // A Uri scheme, like `file` or `untitled`. Scheme *string `json:"scheme,omitzero"` // A glob pattern. Pattern *PatternOrRelativePattern `json:"pattern,omitzero"` } var _ json.UnmarshalerFrom = (*NotebookDocumentFilterNotebookType)(nil) func (s *NotebookDocumentFilterNotebookType) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenNotebookType bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"notebookType"`: seenNotebookType = true if err := json.UnmarshalDecode(dec, &s.NotebookType); err != nil { return err } case `"scheme"`: if err := json.UnmarshalDecode(dec, &s.Scheme); err != nil { return err } case `"pattern"`: if err := json.UnmarshalDecode(dec, &s.Pattern); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenNotebookType { return fmt.Errorf("required property 'notebookType' is missing") } return nil } // A notebook document filter where `scheme` is required field. // // Since: 3.18.0 type NotebookDocumentFilterScheme struct { // The type of the enclosing notebook. NotebookType *string `json:"notebookType,omitzero"` // A Uri scheme, like `file` or `untitled`. Scheme string `json:"scheme"` // A glob pattern. Pattern *PatternOrRelativePattern `json:"pattern,omitzero"` } var _ json.UnmarshalerFrom = (*NotebookDocumentFilterScheme)(nil) func (s *NotebookDocumentFilterScheme) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenScheme bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"notebookType"`: if err := json.UnmarshalDecode(dec, &s.NotebookType); err != nil { return err } case `"scheme"`: seenScheme = true if err := json.UnmarshalDecode(dec, &s.Scheme); err != nil { return err } case `"pattern"`: if err := json.UnmarshalDecode(dec, &s.Pattern); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenScheme { return fmt.Errorf("required property 'scheme' is missing") } return nil } // A notebook document filter where `pattern` is required field. // // Since: 3.18.0 type NotebookDocumentFilterPattern struct { // The type of the enclosing notebook. NotebookType *string `json:"notebookType,omitzero"` // A Uri scheme, like `file` or `untitled`. Scheme *string `json:"scheme,omitzero"` // A glob pattern. Pattern PatternOrRelativePattern `json:"pattern"` } var _ json.UnmarshalerFrom = (*NotebookDocumentFilterPattern)(nil) func (s *NotebookDocumentFilterPattern) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenPattern bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"notebookType"`: if err := json.UnmarshalDecode(dec, &s.NotebookType); err != nil { return err } case `"scheme"`: if err := json.UnmarshalDecode(dec, &s.Scheme); err != nil { return err } case `"pattern"`: seenPattern = true if err := json.UnmarshalDecode(dec, &s.Pattern); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenPattern { return fmt.Errorf("required property 'pattern' is missing") } return nil } // A change describing how to move a `NotebookCell` // array from state S to S'. // // Since: 3.17.0 type NotebookCellArrayChange struct { // The start oftest of the cell that changed. Start uint32 `json:"start"` // The deleted cells DeleteCount uint32 `json:"deleteCount"` // The new cells, if any Cells *[]*NotebookCell `json:"cells,omitzero"` } var _ json.UnmarshalerFrom = (*NotebookCellArrayChange)(nil) func (s *NotebookCellArrayChange) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenStart bool seenDeleteCount bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"start"`: seenStart = true if err := json.UnmarshalDecode(dec, &s.Start); err != nil { return err } case `"deleteCount"`: seenDeleteCount = true if err := json.UnmarshalDecode(dec, &s.DeleteCount); err != nil { return err } case `"cells"`: if err := json.UnmarshalDecode(dec, &s.Cells); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenStart { return fmt.Errorf("required property 'start' is missing") } if !seenDeleteCount { return fmt.Errorf("required property 'deleteCount' is missing") } return nil } type WorkspaceEditClientCapabilities struct { // The client supports versioned document changes in `WorkspaceEdit`s DocumentChanges *bool `json:"documentChanges,omitzero"` // The resource operations the client supports. Clients should at least // support 'create', 'rename' and 'delete' files and folders. // // Since: 3.13.0 ResourceOperations *[]ResourceOperationKind `json:"resourceOperations,omitzero"` // The failure handling strategy of a client if applying the workspace edit // fails. // // Since: 3.13.0 FailureHandling *FailureHandlingKind `json:"failureHandling,omitzero"` // Whether the client normalizes line endings to the client specific // setting. // If set to `true` the client will normalize line ending characters // in a workspace edit to the client-specified new line // character. // // Since: 3.16.0 NormalizesLineEndings *bool `json:"normalizesLineEndings,omitzero"` // Whether the client in general supports change annotations on text edits, // create file, rename file and delete file changes. // // Since: 3.16.0 ChangeAnnotationSupport *ChangeAnnotationsSupportOptions `json:"changeAnnotationSupport,omitzero"` // Whether the client supports `WorkspaceEditMetadata` in `WorkspaceEdit`s. // // Since: 3.18.0 // // Proposed. MetadataSupport *bool `json:"metadataSupport,omitzero"` // Whether the client supports snippets as text edits. // // Since: 3.18.0 // // Proposed. SnippetEditSupport *bool `json:"snippetEditSupport,omitzero"` } type DidChangeConfigurationClientCapabilities struct { // Did change configuration notification supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` } type DidChangeWatchedFilesClientCapabilities struct { // Did change watched files notification supports dynamic registration. Please note // that the current protocol doesn't support static configuration for file changes // from the server side. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // Whether the client has support for pattern // or not. // // Since: 3.17.0 RelativePatternSupport *bool `json:"relativePatternSupport,omitzero"` } // Client capabilities for a WorkspaceSymbolRequest. type WorkspaceSymbolClientCapabilities struct { // Symbol request supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // Specific capabilities for the `SymbolKind` in the `workspace/symbol` request. SymbolKind *ClientSymbolKindOptions `json:"symbolKind,omitzero"` // The client supports tags on `SymbolInformation`. // Clients supporting tags have to handle unknown tags gracefully. // // Since: 3.16.0 TagSupport *ClientSymbolTagOptions `json:"tagSupport,omitzero"` // The client support partial workspace symbols. The client will send the // request `workspaceSymbol/resolve` to the server to resolve additional // properties. // // Since: 3.17.0 ResolveSupport *ClientSymbolResolveOptions `json:"resolveSupport,omitzero"` } // The client capabilities of a ExecuteCommandRequest. type ExecuteCommandClientCapabilities struct { // Execute command supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` } // Since: 3.16.0 type SemanticTokensWorkspaceClientCapabilities struct { // Whether the client implementation supports a refresh request sent from // the server to the client. // // Note that this event is global and will force the client to refresh all // semantic tokens currently shown. It should be used with absolute care // and is useful for situation where a server for example detects a project // wide change that requires such a calculation. RefreshSupport *bool `json:"refreshSupport,omitzero"` } // Since: 3.16.0 type CodeLensWorkspaceClientCapabilities struct { // Whether the client implementation supports a refresh request sent from the // server to the client. // // Note that this event is global and will force the client to refresh all // code lenses currently shown. It should be used with absolute care and is // useful for situation where a server for example detect a project wide // change that requires such a calculation. RefreshSupport *bool `json:"refreshSupport,omitzero"` } // Capabilities relating to events from file operations by the user in the client. // // These events do not come from the file system, they come from user operations // like renaming a file in the UI. // // Since: 3.16.0 type FileOperationClientCapabilities struct { // Whether the client supports dynamic registration for file requests/notifications. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // The client has support for sending didCreateFiles notifications. DidCreate *bool `json:"didCreate,omitzero"` // The client has support for sending willCreateFiles requests. WillCreate *bool `json:"willCreate,omitzero"` // The client has support for sending didRenameFiles notifications. DidRename *bool `json:"didRename,omitzero"` // The client has support for sending willRenameFiles requests. WillRename *bool `json:"willRename,omitzero"` // The client has support for sending didDeleteFiles notifications. DidDelete *bool `json:"didDelete,omitzero"` // The client has support for sending willDeleteFiles requests. WillDelete *bool `json:"willDelete,omitzero"` } // Client workspace capabilities specific to inline values. // // Since: 3.17.0 type InlineValueWorkspaceClientCapabilities struct { // Whether the client implementation supports a refresh request sent from the // server to the client. // // Note that this event is global and will force the client to refresh all // inline values currently shown. It should be used with absolute care and is // useful for situation where a server for example detects a project wide // change that requires such a calculation. RefreshSupport *bool `json:"refreshSupport,omitzero"` } // Client workspace capabilities specific to inlay hints. // // Since: 3.17.0 type InlayHintWorkspaceClientCapabilities struct { // Whether the client implementation supports a refresh request sent from // the server to the client. // // Note that this event is global and will force the client to refresh all // inlay hints currently shown. It should be used with absolute care and // is useful for situation where a server for example detects a project wide // change that requires such a calculation. RefreshSupport *bool `json:"refreshSupport,omitzero"` } // Workspace client capabilities specific to diagnostic pull requests. // // Since: 3.17.0 type DiagnosticWorkspaceClientCapabilities struct { // Whether the client implementation supports a refresh request sent from // the server to the client. // // Note that this event is global and will force the client to refresh all // pulled diagnostics currently shown. It should be used with absolute care and // is useful for situation where a server for example detects a project wide // change that requires such a calculation. RefreshSupport *bool `json:"refreshSupport,omitzero"` } // Client workspace capabilities specific to folding ranges // // Since: 3.18.0 // // Proposed. type FoldingRangeWorkspaceClientCapabilities struct { // Whether the client implementation supports a refresh request sent from the // server to the client. // // Note that this event is global and will force the client to refresh all // folding ranges currently shown. It should be used with absolute care and is // useful for situation where a server for example detects a project wide // change that requires such a calculation. // // Since: 3.18.0 // // Proposed. RefreshSupport *bool `json:"refreshSupport,omitzero"` } // Client capabilities for a text document content provider. // // Since: 3.18.0 // // Proposed. type TextDocumentContentClientCapabilities struct { // Text document content provider supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` } type TextDocumentSyncClientCapabilities struct { // Whether text document synchronization supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // The client supports sending will save notifications. WillSave *bool `json:"willSave,omitzero"` // The client supports sending a will save request and // waits for a response providing text edits which will // be applied to the document before it is saved. WillSaveWaitUntil *bool `json:"willSaveWaitUntil,omitzero"` // The client supports did save notifications. DidSave *bool `json:"didSave,omitzero"` } type TextDocumentFilterClientCapabilities struct { // The client supports Relative Patterns. // // Since: 3.18.0 RelativePatternSupport *bool `json:"relativePatternSupport,omitzero"` } // Completion client capabilities type CompletionClientCapabilities struct { // Whether completion supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // The client supports the following `CompletionItem` specific // capabilities. CompletionItem *ClientCompletionItemOptions `json:"completionItem,omitzero"` CompletionItemKind *ClientCompletionItemOptionsKind `json:"completionItemKind,omitzero"` // Defines how the client handles whitespace and indentation // when accepting a completion item that uses multi line // text in either `insertText` or `textEdit`. // // Since: 3.17.0 InsertTextMode *InsertTextMode `json:"insertTextMode,omitzero"` // The client supports to send additional context information for a // `textDocument/completion` request. ContextSupport *bool `json:"contextSupport,omitzero"` // The client supports the following `CompletionList` specific // capabilities. // // Since: 3.17.0 CompletionList *CompletionListCapabilities `json:"completionList,omitzero"` } type HoverClientCapabilities struct { // Whether hover supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // Client supports the following content formats for the content // property. The order describes the preferred format of the client. ContentFormat *[]MarkupKind `json:"contentFormat,omitzero"` } // Client Capabilities for a SignatureHelpRequest. type SignatureHelpClientCapabilities struct { // Whether signature help supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // The client supports the following `SignatureInformation` // specific properties. SignatureInformation *ClientSignatureInformationOptions `json:"signatureInformation,omitzero"` // The client supports to send additional context information for a // `textDocument/signatureHelp` request. A client that opts into // contextSupport will also support the `retriggerCharacters` on // `SignatureHelpOptions`. // // Since: 3.15.0 ContextSupport *bool `json:"contextSupport,omitzero"` } // Since: 3.14.0 type DeclarationClientCapabilities struct { // Whether declaration supports dynamic registration. If this is set to `true` // the client supports the new `DeclarationRegistrationOptions` return value // for the corresponding server capability as well. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // The client supports additional metadata in the form of declaration links. LinkSupport *bool `json:"linkSupport,omitzero"` } // Client Capabilities for a DefinitionRequest. type DefinitionClientCapabilities struct { // Whether definition supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // The client supports additional metadata in the form of definition links. // // Since: 3.14.0 LinkSupport *bool `json:"linkSupport,omitzero"` } // Since 3.6.0 type TypeDefinitionClientCapabilities struct { // Whether implementation supports dynamic registration. If this is set to `true` // the client supports the new `TypeDefinitionRegistrationOptions` return value // for the corresponding server capability as well. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // The client supports additional metadata in the form of definition links. // // Since 3.14.0 LinkSupport *bool `json:"linkSupport,omitzero"` } // Since: 3.6.0 type ImplementationClientCapabilities struct { // Whether implementation supports dynamic registration. If this is set to `true` // the client supports the new `ImplementationRegistrationOptions` return value // for the corresponding server capability as well. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // The client supports additional metadata in the form of definition links. // // Since: 3.14.0 LinkSupport *bool `json:"linkSupport,omitzero"` } // Client Capabilities for a ReferencesRequest. type ReferenceClientCapabilities struct { // Whether references supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` } // Client Capabilities for a DocumentHighlightRequest. type DocumentHighlightClientCapabilities struct { // Whether document highlight supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` } // Client Capabilities for a DocumentSymbolRequest. type DocumentSymbolClientCapabilities struct { // Whether document symbol supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // Specific capabilities for the `SymbolKind` in the // `textDocument/documentSymbol` request. SymbolKind *ClientSymbolKindOptions `json:"symbolKind,omitzero"` // The client supports hierarchical document symbols. HierarchicalDocumentSymbolSupport *bool `json:"hierarchicalDocumentSymbolSupport,omitzero"` // The client supports tags on `SymbolInformation`. Tags are supported on // `DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true. // Clients supporting tags have to handle unknown tags gracefully. // // Since: 3.16.0 TagSupport *ClientSymbolTagOptions `json:"tagSupport,omitzero"` // The client supports an additional label presented in the UI when // registering a document symbol provider. // // Since: 3.16.0 LabelSupport *bool `json:"labelSupport,omitzero"` } // The Client Capabilities of a CodeActionRequest. type CodeActionClientCapabilities struct { // Whether code action supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // The client support code action literals of type `CodeAction` as a valid // response of the `textDocument/codeAction` request. If the property is not // set the request can only return `Command` literals. // // Since: 3.8.0 CodeActionLiteralSupport *ClientCodeActionLiteralOptions `json:"codeActionLiteralSupport,omitzero"` // Whether code action supports the `isPreferred` property. // // Since: 3.15.0 IsPreferredSupport *bool `json:"isPreferredSupport,omitzero"` // Whether code action supports the `disabled` property. // // Since: 3.16.0 DisabledSupport *bool `json:"disabledSupport,omitzero"` // Whether code action supports the `data` property which is // preserved between a `textDocument/codeAction` and a // `codeAction/resolve` request. // // Since: 3.16.0 DataSupport *bool `json:"dataSupport,omitzero"` // Whether the client supports resolving additional code action // properties via a separate `codeAction/resolve` request. // // Since: 3.16.0 ResolveSupport *ClientCodeActionResolveOptions `json:"resolveSupport,omitzero"` // Whether the client honors the change annotations in // text edits and resource operations returned via the // `CodeAction#edit` property by for example presenting // the workspace edit in the user interface and asking // for confirmation. // // Since: 3.16.0 HonorsChangeAnnotations *bool `json:"honorsChangeAnnotations,omitzero"` // Whether the client supports documentation for a class of // code actions. // // Since: 3.18.0 // // Proposed. DocumentationSupport *bool `json:"documentationSupport,omitzero"` // Client supports the tag property on a code action. Clients // supporting tags have to handle unknown tags gracefully. // // Since: 3.18.0 - proposed TagSupport *CodeActionTagOptions `json:"tagSupport,omitzero"` } // The client capabilities of a CodeLensRequest. type CodeLensClientCapabilities struct { // Whether code lens supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // Whether the client supports resolving additional code lens // properties via a separate `codeLens/resolve` request. // // Since: 3.18.0 ResolveSupport *ClientCodeLensResolveOptions `json:"resolveSupport,omitzero"` } // The client capabilities of a DocumentLinkRequest. type DocumentLinkClientCapabilities struct { // Whether document link supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // Whether the client supports the `tooltip` property on `DocumentLink`. // // Since: 3.15.0 TooltipSupport *bool `json:"tooltipSupport,omitzero"` } type DocumentColorClientCapabilities struct { // Whether implementation supports dynamic registration. If this is set to `true` // the client supports the new `DocumentColorRegistrationOptions` return value // for the corresponding server capability as well. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` } // Client capabilities of a DocumentFormattingRequest. type DocumentFormattingClientCapabilities struct { // Whether formatting supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` } // Client capabilities of a DocumentRangeFormattingRequest. type DocumentRangeFormattingClientCapabilities struct { // Whether range formatting supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // Whether the client supports formatting multiple ranges at once. // // Since: 3.18.0 // // Proposed. RangesSupport *bool `json:"rangesSupport,omitzero"` } // Client capabilities of a DocumentOnTypeFormattingRequest. type DocumentOnTypeFormattingClientCapabilities struct { // Whether on type formatting supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` } type RenameClientCapabilities struct { // Whether rename supports dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // Client supports testing for validity of rename operations // before execution. // // Since: 3.12.0 PrepareSupport *bool `json:"prepareSupport,omitzero"` // Client supports the default behavior result. // // The value indicates the default behavior used by the // client. // // Since: 3.16.0 PrepareSupportDefaultBehavior *PrepareSupportDefaultBehavior `json:"prepareSupportDefaultBehavior,omitzero"` // Whether the client honors the change annotations in // text edits and resource operations returned via the // rename request's workspace edit by for example presenting // the workspace edit in the user interface and asking // for confirmation. // // Since: 3.16.0 HonorsChangeAnnotations *bool `json:"honorsChangeAnnotations,omitzero"` } type FoldingRangeClientCapabilities struct { // Whether implementation supports dynamic registration for folding range // providers. If this is set to `true` the client supports the new // `FoldingRangeRegistrationOptions` return value for the corresponding // server capability as well. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // The maximum number of folding ranges that the client prefers to receive // per document. The value serves as a hint, servers are free to follow the // limit. RangeLimit *uint32 `json:"rangeLimit,omitzero"` // If set, the client signals that it only supports folding complete lines. // If set, client will ignore specified `startCharacter` and `endCharacter` // properties in a FoldingRange. LineFoldingOnly *bool `json:"lineFoldingOnly,omitzero"` // Specific options for the folding range kind. // // Since: 3.17.0 FoldingRangeKind *ClientFoldingRangeKindOptions `json:"foldingRangeKind,omitzero"` // Specific options for the folding range. // // Since: 3.17.0 FoldingRange *ClientFoldingRangeOptions `json:"foldingRange,omitzero"` } type SelectionRangeClientCapabilities struct { // Whether implementation supports dynamic registration for selection range providers. If this is set to `true` // the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server // capability as well. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` } // The publish diagnostic client capabilities. type PublishDiagnosticsClientCapabilities struct { // Whether the clients accepts diagnostics with related information. RelatedInformation *bool `json:"relatedInformation,omitzero"` // Client supports the tag property to provide meta data about a diagnostic. // Clients supporting tags have to handle unknown tags gracefully. // // Since: 3.15.0 TagSupport *ClientDiagnosticsTagOptions `json:"tagSupport,omitzero"` // Client supports a codeDescription property // // Since: 3.16.0 CodeDescriptionSupport *bool `json:"codeDescriptionSupport,omitzero"` // Whether code action supports the `data` property which is // preserved between a `textDocument/publishDiagnostics` and // `textDocument/codeAction` request. // // Since: 3.16.0 DataSupport *bool `json:"dataSupport,omitzero"` // Whether the client interprets the version property of the // `textDocument/publishDiagnostics` notification's parameter. // // Since: 3.15.0 VersionSupport *bool `json:"versionSupport,omitzero"` } // Since: 3.16.0 type CallHierarchyClientCapabilities struct { // Whether implementation supports dynamic registration. If this is set to `true` // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` // return value for the corresponding server capability as well. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` } // Since: 3.16.0 type SemanticTokensClientCapabilities struct { // Whether implementation supports dynamic registration. If this is set to `true` // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` // return value for the corresponding server capability as well. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // Which requests the client supports and might send to the server // depending on the server's capability. Please note that clients might not // show semantic tokens or degrade some of the user experience if a range // or full request is advertised by the client but not provided by the // server. If for example the client capability `requests.full` and // `request.range` are both set to true but the server only provides a // range provider the client might not render a minimap correctly or might // even decide to not show any semantic tokens at all. Requests *ClientSemanticTokensRequestOptions `json:"requests"` // The token types that the client supports. TokenTypes []string `json:"tokenTypes"` // The token modifiers that the client supports. TokenModifiers []string `json:"tokenModifiers"` // The token formats the clients supports. Formats []TokenFormat `json:"formats"` // Whether the client supports tokens that can overlap each other. OverlappingTokenSupport *bool `json:"overlappingTokenSupport,omitzero"` // Whether the client supports tokens that can span multiple lines. MultilineTokenSupport *bool `json:"multilineTokenSupport,omitzero"` // Whether the client allows the server to actively cancel a // semantic token request, e.g. supports returning // LSPErrorCodes.ServerCancelled. If a server does the client // needs to retrigger the request. // // Since: 3.17.0 ServerCancelSupport *bool `json:"serverCancelSupport,omitzero"` // Whether the client uses semantic tokens to augment existing // syntax tokens. If set to `true` client side created syntax // tokens and semantic tokens are both used for colorization. If // set to `false` the client only uses the returned semantic tokens // for colorization. // // If the value is `undefined` then the client behavior is not // specified. // // Since: 3.17.0 AugmentsSyntaxTokens *bool `json:"augmentsSyntaxTokens,omitzero"` } var _ json.UnmarshalerFrom = (*SemanticTokensClientCapabilities)(nil) func (s *SemanticTokensClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenRequests bool seenTokenTypes bool seenTokenModifiers bool seenFormats bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"dynamicRegistration"`: if err := json.UnmarshalDecode(dec, &s.DynamicRegistration); err != nil { return err } case `"requests"`: seenRequests = true if err := json.UnmarshalDecode(dec, &s.Requests); err != nil { return err } case `"tokenTypes"`: seenTokenTypes = true if err := json.UnmarshalDecode(dec, &s.TokenTypes); err != nil { return err } case `"tokenModifiers"`: seenTokenModifiers = true if err := json.UnmarshalDecode(dec, &s.TokenModifiers); err != nil { return err } case `"formats"`: seenFormats = true if err := json.UnmarshalDecode(dec, &s.Formats); err != nil { return err } case `"overlappingTokenSupport"`: if err := json.UnmarshalDecode(dec, &s.OverlappingTokenSupport); err != nil { return err } case `"multilineTokenSupport"`: if err := json.UnmarshalDecode(dec, &s.MultilineTokenSupport); err != nil { return err } case `"serverCancelSupport"`: if err := json.UnmarshalDecode(dec, &s.ServerCancelSupport); err != nil { return err } case `"augmentsSyntaxTokens"`: if err := json.UnmarshalDecode(dec, &s.AugmentsSyntaxTokens); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenRequests { return fmt.Errorf("required property 'requests' is missing") } if !seenTokenTypes { return fmt.Errorf("required property 'tokenTypes' is missing") } if !seenTokenModifiers { return fmt.Errorf("required property 'tokenModifiers' is missing") } if !seenFormats { return fmt.Errorf("required property 'formats' is missing") } return nil } // Client capabilities for the linked editing range request. // // Since: 3.16.0 type LinkedEditingRangeClientCapabilities struct { // Whether implementation supports dynamic registration. If this is set to `true` // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` // return value for the corresponding server capability as well. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` } // Client capabilities specific to the moniker request. // // Since: 3.16.0 type MonikerClientCapabilities struct { // Whether moniker supports dynamic registration. If this is set to `true` // the client supports the new `MonikerRegistrationOptions` return value // for the corresponding server capability as well. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` } // Since: 3.17.0 type TypeHierarchyClientCapabilities struct { // Whether implementation supports dynamic registration. If this is set to `true` // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` // return value for the corresponding server capability as well. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` } // Client capabilities specific to inline values. // // Since: 3.17.0 type InlineValueClientCapabilities struct { // Whether implementation supports dynamic registration for inline value providers. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` } // Inlay hint client capabilities. // // Since: 3.17.0 type InlayHintClientCapabilities struct { // Whether inlay hints support dynamic registration. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // Indicates which properties a client can resolve lazily on an inlay // hint. ResolveSupport *ClientInlayHintResolveOptions `json:"resolveSupport,omitzero"` } // Client capabilities specific to diagnostic pull requests. // // Since: 3.17.0 type DiagnosticClientCapabilities struct { // Whether the clients accepts diagnostics with related information. RelatedInformation *bool `json:"relatedInformation,omitzero"` // Client supports the tag property to provide meta data about a diagnostic. // Clients supporting tags have to handle unknown tags gracefully. // // Since: 3.15.0 TagSupport *ClientDiagnosticsTagOptions `json:"tagSupport,omitzero"` // Client supports a codeDescription property // // Since: 3.16.0 CodeDescriptionSupport *bool `json:"codeDescriptionSupport,omitzero"` // Whether code action supports the `data` property which is // preserved between a `textDocument/publishDiagnostics` and // `textDocument/codeAction` request. // // Since: 3.16.0 DataSupport *bool `json:"dataSupport,omitzero"` // Whether implementation supports dynamic registration. If this is set to `true` // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` // return value for the corresponding server capability as well. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // Whether the clients supports related documents for document diagnostic pulls. RelatedDocumentSupport *bool `json:"relatedDocumentSupport,omitzero"` } // Client capabilities specific to inline completions. // // Since: 3.18.0 // // Proposed. type InlineCompletionClientCapabilities struct { // Whether implementation supports dynamic registration for inline completion providers. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` } // Notebook specific client capabilities. // // Since: 3.17.0 type NotebookDocumentSyncClientCapabilities struct { // Whether implementation supports dynamic registration. If this is // set to `true` the client supports the new // `(TextDocumentRegistrationOptions & StaticRegistrationOptions)` // return value for the corresponding server capability as well. DynamicRegistration *bool `json:"dynamicRegistration,omitzero"` // The client supports sending execution summary data per cell. ExecutionSummarySupport *bool `json:"executionSummarySupport,omitzero"` } // Show message request client capabilities type ShowMessageRequestClientCapabilities struct { // Capabilities specific to the `MessageActionItem` type. MessageActionItem *ClientShowMessageActionItemOptions `json:"messageActionItem,omitzero"` } // Client capabilities for the showDocument request. // // Since: 3.16.0 type ShowDocumentClientCapabilities struct { // The client has support for the showDocument // request. Support bool `json:"support"` } var _ json.UnmarshalerFrom = (*ShowDocumentClientCapabilities)(nil) func (s *ShowDocumentClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenSupport bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"support"`: seenSupport = true if err := json.UnmarshalDecode(dec, &s.Support); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenSupport { return fmt.Errorf("required property 'support' is missing") } return nil } // Since: 3.18.0 type StaleRequestSupportOptions struct { // The client will actively cancel the request. Cancel bool `json:"cancel"` // The list of requests for which the client // will retry the request if it receives a // response with error code `ContentModified` RetryOnContentModified []string `json:"retryOnContentModified"` } var _ json.UnmarshalerFrom = (*StaleRequestSupportOptions)(nil) func (s *StaleRequestSupportOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var ( seenCancel bool seenRetryOnContentModified bool ) if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"cancel"`: seenCancel = true if err := json.UnmarshalDecode(dec, &s.Cancel); err != nil { return err } case `"retryOnContentModified"`: seenRetryOnContentModified = true if err := json.UnmarshalDecode(dec, &s.RetryOnContentModified); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenCancel { return fmt.Errorf("required property 'cancel' is missing") } if !seenRetryOnContentModified { return fmt.Errorf("required property 'retryOnContentModified' is missing") } return nil } // Client capabilities specific to regular expressions. // // Since: 3.16.0 type RegularExpressionsClientCapabilities struct { // The engine's name. Engine string `json:"engine"` // The engine's version. Version *string `json:"version,omitzero"` } var _ json.UnmarshalerFrom = (*RegularExpressionsClientCapabilities)(nil) func (s *RegularExpressionsClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenEngine bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"engine"`: seenEngine = true if err := json.UnmarshalDecode(dec, &s.Engine); err != nil { return err } case `"version"`: if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenEngine { return fmt.Errorf("required property 'engine' is missing") } return nil } // Client capabilities specific to the used markdown parser. // // Since: 3.16.0 type MarkdownClientCapabilities struct { // The name of the parser. Parser string `json:"parser"` // The version of the parser. Version *string `json:"version,omitzero"` // A list of HTML tags that the client allows / supports in // Markdown. // // Since: 3.17.0 AllowedTags *[]string `json:"allowedTags,omitzero"` } var _ json.UnmarshalerFrom = (*MarkdownClientCapabilities)(nil) func (s *MarkdownClientCapabilities) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenParser bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"parser"`: seenParser = true if err := json.UnmarshalDecode(dec, &s.Parser); err != nil { return err } case `"version"`: if err := json.UnmarshalDecode(dec, &s.Version); err != nil { return err } case `"allowedTags"`: if err := json.UnmarshalDecode(dec, &s.AllowedTags); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenParser { return fmt.Errorf("required property 'parser' is missing") } return nil } // Since: 3.18.0 type ChangeAnnotationsSupportOptions struct { // Whether the client groups edits with equal labels into tree nodes, // for instance all edits labelled with "Changes in Strings" would // be a tree node. GroupsOnLabel *bool `json:"groupsOnLabel,omitzero"` } // Since: 3.18.0 type ClientSymbolKindOptions struct { // The symbol kind values the client supports. When this // property exists the client also guarantees that it will // handle values outside its set gracefully and falls back // to a default value when unknown. // // If this property is not present the client only supports // the symbol kinds from `File` to `Array` as defined in // the initial version of the protocol. ValueSet *[]SymbolKind `json:"valueSet,omitzero"` } // Since: 3.18.0 type ClientSymbolTagOptions struct { // The tags supported by the client. ValueSet []SymbolTag `json:"valueSet"` } var _ json.UnmarshalerFrom = (*ClientSymbolTagOptions)(nil) func (s *ClientSymbolTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenValueSet bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"valueSet"`: seenValueSet = true if err := json.UnmarshalDecode(dec, &s.ValueSet); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenValueSet { return fmt.Errorf("required property 'valueSet' is missing") } return nil } // Since: 3.18.0 type ClientSymbolResolveOptions struct { // The properties that a client can resolve lazily. Usually // `location.range` Properties []string `json:"properties"` } var _ json.UnmarshalerFrom = (*ClientSymbolResolveOptions)(nil) func (s *ClientSymbolResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenProperties bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"properties"`: seenProperties = true if err := json.UnmarshalDecode(dec, &s.Properties); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenProperties { return fmt.Errorf("required property 'properties' is missing") } return nil } // Since: 3.18.0 type ClientCompletionItemOptions struct { // Client supports snippets as insert text. // // A snippet can define tab stops and placeholders with `$1`, `$2` // and `${3:foo}`. `$0` defines the final tab stop, it defaults to // the end of the snippet. Placeholders with equal identifiers are linked, // that is typing in one will update others too. SnippetSupport *bool `json:"snippetSupport,omitzero"` // Client supports commit characters on a completion item. CommitCharactersSupport *bool `json:"commitCharactersSupport,omitzero"` // Client supports the following content formats for the documentation // property. The order describes the preferred format of the client. DocumentationFormat *[]MarkupKind `json:"documentationFormat,omitzero"` // Client supports the deprecated property on a completion item. DeprecatedSupport *bool `json:"deprecatedSupport,omitzero"` // Client supports the preselect property on a completion item. PreselectSupport *bool `json:"preselectSupport,omitzero"` // Client supports the tag property on a completion item. Clients supporting // tags have to handle unknown tags gracefully. Clients especially need to // preserve unknown tags when sending a completion item back to the server in // a resolve call. // // Since: 3.15.0 TagSupport *CompletionItemTagOptions `json:"tagSupport,omitzero"` // Client support insert replace edit to control different behavior if a // completion item is inserted in the text or should replace text. // // Since: 3.16.0 InsertReplaceSupport *bool `json:"insertReplaceSupport,omitzero"` // Indicates which properties a client can resolve lazily on a completion // item. Before version 3.16.0 only the predefined properties `documentation` // and `details` could be resolved lazily. // // Since: 3.16.0 ResolveSupport *ClientCompletionItemResolveOptions `json:"resolveSupport,omitzero"` // The client supports the `insertTextMode` property on // a completion item to override the whitespace handling mode // as defined by the client (see `insertTextMode`). // // Since: 3.16.0 InsertTextModeSupport *ClientCompletionItemInsertTextModeOptions `json:"insertTextModeSupport,omitzero"` // The client has support for completion item label // details (see also `CompletionItemLabelDetails`). // // Since: 3.17.0 LabelDetailsSupport *bool `json:"labelDetailsSupport,omitzero"` } // Since: 3.18.0 type ClientCompletionItemOptionsKind struct { // The completion item kind values the client supports. When this // property exists the client also guarantees that it will // handle values outside its set gracefully and falls back // to a default value when unknown. // // If this property is not present the client only supports // the completion items kinds from `Text` to `Reference` as defined in // the initial version of the protocol. ValueSet *[]CompletionItemKind `json:"valueSet,omitzero"` } // The client supports the following `CompletionList` specific // capabilities. // // Since: 3.17.0 type CompletionListCapabilities struct { // The client supports the following itemDefaults on // a completion list. // // The value lists the supported property names of the // `CompletionList.itemDefaults` object. If omitted // no properties are supported. // // Since: 3.17.0 ItemDefaults *[]string `json:"itemDefaults,omitzero"` // Specifies whether the client supports `CompletionList.applyKind` to // indicate how supported values from `completionList.itemDefaults` // and `completion` will be combined. // // If a client supports `applyKind` it must support it for all fields // that it supports that are listed in `CompletionList.applyKind`. This // means when clients add support for new/future fields in completion // items the MUST also support merge for them if those fields are // defined in `CompletionList.applyKind`. // // Since: 3.18.0 ApplyKindSupport *bool `json:"applyKindSupport,omitzero"` } // Since: 3.18.0 type ClientSignatureInformationOptions struct { // Client supports the following content formats for the documentation // property. The order describes the preferred format of the client. DocumentationFormat *[]MarkupKind `json:"documentationFormat,omitzero"` // Client capabilities specific to parameter information. ParameterInformation *ClientSignatureParameterInformationOptions `json:"parameterInformation,omitzero"` // The client supports the `activeParameter` property on `SignatureInformation` // literal. // // Since: 3.16.0 ActiveParameterSupport *bool `json:"activeParameterSupport,omitzero"` // The client supports the `activeParameter` property on // `SignatureHelp`/`SignatureInformation` being set to `null` to // indicate that no parameter should be active. // // Since: 3.18.0 // // Proposed. NoActiveParameterSupport *bool `json:"noActiveParameterSupport,omitzero"` } // Since: 3.18.0 type ClientCodeActionLiteralOptions struct { // The code action kind is support with the following value // set. CodeActionKind *ClientCodeActionKindOptions `json:"codeActionKind"` } var _ json.UnmarshalerFrom = (*ClientCodeActionLiteralOptions)(nil) func (s *ClientCodeActionLiteralOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenCodeActionKind bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"codeActionKind"`: seenCodeActionKind = true if err := json.UnmarshalDecode(dec, &s.CodeActionKind); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenCodeActionKind { return fmt.Errorf("required property 'codeActionKind' is missing") } return nil } // Since: 3.18.0 type ClientCodeActionResolveOptions struct { // The properties that a client can resolve lazily. Properties []string `json:"properties"` } var _ json.UnmarshalerFrom = (*ClientCodeActionResolveOptions)(nil) func (s *ClientCodeActionResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenProperties bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"properties"`: seenProperties = true if err := json.UnmarshalDecode(dec, &s.Properties); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenProperties { return fmt.Errorf("required property 'properties' is missing") } return nil } // Since: 3.18.0 - proposed type CodeActionTagOptions struct { // The tags supported by the client. ValueSet []CodeActionTag `json:"valueSet"` } var _ json.UnmarshalerFrom = (*CodeActionTagOptions)(nil) func (s *CodeActionTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenValueSet bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"valueSet"`: seenValueSet = true if err := json.UnmarshalDecode(dec, &s.ValueSet); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenValueSet { return fmt.Errorf("required property 'valueSet' is missing") } return nil } // Since: 3.18.0 type ClientCodeLensResolveOptions struct { // The properties that a client can resolve lazily. Properties []string `json:"properties"` } var _ json.UnmarshalerFrom = (*ClientCodeLensResolveOptions)(nil) func (s *ClientCodeLensResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenProperties bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"properties"`: seenProperties = true if err := json.UnmarshalDecode(dec, &s.Properties); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenProperties { return fmt.Errorf("required property 'properties' is missing") } return nil } // Since: 3.18.0 type ClientFoldingRangeKindOptions struct { // The folding range kind values the client supports. When this // property exists the client also guarantees that it will // handle values outside its set gracefully and falls back // to a default value when unknown. ValueSet *[]FoldingRangeKind `json:"valueSet,omitzero"` } // Since: 3.18.0 type ClientFoldingRangeOptions struct { // If set, the client signals that it supports setting collapsedText on // folding ranges to display custom labels instead of the default text. // // Since: 3.17.0 CollapsedText *bool `json:"collapsedText,omitzero"` } // General diagnostics capabilities for pull and push model. type DiagnosticsCapabilities struct { // Whether the clients accepts diagnostics with related information. RelatedInformation *bool `json:"relatedInformation,omitzero"` // Client supports the tag property to provide meta data about a diagnostic. // Clients supporting tags have to handle unknown tags gracefully. // // Since: 3.15.0 TagSupport *ClientDiagnosticsTagOptions `json:"tagSupport,omitzero"` // Client supports a codeDescription property // // Since: 3.16.0 CodeDescriptionSupport *bool `json:"codeDescriptionSupport,omitzero"` // Whether code action supports the `data` property which is // preserved between a `textDocument/publishDiagnostics` and // `textDocument/codeAction` request. // // Since: 3.16.0 DataSupport *bool `json:"dataSupport,omitzero"` } // Since: 3.18.0 type ClientSemanticTokensRequestOptions struct { // The client will send the `textDocument/semanticTokens/range` request if // the server provides a corresponding handler. Range *BooleanOrEmptyObject `json:"range,omitzero"` // The client will send the `textDocument/semanticTokens/full` request if // the server provides a corresponding handler. Full *BooleanOrClientSemanticTokensRequestFullDelta `json:"full,omitzero"` } // Since: 3.18.0 type ClientInlayHintResolveOptions struct { // The properties that a client can resolve lazily. Properties []string `json:"properties"` } var _ json.UnmarshalerFrom = (*ClientInlayHintResolveOptions)(nil) func (s *ClientInlayHintResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenProperties bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"properties"`: seenProperties = true if err := json.UnmarshalDecode(dec, &s.Properties); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenProperties { return fmt.Errorf("required property 'properties' is missing") } return nil } // Since: 3.18.0 type ClientShowMessageActionItemOptions struct { // Whether the client supports additional attributes which // are preserved and send back to the server in the // request's response. AdditionalPropertiesSupport *bool `json:"additionalPropertiesSupport,omitzero"` } // Since: 3.18.0 type CompletionItemTagOptions struct { // The tags supported by the client. ValueSet []CompletionItemTag `json:"valueSet"` } var _ json.UnmarshalerFrom = (*CompletionItemTagOptions)(nil) func (s *CompletionItemTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenValueSet bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"valueSet"`: seenValueSet = true if err := json.UnmarshalDecode(dec, &s.ValueSet); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenValueSet { return fmt.Errorf("required property 'valueSet' is missing") } return nil } // Since: 3.18.0 type ClientCompletionItemResolveOptions struct { // The properties that a client can resolve lazily. Properties []string `json:"properties"` } var _ json.UnmarshalerFrom = (*ClientCompletionItemResolveOptions)(nil) func (s *ClientCompletionItemResolveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenProperties bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"properties"`: seenProperties = true if err := json.UnmarshalDecode(dec, &s.Properties); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenProperties { return fmt.Errorf("required property 'properties' is missing") } return nil } // Since: 3.18.0 type ClientCompletionItemInsertTextModeOptions struct { ValueSet []InsertTextMode `json:"valueSet"` } var _ json.UnmarshalerFrom = (*ClientCompletionItemInsertTextModeOptions)(nil) func (s *ClientCompletionItemInsertTextModeOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenValueSet bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"valueSet"`: seenValueSet = true if err := json.UnmarshalDecode(dec, &s.ValueSet); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenValueSet { return fmt.Errorf("required property 'valueSet' is missing") } return nil } // Since: 3.18.0 type ClientSignatureParameterInformationOptions struct { // The client supports processing label offsets instead of a // simple label string. // // Since: 3.14.0 LabelOffsetSupport *bool `json:"labelOffsetSupport,omitzero"` } // Since: 3.18.0 type ClientCodeActionKindOptions struct { // The code action kind values the client supports. When this // property exists the client also guarantees that it will // handle values outside its set gracefully and falls back // to a default value when unknown. ValueSet []CodeActionKind `json:"valueSet"` } var _ json.UnmarshalerFrom = (*ClientCodeActionKindOptions)(nil) func (s *ClientCodeActionKindOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenValueSet bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"valueSet"`: seenValueSet = true if err := json.UnmarshalDecode(dec, &s.ValueSet); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenValueSet { return fmt.Errorf("required property 'valueSet' is missing") } return nil } // Since: 3.18.0 type ClientDiagnosticsTagOptions struct { // The tags supported by the client. ValueSet []DiagnosticTag `json:"valueSet"` } var _ json.UnmarshalerFrom = (*ClientDiagnosticsTagOptions)(nil) func (s *ClientDiagnosticsTagOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { var seenValueSet bool if k := dec.PeekKind(); k != '{' { return fmt.Errorf("expected object start, but encountered %v", k) } if _, err := dec.ReadToken(); err != nil { return err } for dec.PeekKind() != '}' { name, err := dec.ReadValue() if err != nil { return err } switch string(name) { case `"valueSet"`: seenValueSet = true if err := json.UnmarshalDecode(dec, &s.ValueSet); err != nil { return err } default: // Ignore unknown properties. } } if _, err := dec.ReadToken(); err != nil { return err } if !seenValueSet { return fmt.Errorf("required property 'valueSet' is missing") } return nil } // Since: 3.18.0 type ClientSemanticTokensRequestFullDelta struct { // The client will send the `textDocument/semanticTokens/full/delta` request if // the server provides a corresponding handler. Delta *bool `json:"delta,omitzero"` } // Enumerations // A set of predefined token types. This set is not fixed // an clients can specify additional token types via the // corresponding client capabilities. // // Since: 3.16.0 type SemanticTokenTypes string const ( SemanticTokenTypesnamespace SemanticTokenTypes = "namespace" // Represents a generic type. Acts as a fallback for types which can't be mapped to // a specific type like class or enum. SemanticTokenTypestype SemanticTokenTypes = "type" SemanticTokenTypesclass SemanticTokenTypes = "class" SemanticTokenTypesenum SemanticTokenTypes = "enum" SemanticTokenTypesinterface SemanticTokenTypes = "interface" SemanticTokenTypesstruct SemanticTokenTypes = "struct" SemanticTokenTypestypeParameter SemanticTokenTypes = "typeParameter" SemanticTokenTypesparameter SemanticTokenTypes = "parameter" SemanticTokenTypesvariable SemanticTokenTypes = "variable" SemanticTokenTypesproperty SemanticTokenTypes = "property" SemanticTokenTypesenumMember SemanticTokenTypes = "enumMember" SemanticTokenTypesevent SemanticTokenTypes = "event" SemanticTokenTypesfunction SemanticTokenTypes = "function" SemanticTokenTypesmethod SemanticTokenTypes = "method" SemanticTokenTypesmacro SemanticTokenTypes = "macro" SemanticTokenTypeskeyword SemanticTokenTypes = "keyword" SemanticTokenTypesmodifier SemanticTokenTypes = "modifier" SemanticTokenTypescomment SemanticTokenTypes = "comment" SemanticTokenTypesstring SemanticTokenTypes = "string" SemanticTokenTypesnumber SemanticTokenTypes = "number" SemanticTokenTypesregexp SemanticTokenTypes = "regexp" SemanticTokenTypesoperator SemanticTokenTypes = "operator" // Since: 3.17.0 SemanticTokenTypesdecorator SemanticTokenTypes = "decorator" // Since: 3.18.0 SemanticTokenTypeslabel SemanticTokenTypes = "label" ) // A set of predefined token modifiers. This set is not fixed // an clients can specify additional token types via the // corresponding client capabilities. // // Since: 3.16.0 type SemanticTokenModifiers string const ( SemanticTokenModifiersdeclaration SemanticTokenModifiers = "declaration" SemanticTokenModifiersdefinition SemanticTokenModifiers = "definition" SemanticTokenModifiersreadonly SemanticTokenModifiers = "readonly" SemanticTokenModifiersstatic SemanticTokenModifiers = "static" SemanticTokenModifiersdeprecated SemanticTokenModifiers = "deprecated" SemanticTokenModifiersabstract SemanticTokenModifiers = "abstract" SemanticTokenModifiersasync SemanticTokenModifiers = "async" SemanticTokenModifiersmodification SemanticTokenModifiers = "modification" SemanticTokenModifiersdocumentation SemanticTokenModifiers = "documentation" SemanticTokenModifiersdefaultLibrary SemanticTokenModifiers = "defaultLibrary" ) // The document diagnostic report kinds. // // Since: 3.17.0 type DocumentDiagnosticReportKind string const ( // A diagnostic report with a full // set of problems. DocumentDiagnosticReportKindFull DocumentDiagnosticReportKind = "full" // A report indicating that the last // returned report is still accurate. DocumentDiagnosticReportKindUnchanged DocumentDiagnosticReportKind = "unchanged" ) // Predefined error codes. type ErrorCodes int32 const ( ErrorCodesParseError ErrorCodes = -32700 ErrorCodesInvalidRequest ErrorCodes = -32600 ErrorCodesMethodNotFound ErrorCodes = -32601 ErrorCodesInvalidParams ErrorCodes = -32602 ErrorCodesInternalError ErrorCodes = -32603 // Error code indicating that a server received a notification or // request before the server has received the `initialize` request. ErrorCodesServerNotInitialized ErrorCodes = -32002 ErrorCodesUnknownErrorCode ErrorCodes = -32001 ) type LSPErrorCodes int32 const ( // A request failed but it was syntactically correct, e.g the // method name was known and the parameters were valid. The error // message should contain human readable information about why // the request failed. // // Since: 3.17.0 LSPErrorCodesRequestFailed LSPErrorCodes = -32803 // The server cancelled the request. This error code should // only be used for requests that explicitly support being // server cancellable. // // Since: 3.17.0 LSPErrorCodesServerCancelled LSPErrorCodes = -32802 // The server detected that the content of a document got // modified outside normal conditions. A server should // NOT send this error code if it detects a content change // in it unprocessed messages. The result even computed // on an older state might still be useful for the client. // // If a client decides that a result is not of any use anymore // the client should cancel the request. LSPErrorCodesContentModified LSPErrorCodes = -32801 // The client has canceled a request and a server has detected // the cancel. LSPErrorCodesRequestCancelled LSPErrorCodes = -32800 ) // A set of predefined range kinds. type FoldingRangeKind string const ( // Folding range for a comment FoldingRangeKindComment FoldingRangeKind = "comment" // Folding range for an import or include FoldingRangeKindImports FoldingRangeKind = "imports" // Folding range for a region (e.g. `#region`) FoldingRangeKindRegion FoldingRangeKind = "region" ) // A symbol kind. type SymbolKind uint32 const ( SymbolKindFile SymbolKind = 1 SymbolKindModule SymbolKind = 2 SymbolKindNamespace SymbolKind = 3 SymbolKindPackage SymbolKind = 4 SymbolKindClass SymbolKind = 5 SymbolKindMethod SymbolKind = 6 SymbolKindProperty SymbolKind = 7 SymbolKindField SymbolKind = 8 SymbolKindConstructor SymbolKind = 9 SymbolKindEnum SymbolKind = 10 SymbolKindInterface SymbolKind = 11 SymbolKindFunction SymbolKind = 12 SymbolKindVariable SymbolKind = 13 SymbolKindConstant SymbolKind = 14 SymbolKindString SymbolKind = 15 SymbolKindNumber SymbolKind = 16 SymbolKindBoolean SymbolKind = 17 SymbolKindArray SymbolKind = 18 SymbolKindObject SymbolKind = 19 SymbolKindKey SymbolKind = 20 SymbolKindNull SymbolKind = 21 SymbolKindEnumMember SymbolKind = 22 SymbolKindStruct SymbolKind = 23 SymbolKindEvent SymbolKind = 24 SymbolKindOperator SymbolKind = 25 SymbolKindTypeParameter SymbolKind = 26 ) // Symbol tags are extra annotations that tweak the rendering of a symbol. // // Since: 3.16 type SymbolTag uint32 const ( // Render a symbol as obsolete, usually using a strike-out. SymbolTagDeprecated SymbolTag = 1 ) // Moniker uniqueness level to define scope of the moniker. // // Since: 3.16.0 type UniquenessLevel string const ( // The moniker is only unique inside a document UniquenessLeveldocument UniquenessLevel = "document" // The moniker is unique inside a project for which a dump got created UniquenessLevelproject UniquenessLevel = "project" // The moniker is unique inside the group to which a project belongs UniquenessLevelgroup UniquenessLevel = "group" // The moniker is unique inside the moniker scheme. UniquenessLevelscheme UniquenessLevel = "scheme" // The moniker is globally unique UniquenessLevelglobal UniquenessLevel = "global" ) // The moniker kind. // // Since: 3.16.0 type MonikerKind string const ( // The moniker represent a symbol that is imported into a project MonikerKindimport MonikerKind = "import" // The moniker represents a symbol that is exported from a project MonikerKindexport MonikerKind = "export" // The moniker represents a symbol that is local to a project (e.g. a local // variable of a function, a class not visible outside the project, ...) MonikerKindlocal MonikerKind = "local" ) // Inlay hint kinds. // // Since: 3.17.0 type InlayHintKind uint32 const ( // An inlay hint that for a type annotation. InlayHintKindType InlayHintKind = 1 // An inlay hint that is for a parameter. InlayHintKindParameter InlayHintKind = 2 ) // The message type type MessageType uint32 const ( // An error message. MessageTypeError MessageType = 1 // A warning message. MessageTypeWarning MessageType = 2 // An information message. MessageTypeInfo MessageType = 3 // A log message. MessageTypeLog MessageType = 4 // A debug message. // // Since: 3.18.0 // // Proposed. MessageTypeDebug MessageType = 5 ) // Defines how the host (editor) should sync // document changes to the language server. type TextDocumentSyncKind uint32 const ( // Documents should not be synced at all. TextDocumentSyncKindNone TextDocumentSyncKind = 0 // Documents are synced by always sending the full content // of the document. TextDocumentSyncKindFull TextDocumentSyncKind = 1 // Documents are synced by sending the full content on open. // After that only incremental updates to the document are // send. TextDocumentSyncKindIncremental TextDocumentSyncKind = 2 ) // Represents reasons why a text document is saved. type TextDocumentSaveReason uint32 const ( // Manually triggered, e.g. by the user pressing save, by starting debugging, // or by an API call. TextDocumentSaveReasonManual TextDocumentSaveReason = 1 // Automatic after a delay. TextDocumentSaveReasonAfterDelay TextDocumentSaveReason = 2 // When the editor lost focus. TextDocumentSaveReasonFocusOut TextDocumentSaveReason = 3 ) // The kind of a completion entry. type CompletionItemKind uint32 const ( CompletionItemKindText CompletionItemKind = 1 CompletionItemKindMethod CompletionItemKind = 2 CompletionItemKindFunction CompletionItemKind = 3 CompletionItemKindConstructor CompletionItemKind = 4 CompletionItemKindField CompletionItemKind = 5 CompletionItemKindVariable CompletionItemKind = 6 CompletionItemKindClass CompletionItemKind = 7 CompletionItemKindInterface CompletionItemKind = 8 CompletionItemKindModule CompletionItemKind = 9 CompletionItemKindProperty CompletionItemKind = 10 CompletionItemKindUnit CompletionItemKind = 11 CompletionItemKindValue CompletionItemKind = 12 CompletionItemKindEnum CompletionItemKind = 13 CompletionItemKindKeyword CompletionItemKind = 14 CompletionItemKindSnippet CompletionItemKind = 15 CompletionItemKindColor CompletionItemKind = 16 CompletionItemKindFile CompletionItemKind = 17 CompletionItemKindReference CompletionItemKind = 18 CompletionItemKindFolder CompletionItemKind = 19 CompletionItemKindEnumMember CompletionItemKind = 20 CompletionItemKindConstant CompletionItemKind = 21 CompletionItemKindStruct CompletionItemKind = 22 CompletionItemKindEvent CompletionItemKind = 23 CompletionItemKindOperator CompletionItemKind = 24 CompletionItemKindTypeParameter CompletionItemKind = 25 ) // Completion item tags are extra annotations that tweak the rendering of a completion // item. // // Since: 3.15.0 type CompletionItemTag uint32 const ( // Render a completion as obsolete, usually using a strike-out. CompletionItemTagDeprecated CompletionItemTag = 1 ) // Defines whether the insert text in a completion item should be interpreted as // plain text or a snippet. type InsertTextFormat uint32 const ( // The primary text to be inserted is treated as a plain string. InsertTextFormatPlainText InsertTextFormat = 1 // The primary text to be inserted is treated as a snippet. // // A snippet can define tab stops and placeholders with `$1`, `$2` // and `${3:foo}`. `$0` defines the final tab stop, it defaults to // the end of the snippet. Placeholders with equal identifiers are linked, // that is typing in one will update others too. // // See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax InsertTextFormatSnippet InsertTextFormat = 2 ) // How whitespace and indentation is handled during completion // item insertion. // // Since: 3.16.0 type InsertTextMode uint32 const ( // The insertion or replace strings is taken as it is. If the // value is multi line the lines below the cursor will be // inserted using the indentation defined in the string value. // The client will not apply any kind of adjustments to the // string. InsertTextModeasIs InsertTextMode = 1 // The editor adjusts leading whitespace of new lines so that // they match the indentation up to the cursor of the line for // which the item is accepted. // // Consider a line like this: <2tabs><3tabs>foo. Accepting a // multi line completion item is indented using 2 tabs and all // following lines inserted will be indented using 2 tabs as well. InsertTextModeadjustIndentation InsertTextMode = 2 ) // A document highlight kind. type DocumentHighlightKind uint32 const ( // A textual occurrence. DocumentHighlightKindText DocumentHighlightKind = 1 // Read-access of a symbol, like reading a variable. DocumentHighlightKindRead DocumentHighlightKind = 2 // Write-access of a symbol, like writing to a variable. DocumentHighlightKindWrite DocumentHighlightKind = 3 ) // A set of predefined code action kinds type CodeActionKind string const ( // Empty kind. CodeActionKindEmpty CodeActionKind = "" // Base kind for quickfix actions: 'quickfix' CodeActionKindQuickFix CodeActionKind = "quickfix" // Base kind for refactoring actions: 'refactor' CodeActionKindRefactor CodeActionKind = "refactor" // Base kind for refactoring extraction actions: 'refactor.extract' // // Example extract actions: // // - Extract method // - Extract function // - Extract variable // - Extract interface from class // - ... CodeActionKindRefactorExtract CodeActionKind = "refactor.extract" // Base kind for refactoring inline actions: 'refactor.inline' // // Example inline actions: // // - Inline function // - Inline variable // - Inline constant // - ... CodeActionKindRefactorInline CodeActionKind = "refactor.inline" // Base kind for refactoring move actions: `refactor.move` // // Example move actions: // // - Move a function to a new file // - Move a property between classes // - Move method to base class // - ... // // Since: 3.18.0 // // Proposed. CodeActionKindRefactorMove CodeActionKind = "refactor.move" // Base kind for refactoring rewrite actions: 'refactor.rewrite' // // Example rewrite actions: // // - Convert JavaScript function to class // - Add or remove parameter // - Encapsulate field // - Make method static // - Move method to base class // - ... CodeActionKindRefactorRewrite CodeActionKind = "refactor.rewrite" // Base kind for source actions: `source` // // Source code actions apply to the entire file. CodeActionKindSource CodeActionKind = "source" // Base kind for an organize imports source action: `source.organizeImports` CodeActionKindSourceOrganizeImports CodeActionKind = "source.organizeImports" // Base kind for auto-fix source actions: `source.fixAll`. // // Fix all actions automatically fix errors that have a clear fix that do not require user input. // They should not suppress errors or perform unsafe fixes such as generating new types or classes. // // Since: 3.15.0 CodeActionKindSourceFixAll CodeActionKind = "source.fixAll" // Base kind for all code actions applying to the entire notebook's scope. CodeActionKinds using // this should always begin with `notebook.` // // Since: 3.18.0 CodeActionKindNotebook CodeActionKind = "notebook" ) // Code action tags are extra annotations that tweak the behavior of a code action. // // Since: 3.18.0 - proposed type CodeActionTag uint32 const ( // Marks the code action as LLM-generated. CodeActionTagLLMGenerated CodeActionTag = 1 ) type TraceValue string const ( // Turn tracing off. TraceValueOff TraceValue = "off" // Trace messages only. TraceValueMessages TraceValue = "messages" // Verbose message tracing. TraceValueVerbose TraceValue = "verbose" ) // Describes the content type that a client supports in various // result literals like `Hover`, `ParameterInfo` or `CompletionItem`. // // Please note that `MarkupKinds` must not start with a `$`. This kinds // are reserved for internal usage. type MarkupKind string const ( // Plain text is supported as a content format MarkupKindPlainText MarkupKind = "plaintext" // Markdown is supported as a content format MarkupKindMarkdown MarkupKind = "markdown" ) // Predefined Language kinds // // Since: 3.18.0 type LanguageKind string const ( LanguageKindABAP LanguageKind = "abap" LanguageKindWindowsBat LanguageKind = "bat" LanguageKindBibTeX LanguageKind = "bibtex" LanguageKindClojure LanguageKind = "clojure" LanguageKindCoffeescript LanguageKind = "coffeescript" LanguageKindC LanguageKind = "c" LanguageKindCPP LanguageKind = "cpp" LanguageKindCSharp LanguageKind = "csharp" LanguageKindCSS LanguageKind = "css" // Since: 3.18.0 // // Proposed. LanguageKindD LanguageKind = "d" // Since: 3.18.0 // // Proposed. LanguageKindDelphi LanguageKind = "pascal" LanguageKindDiff LanguageKind = "diff" LanguageKindDart LanguageKind = "dart" LanguageKindDockerfile LanguageKind = "dockerfile" LanguageKindElixir LanguageKind = "elixir" LanguageKindErlang LanguageKind = "erlang" LanguageKindFSharp LanguageKind = "fsharp" LanguageKindGitCommit LanguageKind = "git-commit" LanguageKindGitRebase LanguageKind = "rebase" LanguageKindGo LanguageKind = "go" LanguageKindGroovy LanguageKind = "groovy" LanguageKindHandlebars LanguageKind = "handlebars" LanguageKindHaskell LanguageKind = "haskell" LanguageKindHTML LanguageKind = "html" LanguageKindIni LanguageKind = "ini" LanguageKindJava LanguageKind = "java" LanguageKindJavaScript LanguageKind = "javascript" LanguageKindJavaScriptReact LanguageKind = "javascriptreact" LanguageKindJSON LanguageKind = "json" LanguageKindLaTeX LanguageKind = "latex" LanguageKindLess LanguageKind = "less" LanguageKindLua LanguageKind = "lua" LanguageKindMakefile LanguageKind = "makefile" LanguageKindMarkdown LanguageKind = "markdown" LanguageKindObjectiveC LanguageKind = "objective-c" LanguageKindObjectiveCPP LanguageKind = "objective-cpp" // Since: 3.18.0 // // Proposed. LanguageKindPascal LanguageKind = "pascal" LanguageKindPerl LanguageKind = "perl" LanguageKindPerl6 LanguageKind = "perl6" LanguageKindPHP LanguageKind = "php" LanguageKindPowershell LanguageKind = "powershell" LanguageKindPug LanguageKind = "jade" LanguageKindPython LanguageKind = "python" LanguageKindR LanguageKind = "r" LanguageKindRazor LanguageKind = "razor" LanguageKindRuby LanguageKind = "ruby" LanguageKindRust LanguageKind = "rust" LanguageKindSCSS LanguageKind = "scss" LanguageKindSASS LanguageKind = "sass" LanguageKindScala LanguageKind = "scala" LanguageKindShaderLab LanguageKind = "shaderlab" LanguageKindShellScript LanguageKind = "shellscript" LanguageKindSQL LanguageKind = "sql" LanguageKindSwift LanguageKind = "swift" LanguageKindTypeScript LanguageKind = "typescript" LanguageKindTypeScriptReact LanguageKind = "typescriptreact" LanguageKindTeX LanguageKind = "tex" LanguageKindVisualBasic LanguageKind = "vb" LanguageKindXML LanguageKind = "xml" LanguageKindXSL LanguageKind = "xsl" LanguageKindYAML LanguageKind = "yaml" ) // Describes how an provider was triggered. // // Since: 3.18.0 // // Proposed. type InlineCompletionTriggerKind uint32 const ( // Completion was triggered explicitly by a user gesture. InlineCompletionTriggerKindInvoked InlineCompletionTriggerKind = 1 // Completion was triggered automatically while editing. InlineCompletionTriggerKindAutomatic InlineCompletionTriggerKind = 2 ) // A set of predefined position encoding kinds. // // Since: 3.17.0 type PositionEncodingKind string const ( // Character offsets count UTF-8 code units (e.g. bytes). PositionEncodingKindUTF8 PositionEncodingKind = "utf-8" // Character offsets count UTF-16 code units. // // This is the default and must always be supported // by servers PositionEncodingKindUTF16 PositionEncodingKind = "utf-16" // Character offsets count UTF-32 code units. // // Implementation note: these are the same as Unicode codepoints, // so this `PositionEncodingKind` may also be used for an // encoding-agnostic representation of character offsets. PositionEncodingKindUTF32 PositionEncodingKind = "utf-32" ) // The file event type type FileChangeType uint32 const ( // The file got created. FileChangeTypeCreated FileChangeType = 1 // The file got changed. FileChangeTypeChanged FileChangeType = 2 // The file got deleted. FileChangeTypeDeleted FileChangeType = 3 ) type WatchKind uint32 const ( // Interested in create events. WatchKindCreate WatchKind = 1 // Interested in change events WatchKindChange WatchKind = 2 // Interested in delete events WatchKindDelete WatchKind = 4 ) // The diagnostic's severity. type DiagnosticSeverity uint32 const ( // Reports an error. DiagnosticSeverityError DiagnosticSeverity = 1 // Reports a warning. DiagnosticSeverityWarning DiagnosticSeverity = 2 // Reports an information. DiagnosticSeverityInformation DiagnosticSeverity = 3 // Reports a hint. DiagnosticSeverityHint DiagnosticSeverity = 4 ) // The diagnostic tags. // // Since: 3.15.0 type DiagnosticTag uint32 const ( // Unused or unnecessary code. // // Clients are allowed to render diagnostics with this tag faded out instead of having // an error squiggle. DiagnosticTagUnnecessary DiagnosticTag = 1 // Deprecated or obsolete code. // // Clients are allowed to rendered diagnostics with this tag strike through. DiagnosticTagDeprecated DiagnosticTag = 2 ) // How a completion was triggered type CompletionTriggerKind uint32 const ( // Completion was triggered by typing an identifier (24x7 code // complete), manual invocation (e.g Ctrl+Space) or via API. CompletionTriggerKindInvoked CompletionTriggerKind = 1 // Completion was triggered by a trigger character specified by // the `triggerCharacters` properties of the `CompletionRegistrationOptions`. CompletionTriggerKindTriggerCharacter CompletionTriggerKind = 2 // Completion was re-triggered as current completion list is incomplete CompletionTriggerKindTriggerForIncompleteCompletions CompletionTriggerKind = 3 ) // Defines how values from a set of defaults and an individual item will be // merged. // // Since: 3.18.0 type ApplyKind uint32 const ( // The value from the individual item (if provided and not `null`) will be // used instead of the default. ApplyKindReplace ApplyKind = 1 // The value from the item will be merged with the default. // // The specific rules for mergeing values are defined against each field // that supports merging. ApplyKindMerge ApplyKind = 2 ) // How a signature help was triggered. // // Since: 3.15.0 type SignatureHelpTriggerKind uint32 const ( // Signature help was invoked manually by the user or by a command. SignatureHelpTriggerKindInvoked SignatureHelpTriggerKind = 1 // Signature help was triggered by a trigger character. SignatureHelpTriggerKindTriggerCharacter SignatureHelpTriggerKind = 2 // Signature help was triggered by the cursor moving or by the document content changing. SignatureHelpTriggerKindContentChange SignatureHelpTriggerKind = 3 ) // The reason why code actions were requested. // // Since: 3.17.0 type CodeActionTriggerKind uint32 const ( // Code actions were explicitly requested by the user or by an extension. CodeActionTriggerKindInvoked CodeActionTriggerKind = 1 // Code actions were requested automatically. // // This typically happens when current selection in a file changes, but can // also be triggered when file content changes. CodeActionTriggerKindAutomatic CodeActionTriggerKind = 2 ) // A pattern kind describing if a glob pattern matches a file a folder or // both. // // Since: 3.16.0 type FileOperationPatternKind string const ( // The pattern matches a file only. FileOperationPatternKindfile FileOperationPatternKind = "file" // The pattern matches a folder only. FileOperationPatternKindfolder FileOperationPatternKind = "folder" ) // A notebook cell kind. // // Since: 3.17.0 type NotebookCellKind uint32 const ( // A markup-cell is formatted source that is used for display. NotebookCellKindMarkup NotebookCellKind = 1 // A code-cell is source code. NotebookCellKindCode NotebookCellKind = 2 ) type ResourceOperationKind string const ( // Supports creating new files and folders. ResourceOperationKindCreate ResourceOperationKind = "create" // Supports renaming existing files and folders. ResourceOperationKindRename ResourceOperationKind = "rename" // Supports deleting existing files and folders. ResourceOperationKindDelete ResourceOperationKind = "delete" ) type FailureHandlingKind string const ( // Applying the workspace change is simply aborted if one of the changes provided // fails. All operations executed before the failing operation stay executed. FailureHandlingKindAbort FailureHandlingKind = "abort" // All operations are executed transactional. That means they either all // succeed or no changes at all are applied to the workspace. FailureHandlingKindTransactional FailureHandlingKind = "transactional" // If the workspace edit contains only textual file changes they are executed transactional. // If resource changes (create, rename or delete file) are part of the change the failure // handling strategy is abort. FailureHandlingKindTextOnlyTransactional FailureHandlingKind = "textOnlyTransactional" // The client tries to undo the operations already executed. But there is no // guarantee that this is succeeding. FailureHandlingKindUndo FailureHandlingKind = "undo" ) type PrepareSupportDefaultBehavior uint32 const ( // The client's default behavior is to select the identifier // according the to language's syntax rule. PrepareSupportDefaultBehaviorIdentifier PrepareSupportDefaultBehavior = 1 ) type TokenFormat string const ( TokenFormatRelative TokenFormat = "relative" ) func unmarshalParams(method Method, data []byte) (any, error) { switch method { case MethodTextDocumentImplementation: return unmarshalPtrTo[ImplementationParams](data) case MethodTextDocumentTypeDefinition: return unmarshalPtrTo[TypeDefinitionParams](data) case MethodWorkspaceWorkspaceFolders: return unmarshalEmpty(data) case MethodWorkspaceConfiguration: return unmarshalPtrTo[ConfigurationParams](data) case MethodTextDocumentDocumentColor: return unmarshalPtrTo[DocumentColorParams](data) case MethodTextDocumentColorPresentation: return unmarshalPtrTo[ColorPresentationParams](data) case MethodTextDocumentFoldingRange: return unmarshalPtrTo[FoldingRangeParams](data) case MethodWorkspaceFoldingRangeRefresh: return unmarshalEmpty(data) case MethodTextDocumentDeclaration: return unmarshalPtrTo[DeclarationParams](data) case MethodTextDocumentSelectionRange: return unmarshalPtrTo[SelectionRangeParams](data) case MethodWindowWorkDoneProgressCreate: return unmarshalPtrTo[WorkDoneProgressCreateParams](data) case MethodTextDocumentPrepareCallHierarchy: return unmarshalPtrTo[CallHierarchyPrepareParams](data) case MethodCallHierarchyIncomingCalls: return unmarshalPtrTo[CallHierarchyIncomingCallsParams](data) case MethodCallHierarchyOutgoingCalls: return unmarshalPtrTo[CallHierarchyOutgoingCallsParams](data) case MethodTextDocumentSemanticTokensFull: return unmarshalPtrTo[SemanticTokensParams](data) case MethodTextDocumentSemanticTokensFullDelta: return unmarshalPtrTo[SemanticTokensDeltaParams](data) case MethodTextDocumentSemanticTokensRange: return unmarshalPtrTo[SemanticTokensRangeParams](data) case MethodWorkspaceSemanticTokensRefresh: return unmarshalEmpty(data) case MethodWindowShowDocument: return unmarshalPtrTo[ShowDocumentParams](data) case MethodTextDocumentLinkedEditingRange: return unmarshalPtrTo[LinkedEditingRangeParams](data) case MethodWorkspaceWillCreateFiles: return unmarshalPtrTo[CreateFilesParams](data) case MethodWorkspaceWillRenameFiles: return unmarshalPtrTo[RenameFilesParams](data) case MethodWorkspaceWillDeleteFiles: return unmarshalPtrTo[DeleteFilesParams](data) case MethodTextDocumentMoniker: return unmarshalPtrTo[MonikerParams](data) case MethodTextDocumentPrepareTypeHierarchy: return unmarshalPtrTo[TypeHierarchyPrepareParams](data) case MethodTypeHierarchySupertypes: return unmarshalPtrTo[TypeHierarchySupertypesParams](data) case MethodTypeHierarchySubtypes: return unmarshalPtrTo[TypeHierarchySubtypesParams](data) case MethodTextDocumentInlineValue: return unmarshalPtrTo[InlineValueParams](data) case MethodWorkspaceInlineValueRefresh: return unmarshalEmpty(data) case MethodTextDocumentInlayHint: return unmarshalPtrTo[InlayHintParams](data) case MethodInlayHintResolve: return unmarshalPtrTo[InlayHint](data) case MethodWorkspaceInlayHintRefresh: return unmarshalEmpty(data) case MethodTextDocumentDiagnostic: return unmarshalPtrTo[DocumentDiagnosticParams](data) case MethodWorkspaceDiagnostic: return unmarshalPtrTo[WorkspaceDiagnosticParams](data) case MethodWorkspaceDiagnosticRefresh: return unmarshalEmpty(data) case MethodTextDocumentInlineCompletion: return unmarshalPtrTo[InlineCompletionParams](data) case MethodWorkspaceTextDocumentContent: return unmarshalPtrTo[TextDocumentContentParams](data) case MethodWorkspaceTextDocumentContentRefresh: return unmarshalPtrTo[TextDocumentContentRefreshParams](data) case MethodClientRegisterCapability: return unmarshalPtrTo[RegistrationParams](data) case MethodClientUnregisterCapability: return unmarshalPtrTo[UnregistrationParams](data) case MethodInitialize: return unmarshalPtrTo[InitializeParams](data) case MethodShutdown: return unmarshalEmpty(data) case MethodWindowShowMessageRequest: return unmarshalPtrTo[ShowMessageRequestParams](data) case MethodTextDocumentWillSaveWaitUntil: return unmarshalPtrTo[WillSaveTextDocumentParams](data) case MethodTextDocumentCompletion: return unmarshalPtrTo[CompletionParams](data) case MethodCompletionItemResolve: return unmarshalPtrTo[CompletionItem](data) case MethodTextDocumentHover: return unmarshalPtrTo[HoverParams](data) case MethodTextDocumentSignatureHelp: return unmarshalPtrTo[SignatureHelpParams](data) case MethodTextDocumentDefinition: return unmarshalPtrTo[DefinitionParams](data) case MethodTextDocumentReferences: return unmarshalPtrTo[ReferenceParams](data) case MethodTextDocumentDocumentHighlight: return unmarshalPtrTo[DocumentHighlightParams](data) case MethodTextDocumentDocumentSymbol: return unmarshalPtrTo[DocumentSymbolParams](data) case MethodTextDocumentCodeAction: return unmarshalPtrTo[CodeActionParams](data) case MethodCodeActionResolve: return unmarshalPtrTo[CodeAction](data) case MethodWorkspaceSymbol: return unmarshalPtrTo[WorkspaceSymbolParams](data) case MethodWorkspaceSymbolResolve: return unmarshalPtrTo[WorkspaceSymbol](data) case MethodTextDocumentCodeLens: return unmarshalPtrTo[CodeLensParams](data) case MethodCodeLensResolve: return unmarshalPtrTo[CodeLens](data) case MethodWorkspaceCodeLensRefresh: return unmarshalEmpty(data) case MethodTextDocumentDocumentLink: return unmarshalPtrTo[DocumentLinkParams](data) case MethodDocumentLinkResolve: return unmarshalPtrTo[DocumentLink](data) case MethodTextDocumentFormatting: return unmarshalPtrTo[DocumentFormattingParams](data) case MethodTextDocumentRangeFormatting: return unmarshalPtrTo[DocumentRangeFormattingParams](data) case MethodTextDocumentRangesFormatting: return unmarshalPtrTo[DocumentRangesFormattingParams](data) case MethodTextDocumentOnTypeFormatting: return unmarshalPtrTo[DocumentOnTypeFormattingParams](data) case MethodTextDocumentRename: return unmarshalPtrTo[RenameParams](data) case MethodTextDocumentPrepareRename: return unmarshalPtrTo[PrepareRenameParams](data) case MethodWorkspaceExecuteCommand: return unmarshalPtrTo[ExecuteCommandParams](data) case MethodWorkspaceApplyEdit: return unmarshalPtrTo[ApplyWorkspaceEditParams](data) case MethodWorkspaceDidChangeWorkspaceFolders: return unmarshalPtrTo[DidChangeWorkspaceFoldersParams](data) case MethodWindowWorkDoneProgressCancel: return unmarshalPtrTo[WorkDoneProgressCancelParams](data) case MethodWorkspaceDidCreateFiles: return unmarshalPtrTo[CreateFilesParams](data) case MethodWorkspaceDidRenameFiles: return unmarshalPtrTo[RenameFilesParams](data) case MethodWorkspaceDidDeleteFiles: return unmarshalPtrTo[DeleteFilesParams](data) case MethodNotebookDocumentDidOpen: return unmarshalPtrTo[DidOpenNotebookDocumentParams](data) case MethodNotebookDocumentDidChange: return unmarshalPtrTo[DidChangeNotebookDocumentParams](data) case MethodNotebookDocumentDidSave: return unmarshalPtrTo[DidSaveNotebookDocumentParams](data) case MethodNotebookDocumentDidClose: return unmarshalPtrTo[DidCloseNotebookDocumentParams](data) case MethodInitialized: return unmarshalPtrTo[InitializedParams](data) case MethodExit: return unmarshalEmpty(data) case MethodWorkspaceDidChangeConfiguration: return unmarshalPtrTo[DidChangeConfigurationParams](data) case MethodWindowShowMessage: return unmarshalPtrTo[ShowMessageParams](data) case MethodWindowLogMessage: return unmarshalPtrTo[LogMessageParams](data) case MethodTelemetryEvent: return unmarshalAny(data) case MethodTextDocumentDidOpen: return unmarshalPtrTo[DidOpenTextDocumentParams](data) case MethodTextDocumentDidChange: return unmarshalPtrTo[DidChangeTextDocumentParams](data) case MethodTextDocumentDidClose: return unmarshalPtrTo[DidCloseTextDocumentParams](data) case MethodTextDocumentDidSave: return unmarshalPtrTo[DidSaveTextDocumentParams](data) case MethodTextDocumentWillSave: return unmarshalPtrTo[WillSaveTextDocumentParams](data) case MethodWorkspaceDidChangeWatchedFiles: return unmarshalPtrTo[DidChangeWatchedFilesParams](data) case MethodTextDocumentPublishDiagnostics: return unmarshalPtrTo[PublishDiagnosticsParams](data) case MethodSetTrace: return unmarshalPtrTo[SetTraceParams](data) case MethodLogTrace: return unmarshalPtrTo[LogTraceParams](data) case MethodCancelRequest: return unmarshalPtrTo[CancelParams](data) case MethodProgress: return unmarshalPtrTo[ProgressParams](data) default: return unmarshalAny(data) } } // Methods const ( // A request to resolve the implementation locations of a symbol at a given text // document position. The request's parameter is of type TextDocumentPositionParams // the response is of type Definition or a Thenable that resolves to such. MethodTextDocumentImplementation Method = "textDocument/implementation" // A request to resolve the type definition locations of a symbol at a given text // document position. The request's parameter is of type TextDocumentPositionParams // the response is of type Definition or a Thenable that resolves to such. MethodTextDocumentTypeDefinition Method = "textDocument/typeDefinition" // The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders. MethodWorkspaceWorkspaceFolders Method = "workspace/workspaceFolders" // The 'workspace/configuration' request is sent from the server to the client to fetch a certain // configuration setting. // // This pull model replaces the old push model were the client signaled configuration change via an // event. If the server still needs to react to configuration changes (since the server caches the // result of `workspace/configuration` requests) the server should register for an empty configuration // change event and empty the cache if such an event is received. MethodWorkspaceConfiguration Method = "workspace/configuration" // A request to list all color symbols found in a given text document. The request's // parameter is of type DocumentColorParams the // response is of type ColorInformation[] or a Thenable // that resolves to such. MethodTextDocumentDocumentColor Method = "textDocument/documentColor" // A request to list all presentation for a color. The request's // parameter is of type ColorPresentationParams the // response is of type ColorInformation[] or a Thenable // that resolves to such. MethodTextDocumentColorPresentation Method = "textDocument/colorPresentation" // A request to provide folding ranges in a document. The request's // parameter is of type FoldingRangeParams, the // response is of type FoldingRangeList or a Thenable // that resolves to such. MethodTextDocumentFoldingRange Method = "textDocument/foldingRange" // Since: 3.18.0 // // Proposed. MethodWorkspaceFoldingRangeRefresh Method = "workspace/foldingRange/refresh" // A request to resolve the type definition locations of a symbol at a given text // document position. The request's parameter is of type TextDocumentPositionParams // the response is of type Declaration or a typed array of DeclarationLink // or a Thenable that resolves to such. MethodTextDocumentDeclaration Method = "textDocument/declaration" // A request to provide selection ranges in a document. The request's // parameter is of type SelectionRangeParams, the // response is of type SelectionRange[] or a Thenable // that resolves to such. MethodTextDocumentSelectionRange Method = "textDocument/selectionRange" // The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress // reporting from the server. MethodWindowWorkDoneProgressCreate Method = "window/workDoneProgress/create" // A request to result a `CallHierarchyItem` in a document at a given position. // Can be used as an input to an incoming or outgoing call hierarchy. // // Since: 3.16.0 MethodTextDocumentPrepareCallHierarchy Method = "textDocument/prepareCallHierarchy" // A request to resolve the incoming calls for a given `CallHierarchyItem`. // // Since: 3.16.0 MethodCallHierarchyIncomingCalls Method = "callHierarchy/incomingCalls" // A request to resolve the outgoing calls for a given `CallHierarchyItem`. // // Since: 3.16.0 MethodCallHierarchyOutgoingCalls Method = "callHierarchy/outgoingCalls" // Since: 3.16.0 MethodTextDocumentSemanticTokensFull Method = "textDocument/semanticTokens/full" // Since: 3.16.0 MethodTextDocumentSemanticTokensFullDelta Method = "textDocument/semanticTokens/full/delta" // Since: 3.16.0 MethodTextDocumentSemanticTokensRange Method = "textDocument/semanticTokens/range" // Since: 3.16.0 MethodWorkspaceSemanticTokensRefresh Method = "workspace/semanticTokens/refresh" // A request to show a document. This request might open an // external program depending on the value of the URI to open. // For example a request to open `https://code.visualstudio.com/` // will very likely open the URI in a WEB browser. // // Since: 3.16.0 MethodWindowShowDocument Method = "window/showDocument" // A request to provide ranges that can be edited together. // // Since: 3.16.0 MethodTextDocumentLinkedEditingRange Method = "textDocument/linkedEditingRange" // The will create files request is sent from the client to the server before files are actually // created as long as the creation is triggered from within the client. // // The request can return a `WorkspaceEdit` which will be applied to workspace before the // files are created. Hence the `WorkspaceEdit` can not manipulate the content of the file // to be created. // // Since: 3.16.0 MethodWorkspaceWillCreateFiles Method = "workspace/willCreateFiles" // The will rename files request is sent from the client to the server before files are actually // renamed as long as the rename is triggered from within the client. // // Since: 3.16.0 MethodWorkspaceWillRenameFiles Method = "workspace/willRenameFiles" // The did delete files notification is sent from the client to the server when // files were deleted from within the client. // // Since: 3.16.0 MethodWorkspaceWillDeleteFiles Method = "workspace/willDeleteFiles" // A request to get the moniker of a symbol at a given text document position. // The request parameter is of type TextDocumentPositionParams. // The response is of type Moniker[] or `null`. MethodTextDocumentMoniker Method = "textDocument/moniker" // A request to result a `TypeHierarchyItem` in a document at a given position. // Can be used as an input to a subtypes or supertypes type hierarchy. // // Since: 3.17.0 MethodTextDocumentPrepareTypeHierarchy Method = "textDocument/prepareTypeHierarchy" // A request to resolve the supertypes for a given `TypeHierarchyItem`. // // Since: 3.17.0 MethodTypeHierarchySupertypes Method = "typeHierarchy/supertypes" // A request to resolve the subtypes for a given `TypeHierarchyItem`. // // Since: 3.17.0 MethodTypeHierarchySubtypes Method = "typeHierarchy/subtypes" // A request to provide inline values in a document. The request's parameter is of // type InlineValueParams, the response is of type // InlineValue[] or a Thenable that resolves to such. // // Since: 3.17.0 MethodTextDocumentInlineValue Method = "textDocument/inlineValue" // Since: 3.17.0 MethodWorkspaceInlineValueRefresh Method = "workspace/inlineValue/refresh" // A request to provide inlay hints in a document. The request's parameter is of // type InlayHintsParams, the response is of type // InlayHint[] or a Thenable that resolves to such. // // Since: 3.17.0 MethodTextDocumentInlayHint Method = "textDocument/inlayHint" // A request to resolve additional properties for an inlay hint. // The request's parameter is of type InlayHint, the response is // of type InlayHint or a Thenable that resolves to such. // // Since: 3.17.0 MethodInlayHintResolve Method = "inlayHint/resolve" // Since: 3.17.0 MethodWorkspaceInlayHintRefresh Method = "workspace/inlayHint/refresh" // The document diagnostic request definition. // // Since: 3.17.0 MethodTextDocumentDiagnostic Method = "textDocument/diagnostic" // The workspace diagnostic request definition. // // Since: 3.17.0 MethodWorkspaceDiagnostic Method = "workspace/diagnostic" // The diagnostic refresh request definition. // // Since: 3.17.0 MethodWorkspaceDiagnosticRefresh Method = "workspace/diagnostic/refresh" // A request to provide inline completions in a document. The request's parameter is of // type InlineCompletionParams, the response is of type // InlineCompletion[] or a Thenable that resolves to such. // // Since: 3.18.0 // // Proposed. MethodTextDocumentInlineCompletion Method = "textDocument/inlineCompletion" // The `workspace/textDocumentContent` request is sent from the client to the // server to request the content of a text document. // // Since: 3.18.0 // // Proposed. MethodWorkspaceTextDocumentContent Method = "workspace/textDocumentContent" // The `workspace/textDocumentContent` request is sent from the server to the client to refresh // the content of a specific text document. // // Since: 3.18.0 // // Proposed. MethodWorkspaceTextDocumentContentRefresh Method = "workspace/textDocumentContent/refresh" // The `client/registerCapability` request is sent from the server to the client to register a new capability // handler on the client side. MethodClientRegisterCapability Method = "client/registerCapability" // The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability // handler on the client side. MethodClientUnregisterCapability Method = "client/unregisterCapability" // The initialize request is sent from the client to the server. // It is sent once as the request after starting up the server. // The requests parameter is of type InitializeParams // the response if of type InitializeResult of a Thenable that // resolves to such. MethodInitialize Method = "initialize" // A shutdown request is sent from the client to the server. // It is sent once when the client decides to shutdown the // server. The only notification that is sent after a shutdown request // is the exit event. MethodShutdown Method = "shutdown" // The show message request is sent from the server to the client to show a message // and a set of options actions to the user. MethodWindowShowMessageRequest Method = "window/showMessageRequest" // A document will save request is sent from the client to the server before // the document is actually saved. The request can return an array of TextEdits // which will be applied to the text document before it is saved. Please note that // clients might drop results if computing the text edits took too long or if a // server constantly fails on this request. This is done to keep the save fast and // reliable. MethodTextDocumentWillSaveWaitUntil Method = "textDocument/willSaveWaitUntil" // Request to request completion at a given text document position. The request's // parameter is of type TextDocumentPosition the response // is of type CompletionItem[] or CompletionList // or a Thenable that resolves to such. // // The request can delay the computation of the `detail` // and `documentation` properties to the `completionItem/resolve` // request. However, properties that are needed for the initial sorting and filtering, like `sortText`, // `filterText`, `insertText`, and `textEdit`, must not be changed during resolve. MethodTextDocumentCompletion Method = "textDocument/completion" // Request to resolve additional information for a given completion item.The request's // parameter is of type CompletionItem the response // is of type CompletionItem or a Thenable that resolves to such. MethodCompletionItemResolve Method = "completionItem/resolve" // Request to request hover information at a given text document position. The request's // parameter is of type TextDocumentPosition the response is of // type Hover or a Thenable that resolves to such. MethodTextDocumentHover Method = "textDocument/hover" MethodTextDocumentSignatureHelp Method = "textDocument/signatureHelp" // A request to resolve the definition location of a symbol at a given text // document position. The request's parameter is of type TextDocumentPosition // the response is of either type Definition or a typed array of // DefinitionLink or a Thenable that resolves to such. MethodTextDocumentDefinition Method = "textDocument/definition" // A request to resolve project-wide references for the symbol denoted // by the given text document position. The request's parameter is of // type ReferenceParams the response is of type // Location[] or a Thenable that resolves to such. MethodTextDocumentReferences Method = "textDocument/references" // Request to resolve a DocumentHighlight for a given // text document position. The request's parameter is of type TextDocumentPosition // the request response is an array of type DocumentHighlight // or a Thenable that resolves to such. MethodTextDocumentDocumentHighlight Method = "textDocument/documentHighlight" // A request to list all symbols found in a given text document. The request's // parameter is of type TextDocumentIdentifier the // response is of type SymbolInformation[] or a Thenable // that resolves to such. MethodTextDocumentDocumentSymbol Method = "textDocument/documentSymbol" // A request to provide commands for the given text document and range. MethodTextDocumentCodeAction Method = "textDocument/codeAction" // Request to resolve additional information for a given code action.The request's // parameter is of type CodeAction the response // is of type CodeAction or a Thenable that resolves to such. MethodCodeActionResolve Method = "codeAction/resolve" // A request to list project-wide symbols matching the query string given // by the WorkspaceSymbolParams. The response is // of type SymbolInformation[] or a Thenable that // resolves to such. // // Since: 3.17.0 - support for WorkspaceSymbol in the returned data. Clients // need to advertise support for WorkspaceSymbols via the client capability // `workspace.symbol.resolveSupport`. MethodWorkspaceSymbol Method = "workspace/symbol" // A request to resolve the range inside the workspace // symbol's location. // // Since: 3.17.0 MethodWorkspaceSymbolResolve Method = "workspaceSymbol/resolve" // A request to provide code lens for the given text document. MethodTextDocumentCodeLens Method = "textDocument/codeLens" // A request to resolve a command for a given code lens. MethodCodeLensResolve Method = "codeLens/resolve" // A request to refresh all code actions // // Since: 3.16.0 MethodWorkspaceCodeLensRefresh Method = "workspace/codeLens/refresh" // A request to provide document links MethodTextDocumentDocumentLink Method = "textDocument/documentLink" // Request to resolve additional information for a given document link. The request's // parameter is of type DocumentLink the response // is of type DocumentLink or a Thenable that resolves to such. MethodDocumentLinkResolve Method = "documentLink/resolve" // A request to format a whole document. MethodTextDocumentFormatting Method = "textDocument/formatting" // A request to format a range in a document. MethodTextDocumentRangeFormatting Method = "textDocument/rangeFormatting" // A request to format ranges in a document. // // Since: 3.18.0 // // Proposed. MethodTextDocumentRangesFormatting Method = "textDocument/rangesFormatting" // A request to format a document on type. MethodTextDocumentOnTypeFormatting Method = "textDocument/onTypeFormatting" // A request to rename a symbol. MethodTextDocumentRename Method = "textDocument/rename" // A request to test and perform the setup necessary for a rename. // // Since: 3.16 - support for default behavior MethodTextDocumentPrepareRename Method = "textDocument/prepareRename" // A request send from the client to the server to execute a command. The request might return // a workspace edit which the client will apply to the workspace. MethodWorkspaceExecuteCommand Method = "workspace/executeCommand" // A request sent from the server to the client to modified certain resources. MethodWorkspaceApplyEdit Method = "workspace/applyEdit" // The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace // folder configuration changes. MethodWorkspaceDidChangeWorkspaceFolders Method = "workspace/didChangeWorkspaceFolders" // The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress // initiated on the server side. MethodWindowWorkDoneProgressCancel Method = "window/workDoneProgress/cancel" // The did create files notification is sent from the client to the server when // files were created from within the client. // // Since: 3.16.0 MethodWorkspaceDidCreateFiles Method = "workspace/didCreateFiles" // The did rename files notification is sent from the client to the server when // files were renamed from within the client. // // Since: 3.16.0 MethodWorkspaceDidRenameFiles Method = "workspace/didRenameFiles" // The will delete files request is sent from the client to the server before files are actually // deleted as long as the deletion is triggered from within the client. // // Since: 3.16.0 MethodWorkspaceDidDeleteFiles Method = "workspace/didDeleteFiles" // A notification sent when a notebook opens. // // Since: 3.17.0 MethodNotebookDocumentDidOpen Method = "notebookDocument/didOpen" MethodNotebookDocumentDidChange Method = "notebookDocument/didChange" // A notification sent when a notebook document is saved. // // Since: 3.17.0 MethodNotebookDocumentDidSave Method = "notebookDocument/didSave" // A notification sent when a notebook closes. // // Since: 3.17.0 MethodNotebookDocumentDidClose Method = "notebookDocument/didClose" // The initialized notification is sent from the client to the // server after the client is fully initialized and the server // is allowed to send requests from the server to the client. MethodInitialized Method = "initialized" // The exit event is sent from the client to the server to // ask the server to exit its process. MethodExit Method = "exit" // The configuration change notification is sent from the client to the server // when the client's configuration has changed. The notification contains // the changed configuration as defined by the language client. MethodWorkspaceDidChangeConfiguration Method = "workspace/didChangeConfiguration" // The show message notification is sent from a server to a client to ask // the client to display a particular message in the user interface. MethodWindowShowMessage Method = "window/showMessage" // The log message notification is sent from the server to the client to ask // the client to log a particular message. MethodWindowLogMessage Method = "window/logMessage" // The telemetry event notification is sent from the server to the client to ask // the client to log telemetry data. MethodTelemetryEvent Method = "telemetry/event" // The document open notification is sent from the client to the server to signal // newly opened text documents. The document's truth is now managed by the client // and the server must not try to read the document's truth using the document's // uri. Open in this sense means it is managed by the client. It doesn't necessarily // mean that its content is presented in an editor. An open notification must not // be sent more than once without a corresponding close notification send before. // This means open and close notification must be balanced and the max open count // is one. MethodTextDocumentDidOpen Method = "textDocument/didOpen" // The document change notification is sent from the client to the server to signal // changes to a text document. MethodTextDocumentDidChange Method = "textDocument/didChange" // The document close notification is sent from the client to the server when // the document got closed in the client. The document's truth now exists where // the document's uri points to (e.g. if the document's uri is a file uri the // truth now exists on disk). As with the open notification the close notification // is about managing the document's content. Receiving a close notification // doesn't mean that the document was open in an editor before. A close // notification requires a previous open notification to be sent. MethodTextDocumentDidClose Method = "textDocument/didClose" // The document save notification is sent from the client to the server when // the document got saved in the client. MethodTextDocumentDidSave Method = "textDocument/didSave" // A document will save notification is sent from the client to the server before // the document is actually saved. MethodTextDocumentWillSave Method = "textDocument/willSave" // The watched files notification is sent from the client to the server when // the client detects changes to file watched by the language client. MethodWorkspaceDidChangeWatchedFiles Method = "workspace/didChangeWatchedFiles" // Diagnostics notification are sent from the server to the client to signal // results of validation runs. MethodTextDocumentPublishDiagnostics Method = "textDocument/publishDiagnostics" MethodSetTrace Method = "$/setTrace" MethodLogTrace Method = "$/logTrace" MethodCancelRequest Method = "$/cancelRequest" MethodProgress Method = "$/progress" ) // Request response types // Response type for `textDocument/implementation` type ImplementationResponse = LocationOrLocationsOrDefinitionLinksOrNull // Type mapping info for `textDocument/implementation` var TextDocumentImplementationInfo = RequestInfo[*ImplementationParams, ImplementationResponse]{Method: MethodTextDocumentImplementation} // Response type for `textDocument/typeDefinition` type TypeDefinitionResponse = LocationOrLocationsOrDefinitionLinksOrNull // Type mapping info for `textDocument/typeDefinition` var TextDocumentTypeDefinitionInfo = RequestInfo[*TypeDefinitionParams, TypeDefinitionResponse]{Method: MethodTextDocumentTypeDefinition} // Response type for `workspace/workspaceFolders` type WorkspaceFoldersResponse = WorkspaceFoldersOrNull // Type mapping info for `workspace/workspaceFolders` var WorkspaceWorkspaceFoldersInfo = RequestInfo[any, WorkspaceFoldersResponse]{Method: MethodWorkspaceWorkspaceFolders} // Response type for `workspace/configuration` type ConfigurationResponse = []any // Type mapping info for `workspace/configuration` var WorkspaceConfigurationInfo = RequestInfo[*ConfigurationParams, ConfigurationResponse]{Method: MethodWorkspaceConfiguration} // Response type for `textDocument/documentColor` type DocumentColorResponse = []*ColorInformation // Type mapping info for `textDocument/documentColor` var TextDocumentDocumentColorInfo = RequestInfo[*DocumentColorParams, DocumentColorResponse]{Method: MethodTextDocumentDocumentColor} // Response type for `textDocument/colorPresentation` type ColorPresentationResponse = []*ColorPresentation // Type mapping info for `textDocument/colorPresentation` var TextDocumentColorPresentationInfo = RequestInfo[*ColorPresentationParams, ColorPresentationResponse]{Method: MethodTextDocumentColorPresentation} // Response type for `textDocument/foldingRange` type FoldingRangeResponse = FoldingRangesOrNull // Type mapping info for `textDocument/foldingRange` var TextDocumentFoldingRangeInfo = RequestInfo[*FoldingRangeParams, FoldingRangeResponse]{Method: MethodTextDocumentFoldingRange} // Response type for `workspace/foldingRange/refresh` type FoldingRangeRefreshResponse = Null // Type mapping info for `workspace/foldingRange/refresh` var WorkspaceFoldingRangeRefreshInfo = RequestInfo[any, FoldingRangeRefreshResponse]{Method: MethodWorkspaceFoldingRangeRefresh} // Response type for `textDocument/declaration` type DeclarationResponse = LocationOrLocationsOrDeclarationLinksOrNull // Type mapping info for `textDocument/declaration` var TextDocumentDeclarationInfo = RequestInfo[*DeclarationParams, DeclarationResponse]{Method: MethodTextDocumentDeclaration} // Response type for `textDocument/selectionRange` type SelectionRangeResponse = SelectionRangesOrNull // Type mapping info for `textDocument/selectionRange` var TextDocumentSelectionRangeInfo = RequestInfo[*SelectionRangeParams, SelectionRangeResponse]{Method: MethodTextDocumentSelectionRange} // Response type for `window/workDoneProgress/create` type WorkDoneProgressCreateResponse = Null // Type mapping info for `window/workDoneProgress/create` var WindowWorkDoneProgressCreateInfo = RequestInfo[*WorkDoneProgressCreateParams, WorkDoneProgressCreateResponse]{Method: MethodWindowWorkDoneProgressCreate} // Response type for `textDocument/prepareCallHierarchy` type CallHierarchyPrepareResponse = CallHierarchyItemsOrNull // Type mapping info for `textDocument/prepareCallHierarchy` var TextDocumentPrepareCallHierarchyInfo = RequestInfo[*CallHierarchyPrepareParams, CallHierarchyPrepareResponse]{Method: MethodTextDocumentPrepareCallHierarchy} // Response type for `callHierarchy/incomingCalls` type CallHierarchyIncomingCallsResponse = CallHierarchyIncomingCallsOrNull // Type mapping info for `callHierarchy/incomingCalls` var CallHierarchyIncomingCallsInfo = RequestInfo[*CallHierarchyIncomingCallsParams, CallHierarchyIncomingCallsResponse]{Method: MethodCallHierarchyIncomingCalls} // Response type for `callHierarchy/outgoingCalls` type CallHierarchyOutgoingCallsResponse = CallHierarchyOutgoingCallsOrNull // Type mapping info for `callHierarchy/outgoingCalls` var CallHierarchyOutgoingCallsInfo = RequestInfo[*CallHierarchyOutgoingCallsParams, CallHierarchyOutgoingCallsResponse]{Method: MethodCallHierarchyOutgoingCalls} // Response type for `textDocument/semanticTokens/full` type SemanticTokensResponse = SemanticTokensOrNull // Type mapping info for `textDocument/semanticTokens/full` var TextDocumentSemanticTokensFullInfo = RequestInfo[*SemanticTokensParams, SemanticTokensResponse]{Method: MethodTextDocumentSemanticTokensFull} // Response type for `textDocument/semanticTokens/full/delta` type SemanticTokensDeltaResponse = SemanticTokensOrSemanticTokensDeltaOrNull // Type mapping info for `textDocument/semanticTokens/full/delta` var TextDocumentSemanticTokensFullDeltaInfo = RequestInfo[*SemanticTokensDeltaParams, SemanticTokensDeltaResponse]{Method: MethodTextDocumentSemanticTokensFullDelta} // Response type for `textDocument/semanticTokens/range` type SemanticTokensRangeResponse = SemanticTokensOrNull // Type mapping info for `textDocument/semanticTokens/range` var TextDocumentSemanticTokensRangeInfo = RequestInfo[*SemanticTokensRangeParams, SemanticTokensRangeResponse]{Method: MethodTextDocumentSemanticTokensRange} // Response type for `workspace/semanticTokens/refresh` type SemanticTokensRefreshResponse = Null // Type mapping info for `workspace/semanticTokens/refresh` var WorkspaceSemanticTokensRefreshInfo = RequestInfo[any, SemanticTokensRefreshResponse]{Method: MethodWorkspaceSemanticTokensRefresh} // Response type for `window/showDocument` type ShowDocumentResponse = *ShowDocumentResult // Type mapping info for `window/showDocument` var WindowShowDocumentInfo = RequestInfo[*ShowDocumentParams, ShowDocumentResponse]{Method: MethodWindowShowDocument} // Response type for `textDocument/linkedEditingRange` type LinkedEditingRangeResponse = LinkedEditingRangesOrNull // Type mapping info for `textDocument/linkedEditingRange` var TextDocumentLinkedEditingRangeInfo = RequestInfo[*LinkedEditingRangeParams, LinkedEditingRangeResponse]{Method: MethodTextDocumentLinkedEditingRange} // Response type for `workspace/willCreateFiles` type WillCreateFilesResponse = WorkspaceEditOrNull // Type mapping info for `workspace/willCreateFiles` var WorkspaceWillCreateFilesInfo = RequestInfo[*CreateFilesParams, WillCreateFilesResponse]{Method: MethodWorkspaceWillCreateFiles} // Response type for `workspace/willRenameFiles` type WillRenameFilesResponse = WorkspaceEditOrNull // Type mapping info for `workspace/willRenameFiles` var WorkspaceWillRenameFilesInfo = RequestInfo[*RenameFilesParams, WillRenameFilesResponse]{Method: MethodWorkspaceWillRenameFiles} // Response type for `workspace/willDeleteFiles` type WillDeleteFilesResponse = WorkspaceEditOrNull // Type mapping info for `workspace/willDeleteFiles` var WorkspaceWillDeleteFilesInfo = RequestInfo[*DeleteFilesParams, WillDeleteFilesResponse]{Method: MethodWorkspaceWillDeleteFiles} // Response type for `textDocument/moniker` type MonikerResponse = MonikersOrNull // Type mapping info for `textDocument/moniker` var TextDocumentMonikerInfo = RequestInfo[*MonikerParams, MonikerResponse]{Method: MethodTextDocumentMoniker} // Response type for `textDocument/prepareTypeHierarchy` type TypeHierarchyPrepareResponse = TypeHierarchyItemsOrNull // Type mapping info for `textDocument/prepareTypeHierarchy` var TextDocumentPrepareTypeHierarchyInfo = RequestInfo[*TypeHierarchyPrepareParams, TypeHierarchyPrepareResponse]{Method: MethodTextDocumentPrepareTypeHierarchy} // Response type for `typeHierarchy/supertypes` type TypeHierarchySupertypesResponse = TypeHierarchyItemsOrNull // Type mapping info for `typeHierarchy/supertypes` var TypeHierarchySupertypesInfo = RequestInfo[*TypeHierarchySupertypesParams, TypeHierarchySupertypesResponse]{Method: MethodTypeHierarchySupertypes} // Response type for `typeHierarchy/subtypes` type TypeHierarchySubtypesResponse = TypeHierarchyItemsOrNull // Type mapping info for `typeHierarchy/subtypes` var TypeHierarchySubtypesInfo = RequestInfo[*TypeHierarchySubtypesParams, TypeHierarchySubtypesResponse]{Method: MethodTypeHierarchySubtypes} // Response type for `textDocument/inlineValue` type InlineValueResponse = InlineValuesOrNull // Type mapping info for `textDocument/inlineValue` var TextDocumentInlineValueInfo = RequestInfo[*InlineValueParams, InlineValueResponse]{Method: MethodTextDocumentInlineValue} // Response type for `workspace/inlineValue/refresh` type InlineValueRefreshResponse = Null // Type mapping info for `workspace/inlineValue/refresh` var WorkspaceInlineValueRefreshInfo = RequestInfo[any, InlineValueRefreshResponse]{Method: MethodWorkspaceInlineValueRefresh} // Response type for `textDocument/inlayHint` type InlayHintResponse = InlayHintsOrNull // Type mapping info for `textDocument/inlayHint` var TextDocumentInlayHintInfo = RequestInfo[*InlayHintParams, InlayHintResponse]{Method: MethodTextDocumentInlayHint} // Response type for `inlayHint/resolve` type InlayHintResolveResponse = *InlayHint // Type mapping info for `inlayHint/resolve` var InlayHintResolveInfo = RequestInfo[*InlayHint, InlayHintResolveResponse]{Method: MethodInlayHintResolve} // Response type for `workspace/inlayHint/refresh` type InlayHintRefreshResponse = Null // Type mapping info for `workspace/inlayHint/refresh` var WorkspaceInlayHintRefreshInfo = RequestInfo[any, InlayHintRefreshResponse]{Method: MethodWorkspaceInlayHintRefresh} // Response type for `textDocument/diagnostic` type DocumentDiagnosticResponse = RelatedFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport // Type mapping info for `textDocument/diagnostic` var TextDocumentDiagnosticInfo = RequestInfo[*DocumentDiagnosticParams, DocumentDiagnosticResponse]{Method: MethodTextDocumentDiagnostic} // Response type for `workspace/diagnostic` type WorkspaceDiagnosticResponse = *WorkspaceDiagnosticReport // Type mapping info for `workspace/diagnostic` var WorkspaceDiagnosticInfo = RequestInfo[*WorkspaceDiagnosticParams, WorkspaceDiagnosticResponse]{Method: MethodWorkspaceDiagnostic} // Response type for `workspace/diagnostic/refresh` type DiagnosticRefreshResponse = Null // Type mapping info for `workspace/diagnostic/refresh` var WorkspaceDiagnosticRefreshInfo = RequestInfo[any, DiagnosticRefreshResponse]{Method: MethodWorkspaceDiagnosticRefresh} // Response type for `textDocument/inlineCompletion` type InlineCompletionResponse = InlineCompletionListOrItemsOrNull // Type mapping info for `textDocument/inlineCompletion` var TextDocumentInlineCompletionInfo = RequestInfo[*InlineCompletionParams, InlineCompletionResponse]{Method: MethodTextDocumentInlineCompletion} // Response type for `workspace/textDocumentContent` type TextDocumentContentResponse = *TextDocumentContentResult // Type mapping info for `workspace/textDocumentContent` var WorkspaceTextDocumentContentInfo = RequestInfo[*TextDocumentContentParams, TextDocumentContentResponse]{Method: MethodWorkspaceTextDocumentContent} // Response type for `workspace/textDocumentContent/refresh` type TextDocumentContentRefreshResponse = Null // Type mapping info for `workspace/textDocumentContent/refresh` var WorkspaceTextDocumentContentRefreshInfo = RequestInfo[*TextDocumentContentRefreshParams, TextDocumentContentRefreshResponse]{Method: MethodWorkspaceTextDocumentContentRefresh} // Response type for `client/registerCapability` type RegistrationResponse = Null // Type mapping info for `client/registerCapability` var ClientRegisterCapabilityInfo = RequestInfo[*RegistrationParams, RegistrationResponse]{Method: MethodClientRegisterCapability} // Response type for `client/unregisterCapability` type UnregistrationResponse = Null // Type mapping info for `client/unregisterCapability` var ClientUnregisterCapabilityInfo = RequestInfo[*UnregistrationParams, UnregistrationResponse]{Method: MethodClientUnregisterCapability} // Response type for `initialize` type InitializeResponse = *InitializeResult // Type mapping info for `initialize` var InitializeInfo = RequestInfo[*InitializeParams, InitializeResponse]{Method: MethodInitialize} // Response type for `shutdown` type ShutdownResponse = Null // Type mapping info for `shutdown` var ShutdownInfo = RequestInfo[any, ShutdownResponse]{Method: MethodShutdown} // Response type for `window/showMessageRequest` type ShowMessageResponse = MessageActionItemOrNull // Type mapping info for `window/showMessageRequest` var WindowShowMessageRequestInfo = RequestInfo[*ShowMessageRequestParams, ShowMessageResponse]{Method: MethodWindowShowMessageRequest} // Response type for `textDocument/willSaveWaitUntil` type WillSaveTextDocumentWaitUntilResponse = TextEditsOrNull // Type mapping info for `textDocument/willSaveWaitUntil` var TextDocumentWillSaveWaitUntilInfo = RequestInfo[*WillSaveTextDocumentParams, WillSaveTextDocumentWaitUntilResponse]{Method: MethodTextDocumentWillSaveWaitUntil} // Response type for `textDocument/completion` type CompletionResponse = CompletionItemsOrListOrNull // Type mapping info for `textDocument/completion` var TextDocumentCompletionInfo = RequestInfo[*CompletionParams, CompletionResponse]{Method: MethodTextDocumentCompletion} // Response type for `completionItem/resolve` type CompletionResolveResponse = *CompletionItem // Type mapping info for `completionItem/resolve` var CompletionItemResolveInfo = RequestInfo[*CompletionItem, CompletionResolveResponse]{Method: MethodCompletionItemResolve} // Response type for `textDocument/hover` type HoverResponse = HoverOrNull // Type mapping info for `textDocument/hover` var TextDocumentHoverInfo = RequestInfo[*HoverParams, HoverResponse]{Method: MethodTextDocumentHover} // Response type for `textDocument/signatureHelp` type SignatureHelpResponse = SignatureHelpOrNull // Type mapping info for `textDocument/signatureHelp` var TextDocumentSignatureHelpInfo = RequestInfo[*SignatureHelpParams, SignatureHelpResponse]{Method: MethodTextDocumentSignatureHelp} // Response type for `textDocument/definition` type DefinitionResponse = LocationOrLocationsOrDefinitionLinksOrNull // Type mapping info for `textDocument/definition` var TextDocumentDefinitionInfo = RequestInfo[*DefinitionParams, DefinitionResponse]{Method: MethodTextDocumentDefinition} // Response type for `textDocument/references` type ReferencesResponse = LocationsOrNull // Type mapping info for `textDocument/references` var TextDocumentReferencesInfo = RequestInfo[*ReferenceParams, ReferencesResponse]{Method: MethodTextDocumentReferences} // Response type for `textDocument/documentHighlight` type DocumentHighlightResponse = DocumentHighlightsOrNull // Type mapping info for `textDocument/documentHighlight` var TextDocumentDocumentHighlightInfo = RequestInfo[*DocumentHighlightParams, DocumentHighlightResponse]{Method: MethodTextDocumentDocumentHighlight} // Response type for `textDocument/documentSymbol` type DocumentSymbolResponse = SymbolInformationsOrDocumentSymbolsOrNull // Type mapping info for `textDocument/documentSymbol` var TextDocumentDocumentSymbolInfo = RequestInfo[*DocumentSymbolParams, DocumentSymbolResponse]{Method: MethodTextDocumentDocumentSymbol} // Response type for `textDocument/codeAction` type CodeActionResponse = CommandOrCodeActionArrayOrNull // Type mapping info for `textDocument/codeAction` var TextDocumentCodeActionInfo = RequestInfo[*CodeActionParams, CodeActionResponse]{Method: MethodTextDocumentCodeAction} // Response type for `codeAction/resolve` type CodeActionResolveResponse = *CodeAction // Type mapping info for `codeAction/resolve` var CodeActionResolveInfo = RequestInfo[*CodeAction, CodeActionResolveResponse]{Method: MethodCodeActionResolve} // Response type for `workspace/symbol` type WorkspaceSymbolResponse = SymbolInformationsOrWorkspaceSymbolsOrNull // Type mapping info for `workspace/symbol` var WorkspaceSymbolInfo = RequestInfo[*WorkspaceSymbolParams, WorkspaceSymbolResponse]{Method: MethodWorkspaceSymbol} // Response type for `workspaceSymbol/resolve` type WorkspaceSymbolResolveResponse = *WorkspaceSymbol // Type mapping info for `workspaceSymbol/resolve` var WorkspaceSymbolResolveInfo = RequestInfo[*WorkspaceSymbol, WorkspaceSymbolResolveResponse]{Method: MethodWorkspaceSymbolResolve} // Response type for `textDocument/codeLens` type CodeLensResponse = CodeLenssOrNull // Type mapping info for `textDocument/codeLens` var TextDocumentCodeLensInfo = RequestInfo[*CodeLensParams, CodeLensResponse]{Method: MethodTextDocumentCodeLens} // Response type for `codeLens/resolve` type CodeLensResolveResponse = *CodeLens // Type mapping info for `codeLens/resolve` var CodeLensResolveInfo = RequestInfo[*CodeLens, CodeLensResolveResponse]{Method: MethodCodeLensResolve} // Response type for `workspace/codeLens/refresh` type CodeLensRefreshResponse = Null // Type mapping info for `workspace/codeLens/refresh` var WorkspaceCodeLensRefreshInfo = RequestInfo[any, CodeLensRefreshResponse]{Method: MethodWorkspaceCodeLensRefresh} // Response type for `textDocument/documentLink` type DocumentLinkResponse = DocumentLinksOrNull // Type mapping info for `textDocument/documentLink` var TextDocumentDocumentLinkInfo = RequestInfo[*DocumentLinkParams, DocumentLinkResponse]{Method: MethodTextDocumentDocumentLink} // Response type for `documentLink/resolve` type DocumentLinkResolveResponse = *DocumentLink // Type mapping info for `documentLink/resolve` var DocumentLinkResolveInfo = RequestInfo[*DocumentLink, DocumentLinkResolveResponse]{Method: MethodDocumentLinkResolve} // Response type for `textDocument/formatting` type DocumentFormattingResponse = TextEditsOrNull // Type mapping info for `textDocument/formatting` var TextDocumentFormattingInfo = RequestInfo[*DocumentFormattingParams, DocumentFormattingResponse]{Method: MethodTextDocumentFormatting} // Response type for `textDocument/rangeFormatting` type DocumentRangeFormattingResponse = TextEditsOrNull // Type mapping info for `textDocument/rangeFormatting` var TextDocumentRangeFormattingInfo = RequestInfo[*DocumentRangeFormattingParams, DocumentRangeFormattingResponse]{Method: MethodTextDocumentRangeFormatting} // Response type for `textDocument/rangesFormatting` type DocumentRangesFormattingResponse = TextEditsOrNull // Type mapping info for `textDocument/rangesFormatting` var TextDocumentRangesFormattingInfo = RequestInfo[*DocumentRangesFormattingParams, DocumentRangesFormattingResponse]{Method: MethodTextDocumentRangesFormatting} // Response type for `textDocument/onTypeFormatting` type DocumentOnTypeFormattingResponse = TextEditsOrNull // Type mapping info for `textDocument/onTypeFormatting` var TextDocumentOnTypeFormattingInfo = RequestInfo[*DocumentOnTypeFormattingParams, DocumentOnTypeFormattingResponse]{Method: MethodTextDocumentOnTypeFormatting} // Response type for `textDocument/rename` type RenameResponse = WorkspaceEditOrNull // Type mapping info for `textDocument/rename` var TextDocumentRenameInfo = RequestInfo[*RenameParams, RenameResponse]{Method: MethodTextDocumentRename} // Response type for `textDocument/prepareRename` type PrepareRenameResponse = RangeOrPrepareRenamePlaceholderOrPrepareRenameDefaultBehaviorOrNull // Type mapping info for `textDocument/prepareRename` var TextDocumentPrepareRenameInfo = RequestInfo[*PrepareRenameParams, PrepareRenameResponse]{Method: MethodTextDocumentPrepareRename} // Response type for `workspace/executeCommand` type ExecuteCommandResponse = LSPAnyOrNull // Type mapping info for `workspace/executeCommand` var WorkspaceExecuteCommandInfo = RequestInfo[*ExecuteCommandParams, ExecuteCommandResponse]{Method: MethodWorkspaceExecuteCommand} // Response type for `workspace/applyEdit` type ApplyWorkspaceEditResponse = *ApplyWorkspaceEditResult // Type mapping info for `workspace/applyEdit` var WorkspaceApplyEditInfo = RequestInfo[*ApplyWorkspaceEditParams, ApplyWorkspaceEditResponse]{Method: MethodWorkspaceApplyEdit} // Type mapping info for `workspace/didChangeWorkspaceFolders` var WorkspaceDidChangeWorkspaceFoldersInfo = NotificationInfo[*DidChangeWorkspaceFoldersParams]{Method: MethodWorkspaceDidChangeWorkspaceFolders} // Type mapping info for `window/workDoneProgress/cancel` var WindowWorkDoneProgressCancelInfo = NotificationInfo[*WorkDoneProgressCancelParams]{Method: MethodWindowWorkDoneProgressCancel} // Type mapping info for `workspace/didCreateFiles` var WorkspaceDidCreateFilesInfo = NotificationInfo[*CreateFilesParams]{Method: MethodWorkspaceDidCreateFiles} // Type mapping info for `workspace/didRenameFiles` var WorkspaceDidRenameFilesInfo = NotificationInfo[*RenameFilesParams]{Method: MethodWorkspaceDidRenameFiles} // Type mapping info for `workspace/didDeleteFiles` var WorkspaceDidDeleteFilesInfo = NotificationInfo[*DeleteFilesParams]{Method: MethodWorkspaceDidDeleteFiles} // Type mapping info for `notebookDocument/didOpen` var NotebookDocumentDidOpenInfo = NotificationInfo[*DidOpenNotebookDocumentParams]{Method: MethodNotebookDocumentDidOpen} // Type mapping info for `notebookDocument/didChange` var NotebookDocumentDidChangeInfo = NotificationInfo[*DidChangeNotebookDocumentParams]{Method: MethodNotebookDocumentDidChange} // Type mapping info for `notebookDocument/didSave` var NotebookDocumentDidSaveInfo = NotificationInfo[*DidSaveNotebookDocumentParams]{Method: MethodNotebookDocumentDidSave} // Type mapping info for `notebookDocument/didClose` var NotebookDocumentDidCloseInfo = NotificationInfo[*DidCloseNotebookDocumentParams]{Method: MethodNotebookDocumentDidClose} // Type mapping info for `initialized` var InitializedInfo = NotificationInfo[*InitializedParams]{Method: MethodInitialized} // Type mapping info for `exit` var ExitInfo = NotificationInfo[any]{Method: MethodExit} // Type mapping info for `workspace/didChangeConfiguration` var WorkspaceDidChangeConfigurationInfo = NotificationInfo[*DidChangeConfigurationParams]{Method: MethodWorkspaceDidChangeConfiguration} // Type mapping info for `window/showMessage` var WindowShowMessageInfo = NotificationInfo[*ShowMessageParams]{Method: MethodWindowShowMessage} // Type mapping info for `window/logMessage` var WindowLogMessageInfo = NotificationInfo[*LogMessageParams]{Method: MethodWindowLogMessage} // Type mapping info for `telemetry/event` var TelemetryEventInfo = NotificationInfo[any]{Method: MethodTelemetryEvent} // Type mapping info for `textDocument/didOpen` var TextDocumentDidOpenInfo = NotificationInfo[*DidOpenTextDocumentParams]{Method: MethodTextDocumentDidOpen} // Type mapping info for `textDocument/didChange` var TextDocumentDidChangeInfo = NotificationInfo[*DidChangeTextDocumentParams]{Method: MethodTextDocumentDidChange} // Type mapping info for `textDocument/didClose` var TextDocumentDidCloseInfo = NotificationInfo[*DidCloseTextDocumentParams]{Method: MethodTextDocumentDidClose} // Type mapping info for `textDocument/didSave` var TextDocumentDidSaveInfo = NotificationInfo[*DidSaveTextDocumentParams]{Method: MethodTextDocumentDidSave} // Type mapping info for `textDocument/willSave` var TextDocumentWillSaveInfo = NotificationInfo[*WillSaveTextDocumentParams]{Method: MethodTextDocumentWillSave} // Type mapping info for `workspace/didChangeWatchedFiles` var WorkspaceDidChangeWatchedFilesInfo = NotificationInfo[*DidChangeWatchedFilesParams]{Method: MethodWorkspaceDidChangeWatchedFiles} // Type mapping info for `textDocument/publishDiagnostics` var TextDocumentPublishDiagnosticsInfo = NotificationInfo[*PublishDiagnosticsParams]{Method: MethodTextDocumentPublishDiagnostics} // Type mapping info for `$/setTrace` var SetTraceInfo = NotificationInfo[*SetTraceParams]{Method: MethodSetTrace} // Type mapping info for `$/logTrace` var LogTraceInfo = NotificationInfo[*LogTraceParams]{Method: MethodLogTrace} // Type mapping info for `$/cancelRequest` var CancelRequestInfo = NotificationInfo[*CancelParams]{Method: MethodCancelRequest} // Type mapping info for `$/progress` var ProgressInfo = NotificationInfo[*ProgressParams]{Method: MethodProgress} // Union types type IntegerOrString struct { Integer *int32 String *string } var _ json.MarshalerTo = (*IntegerOrString)(nil) func (o *IntegerOrString) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of IntegerOrString should be set", o.Integer != nil, o.String != nil) if o.Integer != nil { return json.MarshalEncode(enc, o.Integer) } if o.String != nil { return json.MarshalEncode(enc, o.String) } panic("unreachable") } var _ json.UnmarshalerFrom = (*IntegerOrString)(nil) func (o *IntegerOrString) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = IntegerOrString{} data, err := dec.ReadValue() if err != nil { return err } var vInteger int32 if err := json.Unmarshal(data, &vInteger); err == nil { o.Integer = &vInteger return nil } var vString string if err := json.Unmarshal(data, &vString); err == nil { o.String = &vString return nil } return fmt.Errorf("invalid IntegerOrString: %s", data) } type DocumentSelectorOrNull struct { DocumentSelector *[]TextDocumentFilterLanguageOrTextDocumentFilterSchemeOrTextDocumentFilterPatternOrNotebookCellTextDocumentFilter } var _ json.MarshalerTo = (*DocumentSelectorOrNull)(nil) func (o *DocumentSelectorOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of DocumentSelectorOrNull is set", o.DocumentSelector != nil) if o.DocumentSelector != nil { return json.MarshalEncode(enc, o.DocumentSelector) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*DocumentSelectorOrNull)(nil) func (o *DocumentSelectorOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = DocumentSelectorOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vDocumentSelector []TextDocumentFilterLanguageOrTextDocumentFilterSchemeOrTextDocumentFilterPatternOrNotebookCellTextDocumentFilter if err := json.Unmarshal(data, &vDocumentSelector); err == nil { o.DocumentSelector = &vDocumentSelector return nil } return fmt.Errorf("invalid DocumentSelectorOrNull: %s", data) } type BooleanOrEmptyObject struct { Boolean *bool EmptyObject *struct{} } var _ json.MarshalerTo = (*BooleanOrEmptyObject)(nil) func (o *BooleanOrEmptyObject) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrEmptyObject should be set", o.Boolean != nil, o.EmptyObject != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.EmptyObject != nil { return json.MarshalEncode(enc, o.EmptyObject) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrEmptyObject)(nil) func (o *BooleanOrEmptyObject) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrEmptyObject{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vEmptyObject struct{} if err := json.Unmarshal(data, &vEmptyObject); err == nil { o.EmptyObject = &vEmptyObject return nil } return fmt.Errorf("invalid BooleanOrEmptyObject: %s", data) } type BooleanOrSemanticTokensFullDelta struct { Boolean *bool SemanticTokensFullDelta *SemanticTokensFullDelta } var _ json.MarshalerTo = (*BooleanOrSemanticTokensFullDelta)(nil) func (o *BooleanOrSemanticTokensFullDelta) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrSemanticTokensFullDelta should be set", o.Boolean != nil, o.SemanticTokensFullDelta != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.SemanticTokensFullDelta != nil { return json.MarshalEncode(enc, o.SemanticTokensFullDelta) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrSemanticTokensFullDelta)(nil) func (o *BooleanOrSemanticTokensFullDelta) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrSemanticTokensFullDelta{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vSemanticTokensFullDelta SemanticTokensFullDelta if err := json.Unmarshal(data, &vSemanticTokensFullDelta); err == nil { o.SemanticTokensFullDelta = &vSemanticTokensFullDelta return nil } return fmt.Errorf("invalid BooleanOrSemanticTokensFullDelta: %s", data) } type TextDocumentEditOrCreateFileOrRenameFileOrDeleteFile struct { TextDocumentEdit *TextDocumentEdit CreateFile *CreateFile RenameFile *RenameFile DeleteFile *DeleteFile } var _ json.MarshalerTo = (*TextDocumentEditOrCreateFileOrRenameFileOrDeleteFile)(nil) func (o *TextDocumentEditOrCreateFileOrRenameFileOrDeleteFile) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of TextDocumentEditOrCreateFileOrRenameFileOrDeleteFile should be set", o.TextDocumentEdit != nil, o.CreateFile != nil, o.RenameFile != nil, o.DeleteFile != nil) if o.TextDocumentEdit != nil { return json.MarshalEncode(enc, o.TextDocumentEdit) } if o.CreateFile != nil { return json.MarshalEncode(enc, o.CreateFile) } if o.RenameFile != nil { return json.MarshalEncode(enc, o.RenameFile) } if o.DeleteFile != nil { return json.MarshalEncode(enc, o.DeleteFile) } panic("unreachable") } var _ json.UnmarshalerFrom = (*TextDocumentEditOrCreateFileOrRenameFileOrDeleteFile)(nil) func (o *TextDocumentEditOrCreateFileOrRenameFileOrDeleteFile) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = TextDocumentEditOrCreateFileOrRenameFileOrDeleteFile{} data, err := dec.ReadValue() if err != nil { return err } var vTextDocumentEdit TextDocumentEdit if err := json.Unmarshal(data, &vTextDocumentEdit); err == nil { o.TextDocumentEdit = &vTextDocumentEdit return nil } var vCreateFile CreateFile if err := json.Unmarshal(data, &vCreateFile); err == nil { o.CreateFile = &vCreateFile return nil } var vRenameFile RenameFile if err := json.Unmarshal(data, &vRenameFile); err == nil { o.RenameFile = &vRenameFile return nil } var vDeleteFile DeleteFile if err := json.Unmarshal(data, &vDeleteFile); err == nil { o.DeleteFile = &vDeleteFile return nil } return fmt.Errorf("invalid TextDocumentEditOrCreateFileOrRenameFileOrDeleteFile: %s", data) } type StringOrInlayHintLabelParts struct { String *string InlayHintLabelParts *[]*InlayHintLabelPart } var _ json.MarshalerTo = (*StringOrInlayHintLabelParts)(nil) func (o *StringOrInlayHintLabelParts) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of StringOrInlayHintLabelParts should be set", o.String != nil, o.InlayHintLabelParts != nil) if o.String != nil { return json.MarshalEncode(enc, o.String) } if o.InlayHintLabelParts != nil { return json.MarshalEncode(enc, o.InlayHintLabelParts) } panic("unreachable") } var _ json.UnmarshalerFrom = (*StringOrInlayHintLabelParts)(nil) func (o *StringOrInlayHintLabelParts) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = StringOrInlayHintLabelParts{} data, err := dec.ReadValue() if err != nil { return err } var vString string if err := json.Unmarshal(data, &vString); err == nil { o.String = &vString return nil } var vInlayHintLabelParts []*InlayHintLabelPart if err := json.Unmarshal(data, &vInlayHintLabelParts); err == nil { o.InlayHintLabelParts = &vInlayHintLabelParts return nil } return fmt.Errorf("invalid StringOrInlayHintLabelParts: %s", data) } type StringOrMarkupContent struct { String *string MarkupContent *MarkupContent } var _ json.MarshalerTo = (*StringOrMarkupContent)(nil) func (o *StringOrMarkupContent) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of StringOrMarkupContent should be set", o.String != nil, o.MarkupContent != nil) if o.String != nil { return json.MarshalEncode(enc, o.String) } if o.MarkupContent != nil { return json.MarshalEncode(enc, o.MarkupContent) } panic("unreachable") } var _ json.UnmarshalerFrom = (*StringOrMarkupContent)(nil) func (o *StringOrMarkupContent) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = StringOrMarkupContent{} data, err := dec.ReadValue() if err != nil { return err } var vString string if err := json.Unmarshal(data, &vString); err == nil { o.String = &vString return nil } var vMarkupContent MarkupContent if err := json.Unmarshal(data, &vMarkupContent); err == nil { o.MarkupContent = &vMarkupContent return nil } return fmt.Errorf("invalid StringOrMarkupContent: %s", data) } type FullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport struct { FullDocumentDiagnosticReport *FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport *UnchangedDocumentDiagnosticReport } var _ json.MarshalerTo = (*FullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport)(nil) func (o *FullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of FullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport should be set", o.FullDocumentDiagnosticReport != nil, o.UnchangedDocumentDiagnosticReport != nil) if o.FullDocumentDiagnosticReport != nil { return json.MarshalEncode(enc, o.FullDocumentDiagnosticReport) } if o.UnchangedDocumentDiagnosticReport != nil { return json.MarshalEncode(enc, o.UnchangedDocumentDiagnosticReport) } panic("unreachable") } var _ json.UnmarshalerFrom = (*FullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport)(nil) func (o *FullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = FullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport{} data, err := dec.ReadValue() if err != nil { return err } var vFullDocumentDiagnosticReport FullDocumentDiagnosticReport if err := json.Unmarshal(data, &vFullDocumentDiagnosticReport); err == nil { o.FullDocumentDiagnosticReport = &vFullDocumentDiagnosticReport return nil } var vUnchangedDocumentDiagnosticReport UnchangedDocumentDiagnosticReport if err := json.Unmarshal(data, &vUnchangedDocumentDiagnosticReport); err == nil { o.UnchangedDocumentDiagnosticReport = &vUnchangedDocumentDiagnosticReport return nil } return fmt.Errorf("invalid FullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport: %s", data) } type WorkspaceFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport struct { FullDocumentDiagnosticReport *WorkspaceFullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport *WorkspaceUnchangedDocumentDiagnosticReport } var _ json.MarshalerTo = (*WorkspaceFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport)(nil) func (o *WorkspaceFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of WorkspaceFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport should be set", o.FullDocumentDiagnosticReport != nil, o.UnchangedDocumentDiagnosticReport != nil) if o.FullDocumentDiagnosticReport != nil { return json.MarshalEncode(enc, o.FullDocumentDiagnosticReport) } if o.UnchangedDocumentDiagnosticReport != nil { return json.MarshalEncode(enc, o.UnchangedDocumentDiagnosticReport) } panic("unreachable") } var _ json.UnmarshalerFrom = (*WorkspaceFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport)(nil) func (o *WorkspaceFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = WorkspaceFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport{} data, err := dec.ReadValue() if err != nil { return err } var vFullDocumentDiagnosticReport WorkspaceFullDocumentDiagnosticReport if err := json.Unmarshal(data, &vFullDocumentDiagnosticReport); err == nil { o.FullDocumentDiagnosticReport = &vFullDocumentDiagnosticReport return nil } var vUnchangedDocumentDiagnosticReport WorkspaceUnchangedDocumentDiagnosticReport if err := json.Unmarshal(data, &vUnchangedDocumentDiagnosticReport); err == nil { o.UnchangedDocumentDiagnosticReport = &vUnchangedDocumentDiagnosticReport return nil } return fmt.Errorf("invalid WorkspaceFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport: %s", data) } type NotebookDocumentFilterWithNotebookOrCells struct { Notebook *NotebookDocumentFilterWithNotebook Cells *NotebookDocumentFilterWithCells } var _ json.MarshalerTo = (*NotebookDocumentFilterWithNotebookOrCells)(nil) func (o *NotebookDocumentFilterWithNotebookOrCells) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of NotebookDocumentFilterWithNotebookOrCells should be set", o.Notebook != nil, o.Cells != nil) if o.Notebook != nil { return json.MarshalEncode(enc, o.Notebook) } if o.Cells != nil { return json.MarshalEncode(enc, o.Cells) } panic("unreachable") } var _ json.UnmarshalerFrom = (*NotebookDocumentFilterWithNotebookOrCells)(nil) func (o *NotebookDocumentFilterWithNotebookOrCells) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = NotebookDocumentFilterWithNotebookOrCells{} data, err := dec.ReadValue() if err != nil { return err } var vNotebook NotebookDocumentFilterWithNotebook if err := json.Unmarshal(data, &vNotebook); err == nil { o.Notebook = &vNotebook return nil } var vCells NotebookDocumentFilterWithCells if err := json.Unmarshal(data, &vCells); err == nil { o.Cells = &vCells return nil } return fmt.Errorf("invalid NotebookDocumentFilterWithNotebookOrCells: %s", data) } type StringOrStringValue struct { String *string StringValue *StringValue } var _ json.MarshalerTo = (*StringOrStringValue)(nil) func (o *StringOrStringValue) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of StringOrStringValue should be set", o.String != nil, o.StringValue != nil) if o.String != nil { return json.MarshalEncode(enc, o.String) } if o.StringValue != nil { return json.MarshalEncode(enc, o.StringValue) } panic("unreachable") } var _ json.UnmarshalerFrom = (*StringOrStringValue)(nil) func (o *StringOrStringValue) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = StringOrStringValue{} data, err := dec.ReadValue() if err != nil { return err } var vString string if err := json.Unmarshal(data, &vString); err == nil { o.String = &vString return nil } var vStringValue StringValue if err := json.Unmarshal(data, &vStringValue); err == nil { o.StringValue = &vStringValue return nil } return fmt.Errorf("invalid StringOrStringValue: %s", data) } type IntegerOrNull struct { Integer *int32 } var _ json.MarshalerTo = (*IntegerOrNull)(nil) func (o *IntegerOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of IntegerOrNull is set", o.Integer != nil) if o.Integer != nil { return json.MarshalEncode(enc, o.Integer) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*IntegerOrNull)(nil) func (o *IntegerOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = IntegerOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vInteger int32 if err := json.Unmarshal(data, &vInteger); err == nil { o.Integer = &vInteger return nil } return fmt.Errorf("invalid IntegerOrNull: %s", data) } type StringOrNull struct { String *string } var _ json.MarshalerTo = (*StringOrNull)(nil) func (o *StringOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of StringOrNull is set", o.String != nil) if o.String != nil { return json.MarshalEncode(enc, o.String) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*StringOrNull)(nil) func (o *StringOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = StringOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vString string if err := json.Unmarshal(data, &vString); err == nil { o.String = &vString return nil } return fmt.Errorf("invalid StringOrNull: %s", data) } type DocumentUriOrNull struct { DocumentUri *DocumentUri } var _ json.MarshalerTo = (*DocumentUriOrNull)(nil) func (o *DocumentUriOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of DocumentUriOrNull is set", o.DocumentUri != nil) if o.DocumentUri != nil { return json.MarshalEncode(enc, o.DocumentUri) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*DocumentUriOrNull)(nil) func (o *DocumentUriOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = DocumentUriOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vDocumentUri DocumentUri if err := json.Unmarshal(data, &vDocumentUri); err == nil { o.DocumentUri = &vDocumentUri return nil } return fmt.Errorf("invalid DocumentUriOrNull: %s", data) } type WorkspaceFoldersOrNull struct { WorkspaceFolders *[]*WorkspaceFolder } var _ json.MarshalerTo = (*WorkspaceFoldersOrNull)(nil) func (o *WorkspaceFoldersOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of WorkspaceFoldersOrNull is set", o.WorkspaceFolders != nil) if o.WorkspaceFolders != nil { return json.MarshalEncode(enc, o.WorkspaceFolders) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*WorkspaceFoldersOrNull)(nil) func (o *WorkspaceFoldersOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = WorkspaceFoldersOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vWorkspaceFolders []*WorkspaceFolder if err := json.Unmarshal(data, &vWorkspaceFolders); err == nil { o.WorkspaceFolders = &vWorkspaceFolders return nil } return fmt.Errorf("invalid WorkspaceFoldersOrNull: %s", data) } type StringOrStrings struct { String *string Strings *[]string } var _ json.MarshalerTo = (*StringOrStrings)(nil) func (o *StringOrStrings) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of StringOrStrings should be set", o.String != nil, o.Strings != nil) if o.String != nil { return json.MarshalEncode(enc, o.String) } if o.Strings != nil { return json.MarshalEncode(enc, o.Strings) } panic("unreachable") } var _ json.UnmarshalerFrom = (*StringOrStrings)(nil) func (o *StringOrStrings) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = StringOrStrings{} data, err := dec.ReadValue() if err != nil { return err } var vString string if err := json.Unmarshal(data, &vString); err == nil { o.String = &vString return nil } var vStrings []string if err := json.Unmarshal(data, &vStrings); err == nil { o.Strings = &vStrings return nil } return fmt.Errorf("invalid StringOrStrings: %s", data) } type TextDocumentContentChangePartialOrWholeDocument struct { Partial *TextDocumentContentChangePartial WholeDocument *TextDocumentContentChangeWholeDocument } var _ json.MarshalerTo = (*TextDocumentContentChangePartialOrWholeDocument)(nil) func (o *TextDocumentContentChangePartialOrWholeDocument) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of TextDocumentContentChangePartialOrWholeDocument should be set", o.Partial != nil, o.WholeDocument != nil) if o.Partial != nil { return json.MarshalEncode(enc, o.Partial) } if o.WholeDocument != nil { return json.MarshalEncode(enc, o.WholeDocument) } panic("unreachable") } var _ json.UnmarshalerFrom = (*TextDocumentContentChangePartialOrWholeDocument)(nil) func (o *TextDocumentContentChangePartialOrWholeDocument) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = TextDocumentContentChangePartialOrWholeDocument{} data, err := dec.ReadValue() if err != nil { return err } var vPartial TextDocumentContentChangePartial if err := json.Unmarshal(data, &vPartial); err == nil { o.Partial = &vPartial return nil } var vWholeDocument TextDocumentContentChangeWholeDocument if err := json.Unmarshal(data, &vWholeDocument); err == nil { o.WholeDocument = &vWholeDocument return nil } return fmt.Errorf("invalid TextDocumentContentChangePartialOrWholeDocument: %s", data) } type TextEditOrInsertReplaceEdit struct { TextEdit *TextEdit InsertReplaceEdit *InsertReplaceEdit } var _ json.MarshalerTo = (*TextEditOrInsertReplaceEdit)(nil) func (o *TextEditOrInsertReplaceEdit) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of TextEditOrInsertReplaceEdit should be set", o.TextEdit != nil, o.InsertReplaceEdit != nil) if o.TextEdit != nil { return json.MarshalEncode(enc, o.TextEdit) } if o.InsertReplaceEdit != nil { return json.MarshalEncode(enc, o.InsertReplaceEdit) } panic("unreachable") } var _ json.UnmarshalerFrom = (*TextEditOrInsertReplaceEdit)(nil) func (o *TextEditOrInsertReplaceEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = TextEditOrInsertReplaceEdit{} data, err := dec.ReadValue() if err != nil { return err } var vTextEdit TextEdit if err := json.Unmarshal(data, &vTextEdit); err == nil { o.TextEdit = &vTextEdit return nil } var vInsertReplaceEdit InsertReplaceEdit if err := json.Unmarshal(data, &vInsertReplaceEdit); err == nil { o.InsertReplaceEdit = &vInsertReplaceEdit return nil } return fmt.Errorf("invalid TextEditOrInsertReplaceEdit: %s", data) } type MarkupContentOrStringOrMarkedStringWithLanguageOrMarkedStrings struct { MarkupContent *MarkupContent String *string MarkedStringWithLanguage *MarkedStringWithLanguage MarkedStrings *[]StringOrMarkedStringWithLanguage } var _ json.MarshalerTo = (*MarkupContentOrStringOrMarkedStringWithLanguageOrMarkedStrings)(nil) func (o *MarkupContentOrStringOrMarkedStringWithLanguageOrMarkedStrings) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of MarkupContentOrStringOrMarkedStringWithLanguageOrMarkedStrings should be set", o.MarkupContent != nil, o.String != nil, o.MarkedStringWithLanguage != nil, o.MarkedStrings != nil) if o.MarkupContent != nil { return json.MarshalEncode(enc, o.MarkupContent) } if o.String != nil { return json.MarshalEncode(enc, o.String) } if o.MarkedStringWithLanguage != nil { return json.MarshalEncode(enc, o.MarkedStringWithLanguage) } if o.MarkedStrings != nil { return json.MarshalEncode(enc, o.MarkedStrings) } panic("unreachable") } var _ json.UnmarshalerFrom = (*MarkupContentOrStringOrMarkedStringWithLanguageOrMarkedStrings)(nil) func (o *MarkupContentOrStringOrMarkedStringWithLanguageOrMarkedStrings) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = MarkupContentOrStringOrMarkedStringWithLanguageOrMarkedStrings{} data, err := dec.ReadValue() if err != nil { return err } var vMarkupContent MarkupContent if err := json.Unmarshal(data, &vMarkupContent); err == nil { o.MarkupContent = &vMarkupContent return nil } var vString string if err := json.Unmarshal(data, &vString); err == nil { o.String = &vString return nil } var vMarkedStringWithLanguage MarkedStringWithLanguage if err := json.Unmarshal(data, &vMarkedStringWithLanguage); err == nil { o.MarkedStringWithLanguage = &vMarkedStringWithLanguage return nil } var vMarkedStrings []StringOrMarkedStringWithLanguage if err := json.Unmarshal(data, &vMarkedStrings); err == nil { o.MarkedStrings = &vMarkedStrings return nil } return fmt.Errorf("invalid MarkupContentOrStringOrMarkedStringWithLanguageOrMarkedStrings: %s", data) } type UintegerOrNull struct { Uinteger *uint32 } var _ json.MarshalerTo = (*UintegerOrNull)(nil) func (o *UintegerOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of UintegerOrNull is set", o.Uinteger != nil) if o.Uinteger != nil { return json.MarshalEncode(enc, o.Uinteger) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*UintegerOrNull)(nil) func (o *UintegerOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = UintegerOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vUinteger uint32 if err := json.Unmarshal(data, &vUinteger); err == nil { o.Uinteger = &vUinteger return nil } return fmt.Errorf("invalid UintegerOrNull: %s", data) } type LocationOrLocationUriOnly struct { Location *Location LocationUriOnly *LocationUriOnly } var _ json.MarshalerTo = (*LocationOrLocationUriOnly)(nil) func (o *LocationOrLocationUriOnly) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of LocationOrLocationUriOnly should be set", o.Location != nil, o.LocationUriOnly != nil) if o.Location != nil { return json.MarshalEncode(enc, o.Location) } if o.LocationUriOnly != nil { return json.MarshalEncode(enc, o.LocationUriOnly) } panic("unreachable") } var _ json.UnmarshalerFrom = (*LocationOrLocationUriOnly)(nil) func (o *LocationOrLocationUriOnly) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = LocationOrLocationUriOnly{} data, err := dec.ReadValue() if err != nil { return err } var vLocation Location if err := json.Unmarshal(data, &vLocation); err == nil { o.Location = &vLocation return nil } var vLocationUriOnly LocationUriOnly if err := json.Unmarshal(data, &vLocationUriOnly); err == nil { o.LocationUriOnly = &vLocationUriOnly return nil } return fmt.Errorf("invalid LocationOrLocationUriOnly: %s", data) } type TextEditOrAnnotatedTextEditOrSnippetTextEdit struct { TextEdit *TextEdit AnnotatedTextEdit *AnnotatedTextEdit SnippetTextEdit *SnippetTextEdit } var _ json.MarshalerTo = (*TextEditOrAnnotatedTextEditOrSnippetTextEdit)(nil) func (o *TextEditOrAnnotatedTextEditOrSnippetTextEdit) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of TextEditOrAnnotatedTextEditOrSnippetTextEdit should be set", o.TextEdit != nil, o.AnnotatedTextEdit != nil, o.SnippetTextEdit != nil) if o.TextEdit != nil { return json.MarshalEncode(enc, o.TextEdit) } if o.AnnotatedTextEdit != nil { return json.MarshalEncode(enc, o.AnnotatedTextEdit) } if o.SnippetTextEdit != nil { return json.MarshalEncode(enc, o.SnippetTextEdit) } panic("unreachable") } var _ json.UnmarshalerFrom = (*TextEditOrAnnotatedTextEditOrSnippetTextEdit)(nil) func (o *TextEditOrAnnotatedTextEditOrSnippetTextEdit) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = TextEditOrAnnotatedTextEditOrSnippetTextEdit{} data, err := dec.ReadValue() if err != nil { return err } var vTextEdit TextEdit if err := json.Unmarshal(data, &vTextEdit); err == nil { o.TextEdit = &vTextEdit return nil } var vAnnotatedTextEdit AnnotatedTextEdit if err := json.Unmarshal(data, &vAnnotatedTextEdit); err == nil { o.AnnotatedTextEdit = &vAnnotatedTextEdit return nil } var vSnippetTextEdit SnippetTextEdit if err := json.Unmarshal(data, &vSnippetTextEdit); err == nil { o.SnippetTextEdit = &vSnippetTextEdit return nil } return fmt.Errorf("invalid TextEditOrAnnotatedTextEditOrSnippetTextEdit: %s", data) } type TextDocumentSyncOptionsOrKind struct { Options *TextDocumentSyncOptions Kind *TextDocumentSyncKind } var _ json.MarshalerTo = (*TextDocumentSyncOptionsOrKind)(nil) func (o *TextDocumentSyncOptionsOrKind) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of TextDocumentSyncOptionsOrKind should be set", o.Options != nil, o.Kind != nil) if o.Options != nil { return json.MarshalEncode(enc, o.Options) } if o.Kind != nil { return json.MarshalEncode(enc, o.Kind) } panic("unreachable") } var _ json.UnmarshalerFrom = (*TextDocumentSyncOptionsOrKind)(nil) func (o *TextDocumentSyncOptionsOrKind) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = TextDocumentSyncOptionsOrKind{} data, err := dec.ReadValue() if err != nil { return err } var vOptions TextDocumentSyncOptions if err := json.Unmarshal(data, &vOptions); err == nil { o.Options = &vOptions return nil } var vKind TextDocumentSyncKind if err := json.Unmarshal(data, &vKind); err == nil { o.Kind = &vKind return nil } return fmt.Errorf("invalid TextDocumentSyncOptionsOrKind: %s", data) } type NotebookDocumentSyncOptionsOrRegistrationOptions struct { Options *NotebookDocumentSyncOptions RegistrationOptions *NotebookDocumentSyncRegistrationOptions } var _ json.MarshalerTo = (*NotebookDocumentSyncOptionsOrRegistrationOptions)(nil) func (o *NotebookDocumentSyncOptionsOrRegistrationOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of NotebookDocumentSyncOptionsOrRegistrationOptions should be set", o.Options != nil, o.RegistrationOptions != nil) if o.Options != nil { return json.MarshalEncode(enc, o.Options) } if o.RegistrationOptions != nil { return json.MarshalEncode(enc, o.RegistrationOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*NotebookDocumentSyncOptionsOrRegistrationOptions)(nil) func (o *NotebookDocumentSyncOptionsOrRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = NotebookDocumentSyncOptionsOrRegistrationOptions{} data, err := dec.ReadValue() if err != nil { return err } var vOptions NotebookDocumentSyncOptions if err := json.Unmarshal(data, &vOptions); err == nil { o.Options = &vOptions return nil } var vRegistrationOptions NotebookDocumentSyncRegistrationOptions if err := json.Unmarshal(data, &vRegistrationOptions); err == nil { o.RegistrationOptions = &vRegistrationOptions return nil } return fmt.Errorf("invalid NotebookDocumentSyncOptionsOrRegistrationOptions: %s", data) } type BooleanOrHoverOptions struct { Boolean *bool HoverOptions *HoverOptions } var _ json.MarshalerTo = (*BooleanOrHoverOptions)(nil) func (o *BooleanOrHoverOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrHoverOptions should be set", o.Boolean != nil, o.HoverOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.HoverOptions != nil { return json.MarshalEncode(enc, o.HoverOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrHoverOptions)(nil) func (o *BooleanOrHoverOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrHoverOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vHoverOptions HoverOptions if err := json.Unmarshal(data, &vHoverOptions); err == nil { o.HoverOptions = &vHoverOptions return nil } return fmt.Errorf("invalid BooleanOrHoverOptions: %s", data) } type BooleanOrDeclarationOptionsOrDeclarationRegistrationOptions struct { Boolean *bool DeclarationOptions *DeclarationOptions DeclarationRegistrationOptions *DeclarationRegistrationOptions } var _ json.MarshalerTo = (*BooleanOrDeclarationOptionsOrDeclarationRegistrationOptions)(nil) func (o *BooleanOrDeclarationOptionsOrDeclarationRegistrationOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrDeclarationOptionsOrDeclarationRegistrationOptions should be set", o.Boolean != nil, o.DeclarationOptions != nil, o.DeclarationRegistrationOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.DeclarationOptions != nil { return json.MarshalEncode(enc, o.DeclarationOptions) } if o.DeclarationRegistrationOptions != nil { return json.MarshalEncode(enc, o.DeclarationRegistrationOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrDeclarationOptionsOrDeclarationRegistrationOptions)(nil) func (o *BooleanOrDeclarationOptionsOrDeclarationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrDeclarationOptionsOrDeclarationRegistrationOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vDeclarationOptions DeclarationOptions if err := json.Unmarshal(data, &vDeclarationOptions); err == nil { o.DeclarationOptions = &vDeclarationOptions return nil } var vDeclarationRegistrationOptions DeclarationRegistrationOptions if err := json.Unmarshal(data, &vDeclarationRegistrationOptions); err == nil { o.DeclarationRegistrationOptions = &vDeclarationRegistrationOptions return nil } return fmt.Errorf("invalid BooleanOrDeclarationOptionsOrDeclarationRegistrationOptions: %s", data) } type BooleanOrDefinitionOptions struct { Boolean *bool DefinitionOptions *DefinitionOptions } var _ json.MarshalerTo = (*BooleanOrDefinitionOptions)(nil) func (o *BooleanOrDefinitionOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrDefinitionOptions should be set", o.Boolean != nil, o.DefinitionOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.DefinitionOptions != nil { return json.MarshalEncode(enc, o.DefinitionOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrDefinitionOptions)(nil) func (o *BooleanOrDefinitionOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrDefinitionOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vDefinitionOptions DefinitionOptions if err := json.Unmarshal(data, &vDefinitionOptions); err == nil { o.DefinitionOptions = &vDefinitionOptions return nil } return fmt.Errorf("invalid BooleanOrDefinitionOptions: %s", data) } type BooleanOrTypeDefinitionOptionsOrTypeDefinitionRegistrationOptions struct { Boolean *bool TypeDefinitionOptions *TypeDefinitionOptions TypeDefinitionRegistrationOptions *TypeDefinitionRegistrationOptions } var _ json.MarshalerTo = (*BooleanOrTypeDefinitionOptionsOrTypeDefinitionRegistrationOptions)(nil) func (o *BooleanOrTypeDefinitionOptionsOrTypeDefinitionRegistrationOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrTypeDefinitionOptionsOrTypeDefinitionRegistrationOptions should be set", o.Boolean != nil, o.TypeDefinitionOptions != nil, o.TypeDefinitionRegistrationOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.TypeDefinitionOptions != nil { return json.MarshalEncode(enc, o.TypeDefinitionOptions) } if o.TypeDefinitionRegistrationOptions != nil { return json.MarshalEncode(enc, o.TypeDefinitionRegistrationOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrTypeDefinitionOptionsOrTypeDefinitionRegistrationOptions)(nil) func (o *BooleanOrTypeDefinitionOptionsOrTypeDefinitionRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrTypeDefinitionOptionsOrTypeDefinitionRegistrationOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vTypeDefinitionOptions TypeDefinitionOptions if err := json.Unmarshal(data, &vTypeDefinitionOptions); err == nil { o.TypeDefinitionOptions = &vTypeDefinitionOptions return nil } var vTypeDefinitionRegistrationOptions TypeDefinitionRegistrationOptions if err := json.Unmarshal(data, &vTypeDefinitionRegistrationOptions); err == nil { o.TypeDefinitionRegistrationOptions = &vTypeDefinitionRegistrationOptions return nil } return fmt.Errorf("invalid BooleanOrTypeDefinitionOptionsOrTypeDefinitionRegistrationOptions: %s", data) } type BooleanOrImplementationOptionsOrImplementationRegistrationOptions struct { Boolean *bool ImplementationOptions *ImplementationOptions ImplementationRegistrationOptions *ImplementationRegistrationOptions } var _ json.MarshalerTo = (*BooleanOrImplementationOptionsOrImplementationRegistrationOptions)(nil) func (o *BooleanOrImplementationOptionsOrImplementationRegistrationOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrImplementationOptionsOrImplementationRegistrationOptions should be set", o.Boolean != nil, o.ImplementationOptions != nil, o.ImplementationRegistrationOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.ImplementationOptions != nil { return json.MarshalEncode(enc, o.ImplementationOptions) } if o.ImplementationRegistrationOptions != nil { return json.MarshalEncode(enc, o.ImplementationRegistrationOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrImplementationOptionsOrImplementationRegistrationOptions)(nil) func (o *BooleanOrImplementationOptionsOrImplementationRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrImplementationOptionsOrImplementationRegistrationOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vImplementationOptions ImplementationOptions if err := json.Unmarshal(data, &vImplementationOptions); err == nil { o.ImplementationOptions = &vImplementationOptions return nil } var vImplementationRegistrationOptions ImplementationRegistrationOptions if err := json.Unmarshal(data, &vImplementationRegistrationOptions); err == nil { o.ImplementationRegistrationOptions = &vImplementationRegistrationOptions return nil } return fmt.Errorf("invalid BooleanOrImplementationOptionsOrImplementationRegistrationOptions: %s", data) } type BooleanOrReferenceOptions struct { Boolean *bool ReferenceOptions *ReferenceOptions } var _ json.MarshalerTo = (*BooleanOrReferenceOptions)(nil) func (o *BooleanOrReferenceOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrReferenceOptions should be set", o.Boolean != nil, o.ReferenceOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.ReferenceOptions != nil { return json.MarshalEncode(enc, o.ReferenceOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrReferenceOptions)(nil) func (o *BooleanOrReferenceOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrReferenceOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vReferenceOptions ReferenceOptions if err := json.Unmarshal(data, &vReferenceOptions); err == nil { o.ReferenceOptions = &vReferenceOptions return nil } return fmt.Errorf("invalid BooleanOrReferenceOptions: %s", data) } type BooleanOrDocumentHighlightOptions struct { Boolean *bool DocumentHighlightOptions *DocumentHighlightOptions } var _ json.MarshalerTo = (*BooleanOrDocumentHighlightOptions)(nil) func (o *BooleanOrDocumentHighlightOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrDocumentHighlightOptions should be set", o.Boolean != nil, o.DocumentHighlightOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.DocumentHighlightOptions != nil { return json.MarshalEncode(enc, o.DocumentHighlightOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrDocumentHighlightOptions)(nil) func (o *BooleanOrDocumentHighlightOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrDocumentHighlightOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vDocumentHighlightOptions DocumentHighlightOptions if err := json.Unmarshal(data, &vDocumentHighlightOptions); err == nil { o.DocumentHighlightOptions = &vDocumentHighlightOptions return nil } return fmt.Errorf("invalid BooleanOrDocumentHighlightOptions: %s", data) } type BooleanOrDocumentSymbolOptions struct { Boolean *bool DocumentSymbolOptions *DocumentSymbolOptions } var _ json.MarshalerTo = (*BooleanOrDocumentSymbolOptions)(nil) func (o *BooleanOrDocumentSymbolOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrDocumentSymbolOptions should be set", o.Boolean != nil, o.DocumentSymbolOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.DocumentSymbolOptions != nil { return json.MarshalEncode(enc, o.DocumentSymbolOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrDocumentSymbolOptions)(nil) func (o *BooleanOrDocumentSymbolOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrDocumentSymbolOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vDocumentSymbolOptions DocumentSymbolOptions if err := json.Unmarshal(data, &vDocumentSymbolOptions); err == nil { o.DocumentSymbolOptions = &vDocumentSymbolOptions return nil } return fmt.Errorf("invalid BooleanOrDocumentSymbolOptions: %s", data) } type BooleanOrCodeActionOptions struct { Boolean *bool CodeActionOptions *CodeActionOptions } var _ json.MarshalerTo = (*BooleanOrCodeActionOptions)(nil) func (o *BooleanOrCodeActionOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrCodeActionOptions should be set", o.Boolean != nil, o.CodeActionOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.CodeActionOptions != nil { return json.MarshalEncode(enc, o.CodeActionOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrCodeActionOptions)(nil) func (o *BooleanOrCodeActionOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrCodeActionOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vCodeActionOptions CodeActionOptions if err := json.Unmarshal(data, &vCodeActionOptions); err == nil { o.CodeActionOptions = &vCodeActionOptions return nil } return fmt.Errorf("invalid BooleanOrCodeActionOptions: %s", data) } type BooleanOrDocumentColorOptionsOrDocumentColorRegistrationOptions struct { Boolean *bool DocumentColorOptions *DocumentColorOptions DocumentColorRegistrationOptions *DocumentColorRegistrationOptions } var _ json.MarshalerTo = (*BooleanOrDocumentColorOptionsOrDocumentColorRegistrationOptions)(nil) func (o *BooleanOrDocumentColorOptionsOrDocumentColorRegistrationOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrDocumentColorOptionsOrDocumentColorRegistrationOptions should be set", o.Boolean != nil, o.DocumentColorOptions != nil, o.DocumentColorRegistrationOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.DocumentColorOptions != nil { return json.MarshalEncode(enc, o.DocumentColorOptions) } if o.DocumentColorRegistrationOptions != nil { return json.MarshalEncode(enc, o.DocumentColorRegistrationOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrDocumentColorOptionsOrDocumentColorRegistrationOptions)(nil) func (o *BooleanOrDocumentColorOptionsOrDocumentColorRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrDocumentColorOptionsOrDocumentColorRegistrationOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vDocumentColorOptions DocumentColorOptions if err := json.Unmarshal(data, &vDocumentColorOptions); err == nil { o.DocumentColorOptions = &vDocumentColorOptions return nil } var vDocumentColorRegistrationOptions DocumentColorRegistrationOptions if err := json.Unmarshal(data, &vDocumentColorRegistrationOptions); err == nil { o.DocumentColorRegistrationOptions = &vDocumentColorRegistrationOptions return nil } return fmt.Errorf("invalid BooleanOrDocumentColorOptionsOrDocumentColorRegistrationOptions: %s", data) } type BooleanOrWorkspaceSymbolOptions struct { Boolean *bool WorkspaceSymbolOptions *WorkspaceSymbolOptions } var _ json.MarshalerTo = (*BooleanOrWorkspaceSymbolOptions)(nil) func (o *BooleanOrWorkspaceSymbolOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrWorkspaceSymbolOptions should be set", o.Boolean != nil, o.WorkspaceSymbolOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.WorkspaceSymbolOptions != nil { return json.MarshalEncode(enc, o.WorkspaceSymbolOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrWorkspaceSymbolOptions)(nil) func (o *BooleanOrWorkspaceSymbolOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrWorkspaceSymbolOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vWorkspaceSymbolOptions WorkspaceSymbolOptions if err := json.Unmarshal(data, &vWorkspaceSymbolOptions); err == nil { o.WorkspaceSymbolOptions = &vWorkspaceSymbolOptions return nil } return fmt.Errorf("invalid BooleanOrWorkspaceSymbolOptions: %s", data) } type BooleanOrDocumentFormattingOptions struct { Boolean *bool DocumentFormattingOptions *DocumentFormattingOptions } var _ json.MarshalerTo = (*BooleanOrDocumentFormattingOptions)(nil) func (o *BooleanOrDocumentFormattingOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrDocumentFormattingOptions should be set", o.Boolean != nil, o.DocumentFormattingOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.DocumentFormattingOptions != nil { return json.MarshalEncode(enc, o.DocumentFormattingOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrDocumentFormattingOptions)(nil) func (o *BooleanOrDocumentFormattingOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrDocumentFormattingOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vDocumentFormattingOptions DocumentFormattingOptions if err := json.Unmarshal(data, &vDocumentFormattingOptions); err == nil { o.DocumentFormattingOptions = &vDocumentFormattingOptions return nil } return fmt.Errorf("invalid BooleanOrDocumentFormattingOptions: %s", data) } type BooleanOrDocumentRangeFormattingOptions struct { Boolean *bool DocumentRangeFormattingOptions *DocumentRangeFormattingOptions } var _ json.MarshalerTo = (*BooleanOrDocumentRangeFormattingOptions)(nil) func (o *BooleanOrDocumentRangeFormattingOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrDocumentRangeFormattingOptions should be set", o.Boolean != nil, o.DocumentRangeFormattingOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.DocumentRangeFormattingOptions != nil { return json.MarshalEncode(enc, o.DocumentRangeFormattingOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrDocumentRangeFormattingOptions)(nil) func (o *BooleanOrDocumentRangeFormattingOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrDocumentRangeFormattingOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vDocumentRangeFormattingOptions DocumentRangeFormattingOptions if err := json.Unmarshal(data, &vDocumentRangeFormattingOptions); err == nil { o.DocumentRangeFormattingOptions = &vDocumentRangeFormattingOptions return nil } return fmt.Errorf("invalid BooleanOrDocumentRangeFormattingOptions: %s", data) } type BooleanOrRenameOptions struct { Boolean *bool RenameOptions *RenameOptions } var _ json.MarshalerTo = (*BooleanOrRenameOptions)(nil) func (o *BooleanOrRenameOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrRenameOptions should be set", o.Boolean != nil, o.RenameOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.RenameOptions != nil { return json.MarshalEncode(enc, o.RenameOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrRenameOptions)(nil) func (o *BooleanOrRenameOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrRenameOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vRenameOptions RenameOptions if err := json.Unmarshal(data, &vRenameOptions); err == nil { o.RenameOptions = &vRenameOptions return nil } return fmt.Errorf("invalid BooleanOrRenameOptions: %s", data) } type BooleanOrFoldingRangeOptionsOrFoldingRangeRegistrationOptions struct { Boolean *bool FoldingRangeOptions *FoldingRangeOptions FoldingRangeRegistrationOptions *FoldingRangeRegistrationOptions } var _ json.MarshalerTo = (*BooleanOrFoldingRangeOptionsOrFoldingRangeRegistrationOptions)(nil) func (o *BooleanOrFoldingRangeOptionsOrFoldingRangeRegistrationOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrFoldingRangeOptionsOrFoldingRangeRegistrationOptions should be set", o.Boolean != nil, o.FoldingRangeOptions != nil, o.FoldingRangeRegistrationOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.FoldingRangeOptions != nil { return json.MarshalEncode(enc, o.FoldingRangeOptions) } if o.FoldingRangeRegistrationOptions != nil { return json.MarshalEncode(enc, o.FoldingRangeRegistrationOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrFoldingRangeOptionsOrFoldingRangeRegistrationOptions)(nil) func (o *BooleanOrFoldingRangeOptionsOrFoldingRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrFoldingRangeOptionsOrFoldingRangeRegistrationOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vFoldingRangeOptions FoldingRangeOptions if err := json.Unmarshal(data, &vFoldingRangeOptions); err == nil { o.FoldingRangeOptions = &vFoldingRangeOptions return nil } var vFoldingRangeRegistrationOptions FoldingRangeRegistrationOptions if err := json.Unmarshal(data, &vFoldingRangeRegistrationOptions); err == nil { o.FoldingRangeRegistrationOptions = &vFoldingRangeRegistrationOptions return nil } return fmt.Errorf("invalid BooleanOrFoldingRangeOptionsOrFoldingRangeRegistrationOptions: %s", data) } type BooleanOrSelectionRangeOptionsOrSelectionRangeRegistrationOptions struct { Boolean *bool SelectionRangeOptions *SelectionRangeOptions SelectionRangeRegistrationOptions *SelectionRangeRegistrationOptions } var _ json.MarshalerTo = (*BooleanOrSelectionRangeOptionsOrSelectionRangeRegistrationOptions)(nil) func (o *BooleanOrSelectionRangeOptionsOrSelectionRangeRegistrationOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrSelectionRangeOptionsOrSelectionRangeRegistrationOptions should be set", o.Boolean != nil, o.SelectionRangeOptions != nil, o.SelectionRangeRegistrationOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.SelectionRangeOptions != nil { return json.MarshalEncode(enc, o.SelectionRangeOptions) } if o.SelectionRangeRegistrationOptions != nil { return json.MarshalEncode(enc, o.SelectionRangeRegistrationOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrSelectionRangeOptionsOrSelectionRangeRegistrationOptions)(nil) func (o *BooleanOrSelectionRangeOptionsOrSelectionRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrSelectionRangeOptionsOrSelectionRangeRegistrationOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vSelectionRangeOptions SelectionRangeOptions if err := json.Unmarshal(data, &vSelectionRangeOptions); err == nil { o.SelectionRangeOptions = &vSelectionRangeOptions return nil } var vSelectionRangeRegistrationOptions SelectionRangeRegistrationOptions if err := json.Unmarshal(data, &vSelectionRangeRegistrationOptions); err == nil { o.SelectionRangeRegistrationOptions = &vSelectionRangeRegistrationOptions return nil } return fmt.Errorf("invalid BooleanOrSelectionRangeOptionsOrSelectionRangeRegistrationOptions: %s", data) } type BooleanOrCallHierarchyOptionsOrCallHierarchyRegistrationOptions struct { Boolean *bool CallHierarchyOptions *CallHierarchyOptions CallHierarchyRegistrationOptions *CallHierarchyRegistrationOptions } var _ json.MarshalerTo = (*BooleanOrCallHierarchyOptionsOrCallHierarchyRegistrationOptions)(nil) func (o *BooleanOrCallHierarchyOptionsOrCallHierarchyRegistrationOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrCallHierarchyOptionsOrCallHierarchyRegistrationOptions should be set", o.Boolean != nil, o.CallHierarchyOptions != nil, o.CallHierarchyRegistrationOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.CallHierarchyOptions != nil { return json.MarshalEncode(enc, o.CallHierarchyOptions) } if o.CallHierarchyRegistrationOptions != nil { return json.MarshalEncode(enc, o.CallHierarchyRegistrationOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrCallHierarchyOptionsOrCallHierarchyRegistrationOptions)(nil) func (o *BooleanOrCallHierarchyOptionsOrCallHierarchyRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrCallHierarchyOptionsOrCallHierarchyRegistrationOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vCallHierarchyOptions CallHierarchyOptions if err := json.Unmarshal(data, &vCallHierarchyOptions); err == nil { o.CallHierarchyOptions = &vCallHierarchyOptions return nil } var vCallHierarchyRegistrationOptions CallHierarchyRegistrationOptions if err := json.Unmarshal(data, &vCallHierarchyRegistrationOptions); err == nil { o.CallHierarchyRegistrationOptions = &vCallHierarchyRegistrationOptions return nil } return fmt.Errorf("invalid BooleanOrCallHierarchyOptionsOrCallHierarchyRegistrationOptions: %s", data) } type BooleanOrLinkedEditingRangeOptionsOrLinkedEditingRangeRegistrationOptions struct { Boolean *bool LinkedEditingRangeOptions *LinkedEditingRangeOptions LinkedEditingRangeRegistrationOptions *LinkedEditingRangeRegistrationOptions } var _ json.MarshalerTo = (*BooleanOrLinkedEditingRangeOptionsOrLinkedEditingRangeRegistrationOptions)(nil) func (o *BooleanOrLinkedEditingRangeOptionsOrLinkedEditingRangeRegistrationOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrLinkedEditingRangeOptionsOrLinkedEditingRangeRegistrationOptions should be set", o.Boolean != nil, o.LinkedEditingRangeOptions != nil, o.LinkedEditingRangeRegistrationOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.LinkedEditingRangeOptions != nil { return json.MarshalEncode(enc, o.LinkedEditingRangeOptions) } if o.LinkedEditingRangeRegistrationOptions != nil { return json.MarshalEncode(enc, o.LinkedEditingRangeRegistrationOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrLinkedEditingRangeOptionsOrLinkedEditingRangeRegistrationOptions)(nil) func (o *BooleanOrLinkedEditingRangeOptionsOrLinkedEditingRangeRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrLinkedEditingRangeOptionsOrLinkedEditingRangeRegistrationOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vLinkedEditingRangeOptions LinkedEditingRangeOptions if err := json.Unmarshal(data, &vLinkedEditingRangeOptions); err == nil { o.LinkedEditingRangeOptions = &vLinkedEditingRangeOptions return nil } var vLinkedEditingRangeRegistrationOptions LinkedEditingRangeRegistrationOptions if err := json.Unmarshal(data, &vLinkedEditingRangeRegistrationOptions); err == nil { o.LinkedEditingRangeRegistrationOptions = &vLinkedEditingRangeRegistrationOptions return nil } return fmt.Errorf("invalid BooleanOrLinkedEditingRangeOptionsOrLinkedEditingRangeRegistrationOptions: %s", data) } type SemanticTokensOptionsOrRegistrationOptions struct { Options *SemanticTokensOptions RegistrationOptions *SemanticTokensRegistrationOptions } var _ json.MarshalerTo = (*SemanticTokensOptionsOrRegistrationOptions)(nil) func (o *SemanticTokensOptionsOrRegistrationOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of SemanticTokensOptionsOrRegistrationOptions should be set", o.Options != nil, o.RegistrationOptions != nil) if o.Options != nil { return json.MarshalEncode(enc, o.Options) } if o.RegistrationOptions != nil { return json.MarshalEncode(enc, o.RegistrationOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*SemanticTokensOptionsOrRegistrationOptions)(nil) func (o *SemanticTokensOptionsOrRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = SemanticTokensOptionsOrRegistrationOptions{} data, err := dec.ReadValue() if err != nil { return err } var vOptions SemanticTokensOptions if err := json.Unmarshal(data, &vOptions); err == nil { o.Options = &vOptions return nil } var vRegistrationOptions SemanticTokensRegistrationOptions if err := json.Unmarshal(data, &vRegistrationOptions); err == nil { o.RegistrationOptions = &vRegistrationOptions return nil } return fmt.Errorf("invalid SemanticTokensOptionsOrRegistrationOptions: %s", data) } type BooleanOrMonikerOptionsOrMonikerRegistrationOptions struct { Boolean *bool MonikerOptions *MonikerOptions MonikerRegistrationOptions *MonikerRegistrationOptions } var _ json.MarshalerTo = (*BooleanOrMonikerOptionsOrMonikerRegistrationOptions)(nil) func (o *BooleanOrMonikerOptionsOrMonikerRegistrationOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrMonikerOptionsOrMonikerRegistrationOptions should be set", o.Boolean != nil, o.MonikerOptions != nil, o.MonikerRegistrationOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.MonikerOptions != nil { return json.MarshalEncode(enc, o.MonikerOptions) } if o.MonikerRegistrationOptions != nil { return json.MarshalEncode(enc, o.MonikerRegistrationOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrMonikerOptionsOrMonikerRegistrationOptions)(nil) func (o *BooleanOrMonikerOptionsOrMonikerRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrMonikerOptionsOrMonikerRegistrationOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vMonikerOptions MonikerOptions if err := json.Unmarshal(data, &vMonikerOptions); err == nil { o.MonikerOptions = &vMonikerOptions return nil } var vMonikerRegistrationOptions MonikerRegistrationOptions if err := json.Unmarshal(data, &vMonikerRegistrationOptions); err == nil { o.MonikerRegistrationOptions = &vMonikerRegistrationOptions return nil } return fmt.Errorf("invalid BooleanOrMonikerOptionsOrMonikerRegistrationOptions: %s", data) } type BooleanOrTypeHierarchyOptionsOrTypeHierarchyRegistrationOptions struct { Boolean *bool TypeHierarchyOptions *TypeHierarchyOptions TypeHierarchyRegistrationOptions *TypeHierarchyRegistrationOptions } var _ json.MarshalerTo = (*BooleanOrTypeHierarchyOptionsOrTypeHierarchyRegistrationOptions)(nil) func (o *BooleanOrTypeHierarchyOptionsOrTypeHierarchyRegistrationOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrTypeHierarchyOptionsOrTypeHierarchyRegistrationOptions should be set", o.Boolean != nil, o.TypeHierarchyOptions != nil, o.TypeHierarchyRegistrationOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.TypeHierarchyOptions != nil { return json.MarshalEncode(enc, o.TypeHierarchyOptions) } if o.TypeHierarchyRegistrationOptions != nil { return json.MarshalEncode(enc, o.TypeHierarchyRegistrationOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrTypeHierarchyOptionsOrTypeHierarchyRegistrationOptions)(nil) func (o *BooleanOrTypeHierarchyOptionsOrTypeHierarchyRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrTypeHierarchyOptionsOrTypeHierarchyRegistrationOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vTypeHierarchyOptions TypeHierarchyOptions if err := json.Unmarshal(data, &vTypeHierarchyOptions); err == nil { o.TypeHierarchyOptions = &vTypeHierarchyOptions return nil } var vTypeHierarchyRegistrationOptions TypeHierarchyRegistrationOptions if err := json.Unmarshal(data, &vTypeHierarchyRegistrationOptions); err == nil { o.TypeHierarchyRegistrationOptions = &vTypeHierarchyRegistrationOptions return nil } return fmt.Errorf("invalid BooleanOrTypeHierarchyOptionsOrTypeHierarchyRegistrationOptions: %s", data) } type BooleanOrInlineValueOptionsOrInlineValueRegistrationOptions struct { Boolean *bool InlineValueOptions *InlineValueOptions InlineValueRegistrationOptions *InlineValueRegistrationOptions } var _ json.MarshalerTo = (*BooleanOrInlineValueOptionsOrInlineValueRegistrationOptions)(nil) func (o *BooleanOrInlineValueOptionsOrInlineValueRegistrationOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrInlineValueOptionsOrInlineValueRegistrationOptions should be set", o.Boolean != nil, o.InlineValueOptions != nil, o.InlineValueRegistrationOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.InlineValueOptions != nil { return json.MarshalEncode(enc, o.InlineValueOptions) } if o.InlineValueRegistrationOptions != nil { return json.MarshalEncode(enc, o.InlineValueRegistrationOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrInlineValueOptionsOrInlineValueRegistrationOptions)(nil) func (o *BooleanOrInlineValueOptionsOrInlineValueRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrInlineValueOptionsOrInlineValueRegistrationOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vInlineValueOptions InlineValueOptions if err := json.Unmarshal(data, &vInlineValueOptions); err == nil { o.InlineValueOptions = &vInlineValueOptions return nil } var vInlineValueRegistrationOptions InlineValueRegistrationOptions if err := json.Unmarshal(data, &vInlineValueRegistrationOptions); err == nil { o.InlineValueRegistrationOptions = &vInlineValueRegistrationOptions return nil } return fmt.Errorf("invalid BooleanOrInlineValueOptionsOrInlineValueRegistrationOptions: %s", data) } type BooleanOrInlayHintOptionsOrInlayHintRegistrationOptions struct { Boolean *bool InlayHintOptions *InlayHintOptions InlayHintRegistrationOptions *InlayHintRegistrationOptions } var _ json.MarshalerTo = (*BooleanOrInlayHintOptionsOrInlayHintRegistrationOptions)(nil) func (o *BooleanOrInlayHintOptionsOrInlayHintRegistrationOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrInlayHintOptionsOrInlayHintRegistrationOptions should be set", o.Boolean != nil, o.InlayHintOptions != nil, o.InlayHintRegistrationOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.InlayHintOptions != nil { return json.MarshalEncode(enc, o.InlayHintOptions) } if o.InlayHintRegistrationOptions != nil { return json.MarshalEncode(enc, o.InlayHintRegistrationOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrInlayHintOptionsOrInlayHintRegistrationOptions)(nil) func (o *BooleanOrInlayHintOptionsOrInlayHintRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrInlayHintOptionsOrInlayHintRegistrationOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vInlayHintOptions InlayHintOptions if err := json.Unmarshal(data, &vInlayHintOptions); err == nil { o.InlayHintOptions = &vInlayHintOptions return nil } var vInlayHintRegistrationOptions InlayHintRegistrationOptions if err := json.Unmarshal(data, &vInlayHintRegistrationOptions); err == nil { o.InlayHintRegistrationOptions = &vInlayHintRegistrationOptions return nil } return fmt.Errorf("invalid BooleanOrInlayHintOptionsOrInlayHintRegistrationOptions: %s", data) } type DiagnosticOptionsOrRegistrationOptions struct { Options *DiagnosticOptions RegistrationOptions *DiagnosticRegistrationOptions } var _ json.MarshalerTo = (*DiagnosticOptionsOrRegistrationOptions)(nil) func (o *DiagnosticOptionsOrRegistrationOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of DiagnosticOptionsOrRegistrationOptions should be set", o.Options != nil, o.RegistrationOptions != nil) if o.Options != nil { return json.MarshalEncode(enc, o.Options) } if o.RegistrationOptions != nil { return json.MarshalEncode(enc, o.RegistrationOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*DiagnosticOptionsOrRegistrationOptions)(nil) func (o *DiagnosticOptionsOrRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = DiagnosticOptionsOrRegistrationOptions{} data, err := dec.ReadValue() if err != nil { return err } var vOptions DiagnosticOptions if err := json.Unmarshal(data, &vOptions); err == nil { o.Options = &vOptions return nil } var vRegistrationOptions DiagnosticRegistrationOptions if err := json.Unmarshal(data, &vRegistrationOptions); err == nil { o.RegistrationOptions = &vRegistrationOptions return nil } return fmt.Errorf("invalid DiagnosticOptionsOrRegistrationOptions: %s", data) } type BooleanOrInlineCompletionOptions struct { Boolean *bool InlineCompletionOptions *InlineCompletionOptions } var _ json.MarshalerTo = (*BooleanOrInlineCompletionOptions)(nil) func (o *BooleanOrInlineCompletionOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrInlineCompletionOptions should be set", o.Boolean != nil, o.InlineCompletionOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.InlineCompletionOptions != nil { return json.MarshalEncode(enc, o.InlineCompletionOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrInlineCompletionOptions)(nil) func (o *BooleanOrInlineCompletionOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrInlineCompletionOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vInlineCompletionOptions InlineCompletionOptions if err := json.Unmarshal(data, &vInlineCompletionOptions); err == nil { o.InlineCompletionOptions = &vInlineCompletionOptions return nil } return fmt.Errorf("invalid BooleanOrInlineCompletionOptions: %s", data) } type PatternOrRelativePattern struct { Pattern *string RelativePattern *RelativePattern } var _ json.MarshalerTo = (*PatternOrRelativePattern)(nil) func (o *PatternOrRelativePattern) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of PatternOrRelativePattern should be set", o.Pattern != nil, o.RelativePattern != nil) if o.Pattern != nil { return json.MarshalEncode(enc, o.Pattern) } if o.RelativePattern != nil { return json.MarshalEncode(enc, o.RelativePattern) } panic("unreachable") } var _ json.UnmarshalerFrom = (*PatternOrRelativePattern)(nil) func (o *PatternOrRelativePattern) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = PatternOrRelativePattern{} data, err := dec.ReadValue() if err != nil { return err } var vPattern string if err := json.Unmarshal(data, &vPattern); err == nil { o.Pattern = &vPattern return nil } var vRelativePattern RelativePattern if err := json.Unmarshal(data, &vRelativePattern); err == nil { o.RelativePattern = &vRelativePattern return nil } return fmt.Errorf("invalid PatternOrRelativePattern: %s", data) } type RangeOrEditRangeWithInsertReplace struct { Range *Range EditRangeWithInsertReplace *EditRangeWithInsertReplace } var _ json.MarshalerTo = (*RangeOrEditRangeWithInsertReplace)(nil) func (o *RangeOrEditRangeWithInsertReplace) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of RangeOrEditRangeWithInsertReplace should be set", o.Range != nil, o.EditRangeWithInsertReplace != nil) if o.Range != nil { return json.MarshalEncode(enc, o.Range) } if o.EditRangeWithInsertReplace != nil { return json.MarshalEncode(enc, o.EditRangeWithInsertReplace) } panic("unreachable") } var _ json.UnmarshalerFrom = (*RangeOrEditRangeWithInsertReplace)(nil) func (o *RangeOrEditRangeWithInsertReplace) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = RangeOrEditRangeWithInsertReplace{} data, err := dec.ReadValue() if err != nil { return err } var vRange Range if err := json.Unmarshal(data, &vRange); err == nil { o.Range = &vRange return nil } var vEditRangeWithInsertReplace EditRangeWithInsertReplace if err := json.Unmarshal(data, &vEditRangeWithInsertReplace); err == nil { o.EditRangeWithInsertReplace = &vEditRangeWithInsertReplace return nil } return fmt.Errorf("invalid RangeOrEditRangeWithInsertReplace: %s", data) } type StringOrNotebookDocumentFilterNotebookTypeOrNotebookDocumentFilterSchemeOrNotebookDocumentFilterPattern struct { String *string NotebookDocumentFilterNotebookType *NotebookDocumentFilterNotebookType NotebookDocumentFilterScheme *NotebookDocumentFilterScheme NotebookDocumentFilterPattern *NotebookDocumentFilterPattern } var _ json.MarshalerTo = (*StringOrNotebookDocumentFilterNotebookTypeOrNotebookDocumentFilterSchemeOrNotebookDocumentFilterPattern)(nil) func (o *StringOrNotebookDocumentFilterNotebookTypeOrNotebookDocumentFilterSchemeOrNotebookDocumentFilterPattern) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of StringOrNotebookDocumentFilterNotebookTypeOrNotebookDocumentFilterSchemeOrNotebookDocumentFilterPattern should be set", o.String != nil, o.NotebookDocumentFilterNotebookType != nil, o.NotebookDocumentFilterScheme != nil, o.NotebookDocumentFilterPattern != nil) if o.String != nil { return json.MarshalEncode(enc, o.String) } if o.NotebookDocumentFilterNotebookType != nil { return json.MarshalEncode(enc, o.NotebookDocumentFilterNotebookType) } if o.NotebookDocumentFilterScheme != nil { return json.MarshalEncode(enc, o.NotebookDocumentFilterScheme) } if o.NotebookDocumentFilterPattern != nil { return json.MarshalEncode(enc, o.NotebookDocumentFilterPattern) } panic("unreachable") } var _ json.UnmarshalerFrom = (*StringOrNotebookDocumentFilterNotebookTypeOrNotebookDocumentFilterSchemeOrNotebookDocumentFilterPattern)(nil) func (o *StringOrNotebookDocumentFilterNotebookTypeOrNotebookDocumentFilterSchemeOrNotebookDocumentFilterPattern) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = StringOrNotebookDocumentFilterNotebookTypeOrNotebookDocumentFilterSchemeOrNotebookDocumentFilterPattern{} data, err := dec.ReadValue() if err != nil { return err } var vString string if err := json.Unmarshal(data, &vString); err == nil { o.String = &vString return nil } var vNotebookDocumentFilterNotebookType NotebookDocumentFilterNotebookType if err := json.Unmarshal(data, &vNotebookDocumentFilterNotebookType); err == nil { o.NotebookDocumentFilterNotebookType = &vNotebookDocumentFilterNotebookType return nil } var vNotebookDocumentFilterScheme NotebookDocumentFilterScheme if err := json.Unmarshal(data, &vNotebookDocumentFilterScheme); err == nil { o.NotebookDocumentFilterScheme = &vNotebookDocumentFilterScheme return nil } var vNotebookDocumentFilterPattern NotebookDocumentFilterPattern if err := json.Unmarshal(data, &vNotebookDocumentFilterPattern); err == nil { o.NotebookDocumentFilterPattern = &vNotebookDocumentFilterPattern return nil } return fmt.Errorf("invalid StringOrNotebookDocumentFilterNotebookTypeOrNotebookDocumentFilterSchemeOrNotebookDocumentFilterPattern: %s", data) } type BooleanOrSaveOptions struct { Boolean *bool SaveOptions *SaveOptions } var _ json.MarshalerTo = (*BooleanOrSaveOptions)(nil) func (o *BooleanOrSaveOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrSaveOptions should be set", o.Boolean != nil, o.SaveOptions != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.SaveOptions != nil { return json.MarshalEncode(enc, o.SaveOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrSaveOptions)(nil) func (o *BooleanOrSaveOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrSaveOptions{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vSaveOptions SaveOptions if err := json.Unmarshal(data, &vSaveOptions); err == nil { o.SaveOptions = &vSaveOptions return nil } return fmt.Errorf("invalid BooleanOrSaveOptions: %s", data) } type TextDocumentContentOptionsOrRegistrationOptions struct { Options *TextDocumentContentOptions RegistrationOptions *TextDocumentContentRegistrationOptions } var _ json.MarshalerTo = (*TextDocumentContentOptionsOrRegistrationOptions)(nil) func (o *TextDocumentContentOptionsOrRegistrationOptions) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of TextDocumentContentOptionsOrRegistrationOptions should be set", o.Options != nil, o.RegistrationOptions != nil) if o.Options != nil { return json.MarshalEncode(enc, o.Options) } if o.RegistrationOptions != nil { return json.MarshalEncode(enc, o.RegistrationOptions) } panic("unreachable") } var _ json.UnmarshalerFrom = (*TextDocumentContentOptionsOrRegistrationOptions)(nil) func (o *TextDocumentContentOptionsOrRegistrationOptions) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = TextDocumentContentOptionsOrRegistrationOptions{} data, err := dec.ReadValue() if err != nil { return err } var vOptions TextDocumentContentOptions if err := json.Unmarshal(data, &vOptions); err == nil { o.Options = &vOptions return nil } var vRegistrationOptions TextDocumentContentRegistrationOptions if err := json.Unmarshal(data, &vRegistrationOptions); err == nil { o.RegistrationOptions = &vRegistrationOptions return nil } return fmt.Errorf("invalid TextDocumentContentOptionsOrRegistrationOptions: %s", data) } type StringOrTuple struct { String *string Tuple *[2]uint32 } var _ json.MarshalerTo = (*StringOrTuple)(nil) func (o *StringOrTuple) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of StringOrTuple should be set", o.String != nil, o.Tuple != nil) if o.String != nil { return json.MarshalEncode(enc, o.String) } if o.Tuple != nil { return json.MarshalEncode(enc, o.Tuple) } panic("unreachable") } var _ json.UnmarshalerFrom = (*StringOrTuple)(nil) func (o *StringOrTuple) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = StringOrTuple{} data, err := dec.ReadValue() if err != nil { return err } var vString string if err := json.Unmarshal(data, &vString); err == nil { o.String = &vString return nil } var vTuple [2]uint32 if err := json.Unmarshal(data, &vTuple); err == nil { o.Tuple = &vTuple return nil } return fmt.Errorf("invalid StringOrTuple: %s", data) } type StringOrBoolean struct { String *string Boolean *bool } var _ json.MarshalerTo = (*StringOrBoolean)(nil) func (o *StringOrBoolean) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of StringOrBoolean should be set", o.String != nil, o.Boolean != nil) if o.String != nil { return json.MarshalEncode(enc, o.String) } if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } panic("unreachable") } var _ json.UnmarshalerFrom = (*StringOrBoolean)(nil) func (o *StringOrBoolean) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = StringOrBoolean{} data, err := dec.ReadValue() if err != nil { return err } var vString string if err := json.Unmarshal(data, &vString); err == nil { o.String = &vString return nil } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } return fmt.Errorf("invalid StringOrBoolean: %s", data) } type WorkspaceFolderOrURI struct { WorkspaceFolder *WorkspaceFolder URI *URI } var _ json.MarshalerTo = (*WorkspaceFolderOrURI)(nil) func (o *WorkspaceFolderOrURI) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of WorkspaceFolderOrURI should be set", o.WorkspaceFolder != nil, o.URI != nil) if o.WorkspaceFolder != nil { return json.MarshalEncode(enc, o.WorkspaceFolder) } if o.URI != nil { return json.MarshalEncode(enc, o.URI) } panic("unreachable") } var _ json.UnmarshalerFrom = (*WorkspaceFolderOrURI)(nil) func (o *WorkspaceFolderOrURI) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = WorkspaceFolderOrURI{} data, err := dec.ReadValue() if err != nil { return err } var vWorkspaceFolder WorkspaceFolder if err := json.Unmarshal(data, &vWorkspaceFolder); err == nil { o.WorkspaceFolder = &vWorkspaceFolder return nil } var vURI URI if err := json.Unmarshal(data, &vURI); err == nil { o.URI = &vURI return nil } return fmt.Errorf("invalid WorkspaceFolderOrURI: %s", data) } type BooleanOrClientSemanticTokensRequestFullDelta struct { Boolean *bool ClientSemanticTokensRequestFullDelta *ClientSemanticTokensRequestFullDelta } var _ json.MarshalerTo = (*BooleanOrClientSemanticTokensRequestFullDelta)(nil) func (o *BooleanOrClientSemanticTokensRequestFullDelta) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of BooleanOrClientSemanticTokensRequestFullDelta should be set", o.Boolean != nil, o.ClientSemanticTokensRequestFullDelta != nil) if o.Boolean != nil { return json.MarshalEncode(enc, o.Boolean) } if o.ClientSemanticTokensRequestFullDelta != nil { return json.MarshalEncode(enc, o.ClientSemanticTokensRequestFullDelta) } panic("unreachable") } var _ json.UnmarshalerFrom = (*BooleanOrClientSemanticTokensRequestFullDelta)(nil) func (o *BooleanOrClientSemanticTokensRequestFullDelta) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = BooleanOrClientSemanticTokensRequestFullDelta{} data, err := dec.ReadValue() if err != nil { return err } var vBoolean bool if err := json.Unmarshal(data, &vBoolean); err == nil { o.Boolean = &vBoolean return nil } var vClientSemanticTokensRequestFullDelta ClientSemanticTokensRequestFullDelta if err := json.Unmarshal(data, &vClientSemanticTokensRequestFullDelta); err == nil { o.ClientSemanticTokensRequestFullDelta = &vClientSemanticTokensRequestFullDelta return nil } return fmt.Errorf("invalid BooleanOrClientSemanticTokensRequestFullDelta: %s", data) } type LocationOrLocationsOrDefinitionLinksOrNull struct { Location *Location Locations *[]Location DefinitionLinks *[]*LocationLink } var _ json.MarshalerTo = (*LocationOrLocationsOrDefinitionLinksOrNull)(nil) func (o *LocationOrLocationsOrDefinitionLinksOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of LocationOrLocationsOrDefinitionLinksOrNull is set", o.Location != nil, o.Locations != nil, o.DefinitionLinks != nil) if o.Location != nil { return json.MarshalEncode(enc, o.Location) } if o.Locations != nil { return json.MarshalEncode(enc, o.Locations) } if o.DefinitionLinks != nil { return json.MarshalEncode(enc, o.DefinitionLinks) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*LocationOrLocationsOrDefinitionLinksOrNull)(nil) func (o *LocationOrLocationsOrDefinitionLinksOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = LocationOrLocationsOrDefinitionLinksOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vLocation Location if err := json.Unmarshal(data, &vLocation); err == nil { o.Location = &vLocation return nil } var vLocations []Location if err := json.Unmarshal(data, &vLocations); err == nil { o.Locations = &vLocations return nil } var vDefinitionLinks []*LocationLink if err := json.Unmarshal(data, &vDefinitionLinks); err == nil { o.DefinitionLinks = &vDefinitionLinks return nil } return fmt.Errorf("invalid LocationOrLocationsOrDefinitionLinksOrNull: %s", data) } type FoldingRangesOrNull struct { FoldingRanges *[]*FoldingRange } var _ json.MarshalerTo = (*FoldingRangesOrNull)(nil) func (o *FoldingRangesOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of FoldingRangesOrNull is set", o.FoldingRanges != nil) if o.FoldingRanges != nil { return json.MarshalEncode(enc, o.FoldingRanges) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*FoldingRangesOrNull)(nil) func (o *FoldingRangesOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = FoldingRangesOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vFoldingRanges []*FoldingRange if err := json.Unmarshal(data, &vFoldingRanges); err == nil { o.FoldingRanges = &vFoldingRanges return nil } return fmt.Errorf("invalid FoldingRangesOrNull: %s", data) } type LocationOrLocationsOrDeclarationLinksOrNull struct { Location *Location Locations *[]Location DeclarationLinks *[]*LocationLink } var _ json.MarshalerTo = (*LocationOrLocationsOrDeclarationLinksOrNull)(nil) func (o *LocationOrLocationsOrDeclarationLinksOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of LocationOrLocationsOrDeclarationLinksOrNull is set", o.Location != nil, o.Locations != nil, o.DeclarationLinks != nil) if o.Location != nil { return json.MarshalEncode(enc, o.Location) } if o.Locations != nil { return json.MarshalEncode(enc, o.Locations) } if o.DeclarationLinks != nil { return json.MarshalEncode(enc, o.DeclarationLinks) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*LocationOrLocationsOrDeclarationLinksOrNull)(nil) func (o *LocationOrLocationsOrDeclarationLinksOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = LocationOrLocationsOrDeclarationLinksOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vLocation Location if err := json.Unmarshal(data, &vLocation); err == nil { o.Location = &vLocation return nil } var vLocations []Location if err := json.Unmarshal(data, &vLocations); err == nil { o.Locations = &vLocations return nil } var vDeclarationLinks []*LocationLink if err := json.Unmarshal(data, &vDeclarationLinks); err == nil { o.DeclarationLinks = &vDeclarationLinks return nil } return fmt.Errorf("invalid LocationOrLocationsOrDeclarationLinksOrNull: %s", data) } type SelectionRangesOrNull struct { SelectionRanges *[]*SelectionRange } var _ json.MarshalerTo = (*SelectionRangesOrNull)(nil) func (o *SelectionRangesOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of SelectionRangesOrNull is set", o.SelectionRanges != nil) if o.SelectionRanges != nil { return json.MarshalEncode(enc, o.SelectionRanges) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*SelectionRangesOrNull)(nil) func (o *SelectionRangesOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = SelectionRangesOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vSelectionRanges []*SelectionRange if err := json.Unmarshal(data, &vSelectionRanges); err == nil { o.SelectionRanges = &vSelectionRanges return nil } return fmt.Errorf("invalid SelectionRangesOrNull: %s", data) } type CallHierarchyItemsOrNull struct { CallHierarchyItems *[]*CallHierarchyItem } var _ json.MarshalerTo = (*CallHierarchyItemsOrNull)(nil) func (o *CallHierarchyItemsOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of CallHierarchyItemsOrNull is set", o.CallHierarchyItems != nil) if o.CallHierarchyItems != nil { return json.MarshalEncode(enc, o.CallHierarchyItems) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*CallHierarchyItemsOrNull)(nil) func (o *CallHierarchyItemsOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = CallHierarchyItemsOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vCallHierarchyItems []*CallHierarchyItem if err := json.Unmarshal(data, &vCallHierarchyItems); err == nil { o.CallHierarchyItems = &vCallHierarchyItems return nil } return fmt.Errorf("invalid CallHierarchyItemsOrNull: %s", data) } type CallHierarchyIncomingCallsOrNull struct { CallHierarchyIncomingCalls *[]*CallHierarchyIncomingCall } var _ json.MarshalerTo = (*CallHierarchyIncomingCallsOrNull)(nil) func (o *CallHierarchyIncomingCallsOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of CallHierarchyIncomingCallsOrNull is set", o.CallHierarchyIncomingCalls != nil) if o.CallHierarchyIncomingCalls != nil { return json.MarshalEncode(enc, o.CallHierarchyIncomingCalls) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*CallHierarchyIncomingCallsOrNull)(nil) func (o *CallHierarchyIncomingCallsOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = CallHierarchyIncomingCallsOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vCallHierarchyIncomingCalls []*CallHierarchyIncomingCall if err := json.Unmarshal(data, &vCallHierarchyIncomingCalls); err == nil { o.CallHierarchyIncomingCalls = &vCallHierarchyIncomingCalls return nil } return fmt.Errorf("invalid CallHierarchyIncomingCallsOrNull: %s", data) } type CallHierarchyOutgoingCallsOrNull struct { CallHierarchyOutgoingCalls *[]*CallHierarchyOutgoingCall } var _ json.MarshalerTo = (*CallHierarchyOutgoingCallsOrNull)(nil) func (o *CallHierarchyOutgoingCallsOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of CallHierarchyOutgoingCallsOrNull is set", o.CallHierarchyOutgoingCalls != nil) if o.CallHierarchyOutgoingCalls != nil { return json.MarshalEncode(enc, o.CallHierarchyOutgoingCalls) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*CallHierarchyOutgoingCallsOrNull)(nil) func (o *CallHierarchyOutgoingCallsOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = CallHierarchyOutgoingCallsOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vCallHierarchyOutgoingCalls []*CallHierarchyOutgoingCall if err := json.Unmarshal(data, &vCallHierarchyOutgoingCalls); err == nil { o.CallHierarchyOutgoingCalls = &vCallHierarchyOutgoingCalls return nil } return fmt.Errorf("invalid CallHierarchyOutgoingCallsOrNull: %s", data) } type SemanticTokensOrNull struct { SemanticTokens *SemanticTokens } var _ json.MarshalerTo = (*SemanticTokensOrNull)(nil) func (o *SemanticTokensOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of SemanticTokensOrNull is set", o.SemanticTokens != nil) if o.SemanticTokens != nil { return json.MarshalEncode(enc, o.SemanticTokens) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*SemanticTokensOrNull)(nil) func (o *SemanticTokensOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = SemanticTokensOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vSemanticTokens SemanticTokens if err := json.Unmarshal(data, &vSemanticTokens); err == nil { o.SemanticTokens = &vSemanticTokens return nil } return fmt.Errorf("invalid SemanticTokensOrNull: %s", data) } type SemanticTokensOrSemanticTokensDeltaOrNull struct { SemanticTokens *SemanticTokens SemanticTokensDelta *SemanticTokensDelta } var _ json.MarshalerTo = (*SemanticTokensOrSemanticTokensDeltaOrNull)(nil) func (o *SemanticTokensOrSemanticTokensDeltaOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of SemanticTokensOrSemanticTokensDeltaOrNull is set", o.SemanticTokens != nil, o.SemanticTokensDelta != nil) if o.SemanticTokens != nil { return json.MarshalEncode(enc, o.SemanticTokens) } if o.SemanticTokensDelta != nil { return json.MarshalEncode(enc, o.SemanticTokensDelta) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*SemanticTokensOrSemanticTokensDeltaOrNull)(nil) func (o *SemanticTokensOrSemanticTokensDeltaOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = SemanticTokensOrSemanticTokensDeltaOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vSemanticTokens SemanticTokens if err := json.Unmarshal(data, &vSemanticTokens); err == nil { o.SemanticTokens = &vSemanticTokens return nil } var vSemanticTokensDelta SemanticTokensDelta if err := json.Unmarshal(data, &vSemanticTokensDelta); err == nil { o.SemanticTokensDelta = &vSemanticTokensDelta return nil } return fmt.Errorf("invalid SemanticTokensOrSemanticTokensDeltaOrNull: %s", data) } type LinkedEditingRangesOrNull struct { LinkedEditingRanges *LinkedEditingRanges } var _ json.MarshalerTo = (*LinkedEditingRangesOrNull)(nil) func (o *LinkedEditingRangesOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of LinkedEditingRangesOrNull is set", o.LinkedEditingRanges != nil) if o.LinkedEditingRanges != nil { return json.MarshalEncode(enc, o.LinkedEditingRanges) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*LinkedEditingRangesOrNull)(nil) func (o *LinkedEditingRangesOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = LinkedEditingRangesOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vLinkedEditingRanges LinkedEditingRanges if err := json.Unmarshal(data, &vLinkedEditingRanges); err == nil { o.LinkedEditingRanges = &vLinkedEditingRanges return nil } return fmt.Errorf("invalid LinkedEditingRangesOrNull: %s", data) } type WorkspaceEditOrNull struct { WorkspaceEdit *WorkspaceEdit } var _ json.MarshalerTo = (*WorkspaceEditOrNull)(nil) func (o *WorkspaceEditOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of WorkspaceEditOrNull is set", o.WorkspaceEdit != nil) if o.WorkspaceEdit != nil { return json.MarshalEncode(enc, o.WorkspaceEdit) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*WorkspaceEditOrNull)(nil) func (o *WorkspaceEditOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = WorkspaceEditOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vWorkspaceEdit WorkspaceEdit if err := json.Unmarshal(data, &vWorkspaceEdit); err == nil { o.WorkspaceEdit = &vWorkspaceEdit return nil } return fmt.Errorf("invalid WorkspaceEditOrNull: %s", data) } type MonikersOrNull struct { Monikers *[]*Moniker } var _ json.MarshalerTo = (*MonikersOrNull)(nil) func (o *MonikersOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of MonikersOrNull is set", o.Monikers != nil) if o.Monikers != nil { return json.MarshalEncode(enc, o.Monikers) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*MonikersOrNull)(nil) func (o *MonikersOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = MonikersOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vMonikers []*Moniker if err := json.Unmarshal(data, &vMonikers); err == nil { o.Monikers = &vMonikers return nil } return fmt.Errorf("invalid MonikersOrNull: %s", data) } type TypeHierarchyItemsOrNull struct { TypeHierarchyItems *[]*TypeHierarchyItem } var _ json.MarshalerTo = (*TypeHierarchyItemsOrNull)(nil) func (o *TypeHierarchyItemsOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of TypeHierarchyItemsOrNull is set", o.TypeHierarchyItems != nil) if o.TypeHierarchyItems != nil { return json.MarshalEncode(enc, o.TypeHierarchyItems) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*TypeHierarchyItemsOrNull)(nil) func (o *TypeHierarchyItemsOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = TypeHierarchyItemsOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vTypeHierarchyItems []*TypeHierarchyItem if err := json.Unmarshal(data, &vTypeHierarchyItems); err == nil { o.TypeHierarchyItems = &vTypeHierarchyItems return nil } return fmt.Errorf("invalid TypeHierarchyItemsOrNull: %s", data) } type InlineValuesOrNull struct { InlineValues *[]InlineValueTextOrVariableLookupOrEvaluatableExpression } var _ json.MarshalerTo = (*InlineValuesOrNull)(nil) func (o *InlineValuesOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of InlineValuesOrNull is set", o.InlineValues != nil) if o.InlineValues != nil { return json.MarshalEncode(enc, o.InlineValues) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*InlineValuesOrNull)(nil) func (o *InlineValuesOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = InlineValuesOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vInlineValues []InlineValueTextOrVariableLookupOrEvaluatableExpression if err := json.Unmarshal(data, &vInlineValues); err == nil { o.InlineValues = &vInlineValues return nil } return fmt.Errorf("invalid InlineValuesOrNull: %s", data) } type InlayHintsOrNull struct { InlayHints *[]*InlayHint } var _ json.MarshalerTo = (*InlayHintsOrNull)(nil) func (o *InlayHintsOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of InlayHintsOrNull is set", o.InlayHints != nil) if o.InlayHints != nil { return json.MarshalEncode(enc, o.InlayHints) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*InlayHintsOrNull)(nil) func (o *InlayHintsOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = InlayHintsOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vInlayHints []*InlayHint if err := json.Unmarshal(data, &vInlayHints); err == nil { o.InlayHints = &vInlayHints return nil } return fmt.Errorf("invalid InlayHintsOrNull: %s", data) } type RelatedFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport struct { FullDocumentDiagnosticReport *RelatedFullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport *RelatedUnchangedDocumentDiagnosticReport } var _ json.MarshalerTo = (*RelatedFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport)(nil) func (o *RelatedFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of RelatedFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport should be set", o.FullDocumentDiagnosticReport != nil, o.UnchangedDocumentDiagnosticReport != nil) if o.FullDocumentDiagnosticReport != nil { return json.MarshalEncode(enc, o.FullDocumentDiagnosticReport) } if o.UnchangedDocumentDiagnosticReport != nil { return json.MarshalEncode(enc, o.UnchangedDocumentDiagnosticReport) } panic("unreachable") } var _ json.UnmarshalerFrom = (*RelatedFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport)(nil) func (o *RelatedFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = RelatedFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport{} data, err := dec.ReadValue() if err != nil { return err } var vFullDocumentDiagnosticReport RelatedFullDocumentDiagnosticReport if err := json.Unmarshal(data, &vFullDocumentDiagnosticReport); err == nil { o.FullDocumentDiagnosticReport = &vFullDocumentDiagnosticReport return nil } var vUnchangedDocumentDiagnosticReport RelatedUnchangedDocumentDiagnosticReport if err := json.Unmarshal(data, &vUnchangedDocumentDiagnosticReport); err == nil { o.UnchangedDocumentDiagnosticReport = &vUnchangedDocumentDiagnosticReport return nil } return fmt.Errorf("invalid RelatedFullDocumentDiagnosticReportOrUnchangedDocumentDiagnosticReport: %s", data) } type InlineCompletionListOrItemsOrNull struct { List *InlineCompletionList Items *[]*InlineCompletionItem } var _ json.MarshalerTo = (*InlineCompletionListOrItemsOrNull)(nil) func (o *InlineCompletionListOrItemsOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of InlineCompletionListOrItemsOrNull is set", o.List != nil, o.Items != nil) if o.List != nil { return json.MarshalEncode(enc, o.List) } if o.Items != nil { return json.MarshalEncode(enc, o.Items) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*InlineCompletionListOrItemsOrNull)(nil) func (o *InlineCompletionListOrItemsOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = InlineCompletionListOrItemsOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vList InlineCompletionList if err := json.Unmarshal(data, &vList); err == nil { o.List = &vList return nil } var vItems []*InlineCompletionItem if err := json.Unmarshal(data, &vItems); err == nil { o.Items = &vItems return nil } return fmt.Errorf("invalid InlineCompletionListOrItemsOrNull: %s", data) } type MessageActionItemOrNull struct { MessageActionItem *MessageActionItem } var _ json.MarshalerTo = (*MessageActionItemOrNull)(nil) func (o *MessageActionItemOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of MessageActionItemOrNull is set", o.MessageActionItem != nil) if o.MessageActionItem != nil { return json.MarshalEncode(enc, o.MessageActionItem) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*MessageActionItemOrNull)(nil) func (o *MessageActionItemOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = MessageActionItemOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vMessageActionItem MessageActionItem if err := json.Unmarshal(data, &vMessageActionItem); err == nil { o.MessageActionItem = &vMessageActionItem return nil } return fmt.Errorf("invalid MessageActionItemOrNull: %s", data) } type TextEditsOrNull struct { TextEdits *[]*TextEdit } var _ json.MarshalerTo = (*TextEditsOrNull)(nil) func (o *TextEditsOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of TextEditsOrNull is set", o.TextEdits != nil) if o.TextEdits != nil { return json.MarshalEncode(enc, o.TextEdits) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*TextEditsOrNull)(nil) func (o *TextEditsOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = TextEditsOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vTextEdits []*TextEdit if err := json.Unmarshal(data, &vTextEdits); err == nil { o.TextEdits = &vTextEdits return nil } return fmt.Errorf("invalid TextEditsOrNull: %s", data) } type CompletionItemsOrListOrNull struct { Items *[]*CompletionItem List *CompletionList } var _ json.MarshalerTo = (*CompletionItemsOrListOrNull)(nil) func (o *CompletionItemsOrListOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of CompletionItemsOrListOrNull is set", o.Items != nil, o.List != nil) if o.Items != nil { return json.MarshalEncode(enc, o.Items) } if o.List != nil { return json.MarshalEncode(enc, o.List) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*CompletionItemsOrListOrNull)(nil) func (o *CompletionItemsOrListOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = CompletionItemsOrListOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vItems []*CompletionItem if err := json.Unmarshal(data, &vItems); err == nil { o.Items = &vItems return nil } var vList CompletionList if err := json.Unmarshal(data, &vList); err == nil { o.List = &vList return nil } return fmt.Errorf("invalid CompletionItemsOrListOrNull: %s", data) } type HoverOrNull struct { Hover *Hover } var _ json.MarshalerTo = (*HoverOrNull)(nil) func (o *HoverOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of HoverOrNull is set", o.Hover != nil) if o.Hover != nil { return json.MarshalEncode(enc, o.Hover) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*HoverOrNull)(nil) func (o *HoverOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = HoverOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vHover Hover if err := json.Unmarshal(data, &vHover); err == nil { o.Hover = &vHover return nil } return fmt.Errorf("invalid HoverOrNull: %s", data) } type SignatureHelpOrNull struct { SignatureHelp *SignatureHelp } var _ json.MarshalerTo = (*SignatureHelpOrNull)(nil) func (o *SignatureHelpOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of SignatureHelpOrNull is set", o.SignatureHelp != nil) if o.SignatureHelp != nil { return json.MarshalEncode(enc, o.SignatureHelp) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*SignatureHelpOrNull)(nil) func (o *SignatureHelpOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = SignatureHelpOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vSignatureHelp SignatureHelp if err := json.Unmarshal(data, &vSignatureHelp); err == nil { o.SignatureHelp = &vSignatureHelp return nil } return fmt.Errorf("invalid SignatureHelpOrNull: %s", data) } type LocationsOrNull struct { Locations *[]Location } var _ json.MarshalerTo = (*LocationsOrNull)(nil) func (o *LocationsOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of LocationsOrNull is set", o.Locations != nil) if o.Locations != nil { return json.MarshalEncode(enc, o.Locations) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*LocationsOrNull)(nil) func (o *LocationsOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = LocationsOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vLocations []Location if err := json.Unmarshal(data, &vLocations); err == nil { o.Locations = &vLocations return nil } return fmt.Errorf("invalid LocationsOrNull: %s", data) } type DocumentHighlightsOrNull struct { DocumentHighlights *[]*DocumentHighlight } var _ json.MarshalerTo = (*DocumentHighlightsOrNull)(nil) func (o *DocumentHighlightsOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of DocumentHighlightsOrNull is set", o.DocumentHighlights != nil) if o.DocumentHighlights != nil { return json.MarshalEncode(enc, o.DocumentHighlights) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*DocumentHighlightsOrNull)(nil) func (o *DocumentHighlightsOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = DocumentHighlightsOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vDocumentHighlights []*DocumentHighlight if err := json.Unmarshal(data, &vDocumentHighlights); err == nil { o.DocumentHighlights = &vDocumentHighlights return nil } return fmt.Errorf("invalid DocumentHighlightsOrNull: %s", data) } type SymbolInformationsOrDocumentSymbolsOrNull struct { SymbolInformations *[]*SymbolInformation DocumentSymbols *[]*DocumentSymbol } var _ json.MarshalerTo = (*SymbolInformationsOrDocumentSymbolsOrNull)(nil) func (o *SymbolInformationsOrDocumentSymbolsOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of SymbolInformationsOrDocumentSymbolsOrNull is set", o.SymbolInformations != nil, o.DocumentSymbols != nil) if o.SymbolInformations != nil { return json.MarshalEncode(enc, o.SymbolInformations) } if o.DocumentSymbols != nil { return json.MarshalEncode(enc, o.DocumentSymbols) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*SymbolInformationsOrDocumentSymbolsOrNull)(nil) func (o *SymbolInformationsOrDocumentSymbolsOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = SymbolInformationsOrDocumentSymbolsOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vSymbolInformations []*SymbolInformation if err := json.Unmarshal(data, &vSymbolInformations); err == nil { o.SymbolInformations = &vSymbolInformations return nil } var vDocumentSymbols []*DocumentSymbol if err := json.Unmarshal(data, &vDocumentSymbols); err == nil { o.DocumentSymbols = &vDocumentSymbols return nil } return fmt.Errorf("invalid SymbolInformationsOrDocumentSymbolsOrNull: %s", data) } type CommandOrCodeAction struct { Command *Command CodeAction *CodeAction } var _ json.MarshalerTo = (*CommandOrCodeAction)(nil) func (o *CommandOrCodeAction) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of CommandOrCodeAction should be set", o.Command != nil, o.CodeAction != nil) if o.Command != nil { return json.MarshalEncode(enc, o.Command) } if o.CodeAction != nil { return json.MarshalEncode(enc, o.CodeAction) } panic("unreachable") } var _ json.UnmarshalerFrom = (*CommandOrCodeAction)(nil) func (o *CommandOrCodeAction) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = CommandOrCodeAction{} data, err := dec.ReadValue() if err != nil { return err } var vCommand Command if err := json.Unmarshal(data, &vCommand); err == nil { o.Command = &vCommand return nil } var vCodeAction CodeAction if err := json.Unmarshal(data, &vCodeAction); err == nil { o.CodeAction = &vCodeAction return nil } return fmt.Errorf("invalid CommandOrCodeAction: %s", data) } type CommandOrCodeActionArrayOrNull struct { CommandOrCodeActionArray *[]CommandOrCodeAction } var _ json.MarshalerTo = (*CommandOrCodeActionArrayOrNull)(nil) func (o *CommandOrCodeActionArrayOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of CommandOrCodeActionArrayOrNull is set", o.CommandOrCodeActionArray != nil) if o.CommandOrCodeActionArray != nil { return json.MarshalEncode(enc, o.CommandOrCodeActionArray) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*CommandOrCodeActionArrayOrNull)(nil) func (o *CommandOrCodeActionArrayOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = CommandOrCodeActionArrayOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vCommandOrCodeActionArray []CommandOrCodeAction if err := json.Unmarshal(data, &vCommandOrCodeActionArray); err == nil { o.CommandOrCodeActionArray = &vCommandOrCodeActionArray return nil } return fmt.Errorf("invalid CommandOrCodeActionArrayOrNull: %s", data) } type SymbolInformationsOrWorkspaceSymbolsOrNull struct { SymbolInformations *[]*SymbolInformation WorkspaceSymbols *[]*WorkspaceSymbol } var _ json.MarshalerTo = (*SymbolInformationsOrWorkspaceSymbolsOrNull)(nil) func (o *SymbolInformationsOrWorkspaceSymbolsOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of SymbolInformationsOrWorkspaceSymbolsOrNull is set", o.SymbolInformations != nil, o.WorkspaceSymbols != nil) if o.SymbolInformations != nil { return json.MarshalEncode(enc, o.SymbolInformations) } if o.WorkspaceSymbols != nil { return json.MarshalEncode(enc, o.WorkspaceSymbols) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*SymbolInformationsOrWorkspaceSymbolsOrNull)(nil) func (o *SymbolInformationsOrWorkspaceSymbolsOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = SymbolInformationsOrWorkspaceSymbolsOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vSymbolInformations []*SymbolInformation if err := json.Unmarshal(data, &vSymbolInformations); err == nil { o.SymbolInformations = &vSymbolInformations return nil } var vWorkspaceSymbols []*WorkspaceSymbol if err := json.Unmarshal(data, &vWorkspaceSymbols); err == nil { o.WorkspaceSymbols = &vWorkspaceSymbols return nil } return fmt.Errorf("invalid SymbolInformationsOrWorkspaceSymbolsOrNull: %s", data) } type CodeLenssOrNull struct { CodeLenss *[]*CodeLens } var _ json.MarshalerTo = (*CodeLenssOrNull)(nil) func (o *CodeLenssOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of CodeLenssOrNull is set", o.CodeLenss != nil) if o.CodeLenss != nil { return json.MarshalEncode(enc, o.CodeLenss) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*CodeLenssOrNull)(nil) func (o *CodeLenssOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = CodeLenssOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vCodeLenss []*CodeLens if err := json.Unmarshal(data, &vCodeLenss); err == nil { o.CodeLenss = &vCodeLenss return nil } return fmt.Errorf("invalid CodeLenssOrNull: %s", data) } type DocumentLinksOrNull struct { DocumentLinks *[]*DocumentLink } var _ json.MarshalerTo = (*DocumentLinksOrNull)(nil) func (o *DocumentLinksOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of DocumentLinksOrNull is set", o.DocumentLinks != nil) if o.DocumentLinks != nil { return json.MarshalEncode(enc, o.DocumentLinks) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*DocumentLinksOrNull)(nil) func (o *DocumentLinksOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = DocumentLinksOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vDocumentLinks []*DocumentLink if err := json.Unmarshal(data, &vDocumentLinks); err == nil { o.DocumentLinks = &vDocumentLinks return nil } return fmt.Errorf("invalid DocumentLinksOrNull: %s", data) } type RangeOrPrepareRenamePlaceholderOrPrepareRenameDefaultBehaviorOrNull struct { Range *Range PrepareRenamePlaceholder *PrepareRenamePlaceholder PrepareRenameDefaultBehavior *PrepareRenameDefaultBehavior } var _ json.MarshalerTo = (*RangeOrPrepareRenamePlaceholderOrPrepareRenameDefaultBehaviorOrNull)(nil) func (o *RangeOrPrepareRenamePlaceholderOrPrepareRenameDefaultBehaviorOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of RangeOrPrepareRenamePlaceholderOrPrepareRenameDefaultBehaviorOrNull is set", o.Range != nil, o.PrepareRenamePlaceholder != nil, o.PrepareRenameDefaultBehavior != nil) if o.Range != nil { return json.MarshalEncode(enc, o.Range) } if o.PrepareRenamePlaceholder != nil { return json.MarshalEncode(enc, o.PrepareRenamePlaceholder) } if o.PrepareRenameDefaultBehavior != nil { return json.MarshalEncode(enc, o.PrepareRenameDefaultBehavior) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*RangeOrPrepareRenamePlaceholderOrPrepareRenameDefaultBehaviorOrNull)(nil) func (o *RangeOrPrepareRenamePlaceholderOrPrepareRenameDefaultBehaviorOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = RangeOrPrepareRenamePlaceholderOrPrepareRenameDefaultBehaviorOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vRange Range if err := json.Unmarshal(data, &vRange); err == nil { o.Range = &vRange return nil } var vPrepareRenamePlaceholder PrepareRenamePlaceholder if err := json.Unmarshal(data, &vPrepareRenamePlaceholder); err == nil { o.PrepareRenamePlaceholder = &vPrepareRenamePlaceholder return nil } var vPrepareRenameDefaultBehavior PrepareRenameDefaultBehavior if err := json.Unmarshal(data, &vPrepareRenameDefaultBehavior); err == nil { o.PrepareRenameDefaultBehavior = &vPrepareRenameDefaultBehavior return nil } return fmt.Errorf("invalid RangeOrPrepareRenamePlaceholderOrPrepareRenameDefaultBehaviorOrNull: %s", data) } type LSPAnyOrNull struct { LSPAny *any } var _ json.MarshalerTo = (*LSPAnyOrNull)(nil) func (o *LSPAnyOrNull) MarshalJSONTo(enc *jsontext.Encoder) error { assertAtMostOne("more than one element of LSPAnyOrNull is set", o.LSPAny != nil) if o.LSPAny != nil { return json.MarshalEncode(enc, o.LSPAny) } return enc.WriteToken(jsontext.Null) } var _ json.UnmarshalerFrom = (*LSPAnyOrNull)(nil) func (o *LSPAnyOrNull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = LSPAnyOrNull{} data, err := dec.ReadValue() if err != nil { return err } if string(data) == "null" { return nil } var vLSPAny any if err := json.Unmarshal(data, &vLSPAny); err == nil { o.LSPAny = &vLSPAny return nil } return fmt.Errorf("invalid LSPAnyOrNull: %s", data) } type TextDocumentFilterLanguageOrTextDocumentFilterSchemeOrTextDocumentFilterPatternOrNotebookCellTextDocumentFilter struct { TextDocumentFilterLanguage *TextDocumentFilterLanguage TextDocumentFilterScheme *TextDocumentFilterScheme TextDocumentFilterPattern *TextDocumentFilterPattern NotebookCellTextDocumentFilter *NotebookCellTextDocumentFilter } var _ json.MarshalerTo = (*TextDocumentFilterLanguageOrTextDocumentFilterSchemeOrTextDocumentFilterPatternOrNotebookCellTextDocumentFilter)(nil) func (o *TextDocumentFilterLanguageOrTextDocumentFilterSchemeOrTextDocumentFilterPatternOrNotebookCellTextDocumentFilter) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of TextDocumentFilterLanguageOrTextDocumentFilterSchemeOrTextDocumentFilterPatternOrNotebookCellTextDocumentFilter should be set", o.TextDocumentFilterLanguage != nil, o.TextDocumentFilterScheme != nil, o.TextDocumentFilterPattern != nil, o.NotebookCellTextDocumentFilter != nil) if o.TextDocumentFilterLanguage != nil { return json.MarshalEncode(enc, o.TextDocumentFilterLanguage) } if o.TextDocumentFilterScheme != nil { return json.MarshalEncode(enc, o.TextDocumentFilterScheme) } if o.TextDocumentFilterPattern != nil { return json.MarshalEncode(enc, o.TextDocumentFilterPattern) } if o.NotebookCellTextDocumentFilter != nil { return json.MarshalEncode(enc, o.NotebookCellTextDocumentFilter) } panic("unreachable") } var _ json.UnmarshalerFrom = (*TextDocumentFilterLanguageOrTextDocumentFilterSchemeOrTextDocumentFilterPatternOrNotebookCellTextDocumentFilter)(nil) func (o *TextDocumentFilterLanguageOrTextDocumentFilterSchemeOrTextDocumentFilterPatternOrNotebookCellTextDocumentFilter) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = TextDocumentFilterLanguageOrTextDocumentFilterSchemeOrTextDocumentFilterPatternOrNotebookCellTextDocumentFilter{} data, err := dec.ReadValue() if err != nil { return err } var vTextDocumentFilterLanguage TextDocumentFilterLanguage if err := json.Unmarshal(data, &vTextDocumentFilterLanguage); err == nil { o.TextDocumentFilterLanguage = &vTextDocumentFilterLanguage return nil } var vTextDocumentFilterScheme TextDocumentFilterScheme if err := json.Unmarshal(data, &vTextDocumentFilterScheme); err == nil { o.TextDocumentFilterScheme = &vTextDocumentFilterScheme return nil } var vTextDocumentFilterPattern TextDocumentFilterPattern if err := json.Unmarshal(data, &vTextDocumentFilterPattern); err == nil { o.TextDocumentFilterPattern = &vTextDocumentFilterPattern return nil } var vNotebookCellTextDocumentFilter NotebookCellTextDocumentFilter if err := json.Unmarshal(data, &vNotebookCellTextDocumentFilter); err == nil { o.NotebookCellTextDocumentFilter = &vNotebookCellTextDocumentFilter return nil } return fmt.Errorf("invalid TextDocumentFilterLanguageOrTextDocumentFilterSchemeOrTextDocumentFilterPatternOrNotebookCellTextDocumentFilter: %s", data) } type StringOrMarkedStringWithLanguage struct { String *string MarkedStringWithLanguage *MarkedStringWithLanguage } var _ json.MarshalerTo = (*StringOrMarkedStringWithLanguage)(nil) func (o *StringOrMarkedStringWithLanguage) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of StringOrMarkedStringWithLanguage should be set", o.String != nil, o.MarkedStringWithLanguage != nil) if o.String != nil { return json.MarshalEncode(enc, o.String) } if o.MarkedStringWithLanguage != nil { return json.MarshalEncode(enc, o.MarkedStringWithLanguage) } panic("unreachable") } var _ json.UnmarshalerFrom = (*StringOrMarkedStringWithLanguage)(nil) func (o *StringOrMarkedStringWithLanguage) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = StringOrMarkedStringWithLanguage{} data, err := dec.ReadValue() if err != nil { return err } var vString string if err := json.Unmarshal(data, &vString); err == nil { o.String = &vString return nil } var vMarkedStringWithLanguage MarkedStringWithLanguage if err := json.Unmarshal(data, &vMarkedStringWithLanguage); err == nil { o.MarkedStringWithLanguage = &vMarkedStringWithLanguage return nil } return fmt.Errorf("invalid StringOrMarkedStringWithLanguage: %s", data) } type InlineValueTextOrVariableLookupOrEvaluatableExpression struct { Text *InlineValueText VariableLookup *InlineValueVariableLookup EvaluatableExpression *InlineValueEvaluatableExpression } var _ json.MarshalerTo = (*InlineValueTextOrVariableLookupOrEvaluatableExpression)(nil) func (o *InlineValueTextOrVariableLookupOrEvaluatableExpression) MarshalJSONTo(enc *jsontext.Encoder) error { assertOnlyOne("exactly one element of InlineValueTextOrVariableLookupOrEvaluatableExpression should be set", o.Text != nil, o.VariableLookup != nil, o.EvaluatableExpression != nil) if o.Text != nil { return json.MarshalEncode(enc, o.Text) } if o.VariableLookup != nil { return json.MarshalEncode(enc, o.VariableLookup) } if o.EvaluatableExpression != nil { return json.MarshalEncode(enc, o.EvaluatableExpression) } panic("unreachable") } var _ json.UnmarshalerFrom = (*InlineValueTextOrVariableLookupOrEvaluatableExpression)(nil) func (o *InlineValueTextOrVariableLookupOrEvaluatableExpression) UnmarshalJSONFrom(dec *jsontext.Decoder) error { *o = InlineValueTextOrVariableLookupOrEvaluatableExpression{} data, err := dec.ReadValue() if err != nil { return err } var vText InlineValueText if err := json.Unmarshal(data, &vText); err == nil { o.Text = &vText return nil } var vVariableLookup InlineValueVariableLookup if err := json.Unmarshal(data, &vVariableLookup); err == nil { o.VariableLookup = &vVariableLookup return nil } var vEvaluatableExpression InlineValueEvaluatableExpression if err := json.Unmarshal(data, &vEvaluatableExpression); err == nil { o.EvaluatableExpression = &vEvaluatableExpression return nil } return fmt.Errorf("invalid InlineValueTextOrVariableLookupOrEvaluatableExpression: %s", data) } // Literal types // StringLiteralBegin is a literal type for "begin" type StringLiteralBegin struct{} var _ json.MarshalerTo = StringLiteralBegin{} func (o StringLiteralBegin) MarshalJSONTo(enc *jsontext.Encoder) error { return enc.WriteValue(jsontext.Value(`"begin"`)) } var _ json.UnmarshalerFrom = &StringLiteralBegin{} func (o *StringLiteralBegin) UnmarshalJSONFrom(dec *jsontext.Decoder) error { v, err := dec.ReadValue() if err != nil { return err } if string(v) != `"begin"` { return fmt.Errorf("expected StringLiteralBegin value %s, got %s", `"begin"`, v) } return nil } // StringLiteralReport is a literal type for "report" type StringLiteralReport struct{} var _ json.MarshalerTo = StringLiteralReport{} func (o StringLiteralReport) MarshalJSONTo(enc *jsontext.Encoder) error { return enc.WriteValue(jsontext.Value(`"report"`)) } var _ json.UnmarshalerFrom = &StringLiteralReport{} func (o *StringLiteralReport) UnmarshalJSONFrom(dec *jsontext.Decoder) error { v, err := dec.ReadValue() if err != nil { return err } if string(v) != `"report"` { return fmt.Errorf("expected StringLiteralReport value %s, got %s", `"report"`, v) } return nil } // StringLiteralEnd is a literal type for "end" type StringLiteralEnd struct{} var _ json.MarshalerTo = StringLiteralEnd{} func (o StringLiteralEnd) MarshalJSONTo(enc *jsontext.Encoder) error { return enc.WriteValue(jsontext.Value(`"end"`)) } var _ json.UnmarshalerFrom = &StringLiteralEnd{} func (o *StringLiteralEnd) UnmarshalJSONFrom(dec *jsontext.Decoder) error { v, err := dec.ReadValue() if err != nil { return err } if string(v) != `"end"` { return fmt.Errorf("expected StringLiteralEnd value %s, got %s", `"end"`, v) } return nil } // StringLiteralCreate is a literal type for "create" type StringLiteralCreate struct{} var _ json.MarshalerTo = StringLiteralCreate{} func (o StringLiteralCreate) MarshalJSONTo(enc *jsontext.Encoder) error { return enc.WriteValue(jsontext.Value(`"create"`)) } var _ json.UnmarshalerFrom = &StringLiteralCreate{} func (o *StringLiteralCreate) UnmarshalJSONFrom(dec *jsontext.Decoder) error { v, err := dec.ReadValue() if err != nil { return err } if string(v) != `"create"` { return fmt.Errorf("expected StringLiteralCreate value %s, got %s", `"create"`, v) } return nil } // StringLiteralRename is a literal type for "rename" type StringLiteralRename struct{} var _ json.MarshalerTo = StringLiteralRename{} func (o StringLiteralRename) MarshalJSONTo(enc *jsontext.Encoder) error { return enc.WriteValue(jsontext.Value(`"rename"`)) } var _ json.UnmarshalerFrom = &StringLiteralRename{} func (o *StringLiteralRename) UnmarshalJSONFrom(dec *jsontext.Decoder) error { v, err := dec.ReadValue() if err != nil { return err } if string(v) != `"rename"` { return fmt.Errorf("expected StringLiteralRename value %s, got %s", `"rename"`, v) } return nil } // StringLiteralDelete is a literal type for "delete" type StringLiteralDelete struct{} var _ json.MarshalerTo = StringLiteralDelete{} func (o StringLiteralDelete) MarshalJSONTo(enc *jsontext.Encoder) error { return enc.WriteValue(jsontext.Value(`"delete"`)) } var _ json.UnmarshalerFrom = &StringLiteralDelete{} func (o *StringLiteralDelete) UnmarshalJSONFrom(dec *jsontext.Decoder) error { v, err := dec.ReadValue() if err != nil { return err } if string(v) != `"delete"` { return fmt.Errorf("expected StringLiteralDelete value %s, got %s", `"delete"`, v) } return nil } // StringLiteralFull is a literal type for "full" type StringLiteralFull struct{} var _ json.MarshalerTo = StringLiteralFull{} func (o StringLiteralFull) MarshalJSONTo(enc *jsontext.Encoder) error { return enc.WriteValue(jsontext.Value(`"full"`)) } var _ json.UnmarshalerFrom = &StringLiteralFull{} func (o *StringLiteralFull) UnmarshalJSONFrom(dec *jsontext.Decoder) error { v, err := dec.ReadValue() if err != nil { return err } if string(v) != `"full"` { return fmt.Errorf("expected StringLiteralFull value %s, got %s", `"full"`, v) } return nil } // StringLiteralUnchanged is a literal type for "unchanged" type StringLiteralUnchanged struct{} var _ json.MarshalerTo = StringLiteralUnchanged{} func (o StringLiteralUnchanged) MarshalJSONTo(enc *jsontext.Encoder) error { return enc.WriteValue(jsontext.Value(`"unchanged"`)) } var _ json.UnmarshalerFrom = &StringLiteralUnchanged{} func (o *StringLiteralUnchanged) UnmarshalJSONFrom(dec *jsontext.Decoder) error { v, err := dec.ReadValue() if err != nil { return err } if string(v) != `"unchanged"` { return fmt.Errorf("expected StringLiteralUnchanged value %s, got %s", `"unchanged"`, v) } return nil } // StringLiteralSnippet is a literal type for "snippet" type StringLiteralSnippet struct{} var _ json.MarshalerTo = StringLiteralSnippet{} func (o StringLiteralSnippet) MarshalJSONTo(enc *jsontext.Encoder) error { return enc.WriteValue(jsontext.Value(`"snippet"`)) } var _ json.UnmarshalerFrom = &StringLiteralSnippet{} func (o *StringLiteralSnippet) UnmarshalJSONFrom(dec *jsontext.Decoder) error { v, err := dec.ReadValue() if err != nil { return err } if string(v) != `"snippet"` { return fmt.Errorf("expected StringLiteralSnippet value %s, got %s", `"snippet"`, v) } return nil }