Documentation
¶
Index ¶
- Constants
- Variables
- func CursorKindNames() []string
- func DefaultShell() []string
- func DocumentDisplayName(path string) string
- func DocumentRelativeName(path, basedir string) string
- func RuneWidth(ch rune, col, tabW int) int
- func StatusLineElementNames() []string
- func VisualColumn(doc core.Rope, from, to, tabW int) int
- func WorkspaceSessionFile(dir string) string
- type Align
- type AsyncRenderer
- type BufferLine
- type Clipboard
- type CodeAction
- type CompletionItem
- type CompletionResult
- type CursorKind
- type CursorShape
- type Diagnostic
- type DiagnosticCounts
- type DiagnosticRange
- type DiagnosticSeverity
- type DiffHunk
- type Direction
- type Displaceable
- type Document
- func (d *Document) AccessedAt() int64
- func (d *Document) Apply(tx core.Transaction, vid Id) error
- func (d *Document) BeginInsertGroup(vid Id)
- func (d *Document) ClearAllDocumentHighlights()
- func (d *Document) ClearAllInlayHints()
- func (d *Document) ClearDiagnostics()
- func (d *Document) ClearDocumentColors()
- func (d *Document) ClearDocumentHighlights(vid Id)
- func (d *Document) ClearDocumentLinks()
- func (d *Document) ClearInlayHints(vid Id)
- func (d *Document) CommitInsertHistory(vid Id)
- func (d *Document) ConsumeDirty(vid Id) bool
- func (d *Document) DiagnosticCounts() DiagnosticCounts
- func (d *Document) Diagnostics() []Diagnostic
- func (d *Document) DisplayName() string
- func (d *Document) DocumentColors() []DocumentColor
- func (d *Document) DocumentHighlights(vid Id) []DocumentHighlight
- func (d *Document) DocumentLinks() []DocumentLink
- func (d *Document) ExternalState() ExternalState
- func (d *Document) HasBOM() bool
- func (d *Document) ID() DocumentId
- func (d *Document) IndentStyle() core.IndentStyle
- func (d *Document) InlayHints(vid Id) []InlayHint
- func (d *Document) Lang() string
- func (d *Document) LastEditPos() int
- func (d *Document) LineEnding() core.LineEnding
- func (d *Document) Loaded() bool
- func (d *Document) MarkDirty()
- func (d *Document) Modified() bool
- func (d *Document) Path() string
- func (d *Document) ReadOnly() bool
- func (d *Document) Redo(vid Id) bool
- func (d *Document) RelativeName(basedir string) string
- func (d *Document) Reload() error
- func (d *Document) RemoveView(vid Id)
- func (d *Document) ReplaceDiagnostics(provider string, diags []Diagnostic)
- func (d *Document) RestoreCursor() bool
- func (d *Document) Revision() int
- func (d *Document) Save(opts *Options, force bool) error
- func (d *Document) SearchHighlightsActive(vid Id) bool
- func (d *Document) Selection() core.Selection
- func (d *Document) SelectionFor(vid Id) core.Selection
- func (d *Document) SetDocumentColors(colors []DocumentColor)
- func (d *Document) SetDocumentHighlights(vid Id, highlights []DocumentHighlight)
- func (d *Document) SetDocumentLinks(links []DocumentLink)
- func (d *Document) SetIndentStyle(s core.IndentStyle)
- func (d *Document) SetInlayHints(vid Id, hints []InlayHint)
- func (d *Document) SetLang(lang string)
- func (d *Document) SetLineEnding(le core.LineEnding)
- func (d *Document) SetPath(path string)
- func (d *Document) SetReadOnly(v bool)
- func (d *Document) SetRestoreCursor(v bool)
- func (d *Document) SetSelectionFor(vid Id, sel core.Selection)
- func (d *Document) ShowSearchHighlights(vid Id)
- func (d *Document) TabWidth() int
- func (d *Document) Text() core.Rope
- func (d *Document) TextFormat(w int) *language.TextFormat
- func (d *Document) TextFormatForConfig(w int, opts *Options) *language.TextFormat
- func (d *Document) Undo(vid Id) bool
- type DocumentChange
- type DocumentColor
- type DocumentHighlight
- type DocumentId
- type DocumentLink
- type DocumentObserver
- type DocumentOpenError
- type Editor
- func (e *Editor) ActiveRegister() rune
- func (e *Editor) AddDocumentObserver(o DocumentObserver)
- func (e *Editor) AllDocuments() []*Document
- func (e *Editor) AllViews() []*View
- func (e *Editor) Apply(tx core.Transaction) error
- func (e *Editor) ApplyToDocument(doc *Document, tx core.Transaction) error
- func (e *Editor) Chdir(path string) error
- func (e *Editor) Clipboard() Clipboard
- func (e *Editor) CloseAllOtherViews()
- func (e *Editor) CloseCurrentView()
- func (e *Editor) ClosePane(id Id)
- func (e *Editor) CloseView(vid Id)
- func (e *Editor) CommitInsertHistory()
- func (e *Editor) Count() int
- func (e *Editor) Cwd() string
- func (e *Editor) DeleteDocument(did DocumentId)
- func (e *Editor) DirStack() []string
- func (e *Editor) DiscardPane(p Pane)
- func (e *Editor) DisplacePane(id Id, p Pane)
- func (e *Editor) Document(did DocumentId) *Document
- func (e *Editor) Earlier(kind core.UndoKind) bool
- func (e *Editor) FirstRegister(name rune) (string, bool)
- func (e *Editor) FocusDirection(dir Direction)
- func (e *Editor) FocusNextView()
- func (e *Editor) FocusPane(id Id)
- func (e *Editor) FocusPrevView()
- func (e *Editor) FocusView(vid Id)
- func (e *Editor) FocusedDocument() *Document
- func (e *Editor) FocusedPane() Pane
- func (e *Editor) FocusedView() *View
- func (e *Editor) HSplit(docID DocumentId) *View
- func (e *Editor) HSplitNew() *View
- func (e *Editor) IndentForNewline(doc *Document, line, pos int) (string, bool)
- func (e *Editor) LanguageServerController() LanguageServerController
- func (e *Editor) LastModifiedDocIDs() [2]DocumentId
- func (e *Editor) LastMotion() func(*Editor)
- func (e *Editor) Later(kind core.UndoKind) bool
- func (e *Editor) Mode() Mode
- func (e *Editor) MoveFocusedFile(path string, force bool) error
- func (e *Editor) NewDocument() *View
- func (e *Editor) OpenFile(path string) (*View, error)
- func (e *Editor) Options() *Options
- func (e *Editor) PeekDoc(path string) (*Document, error)
- func (e *Editor) PopDirectory() error
- func (e *Editor) PopPrevDocID() (DocumentId, bool)
- func (e *Editor) ProcessExternalFileChange(path string) bool
- func (e *Editor) PushDirectory(path string) error
- func (e *Editor) ReadRegister(name rune) []string
- func (e *Editor) Redo() bool
- func (e *Editor) RegisterPaneRestorer(kind SessionKind, fn PaneRestorer)
- func (e *Editor) Registers() register.Registers
- func (e *Editor) Reload() error
- func (e *Editor) ReloadAll() []error
- func (e *Editor) ReloadConfig() error
- func (e *Editor) RemovePane(id Id)
- func (e *Editor) ReplacePane(id Id, p Pane) Pane
- func (e *Editor) ResetCount()
- func (e *Editor) ResetRegister()
- func (e *Editor) ResizeFocusedSplit(dir Direction, delta int)
- func (e *Editor) ResizeTree(size geom.Size)
- func (e *Editor) RestoreSession(path string) (map[string]string, bool, error)
- func (e *Editor) RevertPane(id Id) bool
- func (e *Editor) Save(force bool) error
- func (e *Editor) SaveAll(force bool) []error
- func (e *Editor) SaveSession(path string, opts map[string]string) error
- func (e *Editor) SetClipboard(c Clipboard)
- func (e *Editor) SetConfigReload(fn func() error)
- func (e *Editor) SetCount(n int)
- func (e *Editor) SetHint(h string)
- func (e *Editor) SetIndenter(p Indenter)
- func (e *Editor) SetLanguageServerController(c LanguageServerController)
- func (e *Editor) SetLastMotion(fn func(*Editor))
- func (e *Editor) SetMode(m Mode)
- func (e *Editor) SetRegister(r rune)
- func (e *Editor) SetStatusMsg(msg string)
- func (e *Editor) SetVersionControl(vc VersionControl)
- func (e *Editor) SetViewContentWidth(w int)
- func (e *Editor) SetViewHeight(h int)
- func (e *Editor) ShowDocument(did DocumentId) *View
- func (e *Editor) SplitFocused(layout Layout) error
- func (e *Editor) SplitPane(p Pane, layout Layout) bool
- func (e *Editor) SwapSplitInDirection(dir Direction)
- func (e *Editor) SwitchBuffer(did DocumentId) bool
- func (e *Editor) SwitchOrOpenDoc(path string) (*Document, error)
- func (e *Editor) TakeHint() string
- func (e *Editor) TakeStatusMsg() string
- func (e *Editor) TogglePaneMaximized()
- func (e *Editor) Transpose()
- func (e *Editor) Tree() *Tree
- func (e *Editor) Undo() bool
- func (e *Editor) VSplit(docID DocumentId) *View
- func (e *Editor) VSplitNew() *View
- func (e *Editor) VersionControl() VersionControl
- func (e *Editor) View(vid Id) *View
- func (e *Editor) ViewContentWidth() int
- func (e *Editor) ViewHeight() int
- func (e *Editor) Views() []struct{ ... }
- func (e *Editor) VisibleDocuments() []*Document
- func (e *Editor) WriteRegister(name rune, values []string)
- type ExternalState
- type FileChange
- type FileChangeKind
- type FileOperationController
- type Gutter
- type GutterLineNumbers
- type GutterType
- type Id
- type IndentGuides
- type Indenter
- type InlayHint
- type JumpEntry
- type JumpList
- func (j *JumpList) Backward() (DocumentId, int, bool)
- func (j *JumpList) Clone() JumpList
- func (j *JumpList) Entries() []JumpEntry
- func (j *JumpList) Forward() (DocumentId, int, bool)
- func (j *JumpList) Head() int
- func (j *JumpList) Push(docID DocumentId, anchor int, sel core.Selection)
- func (j *JumpList) Restore(items []JumpEntry, head int)
- type LanguageServerController
- type Layout
- type LineNumber
- type Location
- type Mode
- type Options
- func (o *Options) AutoPairs() (core.AutoPairs, bool)
- func (o *Options) CursorShapeForMode(mode string) CursorKind
- func (o *Options) ModeNameForMode(mode string) string
- func (o *Options) StatusLineLeft() []StatusLineItem
- func (o *Options) StatusLineRight() []StatusLineItem
- func (o *Options) StatusLineSeparator() string
- type Pane
- type PaneRestorer
- type PaneSession
- type Position
- type Separator
- type SeparatorAtRes
- type SessionKind
- type SessionWriter
- type SignatureHelp
- type SignatureInformation
- type StatusLine
- type StatusLineElement
- type StatusLineItem
- type StatusLineModeNames
- type Symbol
- type Tree
- func (t *Tree) Any(pred func(Pane) bool) bool
- func (t *Tree) CanSplit(layout Layout) bool
- func (t *Tree) ContainerLayoutAt(id Id) (Layout, bool)
- func (t *Tree) Count() int
- func (t *Tree) DiscardHistory(id Id)
- func (t *Tree) DisplacePane(id Id, p Pane)
- func (t *Tree) FindSplitInDirection(id Id, dir Direction) (Id, bool)
- func (t *Tree) Focus() Id
- func (t *Tree) Get(id Id) Pane
- func (t *Tree) Insert(p Pane) Id
- func (t *Tree) IsEmpty() bool
- func (t *Tree) Maximized() bool
- func (t *Tree) MoveSeparator(containerID Id, childIdx int, layout Layout, newPos int)
- func (t *Tree) Next() Id
- func (t *Tree) Prev() Id
- func (t *Tree) Range(fn func(Pane) bool)
- func (t *Tree) RangeVisible(fn func(Pane) bool)
- func (t *Tree) Redraw()
- func (t *Tree) Remove(id Id)
- func (t *Tree) ReplacePane(id Id, p Pane)
- func (t *Tree) Resize(size geom.Size) bool
- func (t *Tree) ResizeFocused(dir Direction, delta int) bool
- func (t *Tree) RevertPane(id Id) bool
- func (t *Tree) SeparatorAt(at geom.Point) (SeparatorAtRes, bool)
- func (t *Tree) SetFocus(id Id)
- func (t *Tree) SetRedraw(fn func())
- func (t *Tree) Split(p Pane, layout Layout) Id
- func (t *Tree) SwapSplitInDirection(dir Direction) bool
- func (t *Tree) ToggleMaximized()
- func (t *Tree) Transpose()
- func (t *Tree) Traverse() []Pane
- func (t *Tree) Unmaximize()
- func (t *Tree) WalkSeparators(fn func(Separator))
- type VersionControl
- type View
- func (v *View) Area() geom.Area
- func (v *View) BeginFreeScroll(rev int, sel core.Selection)
- func (v *View) Close()
- func (v *View) ConsumeDirty() bool
- func (v *View) Discard()
- func (v *View) DocID() DocumentId
- func (v *View) EndFreeScroll()
- func (v *View) EnsureCursorVisible(doc core.Rope, sel core.Selection, height, scrolloff int, ...)
- func (v *View) EnsureCursorVisibleHorizontal(doc core.Rope, sel core.Selection, width, tabW, scrolloff int)
- func (v *View) FreeScroll() bool
- func (v *View) ID() Id
- func (v *View) JumpBackward() (DocumentId, int, bool)
- func (v *View) JumpForward() (DocumentId, int, bool)
- func (v *View) Jumps() []JumpEntry
- func (v *View) MarkDirty()
- func (v *View) Mode() Mode
- func (v *View) Offset() Position
- func (v *View) OnDisplace()
- func (v *View) OnRevert()
- func (v *View) Path() string
- func (v *View) PushJump(docID DocumentId, anchor int, sel core.Selection)
- func (v *View) SaveSession(w *SessionWriter)
- func (v *View) SetArea(a geom.Area)
- func (v *View) SetID(id Id)
- func (v *View) SetMode(m Mode)
- func (v *View) SetOffset(p Position)
- func (v *View) Shutdown()
- func (v *View) Split() (Pane, error)
- func (v *View) SyncFreeScroll(rev int, sel core.Selection) bool
- type Whitespace
- type WhitespaceCharacters
- type WhitespaceRender
- func (w *WhitespaceRender) NbspRender() WhitespaceRenderValue
- func (w *WhitespaceRender) NewlineRender() WhitespaceRenderValue
- func (w *WhitespaceRender) NnbspRender() WhitespaceRenderValue
- func (w *WhitespaceRender) SpaceRender() WhitespaceRenderValue
- func (w *WhitespaceRender) TabRender() WhitespaceRenderValue
- func (w *WhitespaceRender) UnmarshalTOML(value any) error
- type WhitespaceRenderValue
Constants ¶
const ( DefaultTheme = "mocha" // DefaultLanguage is the document language name used when no language // could be detected or was explicitly cleared DefaultLanguage = "text" BufferLineNever BufferLine = "never" BufferLineAlways BufferLine = "always" BufferLineMultiple BufferLine = "multiple" StatusLineMode StatusLineElement = "mode" StatusLineFileBaseName StatusLineElement = "file-base-name" StatusLineFileName StatusLineElement = "file-name" StatusLineFileAbsolutePath StatusLineElement = "file-absolute-path" StatusLineReadOnly StatusLineElement = "read-only-indicator" StatusLineFileEncoding StatusLineElement = "file-encoding" StatusLineFileLineEnding StatusLineElement = "file-line-ending" StatusLineFileIndentStyle StatusLineElement = "file-indent-style" StatusLineFileType StatusLineElement = "file-type" StatusLineDiagnostics StatusLineElement = "diagnostics" StatusLineSelections StatusLineElement = "selections" StatusLinePrimaryLen StatusLineElement = "primary-selection-length" StatusLinePosition StatusLineElement = "position" StatusLineSeparator StatusLineElement = "separator" StatusLinePercent StatusLineElement = "position-percentage" StatusLineTotalLines StatusLineElement = "total-line-numbers" StatusLineSpacer StatusLineElement = "spacer" StatusLineVersionControl StatusLineElement = "version-control" StatusLineRegister StatusLineElement = "register" StatusLineModified StatusLineElement = "file-modified-indicator" StatusLineSpinner StatusLineElement = "spinner" CursorKindBlock CursorKind = "block" CursorKindBar CursorKind = "bar" CursorKindUnderline CursorKind = "underline" CursorKindHidden CursorKind = "hidden" LineNumberAbsolute LineNumber = "absolute" LineNumberRelative LineNumber = "relative" DefaultScrollOff = 5 DefaultScrollLines = 3 DefaultAutoSaveDelay = 3000 DefaultInactiveDim = 10 WhitespaceRenderNone WhitespaceRenderValue = "none" WhitespaceRenderAll WhitespaceRenderValue = "all" DefaultWSSpace = '\u00b7' // '·' - middle dot (·) DefaultWSNbsp = '\u237d' // '⍽' - shouldered open box (⍽) DefaultWSNnbsp = '\u2423' // '␣' - open box (␣) DefaultWSTab = '\u2192' // '→' - rightwards arrow (→) DefaultWSNewline = '\u23ce' // '⏎' - return symbol (⏎) DefaultWSTabpad rune = ' ' DefaultIndentGuideChar = '\u2502' // U+2502 box drawings light vertical DefaultStatusLineSeparator = "\u2502" // '│' box drawings light vertical GutterTypeDiagnostics GutterType = "diagnostics" GutterTypeLineNumbers GutterType = "line-numbers" GutterTypeSpacer GutterType = "spacer" GutterTypeDiff GutterType = "diff" DefaultGutterLineNumberMinWidth = 3 )
const ( // InvalidDocumentId is the zero value, indicating no document InvalidDocumentId DocumentId = 0 // ScratchBufferName is the display name used for unnamed scratch documents ScratchBufferName = "[scratch]" // EncodingUTF8 and EncodingUTF8BOM are the text-encoding display names // used in config and status display EncodingUTF8 = "utf-8" EncodingUTF8BOM = "utf-8-bom" )
const ( RegisterSearch = '/' RegisterDefaultYank = '"' RegisterSelectionIndices = '#' RegisterSelectionText = '.' RegisterDocumentPath = '%' RegisterClipboard = '+' RegisterPrimaryClipboard = '*' RegisterBlackHole = '_' )
Variables ¶
var ( ErrInvalidCursorKind = errors.New("invalid cursor kind") ErrInvalidLineNumber = errors.New("invalid line-number value") ErrInvalidStatusLine = errors.New("invalid statusline element") ErrInvalidWhitespaceRender = errors.New("invalid whitespace render value") ErrInvalidGutterType = errors.New("invalid gutter type") ErrInvalidBufferLine = errors.New("invalid bufferline value") )
var ( ErrNoDocument = errors.New("no document") ErrNoView = errors.New("no view") ErrReadOnly = errors.New("document is readonly") ErrDocumentNoPath = errors.New("document has no path") ErrEmptyDirStack = errors.New("directory stack is empty") ErrUnsavedChanges = errors.New("unsaved changes") ErrFileChangedOnDisk = errors.New( "file modified by an external process, use :w! to overwrite", ) ErrFileReadOnly = errors.New("path is read only") ErrCannotSplit = errors.New("pane is too small to split") )
var ( // ErrNoLanguageServer reports that no language server is configured for a // document's language ErrNoLanguageServer = errors.New("LSP not defined for document") // ErrUnknownLanguageServer reports that a named language server was not // found among the document's configured servers ErrUnknownLanguageServer = errors.New("unknown language server") // ErrWorkspaceCommand reports that a requested workspace command is not // offered by any configured language server ErrWorkspaceCommand = errors.New("workspace command unavailable") // ErrFormatSelection reports that range formatting cannot be performed for // the current selection ErrFormatSelection = errors.New("format selection unsupported") )
Functions ¶
func CursorKindNames ¶
func CursorKindNames() []string
CursorKindNames returns the recognized CursorKind values as strings
func DefaultShell ¶
func DefaultShell() []string
DefaultShell returns the platform shell command prefix for shell actions
func DocumentDisplayName ¶
DocumentDisplayName returns a short display name for a file path, or ScratchBufferName if path is empty
func DocumentRelativeName ¶
DocumentRelativeName returns path relative to basedir, falling back to the absolute path on error
func RuneWidth ¶
RuneWidth returns the display width of ch at visual column col, expanding tabs to the next tabW boundary. The ASCII fast path avoids a per-rune string allocation in the render and cursor-positioning hot paths
func StatusLineElementNames ¶ added in v0.1.2
func StatusLineElementNames() []string
StatusLineElementNames returns the recognized statusline elements
func VisualColumn ¶
VisualColumn returns the display column of position to, measured from from, expanding tabs to the next tabW boundary. It folds rune widths over the range directly, allocating no intermediate substring
func WorkspaceSessionFile ¶
WorkspaceSessionFile returns the session file path for dir's workspace
Types ¶
type AsyncRenderer ¶ added in v0.1.10
type AsyncRenderer interface {
SetRedraw(func())
}
AsyncRenderer marks a pane that mutates outside the event loop; the tree hands it a redraw hook on insertion so it can wake the render loop
type BufferLine ¶
type BufferLine string
func ParseBufferLine ¶
func ParseBufferLine(value string) (BufferLine, error)
func (*BufferLine) UnmarshalText ¶
func (b *BufferLine) UnmarshalText(text []byte) error
type Clipboard ¶
type Clipboard interface {
Read() (string, error)
ReadPrimary() (string, error)
Write(text string) error
WritePrimary(text string) error
Available() bool
}
Clipboard is the system clipboard plus the X11 PRIMARY selection
type CodeAction ¶
CodeAction is a normalized language-server action or command
type CompletionItem ¶
type CompletionItem struct {
ID string
Label string
LabelDetail string
LabelDescription string
Detail string
Filter string
Sort string
Insert string
Kind string
Docs string
Server string
Preselect bool
Deprecated bool
}
CompletionItem is a normalized language-server completion candidate
type CompletionResult ¶
type CompletionResult struct {
Items []CompletionItem
Incomplete bool
}
CompletionResult is a normalized language-server completion response
type CursorKind ¶
type CursorKind string
func ParseCursorKind ¶
func ParseCursorKind(value string) (CursorKind, error)
func (*CursorKind) UnmarshalText ¶
func (c *CursorKind) UnmarshalText(text []byte) error
type CursorShape ¶
type CursorShape struct {
Normal CursorKind `toml:"normal"`
Select CursorKind `toml:"select"`
Insert CursorKind `toml:"insert"`
}
type Diagnostic ¶
type Diagnostic struct {
Range DiagnosticRange
Severity DiagnosticSeverity
Message string
Source string
Provider string
}
Diagnostic is a document diagnostic reported by an external provider
type DiagnosticCounts ¶
DiagnosticCounts groups diagnostics by severity
type DiagnosticRange ¶
DiagnosticRange is a character range in a document
type DiagnosticSeverity ¶
type DiagnosticSeverity int
DiagnosticSeverity orders diagnostics by user-facing severity
const ( DiagnosticSeverityHint DiagnosticSeverity = iota + 1 DiagnosticSeverityInfo DiagnosticSeverityWarning DiagnosticSeverityError )
type DiffHunk ¶
DiffHunk is a change as half-open ranges [BaseFrom,BaseTo) and [From,To); an empty base range is a pure insertion, empty doc range a pure removal
func (DiffHunk) PureInsertion ¶
PureInsertion reports whether the hunk only adds document lines
func (DiffHunk) PureRemoval ¶
PureRemoval reports whether the hunk only removes base lines
type Displaceable ¶ added in v0.1.16
type Displaceable interface {
OnDisplace()
OnRevert()
}
Displaceable marks a pane that frees heavy resources while stashed behind another pane and reacquires them when reverted back into view
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document holds an open buffer and its editing, file, view, and render state
func (*Document) AccessedAt ¶
AccessedAt returns the monotonic focus/access sequence for MRU ordering
func (*Document) Apply ¶
func (d *Document) Apply(tx core.Transaction, vid Id) error
Apply applies a transaction to the document, recording in history. While an insert group is active (BeginInsertGroup was called), changes are accumulated and a single revision is committed by CommitInsertHistory
func (*Document) BeginInsertGroup ¶
BeginInsertGroup starts insert-mode change accumulation for vid if not already active. Subsequent Apply calls accumulate into a single history revision until CommitInsertHistory is called
func (*Document) ClearAllDocumentHighlights ¶
func (d *Document) ClearAllDocumentHighlights()
ClearAllDocumentHighlights removes highlight ranges for every view
func (*Document) ClearAllInlayHints ¶
func (d *Document) ClearAllInlayHints()
ClearAllInlayHints removes language-server inlay hints for every view
func (*Document) ClearDiagnostics ¶
func (d *Document) ClearDiagnostics()
ClearDiagnostics removes all diagnostics from the document
func (*Document) ClearDocumentColors ¶
func (d *Document) ClearDocumentColors()
ClearDocumentColors removes document-wide LSP colors
func (*Document) ClearDocumentHighlights ¶
ClearDocumentHighlights removes highlight ranges for a view
func (*Document) ClearDocumentLinks ¶
func (d *Document) ClearDocumentLinks()
ClearDocumentLinks removes document-wide LSP links
func (*Document) ClearInlayHints ¶
ClearInlayHints removes language-server inlay hints for a view
func (*Document) CommitInsertHistory ¶
CommitInsertHistory flushes any accumulated insert-mode changes as one history revision. It is a no-op when no accumulation is active
func (*Document) ConsumeDirty ¶
ConsumeDirty reports whether vid's rendered state changed since the last call for vid, clearing the flag. A vid never seen before is dirty
func (*Document) DiagnosticCounts ¶
func (d *Document) DiagnosticCounts() DiagnosticCounts
DiagnosticCounts returns severity counts for all current diagnostics
func (*Document) Diagnostics ¶
func (d *Document) Diagnostics() []Diagnostic
Diagnostics returns a snapshot of all current diagnostics
func (*Document) DisplayName ¶
DisplayName returns the short display name for the document
func (*Document) DocumentColors ¶
func (d *Document) DocumentColors() []DocumentColor
DocumentColors returns document-wide LSP colors
func (*Document) DocumentHighlights ¶
func (d *Document) DocumentHighlights(vid Id) []DocumentHighlight
DocumentHighlights returns same-document highlight ranges for a view
func (*Document) DocumentLinks ¶
func (d *Document) DocumentLinks() []DocumentLink
DocumentLinks returns document-wide LSP links
func (*Document) ExternalState ¶
func (d *Document) ExternalState() ExternalState
ExternalState reports any unresolved change made to the backing file by another process
func (*Document) HasBOM ¶
HasBOM reports whether the document was loaded with a UTF-8 BOM, which is preserved on save
func (*Document) IndentStyle ¶
func (d *Document) IndentStyle() core.IndentStyle
IndentStyle returns the active indentation style
func (*Document) InlayHints ¶
InlayHints returns language-server inlay hints for a view
func (*Document) LastEditPos ¶
LastEditPos returns the char offset of the most recently committed change
func (*Document) LineEnding ¶
func (d *Document) LineEnding() core.LineEnding
LineEnding returns the document's line-ending style
func (*Document) Loaded ¶
Loaded reports whether the backing file has been read; a restored session buffer stays unloaded until its content is first accessed
func (*Document) RelativeName ¶
RelativeName returns the path relative to basedir
func (*Document) Reload ¶
Reload replaces the document text with the current file contents on disk All per-view selections are reset to the start of the document
func (*Document) RemoveView ¶
RemoveView cleans up selection and LSP state for a closed view
func (*Document) ReplaceDiagnostics ¶
func (d *Document) ReplaceDiagnostics(provider string, diags []Diagnostic)
ReplaceDiagnostics replaces all diagnostics from provider with diags
func (*Document) RestoreCursor ¶
RestoreCursor reports whether the next exit from insert mode should move the cursor back by one grapheme
func (*Document) Revision ¶
Revision returns the document version used for render-cache invalidation
func (*Document) Save ¶
Save writes the document to its current path. Unless force is set, it refuses an unsafe overwrite (changed on disk, or read-only)
func (*Document) SearchHighlightsActive ¶
SearchHighlightsActive reports whether search matches should be highlighted for a view
func (*Document) Selection ¶
Selection returns the buffer's canonical cursor, independent of any view
func (*Document) SelectionFor ¶
SelectionFor returns the selection for a given view
func (*Document) SetDocumentColors ¶
func (d *Document) SetDocumentColors(colors []DocumentColor)
SetDocumentColors stores document-wide LSP colors
func (*Document) SetDocumentHighlights ¶
func (d *Document) SetDocumentHighlights( vid Id, highlights []DocumentHighlight, )
SetDocumentHighlights stores the same-document highlight ranges for a view
func (*Document) SetDocumentLinks ¶
func (d *Document) SetDocumentLinks(links []DocumentLink)
SetDocumentLinks stores document-wide LSP links
func (*Document) SetIndentStyle ¶
func (d *Document) SetIndentStyle(s core.IndentStyle)
SetIndentStyle updates the indent style for this document
func (*Document) SetInlayHints ¶
SetInlayHints stores language-server inlay hints for a view
func (*Document) SetLang ¶
SetLang sets the language identifier and resolves its definition once so the render path reads the cached *language.Language directly
func (*Document) SetLineEnding ¶
func (d *Document) SetLineEnding(le core.LineEnding)
SetLineEnding updates the line ending for this document
func (*Document) SetReadOnly ¶
SetReadOnly marks the document as read-only or writable
func (*Document) SetRestoreCursor ¶
SetRestoreCursor marks whether the next insert-mode exit should restore the cursor one grapheme to the left
func (*Document) SetSelectionFor ¶
SetSelectionFor sets the selection for a view. Changing the selection clears any search-match highlighting for that view
func (*Document) ShowSearchHighlights ¶
ShowSearchHighlights marks a view's search matches as visible. Search actions call this after moving the selection to their match
func (*Document) TextFormat ¶
func (d *Document) TextFormat(w int) *language.TextFormat
TextFormat returns the display-time text layout options for this document
func (*Document) TextFormatForConfig ¶
func (d *Document) TextFormatForConfig( w int, opts *Options, ) *language.TextFormat
TextFormatForConfig returns layout options using the supplied editor options
type DocumentChange ¶
DocumentChange describes an editor text change for document observers
type DocumentColor ¶
DocumentColor is a normalized color range in a document
type DocumentHighlight ¶
DocumentHighlight is a normalized same-document symbol highlight
type DocumentLink ¶
DocumentLink is a normalized link range in a document
type DocumentObserver ¶
type DocumentObserver interface {
DocumentOpened(*Document)
DocumentChanged(*Document, DocumentChange)
DocumentSaved(*Document)
DocumentClosed(*Document)
}
DocumentObserver receives editor document lifecycle notifications
type DocumentOpenError ¶
DocumentOpenError describes why a document could not be opened
func (*DocumentOpenError) Error ¶
func (d *DocumentOpenError) Error() string
func (*DocumentOpenError) Unwrap ¶
func (d *DocumentOpenError) Unwrap() error
type Editor ¶
type Editor struct {
// contains filtered or unexported fields
}
Editor holds the full state of the editor session: all open documents, the view layout tree, and shared editor state
func (*Editor) ActiveRegister ¶
ActiveRegister returns the pending register rune (0 = default)
func (*Editor) AddDocumentObserver ¶
func (e *Editor) AddDocumentObserver(o DocumentObserver)
AddDocumentObserver installs a document lifecycle observer. Observers are notified in registration order
func (*Editor) AllDocuments ¶
AllDocuments returns all open documents
func (*Editor) Apply ¶
func (e *Editor) Apply(tx core.Transaction) error
Apply applies a transaction to the focused document for the focused view
func (*Editor) ApplyToDocument ¶
func (e *Editor) ApplyToDocument(doc *Document, tx core.Transaction) error
ApplyToDocument applies a transaction without changing the focused view
func (*Editor) CloseAllOtherViews ¶
func (e *Editor) CloseAllOtherViews()
CloseAllOtherViews closes all views except the focused one
func (*Editor) CloseCurrentView ¶
func (e *Editor) CloseCurrentView()
CloseCurrentView closes the focused pane
func (*Editor) ClosePane ¶
ClosePane closes the pane at id. If it is the tree's only pane, it is replaced with a fresh scratch document instead of leaving the tree empty
func (*Editor) CloseView ¶
CloseView closes a view and, if no other view references the same document, also closes the document
func (*Editor) CommitInsertHistory ¶
func (e *Editor) CommitInsertHistory()
CommitInsertHistory flushes any pending insert-mode history accumulation on the focused document into a single history revision
func (*Editor) DeleteDocument ¶
func (e *Editor) DeleteDocument(did DocumentId)
DeleteDocument removes a document without closing its views; affected views will report no focused document
func (*Editor) DiscardPane ¶
DiscardPane closes p's document, if p is a view and this was its last reference — for a displaced pane the caller has decided not to keep
func (*Editor) DisplacePane ¶ added in v0.1.16
DisplacePane swaps the pane at id for p, stashing the displaced pane on the node so RevertPane can restore it when p closes
func (*Editor) Document ¶
func (e *Editor) Document(did DocumentId) *Document
Document returns a document by id
func (*Editor) FirstRegister ¶
FirstRegister returns the first value from ReadRegister
func (*Editor) FocusDirection ¶
FocusDirection moves focus to the nearest split in the given direction
func (*Editor) FocusNextView ¶
func (e *Editor) FocusNextView()
FocusNextView moves focus to the next view in DFS order
func (*Editor) FocusPrevView ¶
func (e *Editor) FocusPrevView()
FocusPrevView moves focus to the previous view in DFS order
func (*Editor) FocusedDocument ¶
FocusedDocument returns the document displayed by the focused view
func (*Editor) FocusedPane ¶
FocusedPane returns the currently focused pane
func (*Editor) FocusedView ¶
FocusedView returns the currently focused view
func (*Editor) HSplit ¶
func (e *Editor) HSplit(docID DocumentId) *View
HSplit opens docID in a new horizontal split (stacked)
func (*Editor) IndentForNewline ¶
IndentForNewline returns syntax-aware indentation when a provider exists
func (*Editor) LanguageServerController ¶
func (e *Editor) LanguageServerController() LanguageServerController
LanguageServerController returns the installed language-server controller
func (*Editor) LastModifiedDocIDs ¶
func (e *Editor) LastModifiedDocIDs() [2]DocumentId
LastModifiedDocIDs returns the two most recently modified-and-left documents, with the most recent first. Invalid entries have value InvalidDocumentId
func (*Editor) LastMotion ¶
LastMotion returns the most recently recorded repeatable motion
func (*Editor) MoveFocusedFile ¶
MoveFocusedFile renames the focused document's backing file and updates the document path
func (*Editor) NewDocument ¶
NewDocument creates a new empty scratch document and makes it the focused view
func (*Editor) OpenFile ¶
OpenFile replaces the focused view's document with the given file, reusing an existing document if it is already open
func (*Editor) PopDirectory ¶
PopDirectory changes to the top of the directory stack, if any
func (*Editor) PopPrevDocID ¶
func (e *Editor) PopPrevDocID() (DocumentId, bool)
PopPrevDocID returns and removes the most recently accessed document for the focused view
func (*Editor) ProcessExternalFileChange ¶
ProcessExternalFileChange updates any open document whose backing file changed outside the editor
func (*Editor) PushDirectory ¶
PushDirectory pushes the current directory onto the stack then chdirs
func (*Editor) ReadRegister ¶
ReadRegister returns regular and computed register contents for the current editor state
func (*Editor) RegisterPaneRestorer ¶
func (e *Editor) RegisterPaneRestorer(kind SessionKind, fn PaneRestorer)
RegisterPaneRestorer registers how to rebuild a leaf pane of the given session kind
func (*Editor) ReloadConfig ¶
ReloadConfig reloads the live editor config and resets module section state. Falls back to loading user config only when no reload function is registered
func (*Editor) RemovePane ¶
RemovePane removes a non-document pane from the layout. If it is the only pane, it is replaced with a fresh scratch document
func (*Editor) ReplacePane ¶
ReplacePane swaps the pane at id for p in place, discarding any panes stashed behind id, and returns the evicted pane for the caller to dispose of
func (*Editor) ResetRegister ¶
func (e *Editor) ResetRegister()
ResetRegister clears the pending register to the default
func (*Editor) ResizeFocusedSplit ¶
ResizeFocusedSplit pushes the border on the given side of the focused split by delta cells, screen-direction style (see Tree.ResizeFocused)
func (*Editor) ResizeTree ¶
ResizeTree resizes the layout tree to the given content area dimensions
func (*Editor) RestoreSession ¶
RestoreSession restores file-backed documents and view state from path. It returns any runtime option strings stored in the session for the caller to apply through the command registry
func (*Editor) RevertPane ¶ added in v0.1.16
RevertPane restores the pane most recently displaced at id, reporting whether one was available
func (*Editor) Save ¶
Save saves the focused document to disk. Unless force is set, it refuses an unsafe overwrite (changed on disk, or read-only)
func (*Editor) SaveAll ¶
SaveAll saves all modified documents. Unless force is set, it refuses an unsafe overwrite (changed on disk, or read-only)
func (*Editor) SaveSession ¶
SaveSession stores restorable workspace state in path. Runtime option strings are supplied by the command registry that owns the option handlers
func (*Editor) SetClipboard ¶
func (*Editor) SetConfigReload ¶
SetConfigReload registers the function called by ReloadConfig to reset module section state and re-apply the merged TOML config
func (*Editor) SetIndenter ¶
SetIndenter installs syntax-aware indentation support
func (*Editor) SetLanguageServerController ¶
func (e *Editor) SetLanguageServerController(c LanguageServerController)
SetLanguageServerController installs the language-server request handler
func (*Editor) SetLastMotion ¶
SetLastMotion records fn as the last repeatable motion
func (*Editor) SetRegister ¶
SetRegister sets the pending register selection
func (*Editor) SetStatusMsg ¶
SetStatusMsg stores a transient status message to be displayed after the current keypress. The UI clears it via TakeStatusMsg
func (*Editor) SetVersionControl ¶
func (e *Editor) SetVersionControl(vc VersionControl)
SetVersionControl installs the version-control state provider
func (*Editor) SetViewContentWidth ¶
SetViewContentWidth stores the text content width (called by the renderer after computing the gutter width for the focused document)
func (*Editor) SetViewHeight ¶
SetViewHeight sets the content area height (called by the UI on resize)
func (*Editor) ShowDocument ¶
func (e *Editor) ShowDocument(did DocumentId) *View
ShowDocument displays an open document in the focused pane
func (*Editor) SplitFocused ¶
SplitFocused opens the focused pane in a new split
func (*Editor) SwapSplitInDirection ¶
SwapSplitInDirection swaps focus with the nearest split in the direction
func (*Editor) SwitchBuffer ¶
func (e *Editor) SwitchBuffer(did DocumentId) bool
SwitchBuffer replaces the focused view's document with an already-open document by ID. Returns false if the document does not exist or there is no focused view
func (*Editor) SwitchOrOpenDoc ¶
SwitchOrOpenDoc returns an existing document for path, opening it if needed
func (*Editor) TakeStatusMsg ¶
TakeStatusMsg returns the pending status message and clears it
func (*Editor) TogglePaneMaximized ¶ added in v0.1.8
func (e *Editor) TogglePaneMaximized()
TogglePaneMaximized maximizes the focused pane or restores the split layout
func (*Editor) Transpose ¶
func (e *Editor) Transpose()
Transpose flips the layout of the container holding the focused view
func (*Editor) VSplit ¶
func (e *Editor) VSplit(docID DocumentId) *View
VSplit opens docID in a new vertical split (side by side)
func (*Editor) VersionControl ¶
func (e *Editor) VersionControl() VersionControl
VersionControl returns the installed version-control state provider
func (*Editor) ViewContentWidth ¶
ViewContentWidth returns the last-reported text content width (viewport minus gutter), used for visual-line movement when soft-wrap is active
func (*Editor) ViewHeight ¶
ViewHeight returns the last-reported content area height
func (*Editor) VisibleDocuments ¶
VisibleDocuments returns the deduplicated documents currently shown in a pane
func (*Editor) WriteRegister ¶
WriteRegister stores regular register contents, syncing special clipboard registers to the system clipboard provider
type ExternalState ¶
type ExternalState int
ExternalState describes whether a file-backed document has diverged from the last disk snapshot toe loaded or wrote
const ( ExternalStateClean ExternalState = iota // no external disk change pending ExternalStateChanged // changed while buffer dirty ExternalStateDeleted // backing file removed while open )
type FileChange ¶
type FileChange struct {
Kind FileChangeKind
Path string
FromPath string // original path, set only for FileChangeRenamed
}
FileChange describes one changed file reported by version control
type FileChangeKind ¶
type FileChangeKind int
FileChangeKind classifies a FileChange
const ( FileChangeUntracked FileChangeKind = iota FileChangeAdded FileChangeModified FileChangeConflict FileChangeDeleted FileChangeRenamed )
type FileOperationController ¶
type FileOperationController interface {
WillCreateFile(path string, dir bool) error
DidCreateFile(path string, dir bool) error
WillRenameFile(oldPath, newPath string, dir bool) error
DidRenameFile(oldPath, newPath string, dir bool) error
WillDeleteFile(path string, dir bool) error
DidDeleteFile(path string, dir bool) error
}
FileOperationController handles user-initiated filesystem operations for language-server clients interested in workspace file operations
type Gutter ¶
type Gutter struct {
Present bool
Layout []GutterType `toml:"layout"`
LineNumbers GutterLineNumbers `toml:"line-numbers"`
}
Gutter controls which gutters are shown and in what order. In TOML it can be an array of type strings or a table with layout/line-numbers. Present tracks whether the config was explicitly set
func (*Gutter) GutterLayout ¶
func (g *Gutter) GutterLayout() []GutterType
func (*Gutter) HasGutterType ¶
func (g *Gutter) HasGutterType(gt GutterType) bool
func (*Gutter) LineNumberMinWidth ¶
func (*Gutter) UnmarshalTOML ¶
type GutterLineNumbers ¶
type GutterLineNumbers struct {
MinWidth *int `toml:"min-width"`
}
type GutterType ¶
type GutterType string
func (*GutterType) UnmarshalText ¶
func (g *GutterType) UnmarshalText(text []byte) error
type Id ¶
type Id int
Id is the unique identifier for an open view
const ( // InvalidViewId is the zero value, indicating no view InvalidViewId Id = 0 )
type IndentGuides ¶
type IndentGuides struct {
Render bool `toml:"render"`
Character string `toml:"character"`
SkipLevels *int `toml:"skip-levels"`
}
func (IndentGuides) CharRune ¶
func (i IndentGuides) CharRune() rune
func (IndentGuides) GetSkipLevels ¶
func (i IndentGuides) GetSkipLevels() int
type JumpEntry ¶
type JumpEntry struct {
DocID DocumentId
Anchor int
Selection core.Selection
}
JumpEntry is a single entry in the jump history
type JumpList ¶
type JumpList struct {
// contains filtered or unexported fields
}
JumpList manages a bounded history of cursor positions
func (*JumpList) Backward ¶
func (j *JumpList) Backward() (DocumentId, int, bool)
Backward moves to the previous jump and returns it
func (*JumpList) Forward ¶
func (j *JumpList) Forward() (DocumentId, int, bool)
Forward moves to the next jump and returns it
type LanguageServerController ¶
type LanguageServerController interface {
RestartLanguageServers(*Document, []string) ([]string, error)
StopLanguageServers(*Document, []string) ([]string, error)
ExecuteWorkspaceCommand(*Document, string, []string) error
WorkspaceCommands(*Document) []string
Completions(*Document, Id) (CompletionResult, error)
TriggerCompletions(*Document, Id) (CompletionResult, error)
ResolveCompletion(
*Document, Id, *CompletionItem,
) (CompletionItem, error)
ApplyCompletion(*Document, Id, *CompletionItem) error
Hover(*Document, Id) (string, error)
SignatureHelp(*Document, Id) (SignatureHelp, error)
TriggerSignatureHelp(*Document, Id) (SignatureHelp, error)
GotoDeclaration(*Document, Id) ([]Location, error)
GotoDefinition(*Document, Id) ([]Location, error)
GotoTypeDefinition(*Document, Id) ([]Location, error)
GotoImplementation(*Document, Id) ([]Location, error)
GotoReference(*Document, Id) ([]Location, error)
RenameSymbolPrefill(*Document, Id) (string, error)
RenameSymbol(*Document, Id, string) error
CodeActions(*Document, Id) ([]CodeAction, error)
ApplyCodeAction(*Document, Id, CodeAction) error
DocumentHighlights(*Document, Id) ([]DocumentHighlight, error)
DocumentLinks(*Document) ([]DocumentLink, error)
ResolveDocumentLink(*Document, DocumentLink) (DocumentLink, error)
FormatDocument(*Document, Id) error
FormatSelection(*Document, Id) error
DocumentSymbols(*Document) ([]Symbol, error)
WorkspaceSymbols(*Document, string) ([]Symbol, error)
Busy() bool
}
LanguageServerController controls language-server sessions for commands
type Layout ¶
type Layout bool
Layout describes how child panes are arranged within a split container
type LineNumber ¶
type LineNumber string
func ParseLineNumber ¶
func ParseLineNumber(value string) (LineNumber, error)
func (*LineNumber) UnmarshalText ¶
func (l *LineNumber) UnmarshalText(text []byte) error
type Mode ¶
type Mode int
Mode describes the current editing mode
func ParseMode ¶
ParseMode returns the Mode for a short name (NOR, INS, …), defaulting to ModeNormal for anything unrecognized
type Options ¶
type Options struct {
Theme string
ScrollOff int
ScrollLines int
InactiveDim int
Mouse bool
MiddleClickPaste bool
NerdFonts bool
Shell []string
AutoSaveFocusLost bool
AutoSaveAfterDelay bool
AutoSaveDelayTimeout int
AtomicSave bool
InsertFinalNewline bool
TrimFinalNewlines bool
TrimTrailingWS bool
EditorConfig bool
AutoSession bool
Insecure bool
ContinueComments bool
SearchSmartCase bool
SearchWrapAround bool
CursorLine bool
CursorColumn bool
TextWidth *int
SoftWrap language.SoftWrap
DefaultLineEnding core.LineEnding
Rulers []int
LineNumber LineNumber
Gutters Gutter
Whitespace Whitespace
IndentGuides IndentGuides
CursorShape CursorShape
StatusLine StatusLine
AutoPairMap core.AutoPairs
HasAutoPairs bool
BufferLine BufferLine
Gen int
}
Options holds the editor's typed runtime config values. Fields are exported so module Apply functions can write to them directly
func (*Options) CursorShapeForMode ¶
func (o *Options) CursorShapeForMode(mode string) CursorKind
CursorShapeForMode returns the cursor shape for the given mode string ("NOR", "INS", "SEL")
func (*Options) ModeNameForMode ¶
ModeNameForMode returns the display name for the given mode string
func (*Options) StatusLineLeft ¶
func (o *Options) StatusLineLeft() []StatusLineItem
StatusLineLeft returns the left status line items with defaults
func (*Options) StatusLineRight ¶
func (o *Options) StatusLineRight() []StatusLineItem
StatusLineRight returns the right status line items with defaults
func (*Options) StatusLineSeparator ¶
StatusLineSeparator returns the status line separator string with default
type Pane ¶
type Pane interface {
ID() Id
Path() string
SetID(Id)
Area() geom.Area
SetArea(geom.Area)
MarkDirty()
Mode() Mode
SaveSession(*SessionWriter)
Split() (Pane, error)
Close()
Discard()
Shutdown()
}
Pane is the interface implemented by every split tree leaf
type PaneRestorer ¶
type PaneRestorer func(*Editor, *PaneSession) (Pane, error)
PaneRestorer rebuilds a leaf pane of a given session kind from its persisted state
type PaneSession ¶
type PaneSession struct {
// contains filtered or unexported fields
}
PaneSession exposes module-owned state for a restored pane
func (*PaneSession) Path ¶
func (s *PaneSession) Path() string
Path returns the pane's persisted path
type Position ¶
type Position struct {
// Anchor is the first visible char position in the document
Anchor int
// HorizontalOffset is the number of columns scrolled right
HorizontalOffset int
// VerticalOffset is lines of context above the visible area
VerticalOffset int
}
Position holds the scroll offset for a view
type Separator ¶
Separator describes the position and extent of the gap between two adjacent split panes in a container
type SeparatorAtRes ¶
type SessionKind ¶
type SessionKind string
SessionKind identifies a leaf pane's restorer in a saved session
const ( SessionFile = "session.toml" SessionKindSplit SessionKind = "split" SessionKindView SessionKind = "view" SessionKindImage SessionKind = "image" SessionKindTerminal SessionKind = "terminal" SessionKindBinary SessionKind = "binary" )
type SessionWriter ¶
type SessionWriter struct {
// contains filtered or unexported fields
}
SessionWriter is the opaque target a pane writes session state into
func (*SessionWriter) SaveSlot ¶
func (w *SessionWriter) SaveSlot(kind SessionKind, path string)
SaveSlot stores a reopenable pane slot in the session
func (*SessionWriter) SaveValue ¶
func (w *SessionWriter) SaveValue(key string, value any)
SaveValue stores module-owned pane state
type SignatureHelp ¶
type SignatureHelp struct {
Signatures []SignatureInformation
Active int
}
SignatureHelp is a normalized callable signature response
type SignatureInformation ¶
type SignatureInformation struct {
Label string
Docs string
ParamDocs string
ActiveStart int
ActiveEnd int
}
SignatureInformation describes one callable signature
type StatusLine ¶
type StatusLine struct {
Left []StatusLineItem `toml:"left"`
Right []StatusLineItem `toml:"right"`
Separator string `toml:"separator"`
Mode StatusLineModeNames `toml:"mode"`
}
type StatusLineElement ¶
type StatusLineElement string
type StatusLineItem ¶
type StatusLineItem struct {
Element StatusLineElement
Pinned bool
}
StatusLineItem is one configured status bar element. In TOML it is the element name, optionally suffixed with "!" to pin it so it is never dropped when the bar is too narrow to fit every element
func (*StatusLineItem) UnmarshalText ¶
func (s *StatusLineItem) UnmarshalText(text []byte) error
type StatusLineModeNames ¶
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree manages the spatial layout of views as a split tree
func (*Tree) CanSplit ¶
CanSplit reports whether there is enough room to split the focused pane in the given layout while keeping all resulting panes at or above the min size
func (*Tree) ContainerLayoutAt ¶
ContainerLayoutAt returns the layout of the container that holds id
func (*Tree) DiscardHistory ¶ added in v0.1.16
DiscardHistory discards every pane stashed behind id, for when the slot is vacated without reverting
func (*Tree) DisplacePane ¶ added in v0.1.16
DisplacePane swaps the pane at id for p, stashing the displaced pane on the node so RevertPane can bring it back when p closes. The oldest entry is discarded once the stack exceeds maxPaneHistory
func (*Tree) FindSplitInDirection ¶
FindSplitInDirection finds the nearest split in the given direction from id,
func (*Tree) Maximized ¶ added in v0.1.8
Maximized reports whether one pane temporarily occupies the full tree area
func (*Tree) MoveSeparator ¶
MoveSeparator adjusts the split between children[childIdx] and children[childIdx+1] in containerID, in tree coordinates
func (*Tree) Range ¶
Range calls fn for each leaf pane in DFS order (left-to-right, top-to-bottom), stopping early if fn returns false. It does not allocate
func (*Tree) RangeVisible ¶ added in v0.1.8
RangeVisible calls fn for each pane currently visible in the layout
func (*Tree) Redraw ¶ added in v0.1.11
func (t *Tree) Redraw()
Redraw wakes the renderer after asynchronous editor state changes
func (*Tree) Remove ¶
Remove removes a view from the tree. Focus is moved to the previous view before removal. Empty containers are collapsed
func (*Tree) ReplacePane ¶
ReplacePane swaps the pane at id for p, keeping its tree position and area
func (*Tree) Resize ¶
Resize updates the total area and recalculates view areas. Returns true if the area changed
func (*Tree) ResizeFocused ¶
ResizeFocused pushes a border of the focused pane's split by delta cells in dir, falling back to its other border if it has none on that side. False if no ancestor splits along that axis
func (*Tree) RevertPane ¶ added in v0.1.16
RevertPane restores the most recently displaced pane at id, reporting whether one was available
func (*Tree) SeparatorAt ¶
func (t *Tree) SeparatorAt(at geom.Point) (SeparatorAtRes, bool)
SeparatorAt returns the container ID, left-child index, and layout of the separator hit by the click at tree column x, tree row y (bufferline excluded) SeparatorAtRes identifies a separator and its owning child
func (*Tree) SetRedraw ¶ added in v0.1.10
func (t *Tree) SetRedraw(fn func())
SetRedraw installs the hook the tree hands to AsyncRenderer panes on insertion, wiring any that are already present
func (*Tree) Split ¶
Split creates a new pane alongside the focused pane using the given layout. If the focused pane's parent container already uses the same layout, the new pane is added as a sibling. Otherwise a new sub-container is created
func (*Tree) SwapSplitInDirection ¶
SwapSplitInDirection swaps the focused pane with the nearest pane in the given direction
func (*Tree) ToggleMaximized ¶ added in v0.1.8
func (t *Tree) ToggleMaximized()
ToggleMaximized maximizes the focused pane or restores the split layout
func (*Tree) Transpose ¶
func (t *Tree) Transpose()
Transpose flips the layout of the container holding the focused pane
func (*Tree) Traverse ¶
Traverse returns all leaf panes in DFS order (left-to-right, top-to-bottom). Prefer Tree.Range when a slice isn't actually needed
func (*Tree) Unmaximize ¶ added in v0.1.9
func (t *Tree) Unmaximize()
Unmaximize restores the preserved split layout
func (*Tree) WalkSeparators ¶
WalkSeparators calls fn for each separator between adjacent panes. Vertical seps have W=1 and span the container height; horizontal seps have H=1 and span the container width
type VersionControl ¶
type VersionControl interface {
// DiffHunks returns the current hunks between the document and its
// version-control base, sorted ascending and non-overlapping
DiffHunks(*Document) []DiffHunk
// DiffBase returns the version-control base text of the document
DiffBase(*Document) (string, bool)
// DiffHunksForPath computes hunks between the checked-in base and the
// on-disk contents of an arbitrary workspace file
DiffHunksForPath(path string) []DiffHunk
// DiffBaseForPath returns the version-control base text of an arbitrary
// workspace file, empty when it has none
DiffBaseForPath(path string) string
// HeadName returns a short display name for the current head of the
// repository containing the document
HeadName(*Document) (string, bool)
// ChangedFiles lists workspace files that differ from the head
ChangedFiles() ([]FileChange, error)
// Refresh picks up external version-control state changes
Refresh()
// Updates delivers a token whenever diff state changes, so the UI can
// schedule a redraw
Updates() <-chan struct{}
}
VersionControl exposes version-control state to commands, pickers, and rendering. Implementations live outside the view package; the editor only holds the seam
type View ¶
type View struct {
// contains filtered or unexported fields
}
View is a viewport into a document
func (*View) BeginFreeScroll ¶
BeginFreeScroll decouples the viewport from the cursor. The revision and selection snapshot the document state at this moment; free scroll ends automatically when either changes
func (*View) ConsumeDirty ¶
ConsumeDirty reports whether the view has changed since the last call, clearing the flag
func (*View) Discard ¶
func (v *View) Discard()
Discard closes this displaced view if no other view uses its document
func (*View) DocID ¶
func (v *View) DocID() DocumentId
DocID returns the document this view displays
func (*View) EndFreeScroll ¶
func (v *View) EndFreeScroll()
EndFreeScroll re-couples the viewport to the cursor
func (*View) EnsureCursorVisible ¶
func (v *View) EnsureCursorVisible( doc core.Rope, sel core.Selection, height, scrolloff int, vf *core.VisualMoveFormat, )
EnsureCursorVisible scrolls so the cursor is visible within height rows, respecting scrolloff; measured in visual rows when vf has active soft-wrap
func (*View) EnsureCursorVisibleHorizontal ¶
func (v *View) EnsureCursorVisibleHorizontal( doc core.Rope, sel core.Selection, width, tabW, scrolloff int, )
EnsureCursorVisibleHorizontal scrolls so the cursor's visual column stays within width content columns (gutter excluded). width <= 0 disables horizontal scrolling and resets the offset to 0
func (*View) FreeScroll ¶
FreeScroll reports whether the viewport is decoupled from the cursor
func (*View) JumpBackward ¶
func (v *View) JumpBackward() (DocumentId, int, bool)
JumpBackward moves to the previous position in the jump list
func (*View) JumpForward ¶
func (v *View) JumpForward() (DocumentId, int, bool)
JumpForward moves to the next position in the jump list
func (*View) MarkDirty ¶
func (v *View) MarkDirty()
MarkDirty flags the view as needing a repaint on the next frame
func (*View) OnDisplace ¶ added in v0.1.16
func (v *View) OnDisplace()
OnDisplace marks this view as stashed behind another pane. A view holds no heavy resources of its own, so there is nothing to release
func (*View) OnRevert ¶ added in v0.1.16
func (v *View) OnRevert()
OnRevert marks this view as returned to the foreground. Nothing to reacquire
func (*View) PushJump ¶
func (v *View) PushJump(docID DocumentId, anchor int, sel core.Selection)
PushJump records a selection in the jump list
func (*View) SaveSession ¶
func (v *View) SaveSession(w *SessionWriter)
SaveSession stores this view's document state in w
func (*View) Shutdown ¶
func (v *View) Shutdown()
Shutdown releases external resources owned by this view
type Whitespace ¶
type Whitespace struct {
Render WhitespaceRender `toml:"render"`
Characters WhitespaceCharacters `toml:"characters"`
}
type WhitespaceCharacters ¶
type WhitespaceCharacters struct {
Space string `toml:"space"`
Nbsp string `toml:"nbsp"`
Nnbsp string `toml:"nnbsp"`
Tab string `toml:"tab"`
Tabpad string `toml:"tabpad"`
Newline string `toml:"newline"`
}
func (*WhitespaceCharacters) NbspRune ¶
func (w *WhitespaceCharacters) NbspRune() rune
func (*WhitespaceCharacters) NewlineRune ¶
func (w *WhitespaceCharacters) NewlineRune() rune
func (*WhitespaceCharacters) NnbspRune ¶
func (w *WhitespaceCharacters) NnbspRune() rune
func (*WhitespaceCharacters) SpaceRune ¶
func (w *WhitespaceCharacters) SpaceRune() rune
func (*WhitespaceCharacters) TabRune ¶
func (w *WhitespaceCharacters) TabRune() rune
func (*WhitespaceCharacters) TabpadRune ¶
func (w *WhitespaceCharacters) TabpadRune() rune
type WhitespaceRender ¶
type WhitespaceRender struct {
Default *WhitespaceRenderValue
Space *WhitespaceRenderValue
Nbsp *WhitespaceRenderValue
Nnbsp *WhitespaceRenderValue
Tab *WhitespaceRenderValue
Newline *WhitespaceRenderValue
}
WhitespaceRender holds per-kind whitespace rendering settings. A plain-string TOML value sets Default only; a table sets fields independently, each falling back to Default then "none"
func (*WhitespaceRender) NbspRender ¶
func (w *WhitespaceRender) NbspRender() WhitespaceRenderValue
func (*WhitespaceRender) NewlineRender ¶
func (w *WhitespaceRender) NewlineRender() WhitespaceRenderValue
func (*WhitespaceRender) NnbspRender ¶
func (w *WhitespaceRender) NnbspRender() WhitespaceRenderValue
func (*WhitespaceRender) SpaceRender ¶
func (w *WhitespaceRender) SpaceRender() WhitespaceRenderValue
func (*WhitespaceRender) TabRender ¶
func (w *WhitespaceRender) TabRender() WhitespaceRenderValue
func (*WhitespaceRender) UnmarshalTOML ¶
func (w *WhitespaceRender) UnmarshalTOML(value any) error
type WhitespaceRenderValue ¶
type WhitespaceRenderValue string
func ParseWhitespaceRenderValue ¶
func ParseWhitespaceRenderValue(s string) (WhitespaceRenderValue, error)
Source Files
¶
- clipboard.go
- config-types.go
- diagnostic.go
- document-disk.go
- document-edit.go
- document-io-text.go
- document-io.go
- document-observer.go
- document-open.go
- document-overlay.go
- document.go
- editor-external.go
- editor-focus.go
- editor-history.go
- editor-io.go
- editor-order.go
- editor-pane.go
- editor-register.go
- editor.go
- indent.go
- language-server.go
- options.go
- session-restore.go
- session-save.go
- session.go
- shell_unix.go
- tree-layout.go
- tree-nav.go
- tree-resize.go
- tree-walk.go
- tree.go
- version-control.go
- view.go