Documentation
¶
Overview ¶
Package settings reads and writes the workbench settings file.
Index ¶
- Constants
- func Load(path string) (Settings, []Warning, error)
- func RemoveAIAgent(path, id string) error
- func Save(path string, settings Settings) error
- func SaveAIAgent(path, id string, agent AIAgent) error
- func SaveAIDefaultAgent(path, id string) error
- func StepFontSize(size float32, steps int) float32
- func ValidFormatterName(name string) error
- type AIAgent
- type Formatter
- type KeyInfo
- type LSPServer
- type Settings
- type Theme
- type Warning
Constants ¶
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.
const ( RailIconSizeSmall = "small" RailIconSizeMedium = "medium" RailIconSizeLarge = "large" )
Left activity rail icon size presets.
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 )
const ( MinFontSize = 8 MaxFontSize = 40 )
MinFontSize and MaxFontSize bound editor.fontSize and terminal.fontSize.
Variables ¶
This section is empty.
Functions ¶
func RemoveAIAgent ¶ added in v0.1.0
RemoveAIAgent removes a custom agent or a preset's overrides from ai.agents.
func SaveAIAgent ¶ added in v0.1.0
SaveAIAgent saves a custom agent or a preset's overrides in ai.agents.
func SaveAIDefaultAgent ¶ added in v0.1.0
SaveAIDefaultAgent saves the preferred AI agent ID. An empty ID selects automatically.
func StepFontSize ¶ added in v0.1.0
StepFontSize is size moved by steps points, kept within MinFontSize and MaxFontSize.
func ValidFormatterName ¶ added in v0.2.0
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.
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) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON decodes an object with exact field names and no null values.
type KeyInfo ¶
KeyInfo describes a setting's dotted key, JSON default and supported enum values. Callers must synchronize shared access to Enum.
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
Clone returns a copy sharing no slices, maps or raw messages.
func (LSPServer) MarshalJSON ¶ added in v0.1.0
func (*LSPServer) UnmarshalJSON ¶ added in v0.1.0
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
Clone returns an independent copy of the snapshot and its mutable fields.
func (Settings) UpdateInterval ¶
UpdateInterval returns the configured update check interval, or six hours if unsupported.