Documentation
¶
Overview ¶
Package debug is the Run and Debug views (SPEC §10.31, step 25.4): the Variables, Watch, Call Stack, Breakpoints and Loaded Scripts views of the container, the welcome of the container, the debug toolbar and the pieces of the status bar. The views are models over the debug service of internal/core/debug (the sessions, threads, frames, variables and breakpoints are its data; a view only keeps what is expanded and selected) and widgets over kit's tree. Everything here runs on the UI thread: the events of the service come on any goroutine and are handed over with Opts.Post, and the requests the views make (the scopes of a frame, the children of a variable, the stack frames) run on goroutines of their own and hand their answer over the same way.
The window (internal/gui/app) binds the views to its menus, commands and context keys; the view of a client of a hosted workspace builds the same views over the host's service (D46).
Ported from VS Code: src/vs/workbench/contrib/debug/browser/variablesView.ts, watchExpressionsView.ts, callStackView.ts, breakpointsView.ts, loadedScriptsView.ts, welcomeView.ts, debugToolBar.ts, baseDebugView.ts and debugExpressionRenderer.ts
Index ¶
- Constants
- Variables
- func ConsoleRowKey(rowKey string) foundation.Key
- func HoverSize(root debug.Node, children int) (width, height float64)
- func IconColor(colors kit.Colors, commandID string) foundation.Opt[ui.Color]
- func InDebugMode(state debug.State, sessions []*debug.Session) bool
- func MessageKey(viewID string) foundation.Key
- func RowKey(viewID, rowKey string) foundation.Key
- func RowText(r ConsoleRow) string
- func ToolbarWidth(n int) float64
- func TreeKey(viewID string) foundation.Key
- func WelcomePieces(s WelcomeState) []welcome.Piece
- type Body
- type BodyOpts
- type BreakpointsPane
- func (b BreakpointsPane) CancelEdit()
- func (b BreakpointsPane) Controller() *kit.TreeController
- func (b *BreakpointsPane) Edit(r Row)
- func (b BreakpointsPane) Editing() bool
- func (b BreakpointsPane) EditingKey() string
- func (b BreakpointsPane) Focused() (Row, bool)
- func (b BreakpointsPane) ID() string
- func (b BreakpointsPane) Message() string
- func (b BreakpointsPane) Model() *kit.TreeModel
- func (b BreakpointsPane) OnChange(fn func()) func()
- func (b *BreakpointsPane) Remove(r Row)
- func (b *BreakpointsPane) Render(bc widgets.BuildContext, n kit.TreeNode, st kit.RowState) widgets.Widget
- func (b BreakpointsPane) Row(key string) (Row, bool)
- func (b BreakpointsPane) Selected() []Row
- func (b *BreakpointsPane) SetFolder(folder string)
- func (b BreakpointsPane) StartEdit(key, text string, done func(text string, ok bool))
- func (b *BreakpointsPane) Toggle(r Row)
- type CallStackArgs
- type CallStackPane
- func (b CallStackPane) CancelEdit()
- func (b CallStackPane) Controller() *kit.TreeController
- func (b CallStackPane) Editing() bool
- func (b CallStackPane) EditingKey() string
- func (b CallStackPane) Focused() (Row, bool)
- func (b CallStackPane) ID() string
- func (b CallStackPane) Message() string
- func (b CallStackPane) Model() *kit.TreeModel
- func (b CallStackPane) OnChange(fn func()) func()
- func (c *CallStackPane) Render(bc widgets.BuildContext, n kit.TreeNode, st kit.RowState) widgets.Widget
- func (b CallStackPane) Row(key string) (Row, bool)
- func (c *CallStackPane) Select(r Row)
- func (b CallStackPane) Selected() []Row
- func (b CallStackPane) StartEdit(key, text string, done func(text string, ok bool))
- type Console
- func (c *Console) Accept()
- func (c *Console) Clear()
- func (c *Console) CollapseAll()
- func (c *Console) Counts() (total, shown int)
- func (c *Console) Dispose()
- func (c *Console) Evaluate(text string)
- func (c *Console) FilterController() *kit.InputBoxController
- func (c *Console) FilterText() string
- func (c *Console) History() *kit.History
- func (c *Console) Input() *kit.InputBoxController
- func (c *Console) KeepEnd(atEnd bool)
- func (c *Console) Len() int
- func (c *Console) Multiple() bool
- func (c *Console) OnChange(fn func()) func()
- func (c *Console) OpenLink(p kit.LinkPart)
- func (c *Console) Paste(text string)
- func (c *Console) ReadOnly() bool
- func (c *Console) Refresh()
- func (c *Console) ResolveLink(p kit.LinkPart) bool
- func (c *Console) Rows() []ConsoleRow
- func (c *Console) Select(s *debug.Session)
- func (c *Console) Session() *debug.Session
- func (c *Console) Sessions() []*debug.Session
- func (c *Console) SetFilter(text string)
- func (c *Console) Toggle(key string) bool
- func (c *Console) VisibleText() string
- func (c *Console) WantsEnd() bool
- type ConsoleActions
- type ConsoleActionsOpts
- type ConsoleBody
- type ConsoleBodyOpts
- type ConsoleConfig
- type ConsoleOpts
- type ConsoleRow
- type ConsoleRowKind
- type ExpressionLine
- type FloatingToolbar
- type FloatingToolbarOpts
- type HoverOpts
- type HoverTree
- type LoadedPane
- func (b LoadedPane) CancelEdit()
- func (b LoadedPane) Controller() *kit.TreeController
- func (b LoadedPane) Editing() bool
- func (b LoadedPane) EditingKey() string
- func (b LoadedPane) Focused() (Row, bool)
- func (b LoadedPane) ID() string
- func (b LoadedPane) Message() string
- func (b LoadedPane) Model() *kit.TreeModel
- func (b LoadedPane) OnChange(fn func()) func()
- func (l *LoadedPane) Render(bc widgets.BuildContext, n kit.TreeNode, st kit.RowState) widgets.Widget
- func (b LoadedPane) Row(key string) (Row, bool)
- func (b LoadedPane) Selected() []Row
- func (l *LoadedPane) Sources() []debug.Source
- func (b LoadedPane) StartEdit(key, text string, done func(text string, ok bool))
- type Opts
- type Panes
- type Row
- type RowKind
- type TreePane
- type VariablesPane
- func (b VariablesPane) CancelEdit()
- func (v *VariablesPane) CollapseAll()
- func (b VariablesPane) Controller() *kit.TreeController
- func (b VariablesPane) Editing() bool
- func (b VariablesPane) EditingKey() string
- func (b VariablesPane) Focused() (Row, bool)
- func (v *VariablesPane) Frame() *debug.StackFrame
- func (b VariablesPane) ID() string
- func (b VariablesPane) Message() string
- func (b VariablesPane) Model() *kit.TreeModel
- func (b VariablesPane) OnChange(fn func()) func()
- func (v *VariablesPane) Render(bc widgets.BuildContext, n kit.TreeNode, st kit.RowState) widgets.Widget
- func (b VariablesPane) Row(key string) (Row, bool)
- func (b VariablesPane) Selected() []Row
- func (v *VariablesPane) SetValue(r Row)
- func (b VariablesPane) StartEdit(key, text string, done func(text string, ok bool))
- type WatchPane
- func (w *WatchPane) Add(text string)
- func (b WatchPane) CancelEdit()
- func (b WatchPane) Controller() *kit.TreeController
- func (b WatchPane) Editing() bool
- func (b WatchPane) EditingKey() string
- func (b WatchPane) Focused() (Row, bool)
- func (b WatchPane) ID() string
- func (w *WatchPane) Message() string
- func (b WatchPane) Model() *kit.TreeModel
- func (b WatchPane) OnChange(fn func()) func()
- func (w *WatchPane) Rename(e *debug.Expression)
- func (w *WatchPane) Render(bc widgets.BuildContext, n kit.TreeNode, st kit.RowState) widgets.Widget
- func (b WatchPane) Row(key string) (Row, bool)
- func (b WatchPane) Selected() []Row
- func (w *WatchPane) SetValue(r Row)
- func (b WatchPane) StartEdit(key, text string, done func(text string, ok bool))
- type WelcomeState
Constants ¶
const ( // HoverRowHeight is the height of a row of the tree. HoverRowHeight = 18.0 // HoverMinTreeHeight and HoverMaxTreeHeight bound the height of the tree; HoverWidth is the width of a box with a tree. HoverMinTreeHeight = 0.0 HoverMaxTreeHeight = 266.0 HoverWidth = 420.0 )
The metrics of the debug hover (debugHover.css).
const DefaultToolbarX = 0.5
DefaultToolbarX is the position of the center of the floating toolbar across the editor area (0.5, the middle).
const FilterAsyncLines = 1000
FilterAsyncLines is the number of elements from which the filter matches on a goroutine, after a delay.
const (
// LoadMoreFramesText is the row at the end of a call stack that is not loaded to its end.
LoadMoreFramesText = "Load More Stack Frames"
)
The texts of the Call Stack.
const MaxSuggestRows = 8
MaxSuggestRows is how many rows the list shows at once.
const MaxValueRenderLength = 1024
MaxValueRenderLength is how many characters of a value a view shows (VS Code's MAX_VALUE_RENDER_LENGTH_IN_VIEWLET).
const NoDebuggerText = "All debug extensions are disabled. Enable the extension of a language to debug it."
NoDebuggerText is the text of the welcome while no extension that contributes a debugger is enabled. VS Code's text sends the user to the Marketplace, which Emetos does not have.
const ToolbarHeight = 32.0
ToolbarHeight is the height of the floating toolbar.
Variables ¶
var ( // TreeKey is the key of the tree of a view, by the id of the view. TreeKeyPrefix = "debug:tree:" // MessageKey is the key of the text that stands in place of the tree of a view that has no rows. MessageKeyPrefix = "debug:message:" )
Keys of the widgets of the views, which tests find them by.
var ( // ConsoleListKey is the key of the list of rows and ConsoleInputKey that of the input box. ConsoleListKey = foundation.NewValueKey("debug:console:list") ConsoleInputKey = foundation.NewValueKey("debug:console:input") // ConsoleFilterKey is the key of the filter box, ConsoleClearKey that of the button that clears the console and ConsoleSessionsKey // that of the dropdown of the consoles. ConsoleFilterKey = foundation.NewValueKey("debug:console:filter") ConsoleClearKey = foundation.NewValueKey("debug:console:clear") ConsoleSessionsKey = foundation.NewValueKey("debug:console:sessions") // ConsoleSuggestKey is the key of the list of completions. ConsoleSuggestKey = foundation.NewValueKey("debug:console:suggest") )
Keys of the widgets of the console, which tests find them by.
var ( ToolbarKey = foundation.NewValueKey("debug:toolbar") ToolbarGripKey = foundation.NewValueKey("debug:toolbar-grip") )
ToolbarKey is the key of the floating toolbar, and ToolbarGripKey that of its gripper.
var DefaultConsoleConfig = ConsoleConfig{FontSize: 14, FontFamily: "default", WordWrap: true, HistorySuggestions: true}
DefaultConsoleConfig is VS Code's defaults of the settings.
var InputKey = foundation.NewValueKey("debug:inline-input")
InputKey is the key of the inline input.
Functions ¶
func ConsoleRowKey ¶
func ConsoleRowKey(rowKey string) foundation.Key
ConsoleRowKey is the key of the widget of a row, by the key of the row.
func HoverSize ¶
HoverSize is the size of the box for a root: the room of its rows (with the children that were loaded) and a title, a tip.
func IconColor ¶
IconColor is the color of the icon of a debug command (debugIcon.<name>Foreground); none for a command VS Code leaves in the normal icon color.
func InDebugMode ¶
InDebugMode says whether the status bar takes the debugging colors: a session runs (not one that is being started) that does not hide the status bar or run without debugging.
Ported from VS Code: src/vs/workbench/contrib/debug/browser/statusbarColorProvider.ts (isStatusbarInDebugMode)
func MessageKey ¶
func MessageKey(viewID string) foundation.Key
MessageKey is the key of the message of the view with the id.
func RowKey ¶
func RowKey(viewID, rowKey string) foundation.Key
RowKey is the key of the widget of a row of the tree of a view, which tests find it by.
func RowText ¶
func RowText(r ConsoleRow) string
RowText is the text of a row, without colors: what Copy puts on the clipboard.
func ToolbarWidth ¶
ToolbarWidth is about how wide a toolbar of n buttons is (the gripper and 22 px for each button, with the margins).
func TreeKey ¶
func TreeKey(viewID string) foundation.Key
TreeKey is the key of the tree of the view with the id.
func WelcomePieces ¶
func WelcomePieces(s WelcomeState) []welcome.Piece
WelcomePieces are the pieces of welcome content of the container in order: the link that opens a file, the button that starts, the text that sends to launch.json. The texts and the groups are VS Code's.
Ported from VS Code: src/vs/workbench/contrib/debug/browser/welcomeView.ts (the content registered for WelcomeView.ID)
Types ¶
type Body ¶
type Body struct {
widgets.StatefulWidget
// contains filtered or unexported fields
}
Body is the body of a view: the tree of its pane, or the pane's message while it has no rows.
func (*Body) CreateState ¶
CreateState implements widgets.StatefulWidget.
type BodyOpts ¶
type BodyOpts struct {
// Select is called when the user selects a row: a click, Enter. Open is called for Enter and a double click.
Select func(Row)
Open func(Row)
// Menu opens the context menu of a row at a position of the window; the row is zero for the part below the rows.
Menu func(row Row, ok bool, at ui.Offset)
// Actions gives the buttons of a row, shown while the pointer is over it or it is selected; RunAction runs one.
Actions func(Row) []kit.Action
RunAction func(row Row, id string)
// OnFocusChange is told when the tree gets or loses the keyboard focus.
OnFocusChange func(has bool)
// ToggleOnClick makes a click on an expandable row toggle it; the default of kit's tree.
ToggleOnClick foundation.Opt[bool]
}
BodyOpts are the options of NewBody.
type BreakpointsPane ¶
type BreakpointsPane struct {
// contains filtered or unexported fields
}
BreakpointsPane is the Breakpoints view: the exception filters of the focused session (of the one that was focused last when none runs) with their conditions, the function breakpoints, and the breakpoints of lines and columns, each with a check box that enables it, an icon that says what kind it is and whether the adapter verified it, its file with the folder dimmed after it, and the line in a badge. The list is flat; the setting debug.breakpointsView.presentation is registered and "tree" shows the same list (decision 1192).
Ported from VS Code: src/vs/workbench/contrib/debug/browser/breakpointsView.ts (BreakpointsView, BreakpointsRenderer, FunctionBreakpointsRenderer, ExceptionBreakpointsRenderer)
func (BreakpointsPane) CancelEdit ¶
func (b BreakpointsPane) CancelEdit()
CancelEdit closes the input without committing it.
func (BreakpointsPane) Controller ¶
func (b BreakpointsPane) Controller() *kit.TreeController
Controller gives access to the tree widget from outside (focus, reveal).
func (*BreakpointsPane) Edit ¶
func (b *BreakpointsPane) Edit(r Row)
Edit opens the input on a function breakpoint (its name) or an exception filter (its condition, when it takes one).
func (BreakpointsPane) Editing ¶
func (b BreakpointsPane) Editing() bool
Editing tells whether an inline input is open in the view; the tree leaves its keys to the input then.
func (BreakpointsPane) EditingKey ¶
func (b BreakpointsPane) EditingKey() string
EditingKey is the key of the row whose input is open, or "".
func (BreakpointsPane) Message ¶
func (b BreakpointsPane) Message() string
Message is the text the view shows in place of an empty tree.
func (BreakpointsPane) OnChange ¶
func (b BreakpointsPane) OnChange(fn func()) func()
OnChange calls fn after the rows or a value of the view changed, and returns the function that stops it.
func (*BreakpointsPane) Remove ¶
func (b *BreakpointsPane) Remove(r Row)
Remove removes the breakpoint of a row (Delete). An exception filter stays.
func (*BreakpointsPane) Render ¶
func (b *BreakpointsPane) Render(bc widgets.BuildContext, n kit.TreeNode, st kit.RowState) widgets.Widget
Render builds the contents of a row.
func (BreakpointsPane) Selected ¶
func (b BreakpointsPane) Selected() []Row
Selected are the rows that are selected, in the order of the tree.
func (*BreakpointsPane) SetFolder ¶
func (b *BreakpointsPane) SetFolder(folder string)
SetFolder gives the view the folder of the workspace, which the folders of the files are shown relative to.
func (BreakpointsPane) StartEdit ¶
StartEdit opens the inline input on the row of a key with a text. done is called once, with the text and true on Enter or when the input loses the focus, and with false on Escape. Another open input is closed as if cancelled.
func (*BreakpointsPane) Toggle ¶
func (b *BreakpointsPane) Toggle(r Row)
Toggle enables or disables the breakpoint of a row (the check box, and Space).
type CallStackArgs ¶
CallStackArgs is the argument of a command run for a row of the Call Stack (VS Code's CallStackContext): the ids of the session, the thread and the frame.
type CallStackPane ¶
type CallStackPane struct {
// contains filtered or unexported fields
}
CallStackPane is the Call Stack view: the sessions (the threads and the frames of the only session when there is one), the threads that are stopped with their frames, the frames of no source or marked subtle dimmed and the runs of deemphasized frames collapsed under "Show N More Stack Frames". The frame of the stop is focused and selected, and a click on a frame focuses it.
Ported from VS Code: src/vs/workbench/contrib/debug/browser/callStackView.ts (CallStackView, CallStackDataSource, SessionsRenderer, ThreadsRenderer, StackFramesRenderer)
func (CallStackPane) CancelEdit ¶
func (b CallStackPane) CancelEdit()
CancelEdit closes the input without committing it.
func (CallStackPane) Controller ¶
func (b CallStackPane) Controller() *kit.TreeController
Controller gives access to the tree widget from outside (focus, reveal).
func (CallStackPane) Editing ¶
func (b CallStackPane) Editing() bool
Editing tells whether an inline input is open in the view; the tree leaves its keys to the input then.
func (CallStackPane) EditingKey ¶
func (b CallStackPane) EditingKey() string
EditingKey is the key of the row whose input is open, or "".
func (CallStackPane) Message ¶
func (b CallStackPane) Message() string
Message is the text the view shows in place of an empty tree.
func (CallStackPane) OnChange ¶
func (b CallStackPane) OnChange(fn func()) func()
OnChange calls fn after the rows or a value of the view changed, and returns the function that stops it.
func (*CallStackPane) Render ¶
func (c *CallStackPane) Render(bc widgets.BuildContext, n kit.TreeNode, st kit.RowState) widgets.Widget
Render builds the contents of a row.
func (*CallStackPane) Select ¶
func (c *CallStackPane) Select(r Row)
Select does what a click on a row does: a frame, a thread or a session takes the focus of the debugger; "Show N More Stack Frames" shows the frames; "Load More Stack Frames" asks the adapter for twenty more.
func (CallStackPane) Selected ¶
func (b CallStackPane) Selected() []Row
Selected are the rows that are selected, in the order of the tree.
type Console ¶
type Console struct {
// contains filtered or unexported fields
}
Console is the model of the Debug Console view.
func NewConsole ¶
func NewConsole(opts ConsoleOpts) *Console
NewConsole makes the console and follows the service.
func (*Console) Accept ¶
func (c *Console) Accept()
Accept evaluates the text of the input in the focused frame, and clears the input. It does nothing when the console is read-only.
func (*Console) Clear ¶
func (c *Console) Clear()
Clear removes the elements of the console that is shown. A console of a session that is over is hidden by it, and the console of another session is shown (VS Code's clearRepl).
func (*Console) CollapseAll ¶
func (c *Console) CollapseAll()
CollapseAll closes every group and object.
func (*Console) Counts ¶
Counts are the number of top-level elements and how many of them the filter lets through.
func (*Console) Dispose ¶
func (c *Console) Dispose()
Dispose stops following the service and cancels what the console asked for.
func (*Console) Evaluate ¶
Evaluate evaluates a text in the console that is shown, as if it was typed (Evaluate in Debug Console). The input is left alone.
func (*Console) FilterController ¶
func (c *Console) FilterController() *kit.InputBoxController
FilterController is the controller of the filter box, which the window keeps for as long as the console lives.
func (*Console) FilterText ¶
FilterText is the text of the filter box.
func (*Console) Input ¶
func (c *Console) Input() *kit.InputBoxController
Input is the controller of the input box.
func (*Console) KeepEnd ¶
KeepEnd says that the view was at the end of the console before the rows changed, so that the end stays in view.
func (*Console) Multiple ¶
Multiple tells whether there is more than one console to pick from (the context key multiSessionRepl).
func (*Console) OnChange ¶
func (c *Console) OnChange(fn func()) func()
OnChange calls fn after the rows, the filter, the session or the state of the input changed, and returns the function that stops it.
func (*Console) ReadOnly ¶
ReadOnly tells whether the input cannot be used: there is no session that lives to evaluate in.
func (*Console) Refresh ¶
func (c *Console) Refresh()
Refresh reads the model of the service again, now: the session that is shown, and the rows.
func (*Console) ResolveLink ¶
ResolveLink says whether a part of the output is a link that can be followed: an address, a relative path when there is a folder, a path of a file (found out once, on a goroutine of its own, while the text shows plain). The view rebuilds when it is known.
func (*Console) Sessions ¶
Sessions are the sessions that have a console of their own and are not hidden by Clear, in the order of the model.
func (*Console) SetFilter ¶
SetFilter changes the filter and shows the end of the console, as VS Code does.
A small console is filtered at once. A large one (FilterAsyncLines elements or more) waits FilterDelay for the next key, then matches its lines on a goroutine and swaps the result in on the UI thread: the match of 100,000 lines takes half a second, which the UI thread must not spend. Every change of the text counts a generation, and a result of an older one is dropped, so a fast sequence of edits shows the last one only. Lines that arrive meanwhile are matched when the result is swapped in, and until then by the filter the rows show.
func (*Console) Toggle ¶
Toggle opens or closes the row with the key; it reports whether the row can be toggled.
func (*Console) VisibleText ¶
VisibleText is the text of the rows that show, a line for each: Copy All (VS Code's getVisibleContent).
type ConsoleActions ¶
type ConsoleActions struct {
widgets.StatefulWidget
// contains filtered or unexported fields
}
ConsoleActions is what the panel shows in its title strip while the Debug Console is the tab: the dropdown of the consoles when there are several, the filter box and the button that clears the console.
Ported from VS Code: src/vs/workbench/contrib/debug/browser/repl.ts (the filter of FilterViewPane, clearReplAction, SelectReplActionViewItem)
func NewConsoleActions ¶
func NewConsoleActions(c *Console, opts ...ConsoleActionsOpts) *ConsoleActions
NewConsoleActions makes the actions for a console.
func (*ConsoleActions) CreateState ¶
func (a *ConsoleActions) CreateState() widgets.State
CreateState implements widgets.StatefulWidget.
func (*ConsoleActions) TitleActionsWidth ¶
func (a *ConsoleActions) TitleActionsWidth(room float64) float64
TitleActionsWidth implements kit.TitleActions.
type ConsoleActionsOpts ¶
type ConsoleActionsOpts struct {
// OnFilterFocus is told when the filter box gets or loses the keyboard focus.
OnFilterFocus func(has bool)
}
ConsoleActionsOpts are what the actions ask of the window.
type ConsoleBody ¶
type ConsoleBody struct {
widgets.StatefulWidget
// contains filtered or unexported fields
}
ConsoleBody is the body of the Debug Console: the rows of the output, and the input under them.
func NewConsoleBody ¶
func NewConsoleBody(c *Console, opts ...ConsoleBodyOpts) *ConsoleBody
NewConsoleBody makes the body for a console.
func (*ConsoleBody) CreateState ¶
func (b *ConsoleBody) CreateState() widgets.State
CreateState implements widgets.StatefulWidget.
type ConsoleBodyOpts ¶
type ConsoleBodyOpts struct {
// Menu opens the context menu of a row at a position of the window; ok is false for the part below the rows.
Menu func(row ConsoleRow, ok bool, at ui.Offset)
// OnFocusChange is told when the input gets or loses the keyboard focus.
OnFocusChange func(has bool)
}
ConsoleBodyOpts are what the body asks of its window.
type ConsoleConfig ¶
type ConsoleConfig struct {
// FontSize is debug.console.fontSize (14), FontFamily debug.console.fontFamily ("default": the monospace font of the desktop) and
// LineHeight debug.console.lineHeight (0: 1.4 times the font size).
FontSize float64
FontFamily string
LineHeight float64
// WordWrap is debug.console.wordWrap.
WordWrap bool
// HistorySuggestions is debug.console.historySuggestions and AcceptSuggestionOnEnter debug.console.acceptSuggestionOnEnter == "on".
HistorySuggestions bool
AcceptSuggestionOnEnter bool
}
ConsoleConfig is what the console reads of the debug.console.* settings.
func (ConsoleConfig) ConsoleLineHeight ¶
func (c ConsoleConfig) ConsoleLineHeight() float64
ConsoleLineHeight is the height of a line in pixels: the setting, or 1.4 times the font size.
type ConsoleOpts ¶
type ConsoleOpts struct {
// Ctx ends the requests the console makes when it is done.
Ctx context.Context
// Service is the debug service of the workspace; the view of a client of a hosted workspace gets the host's.
Service *debug.Service
// Post runs a function on the UI thread, later.
Post func(func())
// Logger logs a request that failed; slog's default when nil.
Logger *slog.Logger
// Config gives the settings; DefaultConsoleConfig when nil.
Config func() ConsoleConfig
// Folder is the folder the relative paths of the output are of.
Folder string
// OpenFile shows a file at a line and a column (counted from 1; 0 for none), OpenURL an address.
OpenFile func(path string, line, column int)
OpenURL func(url string)
// OpenSource shows the source an output came from.
OpenSource func(src debug.ReplSource)
// Stat tells whether a path is a file (not a folder); os.Stat by default. It runs on a goroutine of its own.
Stat func(path string) (isFile bool)
// Home is the home folder `~` stands for in a path; empty for none.
Home string
// AfterFrame runs a function after the next frame.
AfterFrame func(func())
// CompletionDelay is how long the input waits after a key before it asks the adapter for completions (150 ms by default; tests
// use less).
CompletionDelay time.Duration
// FilterDelay is how long the filter waits after a key before it matches the lines of a large console (300 ms, as VS Code's filter
// boxes wait; tests use less). A console of up to FilterAsyncLines elements is filtered at once.
FilterDelay time.Duration
}
ConsoleOpts are what the console needs of its window. Everything is called on the UI thread, except Post, which any goroutine may call.
type ConsoleRow ¶
type ConsoleRow struct {
// Key identifies the row in the tree: the id of the element, and below an object the ids of the variables.
Key string
Kind ConsoleRowKind
Depth int
// Element is the element of the console the row is, or the one the object below the row belongs to.
Element debug.ReplElement
// Node is the object the row shows or opens: the expression of an output, a value or a result, or a variable of a child row.
Node debug.Node
// Expandable and Expanded say whether the row has a twistie and whether it is open.
Expandable, Expanded bool
}
ConsoleRow is a row of the console.
type ConsoleRowKind ¶
type ConsoleRowKind int
ConsoleRowKind says what a row of the console shows.
const ( // ConsoleInput is a line the user typed, ConsoleOutput a line of output (with the object behind it, if any), ConsoleResult the result // of an evaluation, ConsoleValue an object or a value logged with no text, ConsoleGroup the title of a group. ConsoleInput ConsoleRowKind = iota + 1 ConsoleOutput ConsoleResult ConsoleValue ConsoleGroup // ConsoleChild is a variable under an object, ConsoleLoading the "Loading..." that stands in place of its children while they are // read. ConsoleChild ConsoleLoading )
The kinds of rows.
type ExpressionLine ¶
type ExpressionLine struct {
// Name is the name; empty for a message.
Name string
// Type is shown before the value when ShowType is set.
Type string
ShowType bool
// Value is the value; Available is false for an expression the adapter could not evaluate.
Value string
Available bool
// Changed marks a value that changed since the last stop.
Changed bool
// Lazy marks a value that has to be asked for (the eye button of VS Code).
Lazy bool
}
ExpressionLine is the text of a row that shows a node: name, the type when debug.showVariableTypes, and the value, in the colors of the debug tokens. The value that changed has the debugView.valueChangedHighlight behind it.
Ported from VS Code: src/vs/workbench/contrib/debug/browser/debugExpressionRenderer.ts (renderVariable, renderValue) and variablesView.ts (VariablesRenderer, ScopesRenderer)
func LineOfNode ¶
func LineOfNode(n debug.Node, name string, showTypes bool) ExpressionLine
LineOfNode makes the line of a node: a scope shows its name only, a variable or an expression its name and value.
func (ExpressionLine) Spans ¶
func (l ExpressionLine) Spans(bc widgets.BuildContext, st kit.RowState) []painting.InlineSpan
Spans make the text of the line in the style of a row: the name in debugTokenExpression.name, then "=" or ":" and the value.
func (ExpressionLine) Widget ¶
func (l ExpressionLine) Widget(bc widgets.BuildContext, st kit.RowState) widgets.Widget
Widget is the line as a one-line rich text that ends in an ellipsis.
type FloatingToolbar ¶
type FloatingToolbar struct {
widgets.StatefulWidget
// contains filtered or unexported fields
}
FloatingToolbar is the debug toolbar over the editor area: a small bar at the top of the editor area with a gripper that drags it sideways (a double click on the gripper centers it) and the buttons of the session: Continue or Pause, Step Over, Step Into, Step Out, Restart and Stop (Disconnect for an attach), and the session picker with several sessions. It is `debug.toolBarLocation: floating`.
Ported from VS Code: src/vs/workbench/contrib/debug/browser/debugToolBar.ts (DebugToolBar) and media/debugToolBar.css
func NewFloatingToolbar ¶
func NewFloatingToolbar(opts FloatingToolbarOpts) *FloatingToolbar
NewFloatingToolbar makes the toolbar. It fills the area it is given and draws the bar at the top of it.
func (*FloatingToolbar) CreateState ¶
func (t *FloatingToolbar) CreateState() widgets.State
CreateState implements widgets.StatefulWidget.
type FloatingToolbarOpts ¶
type FloatingToolbarOpts struct {
// Actions are the buttons, with their icons and colors.
Actions []kit.Action
// OnRun runs a button.
OnRun func(a kit.Action)
// X is where the center of the toolbar is across the width of the editor area, from 0 to 1; DefaultToolbarX when 0.
X float64
// OnMoved is told the new position when the user dragged the toolbar by its gripper, and DefaultToolbarX when a double click on
// the gripper centers it again.
OnMoved func(x float64)
}
FloatingToolbarOpts are the options of NewFloatingToolbar.
type HoverOpts ¶
type HoverOpts struct {
// Ctx is the life of the requests that load children.
Ctx context.Context
// Root is what was evaluated: an expression whose children are the rows of the tree.
Root debug.Node
// ShowTypes is debug.showVariableTypes.
ShowTypes func() bool
// Post hands work to the UI thread (a request of children runs on a goroutine of its own).
Post func(func())
}
HoverOpts are the options of NewHover.
type HoverTree ¶
type HoverTree struct {
widgets.StatefulWidget
// contains filtered or unexported fields
}
HoverTree is the widget of the content of the debug hover.
func NewHover ¶
NewHover makes the content of the debug hover: the value of the root alone when it has no children, else its value as a title, the tree of its children and the tip about the Alt key.
func (*HoverTree) CreateState ¶
CreateState implements widgets.StatefulWidget.
type LoadedPane ¶
type LoadedPane struct {
// contains filtered or unexported fields
}
LoadedPane is the Loaded Scripts view: the sources the focused session reports with loadedSources and loadedSource events, as a flat list of names with their folders dimmed after them (decision 1193; VS Code groups them in a tree of folders). It is shown while the adapter supports the request (loadedScriptsSupported) and loads nothing while it is folded.
Ported from VS Code: src/vs/workbench/contrib/debug/browser/loadedScriptsView.ts
func (LoadedPane) CancelEdit ¶
func (b LoadedPane) CancelEdit()
CancelEdit closes the input without committing it.
func (LoadedPane) Controller ¶
func (b LoadedPane) Controller() *kit.TreeController
Controller gives access to the tree widget from outside (focus, reveal).
func (LoadedPane) Editing ¶
func (b LoadedPane) Editing() bool
Editing tells whether an inline input is open in the view; the tree leaves its keys to the input then.
func (LoadedPane) EditingKey ¶
func (b LoadedPane) EditingKey() string
EditingKey is the key of the row whose input is open, or "".
func (LoadedPane) Message ¶
func (b LoadedPane) Message() string
Message is the text the view shows in place of an empty tree.
func (LoadedPane) OnChange ¶
func (b LoadedPane) OnChange(fn func()) func()
OnChange calls fn after the rows or a value of the view changed, and returns the function that stops it.
func (*LoadedPane) Render ¶
func (l *LoadedPane) Render(bc widgets.BuildContext, n kit.TreeNode, st kit.RowState) widgets.Widget
Render builds the contents of a row.
func (LoadedPane) Selected ¶
func (b LoadedPane) Selected() []Row
Selected are the rows that are selected, in the order of the tree.
func (*LoadedPane) Sources ¶
func (l *LoadedPane) Sources() []debug.Source
Sources are the sources the view lists.
type Opts ¶
type Opts struct {
// Ctx ends the requests the views make when it is done.
Ctx context.Context
// Service is the debug service of the workspace; the view of a client of a hosted workspace gets the host's.
Service *debug.Service
// Post runs a function on the UI thread, later.
Post func(func())
// Logger logs a request of a view that failed; slog's default when nil.
Logger *slog.Logger
// ShowTypes is debug.showVariableTypes; false when nil.
ShowTypes func() bool
// Presentation is debug.breakpointsView.presentation, "list" or "tree"; "list" when nil.
Presentation func() string
// Visible says whether a view is on screen: a view that is folded or hidden asks the adapter for nothing. True when nil.
Visible func(viewID string) bool
}
Opts are what the views need of their window. Everything is called on the UI thread, except Post, which any goroutine may call.
type Panes ¶
type Panes struct {
Variables *VariablesPane
Watch *WatchPane
CallStack *CallStackPane
Breakpoints *BreakpointsPane
Loaded *LoadedPane
// contains filtered or unexported fields
}
Panes are the five views of the container, over one service.
func (*Panes) Dispose ¶
func (p *Panes) Dispose()
Dispose stops following the service and cancels what the views asked for.
func (*Panes) VisibilityChanged ¶
func (p *Panes) VisibilityChanged()
VisibilityChanged tells the views that one of them came on screen or left it.
type Row ¶
type Row struct {
Kind RowKind
// Key is the key of the row in its tree.
Key string
// Text is the text of a message, or the label of RowShowMore and RowLoadMore.
Text string
Scope *debug.Scope
Variable *debug.Variable
Expression *debug.Expression
Session *debug.Session
Thread *debug.Thread
Frame *debug.StackFrame
// Hidden are the deemphasized frames a RowShowMore stands for.
Hidden []*debug.StackFrame
Exception debug.ExceptionBreakpoint
Function debug.FunctionBreakpoint
Breakpoint debug.Breakpoint
Source debug.Source
// Parent is the node a variable is a child of (a scope, a variable or an expression), for Set Value.
Parent debug.Node
}
Row is the data of a row of a view: what the commands of its menus work on. Exactly the member of its Kind is set.
func (Row) ItemType ¶
ItemType is the value of the context key that names the kind of the focused row of the Call Stack (callStackItemType), of the Watch (watchItemType) or of the Breakpoints (breakpointItemType): "session", "thread", "stackFrame"; "expression", "variable"; "breakpoint", "functionBreakpoint", "exceptionBreakpoint".
type RowKind ¶
type RowKind int
RowKind says what a row of a view shows.
const ( // RowMessage is a line of text (a failure to read the scopes, the message of a failed stack trace). RowMessage RowKind = iota + 1 // RowScope is a scope of the focused frame, RowVariable a variable or property, RowExpression a watch expression. RowScope RowVariable RowExpression // RowSession, RowThread and RowFrame are the rows of the Call Stack. RowSession RowThread RowFrame // RowShowMore is "Show N More Stack Frames" (deemphasized frames that are collapsed) and RowLoadMore "Load More Stack Frames". RowShowMore RowLoadMore // RowException, RowFunctionBreakpoint and RowBreakpoint are the rows of the Breakpoints. RowException RowFunctionBreakpoint RowBreakpoint // RowSource is a loaded script. RowSource )
The kinds of rows.
type TreePane ¶
type TreePane interface {
ID() string
Model() *kit.TreeModel
Controller() *kit.TreeController
Message() string
OnChange(fn func()) func()
Row(key string) (Row, bool)
Render(bc widgets.BuildContext, n kit.TreeNode, st kit.RowState) widgets.Widget
Editing() bool
}
TreePane is what a view shows as a tree.
type VariablesPane ¶
type VariablesPane struct {
// contains filtered or unexported fields
}
VariablesPane is the Variables view: the scopes of the focused stack frame, each expanding to its variables, which expand to theirs. The children are asked of the adapter when a node is first expanded, on a goroutine of their own, and the tree shows a "Loading..." row until they arrive. The first scope that is not expensive is expanded when the frame is focused, as VS Code does.
Ported from VS Code: src/vs/workbench/contrib/debug/browser/variablesView.ts (VariablesView, VariablesDataSource, VariablesRenderer, ScopesRenderer)
func (VariablesPane) CancelEdit ¶
func (b VariablesPane) CancelEdit()
CancelEdit closes the input without committing it.
func (*VariablesPane) CollapseAll ¶
func (v *VariablesPane) CollapseAll()
CollapseAll folds every scope and variable.
func (VariablesPane) Controller ¶
func (b VariablesPane) Controller() *kit.TreeController
Controller gives access to the tree widget from outside (focus, reveal).
func (VariablesPane) Editing ¶
func (b VariablesPane) Editing() bool
Editing tells whether an inline input is open in the view; the tree leaves its keys to the input then.
func (VariablesPane) EditingKey ¶
func (b VariablesPane) EditingKey() string
EditingKey is the key of the row whose input is open, or "".
func (*VariablesPane) Frame ¶
func (v *VariablesPane) Frame() *debug.StackFrame
Frame is the frame whose variables the view shows.
func (VariablesPane) Message ¶
func (b VariablesPane) Message() string
Message is the text the view shows in place of an empty tree.
func (VariablesPane) OnChange ¶
func (b VariablesPane) OnChange(fn func()) func()
OnChange calls fn after the rows or a value of the view changed, and returns the function that stops it.
func (*VariablesPane) Render ¶
func (v *VariablesPane) Render(bc widgets.BuildContext, n kit.TreeNode, st kit.RowState) widgets.Widget
Render builds the contents of a row: a scope is its name, a variable its name and value in the colors of the debug tokens.
func (VariablesPane) Selected ¶
func (b VariablesPane) Selected() []Row
Selected are the rows that are selected, in the order of the tree.
func (*VariablesPane) SetValue ¶
func (v *VariablesPane) SetValue(r Row)
SetValue opens the input on a variable with its value (Set Value, F2); the new value goes to the adapter.
type WatchPane ¶
type WatchPane struct {
// contains filtered or unexported fields
}
WatchPane is the Watch view: the watch expressions of the workspace, evaluated in the focused stack frame, each expanding to the children of its value. An expression is added, renamed and removed in the view; they are kept with the workspace.
Ported from VS Code: src/vs/workbench/contrib/debug/browser/watchExpressionsView.ts (WatchExpressionsView, WatchExpressionsDataSource, WatchExpressionsRenderer)
func (*WatchPane) Add ¶
Add opens the row in which a new expression is typed (Add Expression); text is what it starts with (Add to Watch).
func (WatchPane) CancelEdit ¶
func (b WatchPane) CancelEdit()
CancelEdit closes the input without committing it.
func (WatchPane) Controller ¶
func (b WatchPane) Controller() *kit.TreeController
Controller gives access to the tree widget from outside (focus, reveal).
func (WatchPane) Editing ¶
func (b WatchPane) Editing() bool
Editing tells whether an inline input is open in the view; the tree leaves its keys to the input then.
func (WatchPane) EditingKey ¶
func (b WatchPane) EditingKey() string
EditingKey is the key of the row whose input is open, or "".
func (*WatchPane) Message ¶
Message is shown in place of an empty tree: VS Code has no message, the Watch is only its header.
func (WatchPane) OnChange ¶
func (b WatchPane) OnChange(fn func()) func()
OnChange calls fn after the rows or a value of the view changed, and returns the function that stops it.
func (*WatchPane) Rename ¶
func (w *WatchPane) Rename(e *debug.Expression)
Rename opens the input on an expression (Edit Expression); an empty name removes it.
func (WatchPane) Selected ¶
func (b WatchPane) Selected() []Row
Selected are the rows that are selected, in the order of the tree.
func (*WatchPane) SetValue ¶
SetValue opens the input on an expression or one of its variables with its value (Set Value); the new value goes to the adapter.
type WelcomeState ¶
type WelcomeState struct {
// DebuggersAvailable is the context key debuggersAvailable: an enabled extension contributes a debugger.
DebuggersAvailable bool
// ExtensionAvailable is debugExtensionAvailable; false says that no extension that contributes a debugger is enabled.
ExtensionAvailable bool
// InterestedInActiveEditor is debuggerInterestedInActiveEditor: a debugger serves the language of the active editor.
InterestedInActiveEditor bool
// NoFolder is workbenchState == 'empty'.
NoFolder bool
}
WelcomeState is what the welcome content of the container depends on.