mappings

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionMappingConfig

type ActionMappingConfig struct {
	ID          string                `yaml:"id"`
	Description string                `yaml:"description"`
	Name        string                `yaml:"name"`
	Category    string                `yaml:"category"`
	VSCode      VscodeConfigs         `yaml:"vscode"`
	Zed         ZedConfigs            `yaml:"zed"`
	IntelliJ    IntelliJMappingConfig `yaml:"intellij"`
	Vim         VimMappingConfig      `yaml:"vim"`
	Helix       HelixConfig           `yaml:"helix"`
}

ActionMappingConfig holds the complete mapping information for a single action ID.

func (*ActionMappingConfig) IsSupported added in v0.2.0

func (am *ActionMappingConfig) IsSupported(editorType pluginapi.EditorType) bool

type DuplicateActionMappingError

type DuplicateActionMappingError struct {
	Editor string
	// editor action name -> all involved universal action ids
	Duplicates map[string][]string
}

func (*DuplicateActionMappingError) Error

type EditorActionMapping

type EditorActionMapping struct {
	// when true, this config is used for import, otherwise it is only used for export
	ForImport bool `yaml:"forImport,omitempty"`

	// explicitly set to true if this config is not supported by the editor
	NotSupported bool `yaml:"notSupported,omitempty"`
	// reason why this config is not supported by the editor
	NotSupportedReason string `yaml:"notSupportedReason,omitempty"`
}

EditorActionMapping provides extra flags for editor-specific configurations.

type HelixConfig

type HelixConfig []HelixMappingConfig

func (*HelixConfig) UnmarshalYAML

func (h *HelixConfig) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface for HelixConfigs. It supports both a single mapping object and a sequence of objects.

type HelixMappingConfig

type HelixMappingConfig struct {
	EditorActionMapping `yaml:",inline"`

	Command string `yaml:"command"`
	Mode    string `yaml:"mode"`
}

type IntelliJMappingConfig

type IntelliJMappingConfig struct {
	EditorActionMapping `yaml:",inline"`

	Action string `yaml:"action"`
}

type MappingConfig

type MappingConfig struct {
	// Mappings is a map where the key is the one_keymap_id (e.g., "actions.editor.copy")
	// and the value is the detailed mapping information for that action.
	Mappings map[string]ActionMappingConfig
}

MappingConfig holds the final, merged mapping config, indexed by action ID. It serves as a `Anemic Domain Model` because I want the editor specific config query to be implemented in plugin.

func NewMappingConfig

func NewMappingConfig() (*MappingConfig, error)

func NewTestMappingConfig

func NewTestMappingConfig() (*MappingConfig, error)

func (*MappingConfig) FindByUniversalAction

func (mc *MappingConfig) FindByUniversalAction(action string) *ActionMappingConfig

FindByUniversalAction searches for a mapping by universal action ID.

func (*MappingConfig) IsActionMapped

func (mc *MappingConfig) IsActionMapped(action string) bool

IsActionMapped checks if a universal action ID is defined in the mapping configuration.

type VimMappingConfig

type VimMappingConfig struct {
	EditorActionMapping `yaml:",inline"`

	Command string `yaml:"command"`
	Mode    string `yaml:"mode"`
}

type VscodeConfigs

type VscodeConfigs []VscodeMappingConfig

VscodeConfigs is a slice of VscodeMappingConfig that can be unmarshalled from either a single YAML object or a sequence of objects.

func (*VscodeConfigs) HasExplicitForImport added in v0.2.0

func (v *VscodeConfigs) HasExplicitForImport() bool

func (*VscodeConfigs) UnmarshalYAML

func (v *VscodeConfigs) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type VscodeMappingConfig

type VscodeMappingConfig struct {
	EditorActionMapping `yaml:",inline"`

	Command string                 `yaml:"command"`
	When    string                 `yaml:"when"`
	Args    map[string]interface{} `yaml:"args,omitempty"`
}

VscodeMappingConfig defines the structure for VSCode's mapping, including the command and its context.

type ZedConfigs

type ZedConfigs []ZedMappingConfig

func (*ZedConfigs) UnmarshalYAML

func (z *ZedConfigs) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface for ZedConfigs. It supports both a single mapping object and a sequence of objects.

type ZedMappingConfig

type ZedMappingConfig struct {
	EditorActionMapping `yaml:",inline"`

	Action  string                 `yaml:"action"`
	Context string                 `yaml:"context"`
	Args    map[string]interface{} `yaml:"args,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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