Documentation
¶
Index ¶
- func CountBySeverity(diagnostics []lsp.Diagnostic) map[lsp.DiagnosticSeverity]int
- func HasErrors(diagnostics []lsp.Diagnostic) bool
- func HasWarnings(diagnostics []lsp.Diagnostic) bool
- type Client
- func (c *Client) Close() error
- func (c *Client) CloseDocument(uri string) error
- func (c *Client) GetAllDiagnostics() map[string][]lsp.Diagnostic
- func (c *Client) GetDiagnostics(uri string) []lsp.Diagnostic
- func (c *Client) Initialize() error
- func (c *Client) OpenDocument(uri, languageID, text string) error
- type DiagnosticFormatter
- func (f *DiagnosticFormatter) FormatAllDiagnostics(diagnosticsByURI map[string][]lsp.Diagnostic) string
- func (f *DiagnosticFormatter) FormatCompact(uri string, diagnostics []lsp.Diagnostic) string
- func (f *DiagnosticFormatter) FormatDiagnostics(uri string, diagnostics []lsp.Diagnostic) string
- func (f *DiagnosticFormatter) FormatForAI(uri string, diagnostics []lsp.Diagnostic) string
- func (f *DiagnosticFormatter) GetDiagnosticSummary(diagnosticsByURI map[string][]lsp.Diagnostic) DiagnosticSummary
- type DiagnosticSummary
- type FileDiagnosticSummary
- type Manager
- func (m *Manager) AnalyzeFile(filePath, content string) ([]lsp.Diagnostic, error)
- func (m *Manager) Close() error
- func (m *Manager) GetAllDiagnostics() map[string]map[string][]lsp.Diagnostic
- func (m *Manager) GetClient(name string) (*Client, bool)
- func (m *Manager) GetClientForFile(filePath string) (*Client, bool)
- func (m *Manager) GetDiagnosticsForFile(filePath string) []lsp.Diagnostic
- func (m *Manager) GetServerNames() []string
- func (m *Manager) IsEnabled() bool
- type ManagerInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountBySeverity ¶
func CountBySeverity(diagnostics []lsp.Diagnostic) map[lsp.DiagnosticSeverity]int
CountByeSeverity counts diagnostics by severity.
func HasErrors ¶
func HasErrors(diagnostics []lsp.Diagnostic) bool
HasErrors returns true if there are any error-level diagnostics.
func HasWarnings ¶
func HasWarnings(diagnostics []lsp.Diagnostic) bool
HasWarnings returns true if there are any warning-level diagnostics.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an LSP client that communicates with an LSP server.
func NewClient ¶
func NewClient(ctx context.Context, name string, config *schema.LSPServer, rootURI string) (*Client, error)
NewClient creates a new LSP client for the specified server configuration.
func (*Client) CloseDocument ¶
CloseDocument notifies the server that a document was closed.
func (*Client) GetAllDiagnostics ¶
func (c *Client) GetAllDiagnostics() map[string][]lsp.Diagnostic
GetAllDiagnostics returns all diagnostics from all documents.
func (*Client) GetDiagnostics ¶
func (c *Client) GetDiagnostics(uri string) []lsp.Diagnostic
GetDiagnostics returns diagnostics for the specified URI.
func (*Client) Initialize ¶
Initialize sends the initialize request to the LSP server.
func (*Client) OpenDocument ¶
OpenDocument notifies the server that a document was opened.
type DiagnosticFormatter ¶
type DiagnosticFormatter struct {
ShowRelated bool // Show related information.
ShowSource bool // Show diagnostic source.
}
DiagnosticFormatter formats LSP diagnostics for display.
func NewDiagnosticFormatter ¶
func NewDiagnosticFormatter() *DiagnosticFormatter
NewDiagnosticFormatter creates a new diagnostic formatter.
func (*DiagnosticFormatter) FormatAllDiagnostics ¶
func (f *DiagnosticFormatter) FormatAllDiagnostics(diagnosticsByURI map[string][]lsp.Diagnostic) string
FormatAllDiagnostics formats diagnostics from multiple files.
func (*DiagnosticFormatter) FormatCompact ¶
func (f *DiagnosticFormatter) FormatCompact(uri string, diagnostics []lsp.Diagnostic) string
FormatCompact formats diagnostics in a compact, one-line-per-issue format.
func (*DiagnosticFormatter) FormatDiagnostics ¶
func (f *DiagnosticFormatter) FormatDiagnostics(uri string, diagnostics []lsp.Diagnostic) string
FormatDiagnostics formats a list of diagnostics into a human-readable string.
func (*DiagnosticFormatter) FormatForAI ¶
func (f *DiagnosticFormatter) FormatForAI(uri string, diagnostics []lsp.Diagnostic) string
FormatForAI formats diagnostics in a format optimized for AI consumption.
func (*DiagnosticFormatter) GetDiagnosticSummary ¶
func (f *DiagnosticFormatter) GetDiagnosticSummary(diagnosticsByURI map[string][]lsp.Diagnostic) DiagnosticSummary
GetDiagnosticSummary returns a summary of diagnostics.
type DiagnosticSummary ¶
type DiagnosticSummary struct {
FilesWithIssues int `json:"files_with_issues"`
TotalErrors int `json:"total_errors"`
TotalWarnings int `json:"total_warnings"`
TotalInfos int `json:"total_infos"`
TotalHints int `json:"total_hints"`
Files map[string]FileDiagnosticSummary `json:"files"`
}
DiagnosticSummary contains summary information about diagnostics.
type FileDiagnosticSummary ¶
type FileDiagnosticSummary struct {
Errors int `json:"errors"`
Warnings int `json:"warnings"`
Infos int `json:"infos"`
Hints int `json:"hints"`
}
FileDiagnosticSummary contains summary for a single file.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages multiple LSP server clients.
func NewManager ¶
NewManager creates a new LSP manager.
func (*Manager) AnalyzeFile ¶
func (m *Manager) AnalyzeFile(filePath, content string) ([]lsp.Diagnostic, error)
AnalyzeFile opens a file in the appropriate LSP server and returns diagnostics. It waits up to 500ms for diagnostics to be published by the LSP server to handle asynchronous diagnostic publication.
func (*Manager) GetAllDiagnostics ¶
func (m *Manager) GetAllDiagnostics() map[string]map[string][]lsp.Diagnostic
GetAllDiagnostics returns all diagnostics from all LSP servers.
func (*Manager) GetClientForFile ¶
GetClientForFile returns the LSP client that handles the given file.
func (*Manager) GetDiagnosticsForFile ¶
func (m *Manager) GetDiagnosticsForFile(filePath string) []lsp.Diagnostic
GetDiagnosticsForFile returns diagnostics for a specific file from all servers.
func (*Manager) GetServerNames ¶
GetServerNames returns list of configured server names.
type ManagerInterface ¶
type ManagerInterface interface {
GetClient(name string) (*Client, bool)
GetClientForFile(filePath string) (*Client, bool)
AnalyzeFile(filePath, content string) ([]lsp.Diagnostic, error)
GetAllDiagnostics() map[string]map[string][]lsp.Diagnostic
GetDiagnosticsForFile(filePath string) []lsp.Diagnostic
Close() error
IsEnabled() bool
GetServerNames() []string
}
ManagerInterface defines the interface for LSP manager operations.