providers

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 14 Imported by: 1 module, 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

Index

Constants

View Source
const (
	// DiffProviderID is the unique identifier for the diff provider.
	DiffProviderID = "vcs-diff"
)
View Source
const (
	// LineNumberProviderID is the unique identifier for the line number provider.
	LineNumberProviderID = "linenumber"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DiffHunk

type DiffHunk struct {
	// The diff is staged or not
	Staged bool
	// Type is the type of change (added, modified, deleted).
	Type DiffType

	// StartLine is the 0-based line index where this hunk starts in the current document.
	StartLine int

	// EndLine is the 0-based line index where this hunk ends (inclusive).
	// For deleted hunks, StartLine == EndLine and represents where the deletion occurred.
	EndLine int

	// OldLines contains the original content (for modified and deleted hunks).
	OldLines []string

	// NewLines contains the new content (for added and modified hunks).
	NewLines []string
}

DiffHunk represents a single change in the diff.

func (*DiffHunk) LineCount

func (h *DiffHunk) LineCount() int

LineCount returns the number of lines affected by this hunk in the current document.

type DiffType

type DiffType int

DiffType represents the type of change in a diff hunk.

const (
	// DiffAdded indicates lines that were added.
	DiffAdded DiffType = iota
	// DiffModified indicates lines that were modified.
	DiffModified
	// DiffDeleted indicates lines that were deleted.
	DiffDeleted
)

type LineNumberProvider

type LineNumberProvider struct {
	// contains filtered or unexported fields
}

LineNumberProvider renders line numbers in the gutter.

func NewLineNumberProvider

func NewLineNumberProvider() *LineNumberProvider

NewLineNumberProvider creates a new line number provider with default settings.

func NewLineNumberProviderWithMinDigits

func NewLineNumberProviderWithMinDigits(minDigits int) *LineNumberProvider

NewLineNumberProviderWithMinDigits creates a new line number provider with a custom minimum digit count.

func (*LineNumberProvider) HighlightedLines

func (p *LineNumberProvider) HighlightedLines() []gutter.LineHighlight

HighlightedLines returns the current line to be highlighted. This implements the gutter.LineHighlighter interface.

func (*LineNumberProvider) ID

func (p *LineNumberProvider) ID() string

ID returns the unique identifier for this provider.

func (*LineNumberProvider) Layout

Layout renders the line numbers for visible paragraphs.

func (*LineNumberProvider) Priority

func (p *LineNumberProvider) Priority() int

Priority returns the rendering priority. Line numbers have a high priority (100) meaning they are rendered closest to the text (rightmost in the gutter).

func (*LineNumberProvider) Width

func (p *LineNumberProvider) Width(gtx layout.Context, shaper *text.Shaper, params text.Parameters, lineCount int) unit.Dp

Width calculates the width needed to display line numbers.

type VCSDiffProvider

type VCSDiffProvider struct {
	// contains filtered or unexported fields
}

VCSDiffProvider renders vcs (like git) diff indicators in the gutter. It shows colored bars for added/modified lines and triangles for deleted lines.

func NewVCSDiffProvider

func NewVCSDiffProvider() *VCSDiffProvider

NewGitDiffProvider creates a new git diff provider with default colors.

func (*VCSDiffProvider) ClearDiff

func (p *VCSDiffProvider) ClearDiff()

ClearDiff removes all diff data.

func (*VCSDiffProvider) GetAllHunks

func (p *VCSDiffProvider) GetAllHunks() []*DiffHunk

GetAllHunks returns all diff hunks.

func (*VCSDiffProvider) GetHunk

func (p *VCSDiffProvider) GetHunk(line int) *DiffHunk

GetHunk returns the diff hunk for the given line, or nil if none exists.

func (*VCSDiffProvider) HandleClick

func (p *VCSDiffProvider) HandleClick(line int, source pointer.Source, numClicks int, modifiers key.Modifiers) bool

HandleClick handles click events on the gutter. Implements InteractiveGutter interface.

func (*VCSDiffProvider) HandleHover

func (p *VCSDiffProvider) HandleHover(line int) *gutter.HoverInfo

HandleHover handles hover events on the gutter. Implements InteractiveGutter interface.

func (*VCSDiffProvider) HighlightedLines

func (p *VCSDiffProvider) HighlightedLines() []gutter.LineHighlight

HighlightedLines returns line highlights for changed lines. Implements LineHighlighter interface.

func (*VCSDiffProvider) ID

func (p *VCSDiffProvider) ID() string

ID returns the unique identifier for this provider.

func (*VCSDiffProvider) Layout

Layout renders the git diff indicators for visible paragraphs.

func (*VCSDiffProvider) Priority

func (p *VCSDiffProvider) Priority() int

Priority returns the rendering priority. Git diff indicators are rendered leftmost (highest priority value).

func (*VCSDiffProvider) SetColors

func (p *VCSDiffProvider) SetColors(added, modified, deleted gvcolor.Color)

SetColors sets custom colors for the diff indicators.

func (*VCSDiffProvider) SetHighlightLines

func (p *VCSDiffProvider) SetHighlightLines(enabled bool, alpha uint8)

SetHighlightLines enables or disables full-width line highlighting.

func (*VCSDiffProvider) SetIndicatorWidth

func (p *VCSDiffProvider) SetIndicatorWidth(width unit.Dp)

SetIndicatorWidth sets the width of the indicator bar.

func (*VCSDiffProvider) UpdateDiff

func (p *VCSDiffProvider) UpdateDiff(hunks []*DiffHunk)

UpdateDiff updates the diff state with new hunks. This clears any existing diff data.

func (*VCSDiffProvider) Width

func (p *VCSDiffProvider) Width(gtx layout.Context, shaper *text.Shaper, params text.Parameters, lineCount int) unit.Dp

Width returns the width needed for the indicator.

Jump to

Keyboard shortcuts

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