agent

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 18 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 agent implements read-only language-tooling requests against gopls.

Index

Constants

View Source
const MaxBatchOperations = 16

MaxBatchOperations bounds prepared source overlays retained by one session.

Variables

This section is empty.

Functions

func WriteText

func WriteText(w io.Writer, result Result) error

WriteText gives a compact view while JSON output preserves the complete LSP payload, including documentation, edits and location links.

Types

type Options

type Options struct {
	Workspace, File, Operation, Gopls, Insert string
	Line, Column                              int
}

type Position

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

Position uses LSP's zero-based UTF-16 coordinates, not byte or visual columns.

type Result

type Result struct {
	Operation string          `json:"operation"`
	Workspace string          `json:"workspace"`
	File      string          `json:"file"`
	Position  Position        `json:"position"`
	Server    ServerInfo      `json:"server"`
	Payload   json.RawMessage `json:"result"`
	Timing    Timing          `json:"timing"`
}

func Inspect

func Inspect(ctx context.Context, options Options) (Result, error)

Inspect launches an existing gopls executable, sends one unsaved document and returns its actual response. No source files or source-file probes are written.

type ServerInfo

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

type Timing

type Timing struct {
	InitializeNanoseconds int64 `json:"initialize_ns"`
	RequestNanoseconds    int64 `json:"request_ns"`
}

Timing separates protocol request latency from server startup. Request time includes any gopls package loading caused by that request; it is not CPU time. Process shutdown and document preparation belong to the caller's wall time.

Jump to

Keyboard shortcuts

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