lsp

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogError   = 1
	LogWarning = 2
	LogInfo    = 3
	LogDebug   = 4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyWorkspaceEditParams

type ApplyWorkspaceEditParams struct {
	Label string              `json:"label"`
	Edit  WorkspaceEditResult `json:"edit"`
}

type CodeActionResult

type CodeActionResult struct {
	Title       string               `json:"title"`
	Kind        string               `json:"kind"`
	Edit        *WorkspaceEditResult `json:"edit,omitempty"`
	Command     *CommandResult       `json:"command,omitempty"`
	Diagnostics []DiagnosticResult   `json:"diagnostics,omitempty"`
}

type CodeLensOptions

type CodeLensOptions struct {
	ResolveProvider bool `json:"resolveProvider"`
}

type CodeLensResult

type CodeLensResult struct {
	Range   document.Range `json:"range"`
	Command CommandResult  `json:"command"`
}

type CommandResult

type CommandResult struct {
	Title     string `json:"title"`
	Command   string `json:"command"`
	Arguments []any  `json:"arguments"`
}

type CompletionItemResult

type CompletionItemResult struct {
	Label         string              `json:"label"`
	Detail        string              `json:"detail,omitempty"`
	InsertText    string              `json:"insertText,omitempty"`
	Kind          int                 `json:"kind"`
	Documentation *MarkupContent      `json:"documentation,omitempty"`
	Data          map[string]string   `json:"data,omitempty"`
	TextEdit      *CompletionTextEdit `json:"textEdit,omitempty"`
}

type CompletionOptions

type CompletionOptions struct {
	TriggerCharacters []string `json:"triggerCharacters"`
	ResolveProvider   bool     `json:"resolveProvider,omitempty"`
}

type CompletionTextEdit

type CompletionTextEdit struct {
	Range   document.Range `json:"range"`
	NewText string         `json:"newText"`
}

type ContentChange

type ContentChange struct {
	Range *document.Range `json:"range,omitempty"`
	Text  string          `json:"text"`
}

type DiagnosticOptions

type DiagnosticOptions struct {
	InterFileDependencies bool `json:"interFileDependencies"`
	WorkspaceDiagnostics  bool `json:"workspaceDiagnostics"`
}

type DiagnosticParams

type DiagnosticParams struct {
	URI         string             `json:"uri"`
	Diagnostics []DiagnosticResult `json:"diagnostics"`
}

type DiagnosticResult

type DiagnosticResult struct {
	Range    document.Range `json:"range"`
	Severity int            `json:"severity"`
	Code     string         `json:"code"`
	Source   string         `json:"source"`
	Message  string         `json:"message"`
}

type DidChangeParams

type DidChangeParams struct {
	TextDocument struct {
		URI     string `json:"uri"`
		Version int    `json:"version"`
	} `json:"textDocument"`
	ContentChanges []ContentChange `json:"contentChanges"`
}

type DidCloseParams

type DidCloseParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
}

type DidOpenParams

type DidOpenParams struct {
	TextDocument TextDocumentItem `json:"textDocument"`
}

type DocumentDiagnosticReport

type DocumentDiagnosticReport struct {
	Kind  string             `json:"kind"`
	Items []DiagnosticResult `json:"items"`
}

type DocumentLinkResult

type DocumentLinkResult struct {
	Range   document.Range `json:"range"`
	Target  string         `json:"target"`
	Tooltip string         `json:"tooltip,omitempty"`
}

type ExecuteCommandOptions

type ExecuteCommandOptions struct {
	Commands []string `json:"commands"`
}

type FileOperationCapabilities

type FileOperationCapabilities struct {
	WillCreate *FileOperationRegistration `json:"willCreate,omitempty"`
	DidCreate  *FileOperationRegistration `json:"didCreate,omitempty"`
	DidDelete  *FileOperationRegistration `json:"didDelete,omitempty"`
	WillRename *FileOperationRegistration `json:"willRename,omitempty"`
}

type FileOperationFilter

type FileOperationFilter struct {
	Pattern FileOperationPattern `json:"pattern"`
}

type FileOperationPattern

type FileOperationPattern struct {
	Glob string `json:"glob"`
}

type FileOperationRegistration

type FileOperationRegistration struct {
	Filters []FileOperationFilter `json:"filters"`
}

type FoldingRangeResult

type FoldingRangeResult struct {
	StartLine      int    `json:"startLine"`
	StartCharacter int    `json:"startCharacter,omitempty"`
	EndLine        int    `json:"endLine"`
	EndCharacter   int    `json:"endCharacter,omitempty"`
	Kind           string `json:"kind,omitempty"`
}

type HoverResult

type HoverResult struct {
	Contents MarkupContent   `json:"contents"`
	Range    *document.Range `json:"range,omitempty"`
}

type InitializeParams

type InitializeParams struct {
	RootURI          string            `json:"rootUri"`
	Capabilities     json.RawMessage   `json:"capabilities"`
	WorkspaceFolders []WorkspaceFolder `json:"workspaceFolders"`
}

type InitializeResult

type InitializeResult struct {
	Capabilities ServerCapabilities `json:"capabilities"`
	ServerInfo   *ServerInfo        `json:"serverInfo,omitempty"`
}

type LocationResult

type LocationResult struct {
	URI   string         `json:"uri"`
	Range document.Range `json:"range"`
}

type LogMessageParams

type LogMessageParams struct {
	Type    int    `json:"type"`
	Message string `json:"message"`
}

type MarkupContent

type MarkupContent struct {
	Kind  string `json:"kind"`
	Value string `json:"value"`
}

type Notification

type Notification struct {
	JSONRPC string `json:"jsonrpc"`
	Method  string `json:"method"`
	Params  any    `json:"params,omitempty"`
}

type PrepareRenameResult

type PrepareRenameResult struct {
	Range       document.Range `json:"range"`
	Placeholder string         `json:"placeholder"`
}

type RenameOptions

type RenameOptions struct {
	PrepareProvider bool `json:"prepareProvider"`
}

type RenameParams

type RenameParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Position     document.Position      `json:"position"`
	NewName      string                 `json:"newName"`
}

type Request

type Request struct {
	JSONRPC string           `json:"jsonrpc"`
	ID      *json.RawMessage `json:"id,omitempty"`
	Method  string           `json:"method"`
	Params  json.RawMessage  `json:"params,omitempty"`
}

type Response

type Response struct {
	JSONRPC string           `json:"jsonrpc"`
	ID      *json.RawMessage `json:"id"`
	Result  json.RawMessage  `json:"result,omitempty"`
	Error   *ResponseError   `json:"error,omitempty"`
}

type ResponseError

type ResponseError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type SemanticTokensLegend

type SemanticTokensLegend struct {
	TokenTypes     []string `json:"tokenTypes"`
	TokenModifiers []string `json:"tokenModifiers"`
}

type SemanticTokensOptions

type SemanticTokensOptions struct {
	Full   bool                 `json:"full"`
	Range  bool                 `json:"range"`
	Legend SemanticTokensLegend `json:"legend"`
}

type SemanticTokensResult

type SemanticTokensResult struct {
	Data []uint32 `json:"data"`
}

type Server

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

func NewServer

func NewServer() *Server

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, in io.Reader, out io.Writer) error

func (*Server) SetNotify

func (s *Server) SetNotify(fn func(method string, params any))

func (*Server) SetVersion

func (s *Server) SetVersion(v string)

type ServerCapabilities

type ServerCapabilities struct {
	TextDocumentSync                int                    `json:"textDocumentSync"`
	CompletionProvider              *CompletionOptions     `json:"completionProvider,omitempty"`
	DefinitionProvider              bool                   `json:"definitionProvider"`
	HoverProvider                   bool                   `json:"hoverProvider"`
	ReferencesProvider              bool                   `json:"referencesProvider"`
	RenameProvider                  *RenameOptions         `json:"renameProvider,omitempty"`
	CodeActionProvider              bool                   `json:"codeActionProvider"`
	CodeLensProvider                *CodeLensOptions       `json:"codeLensProvider,omitempty"`
	DocumentHighlightProvider       bool                   `json:"documentHighlightProvider"`
	DocumentLinkProvider            bool                   `json:"documentLinkProvider"`
	FoldingRangeProvider            bool                   `json:"foldingRangeProvider"`
	DocumentSymbolProvider          bool                   `json:"documentSymbolProvider"`
	WorkspaceSymbolProvider         bool                   `json:"workspaceSymbolProvider"`
	SelectionRangeProvider          bool                   `json:"selectionRangeProvider"`
	LinkedEditingRangeProvider      bool                   `json:"linkedEditingRangeProvider"`
	DocumentFormattingProvider      bool                   `json:"documentFormattingProvider"`
	InlayHintProvider               bool                   `json:"inlayHintProvider"`
	DocumentRangeFormattingProvider bool                   `json:"documentRangeFormattingProvider"`
	DiagnosticProvider              *DiagnosticOptions     `json:"diagnosticProvider,omitempty"`
	ExecuteCommandProvider          *ExecuteCommandOptions `json:"executeCommandProvider,omitempty"`
	SemanticTokensProvider          *SemanticTokensOptions `json:"semanticTokensProvider,omitempty"`
	Workspace                       *WorkspaceCapabilities `json:"workspace,omitempty"`
}

type ServerInfo

type ServerInfo struct {
	Name    string `json:"name"`
	Version string `json:"version,omitempty"`
}

type ShowMessageParams

type ShowMessageParams struct {
	Type    int    `json:"type"`
	Message string `json:"message"`
}

type TextDocumentIdentifier

type TextDocumentIdentifier struct {
	URI string `json:"uri"`
}

type TextDocumentItem

type TextDocumentItem struct {
	URI     string `json:"uri"`
	Version int    `json:"version"`
	Text    string `json:"text"`
}

type TextDocumentPositionParams

type TextDocumentPositionParams struct {
	TextDocument TextDocumentIdentifier `json:"textDocument"`
	Position     document.Position      `json:"position"`
}

type TextEditResult

type TextEditResult struct {
	Range   document.Range `json:"range"`
	NewText string         `json:"newText"`
}

type WorkspaceCapabilities

type WorkspaceCapabilities struct {
	FileOperations *FileOperationCapabilities `json:"fileOperations,omitempty"`
}

type WorkspaceEditResult

type WorkspaceEditResult struct {
	Changes map[string][]TextEditResult `json:"changes"`
}

type WorkspaceFolder

type WorkspaceFolder struct {
	URI  string `json:"uri"`
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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