session

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: AGPL-3.0 Imports: 6 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 session stores the workspace layout restored at the next launch.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(dir string) bool

Exists reports whether dir has a session file.

func Save

func Save(dir string, s State) error

Save writes s atomically to dir/session.json.

Types

type PaneState

type PaneState struct {
	Tabs   []TabState `json:"tabs"`
	Active int        `json:"active"`
}

PaneState is the tabs of one pane and the one chosen.

type State

type State struct {
	Root          string    `json:"root"`
	Split         bool      `json:"split"`
	SplitVertical bool      `json:"splitVertical"`
	SplitWidth    float32   `json:"splitWidth"`
	SplitHeight   float32   `json:"splitHeight"`
	ActivePane    int       `json:"activePane"`
	Left          PaneState `json:"left"`
	Right         PaneState `json:"right"`
	SidebarOpen   bool      `json:"sidebarOpen"`
	SidebarWidth  float32   `json:"sidebarWidth"`
}

State is the workspace of the last launch.

func Default

func Default() State

Default is the layout of a first launch.

func Load

func Load(dir string) (State, error)

Load reads dir/session.json. A missing or corrupt file returns the defaults; a corrupt one is kept as session.json.bak.

type TabState

type TabState struct {
	Path    string  `json:"path"`
	ScrollY float32 `json:"scrollY"`
	// Draft names the recovery copy of the document's unsaved text, when
	// keeping unsaved content is on; Untitled is its number for a document
	// without a file.
	Draft    string `json:"draft,omitempty"`
	Untitled int    `json:"untitled,omitempty"`
	// Language is the language an untitled document was given in the status
	// bar, by name; "" for none. A tab with a path takes its language from
	// the file name.
	Language string `json:"language,omitempty"`
}

TabState is one tab of a pane: the file it shows and where it was scrolled.

Jump to

Keyboard shortcuts

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