Help us shape the future of Go! Take the 2026 Go Developer Survey

language

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareSeverity

func CompareSeverity(a, b Severity) int

func DiagnosticSummary

func DiagnosticSummary(values []Diagnostic) string

func DocumentSymbolsFromProtocol

func DocumentSymbolsFromProtocol(result lsp.DocumentSymbolResult) ([]lsp.DocumentSymbol, []lsp.SymbolInformation)

func FormatDiagnosticLine

func FormatDiagnosticLine(path string, diagnostic Diagnostic) string

func FormatDiagnostics

func FormatDiagnostics(values []Diagnostic, filePath, root string) string

func HoverText

func HoverText(hover *lsp.Hover) string

func SeverityName

func SeverityName(severity Severity) string

func TreeSitterSupported added in v0.19.1

func TreeSitterSupported(filePath string) bool

Types

type Diagnostic

type Diagnostic struct {
	Range    Range    `json:"range"`
	Severity Severity `json:"severity,omitempty"`
	Code     any      `json:"code,omitempty"`
	Source   string   `json:"source,omitempty"`
	Message  string   `json:"message"`
}

func DiagnosticsFromProtocol

func DiagnosticsFromProtocol(values []lsp.Diagnostic) []Diagnostic

type Position

type Position struct {
	Line      int `json:"line"`
	Character int `json:"character"`
}

type Range

type Range struct {
	Start Position `json:"start"`
	End   Position `json:"end"`
}

type SemanticToken

type SemanticToken struct {
	Line      int      `json:"line"`
	Character int      `json:"character"`
	Length    int      `json:"length"`
	Type      string   `json:"type"`
	Modifiers []string `json:"modifiers,omitempty"`
}

SemanticToken is the expanded editor representation shared by the LSP and Tree-sitter providers. The LSP client itself keeps the protocol's raw, delta-encoded SemanticTokens value.

type Service

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

Service owns the code-intelligence backends for one workspace. It is the only layer that chooses between language-server and structural results.

func New

func New(root string, managerOptions ...lsp.ManagerOption) *Service

func (*Service) Activities added in v0.15.1

func (s *Service) Activities() []lsp.ServerActivity

func (*Service) Capabilities

func (s *Service) Capabilities(ctx context.Context, filePath string) (lsp.ServerCapabilities, bool, error)

func (*Service) Close

func (s *Service) Close()

func (*Service) CloseDocument

func (s *Service) CloseDocument(ctx context.Context, filePath string) error

func (*Service) CodeActions

func (s *Service) CodeActions(ctx context.Context, filePath string, content *string, selection lsp.Range, only []lsp.CodeActionKind, trigger lsp.CodeActionTriggerKind) ([]lsp.CommandOrCodeAction, error)

func (*Service) CompletionItems

func (s *Service) CompletionItems(ctx context.Context, filePath string, content *string, line, column int, completionContext *lsp.CompletionContext) (lsp.CompletionList, error)

func (*Service) DefinitionLocations

func (s *Service) DefinitionLocations(ctx context.Context, filePath string, content *string, line, column int) ([]lsp.Location, error)

func (*Service) Diagnostics

func (s *Service) Diagnostics(ctx context.Context) WorkspaceReport

func (*Service) DocumentContent

func (s *Service) DocumentContent(filePath string) (string, bool)

func (*Service) DocumentHighlights

func (s *Service) DocumentHighlights(ctx context.Context, filePath string, content *string, line, column int) ([]lsp.DocumentHighlight, error)

func (*Service) DocumentSymbols

func (s *Service) DocumentSymbols(ctx context.Context, filePath string, content *string) ([]lsp.DocumentSymbol, []lsp.SymbolInformation, error)

func (*Service) ExecuteCommand

func (s *Service) ExecuteCommand(ctx context.Context, filePath string, content *string, command lsp.Command) (any, error)

func (*Service) ExecuteCommandWithEdits added in v0.15.1

func (s *Service) ExecuteCommandWithEdits(ctx context.Context, filePath string, content *string, command lsp.Command) (any, []lsp.CommandWorkspaceEdit, error)

func (*Service) FileDiagnostics

func (s *Service) FileDiagnostics(ctx context.Context, filePath string, content *string) ([]Diagnostic, bool, error)

func (*Service) FoldingRanges

func (s *Service) FoldingRanges(ctx context.Context, filePath string, content *string) ([]lsp.FoldingRange, error)

func (*Service) Formatting

func (s *Service) Formatting(ctx context.Context, filePath string, content *string, options lsp.FormattingOptions) ([]lsp.TextEdit, error)

func (*Service) HasLSP

func (s *Service) HasLSP() bool

func (*Service) HasLSPFor added in v0.15.1

func (s *Service) HasLSPFor(filePath string) bool

func (*Service) Hover

func (s *Service) Hover(ctx context.Context, filePath string, content *string, line, column int) (string, error)

func (*Service) ImplementationLocations

func (s *Service) ImplementationLocations(ctx context.Context, filePath string, content *string, line, column int) ([]lsp.Location, error)

func (*Service) InlayHints

func (s *Service) InlayHints(ctx context.Context, filePath string, content *string, selection lsp.Range) ([]lsp.InlayHint, error)

func (*Service) InvalidateLSPDetection added in v0.15.0

func (s *Service) InvalidateLSPDetection()

InvalidateLSPDetection makes managed-tool changes visible to subsequent capability and session lookups.

func (*Service) Manager

func (s *Service) Manager() *lsp.Manager

func (*Service) OnTypeFormatting

func (s *Service) OnTypeFormatting(ctx context.Context, filePath string, content *string, line, column int, character string, options lsp.FormattingOptions) ([]lsp.TextEdit, error)

func (*Service) PostEditDiagnostics

func (s *Service) PostEditDiagnostics(ctx context.Context, filePath string) string

func (*Service) PrepareRename

func (s *Service) PrepareRename(ctx context.Context, filePath string, content *string, line, column int) (lsp.PrepareRenameResult, error)

func (*Service) RangeFormatting

func (s *Service) RangeFormatting(ctx context.Context, filePath string, content *string, selection lsp.Range, options lsp.FormattingOptions) ([]lsp.TextEdit, error)

func (*Service) ReferenceLocations

func (s *Service) ReferenceLocations(ctx context.Context, filePath string, content *string, line, column int) ([]lsp.Location, error)

func (*Service) Rename

func (s *Service) Rename(ctx context.Context, filePath string, content *string, line, column int, newName string) (*lsp.WorkspaceEdit, error)

func (*Service) ResolveCodeAction

func (s *Service) ResolveCodeAction(ctx context.Context, filePath string, content *string, action lsp.CodeAction) (*lsp.CodeAction, error)

func (*Service) ResolveCompletionItem

func (s *Service) ResolveCompletionItem(ctx context.Context, filePath string, content *string, item lsp.CompletionItem) (lsp.CompletionItem, error)

func (*Service) SemanticTokens

func (s *Service) SemanticTokens(ctx context.Context, filePath string, content *string) ([]SemanticToken, error)

func (*Service) SetServerInitializationOptions added in v0.15.0

func (s *Service) SetServerInitializationOptions(name string, value any) error

SetServerInitializationOptions refreshes a server's startup configuration.

func (*Service) SignatureHelp

func (s *Service) SignatureHelp(ctx context.Context, filePath string, content *string, line, column int, signatureContext *lsp.SignatureHelpContext) (*lsp.SignatureHelp, error)

func (*Service) SyncDocument

func (s *Service) SyncDocument(ctx context.Context, filePath, content string, saved bool) error

func (*Service) TreeSitterDefinitions added in v0.19.1

func (s *Service) TreeSitterDefinitions(ctx context.Context, filePath string, content *string, line, column int) ([]lsp.Location, error)

func (*Service) TreeSitterDocumentSymbols added in v0.19.1

func (s *Service) TreeSitterDocumentSymbols(filePath string, content *string) ([]lsp.DocumentSymbol, error)

func (*Service) TreeSitterHover added in v0.19.1

func (s *Service) TreeSitterHover(ctx context.Context, filePath string, content *string, line, column int) (string, error)

func (*Service) TreeSitterImplementations added in v0.19.1

func (s *Service) TreeSitterImplementations(ctx context.Context, filePath string, content *string, line, column int) ([]lsp.Location, error)

func (*Service) TreeSitterIncomingCalls added in v0.19.1

func (s *Service) TreeSitterIncomingCalls(ctx context.Context, filePath string, line, column int) ([]lsp.CallHierarchyIncomingCall, error)

func (*Service) TreeSitterOutgoingCalls added in v0.19.1

func (s *Service) TreeSitterOutgoingCalls(ctx context.Context, filePath string, line, column int) ([]lsp.CallHierarchyOutgoingCall, []string, error)

TreeSitterOutgoingCalls also returns callee names without a workspace declaration, typically library or dynamic calls.

func (*Service) TreeSitterReferences added in v0.19.1

func (s *Service) TreeSitterReferences(ctx context.Context, filePath string, content *string, line, column int, includeDeclaration bool) ([]lsp.Location, bool, error)

func (*Service) TreeSitterWorkspaceSymbols added in v0.19.1

func (s *Service) TreeSitterWorkspaceSymbols(ctx context.Context, query string, uncoveredOnly bool) ([]lsp.SymbolInformation, bool, error)

TreeSitterWorkspaceSymbols searches every supported file, or with uncoveredOnly only those no language server is configured for. The bool reports a result capped at maxTreeSitterSymbols.

func (*Service) TypeDefinitionLocations

func (s *Service) TypeDefinitionLocations(ctx context.Context, filePath string, content *string, line, column int) ([]lsp.Location, error)

func (*Service) WarmUp

func (s *Service) WarmUp()

func (*Service) WorkspaceSymbols

func (s *Service) WorkspaceSymbols(ctx context.Context, query string) ([]lsp.SymbolInformation, []lsp.WorkspaceSymbol, error)

type Severity

type Severity int
const (
	SeverityError       Severity = 1
	SeverityWarning     Severity = 2
	SeverityInformation Severity = 3
	SeverityHint        Severity = 4
)

type WorkspaceReport

type WorkspaceReport struct {
	Diagnostics        map[string][]Diagnostic
	CheckedFiles       int
	DiscoveredFiles    int
	DiscoveryTruncated bool
	UnknownFiles       int
	UnavailableServers []string
	Analyzing          bool
}

Jump to

Keyboard shortcuts

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