Documentation
¶
Overview ¶
Package client exposes typed Pencode services over any owned byte stream.
Index ¶
- Variables
- type Client
- func (c *Client) BeginExtension(ctx context.Context) (*ExtensionUpload, error)
- func (c *Client) BrowseDirectory(ctx context.Context, directory string) (string, string, []string, error)
- func (c *Client) Close() error
- func (c *Client) CloseIndex(ctx context.Context, id uint64) error
- func (c *Client) CloseWorkspace(ctx context.Context, id uint64) error
- func (c *Client) Create(ctx context.Context, workspace uint64, path string, directory bool) error
- func (c *Client) Diff(ctx context.Context, left, right string) ([]byte, error)
- func (c *Client) DisableExtension(ctx context.Context, id string) (protocol.ExtensionInfo, error)
- func (c *Client) Done() <-chan struct{}
- func (c *Client) Err() error
- func (c *Client) ForwardPort(parent context.Context, remote protocol.Port, options ForwardOptions) (*Forward, error)
- func (c *Client) Git(ctx context.Context, root string, args ...string) ([]byte, error)
- func (c *Client) GitRepositories(ctx context.Context, root string) ([]string, error)
- func (c *Client) Import(ctx context.Context, target uint64, source, directory string, overwrite bool) (string, error)
- func (c *Client) IndexPage(ctx context.Context, id uint64, offset int, dst []protocol.IndexEntry) ([]protocol.IndexEntry, bool, string, error)
- func (c *Client) ListExtensions(ctx context.Context) (ExtensionCatalog, error)
- func (c *Client) ListeningPorts(ctx context.Context) ([]protocol.Port, error)
- func (c *Client) LoadExtension(ctx context.Context, id string) (*Extension, error)
- func (c *Client) NewSyntax(ctx context.Context) *Syntax
- func (c *Client) OpenDebugAdapter(ctx context.Context, root, adapter, command, address string, args []string) (*Process, error)
- func (c *Client) OpenDebugTerminal(ctx context.Context, root string, command protocol.TerminalCommand) (*Process, int, error)
- func (c *Client) OpenDocument(ctx context.Context, workspace uint64, path string, mode protocol.DocumentMode) (*Document, string, error)
- func (c *Client) OpenIndex(ctx context.Context, root string) (uint64, error)
- func (c *Client) OpenProcess(ctx context.Context, root, name string, args ...string) (*Process, error)
- func (c *Client) OpenTerminal(ctx context.Context, root string, cols, rows int) (*Process, error)
- func (c *Client) OpenWorkspace(ctx context.Context, path string) (protocol.Workspace, error)
- func (c *Client) PrepareEnableExtension(ctx context.Context, id string) (*Extension, error)
- func (c *Client) ReadConfiguration(ctx context.Context) (configuration.Snapshot, error)
- func (c *Client) ReadFile(ctx context.Context, root, name string) ([]byte, error)
- func (c *Client) RefreshIndex(ctx context.Context, root string, previous uint64) (uint64, error)
- func (c *Client) Remove(ctx context.Context, workspace uint64, path string) error
- func (c *Client) RemoveExtension(ctx context.Context, id string) error
- func (c *Client) Rename(ctx context.Context, workspace uint64, from, to string) error
- func (c *Client) SaveFile(ctx context.Context, root, name, before, after string) error
- func (c *Client) SaveSettings(ctx context.Context, data []byte) error
- func (c *Client) SearchPaths(ctx context.Context, id uint64, query string, preferred []string) ([]string, error)
- func (c *Client) SearchText(ctx context.Context, root, directory, query string, options textsearch.Options, ...) (protocol.SearchResult, error)
- func (c *Client) Transfer(ctx context.Context, source, target uint64, from, directory string, ...) (string, error)
- func (c *Client) WatchFiles(root string) *FileWatch
- func (c *Client) WorkFile(ctx context.Context, root, name string) ([]byte, error)
- type Directories
- type Document
- func (d *Document) Close()
- func (d *Document) Move(ctx context.Context, workspace uint64, path string) error
- func (d *Document) Page() protocol.DocumentPage
- func (d *Document) ReadPage(ctx context.Context, offset uint64) (string, protocol.DocumentPage, error)
- func (d *Document) Release()
- func (d *Document) Save(ctx context.Context, content string) error
- func (d *Document) SaveSnapshot[V piecetree.Value](ctx context.Context, value V) error
- func (d *Document) Update[V piecetree.Value](baseValue, contentValue V, start, oldEnd, newEnd int)
- type Extension
- func (x *Extension) Abort(ctx context.Context) error
- func (x *Extension) Commit(ctx context.Context) (protocol.ExtensionInfo, error)
- func (x *Extension) FS(ctx context.Context, cache map[string][]byte) fs.FS
- func (x *Extension) OpenLanguageServer(ctx context.Context, root, id string) (*Process, error)
- func (x *Extension) OpenProcess(ctx context.Context, root string) (*Process, error)
- func (x *Extension) ReadResource(ctx context.Context, name string, limit int64) ([]byte, error)
- func (x *Extension) ReadResources(ctx context.Context, names []string, limit int64) (map[string][]byte, error)
- func (x *Extension) ReadWorkspaceFile(ctx context.Context, root, name string, limit int) ([]byte, error)
- type ExtensionCatalog
- type ExtensionUpload
- type FileWatch
- type Forward
- type ForwardOptions
- type Process
- type Syntax
- func (s *Syntax) Close()
- func (s *Syntax) Language() string
- func (s *Syntax) Tokens(theme *syntax.Theme, definitions *syntax.Definitions) []syntax.Token
- func (s *Syntax) Update[V piecetree.Value](path string, value V) error
- func (s *Syntax) UpdateSnapshot(path string, source piecetree.Snapshot) error
Constants ¶
This section is empty.
Variables ¶
var ErrBusy = errors.New("pencode: request queue is full")
var ErrClosed = errors.New("pencode: server connection closed")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) BeginExtension ¶
func (c *Client) BeginExtension(ctx context.Context) (*ExtensionUpload, error)
func (*Client) BrowseDirectory ¶
func (c *Client) BrowseDirectory(ctx context.Context, directory string) (string, string, []string, error)
BrowseDirectory enumerates project choices without opening a workspace.
func (*Client) CloseWorkspace ¶
func (*Client) DisableExtension ¶
func (*Client) Done ¶
func (c *Client) Done() <-chan struct{}
Done closes as soon as transport failure makes every handle unusable.
func (*Client) ForwardPort ¶
func (*Client) GitRepositories ¶
func (*Client) Import ¶
func (c *Client) Import(ctx context.Context, target uint64, source, directory string, overwrite bool) (string, error)
Import copies a native file on the server host into a workspace.
func (*Client) ListExtensions ¶
func (c *Client) ListExtensions(ctx context.Context) (ExtensionCatalog, error)
func (*Client) ListeningPorts ¶
func (*Client) LoadExtension ¶
func (*Client) OpenDebugAdapter ¶
func (c *Client) OpenDebugAdapter(ctx context.Context, root, adapter, command, address string, args []string) (*Process, error)
OpenDebugAdapter returns the same owned, flow-controlled stream for local and SSH workspaces. Delve selects an ephemeral loopback port on the server.
func (*Client) OpenDebugTerminal ¶
func (*Client) OpenDocument ¶
func (*Client) OpenProcess ¶
func (*Client) OpenTerminal ¶
func (*Client) OpenWorkspace ¶
func (*Client) PrepareEnableExtension ¶
func (*Client) ReadConfiguration ¶
func (*Client) RefreshIndex ¶
RefreshIndex reuses the previous snapshot and rereads directories reported by the native watcher. A missing or invalid snapshot is rebuilt in full.
func (*Client) RemoveExtension ¶
func (*Client) SearchPaths ¶
func (*Client) SearchText ¶
func (c *Client) SearchText(ctx context.Context, root, directory, query string, options textsearch.Options, documents []protocol.SearchDocument) (protocol.SearchResult, error)
func (*Client) WatchFiles ¶
type Directories ¶
Directories supplies only directory enumeration to the existing scanner. File content is accessed through versioned Document APIs.
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document keeps one latest immutable edit snapshot. Submitting an edit never waits for I/O and does not allocate. A worker coalesces intermediate snapshots and sends ordered, versioned deltas; saves explicitly wait for that barrier.
func (*Document) Page ¶
func (d *Document) Page() protocol.DocumentPage
Page describes only the currently loaded window; Content and snapshots for a paged document never represent the unloaded remainder of the file.
func (*Document) ReadPage ¶
func (d *Document) ReadPage(ctx context.Context, offset uint64) (string, protocol.DocumentPage, error)
ReadPage flushes edits to the server's disk-backed document, without saving. The caller must stop submitting edits until this operation has returned.
func (*Document) Release ¶
func (d *Document) Release()
Release retires a handle without waiting on the transport. Close additionally waits for cleanup and is intended for workers and connection shutdown.
func (*Document) SaveSnapshot ¶
SaveSnapshot persists exactly content while Update may continue accepting newer GUI edits. The document worker owns both the version and save barrier; newer text is restored in memory afterwards and is never saved implicitly.
type Extension ¶
type Extension struct {
Info protocol.ExtensionInfo
Diagnostics string
Contributions peb.Contributions
Handle uint64
// contains filtered or unexported fields
}
Extension is a connection-scoped server registration. No executable or asset path is interpreted on the GUI host.
func (*Extension) Commit ¶
Commit publishes a prepared package or persists a validated enable operation.
func (*Extension) FS ¶
FS lets appearance loaders consume remote resources through the standard Go filesystem interface. Each open returns bounded, memory-owned bytes.
func (*Extension) OpenLanguageServer ¶
func (*Extension) OpenProcess ¶
func (*Extension) ReadResource ¶
type ExtensionCatalog ¶
type ExtensionCatalog struct {
Directory string
Items []protocol.ExtensionInfo
}
type ExtensionUpload ¶
type ExtensionUpload struct {
// contains filtered or unexported fields
}
type FileWatch ¶
type FileWatch struct {
// contains filtered or unexported fields
}
FileWatch is an independent cursor over the file service's bounded event journal. Cancellation leaves the cursor intact so retry never loses a batch.
type Forward ¶
type Forward struct {
// contains filtered or unexported fields
}
Forward owns a local TCP listener and every connection accepted on it. Both the caller context and the backend connection bound its lifetime.
type ForwardOptions ¶
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
Process is a flow-controlled stdio/PTY stream. Each reader has at most one outstanding receive of up to StreamWindow bytes; an idle stream cannot block the connection reader. Writes are serialized so concurrent callers cannot interleave the fragments of a logical Write.