Documentation
¶
Overview ¶
Package editor provides IDE integration for worktree environments. It generates per-worktree settings for VS Code/Cursor and JetBrains, including window titles, color theming, and workspace file detection.
Index ¶
- func ColorForBranch(branch string) string
- func DarkenHex(hex string) string
- func DetectEditor() string
- func DetectJetBrains(worktreePath string) bool
- func ForegroundForHex(hex string) string
- func WriteJetBrains(worktreePath, color string) (string, error)
- func WriteVSCode(worktreePath string, s VSCodeSettings) (string, error)
- type EditorInfo
- type VSCodeSettings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorForBranch ¶
ColorForBranch returns a deterministic hex color for the given branch name. The same branch always maps to the same color across sessions.
func DetectEditor ¶
func DetectEditor() string
DetectEditor tries to identify which editor is running this terminal. Returns the canonical name or empty string if detection fails.
func DetectJetBrains ¶
DetectJetBrains returns true if the worktree has a .idea directory.
func ForegroundForHex ¶
ForegroundForHex returns white or dark text depending on background luminance.
func WriteJetBrains ¶
WriteJetBrains sets the project header color in .idea/workspace.xml. JetBrains IDEs (2023.2+) support a colored header bar per project.
func WriteVSCode ¶
func WriteVSCode(worktreePath string, s VSCodeSettings) (string, error)
WriteVSCode writes editor settings to the appropriate location. If a .code-workspace file references the worktree, settings go there. Otherwise, settings go to .vscode/settings.json in the worktree.
Types ¶
type EditorInfo ¶
type EditorInfo struct {
Name string // canonical key: "cursor", "vscode", "zed", "goland", etc.
Display string // human label: "Cursor", "VS Code", "Zed", "GoLand"
CLI string // command to open a path: "cursor", "code", "zed", "goland"
}
EditorInfo describes a detected or configured editor.
func LookupEditor ¶
func LookupEditor(name string) *EditorInfo
LookupEditor returns info for a known editor name, or nil if unknown.
type VSCodeSettings ¶
type VSCodeSettings struct {
Title string // window.title value
Color string // hex color for title/activity/status bars (empty = no color)
Theme string // workbench.colorTheme override (empty = no override)
}
VSCodeSettings holds the settings to write for a VS Code/Cursor workspace.