Documentation
¶
Overview ¶
Package ged implements the visual GUI editor (Silk Designer).
It provides a drag-and-drop design canvas where users place widgets, edit their properties, write event handler code, and export the design as compilable Go source files.
Key types:
- GedView: the main editor view (embeds graph.GraphView)
- GedScene: the design canvas containing FakeWidgets
- FakeWidget: a design-time representation of a GUI widget
- WidgetList: a palette of available widgets for drag-and-drop
- CodePanel: syntax-highlighted Go code editor for event handlers
- CodeGenOptions: controls Go code generation output
Index ¶
- Constants
- Variables
- func AnsiColorRGB(c int) (r, g, b uint8, ok bool)
- func ApplyTemplate(scene *GedScene, tmpl *ProjectTemplate)
- func AvailableEvents(factoryName string) []string
- func CheckRecovery(filename string) string
- func CleanupAutosave(filename string)
- func FindProjectRoot(startDir string) (string, error)
- func FormatGenerateReport(root string, results []GenerateResult) string
- func GenerateDesign(designPath, module string) (string, error)
- func InitAutoSaver()
- func IsDesignPath(path string) bool
- func KeymapFilePath() string
- func RegisterWidget(d WidgetDef) error
- func SaveAsTemplate(scene *GedScene, name, description string) error
- func SaveKeymap(km *KeyMap) error
- func SaveSession(state SessionState) error
- func ShowAboutDialog(parent gui.IWidget)
- func ShowAboutDialogWithInfo(parent gui.IWidget, info AboutInfo)
- func ShowFormSettingsDialog(parent gui.IWidget, view *GedView) bool
- func ShowTagDictionaryDialog(parent gui.IWidget, view *GedView) bool
- func SwitchToDesignMode()
- func SwitchToEditMode()
- type AboutInfo
- type AlignMode
- type AnsiTerm
- func (t *AnsiTerm) Cols() int
- func (t *AnsiTerm) CursorPos() (row, col int)
- func (t *AnsiTerm) LineString(row int) string
- func (t *AnsiTerm) Reset()
- func (t *AnsiTerm) Resize(rows, cols int)
- func (t *AnsiTerm) Rows() int
- func (t *AnsiTerm) Screen() [][]Cell
- func (t *AnsiTerm) Write(p []byte) (int, error)
- type AutoSaver
- type BindingRow
- type BindingsPanel
- func (this *BindingsPanel) Draw(g paint.Painter)
- func (this *BindingsPanel) Init(self gui.IWidget)
- func (this *BindingsPanel) OnLeftDown(x, y float64)
- func (this *BindingsPanel) OnMouseLeave()
- func (this *BindingsPanel) OnMouseMove(x, y float64)
- func (this *BindingsPanel) OnMouseWheel(x, y, z float64)
- func (this *BindingsPanel) Rebuild()
- func (this *BindingsPanel) Rows() []BindingRow
- func (this *BindingsPanel) SelectedRow() int
- func (this *BindingsPanel) SetScene(scene *GedScene)
- func (this *BindingsPanel) SigSelect(fn func(graph.IItem))
- type Bookmark
- type BookmarksPanel
- func (this *BookmarksPanel) Add(file string, line int, label string)
- func (this *BookmarksPanel) Bookmarks() []Bookmark
- func (this *BookmarksPanel) Clear()
- func (this *BookmarksPanel) Draw(g paint.Painter)
- func (this *BookmarksPanel) Init(self gui.IWidget)
- func (this *BookmarksPanel) OnLeftDown(x, y float64)
- func (this *BookmarksPanel) OnMouseLeave()
- func (this *BookmarksPanel) OnMouseMove(x, y float64)
- func (this *BookmarksPanel) OnMouseWheel(x, y, z float64)
- func (this *BookmarksPanel) Remove(file string, line int)
- func (this *BookmarksPanel) SigActivated(fn func(file string, line int))
- func (this *BookmarksPanel) SizeHints() gui.SizeHints
- func (this *BookmarksPanel) Toggle(file string, line int, label string)
- type BreakpointRow
- type BuildOutput
- func (this *BuildOutput) Clear()
- func (this *BuildOutput) Draw(g paint.Painter)
- func (this *BuildOutput) ErrorMap() map[int]string
- func (this *BuildOutput) HasErrors() bool
- func (this *BuildOutput) Init(self gui.IWidget)
- func (this *BuildOutput) OnLeftDown(x, y float64)
- func (this *BuildOutput) OnMouseMove(x, y float64)
- func (this *BuildOutput) OnMouseWheel(x, y, z float64)
- func (this *BuildOutput) SetOutput(text string)
- func (this *BuildOutput) SigErrorClick(fn func(file string, line, col int))
- func (this *BuildOutput) SizeHints() gui.SizeHints
- type BuildOutputLine
- type CallDirection
- type CallHierarchyModel
- func (m *CallHierarchyModel) Cancel()
- func (m *CallHierarchyModel) Clear()
- func (m *CallHierarchyModel) Collapse(node *CallNode)
- func (m *CallHierarchyModel) Contains(node *CallNode) bool
- func (m *CallHierarchyModel) Direction() CallDirection
- func (m *CallHierarchyModel) Expand(node *CallNode)
- func (m *CallHierarchyModel) Generation() int
- func (m *CallHierarchyModel) Incoming() bool
- func (m *CallHierarchyModel) PendingCount() int
- func (m *CallHierarchyModel) Root() *CallNode
- func (m *CallHierarchyModel) Rows() []CallRow
- func (m *CallHierarchyModel) SetChildren(node *CallNode, children []*CallNode) bool
- func (m *CallHierarchyModel) SetDirection(d CallDirection) bool
- func (m *CallHierarchyModel) SetRoot(root *CallNode)
- func (m *CallHierarchyModel) SigExpand(fn func(node *CallNode))
- func (m *CallHierarchyModel) Toggle(node *CallNode)
- type CallHierarchyPanel
- func (this *CallHierarchyPanel) Clear()
- func (this *CallHierarchyPanel) Draw(g paint.Painter)
- func (this *CallHierarchyPanel) Incoming() bool
- func (this *CallHierarchyPanel) Init(self gui.IWidget)
- func (this *CallHierarchyPanel) Model() *CallHierarchyModel
- func (this *CallHierarchyPanel) OnLeftDown(x, y float64)
- func (this *CallHierarchyPanel) OnMouseLeave()
- func (this *CallHierarchyPanel) OnMouseMove(x, y float64)
- func (this *CallHierarchyPanel) OnMouseWheel(x, y, z float64)
- func (this *CallHierarchyPanel) Refresh()
- func (this *CallHierarchyPanel) Rows() []CallRow
- func (this *CallHierarchyPanel) SetChildren(node *CallNode, children []*CallNode) bool
- func (this *CallHierarchyPanel) SetIncoming(incoming bool)
- func (this *CallHierarchyPanel) SetRoot(root *CallNode)
- func (this *CallHierarchyPanel) SigActivate(fn func(file string, line int))
- func (this *CallHierarchyPanel) SigDirection(fn func(incoming bool))
- func (this *CallHierarchyPanel) SigExpand(fn func(node *CallNode))
- func (this *CallHierarchyPanel) SizeHints() gui.SizeHints
- func (this *CallHierarchyPanel) ToggleDirection()
- type CallNode
- type CallRow
- type Cell
- type CodeGenOptions
- type CodeInsightsLayer
- func (this *CodeInsightsLayer) Clear()
- func (this *CodeInsightsLayer) CodeLens() *CodeLens
- func (this *CodeInsightsLayer) InlayHints() *InlayHints
- func (this *CodeInsightsLayer) Line(line int) LineInsights
- func (this *CodeInsightsLayer) Lines(first, last int) []LineInsights
- func (this *CodeInsightsLayer) Revision() int
- func (this *CodeInsightsLayer) SemanticTokens() *SemanticTokens
- func (this *CodeInsightsLayer) SetRevision(revision int)
- type CodeLens
- type CodeOutlinePanel
- func (this *CodeOutlinePanel) Draw(g paint.Painter)
- func (this *CodeOutlinePanel) ExportedOnly() bool
- func (this *CodeOutlinePanel) Filter() string
- func (this *CodeOutlinePanel) Init(self gui.IWidget)
- func (this *CodeOutlinePanel) OnLeftDown(x, y float64)
- func (this *CodeOutlinePanel) OnMouseLeave()
- func (this *CodeOutlinePanel) OnMouseMove(x, y float64)
- func (this *CodeOutlinePanel) OnMouseWheel(x, y, z float64)
- func (this *CodeOutlinePanel) RefreshIfStale() bool
- func (this *CodeOutlinePanel) RefreshSymbols()
- func (this *CodeOutlinePanel) SetEditor(editor *gui.CodeEditor)
- func (this *CodeOutlinePanel) SetExportedOnly(on bool)
- func (this *CodeOutlinePanel) SetFilter(text string)
- func (this *CodeOutlinePanel) SetNavigateCallback(fn func(line int))
- func (this *CodeOutlinePanel) SetRevision(rev int)
- func (this *CodeOutlinePanel) SetSortMode(mode int)
- func (this *CodeOutlinePanel) SetSymbols(syms []OutlineSymbol)
- func (this *CodeOutlinePanel) SortMode() int
- type CodePanel
- func (this *CodePanel) BindGedView(gv *GedView)
- func (this *CodePanel) Draw(g paint.Painter)
- func (this *CodePanel) Focus()
- func (this *CodePanel) Init(self gui.IWidget)
- func (this *CodePanel) Layout()
- func (this *CodePanel) RegenerateNow()
- func (this *CodePanel) SaveCode()
- func (this *CodePanel) ScheduleRegenerate()
- func (this *CodePanel) ScrollToHandler(name string)
- func (this *CodePanel) ScrollToWidget(fake *FakeWidget)
- func (this *CodePanel) SetWidget(fake *FakeWidget)
- func (this *CodePanel) ShowTab(idx int)
- func (this *CodePanel) Title() string
- type ConsoleLine
- type ConsolePanel
- func (this *ConsolePanel) AppendError(text string)
- func (this *ConsolePanel) AppendLine(text string, level int)
- func (this *ConsolePanel) AppendOutput(text string)
- func (this *ConsolePanel) AppendSystem(text string)
- func (this *ConsolePanel) Clear()
- func (this *ConsolePanel) Draw(g paint.Painter)
- func (this *ConsolePanel) Init(self gui.IWidget)
- func (this *ConsolePanel) OnLeftDown(x, y float64)
- func (this *ConsolePanel) OnMouseWheel(x, y, z float64)
- func (this *ConsolePanel) SizeHints() gui.SizeHints
- type DebugPanel
- func (this *DebugPanel) Arguments() []VarRow
- func (this *DebugPanel) Breakpoints() []BreakpointRow
- func (this *DebugPanel) CallStack() []core.StackFrame
- func (this *DebugPanel) Clear()
- func (this *DebugPanel) ClearAll()
- func (this *DebugPanel) ConsoleLines() []string
- func (this *DebugPanel) ConsoleVisible() bool
- func (this *DebugPanel) Draw(g paint.Painter)
- func (this *DebugPanel) Goroutines() []core.Goroutine
- func (this *DebugPanel) Init(self gui.IWidget)
- func (this *DebugPanel) Locals() []VarRow
- func (this *DebugPanel) OnKeyDown(key int, repeat bool)
- func (this *DebugPanel) OnLeftDown(x, y float64)
- func (this *DebugPanel) OnMouseLeave()
- func (this *DebugPanel) OnMouseMove(x, y float64)
- func (this *DebugPanel) OnMouseWheel(x, y, z float64)
- func (this *DebugPanel) OnTextInput(s string)
- func (this *DebugPanel) RemoveWatch(expr string)
- func (this *DebugPanel) SelectedFrame() int
- func (this *DebugPanel) SelectedGoroutine() int64
- func (this *DebugPanel) SetArguments(rows []VarRow)
- func (this *DebugPanel) SetBreakpoints(rows []BreakpointRow)
- func (this *DebugPanel) SetCallStack(frames []core.StackFrame)
- func (this *DebugPanel) SetChildren(path string, rows []VarRow)
- func (this *DebugPanel) SetConsoleLines(lines []string)
- func (this *DebugPanel) SetConsoleVisible(on bool)
- func (this *DebugPanel) SetGoroutines(gs []core.Goroutine)
- func (this *DebugPanel) SetLocals(rows []VarRow)
- func (this *DebugPanel) SetSelectedFrame(i int)
- func (this *DebugPanel) SetSelectedGoroutine(id int64)
- func (this *DebugPanel) SetVariables(vars []core.Variable)
- func (this *DebugPanel) SetWatches(w []WatchEntry)
- func (this *DebugPanel) SigContextChanged(fn func(goroutineID int64, frame int))
- func (this *DebugPanel) SigDeleteBreakpoint(fn func(file string, line int))
- func (this *DebugPanel) SigEditCondition(fn func(file string, line int, cond string))
- func (this *DebugPanel) SigEval(fn func(expr string))
- func (this *DebugPanel) SigExpandVar(fn func(path string))
- func (this *DebugPanel) SigFrameActivated(fn func(frame core.StackFrame))
- func (this *DebugPanel) SigFrameSelected(fn func(index int, frame core.StackFrame))
- func (this *DebugPanel) SigGoroutineActivated(fn func(g core.Goroutine))
- func (this *DebugPanel) SigToggleBreakpoint(fn func(file string, line int, enabled bool))
- func (this *DebugPanel) SigVariableEdited(fn func(name string, newValue string))
- func (this *DebugPanel) SigWatchAdded(fn func(expr string))
- func (this *DebugPanel) SigWatchRemoved(fn func(expr string))
- func (this *DebugPanel) SizeHints() gui.SizeHints
- func (this *DebugPanel) Variables() []core.Variable
- func (this *DebugPanel) WatchExprs() []string
- func (this *DebugPanel) Watches() []WatchEntry
- type Design
- type DesignOutputs
- type DesignerMode
- type DevicePointsEditor
- func (e *DevicePointsEditor) Cell(row, col int) string
- func (e *DevicePointsEditor) Draw(g paint.Painter)
- func (e *DevicePointsEditor) Init(self gui.IWidget)
- func (e *DevicePointsEditor) PointsText() string
- func (e *DevicePointsEditor) RowCount() int
- func (e *DevicePointsEditor) Rows() []driver.TagPoint
- func (e *DevicePointsEditor) SetCell(row, col int, value string) error
- func (e *DevicePointsEditor) SetPointsText(text string) error
- func (e *DevicePointsEditor) SigChanged(fn func(text string))
- func (e *DevicePointsEditor) SizeHints() gui.SizeHints
- type EditorTabs
- func (this *EditorTabs) ActivateFile(path string) bool
- func (this *EditorTabs) ActiveEditor() *gui.CodeEditor
- func (this *EditorTabs) ActiveFilePath() string
- func (this *EditorTabs) CloseTab(idx int)
- func (this *EditorTabs) Draw(g paint.Painter)
- func (this *EditorTabs) Init(self gui.IWidget)
- func (this *EditorTabs) IsSplit() bool
- func (this *EditorTabs) Layout()
- func (this *EditorTabs) OnKeyDown(key int, repeat bool)
- func (this *EditorTabs) OnLeftDown(x, y float64)
- func (this *EditorTabs) OnMouseLeave()
- func (this *EditorTabs) OnMouseMove(x, y float64)
- func (this *EditorTabs) OnResize()
- func (this *EditorTabs) OnTextInput(s string)
- func (this *EditorTabs) OpenFile(path string)
- func (this *EditorTabs) OpenFileAtLine(path string, line int)
- func (this *EditorTabs) OpenFilePaths() []string
- func (this *EditorTabs) SaveAll()
- func (this *EditorTabs) SaveCurrent()
- func (this *EditorTabs) TabCount() int
- func (this *EditorTabs) Title() string
- func (this *EditorTabs) ToggleSplit()
- type FakeWidget
- func (this *FakeWidget) DrawSelf(g paint.Painter)
- func (this *FakeWidget) EnumProperties(list prop.IPropertyList)
- func (this *FakeWidget) EventHandlers() map[string]string
- func (this *FakeWidget) Generate() gui.IWidget
- func (this *FakeWidget) GetCode() string
- func (this *FakeWidget) Init(self graph.IItem)
- func (this *FakeWidget) IsLocked() bool
- func (this *FakeWidget) Layout()
- func (this *FakeWidget) LoadDesign(doc *core.TDoc) error
- func (f *FakeWidget) ManagesChildGeometry() bool
- func (this *FakeWidget) MarkDirty()
- func (this *FakeWidget) OnResize()
- func (this *FakeWidget) RemoveEventHandler(event string)
- func (this *FakeWidget) SaveDesign() *core.TDoc
- func (this *FakeWidget) SetCode(s string)
- func (this *FakeWidget) SetEventHandler(event, handler string)
- func (this *FakeWidget) SetEventHandlerChecked(event, handler string)
- func (this *FakeWidget) SetLocked(b bool)
- func (this *FakeWidget) SetWidget(iw gui.IWidget)
- func (this *FakeWidget) SetWidgetName(name string)
- func (this *FakeWidget) SizePx() (w, h float64)
- func (this *FakeWidget) Widget() gui.IWidget
- func (this *FakeWidget) WidgetFactoryName() string
- func (this *FakeWidget) WidgetName() string
- type FileExplorer
- func (this *FileExplorer) Draw(g paint.Painter)
- func (this *FileExplorer) Init(self gui.IWidget)
- func (this *FileExplorer) OnLeftDown(x, y float64)
- func (this *FileExplorer) OnMouseLeave()
- func (this *FileExplorer) OnMouseMove(x, y float64)
- func (this *FileExplorer) OnMouseWheel(x, y, z float64)
- func (this *FileExplorer) OnRightDown(x, y float64)
- func (this *FileExplorer) Refresh()
- func (this *FileExplorer) SetRootDir(dir string)
- func (this *FileExplorer) SigFileOpen(fn func(path string))
- type FileReplacement
- type FormPreset
- type FormPresetsPanel
- func (this *FormPresetsPanel) Draw(g paint.Painter)
- func (this *FormPresetsPanel) Init(self gui.IWidget)
- func (this *FormPresetsPanel) OnLeftDown(x, y float64)
- func (this *FormPresetsPanel) OnMouseLeave()
- func (this *FormPresetsPanel) OnMouseMove(x, y float64)
- func (this *FormPresetsPanel) OnMouseWheel(x, y, delta float64)
- func (this *FormPresetsPanel) SetScene(scene *GedScene)
- func (this *FormPresetsPanel) SizeHints() gui.SizeHints
- type GedScene
- func (this *GedScene) AddDesignChangedCallback(fn func()) int
- func (this *GedScene) AddGuide(vertical bool, pos float64)
- func (this *GedScene) DrawSelf(g paint.Painter)
- func (this *GedScene) EnumProperties(list prop.IPropertyList)
- func (this *GedScene) Filename() string
- func (this *GedScene) FormTitle() string
- func (this *GedScene) Generate() *Design
- func (scene *GedScene) GenerateCode(opts CodeGenOptions) string
- func (scene *GedScene) GenerateCodeFile(filename string, opts CodeGenOptions) (SplitResult, error)
- func (scene *GedScene) GenerateCodeIndexed(opts CodeGenOptions) GeneratedCode
- func (scene *GedScene) GenerateCodeWithMod(projectDir string, opts CodeGenOptions) string
- func (scene *GedScene) GenerateDeclCode(opts CodeGenOptions) string
- func (scene *GedScene) GenerateUserCode(opts CodeGenOptions) string
- func (this *GedScene) Grid() GridModel
- func (this *GedScene) Guides() sceneGuides
- func (this *GedScene) Init(self graph.IItem)
- func (this *GedScene) Layout()
- func (this *GedScene) LoadDesign(doc *core.TDoc) error
- func (this *GedScene) MissingWidgets() []string
- func (this *GedScene) NotifyDesignChanged()
- func (this *GedScene) OpenFile(filename string) error
- func (this *GedScene) PushCommand(cmd gui.ICommand)
- func (this *GedScene) RemoveDesignChangedCallback(id int)
- func (this *GedScene) RemoveGuide(vertical bool, index int)
- func (this *GedScene) Save() bool
- func (this *GedScene) SaveDesign() *core.TDoc
- func (this *GedScene) SetFilename(f string)
- func (this *GedScene) SetFormTitle(s string)
- func (this *GedScene) SetGrid(g GridModel)
- func (this *GedScene) SetTagDict(decls []TagDecl)
- func (this *GedScene) SigDesignChanged(fn func())
- func (this *GedScene) TagDict() []TagDecl
- type GedView
- func (this *GedView) AddSelectionCallback(cb SelectionCallback)
- func (this *GedView) AlignSelection(mode AlignMode)
- func (v *GedView) BreakLayout() bool
- func (this *GedView) BreakLayoutSelection()
- func (this *GedView) BringSelectionToFront()
- func (v *GedView) CanBreakLayout() bool
- func (v *GedView) CanLayoutSelection(kind LayoutKind) bool
- func (this *GedView) Close()
- func (this *GedView) CopySelected()
- func (this *GedView) DeleteSelectedItems()
- func (this *GedView) Draw(g paint.Painter)
- func (this *GedView) DuplicateSelection()
- func (this *GedView) GedScene() *GedScene
- func (this *GedView) GridSize() float64
- func (this *GedView) Init(self gui.IWidget)
- func (this *GedView) IsShowGrid() bool
- func (this *GedView) IsShowGuides() bool
- func (this *GedView) IsSnapToGrid() bool
- func (this *GedView) LayOutSelection(horizontal bool)
- func (v *GedView) LayoutSelection(kind LayoutKind) bool
- func (this *GedView) OnDragEnter(x, y float64, dnd gui.IDndContext)
- func (this *GedView) OnDragLeave()
- func (this *GedView) OnDragMove(x, y float64, dnd gui.IDndContext)
- func (this *GedView) OnDrop(x, y float64, dnd gui.IDndContext)
- func (this *GedView) OnKeyDown(key int, repeat bool)
- func (this *GedView) OnKeyUp(key int)
- func (this *GedView) OnLeftDown(x, y float64)
- func (this *GedView) OnLeftUp(x, y float64)
- func (this *GedView) OnMouseMove(x, y float64)
- func (this *GedView) OnRightUp(x, y float64)
- func (this *GedView) OpenFile(filename string) error
- func (this *GedView) PasteItems()
- func (this *GedView) Redo()
- func (this *GedView) SameSizeSelection(mode graph.SameSizeMode)
- func (this *GedView) SendSelectionToBack()
- func (v *GedView) SetContextPanelCallbacks(properties, code func())
- func (this *GedView) SetGridSize(size float64)
- func (this *GedView) SetGridStep(step float64)
- func (this *GedView) SetShowGrid(show bool)
- func (this *GedView) SetShowGuides(show bool)
- func (this *GedView) SetSnapEnabled(enabled bool)
- func (this *GedView) SetSnapToGrid(enabled bool)
- func (this *GedView) SnapEnabled() bool
- func (this *GedView) Undo()
- func (this *GedView) WantsTab(shift bool) bool
- type GenerateResult
- type GenerateRunnable
- type GeneratedCode
- type GitBranchInfo
- type GitChangesPanel
- func (this *GitChangesPanel) Clear()
- func (this *GitChangesPanel) ClearStaged()
- func (this *GitChangesPanel) Draw(g paint.Painter)
- func (this *GitChangesPanel) Entries() []core.GitStatusEntry
- func (this *GitChangesPanel) IndexState(path string) GitIndexState
- func (this *GitChangesPanel) Init(self gui.IWidget)
- func (this *GitChangesPanel) OnKeyDown(key int, repeat bool)
- func (this *GitChangesPanel) OnLeftDown(x, y float64)
- func (this *GitChangesPanel) OnMouseLeave()
- func (this *GitChangesPanel) OnMouseMove(x, y float64)
- func (this *GitChangesPanel) OnMouseWheel(x, y, z float64)
- func (this *GitChangesPanel) OnTextInput(s string)
- func (this *GitChangesPanel) SetEntries(entries []core.GitStatusEntry)
- func (this *GitChangesPanel) SetFiles(files []GitFileState)
- func (this *GitChangesPanel) SetStaged(path string, on bool)
- func (this *GitChangesPanel) SigCommit(fn func(message string, stagedPaths []string))
- func (this *GitChangesPanel) SigFileActivated(fn func(entry core.GitStatusEntry))
- func (this *GitChangesPanel) SigFileDiff(fn func(entry core.GitStatusEntry))
- func (this *GitChangesPanel) SigStage(fn func(path string))
- func (this *GitChangesPanel) SigUnstage(fn func(path string))
- func (this *GitChangesPanel) SigUnstageRequested(fn func(paths []string))
- func (this *GitChangesPanel) SizeHints() gui.SizeHints
- func (this *GitChangesPanel) StageAll()
- func (this *GitChangesPanel) StagedPaths() []string
- func (this *GitChangesPanel) UnstageAll()
- type GitFileState
- type GitIndexState
- type GitLogPanel
- func (this *GitLogPanel) Clear()
- func (this *GitLogPanel) Commits() []core.GitCommit
- func (this *GitLogPanel) Draw(g paint.Painter)
- func (this *GitLogPanel) Init(self gui.IWidget)
- func (this *GitLogPanel) OnLeftDown(x, y float64)
- func (this *GitLogPanel) OnMouseLeave()
- func (this *GitLogPanel) OnMouseMove(x, y float64)
- func (this *GitLogPanel) OnMouseWheel(x, y, z float64)
- func (this *GitLogPanel) SetCommits(commits []core.GitCommit)
- func (this *GitLogPanel) SigCommitActivated(fn func(commit core.GitCommit))
- func (this *GitLogPanel) SizeHints() gui.SizeHints
- type GitRemote
- type GitWorkspaceModel
- func (this *GitWorkspaceModel) Clear()
- func (this *GitWorkspaceModel) Collapsed(state GitIndexState) bool
- func (this *GitWorkspaceModel) Count(state GitIndexState) int
- func (this *GitWorkspaceModel) Files() []GitFileState
- func (this *GitWorkspaceModel) Group(state GitIndexState) []GitFileState
- func (this *GitWorkspaceModel) RowAt(idx int) (row GitWorkspaceRow, ok bool)
- func (this *GitWorkspaceModel) Rows() []GitWorkspaceRow
- func (this *GitWorkspaceModel) SetCollapsed(state GitIndexState, on bool)
- func (this *GitWorkspaceModel) SetFiles(files []GitFileState)
- func (this *GitWorkspaceModel) ToggleCollapsed(state GitIndexState)
- type GitWorkspacePanel
- func (this *GitWorkspacePanel) Branch() GitBranchInfo
- func (this *GitWorkspacePanel) Clear()
- func (this *GitWorkspacePanel) Collapsed(state GitIndexState) bool
- func (this *GitWorkspacePanel) Draw(g paint.Painter)
- func (this *GitWorkspacePanel) Files() []GitFileState
- func (this *GitWorkspacePanel) Init(self gui.IWidget)
- func (this *GitWorkspacePanel) OnKeyDown(key int, repeat bool)
- func (this *GitWorkspacePanel) OnLeftDown(x, y float64)
- func (this *GitWorkspacePanel) OnMouseLeave()
- func (this *GitWorkspacePanel) OnMouseMove(x, y float64)
- func (this *GitWorkspacePanel) OnMouseWheel(x, y, z float64)
- func (this *GitWorkspacePanel) OnTextInput(s string)
- func (this *GitWorkspacePanel) Remotes() []GitRemote
- func (this *GitWorkspacePanel) Rows() []GitWorkspaceRow
- func (this *GitWorkspacePanel) SetBranch(info GitBranchInfo)
- func (this *GitWorkspacePanel) SetCollapsed(state GitIndexState, on bool)
- func (this *GitWorkspacePanel) SetEntries(entries []core.GitStatusEntry)
- func (this *GitWorkspacePanel) SetFiles(files []GitFileState)
- func (this *GitWorkspacePanel) SetRemotes(remotes []GitRemote)
- func (this *GitWorkspacePanel) SigCheckout(fn func(branch string))
- func (this *GitWorkspacePanel) SigCreateBranch(fn func(name string))
- func (this *GitWorkspacePanel) SigFetch(fn func())
- func (this *GitWorkspacePanel) SigFileActivated(fn func(path string))
- func (this *GitWorkspacePanel) SigPull(fn func())
- func (this *GitWorkspacePanel) SigPush(fn func())
- func (this *GitWorkspacePanel) SigResolve(fn func(path string))
- func (this *GitWorkspacePanel) SigStash(fn func())
- func (this *GitWorkspacePanel) SigStashPop(fn func())
- func (this *GitWorkspacePanel) SizeHints() gui.SizeHints
- type GitWorkspaceRow
- type GitWorkspaceRowKind
- type GlobalSearchPanel
- func (this *GlobalSearchPanel) ApplyReplacements(reps []FileReplacement) error
- func (this *GlobalSearchPanel) ComputeReplacements() []FileReplacement
- func (this *GlobalSearchPanel) Draw(g paint.Painter)
- func (this *GlobalSearchPanel) Init(self gui.IWidget)
- func (this *GlobalSearchPanel) OnKeyDown(key int, repeat bool)
- func (this *GlobalSearchPanel) OnLeftDown(x, y float64)
- func (this *GlobalSearchPanel) OnMouseLeave()
- func (this *GlobalSearchPanel) OnMouseMove(x, y float64)
- func (this *GlobalSearchPanel) OnMouseWheel(x, y, z float64)
- func (this *GlobalSearchPanel) OnTextInput(s string)
- func (this *GlobalSearchPanel) ReplaceAll()
- func (this *GlobalSearchPanel) Search(query string)
- func (this *GlobalSearchPanel) SetCaseSensitive(on bool)
- func (this *GlobalSearchPanel) SetExclude(patterns []string)
- func (this *GlobalSearchPanel) SetInclude(exts []string)
- func (this *GlobalSearchPanel) SetRegex(on bool)
- func (this *GlobalSearchPanel) SetRootDir(dir string)
- func (this *GlobalSearchPanel) SetWholeWord(on bool)
- func (this *GlobalSearchPanel) SigFileReplaced(fn func(path, content string))
- func (this *GlobalSearchPanel) SigOpen(fn func(path string, line int))
- type GoToolGroup
- type GoToolRow
- type GoToolsPanel
- func (this *GoToolsPanel) Clear()
- func (this *GoToolsPanel) Draw(g paint.Painter)
- func (this *GoToolsPanel) Findings() []core.Finding
- func (this *GoToolsPanel) Groups() []GoToolGroup
- func (this *GoToolsPanel) Init(self gui.IWidget)
- func (this *GoToolsPanel) IsCollapsed(tool string) bool
- func (this *GoToolsPanel) OnLeftDown(x, y float64)
- func (this *GoToolsPanel) OnMouseLeave()
- func (this *GoToolsPanel) OnMouseMove(x, y float64)
- func (this *GoToolsPanel) OnMouseWheel(x, y, z float64)
- func (this *GoToolsPanel) SetFindings(findings []core.Finding)
- func (this *GoToolsPanel) SetTools(tools []core.Tool)
- func (this *GoToolsPanel) SigActivate(fn func(file string, line int))
- func (this *GoToolsPanel) SigRun(fn func(tool string))
- func (this *GoToolsPanel) SizeHints() gui.SizeHints
- func (this *GoToolsPanel) ToolRows() []GoToolRow
- type GridModel
- type Hint
- type InlayHints
- func (this *InlayHints) Clear()
- func (this *InlayHints) Hints() []Hint
- func (this *InlayHints) HintsFor(revision int) []Hint
- func (this *InlayHints) HintsOnLine(revision, line int) []Hint
- func (this *InlayHints) Revision() int
- func (this *InlayHints) Set(revision int, hints []Hint) bool
- func (this *InlayHints) SetRevision(revision int)
- func (this *InlayHints) Stale(revision int) bool
- type KeyBinding
- type KeyMap
- type KeymapPanel
- func (this *KeymapPanel) Draw(g paint.Painter)
- func (this *KeymapPanel) Init(self gui.IWidget)
- func (this *KeymapPanel) Keymap() *KeyMap
- func (this *KeymapPanel) OnLeftDown(x, y float64)
- func (this *KeymapPanel) OnMouseLeave()
- func (this *KeymapPanel) OnMouseMove(x, y float64)
- func (this *KeymapPanel) OnMouseWheel(x, y, delta float64)
- func (this *KeymapPanel) SizeHints() gui.SizeHints
- type LayoutKind
- type Lens
- type LineInsights
- type LogEntry
- type LogLevel
- type LogPanel
- func (this *LogPanel) Append(level LogLevel, message string)
- func (this *LogPanel) Clear()
- func (this *LogPanel) Draw(g paint.Painter)
- func (this *LogPanel) Entries() []LogEntry
- func (this *LogPanel) Filter() LogLevel
- func (this *LogPanel) Init(self gui.IWidget)
- func (this *LogPanel) MaxEntries() int
- func (this *LogPanel) OnLeftDown(x, y float64)
- func (this *LogPanel) OnMouseLeave()
- func (this *LogPanel) OnMouseMove(x, y float64)
- func (this *LogPanel) OnMouseWheel(x, y, z float64)
- func (this *LogPanel) SetFilter(level LogLevel)
- func (this *LogPanel) SetMaxEntries(n int)
- func (this *LogPanel) SigEntryClicked(fn func(LogEntry))
- func (this *LogPanel) SizeHints() gui.SizeHints
- type MergeChoice
- type MergeEditor
- func (this *MergeEditor) CanSave() bool
- func (this *MergeEditor) ConflictCount() int
- func (this *MergeEditor) Draw(g paint.Painter)
- func (this *MergeEditor) Init(self gui.IWidget)
- func (this *MergeEditor) Model() *MergeModel
- func (this *MergeEditor) OnLeftDown(x, y float64)
- func (this *MergeEditor) OnMouseLeave()
- func (this *MergeEditor) OnMouseMove(x, y float64)
- func (this *MergeEditor) OnMouseWheel(x, y, z float64)
- func (this *MergeEditor) Resolve(index int, choice MergeChoice) bool
- func (this *MergeEditor) Result() string
- func (this *MergeEditor) Rows() []MergeRow
- func (this *MergeEditor) Save() bool
- func (this *MergeEditor) SetChunks(chunks []core.MergeChunk)
- func (this *MergeEditor) SetConflictText(text string) error
- func (this *MergeEditor) SetManual(index int, lines []string) bool
- func (this *MergeEditor) SetMerge(base, ours, theirs []string)
- func (this *MergeEditor) SigResolved(fn func(index int, choice MergeChoice))
- func (this *MergeEditor) SigSave(fn func(text string))
- func (this *MergeEditor) SizeHints() gui.SizeHints
- func (this *MergeEditor) UnresolvedCount() int
- type MergeModel
- func (m *MergeModel) CanSave() bool
- func (m *MergeModel) Choice(i int) MergeChoice
- func (m *MergeModel) Chunk(i int) (core.MergeChunk, bool)
- func (m *MergeModel) ConflictCount() int
- func (m *MergeModel) Count() int
- func (m *MergeModel) Resolve(i int, choice MergeChoice) bool
- func (m *MergeModel) Result() string
- func (m *MergeModel) ResultLines() []string
- func (m *MergeModel) Rows() []MergeRow
- func (m *MergeModel) SetChunks(chunks []core.MergeChunk)
- func (m *MergeModel) SetManual(i int, lines []string) bool
- func (m *MergeModel) UnresolvedCount() int
- type MergeRow
- type MergeSide
- type ModeConfig
- type ModeSelector
- func (this *ModeSelector) CurrentMode() DesignerMode
- func (this *ModeSelector) Draw(g paint.Painter)
- func (this *ModeSelector) Init(self gui.IWidget)
- func (this *ModeSelector) OnLeftDown(x, y float64)
- func (this *ModeSelector) OnMouseLeave()
- func (this *ModeSelector) OnMouseMove(x, y float64)
- func (this *ModeSelector) SetMode(mode DesignerMode)
- func (this *ModeSelector) SigModeChanged(fn func(DesignerMode))
- func (this *ModeSelector) SizeHints() gui.SizeHints
- type ObjectInspector
- func (this *ObjectInspector) Draw(g paint.Painter)
- func (this *ObjectInspector) Init(self gui.IWidget)
- func (this *ObjectInspector) Layout()
- func (this *ObjectInspector) OnKeyDown(key int, repeat bool)
- func (this *ObjectInspector) OnKeyUp(key int)
- func (this *ObjectInspector) OnLeftDown(x, y float64)
- func (this *ObjectInspector) OnLeftUp(x, y float64)
- func (this *ObjectInspector) OnMouseLeave()
- func (this *ObjectInspector) OnMouseMove(x, y float64)
- func (this *ObjectInspector) OnMouseWheel(x, y, z float64)
- func (this *ObjectInspector) Rebuild()
- func (this *ObjectInspector) RowNames() []string
- func (this *ObjectInspector) SelectItem(item graph.IItem)
- func (this *ObjectInspector) SelectedItem() graph.IItem
- func (this *ObjectInspector) SetFilter(text string)
- func (this *ObjectInspector) SetScene(scene *GedScene)
- func (this *ObjectInspector) SigSelect(fn func(graph.IItem))
- func (this *ObjectInspector) SyncSelection(items []graph.IItem)
- type OutlineSymbol
- type PackagesPanel
- func (this *PackagesPanel) Draw(g paint.Painter)
- func (this *PackagesPanel) Init(self gui.IWidget)
- func (this *PackagesPanel) IsExpanded(importPath string) bool
- func (this *PackagesPanel) LoadFromDir(dir string) error
- func (this *PackagesPanel) OnLeftDown(x, y float64)
- func (this *PackagesPanel) OnMouseLeave()
- func (this *PackagesPanel) OnMouseMove(x, y float64)
- func (this *PackagesPanel) OnMouseWheel(x, y, z float64)
- func (this *PackagesPanel) Packages() []core.GoListPackage
- func (this *PackagesPanel) SetPackages(pkgs []core.GoListPackage)
- func (this *PackagesPanel) SigFileActivated(fn func(pkg core.GoListPackage, file string))
- func (this *PackagesPanel) SigPackageActivated(fn func(pkg core.GoListPackage))
- func (this *PackagesPanel) SizeHints() gui.SizeHints
- type Pane
- type PkgNode
- type PreviewForm
- type Problem
- type ProblemKind
- type ProblemSource
- type ProblemsPanel
- func (this *ProblemsPanel) Clear()
- func (this *ProblemsPanel) Draw(g paint.Painter)
- func (this *ProblemsPanel) ErrorCount() int
- func (this *ProblemsPanel) Init(self gui.IWidget)
- func (this *ProblemsPanel) OnLeftDown(x, y float64)
- func (this *ProblemsPanel) OnMouseLeave()
- func (this *ProblemsPanel) OnMouseMove(x, y float64)
- func (this *ProblemsPanel) OnMouseWheel(x, y, z float64)
- func (this *ProblemsPanel) Problems() []Problem
- func (this *ProblemsPanel) SetOutput(output string)
- func (this *ProblemsPanel) SetProblems(problems []Problem)
- func (this *ProblemsPanel) SigItemActivated(fn func(item graph.IItem))
- func (this *ProblemsPanel) SigProblemActivated(fn func(file string, line, col int))
- func (this *ProblemsPanel) SizeHints() gui.SizeHints
- func (this *ProblemsPanel) SortByFile()
- func (this *ProblemsPanel) WarningCount() int
- type Project
- type ProjectSettingsPanel
- func (this *ProjectSettingsPanel) BuildTags() string
- func (this *ProjectSettingsPanel) Draw(g paint.Painter)
- func (this *ProjectSettingsPanel) Init(self gui.IWidget)
- func (this *ProjectSettingsPanel) Kit() core.Kit
- func (this *ProjectSettingsPanel) LoadKits() error
- func (this *ProjectSettingsPanel) OnLeftDown(x, y float64)
- func (this *ProjectSettingsPanel) OnMouseLeave()
- func (this *ProjectSettingsPanel) OnMouseMove(x, y float64)
- func (this *ProjectSettingsPanel) OnMouseWheel(x, y, delta float64)
- func (this *ProjectSettingsPanel) OutputDir() string
- func (this *ProjectSettingsPanel) ProjectRoot() string
- func (this *ProjectSettingsPanel) Refresh()
- func (this *ProjectSettingsPanel) RefreshGoMod(projectDir string)
- func (this *ProjectSettingsPanel) ResolvedKit() core.Kit
- func (this *ProjectSettingsPanel) SaveError() error
- func (this *ProjectSettingsPanel) SaveKits() error
- func (this *ProjectSettingsPanel) SetKit(k core.Kit)
- func (this *ProjectSettingsPanel) SetProjectRoot(dir string)
- func (this *ProjectSettingsPanel) SetVariantName(name string) error
- func (this *ProjectSettingsPanel) SigApply(fn func())
- func (this *ProjectSettingsPanel) SizeHints() gui.SizeHints
- func (this *ProjectSettingsPanel) VariantName() string
- type ProjectTemplate
- type QuickHelpPanel
- func (this *QuickHelpPanel) Doc() string
- func (this *QuickHelpPanel) Draw(g paint.Painter)
- func (this *QuickHelpPanel) Init(self gui.IWidget)
- func (this *QuickHelpPanel) Lookup(symbol string)
- func (this *QuickHelpPanel) OnLeftDown(x, y float64)
- func (this *QuickHelpPanel) OnMouseWheel(x, y, z float64)
- func (this *QuickHelpPanel) SetDoc(text string)
- func (this *QuickHelpPanel) SizeHints() gui.SizeHints
- func (this *QuickHelpPanel) Symbol() string
- type QuickOpenPopup
- func (this *QuickOpenPopup) Accept()
- func (this *QuickOpenPopup) Dismiss()
- func (this *QuickOpenPopup) DrawPopup(g paint.Painter, hostW, hostH float64)
- func (this *QuickOpenPopup) OnBackspace()
- func (this *QuickOpenPopup) OnTextInput(s string)
- func (this *QuickOpenPopup) SelectNext()
- func (this *QuickOpenPopup) SelectPrev()
- func (this *QuickOpenPopup) SetOpenCallback(fn func(path string))
- func (this *QuickOpenPopup) SetRootDir(dir string)
- func (this *QuickOpenPopup) Show()
- func (this *QuickOpenPopup) Visible() bool
- type RefKind
- type ReferenceLoc
- type ReferencesPanel
- func (this *ReferencesPanel) Clear()
- func (this *ReferencesPanel) Draw(g paint.Painter)
- func (this *ReferencesPanel) Filter() string
- func (this *ReferencesPanel) Grouped() bool
- func (this *ReferencesPanel) Init(self gui.IWidget)
- func (this *ReferencesPanel) IsCollapsed(file string) bool
- func (this *ReferencesPanel) Loading() bool
- func (this *ReferencesPanel) Locations() []ReferenceLoc
- func (this *ReferencesPanel) OnLeftDown(x, y float64)
- func (this *ReferencesPanel) OnMouseLeave()
- func (this *ReferencesPanel) OnMouseMove(x, y float64)
- func (this *ReferencesPanel) OnMouseWheel(x, y, z float64)
- func (this *ReferencesPanel) Query() string
- func (this *ReferencesPanel) SetFilter(text string)
- func (this *ReferencesPanel) SetGrouped(on bool)
- func (this *ReferencesPanel) SetLoading(on bool)
- func (this *ReferencesPanel) SetLocations(locs []ReferenceLoc)
- func (this *ReferencesPanel) SetQuery(title string)
- func (this *ReferencesPanel) SetReferences(refs []ReferenceLoc)
- func (this *ReferencesPanel) SigCancel(fn func())
- func (this *ReferencesPanel) SigLocationActivated(fn func(file string, line, col int))
- func (this *ReferencesPanel) SizeHints() gui.SizeHints
- type RunConfig
- type RunConfigPanel
- func (this *RunConfigPanel) AddConfig(name string) error
- func (this *RunConfigPanel) AddEnv(text string)
- func (this *RunConfigPanel) Apply() error
- func (this *RunConfigPanel) Config() RunConfig
- func (this *RunConfigPanel) Configs() []runconfig.Config
- func (this *RunConfigPanel) Draw(g paint.Painter)
- func (this *RunConfigPanel) DuplicateSelected(newName string) error
- func (this *RunConfigPanel) EditedConfig() runconfig.Config
- func (this *RunConfigPanel) Init(self gui.IWidget)
- func (this *RunConfigPanel) Kit() string
- func (this *RunConfigPanel) Mode() string
- func (this *RunConfigPanel) OnLeftDown(x, y float64)
- func (this *RunConfigPanel) OnMouseLeave()
- func (this *RunConfigPanel) OnMouseMove(x, y float64)
- func (this *RunConfigPanel) OnMouseWheel(x, y, delta float64)
- func (this *RunConfigPanel) RemoveEnv(idx int)
- func (this *RunConfigPanel) RemoveSelected() bool
- func (this *RunConfigPanel) SelectConfig(name string) bool
- func (this *RunConfigPanel) SelectIndex(idx int) bool
- func (this *RunConfigPanel) Selected() string
- func (this *RunConfigPanel) SetArgs(args string)
- func (this *RunConfigPanel) SetConfig(cfg RunConfig)
- func (this *RunConfigPanel) SetEnvAt(idx int, text string)
- func (this *RunConfigPanel) SetKit(kit string)
- func (this *RunConfigPanel) SetMode(mode string)
- func (this *RunConfigPanel) SetStore(s *runconfig.Store)
- func (this *RunConfigPanel) SetTarget(target string)
- func (this *RunConfigPanel) SetWorkingDir(dir string)
- func (this *RunConfigPanel) SigApply(fn func(cfg runconfig.Config))
- func (this *RunConfigPanel) SigChanged(fn func(cfg RunConfig))
- func (this *RunConfigPanel) SigSelect(fn func(cfg runconfig.Config))
- func (this *RunConfigPanel) SizeHints() gui.SizeHints
- func (this *RunConfigPanel) Store() *runconfig.Store
- func (this *RunConfigPanel) Target() string
- type SearchMatch
- type SelectionCallback
- type SemanticLegend
- type SemanticTokenEdit
- type SemanticTokens
- func (this *SemanticTokens) ApplyEdits(resultID string, edits []SemanticTokenEdit) error
- func (this *SemanticTokens) Clear()
- func (this *SemanticTokens) Data() []uint32
- func (this *SemanticTokens) Legend() SemanticLegend
- func (this *SemanticTokens) ResultID() string
- func (this *SemanticTokens) SetData(resultID string, data []uint32) error
- func (this *SemanticTokens) SetLegend(legend SemanticLegend)
- func (this *SemanticTokens) Tokens() []Token
- func (this *SemanticTokens) TokensOnLine(line int) []Token
- type SessionState
- type Severity
- type ShortcutDef
- type ShortcutsPanel
- type SplitOrientation
- type SplitResult
- type TabOrderMode
- func (this *TabOrderMode) DrawOverlay(g paint.Painter)
- func (this *TabOrderMode) Enter()
- func (this *TabOrderMode) Exit()
- func (this *TabOrderMode) IsActive() bool
- func (this *TabOrderMode) OnLeftDown(x, y float64) bool
- func (this *TabOrderMode) Order() []graph.IItem
- func (this *TabOrderMode) Reset()
- type TagDecl
- type TemplateWidget
- type TerminalPanel
- func (this *TerminalPanel) Clear()
- func (this *TerminalPanel) CommandRunning() bool
- func (this *TerminalPanel) Cwd() string
- func (this *TerminalPanel) Draw(g paint.Painter)
- func (this *TerminalPanel) ExtraEnv() []string
- func (this *TerminalPanel) Hint(msg string)
- func (this *TerminalPanel) History() []string
- func (this *TerminalPanel) Init(self gui.IWidget)
- func (this *TerminalPanel) OnKeyDown(key int, repeat bool)
- func (this *TerminalPanel) OnLeftDown(x, y float64)
- func (this *TerminalPanel) OnMouseWheel(x, y, z float64)
- func (this *TerminalPanel) OnTextInput(s string)
- func (this *TerminalPanel) Run(cmd string)
- func (this *TerminalPanel) RunWithEnv(cmd string, extraEnv []string)
- func (this *TerminalPanel) SessionActive() bool
- func (this *TerminalPanel) SetCwd(cwd string)
- func (this *TerminalPanel) SetExtraEnv(env []string)
- func (this *TerminalPanel) SetHistoryFile(path string)
- func (this *TerminalPanel) SigSubmit(fn func(cmd string))
- func (this *TerminalPanel) SizeHints() gui.SizeHints
- func (this *TerminalPanel) StartSession(shell string) error
- func (this *TerminalPanel) StopRunning() bool
- func (this *TerminalPanel) StopSession()
- func (this *TerminalPanel) Term() *AnsiTerm
- type TestExplorerModel
- func (m *TestExplorerModel) Clear()
- func (m *TestExplorerModel) CollapseAll()
- func (m *TestExplorerModel) Counts() (pass, fail, skip int)
- func (m *TestExplorerModel) ExpandAll()
- func (m *TestExplorerModel) FailedOnly() bool
- func (m *TestExplorerModel) FailedTests() []TestRef
- func (m *TestExplorerModel) FilterText() string
- func (m *TestExplorerModel) Find(pkg, test string) *TestTreeNode
- func (m *TestExplorerModel) Packages() []*TestTreeNode
- func (m *TestExplorerModel) Rows() []TestExplorerRow
- func (m *TestExplorerModel) SetFailedOnly(b bool)
- func (m *TestExplorerModel) SetFilter(text string)
- func (m *TestExplorerModel) SetResults(pkgs []PkgNode)
- type TestExplorerPanel
- func (this *TestExplorerPanel) Clear()
- func (this *TestExplorerPanel) Draw(g paint.Painter)
- func (this *TestExplorerPanel) Init(self gui.IWidget)
- func (this *TestExplorerPanel) Model() *TestExplorerModel
- func (this *TestExplorerPanel) OnLeftDown(x, y float64)
- func (this *TestExplorerPanel) OnMouseLeave()
- func (this *TestExplorerPanel) OnMouseMove(x, y float64)
- func (this *TestExplorerPanel) OnMouseWheel(x, y, z float64)
- func (this *TestExplorerPanel) OnRightDown(x, y float64)
- func (this *TestExplorerPanel) Rows() []TestExplorerRow
- func (this *TestExplorerPanel) SetFailedOnly(b bool)
- func (this *TestExplorerPanel) SetFilter(text string)
- func (this *TestExplorerPanel) SetResults(pkgs []PkgNode)
- func (this *TestExplorerPanel) SigActivate(fn func(file string, line int))
- func (this *TestExplorerPanel) SigDebug(fn func(pkg, test string))
- func (this *TestExplorerPanel) SigRerunFailed(fn func())
- func (this *TestExplorerPanel) SigRun(fn func(pkg, test string))
- func (this *TestExplorerPanel) SizeHints() gui.SizeHints
- type TestExplorerRow
- type TestNode
- type TestNodeStatus
- type TestRef
- type TestResult
- type TestResultsPanel
- func (this *TestResultsPanel) Clear()
- func (this *TestResultsPanel) Counts() (passed, failed, skipped int)
- func (this *TestResultsPanel) Draw(g paint.Painter)
- func (this *TestResultsPanel) Init(self gui.IWidget)
- func (this *TestResultsPanel) OnLeftDown(x, y float64)
- func (this *TestResultsPanel) OnMouseLeave()
- func (this *TestResultsPanel) OnMouseMove(x, y float64)
- func (this *TestResultsPanel) OnMouseWheel(x, y, z float64)
- func (this *TestResultsPanel) OnRightDown(x, y float64)
- func (this *TestResultsPanel) Results() []TestResult
- func (this *TestResultsPanel) SetOutput(output string)
- func (this *TestResultsPanel) SigResultActivated(fn func(r TestResult))
- func (this *TestResultsPanel) SigRunTestRequested(fn func(name string))
- func (this *TestResultsPanel) SizeHints() gui.SizeHints
- type TestStatus
- type TestTreeNode
- type ThemePreviewPanel
- func (this *ThemePreviewPanel) Draw(g paint.Painter)
- func (this *ThemePreviewPanel) Init(self gui.IWidget)
- func (this *ThemePreviewPanel) OnMouseDown(x, y float64, button int)
- func (this *ThemePreviewPanel) OnMouseLeave()
- func (this *ThemePreviewPanel) OnMouseMove(x, y float64)
- func (this *ThemePreviewPanel) SetChangeCallback(cb func(int))
- func (this *ThemePreviewPanel) SizeHints() gui.SizeHints
- type TodoGroupMode
- type TodoPanel
- func (this *TodoPanel) Clear()
- func (this *TodoPanel) Draw(g paint.Painter)
- func (this *TodoPanel) Filter() string
- func (this *TodoPanel) GroupBy() TodoGroupMode
- func (this *TodoPanel) Init(self gui.IWidget)
- func (this *TodoPanel) OnKeyDown(key int, repeat bool)
- func (this *TodoPanel) OnLeftDown(x, y float64)
- func (this *TodoPanel) OnMouseLeave()
- func (this *TodoPanel) OnMouseMove(x, y float64)
- func (this *TodoPanel) OnMouseWheel(x, y, z float64)
- func (this *TodoPanel) OnTextInput(s string)
- func (this *TodoPanel) Rows() []TodoRow
- func (this *TodoPanel) SetFilter(s string)
- func (this *TodoPanel) SetGroupBy(m TodoGroupMode)
- func (this *TodoPanel) SetRows(rows []TodoRow)
- func (this *TodoPanel) SigActivate(fn func(file string, line int))
- func (this *TodoPanel) SigRowActivated(fn func(file string, line int))
- func (this *TodoPanel) SizeHints() gui.SizeHints
- func (this *TodoPanel) ToggleGroupBy()
- type TodoRow
- type Token
- type TypeHierarchyModel
- func (m *TypeHierarchyModel) Clear()
- func (m *TypeHierarchyModel) IsMultiTarget() bool
- func (m *TypeHierarchyModel) Mode() string
- func (m *TypeHierarchyModel) Roots() []*TypeNode
- func (m *TypeHierarchyModel) RowAt(i int) (TypeHierarchyRow, bool)
- func (m *TypeHierarchyModel) RowCount() int
- func (m *TypeHierarchyModel) Rows() []TypeHierarchyRow
- func (m *TypeHierarchyModel) SetChildren(node *TypeNode, children []*TypeNode) bool
- func (m *TypeHierarchyModel) SetMode(mode string) bool
- func (m *TypeHierarchyModel) SetTargets(targets []*TypeNode)
- func (m *TypeHierarchyModel) SigExpand(fn func(node *TypeNode, mode string))
- func (m *TypeHierarchyModel) ToggleRow(i int) bool
- type TypeHierarchyPanel
- func (this *TypeHierarchyPanel) Draw(g paint.Painter)
- func (this *TypeHierarchyPanel) Init(self gui.IWidget)
- func (this *TypeHierarchyPanel) Mode() string
- func (this *TypeHierarchyPanel) Model() *TypeHierarchyModel
- func (this *TypeHierarchyPanel) OnLeftDown(x, y float64)
- func (this *TypeHierarchyPanel) OnMouseLeave()
- func (this *TypeHierarchyPanel) OnMouseMove(x, y float64)
- func (this *TypeHierarchyPanel) OnMouseWheel(x, y, z float64)
- func (this *TypeHierarchyPanel) SetMode(mode string) bool
- func (this *TypeHierarchyPanel) SetTargets(targets []*TypeNode)
- func (this *TypeHierarchyPanel) SigActivate(fn func(file string, line int))
- func (this *TypeHierarchyPanel) SigMode(fn func(mode string))
- func (this *TypeHierarchyPanel) SizeHints() gui.SizeHints
- type TypeHierarchyRow
- type TypeNode
- type UndoPanel
- func (this *UndoPanel) Draw(g paint.Painter)
- func (this *UndoPanel) GoTo(pos int)
- func (this *UndoPanel) Init(self gui.IWidget)
- func (this *UndoPanel) OnLeftDown(x, y float64)
- func (this *UndoPanel) OnMouseLeave()
- func (this *UndoPanel) OnMouseMove(x, y float64)
- func (this *UndoPanel) OnMouseWheel(x, y, z float64)
- func (this *UndoPanel) Rebuild()
- func (this *UndoPanel) Scene() *GedScene
- func (this *UndoPanel) SetScene(scene *GedScene)
- type VarRow
- type WatchEntry
- type WelcomeScreen
- func (this *WelcomeScreen) Draw(g paint.Painter)
- func (this *WelcomeScreen) OnLeftDown(x, y float64)
- func (this *WelcomeScreen) OnMouseMove(x, y float64)
- func (this *WelcomeScreen) SetBranding(info AboutInfo)
- func (this *WelcomeScreen) SetNewProjectCallback(cb func())
- func (this *WelcomeScreen) SetOpenFileCallback(cb func())
- func (this *WelcomeScreen) SetOpenRecentCallback(cb func(string))
- func (this *WelcomeScreen) SetRecentFiles(files []string)
- func (this *WelcomeScreen) SetTitle(s string)
- func (this *WelcomeScreen) SizeHints() gui.SizeHints
- func (this *WelcomeScreen) Title() string
- type WidgetDef
- type WidgetEvent
- type WidgetHelp
- type WidgetList
- type Workspace
- func (w *Workspace) ActiveDoc() string
- func (w *Workspace) ActivePane() *Pane
- func (w *Workspace) ActivePaneID() int
- func (w *Workspace) CloseDoc(paneID int, path string) (stillOpen, ok bool)
- func (w *Workspace) ClosePane(paneID int) bool
- func (w *Workspace) DuplicateViewToOtherPane(path string, toPaneID int) bool
- func (w *Workspace) IsOpen(path string) bool
- func (w *Workspace) MoveDocToPane(path string, fromPaneID, toPaneID int) bool
- func (w *Workspace) OpenDoc(path string) bool
- func (w *Workspace) OpenDocs() []string
- func (w *Workspace) PaneByID(id int) *Pane
- func (w *Workspace) PaneCount() int
- func (w *Workspace) Panes() []*Pane
- func (w *Workspace) SetActivePane(id int) bool
- func (w *Workspace) SplitActive(o SplitOrientation) int
- func (w *Workspace) ViewCount(path string) int
Constants ¶
const ( HintKindType = "type" HintKindParameter = "parameter" )
Hint kind values, mirroring LSP InlayHintKind (1 = Type, 2 = Parameter) as the strings the presentation layer switches on. An empty Kind means the server did not say, and the overlay styles it neutrally.
const ( // OutlineSortByPosition keeps declaration order: rows follow the file // top to bottom. This is the default, and what an outline is for. OutlineSortByPosition = 0 // OutlineSortByName sorts every level alphabetically (case-insensitive, // ties broken by line) — the "sort alphabetically" toggle. OutlineSortByName = 1 )
Sort modes accepted by SetSortMode.
const ( // AnsiDefaultColor marks a cell drawn with the terminal's default // foreground / background color. AnsiDefaultColor = -1 // AnsiRGBBase is the offset applied to 24-bit colors coming from // SGR 38;2 / 48;2. A cell color at or above it packs r<<16|g<<8|b; // a value in 0..255 is an xterm palette index. AnsiRGBBase = 1 << 24 )
const ( TypeHierarchySupertypes = "supertypes" TypeHierarchySubtypes = "subtypes" TypeHierarchyImplementations = "implementations" )
Hierarchy directions offered by the panel, in selector order. The host maps each to its own resolver — gopls `typeHierarchy/supertypes`, `typeHierarchy/subtypes` and `textDocument/implementation` respectively — and pushes the answers back as TypeNodes. The model never sees those wire structs.
const ( TypeKindInterface = "interface" TypeKindStruct = "struct" TypeKindMethod = "method" TypeKindTargets = "targets" )
TypeNode kinds. The first three describe real Go declarations; TypeKindTargets marks only the synthetic root the model inserts when the host resolves several candidate targets for one cursor position (see SetTargets).
const DefaultDesignExt = ".silkui"
DefaultDesignExt is the preferred file extension for SilkUI design files.
Variables ¶
var ( AlignLeftCallback func() AlignRightCallback func() AlignTopCallback func() AlignBottomCallback func() AlignCenterHCallback func() AlignCenterVCallback func() DistributeHCallback func() DistributeVCallback func() )
Alignment callbacks — set by the host application (design.go) so the GedView can trigger alignment operations defined in package main.
var BuildSource = ProblemSource{Kind: ProblemBuild}
BuildSource is where compiler output is filed. Only one build runs at a time, so it needs no further identity.
var DocClosedCallback func(*GedView)
DocClosedCallback is called with a design view the dock has just closed. Set by the host application, which is where anything keyed on an open document has to be retired; see GedView.Close.
var OnDesignMode func()
OnDesignMode is called when switching to design mode. Set by the application to control which tabs are active.
var OnEditMode func()
OnEditMode is called when switching to code/edit mode.
var PreviewCallback func()
PreviewCallback is called when Ctrl+R is pressed. Set by the host application.
var QuickOpenCallback func()
QuickOpenCallback is called when Ctrl+P is pressed. Set by the host application.
var RunCallback func()
RunCallback is called when F5 is pressed. Set by the host application.
var ShowCodePanelCallback func()
ShowCodePanelCallback is called after a widget is double-clicked on the canvas. The host application should bring the code panel tab to the front so the user can see and edit the widget's event handler code.
var SwitchToDesignCallback func()
SwitchToDesignCallback is called when Ctrl+1 is pressed. Set by the host application.
var SwitchToEditCallback func()
SwitchToEditCallback is called when Ctrl+2 is pressed. Set by the host application.
Functions ¶
func AnsiColorRGB ¶
AnsiColorRGB resolves a Cell color to concrete channels. ok is false for AnsiDefaultColor, where the caller supplies its own default.
func ApplyTemplate ¶
func ApplyTemplate(scene *GedScene, tmpl *ProjectTemplate)
ApplyTemplate populates a GedScene with widgets defined in the given ProjectTemplate. The scene is resized and a title is assigned. Each widget is created via the factory system and added through the undo stack so the user can revert the operation.
func AvailableEvents ¶
AvailableEvents returns the events codegen can bind for factoryName, in table order. The designer's property sheet builds its "事件" rows from this, so every event the user can bind is one the generator actually emits.
func CheckRecovery ¶
CheckRecovery checks if an autosave file exists for the given filename. Returns the autosave path if it exists and is newer than the original file, or empty string if no recovery is available.
func CleanupAutosave ¶
func CleanupAutosave(filename string)
CleanupAutosave removes the autosave file for the given filename.
func FindProjectRoot ¶
FindProjectRoot returns the directory of the nearest go.mod at or above startDir. An error means startDir is outside any Go module, which is the same as saying it is not in a project.
func FormatGenerateReport ¶
func FormatGenerateReport(root string, results []GenerateResult) string
FormatGenerateReport renders a whole batch into one dialog body: the counts first, then a line per design with paths relative to the project root. One dialog for the batch is the point — a modal per design makes regenerating a twenty-screen project unusable.
func GenerateDesign ¶
GenerateDesign turns one design into Go beside itself and returns the file written. This is the single place a design becomes code on disk: when the split generator lands, only the GenerateCodeFile call below changes and both halves of DesignOutputs get written from here.
module is the project's module path, already parsed by ScanProject, so this does not re-read go.mod per design.
func InitAutoSaver ¶
func InitAutoSaver()
InitAutoSaver creates and initializes the global auto-saver.
func IsDesignPath ¶
IsDesignPath reports whether path names a SilkUI design. It is the one rule the project scan and the file tree's double-click routing share, so a file the project generates code for is exactly a file the tree opens on the canvas. Extension comparison is case-insensitive because the designer's own save path is the only thing that normalises the case, and files arrive here from the filesystem.
func KeymapFilePath ¶
func KeymapFilePath() string
KeymapFilePath returns the on-disk location of the user's keymap override. Writing to this file is how user customizations persist across sessions.
func RegisterWidget ¶
RegisterWidget adds one plugin widget to every table the designer gates on. It is the only way into them from outside package ged, and it is all-or-nothing: the def is validated in full before anything is written, so a rejected one leaves the tables exactly as they were rather than half-written.
Call it from the plugin package's init(), after core.RegisterFactory has registered d.Factory.
func SaveAsTemplate ¶
SaveAsTemplate persists the current scene design as a reusable template. It creates the templates/ directory if needed, saves the scene's TDoc to "templates/{name}.silkui", and writes a metadata file with name+description.
func SaveKeymap ¶
SaveKeymap persists the entire binding list to KeymapFilePath(). The file is written atomically-ish via a straightforward WriteFile; this is adequate for single-user desktop use.
func SaveSession ¶
func SaveSession(state SessionState) error
SaveSession persists the given state to disk as JSON. The target directory is created by core at init time, so the write itself is the only failure path worth surfacing.
func ShowAboutDialog ¶
ShowAboutDialog keeps the standalone designer entry point compatible.
func ShowAboutDialogWithInfo ¶
ShowAboutDialogWithInfo lets an IDE or SDK host supply its own identity.
func ShowFormSettingsDialog ¶
ShowFormSettingsDialog opens 表单设置 for the view's scene and applies the entered values on 确定. Reports whether anything was applied.
func ShowTagDictionaryDialog ¶
ShowTagDictionaryDialog opens 标签字典 for the view's scene: the tags the design declares, with the unit / engineering range / alarm limits the generated app seeds them with, plus a 未声明 column naming the tags widgets are bound to that nothing declares. Applies on 确定 and reports whether anything changed.
func SwitchToDesignMode ¶
func SwitchToDesignMode()
SwitchToDesignMode activates design mode — widget palette + canvas + properties.
func SwitchToEditMode ¶
func SwitchToEditMode()
SwitchToEditMode activates code mode — file explorer + editor + build output.
Types ¶
type AboutInfo ¶
type AboutInfo struct {
Name string
Version string
Logo paint.Icon // Optional host identity; nil retains the SDK default.
}
AboutInfo identifies the host application separately from the Silk SDK. An empty Name defaults to Silk Designer; an unknown Version is omitted.
type AlignMode ¶
type AlignMode int
AlignMode selects an align-or-distribute operation. The first six entries reposition every rect onto a shared edge or centre line; AlignCenter centres on both axes at once; the last two even out the gaps between rects along one axis. Exported because the host application owns the 排列 menu and drives these through GedView.AlignSelection.
type AnsiTerm ¶
type AnsiTerm struct {
// contains filtered or unexported fields
}
AnsiTerm is a rows x cols terminal screen driven by a byte stream. It implements the subset a shell session needs: SGR attributes, relative and absolute cursor motion, line/screen erase, a scroll region, insert/delete of lines and characters, and the C0 controls. Unsupported sequences are swallowed without disturbing the screen.
AnsiTerm is not safe for concurrent use; TerminalPanel feeds it from the UI thread only.
func NewAnsiTerm ¶
NewAnsiTerm returns a cleared rows x cols screen. Non-positive dimensions are raised to 1 so the cursor always addresses a real cell.
func (*AnsiTerm) CursorPos ¶
CursorPos returns the 0-based cursor row and column. A cursor parked past the right edge by a deferred wrap reports the last column.
func (*AnsiTerm) LineString ¶
LineString returns row's text with trailing blanks removed, or "" when row is out of range.
func (*AnsiTerm) Reset ¶
func (t *AnsiTerm) Reset()
Reset restores the power-on state: cleared screen, home cursor, default attributes, full-screen scroll region, ground parser state.
func (*AnsiTerm) Resize ¶
Resize changes the grid to rows x cols, keeping as much content as makes sense: rows are copied from the top unless that would push the cursor line off the bottom, and columns are truncated on the right. The scroll region is kept when it spanned the whole screen and clamped otherwise; the cursor is clamped into the new bounds.
type AutoSaver ¶
type AutoSaver struct {
// contains filtered or unexported fields
}
AutoSaver provides automatic periodic saving of the current scene to a recovery file ({filename}.autosave). If the application crashes or is closed without saving, the autosave file can be used for recovery.
var GlobalAutoSaver *AutoSaver
GlobalAutoSaver is the singleton auto-saver instance.
func NewAutoSaver ¶
func NewAutoSaver() *AutoSaver
NewAutoSaver creates a new auto-saver with a default 60-second interval.
func (*AutoSaver) SetEnabled ¶
SetEnabled enables or disables auto-saving.
func (*AutoSaver) SetInterval ¶
SetInterval sets the auto-save interval duration.
type BindingRow ¶
type BindingRow struct {
Widget string
Factory string
Event string
Handler string
Bound bool
Known bool
}
BindingRow is one line of the panel: one event of one widget.
Bound is false for an event the design leaves unbound — the row exists so an event nobody wired is visible next to the ones that are. Known is false when widgetEvents has no entry for the (factory, event) pair, which is a binding the generator drops: recorded in the design, absent from the generated file.
type BindingsPanel ¶
BindingsPanel lists every event binding in one design, the 信号/槽 overview.
The property sheet's 事件 rows and the canvas's 绑定事件 submenu both show one widget at a time, so an event nobody bound — or two widgets sharing a handler name — is invisible until the design is generated. This panel reads the generator's own answers (walkFakeWidgets, handlerBindingsFor, AvailableEvents), so what it lists is what the generated file wires, not a second opinion maintained beside it.
It is a tool view, never a placeable widget: no factoryMap entry, so isPlaceable keeps it out of the palette.
func NewBindingsPanel ¶
func NewBindingsPanel() *BindingsPanel
NewBindingsPanel creates an empty bindings panel.
func (*BindingsPanel) Draw ¶
func (this *BindingsPanel) Draw(g paint.Painter)
Draw renders the four columns: widget, type, event, handler.
func (*BindingsPanel) Init ¶
func (this *BindingsPanel) Init(self gui.IWidget)
func (*BindingsPanel) OnLeftDown ¶
func (this *BindingsPanel) OnLeftDown(x, y float64)
OnLeftDown selects the row under the cursor and reports its widget.
func (*BindingsPanel) OnMouseLeave ¶
func (this *BindingsPanel) OnMouseLeave()
OnMouseLeave clears the hover row.
func (*BindingsPanel) OnMouseMove ¶
func (this *BindingsPanel) OnMouseMove(x, y float64)
OnMouseMove tracks the hover row.
func (*BindingsPanel) OnMouseWheel ¶
func (this *BindingsPanel) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls the list.
func (*BindingsPanel) Rebuild ¶
func (this *BindingsPanel) Rebuild()
Rebuild walks the design and rebuilds the row list. It walks with walkFakeWidgets — the walk GenerateCode collects fields with — so the list is in document order and a widget nested in a layout container is listed like any other.
func (*BindingsPanel) Rows ¶
func (this *BindingsPanel) Rows() []BindingRow
Rows returns the listed bindings, top to bottom. It is the panel's content in the only form a caller without a painter can read.
func (*BindingsPanel) SelectedRow ¶
func (this *BindingsPanel) SelectedRow() int
SelectedRow returns the highlighted row index, -1 when none is.
func (*BindingsPanel) SetScene ¶
func (this *BindingsPanel) SetScene(scene *GedScene)
SetScene binds the panel to a design and lists its bindings. It subscribes through AddDesignChangedCallback rather than SigDesignChanged: that slot holds one callback and the code panel owns it.
The previous subscription is dropped first. One panel is shared by every open document and design.go's bindBindingsPanelTo re-aims it on every tab change, so subscribing per call would leave the panel listening to every design the session has visited — once more for each time the user came back to it.
func (*BindingsPanel) SigSelect ¶
func (this *BindingsPanel) SigSelect(fn func(graph.IItem))
SigSelect registers the callback fired when a row is pressed, carrying the widget that row describes.
type BookmarksPanel ¶
BookmarksPanel is the cross-file aggregate view of code bookmarks, modelled on Qt Creator's Bookmarks pane. The CodeEditor keeps its own per-file bookmark concept; this panel does not read the editor directly — the host pushes bookmarks in via Add/Remove/Toggle and the panel renders them as a flat, predictably-ordered list.
Clicking a row fires SigActivated(file, line) so the host can jump the editor to the bookmarked location.
func NewBookmarksPanel ¶
func NewBookmarksPanel() *BookmarksPanel
NewBookmarksPanel creates an empty bookmarks panel.
func (*BookmarksPanel) Add ¶
func (this *BookmarksPanel) Add(file string, line int, label string)
Add inserts a bookmark at (file, line). If one already exists for that location its label is updated rather than adding a duplicate.
func (*BookmarksPanel) Bookmarks ¶
func (this *BookmarksPanel) Bookmarks() []Bookmark
Bookmarks returns the bookmarks, stably sorted by file then line.
func (*BookmarksPanel) Draw ¶
func (this *BookmarksPanel) Draw(g paint.Painter)
Draw renders the bookmarks panel: a count header followed by one row per bookmark (a glyph, "basename:line", then the label) with an alternating row tint.
func (*BookmarksPanel) Init ¶
func (this *BookmarksPanel) Init(self gui.IWidget)
func (*BookmarksPanel) OnLeftDown ¶
func (this *BookmarksPanel) OnLeftDown(x, y float64)
OnLeftDown fires SigActivated for the clicked bookmark row.
func (*BookmarksPanel) OnMouseLeave ¶
func (this *BookmarksPanel) OnMouseLeave()
OnMouseLeave resets hover state.
func (*BookmarksPanel) OnMouseMove ¶
func (this *BookmarksPanel) OnMouseMove(x, y float64)
OnMouseMove tracks hover state for visual feedback.
func (*BookmarksPanel) OnMouseWheel ¶
func (this *BookmarksPanel) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls the bookmark list vertically.
func (*BookmarksPanel) Remove ¶
func (this *BookmarksPanel) Remove(file string, line int)
Remove deletes the bookmark at (file, line) if present.
func (*BookmarksPanel) SigActivated ¶
func (this *BookmarksPanel) SigActivated(fn func(file string, line int))
SigActivated registers the callback invoked when a row is clicked.
func (*BookmarksPanel) SizeHints ¶
func (this *BookmarksPanel) SizeHints() gui.SizeHints
type BreakpointRow ¶
type BreakpointRow struct {
File string
Line int
Cond string // Go expression; empty for an unconditional breakpoint
HitCount uint64
Enabled bool
Verified bool
}
BreakpointRow is one row of the breakpoints table. It is the panel's own flat shape, NOT core.Breakpoint: dlv's breakpoint carries an id and a function name but no UI state, while the table needs the condition, the hit count and the enabled/verified flags. The host converts ListBreakpoints() (plus whatever it knows about disabled/unbound breakpoints) into []BreakpointRow and pushes it via SetBreakpoints.
Enabled is the armed state — a disabled breakpoint stays in the table but does not stop the program. Verified is dlv's view: false means the address could not be bound (a stale line, a file not in the binary), which the row renders hollow so the user sees why it never hits.
type BuildOutput ¶
BuildOutput is a panel that displays compiler output with clickable error navigation, similar to Qt Creator's build output pane.
func NewBuildOutput ¶
func NewBuildOutput() *BuildOutput
NewBuildOutput creates a new build output panel.
func (*BuildOutput) Draw ¶
func (this *BuildOutput) Draw(g paint.Painter)
Draw renders the build output panel.
func (*BuildOutput) ErrorMap ¶
func (this *BuildOutput) ErrorMap() map[int]string
ErrorMap returns a map of 0-based line numbers to error messages, suitable for passing to CodeEditor.SetErrors().
func (*BuildOutput) HasErrors ¶
func (this *BuildOutput) HasErrors() bool
HasErrors returns true if any parsed lines are errors.
func (*BuildOutput) Init ¶
func (this *BuildOutput) Init(self gui.IWidget)
func (*BuildOutput) OnLeftDown ¶
func (this *BuildOutput) OnLeftDown(x, y float64)
OnLeftDown handles click on an error line to navigate to file:line:col.
func (*BuildOutput) OnMouseMove ¶
func (this *BuildOutput) OnMouseMove(x, y float64)
OnMouseMove tracks hover state for visual feedback.
func (*BuildOutput) OnMouseWheel ¶
func (this *BuildOutput) OnMouseWheel(x, y, z float64)
OnMouseWheel handles vertical scrolling of the output.
func (*BuildOutput) SetOutput ¶
func (this *BuildOutput) SetOutput(text string)
SetOutput parses compiler output text and populates the line list. Every non-blank line is kept as a log row; lines the shared buildissues engine recognizes as diagnostics are flagged as clickable errors carrying their file:line:col.
func (*BuildOutput) SigErrorClick ¶
func (this *BuildOutput) SigErrorClick(fn func(file string, line, col int))
SigErrorClick registers a callback invoked when the user clicks an error line.
func (*BuildOutput) SizeHints ¶
func (this *BuildOutput) SizeHints() gui.SizeHints
type BuildOutputLine ¶
BuildOutputLine represents a single line in the build output.
type CallDirection ¶
type CallDirection int
CallDirection selects which side of the call graph the hierarchy walks. Qt Creator's call hierarchy view has exactly these two modes and a toggle between them; the tree is rebuilt from scratch on a switch because "who calls me" and "who do I call" share no nodes.
const ( // CallIncoming lists the callers of the root symbol (who calls me). CallIncoming CallDirection = iota // CallOutgoing lists the callees of the root symbol (who I call). CallOutgoing )
func (CallDirection) String ¶
func (d CallDirection) String() string
String renders the direction as the wire-ish name used in labels and logs: "incoming" / "outgoing".
type CallHierarchyModel ¶
type CallHierarchyModel struct {
// contains filtered or unexported fields
}
CallHierarchyModel is the pure (GL-free) tree behind CallHierarchyPanel: one root, a direction, lazy per-node expansion driven by a host callback, cycle detection, and a generation counter that makes late fetch results harmless.
The fetch protocol is deliberately callback-in / push-back-in, matching the other panels' "host drives the tooling" split:
m.SigExpand(func(n *ged.CallNode) { go resolve(n) }) // host fetches
…later, on the UI thread: m.SetChildren(n, kids) // host pushes
Because the answer arrives after an unknown delay, every Expand stamps the request with the current generation. Anything that invalidates the tree — a new root, a direction switch, Clear, an explicit Cancel — bumps the generation, so a result for the old world is dropped by SetChildren instead of grafting stale callers onto the new tree.
func NewCallHierarchyModel ¶
func NewCallHierarchyModel() *CallHierarchyModel
NewCallHierarchyModel creates an empty incoming-direction model.
func (*CallHierarchyModel) Cancel ¶
func (m *CallHierarchyModel) Cancel()
Cancel invalidates every in-flight fetch without touching the tree — results that arrive afterwards are ignored.
func (*CallHierarchyModel) Clear ¶
func (m *CallHierarchyModel) Clear()
Clear drops the tree and invalidates every in-flight fetch.
func (*CallHierarchyModel) Collapse ¶
func (m *CallHierarchyModel) Collapse(node *CallNode)
Collapse closes a node. Already-resolved children are kept so re-expanding costs nothing.
func (*CallHierarchyModel) Contains ¶
func (m *CallHierarchyModel) Contains(node *CallNode) bool
Contains reports whether node belongs to the current tree.
func (*CallHierarchyModel) Direction ¶
func (m *CallHierarchyModel) Direction() CallDirection
Direction returns the current walk direction.
func (*CallHierarchyModel) Expand ¶
func (m *CallHierarchyModel) Expand(node *CallNode)
Expand opens a node, requesting its children from the host when they have not been resolved yet. Recursive nodes, unknown nodes and nil are no-ops, and a node whose fetch is already in flight does not fire a second request.
func (*CallHierarchyModel) Generation ¶
func (m *CallHierarchyModel) Generation() int
Generation returns the current fetch generation. It only ever grows; results stamped with an older value are stale.
func (*CallHierarchyModel) Incoming ¶
func (m *CallHierarchyModel) Incoming() bool
Incoming reports whether the model is walking callers (true) or callees (false).
func (*CallHierarchyModel) PendingCount ¶
func (m *CallHierarchyModel) PendingCount() int
PendingCount returns how many fetches are in flight for the current generation. Requests left over from an invalidated generation are not counted — they are already cancelled, they are only kept around long enough to recognise (and refuse) a late answer.
func (*CallHierarchyModel) Root ¶
func (m *CallHierarchyModel) Root() *CallNode
Root returns the tree root, or nil when the model is empty.
func (*CallHierarchyModel) Rows ¶
func (m *CallHierarchyModel) Rows() []CallRow
Rows flattens the tree into display order, honouring Expanded.
func (*CallHierarchyModel) SetChildren ¶
func (m *CallHierarchyModel) SetChildren(node *CallNode, children []*CallNode) bool
SetChildren attaches one resolved level to node and reports whether it was applied. Only an answer to a live request is accepted; it is dropped — returning false, leaving the tree untouched — when
- no fetch is outstanding for node (nothing asked for these children, or an earlier answer already satisfied the request),
- the fetch was issued under an older generation, i.e. SetRoot / SetDirection / Clear / Cancel happened while it was in flight, or
- node is no longer part of the current tree.
A host doing the fetch asynchronously can also compare Generation() before pushing, but does not have to: the guards above make a late answer harmless.
Children whose (file, line, name) identity already appears on node's ancestor path (node itself included) are flagged Recursive and pinned collapsed, so the cycle is shown once and never walked.
func (*CallHierarchyModel) SetDirection ¶
func (m *CallHierarchyModel) SetDirection(d CallDirection) bool
SetDirection switches between callers and callees. On a real change the tree is reset to the bare root (children dropped, root collapsed and marked unloaded) and the generation is bumped, so the host is expected to re-resolve the first level in the new direction. It returns whether anything changed.
func (*CallHierarchyModel) SetRoot ¶
func (m *CallHierarchyModel) SetRoot(root *CallNode)
SetRoot replaces the tree with a new root symbol and invalidates every in-flight fetch. The node is taken as-is (a host that already has the first level may hand it in pre-populated with Loaded == true).
func (*CallHierarchyModel) SigExpand ¶
func (m *CallHierarchyModel) SigExpand(fn func(node *CallNode))
SigExpand registers the callback the model fires when a node needs its children resolved. It runs at most once per node per generation; the host answers by calling SetChildren (immediately or later).
func (*CallHierarchyModel) Toggle ¶
func (m *CallHierarchyModel) Toggle(node *CallNode)
Toggle collapses an expanded node and expands a collapsed one.
type CallHierarchyPanel ¶
CallHierarchyPanel is the Qt Creator-style call hierarchy view: a tree of callers (incoming) or callees (outgoing) around one root symbol, with a direction toggle in the header and one level resolved at a time as the user opens nodes.
Like ReferencesPanel and TodoPanel it is a pure display/interaction widget — it never talks to gopls. All the tree logic lives in CallHierarchyModel (lazy expansion, cycle detection, stale-fetch rejection); the panel flattens the model into rows, renders them with indentation and expander triangles, and reports interaction back:
SigExpand — a node was opened and needs its children (host fetches,
then calls SetChildren)
SigActivate — a row was clicked (host opens file:line)
SigDirection — the header toggle flipped incoming/outgoing (host
re-resolves the first level)
func NewCallHierarchyPanel ¶
func NewCallHierarchyPanel() *CallHierarchyPanel
NewCallHierarchyPanel creates an empty call hierarchy panel.
func (*CallHierarchyPanel) Clear ¶
func (this *CallHierarchyPanel) Clear()
Clear empties the panel and invalidates any in-flight fetch.
func (*CallHierarchyPanel) Draw ¶
func (this *CallHierarchyPanel) Draw(g paint.Painter)
Draw renders the header (direction toggle + root caption) and one row per visible node: an expander triangle at the node's indentation, the symbol name, its dimmed detail, and a "basename:line" locator flushed right.
func (*CallHierarchyPanel) Incoming ¶
func (this *CallHierarchyPanel) Incoming() bool
Incoming reports whether the panel is showing callers (true) or callees.
func (*CallHierarchyPanel) Init ¶
func (this *CallHierarchyPanel) Init(self gui.IWidget)
func (*CallHierarchyPanel) Model ¶
func (this *CallHierarchyPanel) Model() *CallHierarchyModel
Model returns the underlying tree so the host can drive it directly (SigExpand, Expand, Cancel, …). Mutating it needs a Refresh() afterwards for the panel to pick up the new row list.
func (*CallHierarchyPanel) OnLeftDown ¶
func (this *CallHierarchyPanel) OnLeftDown(x, y float64)
OnLeftDown routes a click: the header's direction toggle flips the direction, an expander triangle opens/closes that node (fetching its children on first open), and anywhere else on a row activates it.
func (*CallHierarchyPanel) OnMouseLeave ¶
func (this *CallHierarchyPanel) OnMouseLeave()
OnMouseLeave clears the hover highlight.
func (*CallHierarchyPanel) OnMouseMove ¶
func (this *CallHierarchyPanel) OnMouseMove(x, y float64)
OnMouseMove tracks hover state for the row highlight.
func (*CallHierarchyPanel) OnMouseWheel ¶
func (this *CallHierarchyPanel) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls the tree vertically, clamped to the content.
func (*CallHierarchyPanel) Refresh ¶
func (this *CallHierarchyPanel) Refresh()
Refresh re-flattens the model into rows and repaints. Call it after driving the model directly.
func (*CallHierarchyPanel) Rows ¶
func (this *CallHierarchyPanel) Rows() []CallRow
Rows returns a defensive copy of the flattened rows in display order.
func (*CallHierarchyPanel) SetChildren ¶
func (this *CallHierarchyPanel) SetChildren(node *CallNode, children []*CallNode) bool
SetChildren forwards one resolved level to the model and refreshes the rows. It returns false when the fetch was stale (see CallHierarchyModel.SetChildren), in which case nothing changes.
func (*CallHierarchyPanel) SetIncoming ¶
func (this *CallHierarchyPanel) SetIncoming(incoming bool)
SetIncoming switches direction programmatically. It resets the tree to the bare root (the host must re-resolve) but does NOT fire SigDirection — the signal reports user interaction, and the caller here already knows.
func (*CallHierarchyPanel) SetRoot ¶
func (this *CallHierarchyPanel) SetRoot(root *CallNode)
SetRoot replaces the tree with a new root symbol, invalidating any in-flight fetch, and resets the view.
func (*CallHierarchyPanel) SigActivate ¶
func (this *CallHierarchyPanel) SigActivate(fn func(file string, line int))
SigActivate registers the callback fired when the user clicks a row (not its expander). It receives the node's file and 1-based line — the host opens file:line in the editor.
func (*CallHierarchyPanel) SigDirection ¶
func (this *CallHierarchyPanel) SigDirection(fn func(incoming bool))
SigDirection registers the callback fired when the user flips the direction toggle. It receives the new direction: true == incoming.
func (*CallHierarchyPanel) SigExpand ¶
func (this *CallHierarchyPanel) SigExpand(fn func(node *CallNode))
SigExpand registers the callback fired when a node needs its children resolved. The host fetches them and answers with SetChildren.
func (*CallHierarchyPanel) SizeHints ¶
func (this *CallHierarchyPanel) SizeHints() gui.SizeHints
func (*CallHierarchyPanel) ToggleDirection ¶
func (this *CallHierarchyPanel) ToggleDirection()
ToggleDirection flips incoming/outgoing and fires SigDirection so the host can re-resolve the first level. This is what the header toggle does.
type CallNode ¶
type CallNode struct {
Name string // symbol name, e.g. "Frame.Draw"
Detail string // signature / container detail shown dimmed after the name
File string // absolute or workspace-relative path to the definition
Line int // 1-based line of the definition (or of the call site)
Kind string // "func", "method", "closure", … (host's vocabulary)
Children []*CallNode // resolved one level; nil until Loaded
Expanded bool // user has opened this node
Loaded bool // children have been resolved (possibly to zero)
// Recursive marks a node whose (File, Line, Name) identity already
// appears on its own ancestor path. Recursion is the normal case in a
// call graph (direct or mutual), and expanding such a node would walk
// the same cycle forever — so the model flags it, refuses to expand it
// and the panel renders it as a leaf with a cycle marker. Set by
// SetChildren; hosts do not fill it in.
Recursive bool
}
CallNode is one symbol in the call hierarchy tree — the root is the symbol under the cursor, its children are its callers (incoming) or callees (outgoing), and so on down.
Children are fetched lazily: a freshly created node has Loaded == false and no Children, and only when the user expands it does the model ask the host to resolve that one level (see CallHierarchyModel.SigExpand). That keeps the panel off a full transitive closure, which for a hot function is effectively unbounded.
Like the sibling panels' row structs this is the panel's own shape, NOT an LSP type: the host drives gopls (callHierarchy/incomingCalls etc.), converts each result into a CallNode with a 1-based Line, and pushes it in via SetChildren. The model never learns about LSP wire types.
type CallRow ¶
CallRow is one visible line of the flattened tree: the node, its indentation depth (root == 0) and whether it draws an expander. The panel renders and hit-tests rows; it never walks the tree itself.
type Cell ¶
Cell is one character cell of the terminal screen. Colors follow the AnsiDefaultColor / palette-index / AnsiRGBBase encoding described above; use AnsiColorRGB to resolve one to concrete channels. Cells are always produced by AnsiTerm (a zero Cell would mean palette black on black).
type CodeGenOptions ¶
type CodeGenOptions struct {
PackageName string // "main" by default
TypeName string // struct name, derived from form title if empty
FileName string // output file path (optional, for GenerateCodeFile)
ModulePath string // module path from go.mod; emitted as "// Module: <path>" when non-empty
// SplitHandlers makes GenerateCode emit the machine-owned half of a
// split pair: handlers are wired as methods on the UI struct
// (ui.onBtnOK) and neither their bodies nor main() are written here —
// both belong to the user-owned file. Off, the output stays the
// self-contained single file.
SplitHandlers bool
}
CodeGenOptions controls code generation output.
type CodeInsightsLayer ¶
type CodeInsightsLayer struct {
// contains filtered or unexported fields
}
CodeInsightsLayer is the per-document aggregate of the three code-insight models — semantic tokens, inlay hints and code lenses (code-insights-model.go) — plus the document revision that gates them. It is the single handle the editor overlay holds: one object per open file, asked per visible line for everything that has to be painted on top of the plain text.
It stays a pure model, exactly like its three members: no widget, no painting, no LSP transport. The host (silkide) owns one layer per open document, feeds each member as gopls replies arrive, and calls SetRevision on every buffer edit; the drawing commit that follows only reads Line().
Freshness differs per kind, which is why the revision lives here:
- Inlay hints are column-anchored labels squeezed between characters, so a single keystroke misplaces them. They are dropped the moment the revision moves (InlayHints.SetRevision).
- Semantic tokens and lenses are re-requested after an edit but keep showing the previous result until the new one lands — the same "slightly stale beats flickering" tradeoff other editors make. Highlighting that blinks off on every keystroke is worse than highlighting that lags a frame behind.
func NewCodeInsightsLayer ¶
func NewCodeInsightsLayer(legend SemanticLegend) *CodeInsightsLayer
NewCodeInsightsLayer creates an empty layer at revision 0 with the semantic legend the session negotiated. The legend may be empty here and supplied later via SemanticTokens().SetLegend.
func (*CodeInsightsLayer) Clear ¶
func (this *CodeInsightsLayer) Clear()
Clear drops every insight for the document (on close, or when the language server goes away) while keeping the revision and the semantic legend.
func (*CodeInsightsLayer) CodeLens ¶
func (this *CodeInsightsLayer) CodeLens() *CodeLens
CodeLens returns the lens model, for SetLenses plus the OnExecute callback.
func (*CodeInsightsLayer) InlayHints ¶
func (this *CodeInsightsLayer) InlayHints() *InlayHints
InlayHints returns the hint model. Push replies with Set(revision, hints) using the revision the request was issued for, so a late reply is refused.
func (*CodeInsightsLayer) Line ¶
func (this *CodeInsightsLayer) Line(line int) LineInsights
Line gathers the decoration for one 0-based line. Hints are revision-gated against the layer's revision, so hints computed for an older buffer state never reach the drawer.
func (*CodeInsightsLayer) Lines ¶
func (this *CodeInsightsLayer) Lines(first, last int) []LineInsights
Lines gathers the decoration for the inclusive 0-based line range [first, last] — the overlay's viewport query. Lines with nothing on them are skipped, so the result is usually far shorter than the range.
func (*CodeInsightsLayer) Revision ¶
func (this *CodeInsightsLayer) Revision() int
Revision is the document revision the layer currently tracks.
func (*CodeInsightsLayer) SemanticTokens ¶
func (this *CodeInsightsLayer) SemanticTokens() *SemanticTokens
SemanticTokens returns the token model, for the host to push semanticTokens/full (SetData) and /full/delta (ApplyEdits) results into.
func (*CodeInsightsLayer) SetRevision ¶
func (this *CodeInsightsLayer) SetRevision(revision int)
SetRevision advances the document revision after a buffer edit, dropping the inlay hints (their columns no longer describe the text) while leaving tokens and lenses in place until fresh results arrive. Moving to the same or an older revision is a no-op.
type CodeLens ¶
type CodeLens struct {
// contains filtered or unexported fields
}
CodeLens stores one document's lenses and dispatches activation. Hit-testing is by line: the overlay reserves a row above each decorated line, and a click resolves to (line, index-within-line) which ExecuteAt turns into the OnExecute callback.
func (*CodeLens) Clear ¶
func (this *CodeLens) Clear()
Clear drops the lenses, keeping the callback registration.
func (*CodeLens) ExecuteAt ¶
ExecuteAt activates the index-th lens on a line and reports whether one was found. Index is the position within LensesOnLine(line), which is what the drawer's x hit-test yields; index 0 activates the only lens on a line. A miss, or no registered callback, is inert.
func (*CodeLens) LensesOnLine ¶
LensesOnLine returns the lenses annotating one 0-based line, in insertion order — the hit-test. nil when the line carries none, which is also how the drawer knows not to reserve a lens row for it.
type CodeOutlinePanel ¶
CodeOutlinePanel is a persistent symbol tree panel that shows all functions, types, variables, and constants from the active code editor.
func NewCodeOutlinePanel ¶
func NewCodeOutlinePanel() *CodeOutlinePanel
func (*CodeOutlinePanel) Draw ¶
func (this *CodeOutlinePanel) Draw(g paint.Painter)
Draw renders the code outline panel.
func (*CodeOutlinePanel) ExportedOnly ¶
func (this *CodeOutlinePanel) ExportedOnly() bool
ExportedOnly reports whether the exported-only filter is on.
func (*CodeOutlinePanel) Filter ¶
func (this *CodeOutlinePanel) Filter() string
Filter returns the active name filter ("" when unfiltered).
func (*CodeOutlinePanel) Init ¶
func (this *CodeOutlinePanel) Init(self gui.IWidget)
func (*CodeOutlinePanel) OnLeftDown ¶
func (this *CodeOutlinePanel) OnLeftDown(x, y float64)
OnLeftDown handles click events.
func (*CodeOutlinePanel) OnMouseLeave ¶
func (this *CodeOutlinePanel) OnMouseLeave()
OnMouseLeave resets hover.
func (*CodeOutlinePanel) OnMouseMove ¶
func (this *CodeOutlinePanel) OnMouseMove(x, y float64)
OnMouseMove updates hover state.
func (*CodeOutlinePanel) OnMouseWheel ¶
func (this *CodeOutlinePanel) OnMouseWheel(x, y, z float64)
OnMouseWheel handles scrolling.
func (*CodeOutlinePanel) RefreshIfStale ¶
func (this *CodeOutlinePanel) RefreshIfStale() bool
RefreshIfStale re-reads the outline when the editor content or host revision changes. The unchanged Draw path is O(1), including for large documents and same-length edits which the old text-size fingerprint could not detect.
func (*CodeOutlinePanel) RefreshSymbols ¶
func (this *CodeOutlinePanel) RefreshSymbols()
RefreshSymbols rebuilds the outline from its current source: the semantic symbols pushed in by the host when there are any, otherwise a heuristic re-parse of the bound editor.
func (*CodeOutlinePanel) SetEditor ¶
func (this *CodeOutlinePanel) SetEditor(editor *gui.CodeEditor)
SetEditor binds the outline panel to a code editor and refreshes symbols.
func (*CodeOutlinePanel) SetExportedOnly ¶
func (this *CodeOutlinePanel) SetExportedOnly(on bool)
SetExportedOnly toggles the visibility filter that hides symbols not part of the file's public API. A non-exported parent survives when one of its children is exported, otherwise the child would be orphaned.
func (*CodeOutlinePanel) SetFilter ¶
func (this *CodeOutlinePanel) SetFilter(text string)
SetFilter narrows the tree to symbols whose name contains text (case-insensitive). A match keeps its ancestors as context, so a hit on a method still shows the type it hangs under. Empty text clears it.
func (*CodeOutlinePanel) SetNavigateCallback ¶
func (this *CodeOutlinePanel) SetNavigateCallback(fn func(line int))
SetNavigateCallback sets the callback invoked when a symbol is clicked.
func (*CodeOutlinePanel) SetRevision ¶
func (this *CodeOutlinePanel) SetRevision(rev int)
SetRevision records the host's document revision for the bound buffer (an editor change counter, or the LSP version the host sends with didChange). Any change marks the outline stale so the next RefreshIfStale re-reads it. Ordinary editor mutations are tracked automatically; this optional host revision also supports out-of-band semantic updates.
func (*CodeOutlinePanel) SetSortMode ¶
func (this *CodeOutlinePanel) SetSortMode(mode int)
SetSortMode switches between OutlineSortByPosition (declaration order, the default) and OutlineSortByName (alphabetical). The mode applies to every level of the tree, not just the top one.
func (*CodeOutlinePanel) SetSymbols ¶
func (this *CodeOutlinePanel) SetSymbols(syms []OutlineSymbol)
SetSymbols installs a semantic outline (a documentSymbol response the host already converted to []OutlineSymbol) and rebuilds the tree from that hierarchy. It takes a deep copy, so the host may keep reusing or mutating the slice it handed in. Passing nil (or an empty slice) drops the semantic outline and falls back to the heuristic ParseSymbols scan, which is also what an editor with no language server keeps using.
func (*CodeOutlinePanel) SortMode ¶
func (this *CodeOutlinePanel) SortMode() int
SortMode returns the active sort mode.
type CodePanel ¶
CodePanel provides a code editing panel for writing Go event handler code. When a widget is selected on the GED canvas, the panel displays an editable code template for that widget's events, similar to Qt Creator's signal/slot code editor.
Its second tab (生成代码) shows the full generated file for the active design, read-only, refreshed from the design's own change signals.
func NewCodePanel ¶
func NewCodePanel() *CodePanel
func (*CodePanel) BindGedView ¶
BindGedView connects the code panel to a GedView so that selecting a widget on the canvas automatically loads its event handler code into the editor, and so that the 生成代码 view follows that design.
func (*CodePanel) Focus ¶
func (this *CodePanel) Focus()
Focus activates the code editor and brings it into focus.
func (*CodePanel) RegenerateNow ¶
func (this *CodePanel) RegenerateNow()
RegenerateNow rebuilds the generated view from the bound design immediately.
func (*CodePanel) SaveCode ¶
func (this *CodePanel) SaveCode()
SaveCode persists the editor content back to the FakeWidget.
func (*CodePanel) ScheduleRegenerate ¶
func (this *CodePanel) ScheduleRegenerate()
ScheduleRegenerate arms the debounce timer. Start() re-arms rather than stacks, so a burst of design changes collapses into one regeneration.
func (*CodePanel) ScrollToHandler ¶
ScrollToHandler scrolls the editor to the handler for the given widget name.
func (*CodePanel) ScrollToWidget ¶
func (this *CodePanel) ScrollToWidget(fake *FakeWidget)
ScrollToWidget brings the line that constructs fake into view. The line comes from the generation walk, so it survives a widget whose name also appears in a comment or a handler body.
func (*CodePanel) SetWidget ¶
func (this *CodePanel) SetWidget(fake *FakeWidget)
SetWidget shows the code for a specific widget.
type ConsoleLine ¶
ConsoleLine represents a single line of console output.
type ConsolePanel ¶
ConsolePanel is a terminal-like output panel for showing runtime output from F5-launched applications, similar to Qt Creator's Application Output.
func NewConsolePanel ¶
func NewConsolePanel() *ConsolePanel
NewConsolePanel creates a new console output panel.
func (*ConsolePanel) AppendError ¶
func (this *ConsolePanel) AppendError(text string)
AppendError adds text as stderr output (level 1, displayed in red).
func (*ConsolePanel) AppendLine ¶
func (this *ConsolePanel) AppendLine(text string, level int)
AppendLine adds a single output line with a timestamp and level.
func (*ConsolePanel) AppendOutput ¶
func (this *ConsolePanel) AppendOutput(text string)
AppendOutput parses multi-line text and adds each line as stdout (level 0).
func (*ConsolePanel) AppendSystem ¶
func (this *ConsolePanel) AppendSystem(text string)
AppendSystem adds a system message (level 2, displayed in blue/italic).
func (*ConsolePanel) Draw ¶
func (this *ConsolePanel) Draw(g paint.Painter)
Draw renders the console panel.
func (*ConsolePanel) Init ¶
func (this *ConsolePanel) Init(self gui.IWidget)
func (*ConsolePanel) OnLeftDown ¶
func (this *ConsolePanel) OnLeftDown(x, y float64)
OnLeftDown handles focus on click.
func (*ConsolePanel) OnMouseWheel ¶
func (this *ConsolePanel) OnMouseWheel(x, y, z float64)
OnMouseWheel handles vertical scrolling.
func (*ConsolePanel) SizeHints ¶
func (this *ConsolePanel) SizeHints() gui.SizeHints
type DebugPanel ¶
DebugPanel is the bottom-dock pane a debugger uses to show the breakpoint table, the call stack, the variables of the selected frame, the goroutines, watched expressions and a debug console. It is a pure display/interaction widget: it never talks to dlv itself. The host (silkide) drives a core.DebugSession — ListBreakpoints() / Stacktrace() / ListLocals() / Eval() — and pushes the results in via SetBreakpoints / SetCallStack / SetVariables (or SetLocals + SetArguments) / SetGoroutines / SetWatches / SetConsoleLines. The panel renders them and emits signals back:
SigFrameSelected — a stack-frame row was clicked. The host re-fetches
locals for that frame (ListLocals at the frame's
depth) and calls SetVariables to refresh the lower
section.
SigFrameActivated — a stack-frame row was double-clicked / Enter'd. The
host opens frame.File:frame.Line in the editor.
SigContextChanged — the (goroutine, frame) evaluation context changed, by
a row click, a keyboard move or an explicit
SetSelectedGoroutine / SetSelectedFrame. The host
re-runs ListLocals / Eval IN THAT SCOPE instead of the
hardcoded (-1, 0). It is the canonical context signal;
a host should refresh locals from EITHER this or
SigFrameSelected, not both.
SigWatchAdded — the user submitted a new expression in the watch
input. The host evaluates it (Eval) and pushes the
refreshed list back via SetWatches.
SigWatchRemoved — the user dropped a watch row. The host stops
tracking that expression.
SigGoroutineActivated — a goroutine row was clicked. The host opens the
goroutine's File:Line in the editor. The click also
switches the evaluation context to that goroutine
(SigContextChanged).
SigVariableEdited — the user submitted a new value for a variable. The
host calls dlv SetVariable(path, newValue), re-fetches
the variables for the current frame, and pushes them
back via SetVariables / SetLocals.
SigExpandVar — the user opened a composite variable whose children
are not loaded yet. The host evaluates that path in
the current context and pushes the children back via
SetChildren(path, rows) — lazy expansion, so a deep
struct is never fetched whole.
SigToggleBreakpoint — the enabled checkbox of a breakpoint row was
clicked. The host arms/disarms it in dlv (Amend, or
Clear + re-create) and may re-push via SetBreakpoints.
SigEditCondition — a breakpoint condition was submitted in the inline
editor. An EMPTY cond means "clear the condition".
SigDeleteBreakpoint — the ✕ affordance of a breakpoint row was clicked.
The host clears it in dlv and in the editor gutter.
SigEval — the user submitted an expression in the debug console.
The host evaluates it in the current context and
appends the command + result via SetConsoleLines.
Six bands split the widget vertically, top to bottom: breakpoints, the call stack, the variables (Arguments + Locals as a lazily expandable tree), the goroutines, the watch section, and the debug console. Each band has its own header (with a count) and its own independent vertical scroll. The two optional bands take NO height when they have nothing to show: the breakpoints band collapses when the breakpoint list is empty, and the console band only appears once SetConsoleVisible(true) is called (or SetConsoleLines pushes output).
Variables are editable in place: a double-click (or Enter) on a row opens an inline value editor over the value column, and submitting emits SigVariableEdited — the panel never calls dlv SetVariable itself, the host does and re-pushes the variables. Breakpoint conditions work the same way: a double-click on a breakpoint row opens an inline condition editor and submitting emits SigEditCondition.
func (*DebugPanel) Arguments ¶
func (this *DebugPanel) Arguments() []VarRow
Arguments returns a defensive copy of the Arguments group's root rows.
func (*DebugPanel) Breakpoints ¶
func (this *DebugPanel) Breakpoints() []BreakpointRow
Breakpoints returns a defensive copy of the breakpoint rows in display order.
func (*DebugPanel) CallStack ¶
func (this *DebugPanel) CallStack() []core.StackFrame
CallStack returns a defensive copy of the call-stack frames in top-down order. A copy keeps the host from mutating the panel's backing slice.
func (*DebugPanel) Clear ¶
func (this *DebugPanel) Clear()
Clear empties the stop-scoped state — call stack, variables, goroutines — and blanks every watch VALUE while KEEPING the watch expressions: a real debugger keeps your watches across stops and only re-evaluates them. The evaluation context falls back to (-1, 0) without firing SigContextChanged (a host-driven reset, not a user pick). The breakpoint table and the console transcript survive — neither is tied to a single stop. Use ClearAll when the session ends entirely.
func (*DebugPanel) ClearAll ¶
func (this *DebugPanel) ClearAll()
ClearAll resets the panel to empty: everything Clear drops, plus every watch expression, the console transcript, and the in-progress inputs. The host calls this when the debug session ends entirely, so there is no session to keep watches or output for. The breakpoint table stays — breakpoints outlive a session the same way the editor gutter marks do.
func (*DebugPanel) ConsoleLines ¶
func (this *DebugPanel) ConsoleLines() []string
ConsoleLines returns a defensive copy of the console transcript.
func (*DebugPanel) ConsoleVisible ¶
func (this *DebugPanel) ConsoleVisible() bool
ConsoleVisible reports whether the console band currently takes space.
func (*DebugPanel) Draw ¶
func (this *DebugPanel) Draw(g paint.Painter)
Draw paints the stacked sections top to bottom: breakpoints (when any), the call stack, the variables tree, the goroutines, the watch section, and the debug console (when shown), each with a counted header and its own scrolled row list.
func (*DebugPanel) Goroutines ¶
func (this *DebugPanel) Goroutines() []core.Goroutine
Goroutines returns a defensive copy of the goroutine rows in display order.
func (*DebugPanel) Init ¶
func (this *DebugPanel) Init(self gui.IWidget)
func (*DebugPanel) Locals ¶
func (this *DebugPanel) Locals() []VarRow
Locals returns a defensive copy of the Locals group's root rows.
func (*DebugPanel) OnKeyDown ¶
func (this *DebugPanel) OnKeyDown(key int, repeat bool)
OnKeyDown routes keys to whichever inline editor is open — the breakpoint condition editor first, then a variable's value editor (Enter submits, Esc cancels, Backspace deletes a rune) — then to the watch input and the console prompt while one of them holds focus (Enter submits, Esc unfocuses, Backspace deletes a rune), otherwise it gives the call stack Qt-style keyboard control: Up/Down move the selection (re-firing SigFrameSelected and SigContextChanged so the host refreshes in the new scope), Enter activates the frame.
func (*DebugPanel) OnLeftDown ¶
func (this *DebugPanel) OnLeftDown(x, y float64)
OnLeftDown routes a click to the section it lands in. Any click first cancels an in-progress inline edit (a double-click on a row, handled below, re-opens it). The console prompt and the watch input take focus when clicked and lose it on any click elsewhere. In the breakpoints table the left marker toggles enabled, the right ✕ deletes, and a quick second click in between opens the condition editor. A goroutine row click switches the evaluation context to that goroutine and fires SigGoroutineActivated. In the call stack a click selects the frame (firing SigFrameSelected + SigContextChanged) and a quick second click on the same frame activates it. In the variables tree a click on a composite's twisty expands/collapses it (requesting children the first time) and a quick second click elsewhere on a row opens the inline value editor.
func (*DebugPanel) OnMouseLeave ¶
func (this *DebugPanel) OnMouseLeave()
OnMouseLeave clears every hover highlight.
func (*DebugPanel) OnMouseMove ¶
func (this *DebugPanel) OnMouseMove(x, y float64)
OnMouseMove tracks hover state for whichever section the cursor is over.
func (*DebugPanel) OnMouseWheel ¶
func (this *DebugPanel) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls whichever band the cursor is over. Each band clamps to its own content height; the watch view height excludes its header and input line, the console view height its header and prompt line.
func (*DebugPanel) OnTextInput ¶
func (this *DebugPanel) OnTextInput(s string)
OnTextInput feeds typed characters into whichever text field is active: the breakpoint condition editor, a variable's inline value editor, the watch expression input, or the console prompt, in that order. Enter and Backspace arrive via OnKeyDown, not here; with no active field, typing is ignored.
func (*DebugPanel) RemoveWatch ¶
func (this *DebugPanel) RemoveWatch(expr string)
RemoveWatch removes the first watch whose expression equals expr and fires SigWatchRemoved. It is the host-callable form of the row ✕ button so a host UI (or a test) can drop a watch without a click; a no-op when expr is not currently watched.
func (*DebugPanel) SelectedFrame ¶
func (this *DebugPanel) SelectedFrame() int
SelectedFrame returns the index of the highlighted stack frame, default 0 (the top frame). This is the frame whose variables the panel shows and the frame half of the evaluation context.
func (*DebugPanel) SelectedGoroutine ¶
func (this *DebugPanel) SelectedGoroutine() int64
SelectedGoroutine returns the dlv goroutine id every evaluation should run in, -1 meaning "the current/selected goroutine" (dlv's own default).
func (*DebugPanel) SetArguments ¶
func (this *DebugPanel) SetArguments(rows []VarRow)
SetArguments replaces the Arguments group — the current frame's function parameters, which dlv reports separately from its locals (ListFunctionArgs vs ListLocalVars). The group renders above the locals under its own header and behaves identically: same tree, same lazy children, same inline editor. Like SetLocals it collapses the tree, since a push means a new scope.
func (*DebugPanel) SetBreakpoints ¶
func (this *DebugPanel) SetBreakpoints(rows []BreakpointRow)
SetBreakpoints replaces the breakpoint table with a defensive copy and repaints. The host builds the rows from dlv ListBreakpoints() plus its own enabled/condition bookkeeping. An empty list collapses the band entirely, so a panel that has never seen a breakpoint looks exactly like it did before the table existed.
func (*DebugPanel) SetCallStack ¶
func (this *DebugPanel) SetCallStack(frames []core.StackFrame)
SetCallStack replaces the call-stack frames and resets the selection to the top frame (index 0). It does NOT emit SigFrameSelected — pushing a fresh stack is the host telling the panel "we just stopped here", not the user picking a frame; the host already knows the top frame and has loaded its locals. For the same reason it does not emit SigContextChanged.
func (*DebugPanel) SetChildren ¶
func (this *DebugPanel) SetChildren(path string, rows []VarRow)
SetChildren installs the children of the variable at path — the answer to a SigExpandVar request — and shows them: pushing children means the user asked for them. The path is the one the signal carried, i.e. a dlv-evaluable expression ("p.Next", "s[0]"), so the host can Eval it in the current context and hand the result back without keeping its own row bookkeeping. Pushing an empty slice marks the node loaded-but-empty, so re-opening it does not ask again.
func (*DebugPanel) SetConsoleLines ¶
func (this *DebugPanel) SetConsoleLines(lines []string)
SetConsoleLines replaces the debug console transcript with a defensive copy, pins the view to the newest line, and shows the console band when there is anything to show. The host owns the transcript: it echoes the submitted command, appends the evaluation result (or the error), and pushes the whole list back — the panel never formats or evaluates anything itself.
func (*DebugPanel) SetConsoleVisible ¶
func (this *DebugPanel) SetConsoleVisible(on bool)
SetConsoleVisible shows or hides the console band. Hidden is the default so the panel keeps its original layout until a host wires the console up; SetConsoleLines shows it implicitly when it pushes output.
func (*DebugPanel) SetGoroutines ¶
func (this *DebugPanel) SetGoroutines(gs []core.Goroutine)
SetGoroutines replaces the goroutine rows with a defensive copy, resets the band's scroll, and repaints. The host fills this by calling dlv ListGoroutines at a stop and pushing the result; the panel only renders it.
func (*DebugPanel) SetLocals ¶
func (this *DebugPanel) SetLocals(rows []VarRow)
SetLocals replaces the Locals group with a defensive copy of rows, dropping every lazily-loaded child and every expansion: a fresh push is a fresh scope, so stale children from another frame must not survive it. The host re-fetches children on demand when the user re-opens a composite.
func (*DebugPanel) SetSelectedFrame ¶
func (this *DebugPanel) SetSelectedFrame(i int)
SetSelectedFrame switches the evaluation context to frame index i of the current goroutine (0 = top frame), firing SigContextChanged when that is a real change. Out-of-range indices are ignored; with no call stack pushed yet only 0 is accepted.
func (*DebugPanel) SetSelectedGoroutine ¶
func (this *DebugPanel) SetSelectedGoroutine(id int64)
SetSelectedGoroutine switches the evaluation context to goroutine id and resets the frame to the top one, firing SigContextChanged when that is a real change. Pass -1 for "whatever goroutine dlv has selected". No validation against the goroutine rows: the host may set the context before pushing them.
func (*DebugPanel) SetVariables ¶
func (this *DebugPanel) SetVariables(vars []core.Variable)
SetVariables replaces the local-variable rows from dlv's flat projection. The host calls this both on the initial stop (locals of the top frame) and again whenever the context changes. Rows pushed this way have no children (core.Variable cannot express one) — use SetLocals to push composites the user can expand.
func (*DebugPanel) SetWatches ¶
func (this *DebugPanel) SetWatches(w []WatchEntry)
SetWatches replaces the watched expressions and their evaluated results with a defensive copy, then repaints. The host builds this list by evaluating every WatchExprs() entry (dlv Eval) at the current stop and pushing the results — Value/Type set on success, Err set on failure.
func (*DebugPanel) SigContextChanged ¶
func (this *DebugPanel) SigContextChanged(fn func(goroutineID int64, frame int))
SigContextChanged registers the callback fired whenever the (goroutine, frame) evaluation context changes — a stack-row click, a keyboard move, a goroutine-row click, or an explicit SetSelectedGoroutine / SetSelectedFrame. The host re-runs ListLocals / Eval in that scope, instead of the fixed (-1, 0) it used before, and pushes the results back.
func (*DebugPanel) SigDeleteBreakpoint ¶
func (this *DebugPanel) SigDeleteBreakpoint(fn func(file string, line int))
SigDeleteBreakpoint registers the callback fired when the ✕ affordance of a breakpoint row is clicked. The panel drops the row immediately (a direct manipulation of what is shown) and the host clears it in dlv and in the editor gutter.
func (*DebugPanel) SigEditCondition ¶
func (this *DebugPanel) SigEditCondition(fn func(file string, line int, cond string))
SigEditCondition registers the callback fired when a breakpoint condition is submitted in the inline editor. An EMPTY cond means "clear the condition" — unlike a watch or a variable edit, a blank submit is meaningful here and still fires. The panel does not apply the condition itself: that needs a dlv Amend, so the host applies it and re-pushes via SetBreakpoints.
func (*DebugPanel) SigEval ¶
func (this *DebugPanel) SigEval(fn func(expr string))
SigEval registers the callback fired when the user submits an expression at the console prompt. The host evaluates it in the current (goroutine, frame) context and appends the command and its result to the transcript via SetConsoleLines. A blank submit is ignored.
func (*DebugPanel) SigExpandVar ¶
func (this *DebugPanel) SigExpandVar(fn func(path string))
SigExpandVar registers the callback fired when the user opens a composite variable whose children have not been loaded yet. The host evaluates path in the current (goroutine, frame) context and pushes the children back via SetChildren. It fires at most once per path: an already-loaded node expands from the cache.
func (*DebugPanel) SigFrameActivated ¶
func (this *DebugPanel) SigFrameActivated(fn func(frame core.StackFrame))
SigFrameActivated registers the callback fired when the user double-clicks a stack-frame row or presses Enter on it. The host opens frame.File:frame.Line in the editor.
func (*DebugPanel) SigFrameSelected ¶
func (this *DebugPanel) SigFrameSelected(fn func(index int, frame core.StackFrame))
SigFrameSelected registers the callback fired when the user clicks a stack-frame row. The host re-fetches locals for that frame and calls SetVariables. The callback receives a copy of the frame so the host can hold onto it past a later Clear without aliasing the panel's slice. SigContextChanged carries the same news in scope form; wire one of the two.
func (*DebugPanel) SigGoroutineActivated ¶
func (this *DebugPanel) SigGoroutineActivated(fn func(g core.Goroutine))
SigGoroutineActivated registers the callback fired when the user clicks a goroutine row. The host opens the goroutine's File:Line in the editor. The click also switches the evaluation context to that goroutine's top frame, which reports itself through SigContextChanged. The callback receives a copy so the host can hold onto it past a later Clear without aliasing the panel's slice.
func (*DebugPanel) SigToggleBreakpoint ¶
func (this *DebugPanel) SigToggleBreakpoint(fn func(file string, line int, enabled bool))
SigToggleBreakpoint registers the callback fired when the enabled checkbox of a breakpoint row is clicked. enabled is the REQUESTED new state, so the host does not have to read the row back. The panel flips its own row right away for responsiveness (like a watch remove); the host applies it in dlv and may re-push the table.
func (*DebugPanel) SigVariableEdited ¶
func (this *DebugPanel) SigVariableEdited(fn func(name string, newValue string))
SigVariableEdited registers the callback fired when the user submits a new value for a variable through the inline editor. The first argument is the row's dlv-evaluable path — the plain name for a root local or argument, "p.Field" / "s[0]" for a nested row — so the host can apply it with dlv SetVariable(path, newValue) in the current context, then re-fetch the variables and push them back via SetVariables / SetLocals (host-driven, like the rest of the panel — it never calls dlv itself).
func (*DebugPanel) SigWatchAdded ¶
func (this *DebugPanel) SigWatchAdded(fn func(expr string))
SigWatchAdded registers the callback fired when the user submits a new expression in the watch input. The host evaluates it and pushes the refreshed list back via SetWatches.
func (*DebugPanel) SigWatchRemoved ¶
func (this *DebugPanel) SigWatchRemoved(fn func(expr string))
SigWatchRemoved registers the callback fired when the user removes a watch row (the ✕ affordance) or the host calls RemoveWatch. The host stops tracking that expression.
func (*DebugPanel) SizeHints ¶
func (this *DebugPanel) SizeHints() gui.SizeHints
func (*DebugPanel) Variables ¶
func (this *DebugPanel) Variables() []core.Variable
Variables returns the Locals group's root rows in dlv's flat projection — the inverse of SetVariables. Nested children and the Arguments group are not included; use Locals / Arguments for the full rows.
func (*DebugPanel) WatchExprs ¶
func (this *DebugPanel) WatchExprs() []string
WatchExprs returns just the watched expression strings, in display order. The host re-evaluates all of them on each stop and pushes the results back via SetWatches.
func (*DebugPanel) Watches ¶
func (this *DebugPanel) Watches() []WatchEntry
Watches returns a defensive copy of the watched expressions and their last evaluations, in display order.
type DesignOutputs ¶
DesignOutputs names the two Go files a design owns in its own directory.
The split is the point: Generated carries the widget tree and is rewritten on every generate, Companion is hand-written (main(), handlers) and is never touched by the designer. Nothing writes Companion today — the generator still emits one self-contained half — but the mapping is what the split generator swaps into.
func OutputPathsFor ¶
func OutputPathsFor(designPath string) DesignOutputs
OutputPathsFor maps a design onto the Go files that belong beside it. Pure: the paths are derived from the design path alone, so callers can report where output will land without touching the disk.
type DesignerMode ¶
type DesignerMode int
DesignerMode represents a top-level mode of the Silk Designer, similar to Qt Creator's mode selector on the left sidebar.
const ( ModeDesign DesignerMode = iota // UI Design mode (widget palette + canvas + properties) ModeEdit // IDE/Code mode (file explorer + multi-tab editor) ModeDebug // Debug mode (reserved for future use) )
type DevicePointsEditor ¶
DevicePointsEditor is the designer-side editor for a device component's tag point list. It parses the component's CSV point text (via device.ParsePoints) into an editable row model — one driver.TagPoint per row — and, on an inline edit, emits the regenerated CSV through SigChanged so the property panel can push it back onto the component. Rendering is a read-style table; cell edits are applied through SetCell. It embeds gui.Widget so it can sit in the property panel; it holds no device connection, only the point config.
func NewDevicePointsEditor ¶
func NewDevicePointsEditor() *DevicePointsEditor
NewDevicePointsEditor returns an empty editor ready to be given point text.
func (*DevicePointsEditor) Cell ¶
func (e *DevicePointsEditor) Cell(row, col int) string
Cell returns the display string for one cell, or "" if row/col is out of range.
func (*DevicePointsEditor) Draw ¶
func (e *DevicePointsEditor) Draw(g paint.Painter)
Draw renders the point table: a header row of column titles, then one row per point, with light column separators. It is display-only; edits go through SetCell.
func (*DevicePointsEditor) Init ¶
func (e *DevicePointsEditor) Init(self gui.IWidget)
Init sets up the embedded widget and table metrics.
func (*DevicePointsEditor) PointsText ¶
func (e *DevicePointsEditor) PointsText() string
PointsText returns the current rows as canonical CSV text.
func (*DevicePointsEditor) RowCount ¶
func (e *DevicePointsEditor) RowCount() int
RowCount is the number of point rows currently displayed.
func (*DevicePointsEditor) Rows ¶
func (e *DevicePointsEditor) Rows() []driver.TagPoint
Rows returns a copy of the row model.
func (*DevicePointsEditor) SetCell ¶
func (e *DevicePointsEditor) SetCell(row, col int, value string) error
SetCell applies an inline edit: it replaces one field of a row from its string form, revalidates the whole row through the shared parser, updates the model and fires SigChanged with the new CSV. It errors (leaving the row unchanged) if the resulting line is malformed.
func (*DevicePointsEditor) SetPointsText ¶
func (e *DevicePointsEditor) SetPointsText(text string) error
SetPointsText replaces the row model with the points parsed from text. It does not fire SigChanged (this is an external set, not a user edit). A malformed point list returns an error and leaves the current rows unchanged.
func (*DevicePointsEditor) SigChanged ¶
func (e *DevicePointsEditor) SigChanged(fn func(text string))
SigChanged registers a callback fired with the updated CSV text after an edit.
func (*DevicePointsEditor) SizeHints ¶
func (e *DevicePointsEditor) SizeHints() gui.SizeHints
SizeHints sizes the widget to the header plus the current rows.
type EditorTabs ¶
EditorTabs is a multi-tab code editor widget. Each tab holds a CodeEditor for one file. It draws a Chrome-style tab bar at the top and the active editor below.
func NewEditorTabs ¶
func NewEditorTabs() *EditorTabs
func (*EditorTabs) ActivateFile ¶
func (this *EditorTabs) ActivateFile(path string) bool
ActivateFile switches to the tab that holds the given file path if one is open, otherwise does nothing. Paths are compared after absolute-path resolution so callers can pass relative paths safely.
func (*EditorTabs) ActiveEditor ¶
func (this *EditorTabs) ActiveEditor() *gui.CodeEditor
ActiveEditor returns the CodeEditor of the currently active tab, or nil.
func (*EditorTabs) ActiveFilePath ¶
func (this *EditorTabs) ActiveFilePath() string
ActiveFilePath returns the absolute path of the file in the active tab, or an empty string if no tab is active.
func (*EditorTabs) CloseTab ¶
func (this *EditorTabs) CloseTab(idx int)
CloseTab closes the tab at the given index.
func (*EditorTabs) Draw ¶
func (this *EditorTabs) Draw(g paint.Painter)
Draw renders the tab bar and active editor background.
func (*EditorTabs) Init ¶
func (this *EditorTabs) Init(self gui.IWidget)
func (*EditorTabs) IsSplit ¶
func (this *EditorTabs) IsSplit() bool
IsSplit reports whether the split editor view is currently active.
func (*EditorTabs) Layout ¶
func (this *EditorTabs) Layout()
Layout positions the tab bar and the active editor(s).
func (*EditorTabs) OnKeyDown ¶
func (this *EditorTabs) OnKeyDown(key int, repeat bool)
OnKeyDown handles keyboard shortcuts: Ctrl+W close tab, Ctrl+S save, Ctrl+\ split.
func (*EditorTabs) OnLeftDown ¶
func (this *EditorTabs) OnLeftDown(x, y float64)
OnLeftDown handles tab clicks and close button clicks.
func (*EditorTabs) OnMouseLeave ¶
func (this *EditorTabs) OnMouseLeave()
OnMouseLeave resets hover state.
func (*EditorTabs) OnMouseMove ¶
func (this *EditorTabs) OnMouseMove(x, y float64)
OnMouseMove updates hover state for tab bar.
func (*EditorTabs) OnResize ¶
func (this *EditorTabs) OnResize()
OnResize re-layouts when the widget size changes.
func (*EditorTabs) OnTextInput ¶
func (this *EditorTabs) OnTextInput(s string)
OnTextInput forwards text input to QuickOpen popup when visible.
func (*EditorTabs) OpenFile ¶
func (this *EditorTabs) OpenFile(path string)
OpenFile opens a file in a new tab, or switches to an existing tab if the file is already open.
func (*EditorTabs) OpenFileAtLine ¶
func (this *EditorTabs) OpenFileAtLine(path string, line int)
OpenFileAtLine opens a file and scrolls to the given line (0-based). If the file is already open, it switches to that tab and scrolls.
func (*EditorTabs) OpenFilePaths ¶
func (this *EditorTabs) OpenFilePaths() []string
OpenFilePaths returns the absolute paths of all files currently open in tabs. Returned in tab order (left to right). Empty if no tabs are open.
func (*EditorTabs) SaveCurrent ¶
func (this *EditorTabs) SaveCurrent()
SaveCurrent saves the active tab's file to disk.
func (*EditorTabs) TabCount ¶
func (this *EditorTabs) TabCount() int
TabCount returns the number of open tabs.
func (*EditorTabs) Title ¶
func (this *EditorTabs) Title() string
Title returns a display title for the dock tab bar.
func (*EditorTabs) ToggleSplit ¶
func (this *EditorTabs) ToggleSplit()
ToggleSplit toggles the split editor view on or off.
type FakeWidget ¶
func NewFakeWidget ¶
func NewFakeWidget() *FakeWidget
func NewFakeWidgetFromFactory ¶
func NewFakeWidgetFromFactory(name string) (*FakeWidget, error)
func (*FakeWidget) DrawSelf ¶
func (this *FakeWidget) DrawSelf(g paint.Painter)
func (*FakeWidget) EnumProperties ¶
func (this *FakeWidget) EnumProperties(list prop.IPropertyList)
func (*FakeWidget) EventHandlers ¶
func (this *FakeWidget) EventHandlers() map[string]string
EventHandlers returns all event bindings.
func (*FakeWidget) Generate ¶
func (this *FakeWidget) Generate() gui.IWidget
func (*FakeWidget) GetCode ¶
func (this *FakeWidget) GetCode() string
func (*FakeWidget) Init ¶
func (this *FakeWidget) Init(self graph.IItem)
func (*FakeWidget) IsLocked ¶
func (this *FakeWidget) IsLocked() bool
IsLocked returns true if the widget is locked (both position and size).
func (*FakeWidget) Layout ¶
func (this *FakeWidget) Layout()
func (*FakeWidget) LoadDesign ¶
func (this *FakeWidget) LoadDesign(doc *core.TDoc) error
func (*FakeWidget) ManagesChildGeometry ¶
func (f *FakeWidget) ManagesChildGeometry() bool
ManagesChildGeometry distinguishes explicit layouts from free-positioned containers for graph gestures that must carry shared-coordinate descendants.
func (*FakeWidget) MarkDirty ¶
func (this *FakeWidget) MarkDirty()
MarkDirty forces the cached offscreen pixmap to be recreated on the next draw. Call this after any change to the embedded widget's visual state (text, value, size, etc.) so the designer preview stays in sync.
func (*FakeWidget) OnResize ¶
func (this *FakeWidget) OnResize()
OnResize is called by graph.Item.SetSize after bounds change (e.g. resize handles). It re-layouts the embedded widget so its pixel dimensions stay in sync.
func (*FakeWidget) RemoveEventHandler ¶
func (this *FakeWidget) RemoveEventHandler(event string)
RemoveEventHandler removes an event binding by name.
func (*FakeWidget) SaveDesign ¶
func (this *FakeWidget) SaveDesign() *core.TDoc
func (*FakeWidget) SetCode ¶
func (this *FakeWidget) SetCode(s string)
func (*FakeWidget) SetEventHandler ¶
func (this *FakeWidget) SetEventHandler(event, handler string)
SetEventHandler stores an event binding (event name -> handler function name).
func (*FakeWidget) SetEventHandlerChecked ¶
func (this *FakeWidget) SetEventHandlerChecked(event, handler string)
SetEventHandlerChecked applies an edit of one event binding: a blank value unbinds the event, a Go identifier binds it, and anything else is rejected. The name is pasted verbatim into generated code as a func call, so a name that is not an identifier yields a design that cannot generate compilable output — and the failure would only surface at build time, far from the edit that caused it.
func (*FakeWidget) SetLocked ¶
func (this *FakeWidget) SetLocked(b bool)
SetLocked locks or unlocks both position and size.
func (*FakeWidget) SetWidget ¶
func (this *FakeWidget) SetWidget(iw gui.IWidget)
func (*FakeWidget) SetWidgetName ¶
func (this *FakeWidget) SetWidgetName(name string)
func (*FakeWidget) SizePx ¶
func (this *FakeWidget) SizePx() (w, h float64)
func (*FakeWidget) Widget ¶
func (this *FakeWidget) Widget() gui.IWidget
func (*FakeWidget) WidgetFactoryName ¶
func (this *FakeWidget) WidgetFactoryName() string
func (*FakeWidget) WidgetName ¶
func (this *FakeWidget) WidgetName() string
type FileExplorer ¶
FileExplorer is a tree-style file browser panel that scans and displays the project directory structure. Double-clicking a file fires a callback to open it in an editor.
func NewFileExplorer ¶
func NewFileExplorer() *FileExplorer
func (*FileExplorer) Draw ¶
func (this *FileExplorer) Draw(g paint.Painter)
Draw renders the file tree.
func (*FileExplorer) Init ¶
func (this *FileExplorer) Init(self gui.IWidget)
func (*FileExplorer) OnLeftDown ¶
func (this *FileExplorer) OnLeftDown(x, y float64)
OnLeftDown handles click events: expand/collapse folders, select entries.
func (*FileExplorer) OnMouseLeave ¶
func (this *FileExplorer) OnMouseLeave()
OnMouseLeave resets hover.
func (*FileExplorer) OnMouseMove ¶
func (this *FileExplorer) OnMouseMove(x, y float64)
OnMouseMove updates hover state.
func (*FileExplorer) OnMouseWheel ¶
func (this *FileExplorer) OnMouseWheel(x, y, z float64)
OnMouseWheel handles scrolling through the file tree.
func (*FileExplorer) OnRightDown ¶
func (this *FileExplorer) OnRightDown(x, y float64)
OnRightDown opens the file-tree context menu. The clicked entry (if any) becomes the menu's target; a click on empty space targets the explorer root so New File / New Folder still work there.
func (*FileExplorer) Refresh ¶
func (this *FileExplorer) Refresh()
Refresh rescans the root directory.
func (*FileExplorer) SetRootDir ¶
func (this *FileExplorer) SetRootDir(dir string)
SetRootDir scans the given directory and rebuilds the tree.
func (*FileExplorer) SigFileOpen ¶
func (this *FileExplorer) SigFileOpen(fn func(path string))
SigFileOpen registers a callback invoked when a file is double-clicked.
type FileReplacement ¶
type FileReplacement struct {
Path string // file to rewrite
Before string // contents read from disk at preview time
After string // contents once the replacement is applied
Count int // occurrences replaced in this file
}
FileReplacement is one file's previewed rewrite: what is on disk now and what Replace All would put there. It is also the unit ApplyReplacements commits and the record it rolls back from, so Before is the exact text to restore.
type FormPreset ¶
type FormPreset struct {
Name string
Width float64 // in mm
Height float64 // in mm
Icon string // device type: desktop, laptop, tablet, phone, custom
}
FormPreset defines a named form size.
type FormPresetsPanel ¶
FormPresetsPanel displays a grid of preset cards for quickly resizing the current form/scene to common device dimensions.
func NewFormPresetsPanel ¶
func NewFormPresetsPanel() *FormPresetsPanel
func (*FormPresetsPanel) Draw ¶
func (this *FormPresetsPanel) Draw(g paint.Painter)
func (*FormPresetsPanel) Init ¶
func (this *FormPresetsPanel) Init(self gui.IWidget)
func (*FormPresetsPanel) OnLeftDown ¶
func (this *FormPresetsPanel) OnLeftDown(x, y float64)
func (*FormPresetsPanel) OnMouseLeave ¶
func (this *FormPresetsPanel) OnMouseLeave()
func (*FormPresetsPanel) OnMouseMove ¶
func (this *FormPresetsPanel) OnMouseMove(x, y float64)
func (*FormPresetsPanel) OnMouseWheel ¶
func (this *FormPresetsPanel) OnMouseWheel(x, y, delta float64)
func (*FormPresetsPanel) SetScene ¶
func (this *FormPresetsPanel) SetScene(scene *GedScene)
SetScene binds the panel to the current GedScene.
func (*FormPresetsPanel) SizeHints ¶
func (this *FormPresetsPanel) SizeHints() gui.SizeHints
type GedScene ¶
func NewGedScene ¶
func NewGedScene() *GedScene
func (*GedScene) AddDesignChangedCallback ¶
AddDesignChangedCallback appends a listener for the same news SigDesignChanged reports and returns the id RemoveDesignChangedCallback takes. The slot above holds exactly one callback and the code panel owns it (CodePanel.BindGedView), so a panel that also wants to follow the design registers here instead of assigning the slot and silently unplugging the 生成代码 view.
func (*GedScene) EnumProperties ¶
func (this *GedScene) EnumProperties(list prop.IPropertyList)
func (*GedScene) GenerateCode ¶
func (scene *GedScene) GenerateCode(opts CodeGenOptions) string
GenerateCode generates Go source code from the scene's design. By default it produces a complete, compilable Go program with main(); with opts.SplitHandlers it produces the machine-owned half of a pair, which compiles only alongside the user file that declares the handler methods (see GenerateCodeFile).
func (*GedScene) GenerateCodeFile ¶
func (scene *GedScene) GenerateCodeFile(filename string, opts CodeGenOptions) (SplitResult, error)
GenerateCodeFile writes the design as the machine/user pair described above. filename names either half (or neither): its extension is dropped and both files are derived from the stem, so exporting over an earlier export lands on the same pair.
func (*GedScene) GenerateCodeIndexed ¶
func (scene *GedScene) GenerateCodeIndexed(opts CodeGenOptions) GeneratedCode
GenerateCodeIndexed is GenerateCode plus the two things a live view of the generated file needs and a bare string cannot carry: the line each widget is constructed on, and whether the output can be trusted at all.
func (*GedScene) GenerateCodeWithMod ¶
func (scene *GedScene) GenerateCodeWithMod(projectDir string, opts CodeGenOptions) string
GenerateCodeWithMod is a thin wrapper around GenerateCode that resolves the project's go.mod (walking up from projectDir) and fills opts.ModulePath when the caller hasn't set it explicitly. A missing or malformed go.mod is non-fatal — codegen falls back to the plain GenerateCode behaviour. This is the first step toward proper import-path resolution: today only the "// Module: <path>" comment is emitted.
func (*GedScene) GenerateDeclCode ¶
func (scene *GedScene) GenerateDeclCode(opts CodeGenOptions) string
GenerateDeclCode produces a complete .silk.go file using the silk/decl builder DSL. Functionally a sibling of GenerateCode — the difference is the *style* of output:
GenerateCode produces an imperative struct + constructor:
type MyAppUI struct { Form *gui.Form BtnOK *gui.Button } func NewMyAppUI() *MyAppUI { ... }
GenerateDeclCode produces a declarative builder expression:
func BuildMyApp() *decl.Node { return decl.Form(decl.P("title", "MyApp"), decl.Children( decl.Button(decl.ID("btnOK"), decl.P("text", "OK")), ), ) }
The decl form pairs with (*decl.Node).Build() at runtime to materialise the actual widgets. It's the same shape silkgen emits from a .silkui file — wiring the designer through this entry point closes the loop: designer → AST → decl Go source → runtime widgets, all in-process.
Event-handler code (FakeWidget.GetCode()) is NOT inlined; the decl AST has no built-in slot for raw Go bodies. Handlers are emitted as trailing comments so the user can transcribe them or wire them via a host file. The imperative GenerateCode path remains the right choice when the form needs first-class handler bodies in the same file.
func (*GedScene) GenerateUserCode ¶
func (scene *GedScene) GenerateUserCode(opts CodeGenOptions) string
GenerateUserCode renders the user-owned half from scratch, as it is written the first time a design is generated.
func (*GedScene) Grid ¶
Grid returns the scene's grid model — the single source the canvas painting, the drag/drop/paste snap and the coarse keyboard nudge all read.
func (*GedScene) Guides ¶
func (this *GedScene) Guides() sceneGuides
Guides returns the design's user-placed guides.
func (*GedScene) MissingWidgets ¶
MissingWidgets names the factories the last load had to skip, in document order and with repeats, one entry per dropped widget. Kept on the scene because the warning it replaced only ever reached the log: the designer turns these into 问题 rows the moment the file opens.
func (*GedScene) NotifyDesignChanged ¶
func (this *GedScene) NotifyDesignChanged()
NotifyDesignChanged fires SigDesignChanged, then every listener added with AddDesignChangedCallback. Undo and Redo run commands backwards off the stack without pushing anything, so the paths that drive them call this to report what the stack cannot.
func (*GedScene) PushCommand ¶
PushCommand runs cmd through the undo stack, then reports the design changed.
func (*GedScene) RemoveDesignChangedCallback ¶
RemoveDesignChangedCallback drops the listener with the given id, and ignores an id that is not on the list (0, or one already removed).
A tool panel shared by every open document is re-aimed by dropping its old subscription and taking a new one. Without that it collects one listener per visit: come back to a design twice and every edit there rebuilds the panel twice, and a design the user has left keeps driving a panel that no longer shows it.
func (*GedScene) RemoveGuide ¶
RemoveGuide drops the guide at index on one axis. An out-of-range index is ignored so a stale drag cannot panic the canvas.
func (*GedScene) SaveDesign ¶
func (*GedScene) SetFilename ¶
func (*GedScene) SetFormTitle ¶
func (*GedScene) SetGrid ¶
SetGrid replaces the grid model, clamping the pitch into its legal range so no caller (dialog, loader, or a hand-edited document) can install a pitch that paints a smear or disables snapping by accident.
func (*GedScene) SetTagDict ¶
SetTagDict replaces the declared tags, dropping nameless and duplicate entries so what the generator emits is what the runtime registry can actually key on.
func (*GedScene) SigDesignChanged ¶
func (this *GedScene) SigDesignChanged(fn func())
SigDesignChanged registers the callback fired whenever the design is mutated through the undo stack. Like every other Sig* on a scene it is a single-callback slot.
The command stack is used rather than a per-kind signal because it is the one place every mutation passes: move, resize, drop, paste, reparent, morph, tag dictionary — and property-sheet edits, which have no signal at all (prop.PropertyItem.SetValue routes through the bound owner's PushCommand).
type GedView ¶
func NewGedView ¶
func NewGedView() *GedView
func NewProjectFromTemplate ¶
func NewProjectFromTemplate(tmpl *ProjectTemplate) *GedView
NewProjectFromTemplate creates a fully populated GedView from a template. This is a convenience function for programmatic use.
func NewProjectFromTemplateName ¶
NewProjectFromTemplateName creates a GedView from a template identified by its Chinese name string. Returns nil if no matching template is found.
func (*GedView) AddSelectionCallback ¶
func (this *GedView) AddSelectionCallback(cb SelectionCallback)
AddSelectionCallback registers an additional callback invoked when the canvas selection changes. This allows external components (like the code panel) to react to selection changes without replacing existing callbacks.
func (*GedView) AlignSelection ¶
AlignSelection repositions the selection for mode as one undoable step.
Two reference frames, and which one applies is decided by the selection, not by the mode:
- Two or more items, edge/centre-line modes: the reference is the selection's own extremes (min-left, max-right, mean-centre, …) — the rule every form designer uses, and the one alignRects implements. The per-item targets go onto one MoveCommand; MoveCommand.AddItem takes absolute (toX, toY), so N distinct targets need no composite and Ctrl+Z snaps everyone back at once. Each target carries the item's own subtree (graph.AddMoveSubtree), so aligning a container aligns what is in it — and a widget already riding along that way is out of the extremes as well as out of the command; see the comment on movers. Position-locked items are left where they are, as on every other move path — but they still count in the extremes an edge mode lines up on, while a mean mode averages only over what moves, and 分布 refuses outright rather than spread the rest around one; see the comments below.
- 居中 (AlignCenter), and any mode with a single item selected: there are no selection extremes worth aligning to, so the reference is the frame — the container the items live in, or the form when they sit at the root. That move is one shared delta, which is exactly what Selection.GenerateMoveCommand builds (and it skips position-locked and ancestor-selected items on the way, as every other move path does).
Both paths push nothing when nothing would move, so a no-op command never lands on the UndoStack.
func (*GedView) BreakLayout ¶
BreakLayout dissolves only layout containers and preserves both geometry and selection through undo/redo. Ordinary Card/GroupBox widgets are retained.
func (*GedView) BreakLayoutSelection ¶
func (this *GedView) BreakLayoutSelection()
BreakLayoutSelection is the inverse of LayOutSelection: for every selected container widget it lifts the children back up to the container's own parent and removes the now-empty container (Qt Designer's "Break Layout"). Children keep their absolute designer positions (containers use absolute coords in the canvas), so they stay put visually. The freed children become the new selection.
Only unlocked designer-layout widgets that actually hold children are affected; anything else in the selection is ignored, so the action is a no-op when nothing container-like is selected — and a no-op pushes nothing.
func (*GedView) BringSelectionToFront ¶
func (this *GedView) BringSelectionToFront()
BringSelectionToFront and SendSelectionToBack expose the canvas context menu's Z-order path to the host application's 排列 menu. Exported wrappers rather than a second implementation in package main: the undo here is an index snapshot walked back through Raise/Lower, and a menu that restacked items on its own would either skip undo or drift from that inverse.
func (*GedView) CanBreakLayout ¶
func (*GedView) CanLayoutSelection ¶
func (v *GedView) CanLayoutSelection(kind LayoutKind) bool
func (*GedView) Close ¶
func (this *GedView) Close()
Close is what the dock calls as this document's tab goes away, and the only notice the host application gets that a design is no longer open. Both close paths look for it: Dock.CloseIndex and gui.PromptSaveClose each type-assert the view for a Close() method, so the tab's × and 文件/关闭 arrive here alike.
Anything the host keyed on the document — the 问题 rows filed against it, for one — outlives the design without this, and goes on describing a canvas the user cannot open, let alone fix.
func (*GedView) CopySelected ¶
func (this *GedView) CopySelected()
CopySelected serializes every selected FakeWidget into the clipboard through the same SaveDesign the file format uses, so a copy carries the whole widget: its properties, its event bindings, its handler code and its children.
A selected widget whose container is also selected is left out: it already rides inside the container's subtree, and copying it as a second root would paste it twice — once nested, once loose on the canvas.
func (*GedView) DeleteSelectedItems ¶
func (this *GedView) DeleteSelectedItems()
DeleteSelectedItems removes all currently selected items from the scene as a single undoable DeleteCommand, so Ctrl+Z restores every widget at its original parent and z-order slot. The old bare Detach() loop dropped the items with no command on the stack, making deletion an unrecoverable data-loss operation.
func (*GedView) Draw ¶
Draw overrides GraphView.Draw to add the background grid, the manual guide lines, the alignment guide overlay and the rulers. The grid (when enabled) is painted first as a faint backdrop hint; the guides are painted over it, and the rulers last so nothing draws across them.
func (*GedView) DuplicateSelection ¶
func (this *GedView) DuplicateSelection()
DuplicateSelection copies the selection and pastes it straight back, the one-step Ctrl+D / 编辑 → 创建副本 command. It is the copy/paste pipeline rather than a second one beside it: PasteItems already offsets each copy by one grid pitch, hands it a unique name and leaves the selection on the new items. Like every Cmd+D built this way it overwrites the clipboard — the price of not carrying a second serializer.
func (*GedView) IsShowGrid ¶
IsShowGrid reports whether the background dot overlay is opted in.
func (*GedView) IsShowGuides ¶
IsShowGuides reports whether the rulers and guides are drawn.
func (*GedView) IsSnapToGrid ¶
IsSnapToGrid reports whether dragged/dropped widgets snap to the grid.
func (*GedView) LayOutSelection ¶
LayOutSelection wraps the current multi-selection in a new VBox (or HBox when horizontal) container and reparents the selected widgets into it, so codegen arranges them through the container's AddWidget path. The container is sized to the selection's bounding box and the children are reparented in layout order (top-to-bottom for a VBox, left-to-right for an HBox). The new container becomes the selection.
The whole wrap goes onto the undo stack as one ReparentCommand, which is also how the 布局 menu tells an applied layout from a declined one. A single free layout container of the matching type is activated in place. Otherwise requires at least two sibling widgets.
func (*GedView) LayoutSelection ¶
func (v *GedView) LayoutSelection(kind LayoutKind) bool
LayoutSelection activates a selected free layout container in place, or wraps sibling widgets in one undoable layout. Grid and form placement is persisted explicitly, so preview and both code emitters agree.
func (*GedView) OnDragEnter ¶
func (this *GedView) OnDragEnter(x, y float64, dnd gui.IDndContext)
func (*GedView) OnDragLeave ¶
func (this *GedView) OnDragLeave()
func (*GedView) OnDragMove ¶
func (this *GedView) OnDragMove(x, y float64, dnd gui.IDndContext)
func (*GedView) OnLeftDown ¶
OnLeftDown grabs focus, detects double-clicks for text editing, then delegates to GraphView for normal tool handling.
func (*GedView) OnLeftUp ¶
OnLeftUp overrides GraphView.OnLeftUp to clear alignment guides when the drag ends.
func (*GedView) OnMouseMove ¶
OnMouseMove overrides GraphView.OnMouseMove to compute alignment guides while dragging selected items.
func (*GedView) OnRightUp ¶
OnRightUp shows a context menu when the user right-clicks on the canvas.
func (*GedView) PasteItems ¶
func (this *GedView) PasteItems()
PasteItems rebuilds each clipboard subtree through the design loader and drops it on the canvas offset by one grid cell, so the copies don't sit on top of the originals after snap-rounding. With the default 5mm grid, a fixed (2, 2) nudge plus snap actually rounded BACK to the original cell — the per-cell step here keeps the offset visible whatever the grid.
func (*GedView) SameSizeSelection ¶
func (this *GedView) SameSizeSelection(mode graph.SameSizeMode)
SameSizeSelection resizes every selected item onto the last-selected item's width and/or height, keeping each item's position. Exported because the host application owns the 排列 menu but not minWidgetSize — routing the menu back through here keeps one floor value behind every resize path instead of a second copy in package main.
One press is one undo step: no merge token, because a menu command is not a repeating gesture the way a held Ctrl+arrow is.
func (*GedView) SendSelectionToBack ¶
func (this *GedView) SendSelectionToBack()
func (*GedView) SetContextPanelCallbacks ¶
func (v *GedView) SetContextPanelCallbacks(properties, code func())
SetContextPanelCallbacks lets the host activate its actual dock panels rather than merely changing a selection that is already selected by right-click.
func (*GedView) SetGridSize ¶
SetGridSize sets the grid spacing in mm.
func (*GedView) SetGridStep ¶
SetGridStep sets the grid spacing in mm (alias of SetGridSize; the canvas grid, the snap rounding and the coarse nudge share this single step).
func (*GedView) SetShowGrid ¶
SetShowGrid toggles the faint background dot overlay drawn on the page. This is the overlay's own opt-in, on top of the scene's grid visibility.
func (*GedView) SetShowGuides ¶
SetShowGuides toggles the rulers and the manual guide lines together.
func (*GedView) SetSnapEnabled ¶
SetSnapEnabled toggles snap-to-grid behavior.
func (*GedView) SetSnapToGrid ¶
SetSnapToGrid toggles snap-to-grid (alias of SetSnapEnabled, matching the Qt Designer "Grid → Snap to grid" wording the toolbar/menu uses).
func (*GedView) SnapEnabled ¶
SnapEnabled returns whether snap-to-grid is active.
func (*GedView) Undo ¶
func (this *GedView) Undo()
Undo steps the design's command stack back one command and reports the design changed. Running a command backwards pushes nothing, so the signal PushCommand raises never fires for an undo — every listener on it would otherwise keep showing the state Ctrl+Z just left.
func (*GedView) WantsTab ¶
WantsTab claims Tab for the canvas so it walks the widgets being designed.
Without this the key never arrives: gui's window layer owns Tab for focus traversal and spends it before OnKeyDown runs, moving focus to the next IDE panel and taking it off the canvas — so the next Tab walks further away and the widget is unreachable from the keyboard, which is the whole point of the binding. Claimed only when the canvas has something to walk, so an empty form still lets Tab leave the panel.
type GenerateResult ¶
type GenerateResult struct {
Design string // the .silkui the result belongs to
Output string // the file written; "" when nothing was
Err error
}
GenerateResult is one design's outcome in a project-wide generate.
type GenerateRunnable ¶
type GenerateRunnable bool
GenerateRunnable controls whether a complete runnable main() is generated.
type GeneratedCode ¶
type GeneratedCode struct {
Code string
// Lines maps a designed widget to the 0-based line of the statement that
// constructs it. A widget the generator emitted nothing for is absent.
Lines map[*FakeWidget]int
// Err names what the generator could not render. Code is still filled in —
// it is the degraded output — but a view showing it as the design's code
// would be lying, so viewers show Err in its place.
Err error
}
GeneratedCode is one pass of GenerateCodeIndexed: the source, where in it each designed widget is built, and whether the source is a faithful rendering of the design.
func (GeneratedCode) Line ¶
func (g GeneratedCode) Line(fake *FakeWidget) (int, bool)
Line returns the 0-based line fake is constructed on, and whether it is in the map at all.
type GitBranchInfo ¶
type GitBranchInfo struct {
Name string // current branch, or the short hash on a detached HEAD
Upstream string // tracking branch, e.g. "origin/main"; "" when untracked
Ahead int // commits on the branch the upstream lacks
Behind int // commits on the upstream the branch lacks
Detached bool // HEAD is not on a branch
}
GitBranchInfo is what the branch bar shows: the checked-out branch, its upstream, and how far the two have diverged. The host fills it in from core.GitCurrentBranch plus a divergence count (e.g. `git rev-list --left-right --count @{u}...HEAD`); the panel only formats it.
type GitChangesPanel ¶
GitChangesPanel is the IDE's "Source Control / Changes" pane: the list of files with uncommitted modifications, like the left-rail list in VS Code's SCM view or Qt Creator's "Git > status". It is a pure display/interaction widget — it never shells out to git itself. The host (silkide) drives core.GitStatusPorcelain(dir) and pushes the entries in via SetEntries; the panel renders them and emits several signals back:
SigFileActivated — a row's body was single-clicked. The host opens the
file in the editor.
SigFileDiff — a row's body was double-clicked. The host shows the
file's diff.
SigCommit — the user submitted a commit (Enter in the message
line or the Commit button) with a non-empty message
and at least one staged path. The host runs
core.GitStage on the paths, core.GitCommit with the
message, then re-pushes the refreshed status via
SetEntries. The panel never shells out to git itself.
The framework has no native double-click event, so consecutive clicks on the same row are timed here, the same idiom file-explorer.go and debug-panel.go use. A double-click therefore fires SigFileActivated on the first click and SigFileDiff on the second — which mirrors VS Code, where a single click opens the file and a double click opens its diff.
Each row carries a stage checkbox in its left gutter: clicking the checkbox column acts on the row's stage state without opening the file, while clicking the row body still activates it. The message line + Commit button live in a band at the bottom, a rolled text line in the same idiom as debug-panel.go's watch input (no embedded gui.Edit). The header carries a "Stage All" toggle and an "Unstage" button that fires SigUnstageRequested over the staged set so the host can drop those paths from the git index (core.GitUnstage). The commit input takes Shift+Enter for a newline, so a message carries a subject and body; plain Enter still submits.
What the checkbox *means* depends on how the host pushes state in:
SetFiles (index-driven) each file arrives with the GitIndexState the
host read out of git, so the checkbox mirrors
the real index. Clicking it changes nothing
locally — it fires SigStage(path) /
SigUnstage(path), the host runs git and pushes
a fresh set back through SetFiles.
SetEntries (legacy) no index state arrives, so the checkbox is a
local commit selection (tracked in `staged`,
keyed by entry.Path) the way it always was.
Index-driven mode is the accurate one: staging is a property of the git index, not of a UI toggle. Legacy mode stays for hosts that still push raw core.GitStatusPorcelain output.
The list itself is flat with a per-row status letter; the grouped view — conflict / staged / unstaged / untracked sections under collapsible headers, plus the branch and remote bars — is GitWorkspacePanel, which consumes the same []GitFileState this panel takes through SetFiles.
func NewGitChangesPanel ¶
func NewGitChangesPanel() *GitChangesPanel
NewGitChangesPanel creates an empty changes panel.
func (*GitChangesPanel) Clear ¶
func (this *GitChangesPanel) Clear()
Clear empties the change list and resets the view. The host calls this when the working tree is clean or the repo context goes away.
func (*GitChangesPanel) ClearStaged ¶
func (this *GitChangesPanel) ClearStaged()
ClearStaged unchecks every path in the local commit selection. The host calls this to reset it (e.g. after driving its own commit). A no-op when nothing is selected, and in index-driven mode, where there is no local selection to clear — use UnstageAll to empty the real index.
func (*GitChangesPanel) Draw ¶
func (this *GitChangesPanel) Draw(g paint.Painter)
Draw renders a count header followed by one row per change: a status letter in its accent colour, then the path with the basename emphasised and the directory dimmed.
func (*GitChangesPanel) Entries ¶
func (this *GitChangesPanel) Entries() []core.GitStatusEntry
Entries returns a defensive copy of the change rows in arrival order. A copy keeps the host from mutating (or truncating) the panel's backing slice.
func (*GitChangesPanel) IndexState ¶
func (this *GitChangesPanel) IndexState(path string) GitIndexState
IndexState reports the index bucket the host last reported for a path through SetFiles. Unknown paths — and every path in legacy SetEntries mode, where the host reports no index state at all — read as GitUnstaged.
func (*GitChangesPanel) Init ¶
func (this *GitChangesPanel) Init(self gui.IWidget)
func (*GitChangesPanel) OnKeyDown ¶
func (this *GitChangesPanel) OnKeyDown(key int, repeat bool)
OnKeyDown drives the commit message input while it holds focus: Enter submits the commit, Esc unfocuses, Backspace deletes a rune. Keys are ignored when the input is unfocused (the panel has no other key handling).
func (*GitChangesPanel) OnLeftDown ¶
func (this *GitChangesPanel) OnLeftDown(x, y float64)
OnLeftDown routes a click. The bottom commit band takes it first: the message line focuses the input, the Commit button submits. Otherwise a click in a row's left checkbox column toggles that row's stage state, while a click on the row body fires SigFileActivated — and a quick second body-click on the same row fires SigFileDiff, the same double-click idiom as file-explorer.go / debug-panel.go.
func (*GitChangesPanel) OnMouseLeave ¶
func (this *GitChangesPanel) OnMouseLeave()
OnMouseLeave clears the hover highlight.
func (*GitChangesPanel) OnMouseMove ¶
func (this *GitChangesPanel) OnMouseMove(x, y float64)
OnMouseMove tracks hover state for the row highlight.
func (*GitChangesPanel) OnMouseWheel ¶
func (this *GitChangesPanel) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls the row list vertically.
func (*GitChangesPanel) OnTextInput ¶
func (this *GitChangesPanel) OnTextInput(s string)
OnTextInput feeds typed characters into the commit message input while it holds focus. Enter / Backspace arrive via OnKeyDown, not here; when the input is unfocused, typing is ignored.
func (*GitChangesPanel) SetEntries ¶
func (this *GitChangesPanel) SetEntries(entries []core.GitStatusEntry)
SetEntries replaces the change list with a defensive copy of entries and resets the view. The host calls this after every core.GitStatusPorcelain refresh — the panel keeps its own copy rather than borrowing the host's slice so a later host refresh can't mutate rows out from under a paint.
This is the legacy push: no index state arrives with the rows, so the checkbox column stays a local commit selection and the panel leaves index-driven mode. Hosts that can report where each file sits in the index should push SetFiles instead.
func (*GitChangesPanel) SetFiles ¶
func (this *GitChangesPanel) SetFiles(files []GitFileState)
SetFiles replaces the change list with files whose index state the host read out of git, switching the panel into index-driven mode: the checkbox column then shows where each file actually sits in the index (staged / unstaged / conflict / untracked) instead of what the user last clicked, and a click on it fires SigStage / SigUnstage rather than mutating local state. The host runs git and calls SetFiles again with the new truth.
Any local commit selection left over from a previous SetEntries push is dropped — the two models never mix.
func (*GitChangesPanel) SetStaged ¶
func (this *GitChangesPanel) SetStaged(path string, on bool)
SetStaged is the programmatic checkbox click: it stages (on) or unstages (off) a path. In index-driven mode it asks the host to change the git index (SigStage / SigUnstage) and mutates nothing locally; in legacy mode it flips the local commit selection, where unchecking removes the key so StagedPaths stays a clean set. Repaints only when local state actually changes.
func (*GitChangesPanel) SigCommit ¶
func (this *GitChangesPanel) SigCommit(fn func(message string, stagedPaths []string))
SigCommit registers the callback fired when the user submits a commit — Enter in the message line or a click on the Commit button — with a non-empty (trimmed) message AND at least one staged path. The callback receives the message and a copy of the staged paths; the host stages them (core.GitStage), commits (core.GitCommit), and re-pushes the refreshed status via SetEntries. Submitting with an empty message or zero staged paths is a no-op and never fires.
func (*GitChangesPanel) SigFileActivated ¶
func (this *GitChangesPanel) SigFileActivated(fn func(entry core.GitStatusEntry))
SigFileActivated registers the callback fired when the user single-clicks a row. The host opens the file in the editor. The callback receives a copy of the entry so the host can hold onto it past a later Clear without aliasing the panel's slice.
func (*GitChangesPanel) SigFileDiff ¶
func (this *GitChangesPanel) SigFileDiff(fn func(entry core.GitStatusEntry))
SigFileDiff registers the callback fired when the user double-clicks a row. The host renders the file's diff (e.g. core.GitDiffFile + ParseUnifiedDiff).
func (*GitChangesPanel) SigStage ¶
func (this *GitChangesPanel) SigStage(fn func(path string))
SigStage registers the callback fired when the user stages one file in index-driven mode (SetFiles) — a click on an unchecked row's checkbox, or SetStaged(path, true). It receives that file's path; the host runs core.GitStage on it and pushes the refreshed status back through SetFiles. It never fires in legacy SetEntries mode, where the checkbox is only a local commit selection.
func (*GitChangesPanel) SigUnstage ¶
func (this *GitChangesPanel) SigUnstage(fn func(path string))
SigUnstage registers the per-file counterpart to SigStage: a click on a staged row's checkbox in index-driven mode, or SetStaged(path, false). The host runs core.GitUnstage on that single path. Distinct from SigUnstageRequested, which carries the whole staged set from the header button.
func (*GitChangesPanel) SigUnstageRequested ¶
func (this *GitChangesPanel) SigUnstageRequested(fn func(paths []string))
SigUnstageRequested registers the callback fired by the header "Unstage" button. It receives the currently-checked paths (StagedPaths order); the host moves them OUT of the git index (core.GitUnstage) and re-pushes the refreshed status via SetEntries. This is distinct from the local commit-selection toggles (StageAll / UnstageAll / SetStaged): those only flip the in-panel `staged` set, while this asks the host to touch the real git index. Fires only when at least one path is checked.
func (*GitChangesPanel) SizeHints ¶
func (this *GitChangesPanel) SizeHints() gui.SizeHints
func (*GitChangesPanel) StageAll ¶
func (this *GitChangesPanel) StageAll()
StageAll is the header "Stage All" affordance's on-state: it stages every current entry. In index-driven mode that means one SigStage per file that is not staged yet (the host stages them and pushes the result back); in legacy mode it checks every path in the local commit-selection set, leaving already-checked paths alone. A no-op on an empty change list.
func (*GitChangesPanel) StagedPaths ¶
func (this *GitChangesPanel) StagedPaths() []string
StagedPaths returns the staged paths in lexical order (a copy the host can hold onto). In index-driven mode those are the paths the host reported as GitStaged — the real index; in legacy mode they are the ones the user checked. The order is stable so a commit's file set is deterministic; git does not care about the order.
func (*GitChangesPanel) UnstageAll ¶
func (this *GitChangesPanel) UnstageAll()
UnstageAll is the header affordance's off-state and the counterpart to StageAll. In index-driven mode it fires one SigUnstage per staged path so the host empties the index; in legacy mode it only unchecks the in-panel selection (same effect as ClearStaged), leaving the real index to SigUnstageRequested.
type GitFileState ¶
type GitFileState struct {
Entry core.GitStatusEntry
State GitIndexState
}
GitFileState is one changed file as the host reports it: the raw porcelain entry plus the index bucket it belongs to. Entry carries the path, the rename source and both status columns, so a row renderer can reuse statusLetter / statusColor / rowLabel unchanged.
func GitFileStatesFromEntries ¶
func GitFileStatesFromEntries(entries []core.GitStatusEntry) []GitFileState
GitFileStatesFromEntries maps porcelain entries through ClassifyGitEntry, preserving input order. The convenience path for a host that already has a []core.GitStatusEntry and wants the default bucketing.
type GitIndexState ¶
type GitIndexState int
GitIndexState is where a changed file sits relative to the git index — the fact a source-control view groups by.
It is the *host's* reading of git, never a UI toggle: the host runs core.GitStatusPorcelain, buckets every entry (ClassifyGitEntry is the default rule) and pushes the result into the panels. The panels render that state and ask the host to change the index (SigStage / SigUnstage / SigResolve); the host runs git and pushes a fresh set back. Nothing in the UI guesses what the index now holds.
GitUnstaged is the zero value, so a GitFileState built without an explicit state reads as a plain worktree change.
const ( GitUnstaged GitIndexState = iota // worktree change that is not in the index GitStaged // change recorded in the index, ready to commit GitConflict // unmerged path (merge / rebase conflict) GitUntracked // path git does not track at all )
func ClassifyGitEntry ¶
func ClassifyGitEntry(entry core.GitStatusEntry) GitIndexState
ClassifyGitEntry buckets a `git status --porcelain` entry into an index state. Precedence, highest first:
- Conflict — either column is 'U', or the pair is "AA" / "DD": git's unmerged states. A conflict outranks everything else; it has to be resolved before the remaining state means anything.
- Untracked — '?' in either column (git emits "??").
- Staged — the X (index) column carries a real code. A partially staged file ("MM": a staged edit plus a newer worktree edit) lands here, because that is the change `git commit` would capture.
- Unstaged — everything else, i.e. a worktree-only change.
One bucket per file is the model: a host that wants a different split can build GitFileStates itself and push those, this is only the default translation.
func (GitIndexState) String ¶
func (s GitIndexState) String() string
String returns the state's stable lowercase name ("staged", "unstaged", "conflict", "untracked"). Unknown values read as "unstaged", matching the zero value. Used in diagnostics and test failure messages.
type GitLogPanel ¶
GitLogPanel is the bottom-dock "History" pane: the list of recent commits, like Qt Creator's "Git > Log" or VS Code's timeline. It is a pure display/interaction widget — it never shells out to git itself. The host (silkide) drives core.GitShortLog(dir, n) (repo history) or core.GitLogFile(dir, file, n) (single-file history) and pushes the commits in via SetCommits; the panel renders them and emits one signal back:
SigCommitActivated — a row was clicked. The host acts on the commit
(show it, or open its diff).
core.GitCommit is a plain {Hash, Subject, Author, Date} data struct, so it is used directly on the public API surface — the same choice GitChangesPanel makes with core.GitStatusEntry, and unlike ReferencesPanel / TodoPanel which keep their own flat row types because they translate away from wire shapes (LSP locations, marker scans).
func NewGitLogPanel ¶
func NewGitLogPanel() *GitLogPanel
NewGitLogPanel creates an empty history panel.
func (*GitLogPanel) Clear ¶
func (this *GitLogPanel) Clear()
Clear removes all history rows and resets the view.
func (*GitLogPanel) Commits ¶
func (this *GitLogPanel) Commits() []core.GitCommit
Commits returns a defensive copy of the history rows in display order. Returning the backing slice would let callers mutate the panel's state from the outside.
func (*GitLogPanel) Draw ¶
func (this *GitLogPanel) Draw(g paint.Painter)
Draw renders the count header followed by one row per commit: the short hash in a dim gold accent, the subject in primary grey (truncated to the space before the meta column), and the author + date dim and right-aligned. Alternating tint, plus a hover / selection highlight.
func (*GitLogPanel) Init ¶
func (this *GitLogPanel) Init(self gui.IWidget)
func (*GitLogPanel) OnLeftDown ¶
func (this *GitLogPanel) OnLeftDown(x, y float64)
OnLeftDown fires the activated callback for the clicked commit row (the host shows the commit or its diff) and highlights it. Clicks in the header band are inert.
func (*GitLogPanel) OnMouseLeave ¶
func (this *GitLogPanel) OnMouseLeave()
OnMouseLeave clears the hover highlight.
func (*GitLogPanel) OnMouseMove ¶
func (this *GitLogPanel) OnMouseMove(x, y float64)
OnMouseMove tracks hover state for the row highlight.
func (*GitLogPanel) OnMouseWheel ¶
func (this *GitLogPanel) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls the row list vertically, clamped to the content.
func (*GitLogPanel) SetCommits ¶
func (this *GitLogPanel) SetCommits(commits []core.GitCommit)
SetCommits replaces the history rows with a defensive copy and resets the view. A copy is taken so the host can keep mutating (or reuse) the slice it handed in — e.g. a later GitShortLog refresh — without corrupting the panel's state mid-paint.
func (*GitLogPanel) SigCommitActivated ¶
func (this *GitLogPanel) SigCommitActivated(fn func(commit core.GitCommit))
SigCommitActivated registers the callback fired when the user clicks a commit row. It receives the whole commit so the host can show it or its diff.
func (*GitLogPanel) SizeHints ¶
func (this *GitLogPanel) SizeHints() gui.SizeHints
type GitRemote ¶
GitRemote is one configured remote (`git remote -v`), listed in the panel's bottom band.
type GitWorkspaceModel ¶
type GitWorkspaceModel struct {
// contains filtered or unexported fields
}
GitWorkspaceModel is the row model behind GitWorkspacePanel: the changed files the host pushed plus the per-group collapse state, flattened into GitWorkspaceRows on demand. It holds no widget and touches no git, so grouping and collapse can be tested directly.
Zero value is usable: the collapse map is created on first write and read as "everything expanded" until then.
func NewGitWorkspaceModel ¶
func NewGitWorkspaceModel() *GitWorkspaceModel
NewGitWorkspaceModel returns an empty model with every group expanded.
func (*GitWorkspaceModel) Clear ¶
func (this *GitWorkspaceModel) Clear()
Clear drops every file. Collapse state survives, for the same reason SetFiles keeps it.
func (*GitWorkspaceModel) Collapsed ¶
func (this *GitWorkspaceModel) Collapsed(state GitIndexState) bool
Collapsed reports whether a group is folded. Safe on the zero model.
func (*GitWorkspaceModel) Count ¶
func (this *GitWorkspaceModel) Count(state GitIndexState) int
Count is how many files sit in a group.
func (*GitWorkspaceModel) Files ¶
func (this *GitWorkspaceModel) Files() []GitFileState
Files returns a defensive copy of the file set in the order the host pushed it (ungrouped).
func (*GitWorkspaceModel) Group ¶
func (this *GitWorkspaceModel) Group(state GitIndexState) []GitFileState
Group returns the files bucketed into state, sorted by path so the group order is deterministic regardless of how git emitted them (a rename sorts by its target path, which is what the row shows first).
func (*GitWorkspaceModel) RowAt ¶
func (this *GitWorkspaceModel) RowAt(idx int) (row GitWorkspaceRow, ok bool)
RowAt returns the row at idx, or ok=false when idx is out of range.
func (*GitWorkspaceModel) Rows ¶
func (this *GitWorkspaceModel) Rows() []GitWorkspaceRow
Rows flattens the file set + collapse state into the line sequence the panel draws and hit-tests. Groups appear in gitGroupOrder; an empty group contributes nothing (no header for a bucket with no files); a folded group contributes only its header.
func (*GitWorkspaceModel) SetCollapsed ¶
func (this *GitWorkspaceModel) SetCollapsed(state GitIndexState, on bool)
SetCollapsed folds (on) or unfolds (off) a group.
func (*GitWorkspaceModel) SetFiles ¶
func (this *GitWorkspaceModel) SetFiles(files []GitFileState)
SetFiles replaces the file set with a defensive copy, so a later host refresh cannot mutate rows out from under a paint. Collapse state is deliberately kept: a refresh after a stage must not re-open groups the user folded.
func (*GitWorkspaceModel) ToggleCollapsed ¶
func (this *GitWorkspaceModel) ToggleCollapsed(state GitIndexState)
ToggleCollapsed flips a group's fold state.
type GitWorkspacePanel ¶
GitWorkspacePanel is the IDE's source-control pane: the working tree grouped the way git actually sees it, plus the repository-level actions that live above the file list. It is the grouped counterpart to GitChangesPanel's flat row list, and like every sibling panel it is a pure display/interaction widget — it never shells out to git.
Layout, top to bottom:
branch bar the current branch, its upstream and the ahead/behind
marker (gitBranchBarText). Clicking it opens an inline
name input in "checkout" mode.
remote chips [取回 fetch] [拉取 pull] [推送 push]
branch chips [新建 new branch] [暂存 stash] [弹出 stash pop]
file list collapsible 冲突 / 已暂存 / 未暂存 / 未跟踪 groups, one row
per file, driven by the per-file GitIndexState the host
reported (GitWorkspaceModel owns the grouping).
remotes band a collapsible list of the configured remotes, pinned to
the bottom edge the way GitChangesPanel pins its commit
band.
The host (silkide) drives every git call and pushes state in — SetFiles / SetBranch / SetRemotes — then listens on the callbacks:
SigCheckout(branch) switch to an existing branch (git checkout) SigCreateBranch(name) create + switch (git checkout -b) SigFetch/SigPull/SigPush remote sync SigStash/SigStashPop git stash / git stash pop SigResolve(path) mark a conflicted file resolved (git add <path>) SigFileActivated(path) open the file in the editor
After any of those the host re-reads git and pushes fresh state back; the panel never predicts the outcome of an action it asked for.
Both chip strips are left-aligned at fixed widths, so every action hit-test is a pure function of x alone (gitWsChipAt) — no font measurement and no dependency on the widget's size off the paint path.
func NewGitWorkspacePanel ¶
func NewGitWorkspacePanel() *GitWorkspacePanel
NewGitWorkspacePanel creates an empty source-control panel.
func (*GitWorkspacePanel) Branch ¶
func (this *GitWorkspacePanel) Branch() GitBranchInfo
Branch returns the branch info last pushed in.
func (*GitWorkspacePanel) Clear ¶
func (this *GitWorkspacePanel) Clear()
Clear empties the file list and closes the inline input. Branch info and remotes stay: they describe the repository, not the working tree, and the host drops them by pushing empty values when the repo context goes away.
func (*GitWorkspacePanel) Collapsed ¶
func (this *GitWorkspacePanel) Collapsed(state GitIndexState) bool
Collapsed reports whether a group is folded.
func (*GitWorkspacePanel) Draw ¶
func (this *GitWorkspacePanel) Draw(g paint.Painter)
Draw paints the branch bar, the two chip strips, the grouped file list and the bottom remotes band.
func (*GitWorkspacePanel) Files ¶
func (this *GitWorkspacePanel) Files() []GitFileState
Files returns a defensive copy of the pushed file states, ungrouped.
func (*GitWorkspacePanel) Init ¶
func (this *GitWorkspacePanel) Init(self gui.IWidget)
func (*GitWorkspacePanel) OnKeyDown ¶
func (this *GitWorkspacePanel) OnKeyDown(key int, repeat bool)
OnKeyDown drives the inline branch-name input while it is open: Enter submits, Esc closes, Backspace deletes a rune. Keys are ignored when the input is closed (the panel has no other key handling).
func (*GitWorkspacePanel) OnLeftDown ¶
func (this *GitWorkspacePanel) OnLeftDown(x, y float64)
OnLeftDown routes a click. The three top bars take it first (branch bar opens the checkout input, the chips fire their action), then the bottom remotes band (its header folds, its rows are inert), then the grouped file list: a group header folds/unfolds, a 冲突 row's mark column asks the host to resolve the file, any other file-row click opens it.
func (*GitWorkspacePanel) OnMouseLeave ¶
func (this *GitWorkspacePanel) OnMouseLeave()
OnMouseLeave clears the hover highlight.
func (*GitWorkspacePanel) OnMouseMove ¶
func (this *GitWorkspacePanel) OnMouseMove(x, y float64)
OnMouseMove tracks hover state for the row highlight.
func (*GitWorkspacePanel) OnMouseWheel ¶
func (this *GitWorkspacePanel) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls the grouped file list, clamped to its content.
func (*GitWorkspacePanel) OnTextInput ¶
func (this *GitWorkspacePanel) OnTextInput(s string)
OnTextInput feeds typed characters into the inline input while it is open. Enter / Backspace arrive via OnKeyDown, not here.
func (*GitWorkspacePanel) Remotes ¶
func (this *GitWorkspacePanel) Remotes() []GitRemote
Remotes returns a defensive copy of the remotes list.
func (*GitWorkspacePanel) Rows ¶
func (this *GitWorkspacePanel) Rows() []GitWorkspaceRow
Rows returns the flattened row list the panel draws — group headers plus the files of every expanded group. Exposed so a host (or a test) can see exactly what is on screen without a paint.
func (*GitWorkspacePanel) SetBranch ¶
func (this *GitWorkspacePanel) SetBranch(info GitBranchInfo)
SetBranch replaces the branch bar's contents.
func (*GitWorkspacePanel) SetCollapsed ¶
func (this *GitWorkspacePanel) SetCollapsed(state GitIndexState, on bool)
SetCollapsed folds (on) or unfolds (off) a group and repaints. Host- callable so a persisted UI layout can restore the fold state.
func (*GitWorkspacePanel) SetEntries ¶
func (this *GitWorkspacePanel) SetEntries(entries []core.GitStatusEntry)
SetEntries is the convenience push for a host that has raw porcelain entries: it buckets them with ClassifyGitEntry and defers to SetFiles.
func (*GitWorkspacePanel) SetFiles ¶
func (this *GitWorkspacePanel) SetFiles(files []GitFileState)
SetFiles replaces the grouped file list with the states the host read out of git. Per-group collapse state survives the push, so a refresh after a stage does not re-open groups the user folded.
func (*GitWorkspacePanel) SetRemotes ¶
func (this *GitWorkspacePanel) SetRemotes(remotes []GitRemote)
SetRemotes replaces the bottom remotes list with a defensive copy.
func (*GitWorkspacePanel) SigCheckout ¶
func (this *GitWorkspacePanel) SigCheckout(fn func(branch string))
SigCheckout registers the callback fired when the user submits a branch name in the branch bar's input. The host runs `git checkout <branch>` and pushes the refreshed branch + file state back.
func (*GitWorkspacePanel) SigCreateBranch ¶
func (this *GitWorkspacePanel) SigCreateBranch(fn func(name string))
SigCreateBranch registers the callback fired when the user submits a name after the [新建] chip. The host runs `git checkout -b <name>`.
func (*GitWorkspacePanel) SigFetch ¶
func (this *GitWorkspacePanel) SigFetch(fn func())
SigFetch registers the [取回] chip's callback (`git fetch`).
func (*GitWorkspacePanel) SigFileActivated ¶
func (this *GitWorkspacePanel) SigFileActivated(fn func(path string))
SigFileActivated registers the callback fired when a file row's body is clicked. The host opens that path in the editor.
func (*GitWorkspacePanel) SigPull ¶
func (this *GitWorkspacePanel) SigPull(fn func())
SigPull registers the [拉取] chip's callback (`git pull`).
func (*GitWorkspacePanel) SigPush ¶
func (this *GitWorkspacePanel) SigPush(fn func())
SigPush registers the [推送] chip's callback (`git push`).
func (*GitWorkspacePanel) SigResolve ¶
func (this *GitWorkspacePanel) SigResolve(fn func(path string))
SigResolve registers the callback fired when the user clicks the mark column of a row in the 冲突 group. It receives the conflicted path; the host marks it resolved (`git add <path>`) and re-reads git.
func (*GitWorkspacePanel) SigStash ¶
func (this *GitWorkspacePanel) SigStash(fn func())
SigStash registers the [暂存] chip's callback (`git stash`).
func (*GitWorkspacePanel) SigStashPop ¶
func (this *GitWorkspacePanel) SigStashPop(fn func())
SigStashPop registers the [弹出] chip's callback (`git stash pop`).
func (*GitWorkspacePanel) SizeHints ¶
func (this *GitWorkspacePanel) SizeHints() gui.SizeHints
type GitWorkspaceRow ¶
type GitWorkspaceRow struct {
Kind GitWorkspaceRowKind
State GitIndexState // the group this row belongs to
File GitFileState // file rows only; zero on a group row
Count int // group rows only: files in the group
Collapsed bool // group rows only: whether the group is folded
}
GitWorkspaceRow is one flattened line of the grouped file list. Splitting the row sequence out of the widget keeps the layout decision (which lines show, in what order) pure and testable — the same split packages-panel.go makes with packageRow.
type GitWorkspaceRowKind ¶
type GitWorkspaceRowKind int
GitWorkspaceRowKind distinguishes the two kinds of line the grouped file list renders.
const ( GitWorkspaceGroupRow GitWorkspaceRowKind = iota // collapsible group header GitWorkspaceFileRow // a file inside an expanded group )
type GlobalSearchPanel ¶
GlobalSearchPanel provides a search-across-files panel like VS Code's sidebar.
func NewGlobalSearchPanel ¶
func NewGlobalSearchPanel() *GlobalSearchPanel
func (*GlobalSearchPanel) ApplyReplacements ¶
func (this *GlobalSearchPanel) ApplyReplacements(reps []FileReplacement) error
ApplyReplacements commits a previewed set of rewrites as one transaction: either every file lands or none does. If a write fails, the files already written are restored from their Before text and the error is returned, so a failed Replace All never leaves the tree half-rewritten. Only on success does the SigFileReplaced callback fire — once per rewritten file — so a host that reloads open buffers from it never sees a state that was rolled back.
func (*GlobalSearchPanel) ComputeReplacements ¶
func (this *GlobalSearchPanel) ComputeReplacements() []FileReplacement
ComputeReplacements previews Replace All: for every file the last search matched it reads the file, applies the replacement with the same pattern and options the search used, and returns the before/after pair. It writes NOTHING — the caller shows the diff and then hands the slice to ApplyReplacements — so the destructive step is separated from the step that decides what to do. Files that come out byte-identical (no occurrence, or a replacement equal to the match) are left out entirely, so no file is touched for nothing.
The replacement runs line by line — the same unit the search matches in — so a regex can never replace across a line boundary and anchors keep the meaning they had while searching.
func (*GlobalSearchPanel) Draw ¶
func (this *GlobalSearchPanel) Draw(g paint.Painter)
Draw renders the search panel.
func (*GlobalSearchPanel) Init ¶
func (this *GlobalSearchPanel) Init(self gui.IWidget)
func (*GlobalSearchPanel) OnKeyDown ¶
func (this *GlobalSearchPanel) OnKeyDown(key int, repeat bool)
OnKeyDown handles keyboard input.
func (*GlobalSearchPanel) OnLeftDown ¶
func (this *GlobalSearchPanel) OnLeftDown(x, y float64)
OnLeftDown handles clicks.
func (*GlobalSearchPanel) OnMouseLeave ¶
func (this *GlobalSearchPanel) OnMouseLeave()
OnMouseLeave resets hover.
func (*GlobalSearchPanel) OnMouseMove ¶
func (this *GlobalSearchPanel) OnMouseMove(x, y float64)
OnMouseMove updates hover.
func (*GlobalSearchPanel) OnMouseWheel ¶
func (this *GlobalSearchPanel) OnMouseWheel(x, y, z float64)
OnMouseWheel handles scrolling.
func (*GlobalSearchPanel) OnTextInput ¶
func (this *GlobalSearchPanel) OnTextInput(s string)
OnTextInput handles typing into the focused (search or replace) input.
func (*GlobalSearchPanel) ReplaceAll ¶
func (this *GlobalSearchPanel) ReplaceAll()
ReplaceAll previews the rewrite and commits it in one transaction: nothing is written unless every file can be written (see ComputeReplacements / ApplyReplacements). A failed transaction is logged and leaves the tree exactly as it was. Afterwards the search is re-run synchronously so the results list reflects the state on disk either way.
func (*GlobalSearchPanel) Search ¶
func (this *GlobalSearchPanel) Search(query string)
Search runs a find-in-files search under rootDir for query. The filesystem walk is handed to the shared filesearch engine on a background goroutine and the results are marshalled back onto the main thread with gui.Post before any panel state is mutated, so a search triggered from the input never blocks the UI on disk I/O.
func (*GlobalSearchPanel) SetCaseSensitive ¶
func (this *GlobalSearchPanel) SetCaseSensitive(on bool)
SetCaseSensitive matches the query case-sensitively (the default is to fold case, as the panel always did).
func (*GlobalSearchPanel) SetExclude ¶
func (this *GlobalSearchPanel) SetExclude(patterns []string)
SetExclude drops results whose path matches one of these globs. Each pattern is tested against the file's base name and against every path segment, so both "*_test.go" and "testdata" work. The engine has no exclude filter, so this is applied to its output (see excludedPath).
func (*GlobalSearchPanel) SetInclude ¶
func (this *GlobalSearchPanel) SetInclude(exts []string)
SetInclude restricts the search to files with these extensions (a leading dot is optional, matching is case-insensitive — filesearch's own Include rules). An empty list searches every text file.
func (*GlobalSearchPanel) SetRegex ¶
func (this *GlobalSearchPanel) SetRegex(on bool)
SetRegex interprets the query as an RE2 regular expression.
func (*GlobalSearchPanel) SetRootDir ¶
func (this *GlobalSearchPanel) SetRootDir(dir string)
SetRootDir sets the root directory for searching.
func (*GlobalSearchPanel) SetWholeWord ¶
func (this *GlobalSearchPanel) SetWholeWord(on bool)
SetWholeWord requires the match to sit on word boundaries. The engine has no flag for it, so it is compiled into the pattern as \b...\b — which forces regex mode on for that search even for a literal query.
func (*GlobalSearchPanel) SigFileReplaced ¶
func (this *GlobalSearchPanel) SigFileReplaced(fn func(path, content string))
SigFileReplaced registers the callback fired once per file that a committed Replace All rewrote, with the file's new contents. The host uses it to reload the open buffer for that path so an editor never keeps stale text for a file that changed underneath it. It never fires for a transaction that rolled back.
func (*GlobalSearchPanel) SigOpen ¶
func (this *GlobalSearchPanel) SigOpen(fn func(path string, line int))
SigOpen registers a callback invoked when a search result is clicked.
type GoToolGroup ¶
GoToolGroup is every finding one tool produced, in the order the parser emitted them.
type GoToolRow ¶
type GoToolRow struct {
Id string // core.ToolGoVet, core.ToolGovulncheck, ...
Binary string // "go", "govulncheck", "staticcheck"
Available bool
}
GoToolRow is one entry in the workflow picker: a core workflow id, the executable it shells out to, and whether that executable was found on PATH. Unavailable rows still render (so the user can see what a full install would offer) but are inert.
type GoToolsPanel ¶
GoToolsPanel is the analyzer pane: a picker listing every workflow core/gotools.go can build (`go vet`, `go test -race`, a profiling test run, `go tool pprof -top`, `go tool trace`, `govulncheck`, `staticcheck`) over a findings table grouped by the tool that produced each row.
Like the sibling panes it is a pure view. It never builds a command and never starts a process: clicking an available picker row fires SigRun with the workflow id, and the host builds the ToolCommand (core.GoVetCommand and friends), runs it off the UI thread, parses the output (core.ParseToolOutput) and pushes the result back through SetFindings. Clicking a finding that has a source location fires SigActivate so the host can open file:line in the editor.
Availability comes from the host too — SetTools(core.DetectGoTools()) — so the panel greys out what is not installed instead of letting the user start a run that would fail with "executable file not found".
func NewGoToolsPanel ¶
func NewGoToolsPanel() *GoToolsPanel
NewGoToolsPanel creates the panel with the picker populated from the current PATH and no findings yet.
func (*GoToolsPanel) Clear ¶
func (this *GoToolsPanel) Clear()
Clear removes all findings, keeping the picker.
func (*GoToolsPanel) Draw ¶
func (this *GoToolsPanel) Draw(g paint.Painter)
Draw renders the tally header, then the picker rows (dimmed when their binary is missing), then one collapsible group header per tool followed by its findings: a severity-coloured locator and the message.
func (*GoToolsPanel) Findings ¶
func (this *GoToolsPanel) Findings() []core.Finding
Findings returns a copy of the findings in input order.
func (*GoToolsPanel) Groups ¶
func (this *GoToolsPanel) Groups() []GoToolGroup
Groups returns the tool-grouped view of the findings, rebuilt from a copy so callers cannot mutate the panel's own grouping.
func (*GoToolsPanel) Init ¶
func (this *GoToolsPanel) Init(self gui.IWidget)
func (*GoToolsPanel) IsCollapsed ¶
func (this *GoToolsPanel) IsCollapsed(tool string) bool
IsCollapsed reports whether a tool's group is folded.
func (*GoToolsPanel) OnLeftDown ¶
func (this *GoToolsPanel) OnLeftDown(x, y float64)
OnLeftDown routes a click by row kind: an available picker row starts its workflow, an unavailable one is inert; a group header folds; a finding with a source location jumps, one without (a function-level pprof row) is inert.
func (*GoToolsPanel) OnMouseLeave ¶
func (this *GoToolsPanel) OnMouseLeave()
OnMouseLeave clears the hover highlight.
func (*GoToolsPanel) OnMouseMove ¶
func (this *GoToolsPanel) OnMouseMove(x, y float64)
OnMouseMove tracks hover state for the row highlight.
func (*GoToolsPanel) OnMouseWheel ¶
func (this *GoToolsPanel) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls the row list vertically, clamped to the content.
func (*GoToolsPanel) SetFindings ¶
func (this *GoToolsPanel) SetFindings(findings []core.Finding)
SetFindings replaces the findings with a defensive copy and regroups them by tool. Collapse state survives — re-running one tool should not re-expand the groups the user folded away.
func (*GoToolsPanel) SetTools ¶
func (this *GoToolsPanel) SetTools(tools []core.Tool)
SetTools replaces the picker's availability snapshot, normally with core.DetectGoTools(). Tools absent from the snapshot become unavailable.
func (*GoToolsPanel) SigActivate ¶
func (this *GoToolsPanel) SigActivate(fn func(file string, line int))
SigActivate registers the callback fired when a finding row with a source location is clicked. The host opens file at the 1-based line.
func (*GoToolsPanel) SigRun ¶
func (this *GoToolsPanel) SigRun(fn func(tool string))
SigRun registers the callback fired when an available picker row is clicked. It receives the core workflow id (core.ToolGoVet, ...); the host turns that into a ToolCommand and runs it.
func (*GoToolsPanel) SizeHints ¶
func (this *GoToolsPanel) SizeHints() gui.SizeHints
func (*GoToolsPanel) ToolRows ¶
func (this *GoToolsPanel) ToolRows() []GoToolRow
ToolRows returns a copy of the picker rows in display order.
type GridModel ¶
type GridModel struct {
Pitch float64 // spacing between grid lines, mm
Visible bool // paint the grid on the canvas
Snap bool // round drags/drops/pastes onto the grid
}
The designer grid used to be three unrelated literals: a 5mm/50mm pair hard-coded inside GedScene.DrawSelf, a 5mm step on GedView that only the snap paths read, and a 10mm constant that only the Shift+arrow nudge read. GridModel is the one value all of them now read; it lives on GedScene so it travels with the design document instead of resetting on every reopen.
type Hint ¶
type Hint struct {
Line int // 0-based line the hint sits on
Col int // 0-based character offset the hint is anchored before
Label string // the text to paint
Kind string // HintKindType | HintKindParameter | "" when unspecified
PaddingLeft bool // render a leading space
PaddingRight bool // render a trailing space
}
Hint is one inlay hint: a short label the editor paints INSIDE the line without it being part of the buffer — an inferred type after `x :=`, or a parameter name before an argument. Line/Col are 0-based, like Token.
PaddingLeft/PaddingRight are the server's request for a space on either side of the label so it does not collide with the surrounding code; Text applies them.
type InlayHints ¶
type InlayHints struct {
// contains filtered or unexported fields
}
InlayHints stores one document's hints together with the document revision they were computed against.
Hints are position-sensitive in a way tokens are not: a hint at line 12 col 30 is meaningless the moment the user types on line 12, and gopls answers asynchronously, so a reply can land after the buffer has already moved on. The revision is the guard — the host bumps SetRevision on every edit, and a stored set whose revision no longer matches is stale and yields no hints (HintsFor / HintsOnLine return nothing) instead of painting labels at wrong columns. A late reply for an older revision is refused by Set for the same reason.
func NewInlayHints ¶
func NewInlayHints() *InlayHints
NewInlayHints creates an empty hint set at revision 0.
func (*InlayHints) Clear ¶
func (this *InlayHints) Clear()
Clear drops the stored hints, keeping the revision.
func (*InlayHints) Hints ¶
func (this *InlayHints) Hints() []Hint
Hints returns a defensive copy of the stored hints regardless of revision. Use HintsFor when painting.
func (*InlayHints) HintsFor ¶
func (this *InlayHints) HintsFor(revision int) []Hint
HintsFor returns the hints only when they match the given document revision, and nil when they are stale — the revision-gated read.
func (*InlayHints) HintsOnLine ¶
func (this *InlayHints) HintsOnLine(revision, line int) []Hint
HintsOnLine returns the stored hints on one 0-based line in column order, gated on the revision the same way HintsFor is.
func (*InlayHints) Revision ¶
func (this *InlayHints) Revision() int
Revision is the revision the stored hints belong to.
func (*InlayHints) Set ¶
func (this *InlayHints) Set(revision int, hints []Hint) bool
Set stores the hints computed for revision, replacing any previous set, and reports whether they were accepted. A reply for a revision older than the current one is dropped (returns false): it describes a buffer state that no longer exists.
func (*InlayHints) SetRevision ¶
func (this *InlayHints) SetRevision(revision int)
SetRevision advances the document revision, which drops the stored hints: after an edit their columns no longer describe the buffer. Moving to the same or an older revision is a no-op, so redundant notifications are harmless.
func (*InlayHints) Stale ¶
func (this *InlayHints) Stale(revision int) bool
Stale reports whether the stored hints do not describe the given document revision — the check the overlay makes before painting anything.
type KeyBinding ¶
type KeyBinding struct {
Command string `json:"command"`
Key string `json:"key"`
Context string `json:"context"`
}
KeyBinding describes a single command-to-shortcut mapping.
Command is a stable identifier (for example "file.new" or "editor.format"). Key is a human-readable chord string (for example "Ctrl+Shift+F"). Context restricts where the binding applies: "global" (anywhere in the IDE) or "editor" (only when the code editor has focus).
type KeyMap ¶
type KeyMap struct {
// contains filtered or unexported fields
}
KeyMap is the runtime registry of keyboard shortcuts. It is safe for use from multiple goroutines (the mutex guards reads as well as writes so callers can iterate Bindings() consistently during a live edit).
func LoadKeymap ¶
func LoadKeymap() *KeyMap
LoadKeymap returns the shared, process-wide keymap. If a persisted keymap file exists at KeymapFilePath() it is merged over the defaults, otherwise defaults are used verbatim. Subsequent calls return the same instance.
func (*KeyMap) Bindings ¶
func (k *KeyMap) Bindings() []KeyBinding
Bindings returns a snapshot of the binding list. The returned slice is safe for the caller to read; modifying it does not affect the KeyMap.
func (*KeyMap) Get ¶
Get returns the key chord string bound to command, or "" if no such command is known. Thread-safe.
type KeymapPanel ¶
KeymapPanel is a simple, scrollable tool-view for browsing and editing keyboard shortcuts. Rows show the command identifier, its current key chord, and the context (global / editor). Clicking a row prompts the user for a new chord via ShowInputDialog and persists the change to disk.
func NewKeymapPanel ¶
func NewKeymapPanel() *KeymapPanel
NewKeymapPanel creates a new keymap panel bound to the shared global keymap (LoadKeymap()).
func (*KeymapPanel) Draw ¶
func (this *KeymapPanel) Draw(g paint.Painter)
Draw renders the panel. Layout:
Header (title + reset hint) | rowHeight high For each binding: [command] ................... [Key chord] [Context]
func (*KeymapPanel) Init ¶
func (this *KeymapPanel) Init(self gui.IWidget)
Init is called by the factory and by NewKeymapPanel. Fields are initialized to sensible defaults and the shared keymap is loaded.
func (*KeymapPanel) Keymap ¶
func (this *KeymapPanel) Keymap() *KeyMap
Keymap returns the KeyMap instance this panel displays and edits.
func (*KeymapPanel) OnLeftDown ¶
func (this *KeymapPanel) OnLeftDown(x, y float64)
OnLeftDown opens an input dialog to edit the clicked binding's chord.
func (*KeymapPanel) OnMouseLeave ¶
func (this *KeymapPanel) OnMouseLeave()
OnMouseLeave clears the hover highlight.
func (*KeymapPanel) OnMouseMove ¶
func (this *KeymapPanel) OnMouseMove(x, y float64)
OnMouseMove updates the hover highlight.
func (*KeymapPanel) OnMouseWheel ¶
func (this *KeymapPanel) OnMouseWheel(x, y, delta float64)
OnMouseWheel vertically scrolls the binding list.
func (*KeymapPanel) SizeHints ¶
func (this *KeymapPanel) SizeHints() gui.SizeHints
SizeHints advertises a reasonable default panel size.
type LayoutKind ¶
type LayoutKind string
LayoutKind describes a real runtime geometry manager, not an alignment action.
const ( LayoutHorizontal LayoutKind = "gui.HBox" LayoutVertical LayoutKind = "gui.VBox" LayoutGrid LayoutKind = "gui.GridLayout" LayoutForm LayoutKind = "gui.FormLayout" )
type Lens ¶
type Lens struct {
Line int // 0-based line the lens annotates
Title string // the text to paint
Command string // command id to run on activation
Args []string // command arguments, host-stringified
}
Lens is one code lens: a clickable annotation the editor paints on its own row above Line ("3 references", "run test"). Command is the id the host executes on click and Args its arguments, already flattened to strings by the host — the presentation layer never interprets them, it just hands the whole Lens back through the execute callback.
type LineInsights ¶
LineInsights is everything the overlay needs to decorate ONE line: the semantic tokens covering it, the inlay hints anchored inside it, and the lenses annotating it (drawn on their own row above the line). Empty slices are nil, so a plain line costs no allocation.
func (LineInsights) Empty ¶
func (li LineInsights) Empty() bool
Empty reports whether the line carries no decoration at all — the drawer's early-out before it computes any geometry.
type LogEntry ¶
LogEntry is one row in the runtime log. Time is stamped at Append time, not at Draw, so the pane shows when the event happened, not when the user last opened the dock.
type LogLevel ¶
type LogLevel int
LogLevel buckets a LogEntry by severity. The order matters — SetFilter shows entries whose level is at or above the configured floor, so the numeric ranking has to be debug < info < warn < error.
type LogPanel ¶
LogPanel is the IDE's runtime log pane: a scrollable, filterable list of LogEntry rows. It is deliberately distinct from BuildOutput (raw compiler output) and the terminal panel (interactive subprocess I/O): this pane is for IDE-internal events — warnings, diagnostics, the "something's not working" trail.
A future commit will plumb core.Log / core.Warn / core.Error here by installing a log writer that fans out to both the existing log destinations and a registered LogPanel; see Append for the sink shape that wiring is going to call.
func NewLogPanel ¶
func NewLogPanel() *LogPanel
NewLogPanel creates an empty log pane with the default 1000-entry cap.
func (*LogPanel) Append ¶
Append records a new log entry stamped with the current time, drops the oldest entry FIFO when the cap is hit, and follows the tail when the user was already scrolled to the bottom.
This is the sink shape the future core-bridge commit will call once per emitted log line; the pane intentionally keeps its own copy of the entries rather than borrowing core's global state so a stale LogPanel can be torn down without disturbing the log subsystem.
func (*LogPanel) Clear ¶
func (this *LogPanel) Clear()
Clear empties the entries slice and resets the view. The filter level is preserved — clearing the log is not the same as resetting the UI.
func (*LogPanel) Entries ¶
Entries returns a defensive copy of the entries in arrival order. Returning the backing slice would let callers mutate (and inadvertently truncate) the log; a copy keeps the panel's invariants intact.
func (*LogPanel) MaxEntries ¶
MaxEntries returns the configured FIFO cap.
func (*LogPanel) OnLeftDown ¶
OnLeftDown activates the clicked row via SigEntryClicked. Indexing is against the *visible* slice — a row the filter is hiding cannot be clicked.
func (*LogPanel) OnMouseLeave ¶
func (this *LogPanel) OnMouseLeave()
OnMouseLeave clears the hover highlight.
func (*LogPanel) OnMouseMove ¶
OnMouseMove tracks hover state for the row highlight.
func (*LogPanel) OnMouseWheel ¶
OnMouseWheel scrolls the row list vertically. A user scroll always breaks auto-follow until they scroll back to the bottom themselves — shouldAutoScroll re-checks the position on the next Append.
func (*LogPanel) SetFilter ¶
SetFilter sets the minimum severity to render. Entries below the floor stay in the backing slice (so flipping the filter back makes them visible again) — only the rendered subset is filtered.
func (*LogPanel) SetMaxEntries ¶
SetMaxEntries adjusts the FIFO cap. A non-positive value disables the cap. When the new cap is smaller than the current entry count the oldest entries are trimmed immediately so the invariant "len(entries) <= maxEntries" holds at all times.
func (*LogPanel) SigEntryClicked ¶
SigEntryClicked registers the callback invoked when the user clicks a row. The callback receives a copy of the entry so the host can hold onto it past a later Clear without aliasing the panel's slice.
type MergeChoice ¶
type MergeChoice int
MergeChoice is how one conflict chunk got answered. Non-conflict chunks never carry a choice — they already know their final text.
const ( MergeChoiceNone MergeChoice = iota // unresolved: the merge still owes an answer here MergeChoiceOurs // take our side MergeChoiceTheirs // take their side MergeChoiceBoth // keep both, ours first MergeChoiceManual // caller-supplied lines (see SetManual) )
func (MergeChoice) String ¶
func (c MergeChoice) String() string
String gives the stable name used in the chunk header caption and in tests.
type MergeEditor ¶
MergeEditor is the IDE's conflict editor — Qt Creator's "merge tool" / VS Code's inline conflict view, driven entirely by core's three-way merge engine. It shows one row per chunk header plus the chunk's lines, and gives every conflict four answers: take ours, take theirs, keep both, or hand-written lines (SetManual, for a host that pops a text editor). A status band counts what is still unresolved and carries the Save chip.
Like the sibling panes it owns no IO: the host feeds it either three sides (SetMerge → core.Merge3) or an already-conflicted file (SetConflictText → core.ParseConflictMarkers), and gets the merged text back through SigSave. Saving is gated on CanSave — SigSave never fires while a conflict is unanswered, so a half-merged file cannot reach disk through this widget.
All the state lives in MergeModel (merge-editor-model.go); the widget only caches the model's flattened rows so Draw and the hit-test agree on the geometry.
func NewMergeEditor ¶
func NewMergeEditor() *MergeEditor
NewMergeEditor creates an empty conflict editor.
func (*MergeEditor) CanSave ¶
func (this *MergeEditor) CanSave() bool
CanSave reports whether every conflict has an answer — the gate SigSave obeys.
func (*MergeEditor) ConflictCount ¶
func (this *MergeEditor) ConflictCount() int
ConflictCount is how many chunks need an answer.
func (*MergeEditor) Draw ¶
func (this *MergeEditor) Draw(g paint.Painter)
Draw renders the status band (tally + Save chip) followed by the rows: each chunk header carries a kind stripe, its caption and — for conflicts — the three answer chips with the active one lit; content lines are indented under their header and tinted by side.
func (*MergeEditor) Init ¶
func (this *MergeEditor) Init(self gui.IWidget)
func (*MergeEditor) Model ¶
func (this *MergeEditor) Model() *MergeModel
Model exposes the data layer so a host can drive resolutions in bulk or inspect the merge without going through the widget.
func (*MergeEditor) OnLeftDown ¶
func (this *MergeEditor) OnLeftDown(x, y float64)
OnLeftDown resolves a conflict when an answer chip on its header row is clicked, or saves when the Save chip in the status band is. Clicks elsewhere only take focus.
func (*MergeEditor) OnMouseLeave ¶
func (this *MergeEditor) OnMouseLeave()
OnMouseLeave clears the hover highlight.
func (*MergeEditor) OnMouseMove ¶
func (this *MergeEditor) OnMouseMove(x, y float64)
OnMouseMove tracks the hover highlight.
func (*MergeEditor) OnMouseWheel ¶
func (this *MergeEditor) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls the row list, clamped to the content.
func (*MergeEditor) Resolve ¶
func (this *MergeEditor) Resolve(index int, choice MergeChoice) bool
Resolve answers conflict chunk index with ours / theirs / both (or clears it with MergeChoiceNone) and fires SigResolved on success. See MergeModel.Resolve for what gets rejected.
func (*MergeEditor) Result ¶
func (this *MergeEditor) Result() string
Result is the merged text as it stands (unresolved conflicts keep their markers).
func (*MergeEditor) Rows ¶
func (this *MergeEditor) Rows() []MergeRow
Rows returns a copy of the flattened display rows — the same list Draw and the hit-test use.
func (*MergeEditor) Save ¶
func (this *MergeEditor) Save() bool
Save hands Result() to the SigSave callback and reports whether it fired. It refuses — returning false without calling anything — while a conflict is unanswered, and likewise when no callback is registered.
func (*MergeEditor) SetChunks ¶
func (this *MergeEditor) SetChunks(chunks []core.MergeChunk)
SetChunks installs a chunk list (from core.Merge3 or core.ParseConflictMarkers), dropping every previous resolution.
func (*MergeEditor) SetConflictText ¶
func (this *MergeEditor) SetConflictText(text string) error
SetConflictText loads a file that already carries git conflict markers. Whatever parsed is installed even when the markers were malformed; the parse error is returned so the host can report it.
func (*MergeEditor) SetManual ¶
func (this *MergeEditor) SetManual(index int, lines []string) bool
SetManual answers conflict chunk index with hand-written lines and fires SigResolved on success.
func (*MergeEditor) SetMerge ¶
func (this *MergeEditor) SetMerge(base, ours, theirs []string)
SetMerge runs the three-way merge over base/ours/theirs and shows the result.
func (*MergeEditor) SigResolved ¶
func (this *MergeEditor) SigResolved(fn func(index int, choice MergeChoice))
SigResolved registers the callback fired whenever a conflict's answer changes — the host uses it to mark the document dirty.
func (*MergeEditor) SigSave ¶
func (this *MergeEditor) SigSave(fn func(text string))
SigSave registers the callback that receives the merged text. It fires only from Save(), and only once CanSave() is true.
func (*MergeEditor) SizeHints ¶
func (this *MergeEditor) SizeHints() gui.SizeHints
func (*MergeEditor) UnresolvedCount ¶
func (this *MergeEditor) UnresolvedCount() int
UnresolvedCount is how many conflicts are still unanswered.
type MergeModel ¶
type MergeModel struct {
// contains filtered or unexported fields
}
MergeModel is the conflict editor's data layer: the chunk list produced by core.Merge3 (or core.ParseConflictMarkers) plus one resolution per conflict chunk. It is pure Go — no widget, no GL, no git — so the whole resolve/count/Result loop is unit-testable on its own, exactly like the panel/host split the sibling panes use.
Resolutions live in slices parallel to the chunk list rather than inside core.MergeChunk: the chunks stay the immutable output of the merge engine, and re-running the merge simply replaces them (SetChunks resets every answer along with them).
func NewMergeModel ¶
func NewMergeModel(chunks []core.MergeChunk) *MergeModel
NewMergeModel builds a model over chunks (nil is fine — an empty model).
func (*MergeModel) CanSave ¶
func (m *MergeModel) CanSave() bool
CanSave reports whether the merged text is complete: every conflict has an answer. An empty model can save (there is nothing left to decide).
func (*MergeModel) Choice ¶
func (m *MergeModel) Choice(i int) MergeChoice
Choice returns the resolution of chunk i (MergeChoiceNone for a non-conflict chunk, an unresolved conflict, or an out-of-range index).
func (*MergeModel) Chunk ¶
func (m *MergeModel) Chunk(i int) (core.MergeChunk, bool)
Chunk returns chunk i and whether i was in range.
func (*MergeModel) ConflictCount ¶
func (m *MergeModel) ConflictCount() int
ConflictCount is how many chunks need an answer at all.
func (*MergeModel) Resolve ¶
func (m *MergeModel) Resolve(i int, choice MergeChoice) bool
Resolve answers conflict chunk i with ours / theirs / both, or clears the answer again with MergeChoiceNone. It reports whether anything changed: an out-of-range index, a non-conflict chunk, and MergeChoiceManual (which needs its lines — use SetManual) are all rejected.
func (*MergeModel) Result ¶
func (m *MergeModel) Result() string
Result is ResultLines joined with '\n' and no trailing newline.
func (*MergeModel) ResultLines ¶
func (m *MergeModel) ResultLines() []string
ResultLines is the merged text as lines. Unresolved conflicts are written back out with git conflict markers so the result is always the full current state of the file, never a silently dropped hunk — saving it is what CanSave forbids.
func (*MergeModel) Rows ¶
func (m *MergeModel) Rows() []MergeRow
Rows flattens the chunk list into display rows: one header per chunk, then its lines. An unresolved conflict lists both candidate sides (tagged MergeSideOurs / MergeSideTheirs) so the user can compare them; every other chunk lists the lines it contributes to the merged text.
func (*MergeModel) SetChunks ¶
func (m *MergeModel) SetChunks(chunks []core.MergeChunk)
SetChunks replaces the chunk list and clears every resolution. The chunk slice is copied so a later host mutation cannot desync it from the parallel choice slices; the per-chunk line slices are shared with the caller and must be treated as read-only (core.Merge3 already hands out freshly allocated ones).
func (*MergeModel) SetManual ¶
func (m *MergeModel) SetManual(i int, lines []string) bool
SetManual answers conflict chunk i with hand-written lines — the "edit it myself" resolution. A nil / empty slice is a legal answer: it means "take neither side". The lines are copied. Returns whether the index named a conflict chunk.
func (*MergeModel) UnresolvedCount ¶
func (m *MergeModel) UnresolvedCount() int
UnresolvedCount is how many conflicts are still unanswered — the number the editor's status band shows and the gate CanSave checks.
type MergeRow ¶
type MergeRow struct {
Chunk int
Kind core.MergeKind
Header bool
Choice MergeChoice // header rows only: the chunk's current answer
Side MergeSide
Text string
}
MergeRow is one display line of the conflict editor: either a chunk header (Header == true, Text is the caption) or one content line belonging to that chunk. Chunk indexes into the model's chunk list, so a click on a header row knows which conflict to resolve.
type MergeSide ¶
type MergeSide int
MergeSide tags which of the three sides a content row came from, so the renderer can tint it. Rows that are already part of the merged text (context, auto-merged edits and resolved conflicts) are MergeSideMerged; an unresolved conflict lists its two candidate sides instead.
type ModeConfig ¶
type ModeConfig struct {
// Design mode panels (docks)
WidgetListDock gui.IWidget // dock containing widget palette
DesignDock gui.IWidget // dock containing GedView canvas
PropertyDock gui.IWidget // dock containing property sheet + code panel
// Edit mode panels (docks) - reserved for future use
FileExplorerDock gui.IWidget // dock containing file browser
EditorDock gui.IWidget // dock containing multi-tab editor
BuildOutputDock gui.IWidget // dock containing build output
Shared []gui.IWidget
}
ModeConfig holds references to dock panels for each mode. Panels may be nil if they haven't been created yet.
var GlobalModeConfig ModeConfig
GlobalModeConfig is the application-wide mode configuration.
type ModeSelector ¶
ModeSelector is a narrow vertical sidebar on the far left of the frame. It displays mode buttons (icon + label) and lets the user switch between design mode and edit/code mode, similar to Qt Creator's mode selector.
func NewModeSelector ¶
func NewModeSelector() *ModeSelector
NewModeSelector creates a mode selector widget pre-populated with the standard designer modes.
func (*ModeSelector) CurrentMode ¶
func (this *ModeSelector) CurrentMode() DesignerMode
CurrentMode returns the active mode.
func (*ModeSelector) Draw ¶
func (this *ModeSelector) Draw(g paint.Painter)
Draw renders the mode selector as a dark vertical bar with icon+text buttons.
func (*ModeSelector) Init ¶
func (this *ModeSelector) Init(self gui.IWidget)
func (*ModeSelector) OnLeftDown ¶
func (this *ModeSelector) OnLeftDown(x, y float64)
OnLeftDown handles mouse clicks to switch modes.
func (*ModeSelector) OnMouseLeave ¶
func (this *ModeSelector) OnMouseLeave()
OnMouseLeave clears hover state.
func (*ModeSelector) OnMouseMove ¶
func (this *ModeSelector) OnMouseMove(x, y float64)
OnMouseMove tracks hover state for visual feedback.
func (*ModeSelector) SetMode ¶
func (this *ModeSelector) SetMode(mode DesignerMode)
SetMode switches to the given mode and fires the change callback.
func (*ModeSelector) SigModeChanged ¶
func (this *ModeSelector) SigModeChanged(fn func(DesignerMode))
SigModeChanged registers a callback invoked whenever the mode changes.
func (*ModeSelector) SizeHints ¶
func (this *ModeSelector) SizeHints() gui.SizeHints
SizeHints returns a fixed width of 60 pixels, stretching vertically.
type ObjectInspector ¶
ObjectInspector is a tool panel that shows the widget hierarchy as a tree, similar to Qt Creator's Object Inspector. Each row displays the widget name and class type. Clicking a row selects the corresponding scene item.
func NewObjectInspector ¶
func NewObjectInspector() *ObjectInspector
func (*ObjectInspector) Draw ¶
func (this *ObjectInspector) Draw(g paint.Painter)
Draw renders the object inspector tree.
func (*ObjectInspector) Init ¶
func (this *ObjectInspector) Init(self gui.IWidget)
func (*ObjectInspector) Layout ¶
func (this *ObjectInspector) Layout()
func (*ObjectInspector) OnKeyDown ¶
func (this *ObjectInspector) OnKeyDown(key int, repeat bool)
OnKeyDown gives the tree the three keys the canvas beside it already answers: the arrows walk the rows, Delete removes the selected widget and F2 renames it. Reaching a widget nested inside a container is often only practical here, and until now every keystroke after that press had to go back to the canvas.
Delete and F2 skip the form root and are a no-op without a view, the same guard reparentInto carries: a host that bound only a scene has no canvas selection to delete and no undo stack to record the edit on. Both keys stay consumed either way — handing a refused Delete to the canvas would delete whatever the canvas is holding instead. BackSpace is answered here for that reason too: the canvas deletes on either key, so forwarding one of them would leave the form-root guard bypassable by the other.
Every other key goes on to the canvas, the way generatedView passes what it does not answer to the editor underneath it. The window routes a key to the focused widget alone and nothing bubbles to a parent, so a key dropped here while the tree holds focus is a key the designer loses: before this panel took focus, Ctrl+Z, Esc, Ctrl+C/V/X/D and the Alt aligns all reached GedView.OnKeyDown, and "delete a row, then undo it" is the first thing the keys above invite.
func (*ObjectInspector) OnKeyUp ¶
func (this *ObjectInspector) OnKeyUp(key int)
OnKeyUp completes the forward. The window sends the release to the focused widget too, so a press that went to the canvas must have its release follow it: GedView arms Space+drag panning on the press and disarms it on the release, and a release swallowed here leaves the canvas panning on the next click instead of selecting.
func (*ObjectInspector) OnLeftDown ¶
func (this *ObjectInspector) OnLeftDown(x, y float64)
OnLeftDown handles click selection and begins drag tracking.
func (*ObjectInspector) OnLeftUp ¶
func (this *ObjectInspector) OnLeftUp(x, y float64)
OnLeftUp completes the drag: a drop onto a row re-parents, a drop between rows reorders siblings.
func (*ObjectInspector) OnMouseLeave ¶
func (this *ObjectInspector) OnMouseLeave()
OnMouseLeave resets hover and drag state.
func (*ObjectInspector) OnMouseMove ¶
func (this *ObjectInspector) OnMouseMove(x, y float64)
OnMouseMove handles hover highlighting and drag indicator.
func (*ObjectInspector) OnMouseWheel ¶
func (this *ObjectInspector) OnMouseWheel(x, y, z float64)
OnMouseWheel handles scrolling.
func (*ObjectInspector) Rebuild ¶
func (this *ObjectInspector) Rebuild()
Rebuild walks the scene tree and populates the flat items list. The highlight follows the selected ITEM across the rebuild — a re-parent or a filter moves rows around, and a row index kept as-is would end up highlighting whichever widget inherited the slot.
func (*ObjectInspector) RowNames ¶
func (this *ObjectInspector) RowNames() []string
RowNames returns the name of every visible row, top to bottom. It is the panel's content in the only form a caller without a painter can read.
func (*ObjectInspector) SelectItem ¶
func (this *ObjectInspector) SelectItem(item graph.IItem)
SelectItem highlights the row standing for item. An item with no row on screen — filtered out, or belonging to another document — clears the highlight rather than leaving it on an unrelated row.
func (*ObjectInspector) SelectedItem ¶
func (this *ObjectInspector) SelectedItem() graph.IItem
SelectedItem returns the scene item the highlighted row stands for, nil when no row is highlighted.
func (*ObjectInspector) SetFilter ¶
func (this *ObjectInspector) SetFilter(text string)
SetFilter narrows the tree to rows whose widget name or type contains text (case-insensitive), following the widget palette's convention: while a filter is active the matches are listed flat, without the hierarchy they normally hang in. Empty text restores the tree.
func (*ObjectInspector) SetScene ¶
func (this *ObjectInspector) SetScene(scene *GedScene)
SetScene binds the inspector to a GedScene and rebuilds the item list.
The canvas view comes with it: GraphView.SetScene records itself on the scene, and the tree needs it for the two operations that reach back out — a row press sets the canvas selection, and a drag re-parent reuses the command that selection generates. A scene nobody is showing yields a read-only tree.
func (*ObjectInspector) SigSelect ¶
func (this *ObjectInspector) SigSelect(fn func(graph.IItem))
SigSelect registers a callback that fires when the user selects an item.
func (*ObjectInspector) SyncSelection ¶
func (this *ObjectInspector) SyncSelection(items []graph.IItem)
SyncSelection points the highlight at the canvas selection. A multi-item selection has no single row to stand for it, so the highlight clears.
type OutlineSymbol ¶
type OutlineSymbol struct {
Name string
Detail string
Kind string
Line int
EndLine int
Children []OutlineSymbol
Exported bool
}
OutlineSymbol is one node of a semantic document outline, pushed in by the host through SetSymbols. It is deliberately provider-agnostic: the host drives core.LSPClient.DocumentSymbol and converts every LSPSymbol into an OutlineSymbol (kind number → kind name, range → Line/EndLine) before handing the slice over, so the panel never has to know about LSP wire types or numeric kind enums — the same split ReferencesPanel uses for ReferenceLoc. When no symbols are supplied the panel falls back to the heuristic CodeEditor.ParseSymbols scan.
Field semantics:
- Name display name of the declaration
- Detail declaration summary (signature); informational for now
- Kind kind name, matched case-insensitively (see outlineKindOf)
- Line 0-based first line of the declaration (range.start.line)
- EndLine 0-based last line, 0 when the provider gave no range
- Children nested members at arbitrary depth (methods of a type, fields of a struct)
- Exported whether the symbol belongs to the file's public API
Kind takes both LSP and Go spellings ("Function"/"func", "Struct"/"type", "Method", "Field"/"var", "EnumMember"/"const"); anything unknown renders as a function. EndLine, when present, lets the cursor-follow highlight pick the innermost symbol containing the caret. Exported is the host's call — the rule is language-specific (in Go: a capitalised name) — and it is what the exported-only toggle filters on.
type PackagesPanel ¶
PackagesPanel is a navigable view of the Go project's packages, as reported by `go list -json ./...`. Each package gets a collapsible header row showing its ImportPath and a "N go, M test" file-count badge; expanding the header reveals one row per GoFile/TestGoFile.
The host (silkide) feeds in either a directory (LoadFromDir, which shells out via core.LoadGoListJSON) or a pre-parsed slice (SetPackages, used by tests and by hosts that already cache the list). Clicks fire two channels: SigPackageActivated for header rows (host policy decides whether to "open" the package), SigFileActivated for file rows (typically the IDE jumps the editor to that file).
func NewPackagesPanel ¶
func NewPackagesPanel() *PackagesPanel
NewPackagesPanel creates an empty packages panel.
func (*PackagesPanel) Draw ¶
func (this *PackagesPanel) Draw(g paint.Painter)
Draw renders the header tally followed by one row per packageRow. Header rows show the expand glyph, the ImportPath, and a "N go, M test" file-count badge; file rows are indented and prefixed with a small file icon. Alternating row tint and hover highlight follow the sibling-panel idiom.
func (*PackagesPanel) Init ¶
func (this *PackagesPanel) Init(self gui.IWidget)
func (*PackagesPanel) IsExpanded ¶
func (this *PackagesPanel) IsExpanded(importPath string) bool
IsExpanded reports whether the package with the given ImportPath is currently expanded. Exposed for tests and for hosts that mirror the state into a persisted UI layout.
func (*PackagesPanel) LoadFromDir ¶
func (this *PackagesPanel) LoadFromDir(dir string) error
LoadFromDir runs `go list -json ./...` in dir via core.LoadGoListJSON and replaces the package list with the result. The error is returned verbatim so the host can decide whether to surface it; on partial failures core.LoadGoListJSON returns both packages and an error, in which case the slice we keep still reflects whatever was parsable.
func (*PackagesPanel) OnLeftDown ¶
func (this *PackagesPanel) OnLeftDown(x, y float64)
OnLeftDown toggles expansion on a header click and fires the matching activation callback. The callbacks are independent: SigPackageActivated always fires for a header click, SigFileActivated fires for file rows. Toggling expansion is the panel's job; the host doesn't see it.
func (*PackagesPanel) OnMouseLeave ¶
func (this *PackagesPanel) OnMouseLeave()
OnMouseLeave resets hover state.
func (*PackagesPanel) OnMouseMove ¶
func (this *PackagesPanel) OnMouseMove(x, y float64)
OnMouseMove tracks hover state for visual feedback.
func (*PackagesPanel) OnMouseWheel ¶
func (this *PackagesPanel) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls the row list vertically. Bound by the total row extent so the user can't scroll past the last entry.
func (*PackagesPanel) Packages ¶
func (this *PackagesPanel) Packages() []core.GoListPackage
Packages returns the current package list as fed in by LoadFromDir or SetPackages.
func (*PackagesPanel) SetPackages ¶
func (this *PackagesPanel) SetPackages(pkgs []core.GoListPackage)
SetPackages replaces the package list. Resets scroll and hover state so the new project starts at the top. Expansion state is wiped — the previous ImportPaths may not exist in the new list and keeping stale entries around just leaks memory.
func (*PackagesPanel) SigFileActivated ¶
func (this *PackagesPanel) SigFileActivated(fn func(pkg core.GoListPackage, file string))
SigFileActivated registers the callback fired when a file row inside an expanded package is clicked. Hosts typically open the file at the package's Dir + file basename in the editor.
func (*PackagesPanel) SigPackageActivated ¶
func (this *PackagesPanel) SigPackageActivated(fn func(pkg core.GoListPackage))
SigPackageActivated registers the callback fired when a package header row is clicked. Host policy decides what "activate" means — jump to the package directory, run go list refresh, etc.
func (*PackagesPanel) SizeHints ¶
func (this *PackagesPanel) SizeHints() gui.SizeHints
type Pane ¶
type Pane struct {
// ID is stable for the pane's lifetime and never reused. Pane
// indices shift when panes are closed; IDs do not, so every
// Workspace operation addresses panes by ID.
ID int
// Docs holds the open document identities (paths) in tab order.
Docs []string
// Active indexes Docs, or is -1 when the pane shows nothing.
Active int
// Orientation records how this pane was split off from the pane
// before it in Workspace order. It is meaningless for the first
// pane, which has no predecessor.
Orientation SplitOrientation
}
Pane is one editor group: the ordered list of documents it shows plus which of them is focused. It is a plain record — the host reads it to render a tab bar per pane — and all structural changes go through Workspace so index bookkeeping stays in one place.
type PkgNode ¶
type PkgNode struct {
Path string // import path, e.g. "github.com/uk0/silk/ged"
Status TestNodeStatus
Elapsed float64
Output string
Tests []TestNode
}
PkgNode is one package's worth of incoming results: the package's own state (a build failure gives a package a Fail with no tests) plus a flat list of the tests seen in this run.
type PreviewForm ¶
PreviewForm is the window root of a 预览. It owns the title, Esc and handing keyboard focus back, and nothing else: the generated form hangs underneath it exactly as GedScene.Generate produced it, so what the user sees is the tree the code generator would emit and not a re-interpretation of it.
func BuildPreview ¶
func BuildPreview(scene *GedScene) (*PreviewForm, []string)
BuildPreview builds the window root for a preview of scene. It returns (nil, blocked) when the design holds widgets the preview cannot build, so the caller can name them instead of opening a window that is quietly missing part of the design.
func (*PreviewForm) Close ¶
func (this *PreviewForm) Close()
Close hands keyboard focus back to the designer. Window.Close calls it on the way down, so the title-bar button restores focus exactly as Esc does; it is idempotent because Esc calls it first and the window then calls it again.
func (*PreviewForm) OnKeyDown ¶
func (this *PreviewForm) OnKeyDown(key int, repeat bool)
OnKeyDown closes the preview on Esc. Focus is handed back before the window goes, since the window is what routes the key that would otherwise land on a destroyed widget.
func (*PreviewForm) RestoreFocusTo ¶
func (this *PreviewForm) RestoreFocusTo(w gui.IWidget)
RestoreFocusTo names the widget that takes keyboard focus back when the preview closes. Keys are delivered to one global focus widget (window_glfw.go onKey), so a preview must take focus to receive Esc at all — otherwise Esc reaches the design canvas behind it and clears the designer's selection — and must give it back, because destroying a window does not clear that global.
type Problem ¶
type Problem struct {
File string
Line int
Col int
Severity Severity
Message string
// Item is the design widget the problem is about, nil for a compiler
// diagnostic. A load-skipped widget has none either: the loader never
// built it, so there is nothing in the scene to select.
Item graph.IItem
// Source is who filed the row, and so who is allowed to replace it. Set
// by MergeProblems rather than by the writer; see problem-sources.go.
Source ProblemSource
}
Problem is one structured diagnostic. Where BuildOutput keeps the raw text line around, a Problem is the parsed result only: a file, a 1-based line, an optional column (0 when the compiler did not give one), a severity and the human-readable message with the "file:line:col:" prefix stripped off.
The designer raises problems of its own — a widget the generator cannot build, a widget a load had to drop — which have no source file to point at. Those set Item instead, so activating the row selects the widget on the canvas; Line stays 0 and File carries the widget's label.
func DesignProblems ¶
DesignProblems reports what a preview, an export or a run would lose from this design. Each row carries the widget at fault so the 问题 pane can select it on the canvas — the widget is in the scene, it just cannot be built.
func DropDocProblems ¶
DropDocProblems removes every row about doc, whichever writer filed it: the document is closed, so neither the widgets its load dropped nor the ones it could not generate describe anything the user can still act on.
Build rows survive whatever doc is. They carry no document, and an unsaved design's empty filename would otherwise sweep them up with it.
func LoadProblems ¶
LoadProblems turns the factory names a load had to skip into rows. They carry no Item: those widgets were never built, so there is nothing on the canvas to select. The message names the consequence rather than the event, because saving the partially-loaded design is what makes the loss permanent.
func MergeProblems ¶
func MergeProblems(existing []Problem, src ProblemSource, rows []Problem) []Problem
MergeProblems replaces exactly the rows filed under src, leaving every other source's rows where they were. The rows come back stamped with src, which is what lets the next call find them: an unstamped row can never be replaced and the list would only ever grow.
The replacement lands where the source's first row was, so a rebuild does not shuffle the pane under the reader.
func ParseProblems ¶
ParseProblems turns raw compiler output into structured Problem rows by delegating to the shared buildissues engine and mapping each buildissues.Issue onto the panel's Problem type. Routing through the one tested parser means the Problems pane and the Build Output pane agree on every corner case — "file:line:col:" and "file:line:" shapes, "# pkg" context headers, warning classification, and Windows drive-letter paths (C:\...:line:col). It is kept as a free function so it needs no GL context or live widget, and exported so a caller that files the rows under a source can parse without going through the panel.
type ProblemKind ¶
type ProblemKind int
ProblemKind is what a row is a statement about, and so what may replace it.
const ( // ProblemUnfiled is the zero value: a row that reached the pane without a // source, which SetProblems still allows. It is deliberately not a real // kind. Were ProblemBuild the zero instead, an unfiled row would be // indistinguishable from the build's own and the next build would delete // it — the very failure this file exists to end. ProblemUnfiled ProblemKind = iota // ProblemBuild is a compiler diagnostic. The next build replaces the lot. ProblemBuild // ProblemLoad is a widget the loader could not build and dropped. It // outlives any number of builds: the design in memory is still short that // widget, and a 保存 still makes the loss permanent. ProblemLoad // ProblemDesign is a widget in the scene the generator cannot build, // recomputed each time 预览/导出/运行 asks. ProblemDesign )
type ProblemSource ¶
type ProblemSource struct {
Kind ProblemKind
Doc string
}
ProblemSource identifies the rows one writer owns. It is comparable, so a row is matched to its writer with ==. Doc is the design file the rows are about and is empty for a build, whose diagnostics name .go files rather than a design.
func DesignSource ¶
func DesignSource(filename string) ProblemSource
DesignSource is where the widgets a generate would drop are filed. A separate kind from LoadSource on the same document because the two describe different widgets — one never entered the scene, the other is in it — so reporting either must not take the other away.
func LoadSource ¶
func LoadSource(filename string) ProblemSource
LoadSource is where the widgets a load had to drop are filed. Keyed by filename rather than by scene, so opening the same design again replaces the rows the previous open left instead of stacking a second copy beside them.
type ProblemsPanel ¶
ProblemsPanel is a sortable, structured list of compiler diagnostics, modelled on Qt Creator's "Issues" pane. It differs from BuildOutput: BuildOutput is a free-text log that highlights error lines in place, whereas this pane shows one parsed row per problem with a severity glyph, a file:line locator and the message, plus a header tally and file-grouped sorting. Clicking a row jumps to (file, line, col).
func NewProblemsPanel ¶
func NewProblemsPanel() *ProblemsPanel
NewProblemsPanel creates an empty problems panel.
func (*ProblemsPanel) Draw ¶
func (this *ProblemsPanel) Draw(g paint.Painter)
Draw renders the header tally followed by one row per problem.
func (*ProblemsPanel) ErrorCount ¶
func (this *ProblemsPanel) ErrorCount() int
ErrorCount returns how many problems are errors.
func (*ProblemsPanel) Init ¶
func (this *ProblemsPanel) Init(self gui.IWidget)
func (*ProblemsPanel) OnLeftDown ¶
func (this *ProblemsPanel) OnLeftDown(x, y float64)
OnLeftDown fires the activated callback for the clicked problem row.
func (*ProblemsPanel) OnMouseLeave ¶
func (this *ProblemsPanel) OnMouseLeave()
OnMouseLeave clears the hover highlight.
func (*ProblemsPanel) OnMouseMove ¶
func (this *ProblemsPanel) OnMouseMove(x, y float64)
OnMouseMove tracks hover state for the row highlight.
func (*ProblemsPanel) OnMouseWheel ¶
func (this *ProblemsPanel) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls the row list vertically.
func (*ProblemsPanel) Problems ¶
func (this *ProblemsPanel) Problems() []Problem
Problems returns the current problem rows in display order.
func (*ProblemsPanel) SetOutput ¶
func (this *ProblemsPanel) SetOutput(output string)
SetOutput parses raw compiler output and replaces the problem list.
func (*ProblemsPanel) SetProblems ¶
func (this *ProblemsPanel) SetProblems(problems []Problem)
SetProblems replaces the problem list directly and resets the view.
func (*ProblemsPanel) SigItemActivated ¶
func (this *ProblemsPanel) SigItemActivated(fn func(item graph.IItem))
SigItemActivated registers the callback fired when the user clicks a row that names a design widget. Such a row has no source file, so it never reaches the file callback above — routing it there would ask the editor to open "".
func (*ProblemsPanel) SigProblemActivated ¶
func (this *ProblemsPanel) SigProblemActivated(fn func(file string, line, col int))
SigProblemActivated registers the callback fired when the user clicks a problem row. It receives the target file, 1-based line, and column.
func (*ProblemsPanel) SizeHints ¶
func (this *ProblemsPanel) SizeHints() gui.SizeHints
func (*ProblemsPanel) SortByFile ¶
func (this *ProblemsPanel) SortByFile()
SortByFile stably reorders the problems by file name, then by line within a file. Stability keeps same-(file,line) diagnostics in their original arrival order, which matches how the compiler emitted them.
func (*ProblemsPanel) WarningCount ¶
func (this *ProblemsPanel) WarningCount() int
WarningCount returns how many problems are warnings.
type Project ¶
type Project struct {
Root string // absolute path of the directory holding go.mod
Module string // module path go.mod declares; "" when it could not be parsed
Designs []string // absolute .silkui paths under Root, sorted
}
Project is one silk project: the directory holding go.mod, plus every .silkui design beneath it.
There is deliberately no project file. go.mod already answers "where does this project begin" for every Go toolchain the designer shells out to, and a .silkproj carrying the same answer would be a second source of truth that can disagree with the first.
func ScanProject ¶
ScanProject resolves the project containing startDir and lists its designs.
func (*Project) GenerateAll ¶
func (p *Project) GenerateAll() []GenerateResult
GenerateAll regenerates every design in the project, one result per design. A design that fails to load or write does not stop the others: the caller reports the whole batch at once instead of interrupting the user per file.
type ProjectSettingsPanel ¶
ProjectSettingsPanel displays and edits a project's build configuration: the parsed go.mod facts (module, effective Go version, toolchain, require count) plus the active kit — toolchain target, build tags/mode, race and coverage switches, output directory and deploy profile.
The panel reads and writes the project it was pointed at with SetProjectRoot; without that call it falls back to the process working directory for display only and does not persist anything (see SaveKits).
func NewProjectSettingsPanel ¶
func NewProjectSettingsPanel() *ProjectSettingsPanel
func (*ProjectSettingsPanel) BuildTags ¶
func (this *ProjectSettingsPanel) BuildTags() string
BuildTags returns the current build tags setting as a `go build -tags` list.
func (*ProjectSettingsPanel) Draw ¶
func (this *ProjectSettingsPanel) Draw(g paint.Painter)
func (*ProjectSettingsPanel) Init ¶
func (this *ProjectSettingsPanel) Init(self gui.IWidget)
func (*ProjectSettingsPanel) Kit ¶
func (this *ProjectSettingsPanel) Kit() core.Kit
Kit returns the active kit (a copy).
func (*ProjectSettingsPanel) LoadKits ¶
func (this *ProjectSettingsPanel) LoadKits() error
LoadKits re-reads the project's kits file, discarding unsaved edits.
func (*ProjectSettingsPanel) OnLeftDown ¶
func (this *ProjectSettingsPanel) OnLeftDown(x, y float64)
func (*ProjectSettingsPanel) OnMouseLeave ¶
func (this *ProjectSettingsPanel) OnMouseLeave()
func (*ProjectSettingsPanel) OnMouseMove ¶
func (this *ProjectSettingsPanel) OnMouseMove(x, y float64)
func (*ProjectSettingsPanel) OnMouseWheel ¶
func (this *ProjectSettingsPanel) OnMouseWheel(x, y, delta float64)
func (*ProjectSettingsPanel) OutputDir ¶
func (this *ProjectSettingsPanel) OutputDir() string
OutputDir returns the current output directory setting.
func (*ProjectSettingsPanel) ProjectRoot ¶
func (this *ProjectSettingsPanel) ProjectRoot() string
ProjectRoot returns the directory the panel reads the project from.
func (*ProjectSettingsPanel) Refresh ¶
func (this *ProjectSettingsPanel) Refresh()
Refresh re-reads project info and rebuilds the display.
func (*ProjectSettingsPanel) RefreshGoMod ¶
func (this *ProjectSettingsPanel) RefreshGoMod(projectDir string)
RefreshGoMod re-parses the project's go.mod via core.LoadGoMod and updates the panel's cached module path, Go version, toolchain, requires count, and summary. The Go version shown is the *effective* one: a toolchain directive wins over the go directive, because that is the version the build uses. When no go.mod can be found, fields fall back to the no-go.mod sentinel.
func (*ProjectSettingsPanel) ResolvedKit ¶
func (this *ProjectSettingsPanel) ResolvedKit() core.Kit
ResolvedKit returns the active kit with the active variant applied — the configuration a build should actually run with.
func (*ProjectSettingsPanel) SaveError ¶
func (this *ProjectSettingsPanel) SaveError() error
SaveError returns the error from the last load or save attempt, nil when the last one succeeded.
func (*ProjectSettingsPanel) SaveKits ¶
func (this *ProjectSettingsPanel) SaveKits() error
SaveKits writes the current kit and variant selection into the project's kits file.
It is a no-op unless SetProjectRoot pinned an explicit project root: without one the panel does not know which project the edit belongs to and must not drop a kits file into the process working directory. An invalid kit (see core.Kit.Validate) is also refused — the edit stays in memory and the error is reported through SaveError so a half-configured ssh deploy never reaches disk.
func (*ProjectSettingsPanel) SetKit ¶
func (this *ProjectSettingsPanel) SetKit(k core.Kit)
SetKit replaces the active kit, persists it and fires SigApply.
func (*ProjectSettingsPanel) SetProjectRoot ¶
func (this *ProjectSettingsPanel) SetProjectRoot(dir string)
SetProjectRoot points the panel at dir and reloads everything from there: the go.mod facts and the project's kits file. This is what makes the panel show the *selected* project rather than whatever directory the IDE process happens to have been started in.
func (*ProjectSettingsPanel) SetVariantName ¶
func (this *ProjectSettingsPanel) SetVariantName(name string) error
SetVariantName switches the active build variant. Unknown names are rejected and leave the selection untouched.
func (*ProjectSettingsPanel) SigApply ¶
func (this *ProjectSettingsPanel) SigApply(fn func())
SigApply registers the callback fired after an edit has been applied to the kit. The host uses it to re-run the build with the new configuration. It fires even when persistence failed — the in-memory kit did change.
func (*ProjectSettingsPanel) SizeHints ¶
func (this *ProjectSettingsPanel) SizeHints() gui.SizeHints
func (*ProjectSettingsPanel) VariantName ¶
func (this *ProjectSettingsPanel) VariantName() string
VariantName returns the active build variant (Debug / Release).
type ProjectTemplate ¶
type ProjectTemplate struct {
Name string
Description string
Icon string
Width float64 // form width in mm
Height float64 // form height in mm
Widgets []TemplateWidget
}
ProjectTemplate defines a complete project template with form dimensions and a set of pre-configured widgets.
func AllTemplates ¶
func AllTemplates() []*ProjectTemplate
AllTemplates returns both built-in and custom templates.
func BuiltinTemplates ¶
func BuiltinTemplates() []*ProjectTemplate
BuiltinTemplates returns all available project templates.
func LoadCustomTemplates ¶
func LoadCustomTemplates() []*ProjectTemplate
LoadCustomTemplates scans the templates/ directory for .silkui files and returns custom templates alongside built-in ones.
func ShowNewProjectDialog ¶
func ShowNewProjectDialog(parent gui.IWidget) *ProjectTemplate
ShowNewProjectDialog displays a dialog for selecting a project template. Returns the selected template, or nil if the user cancelled.
type QuickHelpPanel ¶
QuickHelpPanel is a Qt Creator-style "Quick Help" pane that renders Go documentation for a single symbol. The mechanism is a synchronous subprocess to `go doc <symbol>` whose combined stdout+stderr becomes the panel's text body.
Synchronous because `go doc` is fast in practice (~50ms on a warm module cache); an async / cancellation path is a follow-up if it ever shows up as a perceptible stall. The host wires the lookup to "show doc for the word under cursor" — the widget itself does not know about editors.
func NewQuickHelpPanel ¶
func NewQuickHelpPanel() *QuickHelpPanel
NewQuickHelpPanel creates an empty quick-help panel.
func (*QuickHelpPanel) Doc ¶
func (this *QuickHelpPanel) Doc() string
Doc returns the current doc body, exactly as it was set (no header prefix, no trimming).
func (*QuickHelpPanel) Draw ¶
func (this *QuickHelpPanel) Draw(g paint.Painter)
Draw renders a header band showing the symbol (or "(no symbol)") and then one row per line of the doc body. Monospace, dark background to match the sibling output panes.
func (*QuickHelpPanel) Init ¶
func (this *QuickHelpPanel) Init(self gui.IWidget)
func (*QuickHelpPanel) Lookup ¶
func (this *QuickHelpPanel) Lookup(symbol string)
Lookup spawns `go doc <symbol>` and populates the panel with its output. An empty symbol is a no-op so callers can bind the panel directly to a "word under cursor" hook without guarding the call. On non-zero exit the captured error output is shown — `go doc` writes a useful "no such symbol" message in that case.
func (*QuickHelpPanel) OnLeftDown ¶
func (this *QuickHelpPanel) OnLeftDown(x, y float64)
OnLeftDown only grabs focus; there is nothing clickable in the body (yet — a future pass may make symbol references jump-to-able).
func (*QuickHelpPanel) OnMouseWheel ¶
func (this *QuickHelpPanel) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls the doc body vertically. Mirrors the wheel handling in BuildOutput / ProblemsPanel so the feel is consistent across the dockable panes.
func (*QuickHelpPanel) SetDoc ¶
func (this *QuickHelpPanel) SetDoc(text string)
SetDoc sets the panel's text body directly, without running a subprocess. Useful for tests, for hosts that already have the doc in hand (e.g. cached), and for clearing the panel via SetDoc(""). Symbol() returns "" after this call — there is no associated symbol.
func (*QuickHelpPanel) SizeHints ¶
func (this *QuickHelpPanel) SizeHints() gui.SizeHints
func (*QuickHelpPanel) Symbol ¶
func (this *QuickHelpPanel) Symbol() string
Symbol returns the last symbol passed to Lookup, or "" when the panel is empty or was populated via SetDoc directly.
type QuickOpenPopup ¶
type QuickOpenPopup struct {
// contains filtered or unexported fields
}
QuickOpenPopup provides a Ctrl+P file finder popup like VS Code.
func GetQuickOpen ¶
func GetQuickOpen() *QuickOpenPopup
GetQuickOpen returns the global QuickOpenPopup, creating it if needed.
func NewQuickOpenPopup ¶
func NewQuickOpenPopup() *QuickOpenPopup
NewQuickOpenPopup creates a new quick file finder popup.
func (*QuickOpenPopup) Accept ¶
func (this *QuickOpenPopup) Accept()
Accept opens the selected file and closes the popup.
func (*QuickOpenPopup) DrawPopup ¶
func (this *QuickOpenPopup) DrawPopup(g paint.Painter, hostW, hostH float64)
DrawPopup renders the quick-open popup as an overlay on the given widget.
func (*QuickOpenPopup) OnBackspace ¶
func (this *QuickOpenPopup) OnBackspace()
OnBackspace handles backspace in the filter field.
func (*QuickOpenPopup) OnTextInput ¶
func (this *QuickOpenPopup) OnTextInput(s string)
OnTextInput handles typing in the filter field.
func (*QuickOpenPopup) SelectNext ¶
func (this *QuickOpenPopup) SelectNext()
SelectNext moves selection down.
func (*QuickOpenPopup) SelectPrev ¶
func (this *QuickOpenPopup) SelectPrev()
SelectPrev moves selection up.
func (*QuickOpenPopup) SetOpenCallback ¶
func (this *QuickOpenPopup) SetOpenCallback(fn func(path string))
SetOpenCallback sets the callback for when a file is selected.
func (*QuickOpenPopup) SetRootDir ¶
func (this *QuickOpenPopup) SetRootDir(dir string)
SetRootDir sets the root directory and scans for files.
func (*QuickOpenPopup) Show ¶
func (this *QuickOpenPopup) Show()
Show opens the popup and resets the filter.
func (*QuickOpenPopup) Visible ¶
func (this *QuickOpenPopup) Visible() bool
Visible returns whether the popup is currently shown.
type RefKind ¶
type RefKind int
RefKind classifies what a reference site does with the symbol, the way Qt Creator's and VS Code's reference views tag their rows: the symbol's own declaration, a write (assignment / mutation) or a plain read. The zero value is RefRead so a host that does not classify its hits — every caller of the legacy SetLocations — still gets sensible rows.
type ReferenceLoc ¶
type ReferenceLoc struct {
File string // absolute or workspace-relative path to the source file
Line int // 1-based line number, ready to display/jump to
Col int // column on that line (host's choice of base; passed through to the jump callback)
Preview string // the source line's text, trimmed, shown alongside the locator
Kind RefKind // read (zero value) / write / declaration — drives the row badge
}
ReferenceLoc is one usage site of a symbol — a single row in the "Find All References" list. It is the panel's own flat shape, NOT core.LSPLocation: the host (silkide) drives core.LSPClient.References, then converts each LSPLocation (uri + 0-based range) into a ReferenceLoc (file path + 1-based line + column + the source line text) before pushing the slice in via SetLocations. Keeping the panel on its own struct means it never has to know about LSP wire types or 0-vs-1-based conventions — that translation lives in the host.
type ReferencesPanel ¶
ReferencesPanel is the bottom-dock pane that lists every usage of a symbol, modelled on VS Code's references view and on the sibling ProblemsPanel: a counted header, one row per location, a per-row file:line locator, alternating row tint, wheel scroll and a hover/ selection highlight. Clicking a row emits SigLocationActivated so the host can open that file at that line.
Like DebugPanel it is a pure display/interaction widget: it never talks to gopls itself. The host fetches the references, converts them to []ReferenceLoc and calls SetReferences (or the older SetLocations); the panel only renders and reports clicks back.
Two views share the same row geometry. The flat list is the original one and stays the default, so SetLocations keeps behaving exactly as before. SetReferences opts into the grouped view: references are stacked under a collapsible per-file header ("5 references in foo.go"), with the push ordered deterministically (path, line, col) so the same query always paints the same rows. On top of that both views support a substring filter (SetFilter), a query title in the header (SetQuery), per-row kind badges and an in-flight state with a cancel button (SetLoading / SigCancel).
func NewReferencesPanel ¶
func NewReferencesPanel() *ReferencesPanel
NewReferencesPanel creates an empty references panel.
func (*ReferencesPanel) Clear ¶
func (this *ReferencesPanel) Clear()
Clear removes all reference rows and resets the view, including the query title, the collapse state and the in-flight flag. The filter is a user-typed view setting and is left in place.
func (*ReferencesPanel) Draw ¶
func (this *ReferencesPanel) Draw(g paint.Painter)
Draw renders the header — query title, match/file tally, the active filter and, while a search is in flight, a progress hint plus the cancel button — followed by the visible rows: collapsible file headers with their child references in the grouped view, a flat list otherwise. Each reference row carries its locator, a kind badge and the trimmed source line. Colors come from gui.Theme() so the pane follows the IDE's light/dark scheme.
func (*ReferencesPanel) Filter ¶
func (this *ReferencesPanel) Filter() string
Filter returns the current filter text.
func (*ReferencesPanel) Grouped ¶
func (this *ReferencesPanel) Grouped() bool
Grouped reports whether the grouped-by-file view is active.
func (*ReferencesPanel) Init ¶
func (this *ReferencesPanel) Init(self gui.IWidget)
func (*ReferencesPanel) IsCollapsed ¶
func (this *ReferencesPanel) IsCollapsed(file string) bool
IsCollapsed reports whether the group for a file path is collapsed. Exposed for tests and for hosts that persist the pane's UI state.
func (*ReferencesPanel) Loading ¶
func (this *ReferencesPanel) Loading() bool
Loading reports whether a search is currently marked in flight.
func (*ReferencesPanel) Locations ¶
func (this *ReferencesPanel) Locations() []ReferenceLoc
Locations returns a defensive copy of the reference rows in display order. Returning the backing slice would let callers mutate the panel's state from the outside.
func (*ReferencesPanel) OnLeftDown ¶
func (this *ReferencesPanel) OnLeftDown(x, y float64)
OnLeftDown routes a click by row kind: a group header toggles its collapse state, a reference row fires the activated callback (the host opens file:line) and highlights itself. In the header band only the cancel button reacts, and only while a search is in flight.
func (*ReferencesPanel) OnMouseLeave ¶
func (this *ReferencesPanel) OnMouseLeave()
OnMouseLeave clears the hover highlight.
func (*ReferencesPanel) OnMouseMove ¶
func (this *ReferencesPanel) OnMouseMove(x, y float64)
OnMouseMove tracks hover state for the row highlight.
func (*ReferencesPanel) OnMouseWheel ¶
func (this *ReferencesPanel) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls the row list vertically, clamped to the content.
func (*ReferencesPanel) Query ¶
func (this *ReferencesPanel) Query() string
Query returns the current header title.
func (*ReferencesPanel) SetFilter ¶
func (this *ReferencesPanel) SetFilter(text string)
SetFilter narrows the visible rows to the references whose file path or source-line preview contains text, case-insensitively. Filtered-out rows stay in the backing slice — clearing the filter brings them back — and a group whose every child is filtered out disappears with them.
func (*ReferencesPanel) SetGrouped ¶
func (this *ReferencesPanel) SetGrouped(on bool)
SetGrouped selects the view: true stacks references under collapsible per-file headers, false renders the original flat list. SetReferences turns grouping on; call this afterwards to opt back out.
func (*ReferencesPanel) SetLoading ¶
func (this *ReferencesPanel) SetLoading(on bool)
SetLoading marks a search as in flight: the header shows a progress hint and a cancel button. The host owns the search, so it also owns this flag — call SetLoading(false) when the result (or the failure) arrives.
func (*ReferencesPanel) SetLocations ¶
func (this *ReferencesPanel) SetLocations(locs []ReferenceLoc)
SetLocations replaces the reference rows with a defensive copy and resets the view. A copy is taken so the host can keep mutating (or reuse) the slice it handed in without corrupting the panel's state.
This is the original flat push: the rows keep the order the host produced and the view mode is left alone. Use SetReferences for the grouped, deterministically ordered view.
func (*ReferencesPanel) SetQuery ¶
func (this *ReferencesPanel) SetQuery(title string)
SetQuery sets the title shown in the header — normally the symbol the search ran for. With a title the header reads "Bar — 3 matches in 2 files"; without one it keeps the plain "引用 / References (3)" tally.
func (*ReferencesPanel) SetReferences ¶
func (this *ReferencesPanel) SetReferences(refs []ReferenceLoc)
SetReferences replaces the reference rows with a defensive copy in a deterministic order — stable sort by file path, then line, then column — and switches the pane to the grouped-by-file view. Determinism is the point: gopls returns references in whatever order its index walk produced, so re-running the same query would otherwise reshuffle the list under the user's cursor. Because the sort makes each file's rows contiguous, the group order is plain path order.
Group collapse state is reset (fresh groups start expanded) since the previous paths need not exist in the new result. The filter and the query title are view settings and survive the push; call SetFilter("") or SetQuery("") to drop them.
func (*ReferencesPanel) SigCancel ¶
func (this *ReferencesPanel) SigCancel(fn func())
SigCancel registers the callback fired when the user clicks the header's cancel button while a search is in flight. The panel clears its own loading flag as it fires, so the button stops indicating progress even if the host's cancellation is asynchronous.
func (*ReferencesPanel) SigLocationActivated ¶
func (this *ReferencesPanel) SigLocationActivated(fn func(file string, line, col int))
SigLocationActivated registers the callback fired when the user clicks a reference row. It receives the target file, the 1-based line, and the column — the host opens file:line in the editor.
func (*ReferencesPanel) SizeHints ¶
func (this *ReferencesPanel) SizeHints() gui.SizeHints
type RunConfig ¶
RunConfig is the structured run configuration the panel edits. Env entries are "KEY=value" strings; blank entries are dropped on parse/serialize round-trips (see parseEnvLines / joinEnvLines).
type RunConfigPanel ¶
RunConfigPanel is a Qt Creator-style "Run Configuration" form: the project's list of named launch configurations on top, and a structured editor for the selected one below — target, launch mode, kit, command-line args, working directory and environment variables.
Two layers, deliberately:
- The single-config layer (RunConfig / SetConfig / Config / SigChanged) is the original API and still works standalone, with no store attached: it edits args, working dir and env only.
- The named layer (SetStore / SelectConfig / AddConfig / DuplicateSelected / RemoveSelected / Apply, reported through SigSelect and SigApply) is backed by a runconfig.Store. Selecting a configuration loads its fields into the editor; Apply writes the edited fields back into the store under the selected name.
The panel never launches anything and never persists the store itself — the host owns both.
func NewRunConfigPanel ¶
func NewRunConfigPanel() *RunConfigPanel
NewRunConfigPanel creates an empty run-config panel.
func (*RunConfigPanel) AddConfig ¶
func (this *RunConfigPanel) AddConfig(name string) error
AddConfig appends a new configuration named name — launch mode "run" against the project's own package — and selects it. The store's validation applies, so a blank name is rejected.
func (*RunConfigPanel) AddEnv ¶
func (this *RunConfigPanel) AddEnv(text string)
AddEnv appends a new env row. Exposed publicly so tests and host code can drive edits without going through ShowInputBox.
func (*RunConfigPanel) Apply ¶
func (this *RunConfigPanel) Apply() error
Apply commits EditedConfig into the store under the selected name and fires SigApply. Validation errors (a blank target, say) are returned unchanged and leave the store untouched.
func (*RunConfigPanel) Config ¶
func (this *RunConfigPanel) Config() RunConfig
Config returns the current configuration. The returned Env slice is a fresh copy; mutating it does not affect the panel.
func (*RunConfigPanel) Configs ¶
func (this *RunConfigPanel) Configs() []runconfig.Config
Configs returns the panel's snapshot of the store's configurations, in list order.
func (*RunConfigPanel) Draw ¶
func (this *RunConfigPanel) Draw(g paint.Painter)
func (*RunConfigPanel) DuplicateSelected ¶
func (this *RunConfigPanel) DuplicateSelected(newName string) error
DuplicateSelected copies the *stored* selected configuration under newName (never the default) and selects the copy. Unapplied in-panel edits are not carried over — Apply first to include them.
func (*RunConfigPanel) EditedConfig ¶
func (this *RunConfigPanel) EditedConfig() runconfig.Config
EditedConfig returns the selected configuration as currently edited: its stored identity (name, kit, pre-run tasks, default flag) merged with the live target, mode, args, working directory and env rows.
func (*RunConfigPanel) Init ¶
func (this *RunConfigPanel) Init(self gui.IWidget)
func (*RunConfigPanel) Kit ¶
func (this *RunConfigPanel) Kit() string
Kit returns the edited kit / toolchain name.
func (*RunConfigPanel) Mode ¶
func (this *RunConfigPanel) Mode() string
Mode returns the edited launch mode, defaulting to "run" when unset.
func (*RunConfigPanel) OnLeftDown ¶
func (this *RunConfigPanel) OnLeftDown(x, y float64)
func (*RunConfigPanel) OnMouseLeave ¶
func (this *RunConfigPanel) OnMouseLeave()
func (*RunConfigPanel) OnMouseMove ¶
func (this *RunConfigPanel) OnMouseMove(x, y float64)
func (*RunConfigPanel) OnMouseWheel ¶
func (this *RunConfigPanel) OnMouseWheel(x, y, delta float64)
func (*RunConfigPanel) RemoveEnv ¶
func (this *RunConfigPanel) RemoveEnv(idx int)
RemoveEnv deletes the env row at idx. No-op on out-of-range idx.
func (*RunConfigPanel) RemoveSelected ¶
func (this *RunConfigPanel) RemoveSelected() bool
RemoveSelected deletes the selected configuration and selects the first remaining one, or clears the editor when none is left. Reports whether something was removed.
func (*RunConfigPanel) SelectConfig ¶
func (this *RunConfigPanel) SelectConfig(name string) bool
SelectConfig selects the configuration named name, loading its fields into the editor and firing SigSelect (plus SigChanged when the loaded args / working dir / env differ from what was on screen). Re-selecting the already selected name is a no-op. Reports whether name was found.
func (*RunConfigPanel) SelectIndex ¶
func (this *RunConfigPanel) SelectIndex(idx int) bool
SelectIndex selects the configuration at idx in list order.
func (*RunConfigPanel) Selected ¶
func (this *RunConfigPanel) Selected() string
Selected returns the name of the selected configuration, "" when none.
func (*RunConfigPanel) SetArgs ¶
func (this *RunConfigPanel) SetArgs(args string)
SetArgs replaces the args string.
func (*RunConfigPanel) SetConfig ¶
func (this *RunConfigPanel) SetConfig(cfg RunConfig)
SetConfig replaces the current configuration. If the normalised new value equals the current one, SigChanged is NOT fired — this keeps idempotent host pushes cheap.
func (*RunConfigPanel) SetEnvAt ¶
func (this *RunConfigPanel) SetEnvAt(idx int, text string)
SetEnvAt replaces the env row at idx. No-op on out-of-range idx.
func (*RunConfigPanel) SetKit ¶
func (this *RunConfigPanel) SetKit(kit string)
SetKit replaces the edited kit / toolchain name.
func (*RunConfigPanel) SetMode ¶
func (this *RunConfigPanel) SetMode(mode string)
SetMode replaces the edited launch mode. Unknown modes are ignored.
func (*RunConfigPanel) SetStore ¶
func (this *RunConfigPanel) SetStore(s *runconfig.Store)
SetStore installs the store backing the configuration list and selects its default configuration (firing SigSelect). Passing nil detaches the store, leaving the panel a plain single-config editor.
func (*RunConfigPanel) SetTarget ¶
func (this *RunConfigPanel) SetTarget(target string)
SetTarget replaces the edited target.
func (*RunConfigPanel) SetWorkingDir ¶
func (this *RunConfigPanel) SetWorkingDir(dir string)
SetWorkingDir replaces the working directory.
func (*RunConfigPanel) SigApply ¶
func (this *RunConfigPanel) SigApply(fn func(cfg runconfig.Config))
SigApply registers the callback fired after Apply has committed the edited fields into the store. It carries the stored configuration.
func (*RunConfigPanel) SigChanged ¶
func (this *RunConfigPanel) SigChanged(fn func(cfg RunConfig))
SigChanged registers the callback fired whenever the configuration changes — through SetConfig with a different value, or through an in-panel edit (args / working dir / env add / env edit / env remove).
func (*RunConfigPanel) SigSelect ¶
func (this *RunConfigPanel) SigSelect(fn func(cfg runconfig.Config))
SigSelect registers the callback fired when a different configuration becomes selected — by a list click, SelectConfig / SelectIndex, or the implicit selection SetStore makes.
func (*RunConfigPanel) SizeHints ¶
func (this *RunConfigPanel) SizeHints() gui.SizeHints
func (*RunConfigPanel) Store ¶
func (this *RunConfigPanel) Store() *runconfig.Store
Store returns the installed store, or nil.
func (*RunConfigPanel) Target ¶
func (this *RunConfigPanel) Target() string
Target returns the edited target (package path or file).
type SearchMatch ¶
SearchMatch represents a single search hit in a file.
type SelectionCallback ¶
SelectionCallback is called when the GedView's selection changes.
type SemanticLegend ¶
type SemanticLegend struct {
Types []string // tokenTypes, e.g. ["namespace","type","function",...]
Modifiers []string // tokenModifiers, e.g. ["declaration","definition",...]
}
SemanticLegend is the server-declared legend that gives meaning to the numeric tokenType index and the tokenModifiers bitmask in the token stream. It arrives once, in the initialize result's semanticTokensProvider.legend, and stays fixed for the session. Indices are positions in Types; modifier bit i (LSB first) names Modifiers[i].
type SemanticTokenEdit ¶
type SemanticTokenEdit struct {
Start int // offset into the previous data array
DeleteCount int // entries to remove at Start
Data []uint32 // entries to insert (may be empty for a pure delete)
}
SemanticTokenEdit is one splice into the PREVIOUS flat uint32 stream (LSP SemanticTokensEdit): drop DeleteCount entries starting at index Start, then insert Data there. Start/DeleteCount index the raw uint32 stream, NOT tokens, and a well-formed server emits them ascending and non-overlapping against the previous stream — see SemanticTokens.ApplyEdits.
type SemanticTokens ¶
type SemanticTokens struct {
// contains filtered or unexported fields
}
SemanticTokens holds one document's semantic highlighting: the raw delta-encoded uint32 stream as the server sent it, plus the decoded absolute tokens and a line index for the overlay's per-line lookups.
The raw stream is retained on purpose: textDocument/semanticTokens/full/delta replies describe edits against it, so a delta update can only be applied by splicing the previous stream and re-decoding (ApplyEdits).
func NewSemanticTokens ¶
func NewSemanticTokens(legend SemanticLegend) *SemanticTokens
NewSemanticTokens creates an empty token set bound to a legend. The legend may be empty at construction and filled in later with SetLegend.
func (*SemanticTokens) ApplyEdits ¶
func (this *SemanticTokens) ApplyEdits(resultID string, edits []SemanticTokenEdit) error
ApplyEdits accepts a semanticTokens/full/delta result: the edits splice the previous raw stream into the new one, which is then re-decoded.
Edits index the previous stream and are applied as one simultaneous splice (all offsets relative to the pre-edit array), which is what the reference clients do. Therefore they must arrive ascending and non-overlapping; an out-of-order or out-of-range edit, or a result that is not a whole number of tokens, is rejected and the previous state is kept. An empty edit list means "unchanged" and only refreshes the result id, matching servers that answer a delta request with no edits.
func (*SemanticTokens) Clear ¶
func (this *SemanticTokens) Clear()
Clear drops the tokens, the raw stream and the result id, keeping the legend (it belongs to the session, not to the document).
func (*SemanticTokens) Data ¶
func (this *SemanticTokens) Data() []uint32
Data returns a defensive copy of the retained raw delta-encoded stream.
func (*SemanticTokens) Legend ¶
func (this *SemanticTokens) Legend() SemanticLegend
Legend returns a defensive copy of the current legend.
func (*SemanticTokens) ResultID ¶
func (this *SemanticTokens) ResultID() string
ResultID is the id of the last accepted result, the value to send back as previousResultId when asking for a delta.
func (*SemanticTokens) SetData ¶
func (this *SemanticTokens) SetData(resultID string, data []uint32) error
SetData accepts a full semanticTokens/full result: resultId plus the whole delta-encoded stream. The stream must be a whole number of 5-entry tokens; a malformed length is rejected and the previous state is kept untouched, so a bad reply never blanks working highlighting.
func (*SemanticTokens) SetLegend ¶
func (this *SemanticTokens) SetLegend(legend SemanticLegend)
SetLegend replaces the legend and re-decodes the retained raw stream, so a legend that arrives after the first tokens still resolves them. Copies the legend slices: the caller keeps ownership of what it handed in.
func (*SemanticTokens) Tokens ¶
func (this *SemanticTokens) Tokens() []Token
Tokens returns a defensive copy of the decoded tokens in stream order, which per spec is document order (lines non-decreasing, characters increasing within a line).
func (*SemanticTokens) TokensOnLine ¶
func (this *SemanticTokens) TokensOnLine(line int) []Token
TokensOnLine returns the tokens on one 0-based line, in character order — the overlay's per-visible-line query, served off a prebuilt index rather than a scan of the whole document. Returns nil for a line without tokens.
type SessionState ¶
type SessionState struct {
LastMode int `json:"last_mode"` // 0 = design, 1 = edit/code
OpenFiles []string `json:"open_files"` // file paths open in editor tabs
ActiveFile string `json:"active_file"` // currently active file path
LastProject string `json:"last_project"` // last opened .silk/.form project file
WindowWidth int `json:"window_width"` // restored on next launch
WindowHeight int `json:"window_height"` // restored on next launch
// 显示参考线 is on by default, so the flag stores the off state: a session
// written before it existed decodes to false and still shows the guides.
HideGuides bool `json:"hide_guides"`
}
SessionState captures the designer's persistent working state across runs, similar to Qt Creator's session files. It remembers which files are open, which file is active, the current mode, and the window geometry.
func LoadSession ¶
func LoadSession() SessionState
LoadSession reads the previously saved session state. If no file exists (first run) or the file is malformed, a zero SessionState is returned and the caller should treat it as "nothing to restore".
type Severity ¶
type Severity int
Severity classifies a Problem as an error or a warning. BuildOutput only ever flags a line as error/not-error; the Problems pane needs the finer distinction so it can render the right glyph and tally the header counts separately.
type ShortcutDef ¶
type ShortcutDef struct {
Command string
Context string // "global" or "editor", as in KeyBinding.Context
Category string // help-panel group heading
Label string // what the binding does
Mods uint8 // gui.ModAction / gui.ModShift / gui.ModAlt bitmap
Key int // gui.Key* constant, or an upper-case ASCII rune
// Chord names a family of keys that Key cannot address on its own (the four
// arrows). Set it only in that case; everywhere else the chord is rendered
// from Mods and Key so the panel cannot disagree with the binding.
Chord string
}
ShortcutDef is one documented key binding: the chord that runs it, what it does, and where it applies. The 快捷键 panel is drawn from this table and from nothing else — a binding absent here is one no user can discover.
Command is the identifier ged.KeyMap rebinds, so the two tables are checked against each other by TestDesignerShortcutsAgreeWithKeymap instead of being kept in step by hand. Context matches KeyBinding.Context: "global" bindings are the ones GedView.OnKeyDown and the designer frame implement, "editor" ones belong to the focused code editor.
type ShortcutsPanel ¶
ShortcutsPanel displays a keyboard shortcut reference card, organized by category, similar to Qt Creator's shortcut viewer.
func NewShortcutsPanel ¶
func NewShortcutsPanel() *ShortcutsPanel
func (*ShortcutsPanel) Draw ¶
func (this *ShortcutsPanel) Draw(g paint.Painter)
func (*ShortcutsPanel) Init ¶
func (this *ShortcutsPanel) Init(self gui.IWidget)
func (*ShortcutsPanel) OnMouseWheel ¶
func (this *ShortcutsPanel) OnMouseWheel(x, y, delta float64)
func (*ShortcutsPanel) SizeHints ¶
func (this *ShortcutsPanel) SizeHints() gui.SizeHints
type SplitOrientation ¶
type SplitOrientation int
SplitOrientation describes how a pane sits next to its predecessor.
The names say what the user sees rather than which way the divider runs — EditorTabs' `splitVertical bool` means "side-by-side", which is exactly the confusion worth avoiding. When wiring this model to that widget: SplitSideBySide == splitVertical true.
const ( // SplitSideBySide places the pane to the right of the previous one // (left | right). It is the zero value, matching the common case. SplitSideBySide SplitOrientation = iota // SplitStacked places the pane below the previous one (top / bottom). SplitStacked )
type SplitResult ¶
type SplitResult struct {
MachineFile string // <base>.silk.go, rewritten wholesale
UserFile string // <base>.go, created once and thereafter only appended to
UserCreated bool // the user file was absent and written from scratch
AddedStubs []string // handler methods appended to an already existing user file
// MissingImports names the imports an appended stub's signature needs that
// the user file does not have. Appending may not touch the developer's
// import block, so the gap is reported instead of closed: unreported it
// reaches them as a bare "undefined: paint" in a file they did not write.
MissingImports []string
}
SplitResult reports what one generation did. Only the user side is worth reporting — the machine file is rewritten unconditionally.
type TabOrderMode ¶
type TabOrderMode struct {
// contains filtered or unexported fields
}
TabOrderMode provides a visual tab order editor that overlays numbered circles on each focusable widget. When active, clicking a widget assigns it the next number in the tab sequence. This is similar to Qt Creator's tab order editing mode.
func NewTabOrderMode ¶
func NewTabOrderMode(scene *GedScene) *TabOrderMode
NewTabOrderMode creates a new tab order editor for the given scene.
func (*TabOrderMode) DrawOverlay ¶
func (this *TabOrderMode) DrawOverlay(g paint.Painter)
DrawOverlay renders the tab order numbers as blue circles on each widget. This should be called after the scene is drawn.
func (*TabOrderMode) Enter ¶
func (this *TabOrderMode) Enter()
Enter activates tab order editing mode. The existing order is preserved; if none exists yet, items are sorted top-to-bottom, left-to-right.
func (*TabOrderMode) Exit ¶
func (this *TabOrderMode) Exit()
Exit deactivates tab order editing mode.
func (*TabOrderMode) IsActive ¶
func (this *TabOrderMode) IsActive() bool
IsActive returns whether tab order editing mode is active.
func (*TabOrderMode) OnLeftDown ¶
func (this *TabOrderMode) OnLeftDown(x, y float64) bool
OnLeftDown handles clicks during tab order editing. Clicking a widget assigns it the next tab number. If all widgets are already assigned, clicking starts a new sequence.
func (*TabOrderMode) Order ¶
func (this *TabOrderMode) Order() []graph.IItem
Order returns the current tab order list.
func (*TabOrderMode) Reset ¶
func (this *TabOrderMode) Reset()
Reset resets the tab order to the default: top-to-bottom, left-to-right.
type TagDecl ¶
A 组态 screen used to acquire its tags by accident: the only record of a tag was the free text typed into a widget's 数据绑定 row, and the generated app called GetOrCreate at bind time — creating it with an empty core.Meta, i.e. no unit, no engineering range and no alarm limits. TagDecl is the other direction: the design declares the tag, with the metadata the runtime needs, and the widget binding merely refers to it.
type TemplateWidget ¶
type TemplateWidget struct {
Factory string
Name string
X, Y float64 // mm
W, H float64 // mm
Text string // default text
Code string // event handler code
}
TemplateWidget defines a single widget inside a project template.
type TerminalPanel ¶
TerminalPanel is the integrated terminal panel. It has two modes:
- session mode (StartSession): a persistent shell on a real pseudo terminal. Keys are forwarded as bytes, output is fed to an AnsiTerm state machine and the panel draws that cell grid, so prompts, cursor motion, colors, line editing and job control all behave.
- runner mode (the default): one shell command at a time in the project directory, streamed line by line into a scrollback.
Both modes read process output on a worker goroutine; a gui.Timer drains it on the UI thread so nothing blocks the main loop.
func NewTerminalPanel ¶
func NewTerminalPanel() *TerminalPanel
NewTerminalPanel creates a new integrated terminal.
func (*TerminalPanel) Clear ¶
func (this *TerminalPanel) Clear()
Clear wipes the scrollback, and the ANSI screen when one is attached.
func (*TerminalPanel) CommandRunning ¶
func (this *TerminalPanel) CommandRunning() bool
CommandRunning reports the owned, line-oriented runner only. A user-opened interactive PTY is not an owned Run task and must not be closed by Stop.
func (*TerminalPanel) Cwd ¶
func (this *TerminalPanel) Cwd() string
Cwd returns the current working directory for command execution.
func (*TerminalPanel) Draw ¶
func (this *TerminalPanel) Draw(g paint.Painter)
func (*TerminalPanel) ExtraEnv ¶
func (this *TerminalPanel) ExtraEnv() []string
ExtraEnv returns a copy of the persistent extra-env slice. Mutating the returned slice does not affect the panel.
func (*TerminalPanel) Hint ¶
func (this *TerminalPanel) Hint(msg string)
Hint pushes one system message line into the scrollback. Renders in the dim-blue hint style (same as the welcome banner). Use instead of Run("echo …") when the IDE wants to surface a platform-neutral message — POSIX single-quote escaping doesn't translate to cmd.exe and a real subprocess adds latency for what's just text.
func (*TerminalPanel) History ¶
func (this *TerminalPanel) History() []string
History returns a copy of the command history, oldest first.
func (*TerminalPanel) Init ¶
func (this *TerminalPanel) Init(self gui.IWidget)
func (*TerminalPanel) OnKeyDown ¶
func (this *TerminalPanel) OnKeyDown(key int, repeat bool)
OnKeyDown handles Enter, arrows, Backspace, and Ctrl shortcuts. With a session attached the key is forwarded to the shell instead: the shell owns the line editing, history and ^C semantics there.
func (*TerminalPanel) OnLeftDown ¶
func (this *TerminalPanel) OnLeftDown(x, y float64)
OnLeftDown focuses the terminal.
func (*TerminalPanel) OnMouseWheel ¶
func (this *TerminalPanel) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls the scrollback. Scrolling up disables auto-scroll so that streaming output doesn't yank the viewport away from the user. Screen mode has no scrollback of its own, so the wheel is inert there.
func (*TerminalPanel) OnTextInput ¶
func (this *TerminalPanel) OnTextInput(s string)
OnTextInput appends typed characters to the pending input line, or sends them straight to the shell in session mode. Enter does NOT arrive here — it flows through OnKeyDown.
func (*TerminalPanel) Run ¶
func (this *TerminalPanel) Run(cmd string)
Run dispatches `cmd` as if the user typed it and pressed Enter. Used by the IDE to wire toolbar "Run" / "Build" actions through the same terminal scrollback the user types into. Returns immediately — execution happens on a worker goroutine and output streams in via pollPending. In session mode the line is fed to the live shell, which queues it like any typed command; in runner mode it is a no-op while another command is running. Routes through RunWithEnv so any SetExtraEnv state applies here too.
func (*TerminalPanel) RunWithEnv ¶
func (this *TerminalPanel) RunWithEnv(cmd string, extraEnv []string)
RunWithEnv is like Run but augments the spawned process env with the supplied KEY=VALUE entries. extraEnv entries OVERRIDE matching keys in os.Environ() (Qt Creator / VS Code semantics: explicit env wins). Entries with no '=' are preserved as-is. extraEnv does not apply in session mode: the shell already owns its environment, which was fixed when the session started.
func (*TerminalPanel) SessionActive ¶
func (this *TerminalPanel) SessionActive() bool
SessionActive reports whether a live shell session is attached.
func (*TerminalPanel) SetCwd ¶
func (this *TerminalPanel) SetCwd(cwd string)
SetCwd overrides the working directory used for command execution.
func (*TerminalPanel) SetExtraEnv ¶
func (this *TerminalPanel) SetExtraEnv(env []string)
SetExtraEnv installs a persistent set of KEY=VALUE entries applied to every subsequent Run / RunWithEnv invocation on this panel. The slice is copied so later caller mutation does not affect us.
func (*TerminalPanel) SetHistoryFile ¶
func (this *TerminalPanel) SetHistoryFile(path string)
SetHistoryFile makes the typed-command history survive restarts. Entries already in the file are loaded immediately (oldest first, newest last) and every later command rewrites the file, capped at terminalHistoryMax lines. An empty path detaches the file and keeps history in memory only.
func (*TerminalPanel) SigSubmit ¶
func (this *TerminalPanel) SigSubmit(fn func(cmd string))
SigSubmit registers an optional observer that fires right after the user presses Enter on a non-empty command. Intended for tests and logging.
func (*TerminalPanel) SizeHints ¶
func (this *TerminalPanel) SizeHints() gui.SizeHints
SizeHints returns the panel's preferred size.
func (*TerminalPanel) StartSession ¶
func (this *TerminalPanel) StartSession(shell string) error
StartSession attaches a persistent shell running on a real pseudo terminal, switching the panel from the built-in command runner to a full terminal. An empty shell means "$SHELL, else the platform default". The session inherits the panel's cwd, os.Environ() and SetExtraEnv entries, plus TERM=xterm-256color unless the caller overrides it.
Returns an error if the session cannot start (notably on Windows, where the ConPTY back end is not implemented yet); the panel then stays in runner mode and the reason is also pushed into the scrollback.
func (*TerminalPanel) StopRunning ¶
func (this *TerminalPanel) StopRunning() bool
StopRunning cancels the current runner once, without waiting on process I/O. It returns true only when this call requested cancellation. The runner keeps its slot until the process and pipes finish, so rapid Run/Stop cannot race an old worker's cleanup against a new command. Interactive PTYs are untouched.
func (*TerminalPanel) StopSession ¶
func (this *TerminalPanel) StopSession()
StopSession hangs up the shell and returns the panel to runner mode. Any output still on screen is flushed into the scrollback by pollPending.
func (*TerminalPanel) Term ¶
func (this *TerminalPanel) Term() *AnsiTerm
Term returns the ANSI screen model driven by the session, or nil in runner mode. Read-only: the panel owns it and feeds it on the UI thread.
type TestExplorerModel ¶
type TestExplorerModel struct {
// contains filtered or unexported fields
}
TestExplorerModel is the pure, GL-free model behind TestExplorerPanel: a package -> test -> subtest tree with per-node status/elapsed/output, a text filter, a failed-only toggle, and a flatten-to-rows pass that honours each node's expansion flag.
Merging (not replacing) is the point of the type. A `go test -run TestFoo` re-run only reports TestFoo, but the explorer must keep showing yesterday's verdict for everything else — so SetResults folds the new run into the existing tree and leaves untouched nodes alone.
func NewTestExplorerModel ¶
func NewTestExplorerModel() *TestExplorerModel
NewTestExplorerModel creates an empty model.
func (*TestExplorerModel) Clear ¶
func (m *TestExplorerModel) Clear()
Clear drops the whole tree, keeping the filter settings.
func (*TestExplorerModel) CollapseAll ¶
func (m *TestExplorerModel) CollapseAll()
func (*TestExplorerModel) Counts ¶
func (m *TestExplorerModel) Counts() (pass, fail, skip int)
Counts tallies the leaf tests by outcome. Only leaves count: a parent test's verdict is just the roll-up of its subtests, and counting both would double-report.
func (*TestExplorerModel) ExpandAll ¶
func (m *TestExplorerModel) ExpandAll()
ExpandAll expands every node, CollapseAll collapses every node — including the packages, which then render as a one-line-per-package summary.
func (*TestExplorerModel) FailedOnly ¶
func (m *TestExplorerModel) FailedOnly() bool
FailedOnly reports whether the failed-only toggle is on.
func (*TestExplorerModel) FailedTests ¶
func (m *TestExplorerModel) FailedTests() []TestRef
FailedTests returns the top-most failed tests: when a parent test and its subtests all failed, only the parent is listed, since re-running it re-runs the subtests too.
func (*TestExplorerModel) FilterText ¶
func (m *TestExplorerModel) FilterText() string
FilterText returns the active filter, lower-cased, "" when inactive.
func (*TestExplorerModel) Find ¶
func (m *TestExplorerModel) Find(pkg, test string) *TestTreeNode
Find returns the node for a package (test == "") or a full test path within it, or nil when it was never seen.
func (*TestExplorerModel) Packages ¶
func (m *TestExplorerModel) Packages() []*TestTreeNode
Packages returns the package nodes in first-seen order. The nodes are live — the panel walks them for drawing and flips Expanded on them.
func (*TestExplorerModel) Rows ¶
func (m *TestExplorerModel) Rows() []TestExplorerRow
Rows flattens the tree into the visible row sequence: packages in first-seen order, each expanded node followed by its children, with the filter and the failed-only toggle applied. Pure — the panel calls it from Draw and from its hit-test so both always agree.
func (*TestExplorerModel) SetFailedOnly ¶
func (m *TestExplorerModel) SetFailedOnly(b bool)
SetFailedOnly restricts the rows to failures and the ancestors that lead to them.
func (*TestExplorerModel) SetFilter ¶
func (m *TestExplorerModel) SetFilter(text string)
SetFilter sets the case-insensitive substring filter applied to node names (and, for tests, to their full "TestFoo/sub" path). An empty text clears it.
func (*TestExplorerModel) SetResults ¶
func (m *TestExplorerModel) SetResults(pkgs []PkgNode)
SetResults merges a run's results into the tree. Packages and tests that are absent from pkgs keep their previous status, elapsed time and output, so a targeted re-run never blanks the rest of the tree.
Per field, an incoming value only overwrites when it carries information: Status when it is not Unknown, Elapsed when positive, Output and File when non-empty. That makes progressive pushes work — a "running" update followed by a "fail" update accumulates instead of erasing what came before.
type TestExplorerPanel ¶
TestExplorerPanel is the hierarchical counterpart to TestResultsPanel: where that pane is a flat log of one run, this one is a persistent package -> test -> subtest tree that survives across runs. Rows carry a status glyph and the elapsed time, expandable rows carry an expander box in the indent gutter, and the context menu drives the host through four callbacks (run / debug / rerun-failed / jump).
All state lives in TestExplorerModel; the panel is a renderer plus a hit-test, so everything interesting about it is testable without GL.
func NewTestExplorerPanel ¶
func NewTestExplorerPanel() *TestExplorerPanel
NewTestExplorerPanel creates an empty test-explorer panel.
func (*TestExplorerPanel) Clear ¶
func (this *TestExplorerPanel) Clear()
Clear empties the tree and resets the view.
func (*TestExplorerPanel) Draw ¶
func (this *TestExplorerPanel) Draw(g paint.Painter)
Draw paints the tally header then one indented row per visible node: the expander box (only when the node has children), the status glyph, the label, the elapsed time and — for rows with a recovered locator — the file:line jump target.
func (*TestExplorerPanel) Init ¶
func (this *TestExplorerPanel) Init(self gui.IWidget)
func (*TestExplorerPanel) Model ¶
func (this *TestExplorerPanel) Model() *TestExplorerModel
Model returns the live tree model. The host uses it for the pieces the panel does not wrap — Find, Counts, FailedTests (to build the re-run command), ExpandAll / CollapseAll.
func (*TestExplorerPanel) OnLeftDown ¶
func (this *TestExplorerPanel) OnLeftDown(x, y float64)
OnLeftDown either toggles the row's expander (when the click landed in the expander box of a row that has children) or selects the row and jumps to its locator through SigActivate.
func (*TestExplorerPanel) OnMouseLeave ¶
func (this *TestExplorerPanel) OnMouseLeave()
OnMouseLeave clears the hover highlight.
func (*TestExplorerPanel) OnMouseMove ¶
func (this *TestExplorerPanel) OnMouseMove(x, y float64)
OnMouseMove tracks hover state for the row highlight.
func (*TestExplorerPanel) OnMouseWheel ¶
func (this *TestExplorerPanel) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls the tree vertically, clamped to the row extent.
func (*TestExplorerPanel) OnRightDown ¶
func (this *TestExplorerPanel) OnRightDown(x, y float64)
OnRightDown opens the row's context menu; a click outside any row is inert.
func (*TestExplorerPanel) Rows ¶
func (this *TestExplorerPanel) Rows() []TestExplorerRow
Rows returns the currently visible rows — the same slice the draw path and the hit-test walk.
func (*TestExplorerPanel) SetFailedOnly ¶
func (this *TestExplorerPanel) SetFailedOnly(b bool)
SetFailedOnly toggles the failures-only view.
func (*TestExplorerPanel) SetFilter ¶
func (this *TestExplorerPanel) SetFilter(text string)
SetFilter applies the case-insensitive name filter and scrolls back to the top, since the row count just changed under the viewport.
func (*TestExplorerPanel) SetResults ¶
func (this *TestExplorerPanel) SetResults(pkgs []PkgNode)
SetResults merges a run's results into the tree (see TestExplorerModel.SetResults: absent tests keep their previous status).
func (*TestExplorerPanel) SigActivate ¶
func (this *TestExplorerPanel) SigActivate(fn func(file string, line int))
SigActivate registers the jump-to-source callback, fired when a row with a recovered failure locator is clicked.
func (*TestExplorerPanel) SigDebug ¶
func (this *TestExplorerPanel) SigDebug(fn func(pkg, test string))
SigDebug registers the callback for "调试", same arguments as SigRun — the host is expected to start the debugger on that test.
func (*TestExplorerPanel) SigRerunFailed ¶
func (this *TestExplorerPanel) SigRerunFailed(fn func())
SigRerunFailed registers the callback for "重跑失败的测试". It takes no arguments: the host reads Model().FailedTests() to build the command.
func (*TestExplorerPanel) SigRun ¶
func (this *TestExplorerPanel) SigRun(fn func(pkg, test string))
SigRun registers the callback for "运行". It receives the row's package import path and its full test path; test is "" on a package row, which means "run the whole package".
func (*TestExplorerPanel) SizeHints ¶
func (this *TestExplorerPanel) SizeHints() gui.SizeHints
type TestExplorerRow ¶
type TestExplorerRow struct {
Node *TestTreeNode
Depth int
}
TestExplorerRow is one visible row of the flattened tree: the node plus the indent depth it renders at (0 for packages).
type TestNode ¶
type TestNode struct {
Name string
Status TestNodeStatus
Elapsed float64 // seconds; 0 when unknown
Output string // captured output for this test
File string // failure locator file, "" when none
Line int // 1-based line that goes with File
}
TestNode is one incoming test result pushed into the explorer. Name is the test's full path within its package as the runner spells it — "TestFoo" for a top-level test, "TestFoo/sub_case" for a subtest — and the model splits it on "/" to nest subtests under their parent.
This is the explorer's own provider-agnostic input shape: whoever drives it (a `go test -json` reader, a discovery pass that only knows test names, or a unit test) converts to TestNode first. The panel therefore never depends on a particular runner package.
type TestNodeStatus ¶
type TestNodeStatus int
TestNodeStatus is the state of one node in the test-explorer tree.
It is deliberately a different enum from TestStatus in test-results-panel.go: that one buckets a finished `go test -v` line into pass/fail/skip, while the explorer models a *persistent* tree where most nodes are, at any moment, either merely discovered (Unknown) or in flight (Running).
const ( TestNodeUnknown TestNodeStatus = iota // discovered, not run (or not run yet in this session) TestNodeRunning // currently executing TestNodePass TestNodeFail TestNodeSkip )
func (TestNodeStatus) String ¶
func (s TestNodeStatus) String() string
String renders the status as its lower-case name, matching the vocabulary the runner uses (and keeping test failures readable).
type TestRef ¶
TestRef identifies one test inside a package. Returned by FailedTests so the host can build the `go test -run` command for a re-run without walking the tree itself.
type TestResult ¶
type TestResult struct {
Name string // e.g. "TestParseFoo" or "TestFoo/subtest"
Package string // e.g. "github.com/uk0/silk/ged" (may be empty for tabular subtests)
Status TestStatus // pass / fail / skip
Duration string // raw, as printed by the runner, e.g. "0.02s"
File string // file path from the FAIL message, "" if not present
Line int // 1-based line from the FAIL message, 0 if not present
Output string // captured failure output between --- FAIL and the next --- or summary
}
TestResult is one parsed row from a `go test -v` capture: a test or subtest name, the package it ran under (when the summary line was seen first), the outcome bucket, the raw duration string the runner printed, and — for FAIL rows only — the captured failure output and the first `file:line:` locator extracted from it for jump-to.
Where Problem keeps a Message field per row, TestResult keeps the whole Output blob: a failing test typically spans many lines (the helper trace, the want/got diff, the stack), and the panel needs all of it to render a useful preview.
type TestResultsPanel ¶
TestResultsPanel is a structured view of `go test -v` output. Unlike BuildOutput — a free-text log that highlights lines — and unlike ProblemsPanel — a flat list of compiler diagnostics — this pane is one row per test with a status glyph, the test name, the raw duration, and, for FAILs, the file:line preview. Clicking a FAIL row whose locator was recoverable fires SigResultActivated for the host IDE to jump to the failing line.
func NewTestResultsPanel ¶
func NewTestResultsPanel() *TestResultsPanel
NewTestResultsPanel creates an empty test-results panel.
func (*TestResultsPanel) Clear ¶
func (this *TestResultsPanel) Clear()
Clear empties the result list.
func (*TestResultsPanel) Counts ¶
func (this *TestResultsPanel) Counts() (passed, failed, skipped int)
Counts returns the tally of passed, failed, and skipped rows. Used by the panel header and by callers that want a quick green/red badge (e.g. the dock tab can colour itself based on Counts).
func (*TestResultsPanel) Draw ¶
func (this *TestResultsPanel) Draw(g paint.Painter)
Draw renders the header tally then one row per test result.
func (*TestResultsPanel) Init ¶
func (this *TestResultsPanel) Init(self gui.IWidget)
func (*TestResultsPanel) OnLeftDown ¶
func (this *TestResultsPanel) OnLeftDown(x, y float64)
OnLeftDown activates a FAIL row with a recoverable File via the SigResultActivated callback. Passes and skips are inert clicks.
func (*TestResultsPanel) OnMouseLeave ¶
func (this *TestResultsPanel) OnMouseLeave()
OnMouseLeave clears the hover highlight.
func (*TestResultsPanel) OnMouseMove ¶
func (this *TestResultsPanel) OnMouseMove(x, y float64)
OnMouseMove tracks hover state for the row highlight.
func (*TestResultsPanel) OnMouseWheel ¶
func (this *TestResultsPanel) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls the row list vertically.
func (*TestResultsPanel) OnRightDown ¶
func (this *TestResultsPanel) OnRightDown(x, y float64)
OnRightDown opens the row's context menu. A click outside any row (header band or empty space) is inert — there is nothing to act on.
func (*TestResultsPanel) Results ¶
func (this *TestResultsPanel) Results() []TestResult
Results returns the parsed test rows in their emitted order.
func (*TestResultsPanel) SetOutput ¶
func (this *TestResultsPanel) SetOutput(output string)
SetOutput parses raw `go test -v` output and replaces the result list. Resets the scroll and hover state so the new run starts at the top.
func (*TestResultsPanel) SigResultActivated ¶
func (this *TestResultsPanel) SigResultActivated(fn func(r TestResult))
SigResultActivated registers the callback fired when the user clicks a FAIL row that has a recoverable File. PASS and SKIP rows are inert — there is nothing to jump to.
func (*TestResultsPanel) SigRunTestRequested ¶
func (this *TestResultsPanel) SigRunTestRequested(fn func(name string))
SigRunTestRequested registers the callback fired when the user picks "运行此测试" from a row's context menu. The host (silkide) is expected to translate the test name into `go test -run ^<name>$ ./...` and stream the new output back through SetOutput.
func (*TestResultsPanel) SizeHints ¶
func (this *TestResultsPanel) SizeHints() gui.SizeHints
type TestStatus ¶
type TestStatus int
TestStatus is the outcome bucket of a single `go test -v` line. BuildOutput knows nothing about test outcomes — it just flags lines as error/not-error; ProblemsPanel only models error vs warning. A test row is a three-state thing (passed / failed / skipped), so it gets its own little enum.
const ( TestPassed TestStatus = iota TestFailed TestSkipped )
type TestTreeNode ¶
type TestTreeNode struct {
Name string // display label: the import path for packages, the leaf segment for tests
Pkg string // owning import path (== Name on package nodes)
Test string // full test path within the package; "" on package nodes
Status TestNodeStatus
Elapsed float64
Output string // cached output from the last run that produced any
File string
Line int
Expanded bool
Children []*TestTreeNode
}
TestTreeNode is one node of the explorer's live tree: a package, a test, or a subtest. Nodes are created once and then merged into, so pointers stay valid across runs — the panel can hold on to one as its selection and the expansion flag survives a re-run.
func (*TestTreeNode) IsPackage ¶
func (n *TestTreeNode) IsPackage() bool
IsPackage reports whether n is a package (root) node.
type ThemePreviewPanel ¶
ThemePreviewPanel displays color swatches for available themes. Clicking a swatch applies the theme to the entire application.
func NewThemePreviewPanel ¶
func NewThemePreviewPanel() *ThemePreviewPanel
func (*ThemePreviewPanel) Draw ¶
func (this *ThemePreviewPanel) Draw(g paint.Painter)
func (*ThemePreviewPanel) Init ¶
func (this *ThemePreviewPanel) Init(self gui.IWidget)
func (*ThemePreviewPanel) OnMouseDown ¶
func (this *ThemePreviewPanel) OnMouseDown(x, y float64, button int)
func (*ThemePreviewPanel) OnMouseLeave ¶
func (this *ThemePreviewPanel) OnMouseLeave()
func (*ThemePreviewPanel) OnMouseMove ¶
func (this *ThemePreviewPanel) OnMouseMove(x, y float64)
func (*ThemePreviewPanel) SetChangeCallback ¶
func (this *ThemePreviewPanel) SetChangeCallback(cb func(int))
SetChangeCallback registers a function called when the user switches themes.
func (*ThemePreviewPanel) SizeHints ¶
func (this *ThemePreviewPanel) SizeHints() gui.SizeHints
type TodoGroupMode ¶
type TodoGroupMode int
TodoGroupMode is how TodoPanel arranges its rows.
const ( TodoGroupNone TodoGroupMode = iota // flat, in the order the host supplied TodoGroupByTag // one group per marker kind TodoGroupByFile // one group per file )
type TodoPanel ¶
TodoPanel is the bottom-dock pane that lists every TODO/FIXME marker in the project, modelled on the sibling ReferencesPanel and ProblemsPanel: a counted header, one row per marker, a per-row "basename:line" locator, alternating row tint, wheel scroll and a hover/selection highlight. Each row leads with a colour-coded Kind badge (TODO amber, FIXME red, XXX/HACK orange, NOTE grey). Clicking a row emits SigActivate so the host can open that file at that line.
A flat list stops being readable at a few hundred markers, so the header band carries two controls: a group toggle (flat / by tag / by file, which inserts a counted group header row before each group) and a filter box that keeps only the rows matching a substring. Both are view state — the row set the host handed in via SetRows is never modified, and Rows() always returns all of it. Grouping and filtering are recomputed into visRows, which is what the panel draws and hit-tests.
Like ReferencesPanel it is a pure display/interaction widget: it never scans for markers itself. The host gathers them, converts to []TodoRow and calls SetRows; the panel only renders and reports clicks back.
func (*TodoPanel) Clear ¶
func (this *TodoPanel) Clear()
Clear removes all marker rows and resets the view.
func (*TodoPanel) Draw ¶
Draw renders the count header (with the group toggle and filter box) and then the display rows: a group header row per group when grouping is on, and per marker a colour-coded Kind badge, a dimmed "basename:line" locator and the marker text, with alternating tint and a hover/selection highlight.
func (*TodoPanel) GroupBy ¶
func (this *TodoPanel) GroupBy() TodoGroupMode
GroupBy returns the current grouping mode.
func (*TodoPanel) OnKeyDown ¶
OnKeyDown edits the filter box: Backspace deletes the last rune, Esc clears the filter and drops focus. Keys are ignored while the box is not focused.
func (*TodoPanel) OnLeftDown ¶
OnLeftDown fires the activated callback for the clicked marker row (the host opens file:line) and highlights it. In the header band it drives the group toggle and focuses the filter box; a click anywhere else in the header, or on a group header row, is inert.
func (*TodoPanel) OnMouseLeave ¶
func (this *TodoPanel) OnMouseLeave()
OnMouseLeave clears the hover highlight.
func (*TodoPanel) OnMouseMove ¶
OnMouseMove tracks hover state for the row highlight.
func (*TodoPanel) OnMouseWheel ¶
OnMouseWheel scrolls the row list vertically, clamped to the content.
func (*TodoPanel) OnTextInput ¶
OnTextInput appends typed text to the filter box while it holds focus and re-filters the list. Typing with the box unfocused is ignored.
func (*TodoPanel) Rows ¶
Rows returns a defensive copy of the marker rows in display order. Returning the backing slice would let callers mutate the panel's state from the outside.
func (*TodoPanel) SetFilter ¶
SetFilter keeps only the marker rows matching s (case-insensitive substring over kind, text and file path). An empty filter shows all rows.
func (*TodoPanel) SetGroupBy ¶
func (this *TodoPanel) SetGroupBy(m TodoGroupMode)
SetGroupBy switches the row arrangement (flat / by tag / by file) and rebuilds the display rows. Selection survives: it indexes rows, not the display order.
func (*TodoPanel) SetRows ¶
SetRows replaces the marker rows with a defensive copy and resets the view. A copy is taken so the host can keep mutating (or reuse) the slice it handed in without corrupting the panel's state.
func (*TodoPanel) SigActivate ¶
SigActivate registers the callback fired when the user clicks a marker row. It receives the target file and the 1-based line — the host opens file:line in the editor.
func (*TodoPanel) SigRowActivated ¶
SigRowActivated is the original name of SigActivate, kept for the hosts already wired to it.
func (*TodoPanel) ToggleGroupBy ¶
func (this *TodoPanel) ToggleGroupBy()
ToggleGroupBy cycles flat -> by tag -> by file -> flat. It is what the header's group button does.
type TodoRow ¶
type TodoRow struct {
File string // absolute or workspace-relative path to the source file
Line int // 1-based line number, ready to display / jump to
Kind string // marker kind: TODO / FIXME / XXX / HACK / NOTE / BUG
Text string // the marker comment text, trimmed
}
TodoRow is one TODO/FIXME marker — a single row in the待办 list. It is the panel's own flat display shape, deliberately NOT the core scanner's result type: the host (silkide) runs the marker scan and converts each hit into a TodoRow before pushing the slice in via SetRows. Keeping the panel on its own struct means it never imports the scanner and never has to know how markers are discovered — that translation lives in the host, exactly as ReferencesPanel stays off core.LSPLocation.
type Token ¶
type Token struct {
Line int // 0-based line
StartChar int // 0-based character offset within the line
Length int // token length in characters
Type string // legend-resolved type; "" when the index is outside the legend
Mods []string // legend-resolved modifiers in bit order; nil when the mask is 0
}
Token is one decoded semantic token with ABSOLUTE coordinates and legend-resolved names — the shape the overlay paints. Lines and characters stay 0-based, exactly as LSP reports them (core.LSPPosition convention), so no base juggling happens in the decoder; the drawer adds the editor's own offset once.
Per spec a token never spans lines and tokens never overlap, so Line plus [StartChar, StartChar+Length) fully places it.
type TypeHierarchyModel ¶
type TypeHierarchyModel struct {
// contains filtered or unexported fields
}
TypeHierarchyModel is the tree behind TypeHierarchyPanel: a mode, a set of roots, and the flattened row list derived from them. It is pure state — no widget, no GL, no LSP — so all of the expansion, cycle and multi-target behaviour is unit-testable on its own.
func NewTypeHierarchyModel ¶
func NewTypeHierarchyModel() *TypeHierarchyModel
NewTypeHierarchyModel returns an empty model in supertypes mode.
func (*TypeHierarchyModel) Clear ¶
func (m *TypeHierarchyModel) Clear()
Clear empties the tree, keeping the mode.
func (*TypeHierarchyModel) IsMultiTarget ¶
func (m *TypeHierarchyModel) IsMultiTarget() bool
IsMultiTarget reports whether the tree is headed by the synthetic multiple-targets root.
func (*TypeHierarchyModel) Mode ¶
func (m *TypeHierarchyModel) Mode() string
Mode returns the active direction.
func (*TypeHierarchyModel) Roots ¶
func (m *TypeHierarchyModel) Roots() []*TypeNode
Roots returns the tree roots (a copy of the slice; the nodes are shared).
func (*TypeHierarchyModel) RowAt ¶
func (m *TypeHierarchyModel) RowAt(i int) (TypeHierarchyRow, bool)
RowAt returns the row at a flat index, and false when the index is out of range.
func (*TypeHierarchyModel) RowCount ¶
func (m *TypeHierarchyModel) RowCount() int
RowCount returns the number of visible rows.
func (*TypeHierarchyModel) Rows ¶
func (m *TypeHierarchyModel) Rows() []TypeHierarchyRow
Rows returns the flattened, indented rows in display order (a copy of the slice; the nodes are shared).
func (*TypeHierarchyModel) SetChildren ¶
func (m *TypeHierarchyModel) SetChildren(node *TypeNode, children []*TypeNode) bool
SetChildren installs a lazily-fetched result: it marks node Loaded (so an empty answer becomes a leaf rather than re-asking forever) and replaces its children, dropping nils and any self-reference. It reports false when node is nil or no longer part of the tree — the guard that makes a late reply from a superseded query (a different mode, a new target) harmless.
func (*TypeHierarchyModel) SetMode ¶
func (m *TypeHierarchyModel) SetMode(mode string) bool
SetMode switches direction and resets the tree: the old roots describe a different relation and cannot be reused. It reports whether anything changed — false for an unknown mode or a re-selection of the current one — so the panel only signals the host (which must re-resolve) on a real switch.
func (*TypeHierarchyModel) SetTargets ¶
func (m *TypeHierarchyModel) SetTargets(targets []*TypeNode)
SetTargets replaces the tree with the host's resolved candidates. One candidate becomes the root directly; several are gathered under a synthetic "multiple targets" root (Kind TypeKindTargets, already expanded and loaded) so an ambiguous cursor position — an embedded name, a method promoted from two interfaces — still yields a single tree instead of a silent guess. nil entries are dropped; an empty list clears the view.
func (*TypeHierarchyModel) SigExpand ¶
func (m *TypeHierarchyModel) SigExpand(fn func(node *TypeNode, mode string))
SigExpand registers the lazy-fetch callback. It fires when the user expands a node whose relatives have never been fetched, receiving the node and the current mode; the host resolves them (possibly asynchronously) and calls SetChildren with the same node pointer.
func (*TypeHierarchyModel) ToggleRow ¶
func (m *TypeHierarchyModel) ToggleRow(i int) bool
ToggleRow expands or collapses the node at a flat row index, rebuilding the rows. Expanding a not-yet-Loaded node fires SigExpand and leaves the node expanded so the children appear as soon as SetChildren lands. Leaves and cyclic stubs are inert. It reports whether the row toggled.
type TypeHierarchyPanel ¶
TypeHierarchyPanel is the type-hierarchy tool view, modelled on Qt Creator's "Type Hierarchy" pane plus its "Find Implementations": a direction selector (父类型 / 子类型 / 实现) over an indented, lazily-expanded tree of types.
Like the sibling ReferencesPanel it is a pure display/interaction widget that never talks to gopls. All state lives in TypeHierarchyModel; the panel adds only geometry and three intents:
- SigMode — the user picked a different direction; the tree was reset and the host must re-resolve the hierarchy for it.
- Model().SigExpand — the user expanded a node whose relatives were never fetched; the host resolves them and calls Model().SetChildren.
- SigActivate — the user clicked a row with a source location; the host opens file:line.
func NewTypeHierarchyPanel ¶
func NewTypeHierarchyPanel() *TypeHierarchyPanel
NewTypeHierarchyPanel creates an empty panel in supertypes mode.
func (*TypeHierarchyPanel) Draw ¶
func (this *TypeHierarchyPanel) Draw(g paint.Painter)
Draw renders the title, the three direction buttons, and one indented row per visible node: a twisty when it has (or may have) relatives, a kind glyph, the name, and a dimmed "pkg · file:line" locator. Cyclic stubs are suffixed with a recursion marker.
func (*TypeHierarchyPanel) Init ¶
func (this *TypeHierarchyPanel) Init(self gui.IWidget)
func (*TypeHierarchyPanel) Mode ¶
func (this *TypeHierarchyPanel) Mode() string
Mode returns the active direction.
func (*TypeHierarchyPanel) Model ¶
func (this *TypeHierarchyPanel) Model() *TypeHierarchyModel
Model returns the tree behind the panel; the host pushes results in through it (SetTargets / SetChildren) and wires the lazy fetch via its SigExpand.
func (*TypeHierarchyPanel) OnLeftDown ¶
func (this *TypeHierarchyPanel) OnLeftDown(x, y float64)
OnLeftDown routes a click: the direction selector switches mode (resetting the tree and firing SigMode), a twisty expands/collapses, and any other row hit fires SigActivate. Rows without a source location — the synthetic multiple-targets root — toggle instead of navigating. The title band is inert.
func (*TypeHierarchyPanel) OnMouseLeave ¶
func (this *TypeHierarchyPanel) OnMouseLeave()
OnMouseLeave clears the hover highlight.
func (*TypeHierarchyPanel) OnMouseMove ¶
func (this *TypeHierarchyPanel) OnMouseMove(x, y float64)
OnMouseMove tracks hover state for the row highlight.
func (*TypeHierarchyPanel) OnMouseWheel ¶
func (this *TypeHierarchyPanel) OnMouseWheel(x, y, z float64)
OnMouseWheel scrolls the tree vertically, clamped to the content.
func (*TypeHierarchyPanel) SetMode ¶
func (this *TypeHierarchyPanel) SetMode(mode string) bool
SetMode switches direction programmatically. It resets the tree exactly as a click does but does NOT fire SigMode — that signal reports user intent, and a host that set the mode itself already knows.
func (*TypeHierarchyPanel) SetTargets ¶
func (this *TypeHierarchyPanel) SetTargets(targets []*TypeNode)
SetTargets installs the host's resolved candidates and resets the view. See TypeHierarchyModel.SetTargets for the multiple-targets root.
func (*TypeHierarchyPanel) SigActivate ¶
func (this *TypeHierarchyPanel) SigActivate(fn func(file string, line int))
SigActivate registers the callback fired when the user clicks a row that has a source location. It receives the file and the 1-based line.
func (*TypeHierarchyPanel) SigMode ¶
func (this *TypeHierarchyPanel) SigMode(fn func(mode string))
SigMode registers the callback fired when the user picks a direction in the selector. The tree has already been cleared; the host re-resolves for the new mode and calls SetTargets.
func (*TypeHierarchyPanel) SizeHints ¶
func (this *TypeHierarchyPanel) SizeHints() gui.SizeHints
type TypeHierarchyRow ¶
TypeHierarchyRow is one visible line of the flattened tree: the node, its indentation depth, and whether it merely repeats an ancestor. Cyclic rows are rendered as stubs and cannot be expanded — that is the cycle guard, and it is what keeps mutually-referencing types (A implements B implements A) from flattening forever.
type TypeNode ¶
type TypeNode struct {
Name string // declaration name, e.g. "Painter" or "Widget.Draw"
Pkg string // package name or import path, host's choice; may be empty
File string // source file; empty for the synthetic multi-target root
Line int // 1-based line of the declaration
Kind string // interface | struct | method (| targets for the synthetic root)
Children []*TypeNode
Expanded bool
Loaded bool
}
TypeNode is one entry in the type hierarchy: a named declaration plus its source location and its lazily-fetched relatives in the current direction.
It is the panel's own shape, deliberately free of LSP types: the host drives gopls, converts each result into a TypeNode (file path + 1-based line) and hands it over. Children stay nil until the user expands the node — Loaded distinguishes "no relatives" (Loaded, empty) from "not asked yet" (not Loaded), which is what makes the twisty and the lazy fetch decidable.
The model takes ownership of the nodes handed to SetTargets/SetChildren: it mutates Expanded/Loaded/Children in place and hands the same pointers back through SigExpand, which is how an async reply finds its parent again. A given *TypeNode must therefore appear at only one place in the tree; hosts that resolve the same type twice should build two nodes.
type UndoPanel ¶
UndoPanel is a tool panel that displays the undo/redo history as a scrollable list. Clicking an entry undoes or redoes to that point. Commands before the current position are shown in normal text; commands at or after the current position (redo-able) are shown in gray/italic.
func NewUndoPanel ¶
func NewUndoPanel() *UndoPanel
func (*UndoPanel) GoTo ¶
GoTo moves the bound stack to position pos, walking there one command at a time through Undo/Redo. Every command still runs its own Undo/Redo in order; re-seating the position any other way would skip the work the commands do.
Walking the stack pushes nothing, so the jump has to report the change itself — the same reason GedView.Undo does. A click here can rewind a dozen edits; without the report every listener keeps rendering the design they replaced.
func (*UndoPanel) OnLeftDown ¶
OnLeftDown handles click to undo/redo to a specific point.
func (*UndoPanel) OnMouseLeave ¶
func (this *UndoPanel) OnMouseLeave()
OnMouseLeave resets hover state.
func (*UndoPanel) OnMouseMove ¶
OnMouseMove handles hover highlighting.
func (*UndoPanel) OnMouseWheel ¶
OnMouseWheel handles scrolling.
func (*UndoPanel) Rebuild ¶
func (this *UndoPanel) Rebuild()
Rebuild reads the undo stack and repopulates the row list.
type VarRow ¶
VarRow is one node of the variables tree: a local, an argument, or a child of either. Name/Type/Value are the dlv projection (same three fields as core.Variable); HasChildren marks a composite — a struct, slice, map or pointer — the user can open. Children are NOT carried here: they are fetched lazily and installed by path via SetChildren, so pushing a frame's variables never drags a deep object graph along.
type WatchEntry ¶
WatchEntry is one watched expression and its last evaluation. Expr is the Go expression the user typed; Value and Type are the dlv Eval result on success; Err is the error string when evaluation failed. A non-empty Err means Value/Type are not meaningful and the row renders the error. The host fills these in and pushes them via SetWatches.
type WelcomeScreen ¶
WelcomeScreen is a start page shown when the designer opens, similar to Qt Creator's welcome screen. It displays the application title, version, a list of recently opened projects, action buttons, and keyboard tips. The visual design is theme-aware (works in both light and dark modes).
func NewWelcomeScreen ¶
func NewWelcomeScreen() *WelcomeScreen
NewWelcomeScreen creates a new welcome screen widget.
func (*WelcomeScreen) Draw ¶
func (this *WelcomeScreen) Draw(g paint.Painter)
Draw renders the welcome screen.
func (*WelcomeScreen) OnLeftDown ¶
func (this *WelcomeScreen) OnLeftDown(x, y float64)
OnLeftDown handles mouse clicks on the welcome screen.
func (*WelcomeScreen) OnMouseMove ¶
func (this *WelcomeScreen) OnMouseMove(x, y float64)
OnMouseMove tracks hover state for interactive elements.
func (*WelcomeScreen) SetBranding ¶
func (this *WelcomeScreen) SetBranding(info AboutInfo)
SetBranding lets an IDE host supply its name, version and logo without changing the standalone SDK designer's default identity.
func (*WelcomeScreen) SetNewProjectCallback ¶
func (this *WelcomeScreen) SetNewProjectCallback(cb func())
SetNewProjectCallback sets the callback for the "New Project" button.
func (*WelcomeScreen) SetOpenFileCallback ¶
func (this *WelcomeScreen) SetOpenFileCallback(cb func())
SetOpenFileCallback sets the callback for the "Open File" button.
func (*WelcomeScreen) SetOpenRecentCallback ¶
func (this *WelcomeScreen) SetOpenRecentCallback(cb func(string))
SetOpenRecentCallback sets the callback for clicking a recent project.
func (*WelcomeScreen) SetRecentFiles ¶
func (this *WelcomeScreen) SetRecentFiles(files []string)
SetRecentFiles sets the list of recently opened project file paths.
func (*WelcomeScreen) SetTitle ¶
func (this *WelcomeScreen) SetTitle(s string)
func (*WelcomeScreen) SizeHints ¶
func (this *WelcomeScreen) SizeHints() gui.SizeHints
SizeHints returns the size hints for the welcome screen.
func (*WelcomeScreen) Title ¶
func (this *WelcomeScreen) Title() string
type WidgetDef ¶
type WidgetDef struct {
Factory string // core factory name, e.g. "acme.Meter"; must already be registered
Category string // palette category display name; a new one is appended when unknown
GoType string // generated field type, e.g. "*acme.Meter"
ImportPath string // import the generated file needs for GoType/Constructor
Constructor string // constructor expression, e.g. `acme.NewMeter()`
Events []WidgetEvent
DefaultEvent string // event auto-bound when the user writes one handler func, "" for none
}
WidgetDef is everything the designer has to know about a widget it did not declare itself: how to generate it (GoType/ImportPath/Constructor), where the palette offers it (Category), and what it can bind (Events/DefaultEvent).
type WidgetEvent ¶
type WidgetEvent struct {
Name string // event name, as stored in the design and shown in the property sheet
Code string // formatted with (fieldName, handlerName); ends in a newline
Params string // the handler's Go parameter list, "" for none
Import string // extra import the emitted line references, "" for none
}
WidgetEvent is one bindable event of a plugin widget: the exported mirror of widgetEvent (ged/codegen.go), whose fields a package outside ged cannot fill.
type WidgetHelp ¶
WidgetHelp shows documentation for the currently selected widget. It is a passive panel: callers (design.go) push selection updates via SetWidget.
func (*WidgetHelp) CurrentFactory ¶
func (this *WidgetHelp) CurrentFactory() string
CurrentFactory returns the factory name currently displayed (or "").
func (*WidgetHelp) Draw ¶
func (this *WidgetHelp) Draw(g paint.Painter)
Draw paints the help content. When no widget is selected, or no doc exists for the current factory, a friendly placeholder message is shown instead.
func (*WidgetHelp) Init ¶
func (this *WidgetHelp) Init(self gui.IWidget)
func (*WidgetHelp) OnMouseWheel ¶
func (this *WidgetHelp) OnMouseWheel(x, y, delta float64)
OnMouseWheel scrolls the content.
func (*WidgetHelp) SetWidget ¶
func (this *WidgetHelp) SetWidget(fw *FakeWidget)
SetWidget updates the panel to show docs for the given FakeWidget. A nil argument clears the panel (shows the placeholder text). Callers should pass nil when no selection, or when the selection is not a FakeWidget.
func (*WidgetHelp) SizeHints ¶
func (this *WidgetHelp) SizeHints() gui.SizeHints
SizeHints returns the panel's preferred size.
type WidgetList ¶
type WidgetList struct {
gui.ListWidget
// contains filtered or unexported fields
}
func NewWidgetList ¶
func NewWidgetList() *WidgetList
func (*WidgetList) Draw ¶
func (this *WidgetList) Draw(g paint.Painter)
Draw overrides ListWidget.Draw to render a clean, Qt Creator-inspired widget palette with compact icon+text rows and styled category headers.
func (*WidgetList) Init ¶
func (this *WidgetList) Init(self gui.IWidget)
func (*WidgetList) OnLeftDown ¶
func (this *WidgetList) OnLeftDown(x, y float64)
OnLeftDown intercepts clicks on category headers to toggle expand/collapse.
func (*WidgetList) SetFilter ¶
func (this *WidgetList) SetFilter(text string)
SetFilter updates the search filter text and rebuilds the flat list. When filter is non-empty, all matching items are shown regardless of category collapse state. Matching is case-insensitive against both the friendly display name and the factory name.
type Workspace ¶
type Workspace struct {
// contains filtered or unexported fields
}
Workspace is the tree of editor panes over one shared set of documents. Use NewWorkspace; the zero value also works and grows its first pane on the first operation.
func NewWorkspace ¶
func NewWorkspace() *Workspace
NewWorkspace returns a workspace with a single empty pane.
func (*Workspace) ActiveDoc ¶
ActiveDoc returns the path of the document focused in the active pane, or "" when nothing is open there.
func (*Workspace) ActivePane ¶
ActivePane returns the focused pane, or nil when there are none.
func (*Workspace) ActivePaneID ¶
ActivePaneID returns the focused pane's ID, or 0 (never a valid ID) when there is no pane.
func (*Workspace) CloseDoc ¶
CloseDoc closes one view — path in pane paneID — and reports whether the document is still open somewhere else (stillOpen) so the host knows when to release its buffer, plus whether a view was actually closed (ok). stillOpen is the truth about the workspace after the call, so it stays meaningful even when ok is false.
func (*Workspace) ClosePane ¶
ClosePane removes a pane and merges its documents into the neighbour it collapses into (the pane before it, or the one after it for the first pane), so closing a split never closes the files it held. The closed pane's focused document keeps focus in the neighbour, and the neighbour takes over focus if the closed pane had it. The last remaining pane cannot be closed: it reports false, as does an unknown ID.
func (*Workspace) DuplicateViewToOtherPane ¶
DuplicateViewToOtherPane adds a second view of an already-open document to toPaneID and focuses it there, leaving the original view untouched. It reports false when the target pane is unknown or the document is not open anywhere — opening a fresh document is OpenDoc's job, this only adds a view of a document the host already holds.
func (*Workspace) MoveDocToPane ¶
MoveDocToPane moves the view of path out of fromPaneID and into toPaneID, focusing it there and focusing the target pane. It reports whether the move happened. Moving onto a pane that already shows the document collapses the two views into one, and the source pane is left in place even when it ends up empty — use ClosePane to drop it.
func (*Workspace) OpenDoc ¶
OpenDoc opens path in the active pane, or just focuses it when that pane already shows it. It reports whether a new view was created — false when the document was merely re-focused, or when path is empty. A document already open in *another* pane still gets a new view here: two views, one shared document.
func (*Workspace) OpenDocs ¶
OpenDocs returns every distinct open document identity, in pane order. One entry per document however many views it has.
func (*Workspace) Panes ¶
Panes returns the panes in layout order (first pane first). The slice is a copy, the panes are shared.
func (*Workspace) SetActivePane ¶
SetActivePane focuses a pane by ID and reports whether it existed.
func (*Workspace) SplitActive ¶
func (w *Workspace) SplitActive(o SplitOrientation) int
SplitActive splits the active pane, inserting a sibling directly after it that shows the *same* document — the same identity, not a copy of its text. The new pane takes focus (as in Qt Creator and VS Code) and its ID is returned; splitting an empty pane yields an empty sibling.
Source Files
¶
- about-dialog.go
- auto-save.go
- bindings-panel.go
- bookmarks-panel.go
- build-output.go
- call-hierarchy-model.go
- call-hierarchy-panel.go
- code-insights-layer.go
- code-insights-model.go
- code-outline.go
- code-panel.go
- codegen-index.go
- codegen.go
- codegen_decl.go
- codegen_services.go
- codegen_split.go
- console-panel.go
- context_actions.go
- debug-panel.go
- design-problems.go
- device_points_editor.go
- doc.go
- editor-tabs.go
- editor-workspace.go
- event-properties.go
- fake-widget.go
- file-explorer-context.go
- file-explorer.go
- form-presets.go
- form-settings-dialog.go
- ged-scene.go
- ged-view.go
- generated-view.go
- git-changes-panel.go
- git-log-panel.go
- git-workspace-model.go
- git-workspace-panel.go
- global-search.go
- go-tools-model.go
- go-tools-panel.go
- grid-model.go
- guides.go
- keymap-panel.go
- keymap.go
- layout_model.go
- layout_selection.go
- log-panel.go
- managed_geometry.go
- merge-editor-model.go
- merge-editor.go
- mode-manager.go
- mode-switch.go
- morph.go
- nested_geometry.go
- object-inspector.go
- packages-panel.go
- palette_drop.go
- platform_shortcuts.go
- preview.go
- problem-sources.go
- problems-panel.go
- project-settings.go
- project.go
- quick-open.go
- quickhelp-panel.go
- references-panel.go
- run-config-panel.go
- session.go
- shortcut-registry.go
- shortcuts-panel.go
- tab-order.go
- tag-dictionary-dialog.go
- tag-dictionary.go
- templates.go
- terminal.go
- terminal_ansi.go
- terminal_process_unix.go
- terminal_pty_unix.go
- test-explorer-model.go
- test-explorer-panel.go
- test-results-panel.go
- theme-preview.go
- todo-panel.go
- type-hierarchy-model.go
- type-hierarchy-panel.go
- undo-panel.go
- welcome.go
- widget-help.go
- widget-list.go
- widget-plugin.go
- widget-registry.go
- widget_properties.go
- widget_property_adapter.go
- workflow_widgets.go