Guidelines for adding, removing, or updating configuration options in cursortab.nvim. Use when modifying config fields, enum values, or validation logic.
Lua owns all default values. The Go daemon receives the complete config via the CURSORTAB_CONFIG environment variable with all defaults already applied. Go structs should not have default values or use pointer types for optional fields - all fields are required and must be provided by Lua.
Lua-only vs Go fields: Some config sections are handled entirely in Lua and never sent to Go: enabled, keymaps, ui, blink. Conversely, Go's Config struct has auto-populated fields (ns_id, editor_version, editor_os) that Lua sets internally — these are not user-configurable and should not be added to default_config.
When modifying config options, update these locations:
lua/cursortab/config.lua
---@class block (e.g., ---@field new_option type)default_config table (required - Go expects all values)valid_* table and update error in validate_config)validate_config_keys() — no update needed there unless changing the validation logic itselfconfig.setup_highlights() in config.luaserver/main.go (only for fields consumed by the daemon — skip for Lua-only fields)
Config, ProviderConfig, BehaviorConfig, etc.)Config.Validate() method — enum checks use the validateEnum() helper with []string slices, numeric ranges use direct comparisonsserver/logger/logger.go (for log levels only)
LogLevel constants (LogLevelTrace, LogLevelDebug, etc.)String() method switch caseParseLogLevel() function switch caseREADME.md
doc/cursortab.txt
For enum-like options (e.g., log_level, provider.type):
valid_* table in config.lua (e.g., valid_log_levels, valid_provider_types)validate_config() with new valid valuesvalidateEnum() call in Config.Validate() in main.goFor simple options:
---@field type annotation in the appropriate ---@class block in config.luadefault_config table in config.luaConfig or nested struct) — skip for Lua-only fieldsConfig.Validate() if needed (numeric ranges, path validation, etc.)ui.jump.*, update config.setup_highlights() in config.luaFor removing or renaming options:
deprecated_mappings table in config.lua (maps old flat key to new nested path, or nil if removed entirely)nested_field_renames table in config.luadefault_config, ---@class blocks, and Go structsWhen adding "trace" to log_level:
-- config.lua
local valid_log_levels = { trace = true, debug = true, info = true, warn = true, error = true }
-- In validate_config():
-- error: "Must be one of: trace, debug, info, warn, error"
// main.go - inside Config.Validate(), using validateEnum helper
if err := validateEnum(c.LogLevel, "log_level", []string{"trace", "debug", "info", "warn", "error"}); err != nil {
return err
}
// logger/logger.go - add constant, update String() and ParseLogLevel()
const LogLevelTrace LogLevel = iota
<!-- README.md and doc/cursortab.txt -->
log_level = "info", -- "trace", "debug", "info", "warn", "error"