exporterapi

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiffType

type DiffType int

DiffType represents the type of diff output format.

const (
	// DiffTypeUnspecified represents an unspecified diff type.
	DiffTypeUnspecified DiffType = iota
	// DiffTypeASCII represents ASCII diff format.
	DiffTypeASCII
	// DiffTypeUnified represents unified diff format.
	DiffTypeUnified
)

func (DiffType) String

func (d DiffType) String() string

String returns the string representation of the DiffType.

type ExportCoverage added in v0.8.0

type ExportCoverage struct {
	// TotalActions is the number of actions requested for export.
	TotalActions int
	// FullyExported is the number of actions where all keybindings were exported.
	FullyExported int
	// PartiallyExported lists actions where some keybindings could not be exported.
	PartiallyExported []PartialExportedAction
}

ExportCoverage summarizes export success rate.

type ExportOptions

type ExportOptions struct {
	// Editor type
	EditorType pluginapi.EditorType
	// Optional, existing original keymap for specific editor before export
	OriginalConfig io.Reader
	// Use diff type to generate ascii diff text or unified diff text
	DiffType DiffType
	// file path for the keymap config
	FilePath string
}

ExportOptions provides configuration for an export operation.

type ExportReport

type ExportReport struct {
	// The diff text between the original keymap and keymap after export.
	Diff string

	// Coverage reports how many actions were successfully exported.
	Coverage ExportCoverage

	// SkipActions reports actions that were not exported and why.
	SkipActions []pluginapi.ExportSkipAction
}

ExportReport details issues encountered during an export operation.

type Exporter

type Exporter interface {
	// Export converts a KeymapSetting and writes it to a destination stream.
	// It returns a report detailing any issues encountered during the conversion.
	Export(
		ctx context.Context,
		destination io.Writer,
		setting keymap.Keymap,
		opts ExportOptions,
	) (*ExportReport, error)
}

Exporter defines the contract for converting a universal KeymapSetting into an editor-specific format.

type PartialExportedAction added in v0.8.0

type PartialExportedAction struct {
	// Action name, e.g. "actions.clipboard.copy"
	Action string
	// Requested keybindings that were requested to be exported
	Requested []keybinding.Keybinding
	// Exported keybindings that were actually exported
	Exported []keybinding.Keybinding
	// Reason explains why some keybindings were not exported
	Reason string
}

PartialExportedAction describes an action that was only partially exported.

Jump to

Keyboard shortcuts

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