lsptool

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package lsptool adapts an *lsp.Client into ds4go.ToolHandler values so a model running in a ds4go.ToolLoop can query a language server.

Index

Constants

View Source
const DefaultDiagnosticsTimeout = 5 * time.Second

DefaultDiagnosticsTimeout bounds the wait in the diagnostics tool.

Variables

This section is empty.

Functions

func NewCompletionTool

func NewCompletionTool(q Querier) ds4go.ToolHandler

NewCompletionTool returns a tool that returns completion suggestions at a 1-based line and character position in a document.

func NewDiagnosticsTool

func NewDiagnosticsTool(q Querier) ds4go.ToolHandler

NewDiagnosticsTool returns a tool that reports diagnostics for a document. If "code" is supplied, the document is updated and re-checked first. Without "code" it returns the latest buffered diagnostics, which may lag the most recent edit.

func NewHoverTool

func NewHoverTool(q Querier) ds4go.ToolHandler

NewHoverTool returns a tool that returns hover info at a 1-based line and character position in a document.

func NewSymbolsTool

func NewSymbolsTool(q Querier) ds4go.ToolHandler

NewSymbolsTool returns a tool that lists the document outline for a document.

Types

type Querier

type Querier interface {
	Update(ctx context.Context, uri, text string) (int, error)
	WaitForDiagnostics(ctx context.Context, uri string, timeout time.Duration) ([]lsp.Diagnostic, error)
	Diagnostics(uri string) []lsp.Diagnostic
	Hover(ctx context.Context, uri string, line, col int) (string, error)
	Symbols(ctx context.Context, uri string) ([]lsp.Symbol, error)
	Completion(ctx context.Context, uri string, line, col, limit int) ([]string, int, error)
}

Querier is the subset of *lsp.Client the tools need. *lsp.Client satisfies it; tests substitute a fake.

Jump to

Keyboard shortcuts

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