Documentation
¶
Overview ¶
Package session persists per-project editor state — open tabs (with cursor and scroll), the active tab, expanded tree folders, and the sidebar — so reopening a project puts the user back where they left off. This is state, not configuration: skiff stays dotfile-free, but remembering where you were is table stakes.
Storage is one file per project, $XDG_STATE_HOME/skiff/sessions/ <hash>.json (falling back to ~/.local/state/skiff/), where <hash> is derived from the project's absolute root path. One file per project is deliberate: a single shared store meant a corrupt or half-written file took every *other* project's state down with it on the next save, and the read-modify-write it forced lost updates between concurrent skiff instances. Now a save touches exactly one project's file and nothing else can be collateral damage.
Every failure mode degrades to "no session" — a corrupt file must never block startup, and must never be deleted behind the user's back. The directory is pruned to the most recent maxProjects files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Project ¶
type Project struct {
Tabs []TabState `json:"tabs,omitempty"`
Active int `json:"active"`
ActivePath string `json:"activePath,omitempty"`
Expanded []string `json:"expanded,omitempty"`
SidebarWidth int `json:"sidebarWidth"`
SidebarShown bool `json:"sidebarShown"`
SavedAt time.Time `json:"savedAt"`
}
Project is everything remembered about one project root. ActivePath is the authority for which tab gets focus; Active (an index into Tabs) is kept only so files written by older builds still restore something sane, because an index silently points at the wrong tab as soon as one saved file has vanished from disk.