quickfix

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

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