Documentation
¶
Overview ¶
Package code provides the main Cogent Code GUI.
Package code implements the Code editor and all the infrastructure and supporting widgets for filetree, commands, console, settings, splitviews, etc.
Index ¶
- Constants
- Variables
- func ArgVarKeys() []string
- func ArgVarPrompts(arg string) (map[string]struct{}, bool)
- func CheckForProjectAtPath(path string) (string, bool)
- func CmdsView(pt *Commands)
- func CodeOpenNodes(it any, sc *core.Scene) []string
- func CommandMenu(fn *filetree.Node) func(mm *core.Scene)
- func CommandName(cat, cmd string) string
- func ConfigEditorTextEditor(ed *texteditor.Editor)
- func ConfigOutputTextEditor(ed *texteditor.Editor)
- func DebugSettingsEditor(pf *cdebug.Params) *core.Form
- func ExecCmds(cv *Code) [][]string
- func LanguagesView(pt *Languages)
- func MarkupCmdOutput(out []byte, lexName string) []byte
- func MarkupStdOutput(out []byte) []byte
- func MarkupStderr(out []byte) []byte
- func MarkupStdout(out []byte) []byte
- func MergeAvailableCmds()
- func NewDebugger(sup fileinfo.Known, path, rootPath string, outbuf *texteditor.Buffer, ...) (cdebug.GiDebug, error)
- func OpenPaths()
- func ProjectPathParse(path string) (root, projnm, fnm string, ok bool)
- func ProjectSettingsEditor(pf *ProjectSettings) *core.Form
- func RegistersMenu(ctx core.Widget, curVal string, fun func(regNm string))
- func RegistersView(pt *Registers)
- func RepoCurBranches(repo vcs.Repo) (string, []string, error)
- func SavePaths()
- func SelectSymbol(cv *Code, ssym syms.Symbol)
- func SetGoMod(gomod bool)
- func SplitsView(pt *Splits)
- func TextLinkHandler(tl paint.TextLink) bool
- type ArgVarInfo
- type ArgVarTypes
- func (i ArgVarTypes) Desc() string
- func (i ArgVarTypes) Int64() int64
- func (i ArgVarTypes) MarshalText() ([]byte, error)
- func (i *ArgVarTypes) SetInt64(in int64)
- func (i *ArgVarTypes) SetString(s string) error
- func (i ArgVarTypes) String() string
- func (i *ArgVarTypes) UnmarshalText(text []byte) error
- func (i ArgVarTypes) Values() []enums.Enum
- type ArgVarVals
- type CmdAndArgs
- type CmdArgs
- type CmdButton
- type CmdName
- type CmdNames
- type CmdRun
- type CmdRuns
- func (rc *CmdRuns) Add(cm *CmdRun)
- func (rc *CmdRuns) AddCmd(name, cmdstr string, cmdargs *CmdAndArgs, ex *exec.Cmd)
- func (rc *CmdRuns) ByName(name string) (*CmdRun, int)
- func (rc *CmdRuns) DeleteByName(name string) bool
- func (rc *CmdRuns) DeleteIndex(idx int)
- func (rc *CmdRuns) KillByName(name string) bool
- type Code
- func (cv *Code) ActiveFileNode() *filetree.Node
- func (cv *Code) ActiveTextEditor() *TextEditor
- func (cv *Code) AddChooserFiles(ac *core.Chooser)
- func (cv *Code) AddChooserSymbols(ac *core.Chooser)
- func (cv *Code) AddCloseDialog()
- func (cv *Code) ApplySettings()
- func (cv *Code) ApplySettingsAction()
- func (cv *Code) ApplySplitsSettings(sv *core.Splits)
- func (cv *Code) AutoSaveCheck(tv *TextEditor, vidx int, fn *filetree.Node) bool
- func (cv *Code) CallFind(ctx core.Widget)
- func (cv *Code) CallSaveActiveViewAs(ctx core.Widget)
- func (cv *Code) CallSplitsSetView(ctx core.Widget)
- func (cv *Code) CallViewFile(ctx core.Widget)
- func (cv *Code) ChooseRunExec(exePath core.Filename)
- func (cv *Code) ClearDebug()
- func (cv *Code) CloneActiveView() (*TextEditor, int)
- func (cv *Code) CloseActiveView()
- func (cv *Code) CloseOpenNodes(nodes []*FileNode)
- func (cv *Code) CommandFromMenu(fn *filetree.Node)
- func (cv *Code) CommentOut() bool
- func (cv *Code) Commit()
- func (cv *Code) CommitNoChecks()
- func (cv *Code) ConfigActiveFilename(fb *core.FuncButton) *core.FuncButton
- func (cv *Code) ConfigFindButton(fb *core.FuncButton) *core.FuncButton
- func (cv *Code) ConfigTextBuffer(tb *texteditor.Buffer)
- func (cv *Code) CopyRect()
- func (cv *Code) CountWords() string
- func (cv *Code) CountWordsRegion() string
- func (cv *Code) CurDebug() *DebugPanel
- func (cv *Code) CurPanel() int
- func (cv *Code) CursorToHistNext() bool
- func (cv *Code) CursorToHistPrev() bool
- func (cv *Code) CutRect()
- func (cv *Code) Debug()
- func (cv *Code) DebugAttach(pid uint64)
- func (cv *Code) DebugTest(testName string)
- func (cv *Code) Defaults()
- func (cv *Code) DiffFileNode(fna *filetree.Node, fnmB core.Filename)
- func (cv *Code) DiffFiles(fnmA, fnmB core.Filename)
- func (cv *Code) EditProjectSettings()
- func (cv *Code) EditRecentPaths()
- func (cv *Code) ExecCmd()
- func (cv *Code) ExecCmdFileNode(fn *filetree.Node)
- func (cv *Code) ExecCmdName(cmdName CmdName)
- func (cv *Code) ExecCmdNameActive(cmdName string)
- func (cv *Code) ExecCmdNameFileNode(fn *filetree.Node, cmdNm CmdName)
- func (cv *Code) ExecCmdNameFilename(fn string, cmdNm CmdName)
- func (cv *Code) ExecCmds(cmdNms CmdNames)
- func (cv *Code) ExecCmdsFileNode(fn *filetree.Node, cmdNames CmdNames)
- func (cv *Code) FileNodeForFile(fpath string, add bool) *filetree.Node
- func (cv *Code) FileNodeOpened(fn *filetree.Node)
- func (cv *Code) FileNodeRunExe(fn *filetree.Node)
- func (cv *Code) FileNodeSelected(fn *filetree.Node)
- func (cv *Code) Find(find string, repl string, ignoreCase bool, regExp bool, ...)
- func (cv *Code) FocusActiveTextEditor() *TextEditor
- func (cv *Code) FocusNextPanel()
- func (cv *Code) FocusOnPanel(panel int) bool
- func (cv *Code) FocusOnTabs() bool
- func (cv *Code) FocusPrevPanel()
- func (cv *Code) GrabSettings()
- func (cv *Code) GuessMainLang() bool
- func (cv *Code) HelpWiki()
- func (cv *Code) Indent() bool
- func (cv *Code) Init()
- func (cv *Code) IsEmpty() bool
- func (cv *Code) JoinParaLines()
- func (cv *Code) LangDefaults()
- func (cv *Code) LinkViewFile(fnm core.Filename) (*TextEditor, int, bool)
- func (cv *Code) LinkViewFileNode(fn *filetree.Node) (*TextEditor, int)
- func (cv *Code) LookupFun(data any, txt string, posLine, posChar int) (ld complete.Lookup)
- func (cv *Code) MakeToolbar(p *tree.Plan)
- func (cv *Code) NChangedFiles() int
- func (cv *Code) NewFile(filename string, addToVcs bool)
- func (cv *Code) NewProject(path core.Filename, folder string, mainLang fileinfo.Known, ...) *Code
- func (cv *Code) NextTextEditor() (*TextEditor, int)
- func (cv *Code) NextViewFile(fnm core.Filename) (*TextEditor, int, bool)
- func (cv *Code) NextViewFileNode(fn *filetree.Node) (*TextEditor, int)
- func (cv *Code) OpenConsoleTab()
- func (cv *Code) OpenFile(fnm string)
- func (cv *Code) OpenFileAtRegion(filename core.Filename, tr text.Region) (tv *TextEditor, ok bool)
- func (cv *Code) OpenFileNode(fn *filetree.Node) (bool, error)
- func (cv *Code) OpenFileURL(ur string, ftv *texteditor.Editor) bool
- func (cv *Code) OpenFindURL(ur string, ftv *texteditor.Editor) bool
- func (cv *Code) OpenNodeForTextEditor(tv *TextEditor) (*filetree.Node, int, bool)
- func (cv *Code) OpenPath(path core.Filename) *Code
- func (cv *Code) OpenProject(filename core.Filename) *Code
- func (cv *Code) OpenRecent(filename core.Filename)
- func (cv *Code) OverflowMenu(m *core.Scene)
- func (cv *Code) PanelIsOpen(panel int) bool
- func (cv *Code) ParseOpenFindURL(ur string, ftv *texteditor.Editor) (tv *TextEditor, reg text.Region, findBufStLn, findCount int, ok bool)
- func (cv *Code) PasteRect()
- func (cv *Code) ReCase(c strcase.Cases) string
- func (cv *Code) RecycleCmdBuf(cmdName string) (*texteditor.Buffer, bool)
- func (cv *Code) RecycleCmdTab(cmdName string) (*texteditor.Buffer, *texteditor.Editor, bool)
- func (cv *Code) RecycleTabTextEditor(name string, buf *texteditor.Buffer) *texteditor.Editor
- func (cv *Code) RegisterCopy(regNm RegisterName)
- func (cv *Code) RegisterPaste(ctx core.Widget)
- func (cv *Code) ReplaceInActive()
- func (cv *Code) RevertActiveView()
- func (cv *Code) Run()
- func (cv *Code) RunBuild()
- func (cv *Code) RunPostCmdsActiveView() bool
- func (cv *Code) RunPostCmdsFileNode(fn *filetree.Node) bool
- func (cv *Code) SaveActiveView()
- func (cv *Code) SaveActiveViewAs(filename core.Filename)
- func (cv *Code) SaveAll()
- func (cv *Code) SaveAllCheck(cancelOpt bool, fun func()) bool
- func (cv *Code) SaveAllOpenNodes()
- func (cv *Code) SaveProject()
- func (cv *Code) SaveProjectAs(filename core.Filename) bool
- func (cv *Code) SaveProjectIfExists(saveAllFiles bool) bool
- func (cv *Code) SelectOpenNode()
- func (cv *Code) SelectTabByName(name string) core.Widget
- func (cv *Code) SelectedFileNode() *filetree.Node
- func (cv *Code) SetActiveFileInfo(buf *texteditor.Buffer)
- func (t *Code) SetActiveLang(v fileinfo.Known) *Code
- func (cv *Code) SetActiveTextEditor(av *TextEditor) int
- func (cv *Code) SetActiveTextEditorIndex(idx int) *TextEditor
- func (cv *Code) SetArgVarVals()
- func (t *Code) SetOpenNodes(v OpenNodes) *Code
- func (t *Code) SetProjectFilename(v core.Filename) *Code
- func (t *Code) SetProjectRoot(v core.Filename) *Code
- func (cv *Code) SetStatus(msg string)
- func (t *Code) SetStatusMessage(v string) *Code
- func (cv *Code) SetWindowNameTitle()
- func (cv *Code) ShowFile(fname string, ln int) (*TextEditor, error)
- func (cv *Code) SpacesToTabs()
- func (cv *Code) Spell()
- func (cv *Code) Splits() *core.Splits
- func (cv *Code) SplitsEdit()
- func (cv *Code) SplitsSave(split SplitName)
- func (cv *Code) SplitsSaveAs(name, desc string)
- func (cv *Code) SplitsSetView(split SplitName)
- func (cv *Code) StatusBar() *core.Frame
- func (cv *Code) StatusText() *core.Text
- func (cv *Code) SwapTextEditors() bool
- func (cv *Code) Symbols()
- func (cv *Code) TabByName(name string) core.Widget
- func (cv *Code) TabDeleted(tabnm string)
- func (cv *Code) Tabs() *core.Tabs
- func (cv *Code) TabsToSpaces()
- func (cv *Code) TextBufForFile(fpath string, add bool) *texteditor.Buffer
- func (cv *Code) TextEditorButtonByIndex(idx int) *core.Button
- func (cv *Code) TextEditorButtonMenu(idx int, m *core.Scene)
- func (cv *Code) TextEditorByIndex(idx int) *TextEditor
- func (cv *Code) TextEditorForFile(fnm core.Filename) (*TextEditor, int, bool)
- func (cv *Code) TextEditorForFileNode(fn *filetree.Node) (*TextEditor, int, bool)
- func (cv *Code) TextEditorIndex(av *TextEditor) int
- func (cv *Code) UpdateFiles()
- func (cv *Code) UpdateStatusText()
- func (cv *Code) UpdateTextButtons()
- func (cv *Code) VCSLog() (vcs.Log, error)
- func (cv *Code) VCSUpdateAll()
- func (cv *Code) VersionControl() filetree.VersionControlName
- func (cv *Code) ViewFile(fnm core.Filename) (*TextEditor, int, bool)
- func (cv *Code) ViewFileInIndex(fnm core.Filename, idx int) (*TextEditor, int, bool)
- func (cv *Code) ViewFileNode(tv *TextEditor, vidx int, fn *filetree.Node)
- func (cv *Code) ViewOpenNodeName(name string)
- type Command
- func (cm *Command) AppendCmdOut(cv *Code, buf *texteditor.Buffer, out []byte)
- func (cm *Command) HasPrompts() (map[string]struct{}, bool)
- func (cm Command) Label() string
- func (cm *Command) LangMatch(lang fileinfo.Known) bool
- func (cm *Command) MarkupCmdOutput(out []byte) []byte
- func (cm *Command) PromptUser(cv *Code, buf *texteditor.Buffer, pvals map[string]struct{})
- func (cm *Command) Run(cv *Code, buf *texteditor.Buffer)
- func (cm *Command) RunAfterPrompts(cv *Code, buf *texteditor.Buffer)
- func (cm *Command) RunBuf(cv *Code, buf *texteditor.Buffer, cma *CmdAndArgs) bool
- func (cm *Command) RunBufWait(cv *Code, buf *texteditor.Buffer, cma *CmdAndArgs) bool
- func (cm *Command) RunNoBuf(cv *Code, cma *CmdAndArgs) bool
- func (cm *Command) RunStatus(cv *Code, buf *texteditor.Buffer, cmdstr string, err error, out []byte) bool
- type Commands
- func (cm *Commands) CmdByName(name CmdName, msg bool) (*Command, int, bool)
- func (cm *Commands) CopyFrom(cp Commands)
- func (cm *Commands) FilterCmdNames(lang fileinfo.Known, vcnm filetree.VersionControlName) [][]string
- func (cm *Commands) Open(filename core.Filename) error
- func (cm *Commands) OpenSettings() error
- func (cm *Commands) Save(filename core.Filename) error
- func (cm *Commands) SaveSettings() error
- func (cm *Commands) ViewStandard()
- type Console
- type DebugBreakStatus
- func (i DebugBreakStatus) Desc() string
- func (i DebugBreakStatus) Int64() int64
- func (i DebugBreakStatus) MarshalText() ([]byte, error)
- func (i *DebugBreakStatus) SetInt64(in int64)
- func (i *DebugBreakStatus) SetString(s string) error
- func (i DebugBreakStatus) String() string
- func (i *DebugBreakStatus) UnmarshalText(text []byte) error
- func (i DebugBreakStatus) Values() []enums.Enum
- type DebugPanel
- func (dv *DebugPanel) AddBreak(fpath string, line int)
- func (dv *DebugPanel) BackupBreaks()
- func (dv *DebugPanel) Config(cv *Code, known fileinfo.Known, exePath string)
- func (dv *DebugPanel) ConsoleText() *texteditor.Editor
- func (dv *DebugPanel) Continue()
- func (dv *DebugPanel) DbgCanStep() bool
- func (dv *DebugPanel) DbgIsActive() bool
- func (dv *DebugPanel) DbgIsAvail() bool
- func (dv *DebugPanel) DeleteAllBreaks()
- func (dv *DebugPanel) DeleteBreak(fpath string, line int)
- func (dv *DebugPanel) DeleteBreakImpl(fpath string, line int)
- func (dv *DebugPanel) DeleteBreakInBuf(fpath string, line int)
- func (dv *DebugPanel) DeleteBreakIndex(bidx int)
- func (dv *DebugPanel) DeleteCurPCInBuf()
- func (dv *DebugPanel) Destroy()
- func (dv *DebugPanel) Detach()
- func (dv *DebugPanel) FindFrames(fpath string, line int)
- func (dv *DebugPanel) Init()
- func (dv *DebugPanel) InitState(ds *cdebug.State)
- func (dv *DebugPanel) InitTabs()
- func (dv *DebugPanel) ListGlobalVars(filter string)
- func (dv *DebugPanel) MakeToolbar(p *tree.Plan)
- func (dv *DebugPanel) SetBreaks()
- func (dv *DebugPanel) SetCurPCInBuf(fpath string, line int)
- func (t *DebugPanel) SetDbgTime(v time.Time) *DebugPanel
- func (t *DebugPanel) SetExePath(v string) *DebugPanel
- func (dv *DebugPanel) SetFrame(depth int)
- func (dv *DebugPanel) SetStatus(stat cdebug.Status)
- func (t *DebugPanel) SetSup(v fileinfo.Known) *DebugPanel
- func (dv *DebugPanel) SetThread(threadID int)
- func (dv *DebugPanel) SetThreadIndex(thridx int)
- func (dv *DebugPanel) ShowBreakFile(bidx int)
- func (dv *DebugPanel) ShowFile(fpath string, line int)
- func (dv *DebugPanel) ShowTab(tab string)
- func (dv *DebugPanel) ShowVar(name string) error
- func (dv *DebugPanel) SingleStep()
- func (dv *DebugPanel) Start()
- func (dv *DebugPanel) StepInto()
- func (dv *DebugPanel) StepOut()
- func (dv *DebugPanel) StepOver()
- func (dv *DebugPanel) Stop()
- func (dv *DebugPanel) SyncBreaks()
- func (dv *DebugPanel) Tabs() *core.Tabs
- func (dv *DebugPanel) Toolbar() *core.Frame
- func (dv *DebugPanel) UpdateAllBreaks()
- func (dv *DebugPanel) UpdateBreakInBuf(fpath string, line int, stat DebugBreakStatus)
- func (dv *DebugPanel) UpdateFromState()
- func (dv *DebugPanel) UpdateTab(tab string)
- func (dv *DebugPanel) UpdateView()
- func (dv *DebugPanel) VarValue(varNm string) string
- type FileNode
- func (fn *FileNode) ContextMenu(m *core.Scene)
- func (fn *FileNode) EditFile()
- func (fn *FileNode) EditFiles()
- func (fn *FileNode) ExecCmdFile()
- func (fn *FileNode) ExecCmdNameFile(cmdNm string)
- func (fn *FileNode) Init()
- func (fn *FileNode) RenameFiles()
- func (fn *FileNode) SetRunExec()
- func (fn *FileNode) SetRunExecs()
- type FileSettings
- type FindPanel
- func (fv *FindPanel) CheckValidRegexp() bool
- func (fv *FindPanel) CompileRegexp() bool
- func (fv *FindPanel) FindAction()
- func (fv *FindPanel) HighlightFinds(tv, ftv *texteditor.Editor, fbStLn, fCount int, find string)
- func (fv *FindPanel) Init()
- func (fv *FindPanel) NextFind()
- func (fv *FindPanel) OnAdd()
- func (fv *FindPanel) OpenFindURL(ur string, ftv *texteditor.Editor) bool
- func (fv *FindPanel) Params() *FindParams
- func (fv *FindPanel) PrevFind()
- func (fv *FindPanel) ReplaceAction() bool
- func (fv *FindPanel) ReplaceAll()
- func (fv *FindPanel) ReplaceAllAction()
- func (t *FindPanel) SetCode(v *Code) *FindPanel
- func (t *FindPanel) SetRe(v *regexp.Regexp) *FindPanel
- func (t *FindPanel) SetTime(v time.Time) *FindPanel
- func (fv *FindPanel) ShowResults(res []filetree.SearchResults)
- func (fv *FindPanel) TextEditor() *texteditor.Editor
- type FindParams
- type LanguageOptions
- type Languages
- func (lt *Languages) CopyFrom(cp Languages)
- func (lt *Languages) Open(filename core.Filename) error
- func (lt *Languages) OpenSettings() error
- func (lt *Languages) RevertToStandard()
- func (lt *Languages) Save(filename core.Filename) error
- func (lt *Languages) SaveSettings() error
- func (lt Languages) Validate() bool
- func (lt *Languages) ViewStandard()
- type OpenNodes
- func (on *OpenNodes) Add(fn *filetree.Node) bool
- func (on *OpenNodes) AddImpl(fn *filetree.Node) bool
- func (on *OpenNodes) ByStringName(name string) *filetree.Node
- func (on *OpenNodes) Delete(fn *filetree.Node) bool
- func (on *OpenNodes) DeleteDeleted()
- func (on *OpenNodes) DeleteIndex(idx int)
- func (on *OpenNodes) FindPath(path string) *filetree.Node
- func (on *OpenNodes) NChanged() int
- func (on *OpenNodes) Strings() []string
- type ProjectSettings
- type RegisterName
- type Registers
- type SettingsData
- func (se *SettingsData) Apply()
- func (se *SettingsData) ApplyEnvVars()
- func (se *SettingsData) Defaults()
- func (se *SettingsData) EditCmds()
- func (se *SettingsData) EditLangOpts()
- func (se *SettingsData) EditRegisters()
- func (se *SettingsData) EditSplits()
- func (se *SettingsData) MakeToolbar(p *tree.Plan)
- func (se *SettingsData) Open() error
- func (se *SettingsData) Save() error
- type SpellPanel
- func (sv *SpellPanel) AcceptSuggestion(s string)
- func (sv *SpellPanel) Change()
- func (sv *SpellPanel) ChangeBar() *core.Toolbar
- func (sv *SpellPanel) ChangeText() *core.TextField
- func (sv *SpellPanel) CheckNext()
- func (sv *SpellPanel) Config(cv *Code, atv *TextEditor)
- func (sv *SpellPanel) Destroy()
- func (sv *SpellPanel) Init()
- func (t *SpellPanel) SetCode(v *Code) *SpellPanel
- func (t *SpellPanel) SetCurIndex(v int) *SpellPanel
- func (t *SpellPanel) SetCurLn(v int) *SpellPanel
- func (t *SpellPanel) SetErrs(v lexer.Line) *SpellPanel
- func (t *SpellPanel) SetLastAction(v *core.Button) *SpellPanel
- func (t *SpellPanel) SetSuggest(v ...string) *SpellPanel
- func (t *SpellPanel) SetText(v *TextEditor) *SpellPanel
- func (t *SpellPanel) SetUnkLex(v lexer.Lex) *SpellPanel
- func (t *SpellPanel) SetUnkWord(v string) *SpellPanel
- func (sv *SpellPanel) SpellBar() *core.Toolbar
- func (sv *SpellPanel) SuggestView() *core.List
- func (sv *SpellPanel) UnkEndPos() lexer.Pos
- func (sv *SpellPanel) UnkStartPos() lexer.Pos
- func (sv *SpellPanel) UnknownBar() *core.Toolbar
- func (sv *SpellPanel) UnknownText() *core.TextField
- type Split
- type SplitName
- type Splits
- func (lt *Splits) Add(name, desc string, splits []float32, tabsUnder bool) (*Split, int)
- func (lt *Splits) CopyFrom(cp Splits)
- func (lt *Splits) Names() []string
- func (lt *Splits) Open(filename core.Filename) error
- func (lt *Splits) OpenSettings() error
- func (lt *Splits) Save(filename core.Filename) error
- func (lt *Splits) SaveSettings() error
- func (lt *Splits) SplitByName(name SplitName) (*Split, int, bool)
- type SymNode
- type SymScopes
- func (i SymScopes) Desc() string
- func (i SymScopes) Int64() int64
- func (i SymScopes) MarshalText() ([]byte, error)
- func (i *SymScopes) SetInt64(in int64)
- func (i *SymScopes) SetString(s string) error
- func (i SymScopes) String() string
- func (i *SymScopes) UnmarshalText(text []byte) error
- func (i SymScopes) Values() []enums.Enum
- type SymTree
- type SymbolsPanel
- func (sv *SymbolsPanel) Config(cv *Code, sp SymbolsParams)
- func (sv *SymbolsPanel) FrameWidget() *core.Frame
- func (sv *SymbolsPanel) Init()
- func (sv *SymbolsPanel) OpenFile()
- func (sv *SymbolsPanel) OpenPackage()
- func (sv *SymbolsPanel) Params() *SymbolsParams
- func (sv *SymbolsPanel) RefreshAction()
- func (sv *SymbolsPanel) ScopeChooser() *core.Chooser
- func (sv *SymbolsPanel) SearchText() *core.TextField
- func (t *SymbolsPanel) SetCode(v *Code) *SymbolsPanel
- func (t *SymbolsPanel) SetMatch(v string) *SymbolsPanel
- func (t *SymbolsPanel) SetSymParams(v SymbolsParams) *SymbolsPanel
- func (t *SymbolsPanel) SetSyms(v *SymNode) *SymbolsPanel
- func (sv *SymbolsPanel) Toolbar() *core.Toolbar
- func (sv *SymbolsPanel) UpdateSymbols()
- type SymbolsParams
- type TextEditor
- func (ed *TextEditor) ClearBreakpoint(ln int)
- func (ed *TextEditor) ContextMenu(m *core.Scene)
- func (ed *TextEditor) CurDebug() (*DebugPanel, bool)
- func (ed *TextEditor) DebugVarValueAtPos(pos image.Point) string
- func (ed *TextEditor) FindFrames(ln int)
- func (ed *TextEditor) HandleDebugDoubleClick(e events.Event, tpos lexer.Pos)
- func (ed *TextEditor) HasBreakpoint(ln int) bool
- func (ed *TextEditor) Init()
- func (ed *TextEditor) LineNumberDoubleClick(tpos lexer.Pos)
- func (ed *TextEditor) SetBreakpoint(ln int)
- func (t *TextEditor) SetCode(v *Code) *TextEditor
- func (ed *TextEditor) ToggleBreakpoint(ln int)
- func (ed *TextEditor) WidgetTooltip(pos image.Point) (string, image.Point)
- type VarView
- func (vv *VarView) Form() *core.Form
- func (vv *VarView) Init()
- func (vv *VarView) MakeToolbar(p *tree.Plan)
- func (t *VarView) SetDbgView(v *DebugPanel) *VarView
- func (vv *VarView) SetVar(vr *cdebug.Variable, frinfo string)
- func (vv *VarView) Splits() *core.Splits
- func (vv *VarView) Tree() *core.Tree
Constants ¶
const ( CmdWait = true CmdNoWait = false CmdFocus = true CmdNoFocus = false CmdConfirm = true CmdNoConfirm = false )
Use these for more obvious command options
const ( FileTreeIndex = iota TextEditor1Index TextEditor2Index TabsIndex )
These are then the fixed indices of the different elements in the splitview
const ( DebugTabConsole = "Console" DebugTabBreaks = "Breaks" DebugTabStack = "Stack" DebugTabTasks = "Tasks" DebugTabThreads = "Threads" DebugTabVars = "Vars" DebugTabFrames = "Find Frames" DebugTabGlobals = "Global Vars" )
const ( // move to next panel to the right KeyNextPanel keymap.Functions = keymap.FunctionsN + iota // move to prev panel to the left KeyPrevPanel // open a new file in active texteditor KeyFileOpen // select an open buffer to edit in active texteditor KeyBufSelect // open active file in other view KeyBufClone // save active texteditor buffer to its file KeyBufSave // save as active texteditor buffer to its file KeyBufSaveAs // close active texteditor buffer KeyBufClose // execute a command on active texteditor buffer KeyExecCmd // copy rectangle KeyRectCopy // cut rectangle KeyRectCut // paste rectangle KeyRectPaste // copy selection to named register KeyRegCopy // paste selection from named register KeyRegPaste // comment out region KeyCommentOut // indent region KeyIndent // jump to line (same as keyfun.Jump) KeyJump // set named splitter config KeySetSplit // build overall project KeyBuildProject // run overall project KeyRunProject )
const NTextEditors = 2
NTextEditors is the number of text views to create -- to keep things simple and consistent (e.g., splitter settings always have the same number of values), we fix this degree of freedom, and have flexibility in the splitter settings for what to actually show.
Variables ¶
var ( // RecentPaths is a slice of recent file paths RecentPaths core.FilePaths // SavedPathsFilename is the name of the saved file paths file in Cogent Code data directory SavedPathsFilename = "saved-paths.json" )
var ArgVars = map[string]ArgVarInfo{ "{FilePath}": {"Current file name with full path.", ArgVarFile}, "{Filename}": {"Current file name only, without path.", ArgVarFile}, "{FileExt}": {"Extension of current file name.", ArgVarExt}, "{FileExtLC}": {"Extension of current file name, lowercase.", ArgVarExt}, "{FilenameNoExt}": {"Current file name without path and extension.", ArgVarFile}, "{FileDir}": {"Name only of current file's directory.", ArgVarDir}, "{FileDirPath}": {"Full path to current file's directory.", ArgVarDir}, "{FileDirProjectRel}": {"Path to current file's directory relative to project root.", ArgVarDir}, "{ProjectDir}": {"Current project directory name, without full path.", ArgVarDir}, "{ProjectPath}": {"Full path to current project directory.", ArgVarDir}, "{BuildDir}": {"Full path to BuildDir specified in project prefs -- the default Build.", ArgVarDir}, "{BuildDirRel}": {"Path to BuildDir relative to project root.", ArgVarDir}, "{BuildTarg}": {"Build target specified in prefs BuildTarg, just filename by itself, without path.", ArgVarFile}, "{BuildTargPath}": {"Full path to build target specified in prefs BuildTarg.", ArgVarFile}, "{BuildTargDirPath}": {"Full path to build target directory, without filename.", ArgVarDir}, "{BuildTargDirPathRel}": {"Project-relative path to build target directory, without filename.", ArgVarDir}, "{RunExec}": {"Run-time executable file RunExec specified in project prefs -- just the raw name of the file, without path.", ArgVarFile}, "{RunExecPath}": {"Full path to the run-time executable file RunExec specified in project prefs.", ArgVarFile}, "{RunExecDirPath}": {"Full path to the directory of the run-time executable file RunExec specified in project prefs.", ArgVarDir}, "{RunExecDirPathRel}": {"Project-root relative path to the directory of the run-time executable file RunExec specified in project prefs.", ArgVarDir}, "{CurLine}": {"Cursor current line number (starts at 1).", ArgVarPos}, "{CurCol}": {"Cursor current column number (starts at 0).", ArgVarPos}, "{SelStartLine}": {"Selection starting line (same as CurLine if no selection).", ArgVarPos}, "{SelStartCol}": {"Selection starting column (same as CurCol if no selection).", ArgVarPos}, "{SelEndLine}": {"Selection ending line (same as CurLine if no selection).", ArgVarPos}, "{SelEndCol}": {"Selection ending column (same as CurCol if no selection).", ArgVarPos}, "{CurSel}": {"Currently selected text.", ArgVarText}, "{CurLineText}": {"Current line text under cursor.", ArgVarText}, "{CurWord}": {"Current word under cursor.", ArgVarText}, "{PromptFilePath}": {"Prompt user for a file, and this is the full path to that file.", ArgVarPrompt}, "{PromptFilename}": {"Prompt user for a file, and this is the filename (only) of that file.", ArgVarPrompt}, "{PromptFileDir}": {"Prompt user for a file, and this is the directory name (only) of that file.", ArgVarPrompt}, "{PromptFileDirPath}": {"Prompt user for a file, and this is the full path to that directory.", ArgVarPrompt}, "{PromptFileDirProjectRel}": {"Prompt user for a file, and this is the path of that directory relative to the project root.", ArgVarPrompt}, "{PromptString1}": {"Prompt user for a string -- this is it.", ArgVarPrompt}, "{PromptString2}": {"Prompt user for another string -- this is it.", ArgVarPrompt}, "{PromptBranch}": {"Prompt user for a VCS branch.", ArgVarPrompt}, }
ArgVars are variables that can be used for arguments to commands in CmdAndArgs
var AvailableLanguagesChanged = false
AvailableLanguagesChanged is used to update core.LangsView toolbars via following menu, toolbar properties update methods -- not accurate if editing any other map but works for now..
var AvailableRegisterNames []string
AvailableRegisterNames are the names of the current AvailRegisters -- used for some choosers
var AvailableRegistersChanged = false
AvailableRegistersChanged is used to update toolbars via following menu, toolbar properties update methods -- not accurate if editing any other map but works for now..
var AvailableSplitNames []string
AvailableSplitNames are the names of the current AvailableSplits -- used for some choosers
var AvailableSplitsChanged = false
AvailableSplitsChanged is used to update toolbars via following menu, toolbar properties update methods -- not accurate if editing any other map but works for now..
var CatNoEdit = map[fileinfo.Known]bool{ fileinfo.Rtf: true, fileinfo.MSWord: true, fileinfo.OpenText: true, fileinfo.OpenPres: true, fileinfo.MSPowerpoint: true, fileinfo.EBook: true, fileinfo.EPub: true, }
CatNoEdit are the files to NOT edit from categories: Doc, Data
var CmdNoUserPrompt bool
CmdNoUserPrompt can be set to true to prevent user from being prompted for strings this is useful when a custom outer-loop has already set the string values. this will be reset automatically after command is run.
var CmdOutStatusLen = 80
CmdOutStatusLen is amount of command output to include in the status update
var CmdPrompt1Vals = map[string]string{}
CmdPrompt1Vals holds last values for PromptString1 per command, so that each such command has its own appropriate history
var CmdPrompt2Vals = map[string]string{}
CmdPrompt2Vals holds last values for PromptString2 per command, so that each such command has its own appropriate history
var CmdWaitOverride bool
CmdWaitOverride will cause the next commands that are run to be in wait mode (sequentially, waiting for completion after each), instead of running each in a separate process as is typical. Don't forget to reset it after commands. This is important when running multiple of the same command, to prevent collisions in the output buffer.
var CommandIcons = map[string]icons.Icon{"File": icons.File, "Git": icons.Git, "Build": icons.Build, "Core": icons.CogentCore, "Go": icons.Go}
var CommandSettingsFilename = "command-settings.toml"
CommandSettingsFilename is the name of the settings file in the app settings directory for saving / loading your CustomCommands commands list
var CustomCommands = Commands{}
CustomCommands is user-specific list of commands saved in settings available for all Code projects. These will override StdCmds with the same names.
var CustomCommandsChanged = false
CustomCommandsChanged is used to update core.CmdsView toolbars via following menu, toolbar properties update methods.
var ( // DebugBreakColors are the colors indicating different breakpoint statuses. DebugBreakColors = map[DebugBreakStatus]image.Image{ DebugBreakInactive: colors.Scheme.Warn.Base, DebugBreakActive: colors.Scheme.Error.Base, DebugBreakCurrent: colors.Scheme.Success.Base, DebugPCCurrent: colors.Scheme.Primary.Base, } )
var DebugStatusColors = map[cdebug.Status]image.Image{ cdebug.NotInit: colors.Scheme.SurfaceContainerHighest, cdebug.Error: colors.Scheme.Error.Container, cdebug.Building: colors.Scheme.Warn.Container, cdebug.Ready: colors.Scheme.Success.Container, cdebug.Running: colors.Scheme.Tertiary.Container, cdebug.Stopped: colors.Scheme.Warn.Container, cdebug.Breakpoint: colors.Scheme.Warn.Container, cdebug.Finished: colors.Scheme.SurfaceContainerHighest, }
DebugStatusColors contains the status colors for different debugging states.
var LanguageSettingsFilename = "language-settings.toml"
LanguageSettingsFilename is the name of the settings file in the app settings directory for saving / loading the default AvailableLanguages languages list
var RegisterSettingsFilename = "register-settings.toml"
RegisterSettingsFilename is the name of the settings file in the app settings directory for saving / loading the default AvailableRegisters
var Settings = &SettingsData{ SettingsBase: core.SettingsBase{ Name: "Code", File: filepath.Join(core.TheApp.DataDir(), "Cogent Code", "settings.toml"), }, }
Settings are the overall Code settings
var SplitsSettingsFilename = "splits-settings.json"
SplitsSettingsFilename is the name of the settings file in App prefs directory for saving / loading the default AvailSplits
var StandardCommands = Commands{ {Cat: "Build", Name: "Run Project", Desc: "run RunExec executable set in project", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "{RunExecPath}"}}, Dir: "{RunExecDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Build", Name: "Run Prompt", Desc: "run any command you enter at the prompt", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "{PromptString1}"}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Build", Name: "Make", Desc: "run make with no args", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "make"}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Build", Name: "Make Prompt", Desc: "run make with prompted make target", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "make", Args: []string{"{PromptString1}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "File", Name: "Grep", Desc: "recursive grep of all files for prompted value", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "grep", Args: []string{"-R", "-e", "{PromptString1}", "{FileDirPath}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "File", Name: "Open", Desc: "open file using OS 'open' command", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "open", Args: []string{"{FilePath}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "File", Name: "Open Target", Desc: "open project target file using OS 'open' command", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "open", Args: []string{"{RunExecPath}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Go", Name: "Imports File", Desc: "run goimports on file", Lang: fileinfo.Go, Cmds: []CmdAndArgs{{Cmd: "goimports", Args: []string{"-w", "{FilePath}"}}}, Dir: "{FileDirPath}", Wait: CmdWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Go", Name: "Fmt File", Desc: "run go fmt on file", Lang: fileinfo.Go, Cmds: []CmdAndArgs{{Cmd: "gofmt", Args: []string{"-w", "{FilePath}"}}}, Dir: "{FileDirPath}", Wait: CmdWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Go", Name: "Build Dir", Desc: "run go build to build in current dir", Lang: fileinfo.Go, Cmds: []CmdAndArgs{{Cmd: "go", Args: []string{"build", "-v"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Go", Name: "Build Proj", Desc: "run go build for project BuildDir", Lang: fileinfo.Go, Cmds: []CmdAndArgs{{Cmd: "go", Args: []string{"build", "-v"}}}, Dir: "{BuildDir}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Go", Name: "Install Dir", Desc: "run go install in current dir", Lang: fileinfo.Go, Cmds: []CmdAndArgs{{Cmd: "go", Args: []string{"install", "-v"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Go", Name: "Generate", Desc: "run go generate in current dir", Lang: fileinfo.Go, Cmds: []CmdAndArgs{{Cmd: "go", Args: []string{"generate"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Go", Name: "Test", Desc: "run go test in current dir. Options include: -run TestName or -bench", Lang: fileinfo.Go, Cmds: []CmdAndArgs{{Cmd: "go", Args: []string{"test", "-v", "{PromptString1}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Go", Name: "Vet", Desc: "run go vet in current dir", Lang: fileinfo.Go, Cmds: []CmdAndArgs{{Cmd: "go", Args: []string{"vet"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Go", Name: "Mod Tidy", Desc: "run go mod tidy in current dir", Lang: fileinfo.Go, Cmds: []CmdAndArgs{{Cmd: "go", Args: []string{"mod", "tidy"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Go", Name: "Mod Init", Desc: "run go mod init in current dir with module path from prompt", Lang: fileinfo.Go, Cmds: []CmdAndArgs{{Cmd: "go", Args: []string{"mod", "init", "{PromptString1}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Go", Name: "Get", Desc: "run go get on package(s) you enter at prompt", Lang: fileinfo.Go, Cmds: []CmdAndArgs{{Cmd: "go", Args: []string{"get", "{PromptString1}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Go", Name: "Get Update", Desc: "run go get -u (update) on package(s) you enter at prompt. use ./... for all.", Lang: fileinfo.Go, Cmds: []CmdAndArgs{{Cmd: "go", Args: []string{"get", "-u", "{PromptString1}"}, Default: "./..."}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Add", Desc: "git add file", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"add", "{FilePath}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Switch To Branch", Desc: "git switch to an existing branch", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"switch", "{PromptBranch}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Switch", Desc: "git switch to new branch or existing commit: -c or -C (force) <branch> to create new; --detatch <commit> to switch to older (non-HEAD) commit; --orphan to abandon history", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"switch", "{PromptString1}"}, Default: "-c "}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Restore", Desc: "git restore: file, directory -- undoes any current changes and restores from last commit; -s option specifies source -- also available as revert in file picker", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"restore", "{PromptString1}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Checkout", Desc: "git checkout: file, directory, branch; -b <branch> creates a new branch", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"checkout", "{PromptString1}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Status", Desc: "git status", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"status"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Diff", Desc: "git diff -- see changes since last checkin", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"diff"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm, Hilight: fileinfo.Diff}, {Cat: "Git", Name: "Log", Desc: "git log", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"log"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Commit", Desc: "git commit", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"commit", "-am", "{PromptString1}"}, PromptIsString: true}}, Dir: "{FileDirPath}", Wait: CmdWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Pull Branch", Desc: "git pull from existing branch", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"pull", "origin", "{PromptBranch}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Pull", Desc: "git pull", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"pull", "{PromptString1}"}, Default: "origin"}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Push", Desc: "git push to update remote (origin) for given branch", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"push", "origin", "{PromptBranch}"}, Default: "origin"}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Push Force", Desc: "git push to update remote (origin) for given branch -- force -- needed for example after rebase or merge with conflicts", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"push", "--force", "origin", "{PromptBranch}"}, Default: "origin"}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Stash", Desc: "git stash: push / pop local changes for later without committing, resetting to HEAD: also list, show, drop, clear", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"stash", "{PromptString1}"}, Default: "push"}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Branch", Desc: "git branch: -a shows all; --list shows local; <branchname> makes a new one, optionally given sha; -d to delete; -r delete remote; -D force delete", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"branch", "{PromptString1}"}, Default: "-a"}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Branch Delete", Desc: "git branch -d -r selected branch name", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"branch", "-d", "-r", "{PromptBranch}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Rebase", Desc: "git rebase: updates current branch to given branch, often master", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"rebase", "{PromptBranch}"}, Default: "master"}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Rebase Continue", Desc: "git rebase: updates current branch to given branch, often master -- does --continue to continue process", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"rebase", "--continue"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Reset", Desc: "git reset: resets current state to given source -- use --hard to override -- CAN RESULT IN LOSS OF CHANGES -- make sure everything is committed", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"reset", "{PromptString1}"}, Default: "--hard origin/master"}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Remote", Desc: "git remote: prune origin = remove stale branches; show; add <name> <URL>; remove <name>; get-url / set-url <name>", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "git", Args: []string{"remote", "{PromptString1}"}, Default: "prune origin"}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Git", Name: "Count LOC", Desc: "runs bash -c git ls-files with command sequence that counts lines of code in git repository -- edit with extra | grep steps to filter accordingly", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "bash", Args: []string{"-c", "{PromptString1}"}, Default: `"git ls-files | xargs wc -l"`}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "SVN", Name: "Add", Desc: "svn add file", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "svn", Args: []string{"add", "{FilePath}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "SVN", Name: "Status", Desc: "svn status", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "svn", Args: []string{"status"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "SVN", Name: "Info", Desc: "svn info", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "svn", Args: []string{"info"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "SVN", Name: "Log", Desc: "svn log", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "svn", Args: []string{"log", "-v"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "SVN", Name: "Commit Project", Desc: "svn commit for entire project directory", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "svn", Args: []string{"commit", "-m", "{PromptString1}"}, PromptIsString: true}}, Dir: "{ProjectPath}", Wait: CmdWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "SVN", Name: "Commit Dir", Desc: "svn commit in directory of current file", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "svn", Args: []string{"commit", "-m", "{PromptString1}"}, PromptIsString: true}}, Dir: "{FileDirPath}", Wait: CmdWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "SVN", Name: "Update", Desc: "svn update", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "svn", Args: []string{"update"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "LaTeX", Name: "LaTeX PDF", Desc: "run PDFLaTeX on file", Lang: fileinfo.TeX, Cmds: []CmdAndArgs{{Cmd: "pdflatex", Args: []string{"-file-line-error", "-interaction=nonstopmode", "{FilePath}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "LaTeX", Name: "BibTeX", Desc: "run BibTeX on file", Lang: fileinfo.TeX, Cmds: []CmdAndArgs{{Cmd: "bibtex", Args: []string{"{FilenameNoExt}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "LaTeX", Name: "Biber", Desc: "run Biber on file", Lang: fileinfo.TeX, Cmds: []CmdAndArgs{{Cmd: "biber", Args: []string{"{FilenameNoExt}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "LaTeX", Name: "CleanTeX", Desc: "remove aux LaTeX files", Lang: fileinfo.TeX, Cmds: []CmdAndArgs{{Cmd: "rm", Args: []string{"*.aux", "*.log", "*.blg", "*.bbl", "*.fff", "*.lof", "*.ttt", "*.toc", "*.spl"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Core", Name: "Run", Desc: "Builds and runs go executable in current directory: core run [ios | android | web | darwin | windows | linux]", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "core", Args: []string{"run", "{PromptString1}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Core", Name: "Install", Desc: "Installs go executable in current directory: core install -t [ios | android | web | darwin | windows | linux]", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "core", Args: []string{"install", "{PromptString1}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Core", Name: "Next-Release", Desc: "increments the patch-level version number and pushes a release tag at this new version", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "core", Args: []string{"next-release"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Core", Name: "Release", Desc: "sets the version to the given value at the prompt and pushes a release tag at this version", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "core", Args: []string{"release", "{PromptString1}"}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Core", Name: "Generate All", Desc: "runs core generate ./... to update all generated files in current dir and below", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "core", Args: []string{"generate", "./..."}}}, Dir: "{FileDirPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Core", Name: "Changed", Desc: "show which packages are changed, at the root project level", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "core", Args: []string{"changed"}}}, Dir: "{ProjectPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, {Cat: "Core", Name: "Pull", Desc: "pull all packages at the root project level", Lang: fileinfo.Any, Cmds: []CmdAndArgs{{Cmd: "core", Args: []string{"pull"}}}, Dir: "{ProjectPath}", Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm}, }
StandardCommands is the original compiled-in set of standard commands.
var StandardKeyMaps = keymap.Maps{ {"MacStandard", "Standard Mac KeyMap", keymap.Map{ "Control+Tab": KeyNextPanel, "Control+Shift+Tab": KeyPrevPanel, "Control+X o": KeyNextPanel, "Control+X Control+O": KeyNextPanel, "Control+X p": KeyPrevPanel, "Control+X Control+P": KeyPrevPanel, "Control+X f": KeyFileOpen, "Control+X Control+F": KeyFileOpen, "Control+X b": KeyBufSelect, "Control+X Control+B": KeyBufSelect, "Control+X s": KeyBufSave, "Control+X Control+S": KeyBufSave, "Control+X w": KeyBufSaveAs, "Control+X Control+W": KeyBufSaveAs, "Control+X k": KeyBufClose, "Control+X Control+K": KeyBufClose, "Control+X c": KeyExecCmd, "Control+X Control+C": KeyExecCmd, "Control+C c": KeyExecCmd, "Control+C Control+C": KeyExecCmd, "Control+C o": KeyBufClone, "Control+C Control+O": KeyBufClone, "Control+X x": KeyRegCopy, "Control+X g": KeyRegPaste, "Control+X Control+X": KeyRectCut, "Control+X Control+Y": KeyRectPaste, "Control+X Alt+∑": KeyRectCopy, "Control+C k": KeyCommentOut, "Control+C Control+K": KeyCommentOut, "Control+X i": KeyIndent, "Control+X Control+I": KeyIndent, "Control+X j": KeyJump, "Control+X Control+J": KeyJump, "Control+X v": KeySetSplit, "Control+X Control+V": KeySetSplit, "Control+X m": KeyBuildProject, "Control+X Control+M": KeyBuildProject, "Control+X r": KeyRunProject, "Control+X Control+R": KeyRunProject, }}, {"MacEmacs", "Mac with emacs-style navigation -- emacs wins in conflicts", keymap.Map{ "Control+Tab": KeyNextPanel, "Control+Shift+Tab": KeyPrevPanel, "Control+X o": KeyNextPanel, "Control+X Control+O": KeyNextPanel, "Control+X p": KeyPrevPanel, "Control+X Control+P": KeyPrevPanel, "Control+X f": KeyFileOpen, "Control+X Control+F": KeyFileOpen, "Control+X b": KeyBufSelect, "Control+X Control+B": KeyBufSelect, "Control+X s": KeyBufSave, "Control+X Control+S": KeyBufSave, "Control+X w": KeyBufSaveAs, "Control+X Control+W": KeyBufSaveAs, "Control+X k": KeyBufClose, "Control+X Control+K": KeyBufClose, "Control+X c": KeyExecCmd, "Control+X Control+C": KeyExecCmd, "Control+C c": KeyExecCmd, "Control+C Control+C": KeyExecCmd, "Control+C o": KeyBufClone, "Control+C Control+O": KeyBufClone, "Control+X x": KeyRegCopy, "Control+X g": KeyRegPaste, "Control+X Control+X": KeyRectCut, "Control+X Control+Y": KeyRectPaste, "Control+X Alt+∑": KeyRectCopy, "Control+C k": KeyCommentOut, "Control+C Control+K": KeyCommentOut, "Control+X i": KeyIndent, "Control+X Control+I": KeyIndent, "Control+X j": KeyJump, "Control+X Control+J": KeyJump, "Control+X v": KeySetSplit, "Control+X Control+V": KeySetSplit, "Control+X m": KeyBuildProject, "Control+X Control+M": KeyBuildProject, "Control+X r": KeyRunProject, "Control+X Control+R": KeyRunProject, }}, {"LinuxEmacs", "Linux with emacs-style navigation -- emacs wins in conflicts", keymap.Map{ "Control+Tab": KeyNextPanel, "Control+Shift+Tab": KeyPrevPanel, "Control+X o": KeyNextPanel, "Control+X Control+O": KeyNextPanel, "Control+X p": KeyPrevPanel, "Control+X Control+P": KeyPrevPanel, "Control+X f": KeyFileOpen, "Control+X Control+F": KeyFileOpen, "Control+X b": KeyBufSelect, "Control+X Control+B": KeyBufSelect, "Control+X s": KeyBufSave, "Control+X Control+S": KeyBufSave, "Control+X w": KeyBufSaveAs, "Control+X Control+W": KeyBufSaveAs, "Control+X k": KeyBufClose, "Control+X Control+K": KeyBufClose, "Control+X c": KeyExecCmd, "Control+X Control+C": KeyExecCmd, "Control+C c": KeyExecCmd, "Control+C Control+C": KeyExecCmd, "Control+C o": KeyBufClone, "Control+C Control+O": KeyBufClone, "Control+X x": KeyRegCopy, "Control+X g": KeyRegPaste, "Control+X Control+X": KeyRectCut, "Control+X Control+Y": KeyRectPaste, "Control+X Alt+∑": KeyRectCopy, "Control+C k": KeyCommentOut, "Control+C Control+K": KeyCommentOut, "Control+X i": KeyIndent, "Control+X Control+I": KeyIndent, "Control+X j": KeyJump, "Control+X Control+J": KeyJump, "Control+X v": KeySetSplit, "Control+X Control+V": KeySetSplit, "Control+M m": KeyBuildProject, "Control+M Control+M": KeyBuildProject, "Control+M r": KeyRunProject, "Control+M Control+R": KeyRunProject, }}, {"LinuxStandard", "Standard Linux key map", keymap.Map{ "Control+Tab": KeyNextPanel, "Control+Shift+Tab": KeyPrevPanel, "Control+E o": KeyNextPanel, "Control+E Control+O": KeyNextPanel, "Control+E p": KeyPrevPanel, "Control+E Control+P": KeyPrevPanel, "Control+O": KeyFileOpen, "Control+E f": KeyFileOpen, "Control+E Control+F": KeyFileOpen, "Control+E b": KeyBufSelect, "Control+E Control+B": KeyBufSelect, "Control+S": KeyBufSave, "Control+Shift+S": KeyBufSaveAs, "Control+E s": KeyBufSave, "Control+E Control+S": KeyBufSave, "Control+E w": KeyBufSaveAs, "Control+E Control+W": KeyBufSaveAs, "Control+E k": KeyBufClose, "Control+E Control+K": KeyBufClose, "Control+B c": KeyExecCmd, "Control+B Control+C": KeyExecCmd, "Control+B o": KeyBufClone, "Control+B Control+O": KeyBufClone, "Control+E x": KeyRegCopy, "Control+E g": KeyRegPaste, "Control+E Control+X": KeyRectCut, "Control+E Control+Y": KeyRectPaste, "Control+E Alt+∑": KeyRectCopy, "Control+/": KeyCommentOut, "Control+B k": KeyCommentOut, "Control+B Control+K": KeyCommentOut, "Control+E i": KeyIndent, "Control+E Control+I": KeyIndent, "Control+E j": KeyJump, "Control+E Control+J": KeyJump, "Control+E v": KeySetSplit, "Control+E Control+V": KeySetSplit, "Control+E m": KeyBuildProject, "Control+E Control+M": KeyBuildProject, "Control+E r": KeyRunProject, "Control+E Control+R": KeyRunProject, }}, {"WindowsStandard", "Standard Windows key map", keymap.Map{ "Control+Tab": KeyNextPanel, "Control+Shift+Tab": KeyPrevPanel, "Control+E o": KeyNextPanel, "Control+E Control+O": KeyNextPanel, "Control+E p": KeyPrevPanel, "Control+E Control+P": KeyPrevPanel, "Control+O": KeyFileOpen, "Control+E f": KeyFileOpen, "Control+E Control+F": KeyFileOpen, "Control+E b": KeyBufSelect, "Control+E Control+B": KeyBufSelect, "Control+S": KeyBufSave, "Control+Shift+S": KeyBufSaveAs, "Control+E s": KeyBufSave, "Control+E Control+S": KeyBufSave, "Control+E w": KeyBufSaveAs, "Control+E Control+W": KeyBufSaveAs, "Control+E k": KeyBufClose, "Control+E Control+K": KeyBufClose, "Control+B c": KeyExecCmd, "Control+B Control+C": KeyExecCmd, "Control+B o": KeyBufClone, "Control+B Control+O": KeyBufClone, "Control+E x": KeyRegCopy, "Control+E g": KeyRegPaste, "Control+E Control+X": KeyRectCut, "Control+E Control+Y": KeyRectPaste, "Control+E Alt+∑": KeyRectCopy, "Control+/": KeyCommentOut, "Control+B k": KeyCommentOut, "Control+B Control+K": KeyCommentOut, "Control+E i": KeyIndent, "Control+E Control+I": KeyIndent, "Control+E j": KeyJump, "Control+E Control+J": KeyJump, "Control+E v": KeySetSplit, "Control+E Control+V": KeySetSplit, "Control+E m": KeyBuildProject, "Control+E Control+M": KeyBuildProject, "Control+E r": KeyRunProject, "Control+E Control+R": KeyRunProject, }}, {"ChromeStd", "Standard chrome-browser and linux-under-chrome bindings", keymap.Map{ "Control+Tab": KeyNextPanel, "Control+Shift+Tab": KeyPrevPanel, "Control+E o": KeyNextPanel, "Control+E Control+O": KeyNextPanel, "Control+E p": KeyPrevPanel, "Control+E Control+P": KeyPrevPanel, "Control+O": KeyFileOpen, "Control+E f": KeyFileOpen, "Control+E Control+F": KeyFileOpen, "Control+E b": KeyBufSelect, "Control+E Control+B": KeyBufSelect, "Control+S": KeyBufSave, "Control+Shift+S": KeyBufSaveAs, "Control+E s": KeyBufSave, "Control+E Control+S": KeyBufSave, "Control+E w": KeyBufSaveAs, "Control+E Control+W": KeyBufSaveAs, "Control+E k": KeyBufClose, "Control+E Control+K": KeyBufClose, "Control+B c": KeyExecCmd, "Control+B Control+C": KeyExecCmd, "Control+B o": KeyBufClone, "Control+B Control+O": KeyBufClone, "Control+E x": KeyRegCopy, "Control+E g": KeyRegPaste, "Control+E Control+X": KeyRectCut, "Control+E Control+Y": KeyRectPaste, "Control+E Alt+∑": KeyRectCopy, "Control+/": KeyCommentOut, "Control+B k": KeyCommentOut, "Control+B Control+K": KeyCommentOut, "Control+E i": KeyIndent, "Control+E Control+I": KeyIndent, "Control+E j": KeyJump, "Control+E Control+J": KeyJump, "Control+E v": KeySetSplit, "Control+E Control+V": KeySetSplit, "Control+E m": KeyBuildProject, "Control+E Control+M": KeyBuildProject, "Control+E r": KeyRunProject, "Control+E Control+R": KeyRunProject, }}, }
StandardKeyMaps are the standard extended maps for Code
var StandardLanguages = Languages{ fileinfo.Go: {CmdNames{"Go: Imports File"}}, }
StandardLanguages is the original compiled-in set of standard language options.
var StandardSplits = Splits{ {"Compact", "2 text views, tabs under", [4]float32{.2, .5, .5, .3}, true}, {"Wide", "2 text views, tabs, in a row", [4]float32{.1, .325, .325, .25}, false}, {"Small", "1 text view, tabs", [4]float32{.2, 1, 0, .3}, true}, {"BigTabs", "1 text view, big tabs", [4]float32{.1, .3, 0, .6}, false}, {"Debug", "bigger command panel for debugging", [4]float32{0.1, 0.3, 0.3, 0.3}, false}, }
StandardSplits is the original compiled-in set of standard named splits.
Functions ¶
func ArgVarPrompts ¶
ArgVarPrompts returns any Prompt* variables required by this string, false if none
func CheckForProjectAtPath ¶
CheckForProjectAtPath checks if there is a .code project at the given path returns project path and true if found, otherwise false
func CodeOpenNodes ¶
CodeOpenNodes gets list of open nodes for submenu-func
func CommandMenu ¶
CommandMenu returns a menu function for commands for given language and vcs name
func CommandName ¶
CommandName returns a qualified command name as cat: cmd
func ConfigEditorTextEditor ¶
func ConfigEditorTextEditor(ed *texteditor.Editor)
ConfigEditorTextEditor configures an editor texteditor
func ConfigOutputTextEditor ¶
func ConfigOutputTextEditor(ed *texteditor.Editor)
ConfigOutputTextEditor configures a command-output texteditor within given parent layout
func DebugSettingsEditor ¶
DebugSettingsEditor opens a view of project Debug settings, returns form if not already open
func LanguagesView ¶
func LanguagesView(pt *Languages)
LanguagesView opens a view of a languages options map
func MarkupCmdOutput ¶
MarkupCmdOutput applies links to the first element in command output line if it looks like a file name / position, and runs markup using given lexer name if provided (default is "bash")
func MarkupStdOutput ¶ added in v0.1.0
MarkupStdOutput applies links to the first element in command output line if it looks like a file name / position
func MarkupStderr ¶
func MarkupStdout ¶
func MergeAvailableCmds ¶
func MergeAvailableCmds()
MergeAvailableCmds updates the AvailCmds list from CustomCmds and StdCmds
func NewDebugger ¶
func NewDebugger(sup fileinfo.Known, path, rootPath string, outbuf *texteditor.Buffer, pars *cdebug.Params) (cdebug.GiDebug, error)
NewDebugger returns a new debugger for given supported file type
func ProjectPathParse ¶
ProjectPathParse parses given project path into a root directory (which could be the path or just the directory portion of the path, depending in whether the path is a directory or not), and a bool if all is good (otherwise error message has been reported). projnm is always the last directory of the path.
func ProjectSettingsEditor ¶
func ProjectSettingsEditor(pf *ProjectSettings) *core.Form
ProjectSettingsEditor opens a view of project settings, returns form if not already open
func RegistersMenu ¶
RegistersMenu presents a menu of existing registers, calling the given function with the selected register name
func RegistersView ¶
func RegistersView(pt *Registers)
RegistersView opens a view of a commands table
func RepoCurBranches ¶
RepoCurBranches returns the current branch and a list of all branches ensuring that the current also appears on the list of all. In git, a new branch may not so appear.
func SelectSymbol ¶
func SetGoMod ¶
func SetGoMod(gomod bool)
SetGoMod applies the given gomod setting, setting the GO111MODULE env var
func TextLinkHandler ¶
TextLinkHandler is the Code handler for text links -- preferred one b/c directly connects to correct Code project
Types ¶
type ArgVarInfo ¶
type ArgVarInfo struct { // description of arg var Desc string // type of variable -- used for checking usage and other special features such as prompting Type ArgVarTypes }
ArgVarInfo has info about argument variables that fill in relevant values for commands, used in ArgVars list of variables
type ArgVarTypes ¶
type ArgVarTypes int32 //enums:enum -trim-prefix ArgVar
ArgVarTypes describe the type of information in the arg var -- used for checking usage and special features.
const ( // ArgVarFile is a file name, not a directory ArgVarFile ArgVarTypes = iota // ArgVarDir is a directory name, not a file ArgVarDir // ArgVarExt is a file extension ArgVarExt // ArgVarPos is a text position ArgVarPos // ArgVarText is text from a buffer ArgVarText // ArgVarPrompt is a user-prompted variable ArgVarPrompt )
const ArgVarTypesN ArgVarTypes = 6
ArgVarTypesN is the highest valid value for type ArgVarTypes, plus one.
func ArgVarTypesValues ¶
func ArgVarTypesValues() []ArgVarTypes
ArgVarTypesValues returns all possible values for the type ArgVarTypes.
func (ArgVarTypes) Desc ¶
func (i ArgVarTypes) Desc() string
Desc returns the description of the ArgVarTypes value.
func (ArgVarTypes) Int64 ¶
func (i ArgVarTypes) Int64() int64
Int64 returns the ArgVarTypes value as an int64.
func (ArgVarTypes) MarshalText ¶
func (i ArgVarTypes) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*ArgVarTypes) SetInt64 ¶
func (i *ArgVarTypes) SetInt64(in int64)
SetInt64 sets the ArgVarTypes value from an int64.
func (*ArgVarTypes) SetString ¶
func (i *ArgVarTypes) SetString(s string) error
SetString sets the ArgVarTypes value from its string representation, and returns an error if the string is invalid.
func (ArgVarTypes) String ¶
func (i ArgVarTypes) String() string
String returns the string representation of this ArgVarTypes value.
func (*ArgVarTypes) UnmarshalText ¶
func (i *ArgVarTypes) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (ArgVarTypes) Values ¶
func (i ArgVarTypes) Values() []enums.Enum
Values returns all possible values for the type ArgVarTypes.
type ArgVarVals ¶
ArgVarVals are current values of arg var vals -- updated on demand when a command is invoked
func (*ArgVarVals) Bind ¶
func (avp *ArgVarVals) Bind(arg string) string
Bind replaces the variables in the given arg string with their values
func (*ArgVarVals) Set ¶
func (avp *ArgVarVals) Set(fpath string, ppref *ProjectSettings, tv *texteditor.Editor)
Set sets the current values for arg variables -- prompts must be already set!
type CmdAndArgs ¶
type CmdAndArgs struct { // external program to execute -- must be on path or have full path specified -- use {RunExec} for the project RunExec executable. Cmd string `width:"25"` // args to pass to the program, one string per arg. // Use {Filename} etc to refer to special variables. // Use backslash-quoted bracket to insert a literal curly bracket. // Use unix-standard path separators (/); they will be replaced with // proper os-specific path separator on Windows. Args CmdArgs `width:"25"` // default value for prompt string, for first use -- thereafter it uses last value provided for given command Default string `width:"25"` // if true, then do not split any prompted string into separate space-separated fields -- otherwise do so, except for values within quotes PromptIsString bool }
CmdAndArgs contains the name of an external program to execute and args to pass to that program
func (*CmdAndArgs) BindArgs ¶
func (cm *CmdAndArgs) BindArgs(avp *ArgVarVals) []string
BindArgs replaces any variables in the args with their values, and returns resulting args
func (*CmdAndArgs) HasPrompts ¶
func (cm *CmdAndArgs) HasPrompts() (map[string]struct{}, bool)
HasPrompts returns true if any prompts are required before running command, and the set of such args
func (*CmdAndArgs) PrepCmd ¶
func (cm *CmdAndArgs) PrepCmd(avp *ArgVarVals) (*exec.Cmd, string)
PrepCmd prepares to run command, returning *exec.Cmd and a string of the full command
type CmdButton ¶
CmdButton represents a CmdName value with a button that opens a [CmdView].
func NewCmdButton ¶
NewCmdButton returns a new CmdButton with the given optional parent: CmdButton represents a CmdName value with a button that opens a [CmdView].
func (*CmdButton) WidgetValue ¶
type CmdName ¶
type CmdName string
CmdName has an associated ValueView for selecting from the list of available command names, for use in settings etc. Formatted as Cat: Name as in Command.Label()
func (CmdName) Command ¶
Command returns command associated with command name in AvailCmds, and false if it doesn't exist
type CmdRun ¶
type CmdRun struct { // Name of command being run -- same as Command.Name Name string // command string CmdStr string // Details of the command and args CmdArgs *CmdAndArgs // exec.Cmd for the command Exec *exec.Cmd }
CmdRun tracks running commands
type CmdRuns ¶
type CmdRuns []*CmdRun
CmdRuns is a slice list of running commands
func (*CmdRuns) AddCmd ¶
func (rc *CmdRuns) AddCmd(name, cmdstr string, cmdargs *CmdAndArgs, ex *exec.Cmd)
AddCmd adds a new running command, creating CmdRun via args
func (*CmdRuns) DeleteByName ¶
DeleteByName deletes command by name
func (*CmdRuns) DeleteIndex ¶
DeleteIndex delete command at given index
func (*CmdRuns) KillByName ¶
KillByName kills a running process by name, and removes it from the list of running commands
type Code ¶
type Code struct { core.Frame // root directory for the project -- all projects must be organized within a top-level root directory, with all the files therein constituting the scope of the project -- by default it is the path for ProjectFilename ProjectRoot core.Filename // current project filename for saving / loading specific Code configuration information in a .code file (optional) ProjectFilename core.Filename `extension:".code"` // filename of the currently active texteditor ActiveFilename core.Filename `set:"-"` // language for current active filename ActiveLang fileinfo.Known // VCS repo for current active filename ActiveVCS vcs.Repo `set:"-"` // VCS info for current active filename (typically branch or revision) -- for status ActiveVCSInfo string `set:"-"` // has the root changed? we receive update signals from root for changes Changed bool `set:"-" json:"-"` // the last status update message StatusMessage string // timestamp for when a file was last saved -- provides dirty state for various updates including rebuilding in debugger LastSaveTStamp time.Time `set:"-" json:"-"` // all the files in the project directory and subdirectories Files *filetree.Tree `set:"-" json:"-"` // index of the currently active texteditor -- new files will be viewed in other views if available ActiveTextEditorIndex int `set:"-" json:"-"` // list of open nodes, most recent first OpenNodes OpenNodes `json:"-"` // the command buffers for commands run in this project CmdBufs map[string]*texteditor.Buffer `set:"-" json:"-"` // history of commands executed in this session CmdHistory CmdNames `set:"-" json:"-"` // currently running commands in this project RunningCmds CmdRuns `set:"-" json:"-" xml:"-"` // current arg var vals ArgVals ArgVarVals `set:"-" json:"-" xml:"-"` // settings for this project -- this is what is saved in a .code project file Settings ProjectSettings `set:"-"` // current debug view CurDbg *DebugPanel `set:"-"` // first key in sequence if needs2 key pressed KeySeq1 key.Chord `set:"-"` // mutex for protecting overall updates to Code UpdateMu sync.Mutex `set:"-"` }
Code is the core editor and tab viewer widget for the Code system. The default view has a tree browser of files on the left, editor panels in the middle, and a tabbed viewer on the right.
func CodeInScene ¶
func NewCode ¶
NewCode returns a new Code with the given optional parent: Code is the core editor and tab viewer widget for the Code system. The default view has a tree browser of files on the left, editor panels in the middle, and a tabbed viewer on the right.
func NewCodeProjectPath ¶
NewCodeProjectPath creates a new Code window with a new Code project for given path, returning the window and the path
func NewCodeWindow ¶
NewCodeWindow is common code for Open CodeWindow from Project or Path
func OpenCodeProject ¶
OpenCodeProject creates a new Code window opened to given Code project, returning the window and the path
func ParentCode ¶
ParentCode returns the Code parent of given node
func (*Code) ActiveFileNode ¶
ActiveFileNode returns the file node for the active file -- nil if none
func (*Code) ActiveTextEditor ¶
func (cv *Code) ActiveTextEditor() *TextEditor
ActiveTextEditor returns the currently active TextEditor
func (*Code) AddChooserFiles ¶
AddChooserFiles adds the files to the app chooser.
func (*Code) AddChooserSymbols ¶
AddChooserSymbols adds the symbols to the app chooser.
func (*Code) AddCloseDialog ¶
func (cv *Code) AddCloseDialog()
AddCloseDialog adds the close dialog that automatically saves the project and prompts the user to save open files when they try to close the scene containing this code view.
func (*Code) ApplySettings ¶
func (cv *Code) ApplySettings()
ApplySettings applies current project preference settings into places where they are used -- only for those done prior to loading
func (*Code) ApplySettingsAction ¶
func (cv *Code) ApplySettingsAction()
ApplySettingsAction applies current settings to the project, and updates the project
func (*Code) ApplySplitsSettings ¶ added in v0.1.0
func (*Code) AutoSaveCheck ¶
AutoSaveCheck checks for an autosave file and prompts user about opening it -- returns true if autosave file does exist for a file that currently unchanged (means just opened)
func (*Code) CallSaveActiveViewAs ¶
func (*Code) CallSplitsSetView ¶
func (*Code) CallViewFile ¶
CallViewFile calls ViewFile with ActiveFilename set as arg
func (*Code) ChooseRunExec ¶
ChooseRunExec selects the executable to run for the project
func (*Code) ClearDebug ¶
func (cv *Code) ClearDebug()
ClearDebug clears the current debugger setting -- no more debugger active.
func (*Code) CloneActiveView ¶
func (cv *Code) CloneActiveView() (*TextEditor, int)
CloneActiveView sets the next text view to view the same file currently being vieweds in the active view. returns text view and index
func (*Code) CloseActiveView ¶
func (cv *Code) CloseActiveView()
CloseActiveView closes the buffer associated with active view
func (*Code) CloseOpenNodes ¶
CloseOpenNodes closes any nodes with open views (including those in directories under nodes). called prior to rename.
func (*Code) CommandFromMenu ¶
CommandFromMenu pops up a menu of commands for given language, with given last command selected by default, and runs selected command.
func (*Code) CommentOut ¶
CommentOut comments-out selected lines in active text view and uncomments if already commented If multiple lines are selected and any line is uncommented all will be commented
func (*Code) Commit ¶
func (cv *Code) Commit()
Commit commits the current changes using relevant VCS tool. Checks for VCS setting and for unsaved files.
func (*Code) CommitNoChecks ¶
func (cv *Code) CommitNoChecks()
CommitNoChecks does the commit without any further checks for VCS, and unsaved files
func (*Code) ConfigActiveFilename ¶
func (cv *Code) ConfigActiveFilename(fb *core.FuncButton) *core.FuncButton
ConfigActiveFilename configures the first arg of given FuncButton to use the ActiveFilename
func (*Code) ConfigFindButton ¶
func (cv *Code) ConfigFindButton(fb *core.FuncButton) *core.FuncButton
ConfigFindButton configures the Find FuncButton with current params
func (*Code) ConfigTextBuffer ¶
func (cv *Code) ConfigTextBuffer(tb *texteditor.Buffer)
ConfigTextBuffer configures the text buffer according to the settings.
func (*Code) CountWords ¶
CountWords counts number of words (and lines) in active file returns a string report thereof.
func (*Code) CountWordsRegion ¶
CountWordsRegion counts number of words (and lines) in selected region in file if no selection, returns numbers for entire file.
func (*Code) CurDebug ¶
func (cv *Code) CurDebug() *DebugPanel
CurDebug returns the current debug view
func (*Code) CursorToHistNext ¶
CursorToHistNext moves forward to the next history item.
func (*Code) CursorToHistPrev ¶
CursorToHistPrev moves back to the previous history item.
func (*Code) DebugAttach ¶
DebugAttach runs the debugger by attaching to an already-running process. pid is the process id to attach to.
func (*Code) DebugTest ¶
DebugTest runs the debugger using testing mode in current active texteditor path. testName specifies which test(s) to run according to the standard go test -run specification.
func (*Code) Defaults ¶
func (cv *Code) Defaults()
Defaults sets new project defaults based on overall settings
func (*Code) DiffFileNode ¶
DiffFileNode shows the differences between given file node as the A file, and another given file as the B file, in side-by-side DiffEditor and in the console as a context diff.
func (*Code) DiffFiles ¶
DiffFiles shows the differences between two given files in side-by-side DiffEditor and in the console as a context diff. It opens the files as file nodes and uses existing contents if open already.
func (*Code) EditProjectSettings ¶
func (cv *Code) EditProjectSettings()
EditProjectSettings allows editing of project settings (settings specific to this project)
func (*Code) EditRecentPaths ¶
func (cv *Code) EditRecentPaths()
EditRecentPaths opens a dialog editor for editing the recent project paths list
func (*Code) ExecCmd ¶
func (cv *Code) ExecCmd()
ExecCmd pops up a menu to select a command appropriate for the current active text view, and shows output in Tab with name of command
func (*Code) ExecCmdFileNode ¶
ExecCmdFileNode pops up a menu to select a command appropriate for the given node, and shows output in Tab with name of command
func (*Code) ExecCmdName ¶
ExecCmdName executes command of given name; this is the final common pathway for all command invocation except on a node.
func (*Code) ExecCmdNameActive ¶
ExecCmdNameActive calls given command on current active texteditor
func (*Code) ExecCmdNameFileNode ¶
ExecCmdNameFileNode executes command of given name on given node
func (*Code) ExecCmdNameFilename ¶
ExecCmdNameFilename executes command of given name on given file name
func (*Code) ExecCmdsFileNode ¶
ExecCmdsFileNode executes a sequence of commands on file node
func (*Code) FileNodeForFile ¶
FileNodeForFile returns file node for given file path add: if not found in existing tree and external files, then if add is true, it is added to the ExtFiles list.
func (*Code) FileNodeOpened ¶
FileNodeOpened is called whenever file node is double-clicked in file tree
func (*Code) FileNodeRunExe ¶
FileNodeRunExe runs the given executable file node
func (*Code) FileNodeSelected ¶
FileNodeSelected is called whenever tree browser has file node selected
func (*Code) Find ¶
func (cv *Code) Find(find string, repl string, ignoreCase bool, regExp bool, loc filetree.FindLocation, langs []fileinfo.Known)
Find does Find / Replace in files, using given options and filters -- opens up a main tab with the results and further controls.
func (*Code) FocusActiveTextEditor ¶
func (cv *Code) FocusActiveTextEditor() *TextEditor
FocusActiveTextEditor sets focus to active text editor
func (*Code) FocusNextPanel ¶
func (cv *Code) FocusNextPanel()
FocusNextPanel moves the keyboard focus to the next panel to the right
func (*Code) FocusOnPanel ¶
FocusOnPanel moves keyboard focus to given panel -- returns false if nothing at that tab
func (*Code) FocusOnTabs ¶
func (*Code) FocusPrevPanel ¶
func (cv *Code) FocusPrevPanel()
FocusPrevPanel moves the keyboard focus to the previous panel to the left
func (*Code) GrabSettings ¶
func (cv *Code) GrabSettings()
GrabSettings grabs the current project preference settings from various places, e.g., prior to saving or editing.
func (*Code) GuessMainLang ¶
GuessMainLang guesses the main language in the project -- returns true if successful
func (*Code) JoinParaLines ¶
func (cv *Code) JoinParaLines()
JoinParaLines merges sequences of lines with hard returns forming paragraphs, separated by blank lines, into a single line per paragraph, for given selected region (full text if no selection)
func (*Code) LangDefaults ¶
func (cv *Code) LangDefaults()
LangDefaults applies default language settings based on MainLang
func (*Code) LinkViewFile ¶
LinkViewFile opens the file in the 2nd texteditor, which is next to the tabs where links are clicked, if it is not collapsed -- else 1st
func (*Code) LinkViewFileNode ¶
func (cv *Code) LinkViewFileNode(fn *filetree.Node) (*TextEditor, int)
LinkViewFileNode opens the file node in the 2nd texteditor, which is next to the tabs where links are clicked, if it is not collapsed -- else 1st
func (*Code) LookupFun ¶
LookupFun is the completion system Lookup function that makes a custom texteditor dialog that has option to edit resulting file.
func (*Code) MakeToolbar ¶
func (*Code) NChangedFiles ¶
NChangedFiles returns number of opened files with unsaved changes
func (*Code) NewProject ¶
func (cv *Code) NewProject(path core.Filename, folder string, mainLang fileinfo.Known, VersionControl filetree.VersionControlName) *Code
NewProject creates a new project at given path, making a new folder in that path -- all Code projects are essentially defined by a path to a folder containing files. If the folder already exists, then use OpenPath. Can also specify main language and version control type
func (*Code) NextTextEditor ¶
func (cv *Code) NextTextEditor() (*TextEditor, int)
NextTextEditor returns the next text view available for viewing a file and its index -- if the active text view is empty, then it is used, otherwise it is the next one (if visible)
func (*Code) NextViewFile ¶
NextViewFile sets the next text view to view given file name -- include as much of name as possible to disambiguate -- will use the first matching -- if already being viewed, that is activated -- returns texteditor and its index, false if not found
func (*Code) NextViewFileNode ¶
func (cv *Code) NextViewFileNode(fn *filetree.Node) (*TextEditor, int)
NextViewFileNode sets the next text view to view file in given node (opens buffer if not already opened) -- if already being viewed, that is activated, returns text view and index
func (*Code) OpenConsoleTab ¶
func (cv *Code) OpenConsoleTab()
OpenConsoleTab opens a main tab displaying console output (stdout, stderr)
func (*Code) OpenFile ¶
OpenFile opens file in an open project if it has the same path as the file or in a new window.
func (*Code) OpenFileAtRegion ¶
func (*Code) OpenFileNode ¶
OpenFileNode opens file for file node -- returns new bool and error
func (*Code) OpenFileURL ¶
func (cv *Code) OpenFileURL(ur string, ftv *texteditor.Editor) bool
OpenFileURL opens given file:/// url
func (*Code) OpenFindURL ¶
func (cv *Code) OpenFindURL(ur string, ftv *texteditor.Editor) bool
OpenFindURL opens given find:/// url from Find; delegates to FindPanel
func (*Code) OpenNodeForTextEditor ¶
OpenNodeForTextEditor finds the FileNode that a given TextEditor is viewing, returning its index within OpenNodes list, or false if not found
func (*Code) OpenPath ¶
OpenPath creates a new project by opening given path, which can either be a specific file or a folder containing multiple files of interest -- opens in current Code object if it is empty, or otherwise opens a new window.
func (*Code) OpenProject ¶
OpenProject opens .code project file and its settings from given filename, in a standard toml-formatted file
func (*Code) OpenRecent ¶
OpenRecent opens a recently used file
func (*Code) OverflowMenu ¶
func (*Code) PanelIsOpen ¶
PanelIsOpen returns true if the given panel has not been collapsed and is avail and visible for displaying something
func (*Code) ParseOpenFindURL ¶
func (cv *Code) ParseOpenFindURL(ur string, ftv *texteditor.Editor) (tv *TextEditor, reg text.Region, findBufStLn, findCount int, ok bool)
ParseOpenFindURL parses and opens given find:/// url from Find, return text region encoded in url, and starting line of results in find buffer, and number of results returned -- for parsing all the find results
func (*Code) ReCase ¶
ReCase replaces currently selected text in current active view with given case
func (*Code) RecycleCmdBuf ¶
func (cv *Code) RecycleCmdBuf(cmdName string) (*texteditor.Buffer, bool)
RecycleCmdBuf creates the buffer for command output, or returns existing. Returns true if new buffer created.
func (*Code) RecycleCmdTab ¶
func (cv *Code) RecycleCmdTab(cmdName string) (*texteditor.Buffer, *texteditor.Editor, bool)
RecycleCmdTab creates the tab to show command output, including making a buffer object to save output from the command. Returns true if a new buffer was created, false if one already existed.
func (*Code) RecycleTabTextEditor ¶
func (cv *Code) RecycleTabTextEditor(name string, buf *texteditor.Buffer) *texteditor.Editor
RecycleTabTextEditor returns a text editor in a tab with the given name, first by looking for an existing one, and if not found, making a new one with a text editor in it.
func (*Code) RegisterCopy ¶
func (cv *Code) RegisterCopy(regNm RegisterName)
RegisterCopy saves current selection in active text view to register of given name returns true if saved.
func (*Code) RegisterPaste ¶
RegisterPaste prompts user for available registers, and pastes selected one into active text view
func (*Code) ReplaceInActive ¶
func (cv *Code) ReplaceInActive()
ReplaceInActive does query-replace in active file only
func (*Code) RevertActiveView ¶
func (cv *Code) RevertActiveView()
RevertActiveView revert active view to saved version
func (*Code) RunPostCmdsActiveView ¶
RunPostCmdsActiveView runs any registered post commands on the active view -- returns true if commands were run and file was reverted after that -- uses MainLang to disambiguate if multiple languages associated with extension.
func (*Code) RunPostCmdsFileNode ¶
RunPostCmdsFileNode runs any registered post commands on the given file node -- returns true if commands were run and file was reverted after that -- uses MainLang to disambiguate if multiple languages associated with extension.
func (*Code) SaveActiveView ¶
func (cv *Code) SaveActiveView()
SaveActiveView saves the contents of the currently active texteditor
func (*Code) SaveActiveViewAs ¶
SaveActiveViewAs save with specified filename the contents of the currently active texteditor
func (*Code) SaveAll ¶
func (cv *Code) SaveAll()
SaveAll saves all of the open filenodes to their current file names and saves the project state if it has been saved before (i.e., the .code file exists)
func (*Code) SaveAllCheck ¶
SaveAllCheck -- check if any files have not been saved, and prompt to save them returns true if there were unsaved files, false otherwise. cancelOpt presents an option to cancel current command, in which case function is not called. if function is passed, then it is called in all cases except if the user selects cancel.
func (*Code) SaveAllOpenNodes ¶
func (cv *Code) SaveAllOpenNodes()
SaveAllOpenNodes saves all of the open filenodes to their current file names
func (*Code) SaveProject ¶
func (cv *Code) SaveProject()
SaveProject saves project file containing custom project settings, in a standard toml-formatted file
func (*Code) SaveProjectAs ¶
SaveProjectAs saves project custom settings to given filename, in a standard toml-formatted file saveAllFiles indicates if user should be prompted for saving all files returns true if the user was prompted, false otherwise
func (*Code) SaveProjectIfExists ¶
SaveProjectIfExists saves project file containing custom project settings, in a standard toml-formatted file, only if it already exists -- returns true if saved saveAllFiles indicates if user should be prompted for saving all files
func (*Code) SelectOpenNode ¶
func (cv *Code) SelectOpenNode()
SelectOpenNode pops up a menu to select an open node (aka buffer) to view in current active texteditor
func (*Code) SelectTabByName ¶
SelectTabByName Selects given main tab, and returns all of its contents as well.
func (*Code) SelectedFileNode ¶
SelectedFileNode returns currently selected file tree node as a *filetree.Node could be nil.
func (*Code) SetActiveFileInfo ¶
func (cv *Code) SetActiveFileInfo(buf *texteditor.Buffer)
SetActiveFileInfo sets the active file info from text
func (*Code) SetActiveLang ¶
SetActiveLang sets the [Code.ActiveLang]: language for current active filename
func (*Code) SetActiveTextEditor ¶
func (cv *Code) SetActiveTextEditor(av *TextEditor) int
SetActiveTextEditor sets the given texteditor as the active one, and returns its index
func (*Code) SetActiveTextEditorIndex ¶
func (cv *Code) SetActiveTextEditorIndex(idx int) *TextEditor
SetActiveTextEditorIndex sets the given view index as the currently active TextEditor -- returns that texteditor. This is the main method for activating a text editor.
func (*Code) SetArgVarVals ¶
func (cv *Code) SetArgVarVals()
SetArgVarVals sets the ArgVar values for commands, from Code values
func (*Code) SetOpenNodes ¶
SetOpenNodes sets the [Code.OpenNodes]: list of open nodes, most recent first
func (*Code) SetProjectFilename ¶
SetProjectFilename sets the [Code.ProjectFilename]: current project filename for saving / loading specific Code configuration information in a .code file (optional)
func (*Code) SetProjectRoot ¶
SetProjectRoot sets the [Code.ProjectRoot]: root directory for the project -- all projects must be organized within a top-level root directory, with all the files therein constituting the scope of the project -- by default it is the path for ProjectFilename
func (*Code) SetStatus ¶
SetStatus sets the current status update message for the StatusBar next time it renders
func (*Code) SetStatusMessage ¶
SetStatusMessage sets the [Code.StatusMessage]: the last status update message
func (*Code) SetWindowNameTitle ¶
func (cv *Code) SetWindowNameTitle()
SetWindowNameTitle sets the window name and title based on current project name
func (*Code) ShowFile ¶
func (cv *Code) ShowFile(fname string, ln int) (*TextEditor, error)
ShowFile shows given file name at given line, returning TextEditor showing it or error if not found.
func (*Code) SpacesToTabs ¶
func (cv *Code) SpacesToTabs()
SpacesToTabs converts spaces to tabs for given selected region (full text if no selection)
func (*Code) SplitsEdit ¶
func (cv *Code) SplitsEdit()
SplitsEdit opens the SplitsView editor to customize saved splitter settings
func (*Code) SplitsSave ¶
SplitsSave saves current splitter settings to named splitter settings under existing name, and saves to prefs file
func (*Code) SplitsSaveAs ¶
SplitsSaveAs saves current splitter settings to new named splitter settings, and saves to prefs file
func (*Code) SplitsSetView ¶
SplitsSetView sets split view splitters to given named setting
func (*Code) StatusText ¶
StatusText returns the status bar text widget
func (*Code) SwapTextEditors ¶
SwapTextEditors switches the buffers for the two open texteditors only operates if both panels are open
func (*Code) TabDeleted ¶
TabDeleted is called when a main tab is deleted -- we cancel any running commands
func (*Code) TabsToSpaces ¶
func (cv *Code) TabsToSpaces()
TabsToSpaces converts tabs to spaces for given selected region (full text if no selection)
func (*Code) TextBufForFile ¶
func (cv *Code) TextBufForFile(fpath string, add bool) *texteditor.Buffer
TextBufForFile returns TextBuf for given file path. add: if not found in existing tree and external files, then if add is true, it is added to the ExtFiles list.
func (*Code) TextEditorButtonByIndex ¶
TextEditorButtonByIndex returns the top texteditor menu button by index (0 or 1)
func (*Code) TextEditorByIndex ¶
func (cv *Code) TextEditorByIndex(idx int) *TextEditor
TextEditorByIndex returns the TextEditor by index (0 or 1), nil if not found
func (*Code) TextEditorForFile ¶
TextEditorForFile finds FileNode for file, and returns TextEditor and index that is viewing that FileNode, or false if none is
func (*Code) TextEditorForFileNode ¶
TextEditorForFileNode finds a TextEditor that is viewing given FileNode, and its index, or false if none is
func (*Code) TextEditorIndex ¶
func (cv *Code) TextEditorIndex(av *TextEditor) int
TextEditorIndex finds index of given texteditor (0 or 1)
func (*Code) UpdateFiles ¶
func (cv *Code) UpdateFiles()
UpdateFiles updates the list of files saved in project
func (*Code) UpdateStatusText ¶
func (cv *Code) UpdateStatusText()
UpdateStatusText updates the status bar text with current data.
func (*Code) UpdateTextButtons ¶
func (cv *Code) UpdateTextButtons()
UpdateTextButtons updates texteditor menu buttons is called by SetStatus. Doesn't do anything unless a change is required, so safe to call frequently.
func (*Code) VCSLog ¶
VCSLog shows the VCS log of commits in this project, in an interactive browser from which any revisions can be compared and diffs browsed.
func (*Code) VCSUpdateAll ¶
func (cv *Code) VCSUpdateAll()
VCSUpdateAll does an Update (e.g., Pull) on all VCS repositories within the open tree nodes in FileTree.
func (*Code) VersionControl ¶
func (cv *Code) VersionControl() filetree.VersionControlName
VersionControl returns the version control system in effect, using the file tree detected version or whatever is set in project settings
func (*Code) ViewFile ¶
ViewFile views file in an existing TextEditor if it is already viewing that file, otherwise opens ViewFileNode in active buffer
func (*Code) ViewFileInIndex ¶
ViewFileInIndex views file in given text view index
func (*Code) ViewFileNode ¶
func (cv *Code) ViewFileNode(tv *TextEditor, vidx int, fn *filetree.Node)
ViewFileNode sets the given text view to view file in given node (opens buffer if not already opened). This is the main method for viewing a file.
func (*Code) ViewOpenNodeName ¶
ViewOpenNodeName views given open node (by name) in active view
type Command ¶
type Command struct { // category for the command -- commands are organized in to hierarchical menus according to category Cat string // name of this command (must be unique in list of commands) Name string `width:"20"` // brief description of this command Desc string `width:"40"` // supported language / file type that this command applies to -- choose Any or e.g., AnyCode for subtypes -- filters the list of commands shown based on file language type Lang fileinfo.Known // sequence of commands to run for this overall command. Cmds []CmdAndArgs `table-select:"-"` // if specified, will change to this directory before executing the command; // e.g., use {FileDirPath} for current file's directory. Only use directory // values here; if not specified, directory will be project root directory. Dir string `width:"20"` // if true, we wait for the command to run before displaying output -- mainly for post-save commands and those with subsequent steps: if multiple commands are present, then it uses Wait mode regardless. Wait bool // if true, keyboard focus is directed to the command output tab panel after the command runs. Focus bool // if true, command requires Ok / Cancel confirmation dialog -- only needed for non-prompt commands Confirm bool // what type of file to use for syntax highlighting. Bash is the default. Hilight fileinfo.Known }
Command defines different types of commands that can be run in the project. The output of the commands shows up in an associated tab.
func (*Command) AppendCmdOut ¶
func (cm *Command) AppendCmdOut(cv *Code, buf *texteditor.Buffer, out []byte)
AppendCmdOut appends command output to buffer, applying markup for links
func (*Command) HasPrompts ¶
HasPrompts returns true if any prompts are required before running command, and the set of such args
func (*Command) LangMatch ¶
LangMatch returns true if the given language matches the command Lang constraints
func (*Command) MarkupCmdOutput ¶
func (*Command) PromptUser ¶
func (cm *Command) PromptUser(cv *Code, buf *texteditor.Buffer, pvals map[string]struct{})
PromptUser prompts for values that need prompting for, and then runs RunAfterPrompts if not otherwise cancelled by user
func (*Command) Run ¶
func (cm *Command) Run(cv *Code, buf *texteditor.Buffer)
Run runs the command and saves the output in the Buf if it is non-nil, which can be displayed -- if !wait, then Buf is updated online as output occurs. Status is updated with status of command exec. User is prompted for any values that might be needed for command.
func (*Command) RunAfterPrompts ¶
func (cm *Command) RunAfterPrompts(cv *Code, buf *texteditor.Buffer)
RunAfterPrompts runs after any prompts have been set, if needed
func (*Command) RunBuf ¶
func (cm *Command) RunBuf(cv *Code, buf *texteditor.Buffer, cma *CmdAndArgs) bool
RunBuf runs a command with output to the buffer, incrementally updating the buffer with new results line-by-line as they come in
func (*Command) RunBufWait ¶
func (cm *Command) RunBufWait(cv *Code, buf *texteditor.Buffer, cma *CmdAndArgs) bool
RunBufWait runs a command with output to the buffer, using CombinedOutput so it waits for completion -- returns overall command success, and logs one line of the command output to code statusbar
type Commands ¶
type Commands []*Command //types:add
Commands is a list of different commands
var AvailableCommands Commands
AvailableCommands is the current list of ALL available commands for use -- it combines StdCmds and CustomCmds. Custom overrides Std items with the same names.
func (*Commands) CmdByName ¶
CmdByName returns a command and index by name -- returns false and emits a message to log if not found if msg is true
func (*Commands) FilterCmdNames ¶
func (cm *Commands) FilterCmdNames(lang fileinfo.Known, vcnm filetree.VersionControlName) [][]string
FilterCmdNames returns a slice of commands organized by category that are compatible with given language and version control system.
func (*Commands) OpenSettings ¶
OpenSettings opens custom Commands from the app settings directory, using CommandSettingsFilename.
func (*Commands) SaveSettings ¶
SaveSettings saves custom Commands to the app settings directory, using CommandSettingsFilename.
func (*Commands) ViewStandard ¶
func (cm *Commands) ViewStandard()
ViewStandard shows the standard types that are compiled into the program and have all the lastest standards. Useful for comparing against custom lists.
type Console ¶
type Console struct { // std out writer -- set to os.Stdout StdoutWrite *os.File `json:"-" xml:"-"` // std out reader -- used to read os.Stdout StdoutRead *os.File `json:"-" xml:"-"` // std err writer -- set to os.Stderr StderrWrite *os.File `json:"-" xml:"-"` // std err reader -- used to read os.Stderr StderrRead *os.File `json:"-" xml:"-"` // text buffer holding all output Buffer *texteditor.Buffer `json:"-" xml:"-"` // set to true to cancel monitoring Cancel bool `json:"-" xml:"-"` // mutex protecting updating of buffer between out / err Mu sync.Mutex `json:"-" xml:"-"` // original os.Stdout writer OrgoutWrite *os.File `json:"-" xml:"-"` // original os.Stderr writer OrgerrWrite *os.File `json:"-" xml:"-"` // log file writer LogWrite *os.File `json:"-" xml:"-"` }
Console redirects our os.Stdout and os.Stderr to a buffer for display within app
var TheConsole Console
func (*Console) Init ¶
Init initializes the console -- sets up the capture, Buf, and starts the routine that monitors output. if logFile is non-empty, writes output to that file as well.
func (*Console) MonitorErr ¶
func (cn *Console) MonitorErr()
MonitorErr monitors std error and appends it to the buffer should be in a separate routine
func (*Console) MonitorOut ¶
func (cn *Console) MonitorOut()
MonitorOut monitors std output and appends it to the buffer should be in a separate routine
type DebugBreakStatus ¶
type DebugBreakStatus int32 //enums:enum -trim-prefix Debug
DebugBreakStatus represents the status of a certain breakpoint.
const ( // DebugBreakInactive is an inactive break point DebugBreakInactive DebugBreakStatus = iota // DebugBreakActive is an active break point DebugBreakActive // DebugBreakCurrent is the current break point DebugBreakCurrent // DebugPCCurrent is the current program execution point, // updated for every ShowFile action DebugPCCurrent )
const DebugBreakStatusN DebugBreakStatus = 4
DebugBreakStatusN is the highest valid value for type DebugBreakStatus, plus one.
func DebugBreakStatusValues ¶
func DebugBreakStatusValues() []DebugBreakStatus
DebugBreakStatusValues returns all possible values for the type DebugBreakStatus.
func (DebugBreakStatus) Desc ¶
func (i DebugBreakStatus) Desc() string
Desc returns the description of the DebugBreakStatus value.
func (DebugBreakStatus) Int64 ¶
func (i DebugBreakStatus) Int64() int64
Int64 returns the DebugBreakStatus value as an int64.
func (DebugBreakStatus) MarshalText ¶
func (i DebugBreakStatus) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*DebugBreakStatus) SetInt64 ¶
func (i *DebugBreakStatus) SetInt64(in int64)
SetInt64 sets the DebugBreakStatus value from an int64.
func (*DebugBreakStatus) SetString ¶
func (i *DebugBreakStatus) SetString(s string) error
SetString sets the DebugBreakStatus value from its string representation, and returns an error if the string is invalid.
func (DebugBreakStatus) String ¶
func (i DebugBreakStatus) String() string
String returns the string representation of this DebugBreakStatus value.
func (*DebugBreakStatus) UnmarshalText ¶
func (i *DebugBreakStatus) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (DebugBreakStatus) Values ¶
func (i DebugBreakStatus) Values() []enums.Enum
Values returns all possible values for the type DebugBreakStatus.
type DebugPanel ¶
type DebugPanel struct { core.Frame // known file type to determine debugger Known fileinfo.Known // path to executable / dir to debug ExePath string // time when dbg was last restarted DbgTime time.Time // the debugger Dbg cdebug.GiDebug `set:"-" json:"-" xml:"-"` // all relevant debug state info State cdebug.AllState `set:"-" json:"-" xml:"-"` // current ShowFile location -- cleared before next one or run CurFileLoc cdebug.Location `set:"-" json:"-" xml:"-"` // backup breakpoints list -- to track deletes BBreaks []*cdebug.Break `set:"-" json:"-" xml:"-"` // output from the debugger OutputBuffer *texteditor.Buffer `set:"-" json:"-" xml:"-"` // parent code project Code *Code `set:"-" json:"-" xml:"-"` }
DebugPanel is the debugger panel.
func NewDebugPanel ¶
func NewDebugPanel(parent ...tree.Node) *DebugPanel
NewDebugPanel returns a new DebugPanel with the given optional parent: DebugPanel is the debugger panel.
func (*DebugPanel) AddBreak ¶
func (dv *DebugPanel) AddBreak(fpath string, line int)
AddBreak adds a breakpoint at given file path and line number. note: all breakpoints are just set in our master list and uploaded to the system right before starting running.
func (*DebugPanel) BackupBreaks ¶
func (dv *DebugPanel) BackupBreaks()
BackupBreaks makes a backup copy of current breaks
func (*DebugPanel) Config ¶
func (dv *DebugPanel) Config(cv *Code, known fileinfo.Known, exePath string)
Config sets parameters that must be set for a new view
func (*DebugPanel) ConsoleText ¶
func (dv *DebugPanel) ConsoleText() *texteditor.Editor
ConsoleText returns the console TextEditor
func (*DebugPanel) Continue ¶
func (dv *DebugPanel) Continue()
Continue continues running from current point -- this MUST be called in a separate goroutine!
func (*DebugPanel) DbgCanStep ¶
func (dv *DebugPanel) DbgCanStep() bool
DbgCanStep means the debugger is started AND process is not currently running, AND it is not already waiting for a next step
func (*DebugPanel) DbgIsActive ¶
func (dv *DebugPanel) DbgIsActive() bool
DbgIsActive means debugger is started.
func (*DebugPanel) DbgIsAvail ¶
func (dv *DebugPanel) DbgIsAvail() bool
DbgIsAvail means the debugger is started AND process is not currently running -- it is available for command input.
func (*DebugPanel) DeleteAllBreaks ¶
func (dv *DebugPanel) DeleteAllBreaks()
DeleteAllBreaks deletes all breakpoints
func (*DebugPanel) DeleteBreak ¶
func (dv *DebugPanel) DeleteBreak(fpath string, line int)
DeleteBreak deletes given breakpoint. If debugger is not yet activated then it just deletes from master list. Note that breakpoints can be turned on and off directly using On flag.
func (*DebugPanel) DeleteBreakImpl ¶
func (dv *DebugPanel) DeleteBreakImpl(fpath string, line int)
DeleteBreakImpl deletes given breakpoint with no other updates
func (*DebugPanel) DeleteBreakInBuf ¶
func (dv *DebugPanel) DeleteBreakInBuf(fpath string, line int)
DeleteBreakInBuf delete breakpoint in its TextBuf line is 1-based line number
func (*DebugPanel) DeleteBreakIndex ¶
func (dv *DebugPanel) DeleteBreakIndex(bidx int)
DeleteBreakIndex deletes break at given index in list of breaks
func (*DebugPanel) DeleteCurPCInBuf ¶
func (dv *DebugPanel) DeleteCurPCInBuf()
DeleteCurPCInBuf deletes the current PC location in given file line is 1-based line number
func (*DebugPanel) Destroy ¶
func (dv *DebugPanel) Destroy()
func (*DebugPanel) FindFrames ¶
func (dv *DebugPanel) FindFrames(fpath string, line int)
FindFrames finds the frames where given file and line are active Selects the one that is closest and shows the others in Find Tab
func (*DebugPanel) Init ¶
func (dv *DebugPanel) Init()
func (*DebugPanel) InitState ¶
func (dv *DebugPanel) InitState(ds *cdebug.State)
InitState updates the State and View from given debug state Call this when debugger returns from any action update
func (*DebugPanel) InitTabs ¶
func (dv *DebugPanel) InitTabs()
func (*DebugPanel) ListGlobalVars ¶
func (dv *DebugPanel) ListGlobalVars(filter string)
ListGlobalVars lists global vars matching the given optional filter.
func (*DebugPanel) MakeToolbar ¶
func (dv *DebugPanel) MakeToolbar(p *tree.Plan)
func (*DebugPanel) SetBreaks ¶
func (dv *DebugPanel) SetBreaks()
SetBreaks sets the current breakpoints from State, call this prior to running
func (*DebugPanel) SetCurPCInBuf ¶
func (dv *DebugPanel) SetCurPCInBuf(fpath string, line int)
SetCurPCInBuf sets the current PC location in given file line is 1-based line number
func (*DebugPanel) SetDbgTime ¶
func (t *DebugPanel) SetDbgTime(v time.Time) *DebugPanel
SetDbgTime sets the [DebugPanel.DbgTime]: time when dbg was last restarted
func (*DebugPanel) SetExePath ¶
func (t *DebugPanel) SetExePath(v string) *DebugPanel
SetExePath sets the [DebugPanel.ExePath]: path to executable / dir to debug
func (*DebugPanel) SetFrame ¶
func (dv *DebugPanel) SetFrame(depth int)
SetFrame sets the given frame depth level as active
func (*DebugPanel) SetStatus ¶
func (dv *DebugPanel) SetStatus(stat cdebug.Status)
func (*DebugPanel) SetSup ¶
func (t *DebugPanel) SetSup(v fileinfo.Known) *DebugPanel
SetSup sets the [DebugPanel.Known]: supported file type to determine debugger
func (*DebugPanel) SetThread ¶
func (dv *DebugPanel) SetThread(threadID int)
SetThread sets the given thread as active -- this must be TaskID if HasTasks and ThreadID if not.
func (*DebugPanel) SetThreadIndex ¶
func (dv *DebugPanel) SetThreadIndex(thridx int)
SetThreadIndex sets the given thread by index in threads list as active this must be TaskID if HasTasks and ThreadID if not.
func (*DebugPanel) ShowBreakFile ¶
func (dv *DebugPanel) ShowBreakFile(bidx int)
ShowBreakFile shows the file for given break index
func (*DebugPanel) ShowFile ¶
func (dv *DebugPanel) ShowFile(fpath string, line int)
ShowFile shows the file name in code
func (*DebugPanel) ShowVar ¶
func (dv *DebugPanel) ShowVar(name string) error
ShowVar shows info on a given variable within the current frame scope in a text view dialog
func (*DebugPanel) SingleStep ¶
func (dv *DebugPanel) SingleStep()
StepSingle steps a single CPU instruction.
func (*DebugPanel) StepInto ¶
func (dv *DebugPanel) StepInto()
StepInto continues to the next source line, entering function calls.
func (*DebugPanel) StepOut ¶
func (dv *DebugPanel) StepOut()
StepOut continues to the return point of the current function.
func (*DebugPanel) StepOver ¶
func (dv *DebugPanel) StepOver()
StepOver continues to the next source line, not entering function calls.
func (*DebugPanel) SyncBreaks ¶
func (dv *DebugPanel) SyncBreaks()
SyncBreaks synchronizes backup breaks with current breaks, after Breaks Changed
func (*DebugPanel) Toolbar ¶
func (dv *DebugPanel) Toolbar() *core.Frame
Toolbar returns the debug toolbar
func (*DebugPanel) UpdateAllBreaks ¶
func (dv *DebugPanel) UpdateAllBreaks()
UpdateAllBreaks updates all breakpoints
func (*DebugPanel) UpdateBreakInBuf ¶
func (dv *DebugPanel) UpdateBreakInBuf(fpath string, line int, stat DebugBreakStatus)
UpdateBreakInBuf updates break status in its TextBuf line is 1-based line number
func (*DebugPanel) UpdateFromState ¶
func (dv *DebugPanel) UpdateFromState()
UpdateFromState updates the view from current debugger state
func (*DebugPanel) UpdateTab ¶
func (dv *DebugPanel) UpdateTab(tab string)
UpdateTab updates given tab
func (*DebugPanel) UpdateView ¶
func (dv *DebugPanel) UpdateView()
UpdateView updates current view of state
func (*DebugPanel) VarValue ¶
func (dv *DebugPanel) VarValue(varNm string) string
VarValue returns the value of given variable, first looking in local stack vars and then in global vars
type FileNode ¶
FileNode is Code version of FileNode for FileTree
func NewFileNode ¶
NewFileNode returns a new FileNode with the given optional parent: FileNode is Code version of FileNode for FileTree
func (*FileNode) ContextMenu ¶
func (*FileNode) EditFiles ¶
func (fn *FileNode) EditFiles()
EditFiles calls EditFile on selected files
func (*FileNode) ExecCmdFile ¶
func (fn *FileNode) ExecCmdFile()
ExecCmdFile pops up a menu to select a command appropriate for the given node, and shows output in MainTab with name of command
func (*FileNode) ExecCmdNameFile ¶
ExecCmdNameFile executes given command name on node
func (*FileNode) RenameFiles ¶
func (fn *FileNode) RenameFiles()
RenameFiles calls RenameFile on any selected nodes
func (*FileNode) SetRunExec ¶
func (fn *FileNode) SetRunExec()
SetRunExec sets executable as the RunExec executable that will be run with Run / Debug buttons
func (*FileNode) SetRunExecs ¶
func (fn *FileNode) SetRunExecs()
SetRunExecs sets executable as the RunExec executable that will be run with Run / Debug buttons
type FileSettings ¶
type FileSettings struct { // if true, then all directories are placed at the top of the tree -- otherwise everything is alpha sorted DirsOnTop bool }
FileSettings contains file picker settings
func (*FileSettings) Defaults ¶
func (se *FileSettings) Defaults()
Defaults are the defaults for FileSettings
type FindPanel ¶
type FindPanel struct { core.Frame // parent code project Code *Code `json:"-" xml:"-"` // time of last find Time time.Time // compiled regexp Re *regexp.Regexp }
FindPanel is a find / replace widget that displays results in a TextEditor and has a toolbar for controlling find / replace process.
func NewFindPanel ¶
NewFindPanel returns a new FindPanel with the given optional parent: FindPanel is a find / replace widget that displays results in a TextEditor and has a toolbar for controlling find / replace process.
func (*FindPanel) CheckValidRegexp ¶
CheckValidRegexp returns false if using regexp and it is not valid
func (*FindPanel) CompileRegexp ¶
CompileRegexp compiles the regexp if necessary -- returns false if it is invalid
func (*FindPanel) FindAction ¶
func (fv *FindPanel) FindAction()
FindAction runs a new find with current params
func (*FindPanel) HighlightFinds ¶
func (fv *FindPanel) HighlightFinds(tv, ftv *texteditor.Editor, fbStLn, fCount int, find string)
HighlightFinds highlights all the find results in ftv buffer
func (*FindPanel) OpenFindURL ¶
func (fv *FindPanel) OpenFindURL(ur string, ftv *texteditor.Editor) bool
OpenFindURL opens given find:/// url from Find
func (*FindPanel) ReplaceAction ¶
ReplaceAction performs the replace -- if using regexp mode, regexp must be compiled in advance
func (*FindPanel) ReplaceAllAction ¶
func (fv *FindPanel) ReplaceAllAction()
ReplaceAllAction performs replace all, prompting before proceeding
func (*FindPanel) ShowResults ¶
func (fv *FindPanel) ShowResults(res []filetree.SearchResults)
ShowResults shows the results in the buffer
func (*FindPanel) TextEditor ¶
func (fv *FindPanel) TextEditor() *texteditor.Editor
TextEditorLay returns the find results TextEditor
type FindParams ¶
type FindParams struct { // find string Find string // replace string Replace string // ignore case IgnoreCase bool // use regexp regular expression search and replace Regexp bool // locations to search in Loc filetree.FindLocation // languages for files to search Languages []fileinfo.Known // history of finds FindHist []string // history of replaces ReplHist []string }
FindParams are parameters for find / replace
type LanguageOptions ¶
type LanguageOptions struct { // command(s) to run after a file of this type is saved PostSaveCmds CmdNames }
LanguageOptions defines options associated with a given language / file format only languages in fileinfo.Known list are supported..
type Languages ¶
type Languages map[fileinfo.Known]*LanguageOptions
Languages is a map of language options
var AvailableLanguages Languages
AvailableLanguages is the current set of language options -- can be loaded / saved / edited with settings. This is set to StandardLanguages at startup.
func (*Languages) OpenSettings ¶
OpenSettings opens the Langs from the app settings directory, using LanguageSettingsFilename.
func (*Languages) RevertToStandard ¶
func (lt *Languages) RevertToStandard()
RevertToStandard reverts this map to using the StdLangs that are compiled into the program and have all the lastest standards.
func (*Languages) SaveSettings ¶
SaveSettings saves the Langs to the app settings directory, using LanguageSettingsFilename.
func (Languages) Validate ¶
Validate checks to make sure post save command names exist, issuing warnings to log for those that don't
func (*Languages) ViewStandard ¶
func (lt *Languages) ViewStandard()
ViewStandard shows the standard languages that are compiled into the program and have all the lastest standards. Useful for comparing against custom lists.
type OpenNodes ¶
OpenNodes is a list of file nodes that have been opened for editing -- it is maintained in recency order -- most recent on top -- call Add every time a node is opened / visited for editing
func (*OpenNodes) Add ¶
Add adds given node to list of open nodes -- if already on the list it is moved to the top -- returns true if actually added. Connects to fn.TextBuf signal and auto-closes when buffer closes.
func (*OpenNodes) AddImpl ¶
AddImpl adds given node to list of open nodes -- if already on the list it is moved to the top -- returns true if actually added.
func (*OpenNodes) ByStringName ¶
ByStringName returns the open node with given strings name
func (*OpenNodes) Delete ¶
Delete deletes given node in list of open nodes, returning true if found and deleted
func (*OpenNodes) DeleteDeleted ¶
func (on *OpenNodes) DeleteDeleted()
DeleteDeleted deletes deleted nodes on list
func (*OpenNodes) DeleteIndex ¶
DeleteIndex deletes at given index
type ProjectSettings ¶
type ProjectSettings struct { // file picker settings Files FileSettings // editor settings Editor core.EditorSettings `display:"inline"` // current named-split config in use for configuring the splitters SplitName SplitName // the language associated with the most frequently encountered file // extension in the file tree -- can be manually set here as well MainLang fileinfo.Known // the type of version control system used in this project (git, svn, etc). // filters commands available VersionControl filetree.VersionControlName // current project filename for saving / loading specific Code // configuration information in a .code file (optional) ProjectFilename core.Filename `extension:".code"` // root directory for the project. all projects must be organized within // a top-level root directory, with all the files therein constituting // the scope of the project. By default it is the path for ProjectFilename ProjectRoot core.Filename // if true, use Go modules, otherwise use GOPATH -- this sets your effective GO111MODULE environment variable accordingly, dynamically -- updated by toolbar checkbox, dynamically GoMod bool // command(s) to run for main Build button BuildCmds CmdNames // build directory for main Build button -- set this to the directory where you want to build the main target for this project -- avail as {BuildDir} in commands BuildDir core.Filename // build target for main Build button, if relevant for your BuildCmds BuildTarg core.Filename // executable to run for this project via main Run button -- called by standard Run Project command RunExec core.Filename // command(s) to run for main Run button (typically Run Project) RunCmds CmdNames // custom debugger parameters for this project Debug cdebug.Params // saved find params Find FindParams `display:"-"` // saved structure params Symbols SymbolsParams `display:"-"` // directory properties Dirs filetree.DirFlagMap `display:"-"` // last register used Register RegisterName `display:"-"` // current splitter splits Splits [4]float32 `display:"-"` // current tabUnder setting for splits TabsUnder bool `display:"-"` }
ProjectSettings are the settings for saving for a project. This IS the project file
func (*ProjectSettings) Open ¶
func (se *ProjectSettings) Open(filename core.Filename) error
Open open from file
func (*ProjectSettings) RunExecIsExec ¶
func (se *ProjectSettings) RunExecIsExec() bool
RunExecIsExec returns true if the RunExec is actually executable
func (*ProjectSettings) Save ¶
func (se *ProjectSettings) Save(filename core.Filename) error
Save save to file
func (*ProjectSettings) Update ¶
func (se *ProjectSettings) Update()
type RegisterName ¶
type RegisterName string
RegisterName has an associated ValueView for selecting from the list of available named registers
func (RegisterName) Value ¶
func (rn RegisterName) Value() core.Value
Value registers core.Chooser as the core.Value widget for RegisterName
type Registers ¶
Registers is a list of named strings
var AvailableRegisters Registers
AvailableRegisters are available named registers. can be loaded / saved / edited with settings.
func (*Registers) OpenSettings ¶
OpenSettings opens the Registers from the app settings directory, using RegisterSettingsFilename.
func (*Registers) SaveSettings ¶
SaveSettings saves the Registers to the app settings directory, using RegisterSettingsFilename.
type SettingsData ¶
type SettingsData struct { core.SettingsBase // file picker settings Files FileSettings // environment variables to set for this app -- if run from the command line, standard shell environment variables are inherited, but on some OS's (Mac), they are not set when run as a gui app EnvVars map[string]string // if set, the current customized set of language options (see Edit Lang Opts) is saved / loaded along with other settings -- if not set, then you always are using the default compiled-in standard set (which will be updated) SaveLangOpts bool // if set, the current customized set of command parameters (see Edit Cmds) is saved / loaded along with other settings -- if not set, then you always are using the default compiled-in standard set (which will be updated) SaveCmds bool }
SettingsData is the data type for the overall user settings for Code.
func (*SettingsData) Apply ¶
func (se *SettingsData) Apply()
Apply settings updates things according with settings
func (*SettingsData) ApplyEnvVars ¶
func (se *SettingsData) ApplyEnvVars()
ApplyEnvVars applies environment variables set in EnvVars
func (*SettingsData) Defaults ¶
func (se *SettingsData) Defaults()
Defaults are the defaults for Settings
func (*SettingsData) EditCmds ¶
func (se *SettingsData) EditCmds()
EditCmds opens the CmdsView editor to customize commands you can run.
func (*SettingsData) EditLangOpts ¶
func (se *SettingsData) EditLangOpts()
EditLangOpts opens the LangsView editor to customize options for each type of language / data / file type.
func (*SettingsData) EditRegisters ¶
func (se *SettingsData) EditRegisters()
EditRegisters opens the RegistersView editor to customize saved registers
func (*SettingsData) EditSplits ¶
func (se *SettingsData) EditSplits()
EditSplits opens the SplitsView editor to customize saved splitter settings
func (*SettingsData) MakeToolbar ¶
func (se *SettingsData) MakeToolbar(p *tree.Plan)
func (*SettingsData) Open ¶
func (se *SettingsData) Open() error
func (*SettingsData) Save ¶
func (se *SettingsData) Save() error
type SpellPanel ¶
type SpellPanel struct { core.Frame // parent code project Code *Code `json:"-" xml:"-" copier:"-"` // texteditor that we're spell-checking Text *TextEditor `json:"-" xml:"-" copier:"-"` // current spelling errors Errs lexer.Line // current line in text we're on CurLn int // current index in Errs we're on CurIndex int // current unknown lex token UnkLex lexer.Lex // current unknown word UnkWord string // a list of suggestions from spell checker Suggest []string // last user action (ignore, change, learn) LastAction *core.Button }
SpellPanel is a widget that displays results of a spell check.
func NewSpellPanel ¶
func NewSpellPanel(parent ...tree.Node) *SpellPanel
NewSpellPanel returns a new SpellPanel with the given optional parent: SpellPanel is a widget that displays results of a spell check.
func (*SpellPanel) AcceptSuggestion ¶
func (sv *SpellPanel) AcceptSuggestion(s string)
AcceptSuggestion replaces the misspelled word with the word in the ChangeText field
func (*SpellPanel) Change ¶
func (sv *SpellPanel) Change()
func (*SpellPanel) ChangeBar ¶
func (sv *SpellPanel) ChangeBar() *core.Toolbar
ChangeBar returns the suggest toolbar
func (*SpellPanel) ChangeText ¶
func (sv *SpellPanel) ChangeText() *core.TextField
ChangeText returns the unknown word textfield from toolbar
func (*SpellPanel) CheckNext ¶
func (sv *SpellPanel) CheckNext()
CheckNext will find the next misspelled/unknown word and get suggestions for replacing it
func (*SpellPanel) Config ¶
func (sv *SpellPanel) Config(cv *Code, atv *TextEditor)
func (*SpellPanel) Destroy ¶
func (sv *SpellPanel) Destroy()
func (*SpellPanel) Init ¶
func (sv *SpellPanel) Init()
func (*SpellPanel) SetCode ¶
func (t *SpellPanel) SetCode(v *Code) *SpellPanel
SetCode sets the [SpellPanel.Code]: parent code project
func (*SpellPanel) SetCurIndex ¶
func (t *SpellPanel) SetCurIndex(v int) *SpellPanel
SetCurIndex sets the [SpellPanel.CurIndex]: current index in Errs we're on
func (*SpellPanel) SetCurLn ¶
func (t *SpellPanel) SetCurLn(v int) *SpellPanel
SetCurLn sets the [SpellPanel.CurLn]: current line in text we're on
func (*SpellPanel) SetErrs ¶
func (t *SpellPanel) SetErrs(v lexer.Line) *SpellPanel
SetErrs sets the [SpellPanel.Errs]: current spelling errors
func (*SpellPanel) SetLastAction ¶
func (t *SpellPanel) SetLastAction(v *core.Button) *SpellPanel
SetLastAction sets the [SpellPanel.LastAction]: last user action (ignore, change, learn)
func (*SpellPanel) SetSuggest ¶
func (t *SpellPanel) SetSuggest(v ...string) *SpellPanel
SetSuggest sets the [SpellPanel.Suggest]: a list of suggestions from spell checker
func (*SpellPanel) SetText ¶
func (t *SpellPanel) SetText(v *TextEditor) *SpellPanel
SetText sets the [SpellPanel.Text]: texteditor that we're spell-checking
func (*SpellPanel) SetUnkLex ¶
func (t *SpellPanel) SetUnkLex(v lexer.Lex) *SpellPanel
SetUnkLex sets the [SpellPanel.UnkLex]: current unknown lex token
func (*SpellPanel) SetUnkWord ¶
func (t *SpellPanel) SetUnkWord(v string) *SpellPanel
SetUnkWord sets the [SpellPanel.UnkWord]: current unknown word
func (*SpellPanel) SpellBar ¶
func (sv *SpellPanel) SpellBar() *core.Toolbar
SpellBar returns the spell toolbar
func (*SpellPanel) SuggestView ¶
func (sv *SpellPanel) SuggestView() *core.List
SuggestView returns the view for the list of suggestions
func (*SpellPanel) UnkEndPos ¶
func (sv *SpellPanel) UnkEndPos() lexer.Pos
UnkEndPos returns the end position of the current unknown word
func (*SpellPanel) UnkStartPos ¶
func (sv *SpellPanel) UnkStartPos() lexer.Pos
UnkStartPos returns the start position of the current unknown word
func (*SpellPanel) UnknownBar ¶
func (sv *SpellPanel) UnknownBar() *core.Toolbar
UnknownBar returns the toolbar that displays the unknown word
func (*SpellPanel) UnknownText ¶
func (sv *SpellPanel) UnknownText() *core.TextField
UnknownText returns the unknown word textfield from toolbar
type Split ¶
type Split struct { // name of splitter config Name string // brief description Desc string // splitter panel proportions Splits [4]float32 `min:"0" max:"1" step:".05"` // TabsUnder sets the tabs under the editors, making a more compact layout, // suitable for laptop and smaller displays. TabsUnder bool }
Split is a named splitter configuration
func (*Split) SaveSplits ¶
SaveSplits saves given splits to this setting -- must use copy!
type SplitName ¶
type SplitName string
SplitName has an associated ValueView for selecting from the list of available named splits
func (SplitName) Value ¶
Value registers core.Chooser as the core.Value widget for SplitName
type Splits ¶
type Splits []*Split //types:add
Splits is a list of named splitter configurations
var AvailableSplits Splits
AvailableSplits are available named splitter settings. can be loaded / saved / edited with settings. This is set to StandardSplits at startup.
func (*Splits) OpenSettings ¶
OpenSettings opens Splits from App standard prefs directory, using PrefSplitsFilename
func (*Splits) SaveSettings ¶
SaveSettings saves Splits to App standard prefs directory, using PrefSplitsFilename
type SymNode ¶
SymNode represents a language symbol -- the name of the node is the name of the symbol. Some symbols, e.g. type have children
func NewSymNode ¶
NewSymNode returns a new SymNode with the given optional parent: SymNode represents a language symbol -- the name of the node is the name of the symbol. Some symbols, e.g. type have children
type SymScopes ¶
type SymScopes int32 //enums:enum -trim-prefix SymScope
SymScopes corresponds to the search scope
const SymScopesN SymScopes = 2
SymScopesN is the highest valid value for type SymScopes, plus one.
func SymScopesValues ¶
func SymScopesValues() []SymScopes
SymScopesValues returns all possible values for the type SymScopes.
func (SymScopes) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*SymScopes) SetString ¶
SetString sets the SymScopes value from its string representation, and returns an error if the string is invalid.
func (*SymScopes) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type SymTree ¶
SymTree is a Tree that knows how to operate on FileNode nodes
func NewSymTree ¶
NewSymTree returns a new SymTree with the given optional parent: SymTree is a Tree that knows how to operate on FileNode nodes
type SymbolsPanel ¶
type SymbolsPanel struct { core.Frame // parent code project Code *Code `json:"-" xml:"-"` // params for structure display SymParams SymbolsParams // all the symbols for the file or package in a tree Syms *SymNode // only show symbols that match this string Match string }
SymbolsPanel is a widget that displays results of a file or package parse of symbols.
func NewSymbolsPanel ¶
func NewSymbolsPanel(parent ...tree.Node) *SymbolsPanel
NewSymbolsPanel returns a new SymbolsPanel with the given optional parent: SymbolsPanel is a widget that displays results of a file or package parse of symbols.
func (*SymbolsPanel) Config ¶
func (sv *SymbolsPanel) Config(cv *Code, sp SymbolsParams)
func (*SymbolsPanel) FrameWidget ¶
func (sv *SymbolsPanel) FrameWidget() *core.Frame
FrameWidget returns the frame widget.
func (*SymbolsPanel) Init ¶
func (sv *SymbolsPanel) Init()
func (*SymbolsPanel) OpenFile ¶
func (sv *SymbolsPanel) OpenFile()
OpenFile opens file-level symbols for current active texteditor
func (*SymbolsPanel) OpenPackage ¶
func (sv *SymbolsPanel) OpenPackage()
OpenPackage opens package-level symbols for current active texteditor
func (*SymbolsPanel) Params ¶
func (sv *SymbolsPanel) Params() *SymbolsParams
Params returns the symbols params
func (*SymbolsPanel) RefreshAction ¶
func (sv *SymbolsPanel) RefreshAction()
RefreshAction loads symbols for current file and scope
func (*SymbolsPanel) ScopeChooser ¶
func (sv *SymbolsPanel) ScopeChooser() *core.Chooser
ScopeChooser returns the scope Chooser
func (*SymbolsPanel) SearchText ¶
func (sv *SymbolsPanel) SearchText() *core.TextField
SearchText returns the unknown word textfield from toolbar
func (*SymbolsPanel) SetCode ¶
func (t *SymbolsPanel) SetCode(v *Code) *SymbolsPanel
SetCode sets the [SymbolsPanel.Code]: parent code project
func (*SymbolsPanel) SetMatch ¶
func (t *SymbolsPanel) SetMatch(v string) *SymbolsPanel
SetMatch sets the [SymbolsPanel.Match]: only show symbols that match this string
func (*SymbolsPanel) SetSymParams ¶
func (t *SymbolsPanel) SetSymParams(v SymbolsParams) *SymbolsPanel
SetSymParams sets the [SymbolsPanel.SymParams]: params for structure display
func (*SymbolsPanel) SetSyms ¶
func (t *SymbolsPanel) SetSyms(v *SymNode) *SymbolsPanel
SetSyms sets the [SymbolsPanel.Syms]: all the symbols for the file or package in a tree
func (*SymbolsPanel) Toolbar ¶
func (sv *SymbolsPanel) Toolbar() *core.Toolbar
Toolbar returns the symbols toolbar
func (*SymbolsPanel) UpdateSymbols ¶
func (sv *SymbolsPanel) UpdateSymbols()
type SymbolsParams ¶
type SymbolsParams struct { // scope of symbols to list Scope SymScopes }
SymbolsParams are parameters for structure view of file or package
type TextEditor ¶
type TextEditor struct { texteditor.Editor Code *Code }
TextEditor is the Code-specific version of the TextEditor, with support for setting / clearing breakpoints, etc
func NewTextEditor ¶
func NewTextEditor(parent ...tree.Node) *TextEditor
NewTextEditor returns a new TextEditor with the given optional parent: TextEditor is the Code-specific version of the TextEditor, with support for setting / clearing breakpoints, etc
func (*TextEditor) ClearBreakpoint ¶
func (ed *TextEditor) ClearBreakpoint(ln int)
func (*TextEditor) ContextMenu ¶
func (ed *TextEditor) ContextMenu(m *core.Scene)
ContextMenu builds the text editor context menu
func (*TextEditor) CurDebug ¶
func (ed *TextEditor) CurDebug() (*DebugPanel, bool)
CurDebug returns the current debugger, true if it is present
func (*TextEditor) DebugVarValueAtPos ¶
func (ed *TextEditor) DebugVarValueAtPos(pos image.Point) string
DebugVarValueAtPos returns debugger variable value for given mouse position
func (*TextEditor) FindFrames ¶
func (ed *TextEditor) FindFrames(ln int)
FindFrames finds stack frames in the debugger containing this file and line
func (*TextEditor) HandleDebugDoubleClick ¶
func (ed *TextEditor) HandleDebugDoubleClick(e events.Event, tpos lexer.Pos)
DoubleClickEvent processes double-clicks NOT on the line-number section
func (*TextEditor) HasBreakpoint ¶
func (ed *TextEditor) HasBreakpoint(ln int) bool
HasBreakpoint checks if line has a breakpoint
func (*TextEditor) Init ¶
func (ed *TextEditor) Init()
func (*TextEditor) LineNumberDoubleClick ¶
func (ed *TextEditor) LineNumberDoubleClick(tpos lexer.Pos)
LineNumberDoubleClick processes double-clicks on the line-number section
func (*TextEditor) SetBreakpoint ¶
func (ed *TextEditor) SetBreakpoint(ln int)
SetBreakpoint sets breakpoint at given line (e.g., tv.CursorPos.Ln)
func (*TextEditor) SetCode ¶
func (t *TextEditor) SetCode(v *Code) *TextEditor
SetCode sets the [TextEditor.Code]
func (*TextEditor) ToggleBreakpoint ¶
func (ed *TextEditor) ToggleBreakpoint(ln int)
func (*TextEditor) WidgetTooltip ¶
type VarView ¶
type VarView struct { core.Frame // variable being edited Var *cdebug.Variable `set:"-"` SelectVar *cdebug.Variable `set:"-"` // frame info FrameInfo string `set:"-"` // parent DebugPanel DbgView *DebugPanel `json:"-" xml:"-"` }
VarView shows a debug variable in an inspector-like framework, with sub-variables in a tree.
func NewVarView ¶
NewVarView returns a new VarView with the given optional parent: VarView shows a debug variable in an inspector-like framework, with sub-variables in a tree.
func VarViewDialog ¶
func VarViewDialog(vr *cdebug.Variable, frinfo string, dbgVw *DebugPanel) *VarView
VarViewDialog opens an interactive editor of the given variable.
func (*VarView) MakeToolbar ¶
func (*VarView) SetDbgView ¶
func (t *VarView) SetDbgView(v *DebugPanel) *VarView
SetDbgView sets the [VarView.DbgView]: parent DebugPanel
Source Files
¶
- appbar.go
- argvars.go
- cmdstd.go
- code.go
- commandbufs.go
- commands.go
- console.go
- debugpanel.go
- doc.go
- editor.go
- enumgen.go
- events.go
- files.go
- filetree.go
- findpanel.go
- keymap.go
- languages.go
- panels.go
- registers.go
- settings.go
- spellpanel.go
- splits.go
- symbolspanel.go
- texteditor.go
- texteditors.go
- typegen.go
- values.go
- views.go