pluginbrowser

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 29 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 pluginbrowser renders one protocol plugin as a list-and-detail browser: a collection's rows in a table with a cursor, and the document behind the cursor beside it.

It is deliberately host-independent, in the same way internal/resourceview is. It knows pluginhost's vocabulary — descriptions, collections, pages, items, actions — and resource documents, and it knows nothing about panes, tmux, workspaces, projects, or which surface is showing it. A global tab and (from M3) a pane leaf bind the same model, so anything that behaves differently between them is a bug rather than a preference.

It is also passive about processes. Every call to the plugin is a command the host supplies through Calls; the browser decides when to ask and what to do with the answer, and never starts a process, reads a file, or blocks inside Update or View.

Keys are host-owned and identical for every plugin, which is the whole point of one browser rather than one per plugin: j/k move, Enter opens, / edits the query, v opens the View modal, r refreshes, a opens the action menu, o opens a validated sourceUrl through the host's confirmed path, c explains the page's outcome, and +/- move the split. `n` and Tab are deliberately not the browser's: the pane switcher and the app's focus ring already answer both, and the browser joins the ring through PaneFocusProvider and hands the key over through PaneFocusRingHost rather than by binding one. A plugin may suggest one letter for an action; it is granted only when nothing above, nothing in keymap.HostReservedKeys, and nothing in the surface's own bindings already uses it.

Index

Constants

View Source
const DetailQuiet = 80 * time.Millisecond

DetailQuiet is how long the cursor has to sit still before the detail box fetches the row under it. It is the file browser's own preview figure (internal/plugins/filebrowser's treePreviewQuiet), because key repeat and trackpad inertia feel the same on both surfaces and a second answer to one question is how two surfaces start disagreeing.

View Source
const KeyRepeatWindow = QueryDebounce

KeyRepeatWindow is how long after a key press another press of the same key still counts as the same held-down burst. It is the figure the query row already debounces on, so a burst that ends inside one relist cannot straddle two.

View Source
const QueryDebounce = 250 * time.Millisecond

QueryDebounce is how long the browser waits after a keystroke before it spends a process on the new query. It is the protocol's stated figure, and it is a package constant rather than a literal because the conformance story ("search as you type costs one process per pause, not one per keystroke") depends on exactly this value.

Variables

This section is empty.

Functions

func IsBrowserMsg

func IsBrowserMsg(msg tea.Msg) bool

IsBrowserMsg reports whether msg is one of the browser's own answers or ticks. Hosts use it to route background traffic to pane-mode browsers without keeping their own list of the message types, which would go stale the moment one is added.

func OwnedKeys

func OwnedKeys() map[string]bool

OwnedKeys reports the keys the browser acts on, for a host that has to answer "does this surface claim that key" without keeping its own copy of the list.

func TabDescriptors

func TabDescriptors(cfg *config.Config, calls func(instance string) Calls) []plugin.Descriptor

TabDescriptors projects every configured protocol instance that declares a tab placement onto a descriptor with New attached.

It is a pure function of configuration: it runs no plugin, resolves nothing on PATH, and reads nothing from disk, so it is safe before the first frame. The describe result that fills in the plugin's real name arrives later, on the browser's own DescribedMsg.

Types

type ActCall

type ActCall struct {
	Instance string
	Browser  uint64
	Params   pluginhost.ActParams
	Context  *pluginhost.Context

	Generation uint64
}

ActCall is one typed operation.

type ActedMsg

type ActedMsg struct {
	Instance   string
	Browser    uint64
	Action     string
	Generation uint64
	Outcome    pluginhost.Outcome
	Err        error
}

ActedMsg is one action answer.

type Calls

type Calls struct {
	// Describe reports the newest describe outcome for this instance. The bool
	// is false until the host has run a describe pass at all.
	Describe func(instance string) (pluginhost.Description, pluginhost.Status, bool)

	// List asks for one page. The returned command must eventually produce a
	// ListedMsg carrying the same identity fields it was given.
	List func(ListCall) tea.Cmd

	// Get expands one row into one document, producing a GotMsg.
	Get func(GetCall) tea.Cmd

	// Act performs one typed operation, producing an ActedMsg.
	Act func(ActCall) tea.Cmd

	// OpenURL opens a validated http(s) URL through the host's own confirmed
	// path. The browser validates before calling; a nil OpenURL means `o` does
	// nothing, which is what a surface with no way to open a browser wants.
	OpenURL func(url string) tea.Cmd

	// Context is the host context on offer for this surface. The host boundary
	// narrows it to the kinds the plugin declared, so offering more than a
	// plugin reads is safe. Nil means no context at all.
	Context func() *pluginhost.Context

	// Cancel drops whatever the host has in flight for a pane key, killing its
	// process group. A browser calls it for its own keys when it closes; a nil
	// Cancel means the host keeps no in-flight calls to drop.
	Cancel func(paneKey string)

	// Now is the clock relative timestamps are measured against. Nil means
	// time.Now; a test supplies its own so a timeline renders the same string
	// on every run.
	Now func() time.Time
}

Calls is the seam between the browser and whatever owns the plugin host.

Every field is a function the host supplies. Describe reads already-cached state and must not start anything; List, Get and Act return commands, so the process spawn happens inside a tea.Cmd and never on the render path.

A zero Calls is usable: the browser then renders a loading card and does nothing, which is exactly what it should do before the host has described anything.

type ChangedMsg

type ChangedMsg struct {
	Instance   string
	Collection string
}

ChangedMsg says one plugin's data moved and its visible tabs should re-list.

It arrives from `sidecar plugin changed` on the request bus — the poke a plugin gives Sidecar when the change is not a file it declared under refresh.watch. An empty Collection means every collection of that plugin, which is what a tool that does not know what it touched should say.

type DescribedMsg

type DescribedMsg struct{}

DescribedMsg tells every browser that a describe pass has settled, so it can re-read its host's cached description rather than polling for one.

It is broadcast rather than addressed: a describe pass covers every configured instance, and a browser that is not the subject simply finds its own state unchanged.

type DetailQuietMsg

type DetailQuietMsg struct {
	Instance   string
	Browser    uint64
	Collection string
	ID         string
	Sequence   uint64
	// Describe is the describe generation the schedule was made under. A
	// plugin that re-described in the meantime may not declare this collection
	// at all any more, and a load against the old declaration would be a
	// question about a surface that no longer exists.
	Describe uint64
}

DetailQuietMsg fires DetailQuiet after a cursor move. Only the newest sequence may load, and only if the cursor is still on the row it was scheduled for and the plugin has not re-described since.

It is exported for the same reason QueryDebouncedMsg is: a pane-mode browser's ticks travel the host's message bus, and a host cannot route a type it cannot name.

type Focus

type Focus string

Focus names the two windows inside the browser. They are the browser's own focus ring, projected to the host through PaneFocusProvider rather than duplicated by it.

const (
	// FocusList is the collection table.
	FocusList Focus = "list"
	// FocusDetail is the document box beside it.
	FocusDetail Focus = "detail"
)

type GetCall

type GetCall struct {
	Instance string
	Browser  uint64
	// PaneKey identifies the asking detail box. A second get for the same key
	// supersedes the first, which kills the earlier call's process group; that
	// is what makes a detail box that follows the cursor cost one process
	// rather than one per row.
	PaneKey string
	Params  pluginhost.GetParams
	Context *pluginhost.Context
	// Refresh bypasses cached freshness for this call.
	Refresh bool

	Generation uint64
}

GetCall is one request to expand a row.

type GotMsg

type GotMsg struct {
	Instance   string
	Browser    uint64
	Collection string
	ID         string
	Generation uint64
	Document   resource.Document
	Err        error
}

GotMsg is one document answer.

type ListCall

type ListCall struct {
	Instance string
	// Browser identifies the asking browser. Two browsers of one plugin — a
	// global tab and a pane showing the same collection — are two independent
	// readers with independent generations, so an answer must name which one
	// asked or the tab's page lands in the pane.
	Browser uint64
	// PaneKey identifies the asking surface. A second list for the same key
	// supersedes the first, which kills the earlier call's process group; that
	// is what makes search-as-you-type affordable with one-shot processes.
	PaneKey string
	Params  pluginhost.ListParams
	Context *pluginhost.Context

	// Generation stamps the answer so a late page cannot land after the query,
	// view, sort or collection it belonged to has moved on.
	Generation uint64
	// Append marks a page requested with a cursor, whose items extend the
	// current list rather than replacing it.
	Append bool
}

ListCall is one request for a page of one collection.

type ListedMsg

type ListedMsg struct {
	Instance   string
	Browser    uint64
	Collection string
	Generation uint64
	Append     bool
	Page       pluginhost.Page
	Err        error
}

ListedMsg is one page answer.

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is one protocol plugin in one content box.

func New

func New(instance, name string, calls Calls, renderer *markdown.Renderer) *Model

New builds a browser for one configured instance.

Construction does no I/O and starts nothing: the model renders a loading card until the host's describe pass has settled, which is what keeps a protocol plugin off the first-frame path.

func (*Model) AbandonSelection

func (m *Model) AbandonSelection() textselect.Result

AbandonSelection ends a gesture whose release never arrived.

func (*Model) ActiveCollection

func (m *Model) ActiveCollection() (pluginhost.Collection, bool)

ActiveCollection is the collection on screen, and whether there is one.

func (*Model) ArmPaneDocument

func (m *Model) ArmPaneDocument(collection, id string, filters map[string]string)

ArmPaneDocument points the browser at one row without fetching it. A restored tab starts here, so relaunch does not fan out one process per remembered tab and the strip still names what each tab is. It carries the scope for the same reason SetPaneDocument does: the fetch that follows is the armed one.

func (*Model) BlocksGlobalKeys

func (m *Model) BlocksGlobalKeys() bool

BlocksGlobalKeys reports that an overlay owns the keyboard.

func (*Model) ClaimsKey

func (m *Model) ClaimsKey(key string) bool

ClaimsKey reports whether the browser would act on a key in its current state. It is what the host's key ladder asks at precedence level 3.

func (*Model) ClearQuery

func (m *Model) ClearQuery() tea.Cmd

ClearQuery is the filter-clear command's entry point, for a host that reaches it from the palette rather than from the row.

func (*Model) ClearSelection

func (m *Model) ClearSelection()

ClearSelection drops the selection and any gesture editing it.

func (*Model) Close

func (m *Model) Close()

Close releases what this browser has in flight. A surface that goes away while a slow list or get is running must not leave a child process behind, and the manager cannot know a reader is gone unless the reader says so.

func (*Model) Collection

func (m *Model) Collection() (pluginhost.Collection, bool)

Collection returns the collection on screen for a host that needs its ID.

func (*Model) Collections

func (m *Model) Collections() []pluginhost.Collection

Collections are the collections the browser can show, which is every declared one. A collection that narrows itself to project context and has none is hidden: showing a tab that can only ever be empty claims a capability the surface does not have.

func (*Model) ConsumesTextInput

func (m *Model) ConsumesTextInput() bool

ConsumesTextInput reports that the query line has the keyboard, so the host forwards alphanumeric keys as typed text instead of running its shortcuts.

func (*Model) DescribeGeneration

func (m *Model) DescribeGeneration() uint64

DescribeGeneration counts the describe results this browser has adopted. The live-refresh binding validates its watch set once per generation rather than on every reconcile.

func (*Model) Described

func (m *Model) Described() bool

Described reports whether a describe result has landed.

func (*Model) Description

func (m *Model) Description() pluginhost.Description

Description returns the newest describe result.

func (*Model) DetailDocument

func (m *Model) DetailDocument() (resource.Document, bool)

DetailDocument returns the open document and whether there is one, for a host that needs its source URL or its identity.

func (*Model) Flash

func (m *Model) Flash() (string, bool)

Flash is the standing line an act outcome left, and whether it is an error. The host puts it in the footer; the browser never renders a footer of its own.

func (*Model) Focused

func (m *Model) Focused() bool

Focused reports whether the browser owns the keyboard.

func (*Model) GrantedKey

func (m *Model) GrantedKey(key string) (string, bool)

GrantedKey reports the action a plugin-suggested letter was granted for.

func (*Model) HandleKey

func (m *Model) HandleKey(msg tea.KeyPressMsg) (tea.Cmd, bool)

HandleKey routes one key press and reports whether the browser consumed it.

func (*Model) HandleKeyString

func (m *Model) HandleKeyString(key string) (tea.Cmd, bool)

HandleKeyString routes a key given as the string a host's key ladder already works in. It is the same path HandleKey takes, so a pane and a tab cannot answer one key differently.

func (*Model) HandleMouse

func (m *Model) HandleMouse(msg tea.MouseMsg) tea.Cmd

HandleMouse routes one pointer event. An open overlay wins, exactly as it does for keys; everything else resolves through the browser's own hit map.

func (*Model) HandlePaste

func (m *Model) HandlePaste(msg tea.PasteMsg) (tea.Cmd, bool)

HandlePaste puts a bracketed paste into the query row and reports whether it took it. A paste is text like any other: it goes through the same field, the same bound and the same debounce a typed key does.

func (*Model) HandleSelectionKey

func (m *Model) HandleSelectionKey(msg tea.KeyMsg) textselect.Result

HandleSelectionKey answers the chords that act on the selection: copy, select-all, and escape.

func (*Model) HandleSelectionMouse

func (m *Model) HandleSelectionMouse(action mouse.MouseAction) textselect.Result

HandleSelectionMouse advances the gesture over the detail box and reports what the host owes for it.

A drag that has run past an edge scrolls the box here rather than in the host: the window it is asking for is this model's own. The rows it reveals are selected by the next motion event, as the engine's contract says.

func (*Model) HasQuery

func (m *Model) HasQuery() bool

HasQuery reports that the collection on screen is narrowed by a query, which is the condition the × is drawn under and the filter-clear command offered under. One rule for the key and the pointer.

func (*Model) HasSelection

func (m *Model) HasSelection() bool

HasSelection reports whether anything in the detail box is selected. It is asked outside a render — by a key, by a click elsewhere — so it settles the expiry itself rather than reporting a selection the next frame will drop.

func (*Model) Instance

func (m *Model) Instance() string

Instance is the configured instance ID this browser renders.

func (*Model) ListShare

func (m *Model) ListShare() int

ListShare reports the list's current share of the box, for a test or a host that needs to see what a drag left behind.

func (*Model) Name

func (m *Model) Name() string

Name is the display name: the plugin's own once describe has landed, and the configured ID until then. It never changes to something the settings page and the CLI would disagree with, because both read the same describe result.

func (*Model) OverlayOpen

func (m *Model) OverlayOpen() bool

OverlayOpen reports whether a modal is up, for a host deciding whether the surface owns the keyboard.

func (*Model) PaneCollection

func (m *Model) PaneCollection() string

PaneCollection is the pinned collection ID.

func (*Model) PaneCursorID

func (m *Model) PaneCursorID() string

func (*Model) PaneDocument

func (m *Model) PaneDocument() (resource.Document, bool)

PaneDocument exposes a document tab's loaded document, which is what a host asks for to answer "is there anything here to link".

func (*Model) PaneDocumentID

func (m *Model) PaneDocumentID() string

PaneDocumentID is the row ID a document tab was opened for.

func (*Model) PaneDocumentIdentity

func (m *Model) PaneDocumentIdentity() string

PaneDocumentIdentity is the provider-stable identity of a document tab's document, once it has landed. The host re-keys the tab to it, exactly as a resolve already re-keys a resource card.

func (*Model) PaneDocumentShowing

func (m *Model) PaneDocumentShowing(id string) bool

PaneDocumentShowing reports that this pane is already showing (or fetching) the row named by id, so re-selecting it needs no process.

func (*Model) PaneFilters

func (m *Model) PaneFilters() map[string]string

PaneFilters is the applied filter set, as the map the wire and the persisted record both use. It is a copy: a tab's state must not be editable through what the host saved.

func (*Model) PaneFocus

func (m *Model) PaneFocus() string

PaneFocus is the focused window's ID.

func (*Model) PaneFocusStops

func (m *Model) PaneFocusStops() []string

PaneFocusStops names the browser's two windows for the app-owned focus ring. The detail box is a stop only when there is something in it; a ring entry that lands on a blank card is a stop the user cannot use.

func (*Model) PanePollSeconds

func (m *Model) PanePollSeconds() int

PanePollSeconds is the declared poll interval for what this pane is showing, already clamped by describe validation. Zero means the plugin declared none and nothing should tick.

func (*Model) PaneQuery

func (m *Model) PaneQuery() string

PaneQuery, PaneView, PaneSort and PaneCursorID are the collection tab's view position, which is what the host persists and restores. They read the live state rather than a copy, so a tab saved mid-query saves the query the user can see.

func (*Model) PaneRefresh

func (m *Model) PaneRefresh() tea.Cmd

PaneRefresh re-reads whatever this pane is showing. It is what the live refresh binding drives on both surfaces and what `r` runs, so a watched file changing and the user pressing a key do exactly the same thing.

func (*Model) PaneScroll

func (m *Model) PaneScroll(delta int) bool

PaneScroll is the wheel over a pane-mode browser. Over a list it moves the cursor, which is what "scrolling a list" means everywhere else in Sidecar; over a document it moves the viewport.

func (*Model) PaneScrollAtBoundary

func (m *Model) PaneScrollAtBoundary(delta int) bool

PaneScrollAtBoundary reports whether a scroll would move nothing, so the host hands the wheel to whatever is underneath instead of swallowing it.

func (*Model) PaneShape

func (m *Model) PaneShape() PaneShape

PaneShape reports which shape the browser is in, if any.

func (*Model) PaneSort

func (m *Model) PaneSort() string

func (*Model) PaneSourceURL

func (m *Model) PaneSourceURL() string

PaneSourceURL is the validated http(s) URL `o` would open in this pane.

func (*Model) PaneTabLabel

func (m *Model) PaneTabLabel() string

PaneTabLabel is the tab strip's text for this pane. A collection tab is named by its collection so two collections of one plugin are told apart; a document tab is named by what it is showing.

func (*Model) PaneTitle

func (m *Model) PaneTitle() string

PaneTitle is the leaf header's label: the collection's declared title for a collection tab, and the document's own title for a document tab. Neither falls back to the plugin's name, because the leaf header already carries it.

func (*Model) PaneView

func (m *Model) PaneView() string

func (*Model) PaneViewApplied

func (m *Model) PaneViewApplied() bool

PaneViewApplied reports that a restored view position has been folded into live collection state. Until it has, the reference the host holds is still the authority on what this tab is showing.

func (*Model) PaneWatchPaths

func (m *Model) PaneWatchPaths() []string

PaneWatchPaths are the declared watch paths of whatever this pane is showing.

It reads the cached describe snapshot and nothing else: it runs on the update goroutine on every live-refresh reconcile, so resolving anything here would be exactly the hidden per-frame filesystem cost the startup rules exist to prevent. A collection with no refresh declaration contributes none, which is how a plugin opts out of being watched.

func (*Model) QuitKeyExits

func (m *Model) QuitKeyExits() bool

QuitKeyExits reports whether `q` should reach sidecar's quit flow. It does everywhere except while the query line is taking text, where `q` is a letter.

func (*Model) Refresh

func (m *Model) Refresh() tea.Cmd

Refresh re-reads the host's describe result and re-lists the active collection if anything it depends on moved. It is what a DescribedMsg and the first focus both run.

func (*Model) Regions

func (m *Model) Regions() []mouse.Region

Regions exposes the hit map's regions, for tests that assert what a frame made clickable.

func (*Model) RestorePaneView

func (m *Model) RestorePaneView(query, view, sort, cursorID string, filters map[string]string)

RestorePaneView reinstates a persisted collection tab's view position before anything is listed, so the first list is the one the user was reading rather than the collection's default page followed by a correction.

cursorID is the row the cursor was on. It is applied when the page it names arrives, because the row's position in a re-listed page is not knowable here.

func (*Model) ScrollAtBoundary

func (m *Model) ScrollAtBoundary(delta int) bool

ScrollAtBoundary reports whether a scroll of delta would move nothing, so a host can hand the wheel event to whatever is underneath instead of swallowing it.

func (*Model) ScrollAtBoundaryAt

func (m *Model) ScrollAtBoundaryAt(x, y, delta int) bool

ScrollAtBoundaryAt reports whether a wheel notch at a point would move nothing, answered for the box under the pointer rather than the focused one, so the host can hand the notch to whatever is underneath.

func (*Model) ScrollBy

func (m *Model) ScrollBy(delta int) (tea.Cmd, bool)

ScrollBy moves whichever window has focus, and reports the follow-load schedule alongside whether anything moved.

Over the list this is a cursor move like any other, so it schedules the detail that goes with the row it lands on. The cmd has to reach the host's Update or the follow never runs — and worse, a follow already scheduled from the keyboard is invalidated by the newer generation this move stamps, so a dropped cmd leaves the detail showing a row the cursor has left.

func (*Model) SelectionCopyCmd

func (m *Model) SelectionCopyCmd(result textselect.Result, wrap func(textselect.CopyNotice) tea.Msg) tea.Cmd

SelectionCopyCmd delivers the copy an engine result asked for, phrased by the shared pipeline and wrapped in whatever notification type the host uses.

func (*Model) SelectionText

func (m *Model) SelectionText() []string

SelectionText is the selection as the user sees it: the rows it covers, without the styling they were drawn with.

func (*Model) SetCalls

func (m *Model) SetCalls(calls Calls)

SetCalls replaces the host seam. A browser built before the host had a manager observes one appearing this way.

func (*Model) SetFocused

func (m *Model) SetFocused(focused bool)

SetFocused records whether the browser owns the keyboard.

func (*Model) SetOnOpenRow

func (m *Model) SetOnOpenRow(open func(collection, id string, filters map[string]string) tea.Cmd)

SetOnOpenRow installs what Enter on a row does in pane mode. A pane has no room for the document beside the list, so the host opens it as a second tab in the same leaf; without a handler Enter does nothing rather than replacing the list.

func (*Model) SetPaneCollection

func (m *Model) SetPaneCollection(id string)

SetPaneCollection puts the browser in pane mode showing one collection.

The collection is pinned: the browser never cycles off it, and a describe that stops declaring it leaves the pane saying so rather than quietly showing a different collection under the same tab.

func (*Model) SetPaneDocument

func (m *Model) SetPaneDocument(collection, id string, filters map[string]string) tea.Cmd

SetPaneDocument puts the browser in pane mode showing one document, and returns the command that fetches it. A document tab has no list.

filters is the applied set of the list the row was found in. It is not optional decoration: a row found under a filter-chosen scope has to expand under that scope, and a document tab has no list of its own to read it from.

func (*Model) SetPaneFocus

func (m *Model) SetPaneFocus(id string)

SetPaneFocus moves focus within the browser.

func (*Model) SetPaneFocusActive

func (m *Model) SetPaneFocusActive(active bool)

SetPaneFocusActive records whether the browser's inner focus chrome should be drawn, which is false while an app-level surface holds the keyboard.

func (*Model) SetReservedKeys

func (m *Model) SetReservedKeys(keys map[string]bool)

SetReservedKeys records the keys the surface already binds, so a plugin-suggested action letter that collides with one is refused rather than silently stealing it.

func (*Model) SetSelection

func (m *Model) SetSelection(keys textselect.Keys, copyOnSelect bool)

SetSelection binds the host's shared selection settings: the chords the detail answers, and whether finishing a drag copies without being asked.

func (*Model) SetSize

func (m *Model) SetSize(width, height int)

SetSize records the content box.

func (*Model) Status

func (m *Model) Status() pluginhost.Status

Status returns the newest describe status.

func (*Model) Update

func (m *Model) Update(msg tea.Msg) tea.Cmd

Update routes one message. It returns only commands; nothing here starts a process itself.

func (*Model) View

func (m *Model) View() string

View renders the browser, held to exactly the box it was given. A content that hands back more rows than its box would push the app header off screen, so the fit is enforced here rather than trusted to the caller.

func (*Model) ViewIsSelfConstrained

func (m *Model) ViewIsSelfConstrained() bool

ViewIsSelfConstrained reports that View already returns exactly the box it was given, so the shell skips its defensive clamp.

type PaneShape

type PaneShape int

PaneShape names which of a Resource leaf's two tab shapes a pane-mode browser is showing.

const (
	// PaneNone is a browser that is not in pane mode.
	PaneNone PaneShape = iota
	// PaneCollection is a collection tab: the list, full width.
	PaneCollection
	// PaneDocument is a document tab: one document, full width.
	PaneDocument
)

type QueryDebouncedMsg

type QueryDebouncedMsg struct {
	Instance   string
	Collection string
	Sequence   uint64
}

QueryDebouncedMsg fires QueryDebounce after a keystroke. Only the newest sequence for a collection is acted on; every earlier one is a keystroke the user typed past.

It is exported because a pane-mode browser's ticks travel the host's message bus like every other background answer, and a host cannot route a type it cannot name.

type TabPlugin

type TabPlugin struct {
	// contains filtered or unexported fields
}

TabPlugin hosts one browser as a navbar surface. Its Calls are built once, at construction: each closure reads the live manager when it runs, so a browser built before the host had one observes it appearing without the render path rebuilding a seam every frame.

It is the whole of what a protocol plugin needs to be a tab: the descriptor says it has one, the app builds a globalPluginHost around this, and every capability the shell asks for is answered here rather than by each plugin.

func NewTabPlugin

func NewTabPlugin(instance, name string, calls func(instance string) Calls) *TabPlugin

NewTabPlugin builds the tab surface for one configured instance. It performs no I/O and starts nothing: everything it shows comes from a describe pass the host runs after the first ready frame.

func (*TabPlugin) BlocksGlobalKeys

func (p *TabPlugin) BlocksGlobalKeys() bool

BlocksGlobalKeys reports that a modal owns the keyboard.

func (*TabPlugin) ClaimsKey

func (p *TabPlugin) ClaimsKey(key string) bool

ClaimsKey reports a live contextual binding, at precedence level 3.

func (*TabPlugin) ClearSelection

func (p *TabPlugin) ClearSelection()

ClearSelection drops the detail box's selection. See HasSelection.

func (*TabPlugin) Commands

func (p *TabPlugin) Commands() []plugin.Command

Commands are the footer's, in the order the design language asks for: frequency of use, not alphabetical.

func (*TabPlugin) ConsumesTextInput

func (p *TabPlugin) ConsumesTextInput() bool

ConsumesTextInput forwards typed text to the query line instead of running the host's shortcuts.

func (*TabPlugin) ContentLinkSurfaces

func (p *TabPlugin) ContentLinkSurfaces() []contentlink.Surface

ContentLinkSurfaces publishes the detail box as read-only rendered text, so an issue key or a path in a plugin's document is clickable exactly as it is everywhere else. Nothing in it is renderer-owned: a body may be the plugin's own bytes word-wrapped, and an OSC-8 sequence in those is authored content.

func (*TabPlugin) Diagnostics

func (p *TabPlugin) Diagnostics() []plugin.Diagnostic

Diagnostics report what the host knows about this instance without running anything: the describe state, what it declared, and the last typed failure.

func (*TabPlugin) FocusContext

func (p *TabPlugin) FocusContext() string

FocusContext is per instance, because a plugin-granted action letter belongs to one plugin and a shared context would put it on every plugin's footer. An open overlay reports its own, so the footer describes what has the keyboard.

func (*TabPlugin) FooterStatus

func (p *TabPlugin) FooterStatus() (string, bool)

FooterStatus is the standing condition the host right-aligns on the footer. A describe that failed is a condition that stays true until someone fixes it, which is exactly what this line is for; the outcome of the page on screen is the rest of the time's honest answer.

func (*TabPlugin) HasSelection

func (p *TabPlugin) HasSelection() bool

HasSelection reports whether the detail box currently holds a selection, and ClearSelection drops it. They are this plugin's half of the host's one selection at a time rule. The detail box is drawn on the same screen as the deck's content panes, so a gesture started in either has to be able to drop the other's; without them a highlight in the detail sits beside a highlight in an issue card, and the copy chord — which follows the keyboard, not the highlight — answers for whichever of the two the reader is not looking at.

func (*TabPlugin) HostOwnsPaneFocusRing

func (p *TabPlugin) HostOwnsPaneFocusRing() bool

HostOwnsPaneFocusRing hands Tab and Shift+Tab to the app on a deck holding nothing but this browser's Primary leaf. It is the same statement browserOwnedKeys makes by leaving `tab` out: the focus ring is the host's on every other surface, and a protocol plugin gets it without binding anything.

func (*TabPlugin) ID

func (p *TabPlugin) ID() string

func (*TabPlugin) Icon

func (p *TabPlugin) Icon() string

Icon is the header glyph. A protocol plugin declares none, so the host takes the first letter of its name — which is what the header would have shown anyway, and never a glyph a plugin could pick to impersonate a built-in tab.

func (*TabPlugin) Init

func (p *TabPlugin) Init(ctx *plugin.Context) error

Init records the host context and publishes the browser's key table. It does no I/O: a protocol plugin's first process runs after the first ready frame, from the host's describe pass.

func (*TabPlugin) IsFocused

func (p *TabPlugin) IsFocused() bool

func (*TabPlugin) Model

func (p *TabPlugin) Model() *Model

Model exposes the browser, for a host that needs to read its state.

func (*TabPlugin) Name

func (p *TabPlugin) Name() string

func (*TabPlugin) PaneFocus

func (p *TabPlugin) PaneFocus() string

func (*TabPlugin) PaneFocusStops

func (p *TabPlugin) PaneFocusStops() []plugin.PaneFocusStop

PaneFocusStops projects the browser's two windows into the app-owned ring.

func (*TabPlugin) QuitKeyExits

func (p *TabPlugin) QuitKeyExits() bool

QuitKeyExits reports whether `q` reaches sidecar's quit flow.

func (*TabPlugin) SetFocused

func (p *TabPlugin) SetFocused(focused bool)

func (*TabPlugin) SetPaneFocus

func (p *TabPlugin) SetPaneFocus(id string) tea.Cmd

func (*TabPlugin) SetPaneFocusActive

func (p *TabPlugin) SetPaneFocusActive(active bool)

func (*TabPlugin) SetSelection

func (p *TabPlugin) SetSelection(keys textselect.Keys, copyOnSelect bool)

SetSelection binds the host's shared selection settings to the detail box. The host resolves them from config once for every surface it draws, and a plugin that owns a selectable box inside its own frame is one of them: reading config here would be a second answer to a settled question.

func (*TabPlugin) Start

func (p *TabPlugin) Start() tea.Cmd

Start returns no command. Everything the browser shows arrives on a DescribedMsg the host broadcasts once its describe pass has settled, so nothing here waits on a process.

func (*TabPlugin) Stop

func (p *TabPlugin) Stop()

Stop drops what this browser has in flight. The manager owns every child process, but it cannot know a reader has gone away unless the reader says so, and a tab closed over a slow get would otherwise leave that process running to nobody.

func (*TabPlugin) Update

func (p *TabPlugin) Update(msg tea.Msg) (plugin.Plugin, tea.Cmd)

func (*TabPlugin) View

func (p *TabPlugin) View(width, height int) string

func (*TabPlugin) ViewIsSelfConstrained

func (p *TabPlugin) ViewIsSelfConstrained() bool

ViewIsSelfConstrained reports that View returns exactly the box it was given.

func (*TabPlugin) WheelAtBoundary

func (p *TabPlugin) WheelAtBoundary(msg tea.MouseWheelMsg) bool

WheelAtBoundary drops an inertia event that cannot move the surface. It is answered for the box under the pointer, because that is the box the notch would have scrolled.

Jump to

Keyboard shortcuts

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