Help us shape the future of Go! Take the 2026 Go Developer Survey

completion

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendSubsectionTarget

func AppendSubsectionTarget(doc Document, node SectionNode, inserted string) (PatchTarget, Status)

func StableInsertionTarget

func StableInsertionTarget(doc Document, tmpl *Template, target TemplateSection, inserted string) (PatchTarget, Status)

Types

type BuildInput

type BuildInput struct {
	OriginalSpec    string
	Candidates      []Candidate
	ExistingPatches []schema.Patch
	Issues          []schema.Issue
	Config          Config
	Template        string
}

type Candidate

type Candidate struct {
	SourceIssueID     string // exactly one current issue that sources this candidate
	SourceQuestionIDs []string
	Template          string
	Section           string
	// TargetLine is the 1-based target line in the current spec. Zero means unknown.
	TargetLine   int
	Status       Status
	Text         string
	Before       string
	After        string
	Severity     schema.Severity
	SectionOrder int
}

func GenerateCandidates

func GenerateCandidates(input Input) []Candidate

type Config

type Config struct {
	Suggestions   bool
	Mode          Mode
	Template      string
	MaxPatches    int
	OpenDecisions bool
}

type Document

type Document struct {
	Raw          string
	Lines        []string
	Sections     []SectionNode
	PrimaryLevel int
}

func AnalyzeSections

func AnalyzeSections(raw string) Document

type Input

type Input struct {
	SpecText  string
	Profile   string
	Template  *Template
	Issues    []schema.Issue
	Questions []schema.Question
	Config    Config
}

type Mode

type Mode string

type PatchTarget

type PatchTarget struct {
	Before string
	After  string
	Line   int
}

type Placeholder

type Placeholder struct {
	Text              string
	RequiresDecision  bool
	RelevanceKeywords []string
}

type Result

type Result struct {
	Candidates []Candidate
	Patches    []schema.Patch
	Meta       schema.CompletionMeta
}

func BuildResult

func BuildResult(input BuildInput) (Result, []schema.Issue, error)

type SectionNode

type SectionNode struct {
	Heading   string
	Level     int
	StartLine int
	EndLine   int
	BodyStart int
	Parent    int
}

func IncompleteSections

func IncompleteSections(doc Document, tmpl *Template) []SectionNode

type Status

type Status string
const (
	StatusPatchGenerated               Status = "patch_generated"
	StatusSkippedNoSafeLocation        Status = "skipped_no_safe_location"
	StatusSkippedOverlap               Status = "skipped_overlap"
	StatusSkippedRedaction             Status = "skipped_redaction"
	StatusSkippedLimit                 Status = "skipped_limit"
	StatusSkippedOpenDecisionsDisabled Status = "skipped_open_decisions_disabled"
)

type Template

type Template struct {
	Name     string
	Sections []TemplateSection
}

func GetTemplate

func GetTemplate(name string, selectedProfile string) (*Template, error)

GetTemplate returns a built-in completion template. The special name "profile" resolves to selectedProfile.

type TemplateSection

type TemplateSection struct {
	Heading          string
	Subheadings      []string
	Placeholders     []Placeholder
	Categories       []schema.Category
	PreflightRuleIDs []string
	Order            int
}

func MissingSections

func MissingSections(doc Document, tmpl *Template) []TemplateSection

Jump to

Keyboard shortcuts

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