config

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidOption = errors.New("invalid option")
)

Functions

func FormatIntSlice

func FormatIntSlice(values []int) string

FormatIntSlice renders integers as a bracketed list

func FormatStringSlice

func FormatStringSlice(values []string) string

FormatStringSlice renders strings as a bracketed list

func LoadRawConfig

func LoadRawConfig(path string) (map[string]any, bool)

LoadRawConfig returns the raw merged TOML map for the given config file path

func LoadRawConfigForDir

func LoadRawConfigForDir(dir string) (map[string]any, bool)

LoadRawConfigForDir returns user config merged with dir's trusted workspace config

func LoadRawConfigForWorkspace

func LoadRawConfigForWorkspace(
	args loader.WorkspaceFiles,
) (map[string]any, bool)

LoadRawConfigForWorkspace merges the user and workspace config TOML

func ParseBool

func ParseBool(value string) (bool, error)

ParseBool parses an option's boolean value

func ParseIntSlice

func ParseIntSlice(value string) ([]int, error)

ParseIntSlice parses a bracketed list of integers

func ParseNonNegInt

func ParseNonNegInt(value string) (int, error)

ParseNonNegInt parses an option value that may be zero

func ParsePositiveInt

func ParsePositiveInt(value string) (int, error)

ParsePositiveInt parses an option value that must exceed zero

func ParseStringLiteral

func ParseStringLiteral(value string) (string, error)

ParseStringLiteral parses an optionally quoted string value

func ParseStringSlice

func ParseStringSlice(value string) ([]string, error)

ParseStringSlice parses a bracketed list of strings

Types

type AutoSave

type AutoSave struct {
	FocusLost  *bool              `toml:"focus-lost"`
	AfterDelay AutoSaveAfterDelay `toml:"after-delay"`
}

func (*AutoSave) UnmarshalTOML

func (a *AutoSave) UnmarshalTOML(value any) error

UnmarshalTOML accepts either a bool or a table of auto-save triggers

type AutoSaveAfterDelay

type AutoSaveAfterDelay struct {
	Enable  *bool `toml:"enable"`
	Timeout *int  `toml:"timeout"`
}

type EditorConfig

type EditorConfig struct {
	IndentStyle            *core.IndentStyle
	TabWidth               *int
	LineEnding             *core.LineEnding
	TrimTrailingWhitespace *bool
	InsertFinalNewline     *bool
	MaxLineLength          *int
}

func FindEditorConfig

func FindEditorConfig(file string) *EditorConfig

FindEditorConfig resolves the .editorconfig settings applying to file

type Search struct {
	SmartCase  *bool `toml:"smart-case"`
	WrapAround *bool `toml:"wrap-around"`
}

Jump to

Keyboard shortcuts

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