quickfix

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 1 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 quickfix carries the source edits that resolve a diagnostic, attached by the layer that reported it and rendered by an editor as a quick fix.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edit

type Edit struct {
	Span    source.Span
	NewText string
	// OwnLine makes the edit a whole line inserted before Span.Offset, indented
	// like the line that offset sits on (see Render).
	OwnLine bool
}

Edit replaces the text a span covers. A zero-length span is an insertion at its offset.

func Insert

func Insert(offset int, text string) Edit

Insert returns an insertion of text at offset.

func InsertLine

func InsertLine(offset int, text string) Edit

InsertLine returns an insertion of text as its own line before offset.

func Replace

func Replace(span source.Span, text string) Edit

Replace returns a replacement of the text span covers with text.

func (Edit) Render

func (e Edit) Render(content []byte) (source.Span, string)

Render resolves an edit against its document, returning the span to replace and the replacement. An own-line edit keeps the line it precedes on its own line.

type Fix

type Fix struct {
	Title     string
	Edits     []Edit
	Preferred bool
}

Fix is one unambiguous way to resolve a diagnostic, within the document that diagnostic belongs to. Preferred marks a fix an editor may apply unprompted.

Jump to

Keyboard shortcuts

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