settings

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0 modules, 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

Overview

Package settings reads and writes the workbench settings file.

Index

Constants

View Source
const (
	AIAgentClaudeCode  = "claude-code"
	AIAgentCodex       = "codex"
	AIAgentAntigravity = "antigravity"
	AIAgentOpenCode    = "opencode"
	AIAgentGemini      = "gemini"
	AIAgentQwenCode    = "qwen-code"
	AIAgentCopilot     = "copilot"
	AIAgentKimi        = "kimi"
)

Built-in AI agent IDs. These entries may omit a command in settings.

View Source
const (
	RailIconSizeSmall  = "small"
	RailIconSizeMedium = "medium"
	RailIconSizeLarge  = "large"
)

Left activity rail icon size presets.

View Source
const (
	// MinGitAutoFetchPeriod is the shortest auto-fetch period in seconds.
	MinGitAutoFetchPeriod = 60
	// MaxGitAutoFetchPeriod is the largest period in seconds that fits both an int and a time.Duration.
	MaxGitAutoFetchPeriod = int(min(math.MaxInt, math.MaxInt64/int64(time.Second)))
	// MinGitRepositoryScanMaxDepth represents unlimited directory depth.
	MinGitRepositoryScanMaxDepth = -1
	// MaxGitRepositoryScanMaxDepth is the largest bounded directory depth.
	MaxGitRepositoryScanMaxDepth = 8
)
View Source
const (
	MinFontSize = 8
	MaxFontSize = 40
)

MinFontSize and MaxFontSize bound editor.fontSize and terminal.fontSize.

Variables

This section is empty.

Functions

func Load

func Load(path string) (Settings, []Warning, error)

Load reads settings from path, applying defaults for missing or invalid values.

func RemoveAIAgent added in v0.1.0

func RemoveAIAgent(path, id string) error

RemoveAIAgent removes a custom agent or a preset's overrides from ai.agents.

func Save

func Save(path string, settings Settings) error

Save validates settings and atomically persists values that differ from the defaults.

func SaveAIAgent added in v0.1.0

func SaveAIAgent(path, id string, agent AIAgent) error

SaveAIAgent saves a custom agent or a preset's overrides in ai.agents.

func SaveAIDefaultAgent added in v0.1.0

func SaveAIDefaultAgent(path, id string) error

SaveAIDefaultAgent saves the preferred AI agent ID. An empty ID selects automatically.

func StepFontSize added in v0.1.0

func StepFontSize(size float32, steps int) float32

StepFontSize is size moved by steps points, kept within MinFontSize and MaxFontSize.

func ValidFormatterName added in v0.2.0

func ValidFormatterName(name string) error

ValidFormatterName checks the identifier of an external formatter.

Types

type AIAgent added in v0.1.0

type AIAgent struct {
	Name     string            `json:"name,omitempty"`
	Command  []string          `json:"command,omitempty"`
	Env      map[string]string `json:"env,omitempty"`
	Disabled bool              `json:"disabled,omitempty"`
	// Options holds the agent's ACP session config choices (option ID to
	// value), applied to its new chats.
	Options map[string]string `json:"options,omitempty"`
}

AIAgent configures a custom agent or a built-in agent's overrides. Callers must synchronize shared access to its mutable fields.

func (AIAgent) Clone added in v0.1.0

func (a AIAgent) Clone() AIAgent

Clone returns a copy sharing no slices or maps.

func (AIAgent) Validate added in v0.1.0

func (a AIAgent) Validate(id string) (field string, err error)

Validate returns the field name and error for the first invalid value.

type Formatter added in v0.2.0

type Formatter struct {
	Command   []string          `json:"command"`
	Languages []string          `json:"languages,omitempty"`
	FileTypes []string          `json:"fileTypes,omitempty"`
	Env       map[string]string `json:"env,omitempty"`
	Input     string            `json:"input,omitempty"` // Empty uses stdin.
	Disabled  bool              `json:"disabled,omitempty"`
}

Formatter configures one entry of format.formatters. Callers must synchronize shared access to its mutable fields.

func (Formatter) Clone added in v0.2.0

func (f Formatter) Clone() Formatter

Clone returns a copy sharing no slices or maps.

func (*Formatter) UnmarshalJSON added in v0.2.0

func (f *Formatter) UnmarshalJSON(raw []byte) error

UnmarshalJSON decodes an object with exact field names and no null values.

func (Formatter) Validate added in v0.2.0

func (f Formatter) Validate() (field string, err error)

Validate returns the JSON field name and error for the first invalid value.

type KeyInfo

type KeyInfo struct {
	Key     string
	Default string
	Enum    []string
}

KeyInfo describes a setting's dotted key, JSON default and supported enum values. Callers must synchronize shared access to Enum.

func Keys

func Keys() []KeyInfo

Keys returns metadata for the settings page in a stable order.

type LSPServer added in v0.1.0

type LSPServer struct {
	Command               []string          `json:"command,omitempty"`
	Languages             []string          `json:"languages,omitempty"`
	FileTypes             []string          `json:"fileTypes,omitempty"`
	RootMarkers           []string          `json:"rootMarkers,omitempty"`
	InitializationOptions json.RawMessage   `json:"initializationOptions,omitempty"`
	Settings              json.RawMessage   `json:"settings,omitempty"`
	Env                   map[string]string `json:"env,omitempty"`
	Disabled              bool              `json:"disabled,omitempty"`
}

LSPServer configures one entry of lsp.servers. In JSON it is either an array (the command only, the legacy form) or an object. Callers must synchronize shared access to its mutable fields.

func (LSPServer) Clone added in v0.1.0

func (s LSPServer) Clone() LSPServer

Clone returns a copy sharing no slices, maps or raw messages.

func (LSPServer) MarshalJSON added in v0.1.0

func (s LSPServer) MarshalJSON() ([]byte, error)

func (*LSPServer) UnmarshalJSON added in v0.1.0

func (s *LSPServer) UnmarshalJSON(raw []byte) error

func (LSPServer) Validate added in v0.1.0

func (s LSPServer) Validate() (field string, err error)

Validate checks the entry's field values and returns the JSON field name and error for the first invalid value, or an empty name and nil on success.

type Settings

type Settings struct {
	Locale                 string
	Theme                  Theme
	ColorTheme             string
	ColorCustomizations    map[string]string
	WorkbenchTabsWrap      bool
	WorkbenchRailIconSize  string
	WorkbenchKeymap        string
	EditorFontSize         float32
	EditorFontFamily       string
	EditorTabSize          int
	EditorInsertSpaces     bool
	EditorDetectIndent     bool
	EditorWordWrap         bool
	EditorLineNumbers      bool
	EditorSelectionMode    string
	EditorWordWrapColumn   int // Zero follows the viewport width.
	EditorRenderWhitespace string
	EditorCursorShape      string
	EditorIndentGuides     bool
	EditorScrollPastEnd    bool
	EditorMinimap          bool
	EditorDiffOverview     bool
	EditorMouseWheelZoom   bool
	EditorFormatOnSave     bool
	FormatFormatters       map[string]Formatter
	FormatDefault          map[string]string
	FilesEncoding          string
	FilesEOL               string
	FilesTrimTrailing      bool
	FilesFinalNewline      bool
	FilesAutoSave          string
	FilesAutoSaveDelay     int
	FilesExclude           []string
	SearchExclude          []string
	SearchUseIgnore        bool
	GitPath                string
	GitAutoFetch           bool
	GitAutoFetchPeriod     int // Seconds.
	GitUpdateMethod        string
	GitAutoStash           bool
	GitConfirmForcePush    bool
	GitSignoff             bool
	GitCommitSign          bool
	GitBlameInline         bool
	GitHostingKind         map[string]string
	TerminalShell          string
	TerminalFontSize       float32
	TerminalEnv            map[string]string
	LSPServers             map[string]LSPServer
	LSPEnabled             bool
	AIEnabled              bool
	AIDefaultAgent         string
	AIAgents               map[string]AIAgent
	UpdateAutoCheck        bool
	UpdateCheckInterval    string

	GitRepositoryScanMaxDepth int
	GitDetectSubmodules       bool
	GitIgnoredRepositories    []string
	GitSyncBranchOperations   bool
	GitSubmoduleUpdate        string

	AIPanelSide string
}

Settings is a mutable snapshot for use by one goroutine unless callers synchronize shared access.

func Defaults

func Defaults() Settings

Defaults returns a fresh snapshot with the application's default settings.

func (Settings) Clone added in v0.1.0

func (s Settings) Clone() Settings

Clone returns an independent copy of the snapshot and its mutable fields.

func (Settings) UpdateInterval

func (s Settings) UpdateInterval() time.Duration

UpdateInterval returns the configured update check interval, or six hours if unsupported.

type Theme

type Theme string

Theme selects the workbench color scheme.

const (
	// ThemeSystem follows the system color scheme.
	ThemeSystem Theme = "system"
	// ThemeLight selects the light color scheme.
	ThemeLight Theme = "light"
	// ThemeDark selects the dark color scheme.
	ThemeDark Theme = "dark"
)

type Warning

type Warning struct {
	Key  string
	Line int
	Msg  string
}

Warning describes an ignored setting or a syntax error. Line is one-based, or zero if the source location is unavailable.

Jump to

Keyboard shortcuts

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