protocol

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodTextDocumentDidOpen = "textDocument/didOpen"

	MethodTextDocumentDidClose = "textDocument/didClose"

	MethodTextDocumentDidChange = "textDocument/didChange"

	MethodTextDocumentDidSave = "textDocument/didSave"
)
View Source
const (
	MethodInitialize = "initialize"

	MethodInitialized = "initialized"
)
View Source
const (
	// MethodTextDocumentCodeAction method name of "textDocument/codeAction".
	MethodTextDocumentCodeAction = "textDocument/codeAction"
)
View Source
const (
	// MethodTextDocumentCompletion method name of "textDocument/completion".
	MethodTextDocumentCompletion = "textDocument/completion"
)
View Source
const (
	// MethodTextDocumentDefinition method name of "textDocument/definition".
	MethodTextDocumentDefinition = "textDocument/definition"
)
View Source
const (
	MethodTextDocumentDiagnostic = "textDocument/diagnostic"
)
View Source
const (
	MethodTextDocumentHover = "textDocument/hover"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientCapabilities

type ClientCapabilities struct{}

ClientCapabilities defines the capabilities of the client (e.g., editor or IDE). It tells the language server what features the client supports.

type ClientInfo

type ClientInfo struct {
	// Name is the name of the client.
	Name string `json:"name"`

	// Version is the version of the client (optional).
	Version string `json:"version,omitempty"`
}

ClientInfo represents additional information about the client.

type CodeAction

type CodeAction struct {
	// Title is a short, human-readable title for the code action.
	Title string `json:"title"`

	// Kind is the kind of the code action, such as "quickfix" or "refactor".
	// Used to filter and organize code actions.
	Kind CodeActionKind `json:"kind,omitempty"`

	// Diagnostics are the diagnostics that this code action resolves.
	Diagnostics []Diagnostic `json:"diagnostics,omitempty"`

	// Edit specifies changes to be made to the workspace when this action is applied.
	// Mutually exclusive with Command.
	Edit *WorkspaceEdit `json:"edit,omitempty"`

	// Command specifies a command to execute after applying the code action.
	// Mutually exclusive with Edit.
	Command *Command `json:"command,omitempty"`

	// Data is custom data the server may use to identify the code action.
	Data interface{} `json:"data,omitempty"`
}

CodeAction represents a specific action that can be performed in a text document.

type CodeActionContext

type CodeActionContext struct {
	// Diagnostics contains the diagnostics for the specified range in the document.
	Diagnostics []Diagnostic `json:"diagnostics"`

	// Only is an optional list of code action kinds to return.
	// If specified, the server should only return these kinds.
	Only []CodeActionKind `json:"only,omitempty"`
}

CodeActionContext contains additional information about the context in which a code action is requested.

type CodeActionKind

type CodeActionKind string

CodeActionKind defines the type of code action.

const (
	CodeActionQuickFix              CodeActionKind = "quickfix"
	CodeActionRefactor              CodeActionKind = "refactor"
	CodeActionRefactorExtract       CodeActionKind = "refactor.extract"
	CodeActionRefactorInline        CodeActionKind = "refactor.inline"
	CodeActionRefactorRewrite       CodeActionKind = "refactor.rewrite"
	CodeActionSource                CodeActionKind = "source"
	CodeActionSourceOrganizeImports CodeActionKind = "source.organizeImports"
)

type CodeActionParams

type CodeActionParams struct {
	// WorkDoneProgressParams are standard parameters for work progress reporting.
	WorkDoneProgressParams

	// PartialResultParams are standard parameters for partial result reporting.
	PartialResultParams

	// TextDocument specifies the text document in which code actions are requested.
	TextDocument TextDocumentIdentifier `json:"textDocument"`

	// Range specifies the range in the document where code actions are requested.
	Range Range `json:"range"`

	// Context provides additional information about the request, such as diagnostics.
	Context CodeActionContext `json:"context"`
}

CodeActionParams defines the parameters of a `textDocument/codeAction` request.

type CodeActionResult

type CodeActionResult struct {
	Commands    []Command
	CodeActions []CodeAction
}

CodeActionResult represents the result of a `textDocument/codeAction` request. It can be either an array of Command or CodeAction, or null.

func (CodeActionResult) MarshalJSON

func (r CodeActionResult) MarshalJSON() ([]byte, error)

MarshalJSON customizes the marshaling of CodeActionResult.

func (*CodeActionResult) UnmarshalJSON

func (r *CodeActionResult) UnmarshalJSON(data []byte) error

UnmarshalJSON customizes the unmarshaling of CodeActionResult.

type CodeDescription

type CodeDescription struct {
	// Href is a URI pointing to more information about the diagnostic code.
	Href string `json:"href"`
}

CodeDescription provides a URI that points to additional information about a diagnostic code.

type Command

type Command struct {
	// Title is a human-readable title for the command, displayed in the UI.
	Title string `json:"title"`

	// Command is the identifier of the actual command to execute.
	Command string `json:"command"`

	// Arguments are additional arguments that the command accepts.
	// These are specific to the command being executed.
	Arguments []interface{} `json:"arguments,omitempty"`
}

Command represents a command that can be executed in the client. Commands are provided as part of code actions, completion items, and other features.

type CompletionContext

type CompletionContext struct {
	// TriggerKind specifies how the completion was triggered.
	TriggerKind CompletionTriggerKind `json:"triggerKind"`

	// TriggerCharacter is the character that triggered the completion, if applicable.
	// This field is only populated if the triggerKind is TriggerCharacter.
	TriggerCharacter *string `json:"triggerCharacter,omitempty"`
}

CompletionContext provides additional information about the completion request context.

type CompletionItem

type CompletionItem struct {
	// Label is the label of this completion item. It will be displayed in the UI.
	Label string `json:"label"`

	// Kind specifies the type of completion item (e.g., Function, Class).
	Kind CompletionItemKind `json:"kind,omitempty"`

	// Tags are optional tags for this item (e.g., Deprecated).
	Tags []CompletionItemTag `json:"tags,omitempty"`

	// Detail provides additional information about this item, like the type or symbol signature.
	Detail string `json:"detail,omitempty"`

	// Documentation contains a human-readable description of the item.
	Documentation *MarkupContent `json:"documentation,omitempty"`

	// Deprecated indicates whether this item is deprecated.
	Deprecated *bool `json:"deprecated,omitempty"`

	// Preselect determines if this item should be preselected in the UI.
	Preselect *bool `json:"preselect,omitempty"`

	// SortText is used to order completion items in the UI.
	SortText string `json:"sortText,omitempty"`

	// FilterText is used to filter items when performing fuzzy matching.
	FilterText string `json:"filterText,omitempty"`

	// InsertText is the string to insert when this item is selected.
	InsertText string `json:"insertText,omitempty"`

	// InsertTextFormat specifies how `InsertText` should be interpreted.
	InsertTextFormat *InsertTextFormat `json:"insertTextFormat,omitempty"`

	// InsertTextMode specifies how whitespace and indentation should be handled during insertion.
	InsertTextMode *InsertTextMode `json:"insertTextMode,omitempty"`

	// TextEdit specifies changes to the document that occur when this item is selected.
	TextEdit *TextEdit `json:"textEdit,omitempty"`

	// AdditionalTextEdits specifies additional edits that are applied after this item is selected.
	AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"`

	// CommitCharacters is a list of characters that commit the completion item selection.
	CommitCharacters []string `json:"commitCharacters,omitempty"`

	// Command is an optional command that is executed after selecting this item.
	Command *Command `json:"command,omitempty"`

	// Data is a custom data field, which can be used by the server to identify or resolve this item.
	Data interface{} `json:"data,omitempty"`
}

CompletionItem represents a single completion suggestion.

type CompletionItemKind

type CompletionItemKind int

CompletionItemKind defines the type of completion item (e.g., Function, Class).

const (
	CompletionItemKindNone          CompletionItemKind = 0
	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
)

type CompletionItemTag

type CompletionItemTag int

CompletionItemTag defines optional tags for CompletionItem.

const (
	CompletionItemTagDeprecated CompletionItemTag = 1
)

type CompletionList

type CompletionList struct {
	// IsIncomplete indicates if the list is complete.
	// If true, the client should re-trigger completion when typing more characters.
	IsIncomplete bool `json:"isIncomplete"`

	// Items contains the completion items.
	Items []CompletionItem `json:"items"`
}

CompletionList represents a collection of completion items. It can be either a list of items or a flag indicating if further items can be resolved.

type CompletionOptions

type CompletionOptions struct {
	// ResolveProvider indicates whether the server provides support to resolve additional information for a completion item.
	ResolveProvider bool `json:"resolveProvider,omitempty"`

	// TriggerCharacters defines the characters that trigger completion.
	TriggerCharacters []string `json:"triggerCharacters,omitempty"`
}

CompletionOptions defines how the server supports providing completion items.

type CompletionParams

type CompletionParams struct {
	// TextDocument identifies the text document where completion is being requested.
	TextDocument TextDocumentIdentifier `json:"textDocument"`

	// Position specifies the position in the document where completion is requested.
	Position Position `json:"position"`

	// Context provides additional information about the context in which completion is requested.
	Context *CompletionContext `json:"context,omitempty"`

	// WorkDoneProgressParams allows reporting progress for this request.
	WorkDoneProgressParams
}

CompletionParams represents the parameters for a `textDocument/completion` request. It provides the text document, position, context, and optional progress tracking.

type CompletionResult

type CompletionResult struct {
	// CompletionList is populated if the result is a CompletionList.
	CompletionList *CompletionList

	// CompletionItems is populated if the result is a slice of CompletionItem.
	CompletionItems []CompletionItem
}

CompletionResult represents the result of a `textDocument/completion` request. It can either be a CompletionList or a slice of CompletionItem.

func (CompletionResult) MarshalJSON

func (cr CompletionResult) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON encoding for CompletionResult.

func (*CompletionResult) UnmarshalJSON

func (cr *CompletionResult) UnmarshalJSON(data []byte) error

UnmarshalJSON customizes the JSON decoding for CompletionResult.

type CompletionTriggerKind

type CompletionTriggerKind int

CompletionTriggerKind specifies how the completion request was triggered.

const (
	// Invoked means completion was manually triggered, such as by pressing Ctrl+Space.
	CompletionTriggerInvoked CompletionTriggerKind = 1

	// TriggerCharacter means completion was triggered by a specific character.
	CompletionTriggerCharacter CompletionTriggerKind = 2

	// TriggerForIncompleteCompletions means completion was triggered to resolve incomplete items.
	CompletionTriggerForIncompleteCompletions CompletionTriggerKind = 3
)

type DefinitionParams

type DefinitionParams struct {
	// WorkDoneProgressParams allows the client to request progress updates for the operation.
	WorkDoneProgressParams

	// PartialResultParams allows the server to send partial results for the request.
	PartialResultParams

	// TextDocument specifies the document where the symbol is located.
	TextDocument TextDocumentIdentifier `json:"textDocument"`

	// Position specifies the position within the document where the symbol is located.
	Position Position `json:"position"`
}

DefinitionParams represents the parameters for the `textDocument/definition` request. This request is used to find the definition of a symbol at a specific position in a text document.

type DefinitionResponse

type DefinitionResponse struct {
	Location      *Location      // Single Location
	Locations     []Location     // Multiple Locations
	LocationLinks []LocationLink // Multiple LocationLinks
}

DefinitionResponse represents the response for the `textDocument/definition` request. It can be a single Location, a slice of Locations, or a slice of LocationLinks.

func (DefinitionResponse) MarshalJSON

func (r DefinitionResponse) MarshalJSON() ([]byte, error)

MarshalJSON customizes the JSON encoding for DefinitionResponse.

type Diagnostic

type Diagnostic struct {
	// Range specifies the location of the diagnostic within the document.
	Range Range `json:"range"`

	// Severity represents the severity of the diagnostic (e.g., error, warning).
	Severity DiagnosticSeverity `json:"severity,omitempty"`

	// Code is an optional identifier for the diagnostic, which can be a string or number.
	Code interface{} `json:"code,omitempty"`

	// CodeDescription provides an optional URI pointing to more information about the diagnostic code.
	CodeDescription *CodeDescription `json:"codeDescription,omitempty"`

	// Source identifies the origin of this diagnostic (e.g., "typescript").
	Source string `json:"source,omitempty"`

	// Message is the diagnostic message to be displayed.
	Message string `json:"message"`

	// Tags is an optional array of tags for additional metadata.
	Tags []DiagnosticTag `json:"tags,omitempty"`

	// RelatedInformation is an optional array of additional locations related to this diagnostic.
	RelatedInformation []DiagnosticRelatedInformation `json:"relatedInformation,omitempty"`

	// Data provides additional metadata for the diagnostic.
	Data interface{} `json:"data,omitempty"`
}

Diagnostic represents a single diagnostic (error, warning, etc.) in a text document.

type DiagnosticOptions

type DiagnosticOptions struct {
	WorkDoneProgressOptions

	// Identifier is an optional string to identify this diagnostic request.
	Identifier string `json:"identifier,omitempty"`

	// InterFileDependencies indicates if the diagnostics depend on multiple files.
	InterFileDependencies bool `json:"interFileDependencies"`

	// WorkspaceDiagnostics indicates if workspace-wide diagnostics are supported.
	WorkspaceDiagnostics bool `json:"workspaceDiagnostics"`
}

DiagnosticOptions contains configuration options for the diagnostic provider.

type DiagnosticRelatedInformation

type DiagnosticRelatedInformation struct {
	// Location is the location where this related diagnostic is reported.
	Location Location `json:"location"`

	// Message is the message to be displayed for this related diagnostic.
	Message string `json:"message"`
}

DiagnosticRelatedInformation represents additional diagnostic information related to the primary diagnostic.

type DiagnosticSeverity

type DiagnosticSeverity int

DiagnosticSeverity defines the severity level for a diagnostic.

const (
	// SeverityError indicates an error.
	SeverityError DiagnosticSeverity = 1

	// SeverityWarning indicates a warning.
	SeverityWarning DiagnosticSeverity = 2

	// SeverityInformation indicates an informational message.
	SeverityInformation DiagnosticSeverity = 3

	// SeverityHint indicates a hint or suggestion.
	SeverityHint DiagnosticSeverity = 4
)

type DiagnosticTag

type DiagnosticTag int

DiagnosticTag represents additional metadata for diagnostics.

const (
	// Unnecessary indicates that the diagnostic refers to code that is unnecessary or unused.
	Unnecessary DiagnosticTag = 1

	// Deprecated indicates that the diagnostic refers to deprecated code.
	Deprecated DiagnosticTag = 2
)

type DidChangeTextDocumentParams

type DidChangeTextDocumentParams struct {
	// TextDocument holds the identifier and version of the text document that changed.
	TextDocument VersionedTextDocumentIdentifier `json:"textDocument"`

	// ContentChanges is a list of changes applied to the document.
	// The changes represent the modified content of the document.
	ContentChanges []TextDocumentContentChangeEvent `json:"contentChanges"`
}

DidChangeTextDocumentParams represents the parameters sent in the notification when a document is changed by the client.

type DidCloseTextDocumentParams

type DidCloseTextDocumentParams struct {
	// TextDocument contains the details of the document that was closed.
	TextDocument TextDocumentIdentifier `json:"textDocument"`
}

DidCloseTextDocumentParams represents the parameters sent in the notification when a document is closed by the client.

type DidOpenTextDocumentParams

type DidOpenTextDocumentParams struct {
	// TextDocument contains the details of the document that was opened.
	TextDocument TextDocumentItem `json:"textDocument"`
}

DidOpenTextDocumentParams represents the parameters sent in the notification when a document is opened by the client.

type DidSaveTextDocumentParams

type DidSaveTextDocumentParams struct {
	// TextDocument holds the identifier and version of the text document that was saved
	TextDocument TextDocumentIdentifier `json:"textDocument"`

	// Text is the new text of the document that was saved.
	Text *string `json:"text,omitempty"`
}

DidSaveTextDocumentParams represents the parameters sent in the notification when a document is saved by the client.

type DocumentDiagnosticParams

type DocumentDiagnosticParams struct {
	// WorkDoneProgressParams contains options for work done progress reporting.
	WorkDoneProgressParams

	// TextDocument identifies the specific document to retrieve diagnostics for.
	TextDocument TextDocumentIdentifier `json:"textDocument"`

	// Identifier uniquely identifies the request.
	Identifier string `json:"identifier,omitempty"`

	// PreviousResultId is the identifier of the last known result for this document.
	// The server may use this to optimize diagnostic calculations and only return differences.
	PreviousResultId string `json:"previousResultId,omitempty"`
}

DocumentDiagnosticParams represents the parameters for the `textDocument/diagnostic` request. It is used to request diagnostics for a specific document.

type DocumentDiagnosticReport

type DocumentDiagnosticReport interface {
	GetKind() string
}

DocumentDiagnosticReport is an interface for diagnostic reports, which can be either FullDocumentDiagnosticReport or RelatedDocumentDiagnosticReport.

type FullDocumentDiagnosticReport

type FullDocumentDiagnosticReport struct {
	// Kind indicates this is a full document diagnostic report.
	Kind string `json:"kind"` // Should be "full"

	// ResultId is an optional identifier for caching and incremental updates.
	ResultId string `json:"resultId,omitempty"`

	// Items contains the list of diagnostics for the document.
	Items []Diagnostic `json:"items"`
}

FullDocumentDiagnosticReport represents a full set of diagnostics for a document.

func (*FullDocumentDiagnosticReport) GetKind

func (f *FullDocumentDiagnosticReport) GetKind() string

GetKind returns the kind of FullDocumentDiagnosticReport.

type HoverContent

type HoverContent struct {
	MarkupContent   *MarkupContent `json:"-"`
	MarkedStrings   []MarkedString `json:"-"`
	PlainTextString *string        `json:"-"`
}

HoverContent represents the content for the hover response. It can be one of MarkupContent, MarkedString, or an array of MarkedString.

func (HoverContent) MarshalJSON

func (h HoverContent) MarshalJSON() ([]byte, error)

MarshalJSON customizes JSON encoding for HoverContent.

type HoverParams

type HoverParams struct {
	// TextDocument is the identifier for the text document.
	TextDocument TextDocumentIdentifier `json:"textDocument"`

	// Position specifies the position inside the text document where hover information is requested.
	Position Position `json:"position"`

	// WorkDoneProgressParams allows reporting progress for this request.
	WorkDoneProgressParams
}

HoverParams represents the parameters for a `textDocument/hover` request. It provides the position in the text document where hover information is requested.

type HoverResult

type HoverResult struct {
	// Contents is the hover information provided by the server.
	// It can be a string, a MarkupContent object, or an array of MarkedString objects.
	Contents HoverContent `json:"contents"`

	// Range is an optional range in the document that this hover refers to.
	Range *Range `json:"range,omitempty"`
}

HoverResult represents the result of a `textDocument/hover` request. It contains the hover content and an optional range within the document.

type InitializeParams

type InitializeParams struct {
	WorkDoneProgressParams

	// ProcessID is the ID of the parent process that started the server. If null, the process is not specified.
	ProcessID int `json:"processId,omitempty"`

	// ClientInfo is the information about the client.
	ClientInfo *ClientInfo `json:"clientInfo,omitempty"`

	// RootURI is the root URI of the workspace, which may be null.
	RootURI string `json:"rootUri,omitempty"`

	// Capabilities represents the client capabilities.
	Capabilities ClientCapabilities `json:"capabilities"`

	// Trace enables tracing and can be set to "off", "messages", or "verbose".
	Trace TraceValue `json:"trace,omitempty"`
}

InitializeParams represents the parameters sent during the "initialize" request.

type InitializeResult

type InitializeResult struct {
	// Capabilities defines the capabilities provided by the language server.
	Capabilities ServerCapabilities `json:"capabilities"`

	// ServerInfo provides information about the server (optional).
	ServerInfo *ServerInfo `json:"serverInfo,omitempty"`
}

InitializeResult represents the response sent by the server after receiving an InitializeRequest. It contains the capabilities of the language server.

type InsertTextFormat

type InsertTextFormat int

InsertTextFormat specifies how InsertText should be interpreted.

const (
	InsertTextFormatPlainText InsertTextFormat = 1 // Plain text format
	InsertTextFormatSnippet   InsertTextFormat = 2 // Snippet format
)

type InsertTextMode

type InsertTextMode int

InsertTextMode defines how whitespace is handled during insertion.

const (
	InsertTextModeAsIs              InsertTextMode = 1
	InsertTextModeAdjustIndentation InsertTextMode = 2
)

type LanguageID

type LanguageID string

Language represents the programming language identifier for a document. It is used to specify the language type of the file (e.g., JavaScript, Python, etc.).

const (
	// LanguagePHP is the identifier for PHP documents.
	LanguagePHP LanguageID = "php"

	// LanguageBlade is the identifier for blade documents.
	LanguageBlade LanguageID = "blade"
)

type Location

type Location struct {
	// URI is the unique resource identifier of the document.
	URI string `json:"uri"`

	// Range specifies the range within the document where the symbol's definition is located.
	Range Range `json:"range"`
}

Location represents a specific location in a text document.

type LocationLink struct {
	// OriginSelectionRange is the range in the originating document where the request was initiated.
	// This can be used to specify the range of the symbol being requested.
	OriginSelectionRange *Range `json:"originSelectionRange,omitempty"`

	// TargetURI is the URI of the target document where the definition is located.
	TargetURI string `json:"targetUri"`

	// TargetRange specifies the full range in the target document where the definition resides.
	TargetRange Range `json:"targetRange"`

	// TargetSelectionRange specifies the range within the target document that identifies the symbol definition.
	TargetSelectionRange Range `json:"targetSelectionRange"`
}

LocationLink provides additional metadata for a symbol's location, such as an origin selection range.

type MarkedString

type MarkedString struct {
	Language string `json:"language,omitempty"`
	Value    string `json:"value"`
}

MarkedString represents either a raw string or a language-specific string with a language identifier.

type MarkupContent

type MarkupContent struct {
	// Kind specifies the type of markup (e.g., "plaintext" or "markdown").
	Kind string `json:"kind"`

	// Value is the content to be displayed in the hover.
	Value string `json:"value"`
}

MarkupContent represents content with a specific markup kind (e.g., Markdown or plain text).

type PartialResultParams

type PartialResultParams struct {
	// PartialResultToken is a token for handling partial result updates.
	PartialResultToken *ProgressToken `json:"partialResultToken,omitempty"`
}

PartialResultParams allows for partial results in responses.

type Position

type Position struct {
	// Line is the zero-based line position in the document.
	Line int `json:"line"`

	// Character is the zero-based character offset in the line.
	Character int `json:"character"`
}

Position represents a position in a text document (line and character offset).

type ProgressToken

type ProgressToken struct {
	// contains filtered or unexported fields
}

ProgressToken is the progress token provided by the client or server.

func (*ProgressToken) MarshalJSON

func (v *ProgressToken) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*ProgressToken) UnmarshalJSON

func (v *ProgressToken) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Range

type Range struct {
	// Start is the start position of the range.
	Start Position `json:"start"`

	// End is the end position of the range.
	End Position `json:"end"`
}

Range represents a range in the text document, defined by a start and end position.

type RelatedDocumentDiagnosticReport

type RelatedDocumentDiagnosticReport struct {
	// Kind indicates this is a related document diagnostic report.
	Kind string `json:"kind"` // Should be "related"

	// RelatedDocuments maps document URIs to associated DocumentDiagnosticReport objects.
	RelatedDocuments map[string]DocumentDiagnosticReport `json:"relatedDocuments"`
}

RelatedDocumentDiagnosticReport represents diagnostics for a document with references to related documents.

func (*RelatedDocumentDiagnosticReport) GetKind

GetKind returns the kind of RelatedDocumentDiagnosticReport.

type ServerCapabilities

type ServerCapabilities struct {
	// TextDocumentSync defines how the server handles text document synchronization.
	//
	// If omitted it defaults to TextDocumentSyncKind.None`
	TextDocumentSync interface{} `json:"textDocumentSync,omitempty"` // *TextDocumentSyncOptions | TextDocumentSyncKind

	// HoverProvider indicates whether the server provides hover support.
	HoverProvider bool `json:"hoverProvider,omitempty"`

	// CompletionProvider defines the server's capability to provide completion items.
	CompletionProvider *CompletionOptions `json:"completionProvider,omitempty"`

	// SignatureHelpProvider defines the server's capability to provide signature help.
	SignatureHelpProvider *SignatureHelpOptions `json:"signatureHelpProvider,omitempty"`

	// DefinitionProvider represents the server's capability of providing definitions
	// for symbols in a text document, allowing the client to navigate to the symbol's definition.
	DefinitionProvider bool `json:"definitionProvider,omitempty"`

	// The server has support for pull model diagnostics.
	DiagnosticProvider interface{} `json:"diagnosticProvider,omitempty"`

	// The server has support for code actions.
	CodeActionProvider bool `json:"codeActionProvider,omitempty"`
}

ServerCapabilities defines the capabilities of the language server.

type ServerInfo

type ServerInfo struct {
	// Name is the name of the server.
	Name string `json:"name"`

	// Version is the version of the server (optional).
	Version string `json:"version,omitempty"`
}

ServerInfo represents additional information about the server.

type SignatureHelpOptions

type SignatureHelpOptions struct {
	// TriggerCharacters defines the characters that trigger signature help.
	TriggerCharacters []string `json:"triggerCharacters,omitempty"`
}

SignatureHelpOptions defines how the server supports providing signature help.

type TextDocumentContentChangeEvent

type TextDocumentContentChangeEvent struct {
	// Range specifies the range of the text document that changed.
	// If nil, the entire document is considered changed.
	Range *Range `json:"range,omitempty"`

	// RangeLength is the length of the range that got replaced.
	// This field is optional and only provided when applicable.
	RangeLength *int `json:"rangeLength,omitempty"`

	// Text is the new text of the document after the change.
	Text string `json:"text"`
}

TextDocumentContentChangeEvent represents a change to a text document. It includes the text that was inserted, deleted, or modified.

type TextDocumentEdit

type TextDocumentEdit struct {
	// TextDocument identifies the text document to change.
	TextDocument VersionedTextDocumentIdentifier `json:"textDocument"`

	// Edits is an array of edits to apply to the text document.
	Edits []TextEdit `json:"edits"`
}

TextDocumentEdit represents edits to a single text document.

type TextDocumentIdentifier

type TextDocumentIdentifier struct {
	// URI is the unique resource identifier of the document that was closed.
	URI string `json:"uri"`
}

TextDocumentIdentifier is used to identify a specific text document. It only contains the URI of the document.

type TextDocumentItem

type TextDocumentItem struct {
	// URI is the unique resource identifier of the document (usually a file path or URL).
	URI string `json:"uri"`

	// LanguageID is the language identifier associated with the document (e.g., "python", "javascript").
	LanguageID LanguageID `json:"languageId"`

	// Version is the version number of the document.
	Version int `json:"version"`

	// Text is the content of the document.
	Text string `json:"text"`
}

TextDocumentItem represents the information related to a text document.

type TextDocumentPositionParams

type TextDocumentPositionParams struct {
	// TextDocument holds the identifier of the text document.
	TextDocument TextDocumentIdentifier `json:"textDocument"`

	// Position specifies the position within the text document.
	Position Position `json:"position"`
}

TextDocumentPositionParams represents parameters for requests that operate on a specific text document at a specific position, such as hover information or code actions.

type TextDocumentSyncKind

type TextDocumentSyncKind float64

TextDocumentSyncKind defines how the host (editor) should sync document changes to the language server.

const (
	// TextDocumentSyncKindNone documents should not be synced at all.
	TextDocumentSyncKindNone TextDocumentSyncKind = 0

	// TextDocumentSyncKindFull documents are synced by always sending the full content
	// of the document.
	TextDocumentSyncKindFull TextDocumentSyncKind = 1

	// TextDocumentSyncKindIncremental documents are synced by sending the full content on open.
	// After that only incremental updates to the document are
	// send.
	TextDocumentSyncKindIncremental TextDocumentSyncKind = 2
)

type TextEdit

type TextEdit struct {
	// Range specifies the range of text to be replaced.
	Range Range `json:"range"`

	// NewText is the string to replace the range with.
	NewText string `json:"newText"`
}

TextEdit represents a textual edit applicable to a document.

type TraceValue

type TraceValue string

TraceValue represents a InitializeParams Trace mode.

const (
	// TraceOff disable tracing.
	TraceOff TraceValue = "off"

	// TraceMessage normal tracing mode.
	TraceMessage TraceValue = "message"

	// TraceVerbose verbose tracing mode.
	TraceVerbose TraceValue = "verbose"
)

list of TraceValue.

type VersionedTextDocumentIdentifier

type VersionedTextDocumentIdentifier struct {
	TextDocumentIdentifier

	// Version is the version number of the document.
	Version int `json:"version"`
}

VersionedTextDocumentIdentifier identifies a versioned text document.

type WorkDoneProgressOptions

type WorkDoneProgressOptions struct {
	// WorkDoneProgress is a flag that indicates whether progress reporting is supported.
	WorkDoneProgress bool `json:"workDoneProgress,omitempty"`
}

WorkDoneProgressOptions indicates if a request supports work-done progress reporting.

type WorkDoneProgressParams

type WorkDoneProgressParams struct {
	// WorkDoneToken an optional token that a server can use to report work done progress.
	WorkDoneToken *ProgressToken `json:"workDoneToken,omitempty"`
}

WorkDoneProgressParams is a parameter property of report work done progress.

type WorkspaceEdit

type WorkspaceEdit struct {
	// Changes is a map of document URIs to an array of TextEdits.
	// Changes should be applied to the documents in the specified order.
	Changes map[string][]TextEdit `json:"changes,omitempty"`

	// DocumentChanges is an optional array of TextDocumentEdits.
	// These edits support versioned documents and resource operations.
	DocumentChanges []TextDocumentEdit `json:"documentChanges,omitempty"`
}

WorkspaceEdit represents changes to many resources in the workspace.

Jump to

Keyboard shortcuts

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