protocol

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
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")
)
View Source
const MethodInitialize = protocol316.Method("initialize")
View Source
const MethodTextDocumentDiagnostic = protocol316.Method("textDocument/diagnostic")
View Source
const MethodTextDocumentInlayHint = protocol316.Method("textDocument/inlayHint")

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientCapabilities

type ClientCapabilities struct {
	protocol316.ClientCapabilities

	TextDocument *TextDocumentClientCapabilities `json:"textDocument,omitempty"`
}

type DiagnosticClientCapabilities

type DiagnosticClientCapabilities 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"`

	/**
	 * Whether the clients supports related documents for document diagnostic
	 * pulls.
	 */
	RelatedDocumentSupport bool `json:"relatedDocumentSupport"`
}

*

  • Client capabilities specific to diagnostic pull requests. *
  • @since 3.17.0

type DiagnosticOptions

type DiagnosticOptions struct {
	protocol316.WorkDoneProgressOptions
	/**
	 * An optional identifier under which the diagnostics are
	 * managed by the client.
	 */
	Identifier *string `json:"identifier"`

	/**
	 * 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"`
}

*

  • Diagnostic options. *
  • @since 3.17.0

type DiagnosticRegistrationOptions

*

  • Diagnostic registration options. *
  • @since 3.17.0

type DiagnosticServerCancellationData

type DiagnosticServerCancellationData struct {
	RetriggerRequest bool `json:"retriggerRequest"`
}

*

  • Cancellation data returned from a diagnostic request. *
  • @since 3.17.0

type DocumentDiagnosticParams

type DocumentDiagnosticParams struct {
	protocol316.WorkDoneProgressParams
	protocol316.PartialResultParams

	/**
	 * The text document.
	 */
	TextDocument protocol316.TextDocumentIdentifier `json:"textDocument"`

	/**
	 * The additional identifier  provided during registration.
	 */
	Identifier *string `json:"identifier,omitempty"`

	/**
	 * The result id of a previous response if provided.
	 */
	PreviousResultId *string `json:"previousResultId,omitempty"`
}

*

  • Parameters of the document diagnostic request. *
  • @since 3.17.0

type DocumentDiagnosticReport

type DocumentDiagnosticReport any // RelatedFullDocumentDiagnosticReport | RelatedUnchangedDocumentDiagnosticReport

*

  • The result of a document diagnostic pull request. A report can
  • either be a full report containing all diagnostics for the
  • requested document or a unchanged report indicating that nothing
  • has changed in terms of diagnostics in comparison to the last
  • pull request. *
  • @since 3.17.0

type DocumentDiagnosticReportKind

type DocumentDiagnosticReportKind string

*

  • The document diagnostic report kinds. *
  • @since 3.17.0

type DocumentDiagnosticReportPartialResult

type DocumentDiagnosticReportPartialResult struct {
	RelatedDocuments map[protocol316.DocumentUri]interface{} `json:"relatedDocuments"`
}

*

  • A partial result for a document diagnostic report. *
  • @since 3.17.0

type FullDocumentDiagnosticReport

type FullDocumentDiagnosticReport struct {
	/**
	 * A full document diagnostic report.
	 */
	Kind string `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,omitempty"`

	/**
	 * The actual items.
	 */
	Items []protocol316.Diagnostic `json:"items"`
}

*

  • A diagnostic report with a full set of problems. *
  • @since 3.17.0

type Handler

type Handler struct {
	protocol316.Handler

	Initialize             InitializeFunc
	TextDocumentDiagnostic TextDocumentDiagnosticFunc
	TextDocumentInlayHint  TextDocumentInlayHintFunc
	// contains filtered or unexported fields
}

func (*Handler) CreateServerCapabilities

func (self *Handler) CreateServerCapabilities() ServerCapabilities

func (*Handler) Handle

func (self *Handler) Handle(context *glsp.Context) (r any, validMethod bool, validParams bool, err error)

func (*Handler) IsInitialized

func (self *Handler) IsInitialized() bool

func (*Handler) SetInitialized

func (self *Handler) SetInitialized(initialized bool)

type InitializeFunc

type InitializeFunc func(context *glsp.Context, params *InitializeParams) (any, error)

Returns: InitializeResult | InitializeError

type InitializeParams

type InitializeParams struct {
	protocol316.InitializeParams

	/**
	 * The capabilities provided by the client (editor or tool)
	 */
	Capabilities ClientCapabilities `json:"capabilities"`
}

type InitializeResult

type InitializeResult struct {
	/**
	 * The capabilities the language server provides.
	 */
	Capabilities ServerCapabilities `json:"capabilities"`

	/**
	 * Information about the server.
	 *
	 * @since 3.15.0
	 */
	ServerInfo *protocol316.InitializeResultServerInfo `json:"serverInfo,omitempty"`
}

type InlayHint

type InlayHint struct {
	/**
	 * The position of this hint.
	 */
	Position protocol316.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 string `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,omitempty"`

	/**
	 * 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.
	 */
	Tooltip any `json:"tooltip,omitempty"` // string | MarkupContent

	/**
	 * 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,omitempty"`

	/**
	 * 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,omitempty"`
}

*

  • Inlay hint information. *
  • @since 3.17.0

type InlayHintKind

type InlayHintKind int

*

  • Inlay hint kinds. *
  • @since 3.17.0
const (
	/**
	 * An inlay hint that for a type annotation.
	 */
	InlayHintKindType InlayHintKind = 1

	/**
	 * An inlay hint that is for a parameter.
	 */
	InlayHintKindParameter InlayHintKind = 2
)

type InlayHintOptions

type InlayHintOptions struct {
	protocol316.WorkDoneProgressOptions
}

*

  • Inlay hint options used during static registration. *
  • @since 3.17.0

type InlayHintParams

type InlayHintParams struct {
	/**
	 * The text document.
	 */
	TextDocument protocol316.TextDocumentIdentifier `json:"textDocument"`

	/**
	 * The document range for which inlay hints should be computed.
	 */
	Range protocol316.Range `json:"range"`
}

*

  • A parameter literal used in inlay hint requests. *
  • @since 3.17.0

type InlayHintRegistrationOptions

*

  • Inlay hint options used during static or dynamic registration. *
  • @since 3.17.0

type RelatedFullDocumentDiagnosticReport

type RelatedFullDocumentDiagnosticReport struct {
	FullDocumentDiagnosticReport
	/**
	 * 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[protocol316.DocumentUri]interface{} `json:"relatedDocuments,omitempty"`
}

*

  • A full diagnostic report with a set of related documents. *
  • @since 3.17.0

type RelatedUnchangedDocumentDiagnosticReport

type RelatedUnchangedDocumentDiagnosticReport struct {
	UnchangedDocumentDiagnosticReport
	/**
	 * 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[protocol316.DocumentUri]interface{} `json:"relatedDocuments,omitempty"`
}

*

  • An unchanged diagnostic report with a set of related documents. *
  • @since 3.17.0

type ServerCapabilities

type ServerCapabilities struct {
	protocol316.ServerCapabilities

	/**
	 * The server has support for pull model diagnostics.
	 *
	 * @since 3.17.0
	 */
	DiagnosticProvider any `json:"diagnosticProvider,omitempty"` // nil | DiagnosticOptions | DiagnosticRegistrationOptions

	/**
	 * The server provides inlay hints.
	 *
	 * @since 3.17.0
	 */
	InlayHintProvider any `json:"inlayHintProvider,omitempty"` // nil | bool | InlayHintOptions | InlayHintRegistrationOptions
}

func (*ServerCapabilities) UnmarshalJSON

func (self *ServerCapabilities) UnmarshalJSON(data []byte) error

type TextDocumentClientCapabilities

type TextDocumentClientCapabilities struct {
	protocol316.TextDocumentClientCapabilities

	/**
	 * Capabilities specific to the diagnostic pull model.
	 *
	 * @since 3.17.0
	 */
	Diagnostic *DiagnosticClientCapabilities `json:"diagnostic,omitempty"`
}

*

  • Text document specific client capabilities.

type TextDocumentDiagnosticFunc

type TextDocumentDiagnosticFunc func(context *glsp.Context, params *DocumentDiagnosticParams) (any, error)

type TextDocumentInlayHintFunc

type TextDocumentInlayHintFunc func(context *glsp.Context, params *InlayHintParams) ([]InlayHint, error)

type UnchangedDocumentDiagnosticReport

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 string `json:"kind"`

	/**
	 * A result id which will be sent on the next
	 * diagnostic request for the same document.
	 */
	ResultID string `json:"resultId"`
}

*

  • A diagnostic report indicating that the last returned
  • report is still accurate. *
  • @since 3.17.0

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL