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 CommandName(cat, cmd string) string
- func ConfigOutputTextEditor(ed *textcore.Editor)
- func DebugSettingsEditor(pf *cdebug.Params) *core.Form
- func ExecCmds(cv *Code) [][]string
- func GetVCSRepo(obj any) vcs.Repo
- func LangSymbolToSyms(sy lang.Symbol) syms.Symbol
- func LanguagesView(pt *Languages)
- func MarkupCmdOutput(buf *lines.Lines, out []rune, lexName string) rich.Text
- func MarkupStderr(buf *lines.Lines, out []rune) rich.Text
- func MarkupStdout(buf *lines.Lines, out []rune) rich.Text
- func MergeAvailableCmds()
- func NewDebugger(sup fileinfo.Known, path, rootPath string, outbuf *lines.Lines, ...) (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 SetVCSRepo(obj any, repo vcs.Repo)
- func SplitsView(pt *Splits)
- func UpdateParserUse(cvs ...*Code)
- 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) ActiveEditor() *TextEditor
- func (cv *Code) ActiveLines() *lines.Lines
- 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, ln *lines.Lines) 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) CloseOpenFile(fname string)
- func (cv *Code) CloseOpenFiles(fnames []string)
- func (cv *Code) CmdBuffsReMarkup()
- func (cv *Code) CommandMenu(lang fileinfo.Known, repo vcs.Repo, fname string) func(mm *core.Scene, pos image.Point)
- func (cv *Code) CommandMenuFileNode(fn *filetree.Node) func(mm *core.Scene, pos image.Point)
- func (cv *Code) CommandMenuLines(ln *lines.Lines) func(mm *core.Scene, pos image.Point)
- 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) ConfigLines(tb *lines.Lines)
- 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) CurrentTerminal() *terminal.Terminal
- 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) DiffFileLines(lna *lines.Lines, fnmB string)
- func (cv *Code) DiffFiles(fnmA, fnmB core.Filename)
- func (cv *Code) EditProjectSettings()
- func (cv *Code) EditRecentPaths()
- func (cv *Code) EditorButtonByIndex(idx int) *core.Button
- func (cv *Code) EditorButtonMenu(idx int, m *core.Scene)
- func (cv *Code) EditorByIndex(idx int) *TextEditor
- func (cv *Code) EditorForLines(ln *lines.Lines) (*TextEditor, int, bool)
- func (cv *Code) EditorIndex(av *TextEditor) int
- 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) ExecCmdNameFile(fname string, cmdNm CmdName)
- func (cv *Code) ExecCmds(cmdNms CmdNames)
- func (cv *Code) ExecCmdsFile(fname string, cmdNames CmdNames)
- func (cv *Code) ExpandSelection()
- func (cv *Code) FileNodeForFile(fpath string) *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, loc Locations, ...)
- func (cv *Code) FindImplementations()
- func (cv *Code) FindReferences()
- func (cv *Code) FocusActiveEditor() *TextEditor
- func (cv *Code) FocusNextPanel()
- func (cv *Code) FocusOnPanel(panel int) bool
- func (cv *Code) FocusOnTabs() bool
- func (cv *Code) FocusPrevPanel()
- func (cv *Code) GetOpenFile(fpath string) *lines.Lines
- func (cv *Code) GotoDefinition()
- func (cv *Code) GotoTypeDefinition()
- func (cv *Code) GrabSettings()
- func (cv *Code) GuessMainLang() bool
- func (cv *Code) HelpWiki()
- func (cv *Code) InRootPath(fpath string) bool
- 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) LangFormat()
- func (cv *Code) LangSvc() *LangService
- func (cv *Code) LinkViewFile(fnm string) (*TextEditor, int, bool)
- func (cv *Code) LinkViewLines(ln *lines.Lines) (*TextEditor, int)
- func (cv *Code) Lookup()
- func (cv *Code) LookupFun(data any, txt string, posLine, posChar int) (ld complete.Lookup)
- func (cv *Code) MakeToolbar(p *tree.Plan)
- func (cv *Code) MenuSearch(items *[]core.ChooserItem)
- 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) NewTerminal()
- func (cv *Code) NextProblem()
- func (cv *Code) NextTab()
- func (cv *Code) NextTextEditor() (*TextEditor, int)
- func (cv *Code) NextViewFile(fnm string) (*TextEditor, int, bool)
- func (cv *Code) NextViewLines(ln *lines.Lines) (*TextEditor, int)
- func (cv *Code) OpenConsoleTab()
- func (cv *Code) OpenFile(fnm string)
- func (cv *Code) OpenFileAtRegion(filename string, tr textpos.Region) (tv *TextEditor, ok bool)
- func (cv *Code) OpenFileURL(ur string, ftv *textcore.Editor) bool
- func (cv *Code) OpenFindURL(ur string, ftv *textcore.Editor) bool
- func (cv *Code) OpenLines(fpath string) *lines.Lines
- 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) OpenTerminal()
- func (cv *Code) OverflowMenu(m *core.Scene, pos image.Point)
- func (cv *Code) PanelIsOpen(panel int) bool
- func (cv *Code) PasteRect()
- func (cv *Code) PrevTab()
- func (cv *Code) QuickFix()
- func (cv *Code) ReCase(c strcase.Cases) string
- func (cv *Code) RecycleCmdBuf(cmdName string) (*lines.Lines, bool)
- func (cv *Code) RecycleCmdTab(cmdName string) (*lines.Lines, *textcore.Editor, bool)
- func (cv *Code) RecycleFile(fpath string) (*lines.Lines, bool)
- func (cv *Code) RecycleTabTextEditor(name string, buf *lines.Lines) *textcore.Editor
- func (cv *Code) RegisterCopy(regNm RegisterName)
- func (cv *Code) RegisterPaste(ctx core.Widget)
- func (cv *Code) RenameSymbol()
- func (cv *Code) ReplaceInActive()
- func (cv *Code) RevertActiveView()
- func (cv *Code) Run()
- func (cv *Code) RunBuild()
- func (cv *Code) RunPostCmds(ln *lines.Lines) 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) SaveAllOpenFiles()
- func (cv *Code) SaveProject()
- func (cv *Code) SaveProjectAs(filename core.Filename) bool
- func (cv *Code) SaveProjectIfExists(saveAllFiles bool) bool
- func (cv *Code) SelectOpenFile()
- func (cv *Code) SelectTabByName(name string) core.Widget
- func (cv *Code) SelectedFileNode() *filetree.Node
- func (cv *Code) SetActiveEditor(av *TextEditor) int
- func (cv *Code) SetActiveEditorIndex(idx int) *TextEditor
- func (cv *Code) SetActiveFileInfo(ln *lines.Lines)
- func (t *Code) SetActiveLang(v fileinfo.Known) *Code
- func (cv *Code) SetArgVarVals()
- func (cv *Code) SetInlayHints(on bool)
- func (t *Code) SetOpenFiles(v OpenFiles) *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(fpath string, ln int) (*TextEditor, error)
- func (cv *Code) ShowInlayHints()
- func (cv *Code) ShowProblems(scope Locations)
- func (cv *Code) ShowSignatureHelp()
- func (cv *Code) ShrinkSelection()
- func (cv *Code) SourceOfGenerated(ln *lines.Lines) *lines.Lines
- 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) TerminalCdToFile()
- func (cv *Code) TerminalCdToProject()
- func (cv *Code) Terminals() []*terminal.Terminal
- 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() vcs.Types
- func (cv *Code) ViewFile(fnm core.Filename) (*TextEditor, int, bool)
- func (cv *Code) ViewFileInIndex(fnm string, idx int) (*TextEditor, int, bool)
- func (cv *Code) ViewLines(tv *TextEditor, vidx int, ln *lines.Lines)
- func (cv *Code) WorkspaceSymbolPrompt()
- type Command
- func (cm *Command) AppendCmdOut(cv *Code, buf *lines.Lines, out []rune)
- 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(buf *lines.Lines, out []rune) rich.Text
- func (cm *Command) PromptUser(cv *Code, buf *lines.Lines, pvals map[string]struct{})
- func (cm *Command) Run(cv *Code, buf *lines.Lines)
- func (cm *Command) RunAfterPrompts(cv *Code, buf *lines.Lines)
- func (cm *Command) RunBuf(cv *Code, buf *lines.Lines, cma *CmdAndArgs) bool
- func (cm *Command) RunBufWait(cv *Code, buf *lines.Lines, cma *CmdAndArgs) bool
- func (cm *Command) RunNoBuf(cv *Code, cma *CmdAndArgs) bool
- func (cm *Command) RunStatus(cv *Code, buf *lines.Lines, 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, vcstype vcs.Types) [][]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() *textcore.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 (t *DebugPanel) SetKnown(v fileinfo.Known) *DebugPanel
- func (dv *DebugPanel) SetStatus(stat cdebug.Status)
- 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, pos image.Point)
- func (fn *FileNode) DeleteFiles()
- 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) OnClose()
- func (fn *FileNode) OnOpen()
- 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 *textcore.Editor, res *search.Results, find string)
- func (fv *FindPanel) Init()
- func (fv *FindPanel) NextFind()
- func (fv *FindPanel) OnAdd()
- func (fv *FindPanel) OpenFindURL(ur string, ftv *textcore.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) SetOnReplace(v func(tv *TextEditor)) *FindPanel
- func (t *FindPanel) SetRe(v *regexp.Regexp) *FindPanel
- func (t *FindPanel) SetRenamed(v int) *FindPanel
- func (t *FindPanel) SetRenaming(v bool) *FindPanel
- func (t *FindPanel) SetTime(v time.Time) *FindPanel
- func (fv *FindPanel) ShowResults(res []search.Results)
- func (fv *FindPanel) TextEditor() *textcore.Editor
- type FindParams
- type LangBackends
- func (i LangBackends) Desc() string
- func (i LangBackends) Int64() int64
- func (i LangBackends) MarshalText() ([]byte, error)
- func (i *LangBackends) SetInt64(in int64)
- func (i *LangBackends) SetString(s string) error
- func (i LangBackends) String() string
- func (i *LangBackends) UnmarshalText(text []byte) error
- func (i LangBackends) Values() []enums.Enum
- type LangService
- func (ls *LangService) Activated(tv *TextEditor)
- func (ls *LangService) Change(ln *lines.Lines)
- func (ls *LangService) Closed(ln *lines.Lines)
- func (ls *LangService) DiagStatusMsg(ln *lines.Lines) string
- func (ls *LangService) EditorInput(tv *TextEditor)
- func (ls *LangService) ExpandSelection(tv *TextEditor) bool
- func (ls *LangService) FilesChanged(changes []lsp.FileChange)
- func (ls *LangService) HoverAt(tv *TextEditor, pos textpos.Pos) string
- func (ls *LangService) Input(ln *lines.Lines)
- func (ls *LangService) LSPActive(ln *lines.Lines) bool
- func (ls *LangService) Lookup(tv *TextEditor) bool
- func (ls *LangService) ProgressStatusMsg() string
- func (ls *LangService) Saved(ln *lines.Lines)
- func (ls *LangService) ScheduleSigHelp(tv *TextEditor)
- func (ls *LangService) SemanticRefresh(ln *lines.Lines)
- func (ls *LangService) ShrinkSelection(tv *TextEditor)
- func (ls *LangService) SigHelpUpdate(tv *TextEditor)
- func (ls *LangService) SigStatusMsg() string
- func (ls *LangService) Stop()
- 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 Locations
- func (i Locations) Desc() string
- func (i Locations) Int64() int64
- func (i Locations) MarshalText() ([]byte, error)
- func (i *Locations) SetInt64(in int64)
- func (i *Locations) SetString(s string) error
- func (i Locations) String() string
- func (i *Locations) UnmarshalText(text []byte) error
- func (i Locations) Values() []enums.Enum
- type OpenFiles
- func (of *OpenFiles) Add(ln *lines.Lines) *lines.Lines
- func (of *OpenFiles) Move(to, from int)
- func (of *OpenFiles) NChanged() int
- func (of *OpenFiles) Paths() []string
- func (of *OpenFiles) ReMarkup()
- func (of *OpenFiles) SearchInPaths(paths []string, find string, ignoreCase bool, langs []fileinfo.Known) []search.Results
- func (of *OpenFiles) SearchRegexpInPaths(paths []string, re *regexp.Regexp, langs []fileinfo.Known) []search.Results
- func (of *OpenFiles) Strings(root string) []string
- type PreviewPanel
- type ProjectSettings
- type RegisterName
- type Registers
- type SettingsData
- func (se *SettingsData) Apply()
- 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() textpos.Pos
- func (sv *SpellPanel) UnkStartPos() textpos.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) Init()
- func (sv *SymbolsPanel) OpenFile()
- func (sv *SymbolsPanel) OpenPackage()
- func (sv *SymbolsPanel) Params() *SymbolsParams
- 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) UpdateSymbols()
- type SymbolsParams
- type TerminalSettings
- type TextEditor
- func (ed *TextEditor) ClearBreakpoint(ln int)
- func (ed *TextEditor) ContextMenu(m *core.Scene, pos image.Point)
- 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 textpos.Pos)
- func (ed *TextEditor) HasBreakpoint(ln int) bool
- func (ed *TextEditor) Init()
- func (ed *TextEditor) LineNumberDoubleClick(tpos textpos.Pos)
- func (ed *TextEditor) SetBreakpoint(ln int)
- func (t *TextEditor) SetCode(v *Code) *TextEditor
- func (ed *TextEditor) ShowContextMenu(e events.Event)
- 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 ( FileTreeIndex = iota TextEditor1Index TextEditor2Index TabsIndex )
These are then the fixed indices of the different elements in the splitview
const ( CmdWait = true CmdNoWait = false CmdFocus = true CmdNoFocus = false CmdConfirm = true CmdNoConfirm = false )
Use these for more obvious command options
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 // report problems with open files. KeyProblems // move to next problem (if problems tab open). KeyNextProblem // lookup at the cursor: quick fixes if there is an error there, // and otherwise completions and go to definition (see [Code.Lookup]) KeyQuickFix // show signature help for the callable at the cursor KeySignatureHelp // expand the selection to the next larger syntactic element KeyExpandSelection // shrink the selection to the next smaller syntactic element KeyShrinkSelection )
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.
const TerminalTabName = "Terminal"
TerminalTabName is the name of the tab of the default terminal.
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{ 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: "Build All", Desc: "run go 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: "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: "Test All", 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; --detach <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", "{PromptString1}"}}}, Dir: "{FileDirPath}", Wait: CmdWait, 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: CmdConfirm}, {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 StandardIgnoreProblems = []string{
"struct literal uses unkeyed fields",
"copies lock value",
"passes lock by value",
"non-constant format string",
"error strings should not be capitalized",
"error strings should not end with punctuation",
"should not use dot imports",
"methods on the same type should have the same receiver name",
"receiver name should be",
"could use tagged switch",
"could remove embedded field",
"should merge variable declaration with assignment",
"unused parameter",
"can be modernized",
"interface{} can be replaced by any",
"can be simplified using",
"ReplaceAll instead",
"could apply De Morgan's law",
"could lift into loop condition",
"could merge conditional assignment",
"could eliminate this type assertion",
}
StandardIgnoreProblems are commonly ignored Go warnings, which are added to ProjectSettings.IgnoreProblems, disabled, so that they are easy to enable.
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+C p": KeyProblems, "Control+C Control+P": KeyProblems, "Control+C n": KeyNextProblem, "Control+C Control+N": KeyNextProblem, "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, "Control+.": KeyQuickFix, "Control+Shift+Space": KeySignatureHelp, "Control+Shift+UpArrow": KeyExpandSelection, "Control+Shift+DownArrow": KeyShrinkSelection, }}, {"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+C p": KeyProblems, "Control+C Control+P": KeyProblems, "Control+C n": KeyNextProblem, "Control+C Control+N": KeyNextProblem, "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, "Control+.": KeyQuickFix, "Control+Shift+Space": KeySignatureHelp, "Control+Shift+UpArrow": KeyExpandSelection, "Control+Shift+DownArrow": KeyShrinkSelection, }}, {"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+C p": KeyProblems, "Control+C Control+P": KeyProblems, "Control+C n": KeyNextProblem, "Control+C Control+N": KeyNextProblem, "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, "Control+.": KeyQuickFix, "Control+Shift+Space": KeySignatureHelp, "Control+Shift+UpArrow": KeyExpandSelection, "Control+Shift+DownArrow": KeyShrinkSelection, }}, {"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+B p": KeyProblems, "Control+B Control+P": KeyProblems, "Control+B n": KeyNextProblem, "Control+B Control+N": KeyNextProblem, "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, "Control+.": KeyQuickFix, "Control+Shift+Space": KeySignatureHelp, "Control+Shift+UpArrow": KeyExpandSelection, "Control+Shift+DownArrow": KeyShrinkSelection, }}, {"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+B p": KeyProblems, "Control+B Control+P": KeyProblems, "Control+B n": KeyNextProblem, "Control+B Control+N": KeyNextProblem, "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, "Control+.": KeyQuickFix, "Control+Shift+Space": KeySignatureHelp, "Control+Shift+UpArrow": KeyExpandSelection, "Control+Shift+DownArrow": KeyShrinkSelection, }}, {"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+B p": KeyProblems, "Control+B Control+P": KeyProblems, "Control+B n": KeyNextProblem, "Control+B Control+N": KeyNextProblem, "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, "Control+.": KeyQuickFix, "Control+Shift+Space": KeySignatureHelp, "Control+Shift+UpArrow": KeyExpandSelection, "Control+Shift+DownArrow": KeyShrinkSelection, }}, }
StandardKeyMaps are the standard extended maps for Code
var StandardLanguages = Languages{ fileinfo.Go: {PostSaveCmds: CmdNames{"Go: Imports File"}}, fileinfo.Markdown: {Parser: true}, fileinfo.TeX: {Parser: true}, }
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 CommandName ¶
CommandName returns a qualified command name as cat: cmd
func ConfigOutputTextEditor ¶
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 GetVCSRepo ¶ added in v0.1.1
GetVCSRepo returns vcs.Repo from given object's metadata. Returns nil if none or no metadata.
func LangSymbolToSyms ¶ added in v0.2.0
LangSymbolToSyms converts a lang.Symbol to the syms.Symbol representation used by the symbols panels, recursively.
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 MergeAvailableCmds ¶
func MergeAvailableCmds()
MergeAvailableCmds updates the AvailCmds list from CustomCmds and StdCmds
func NewDebugger ¶
func NewDebugger(sup fileinfo.Known, path, rootPath string, outbuf *lines.Lines, 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 SetVCSRepo ¶ added in v0.1.1
SetVCSRepo sets a pointer to the vcs.Repo into given object's metadata, used on Lines.
func UpdateParserUse ¶ added in v0.2.0
func UpdateParserUse(cvs ...*Code)
UpdateParserUse applies changes in the use of the built-in parser, from the language backend of the projects and the Parser language options, to the files open in all Code windows. Any given Code windows are included even if they are not yet in core.AllRenderWindows.
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 *textcore.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
ActiveEditorIndex int `set:"-" json:"-"`
// list of open files, most recent first
OpenFiles OpenFiles `json:"-"`
// the command buffers for commands run in this project
CmdBufs map[string]*lines.Lines `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:"-"`
// contains filtered or unexported fields
}
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) ActiveEditor ¶ added in v0.1.1
func (cv *Code) ActiveEditor() *TextEditor
ActiveEditor returns the currently active TextEditor
func (*Code) ActiveLines ¶ added in v0.1.1
ActiveLines returns the Lines for the active file; nil if none
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 ¶ added in v0.1.1
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) CloseOpenFile ¶ added in v0.1.1
CloseOpenFile closes given file if it is open.
func (*Code) CloseOpenFiles ¶ added in v0.1.1
CloseOpenFiles closes any open files on the given list of filenames.
func (*Code) CmdBuffsReMarkup ¶ added in v0.1.1
func (cv *Code) CmdBuffsReMarkup()
CmdBuffsReMarkup runs ReMarkup on all command bufs.
func (*Code) CommandMenu ¶ added in v0.1.1
func (cv *Code) CommandMenu(lang fileinfo.Known, repo vcs.Repo, fname string) func(mm *core.Scene, pos image.Point)
CommandMenu returns a menu function for commands for given language and vcs name
func (*Code) CommandMenuFileNode ¶ added in v0.1.1
CommandMenuFileNode returns a menu function for commands for FileNode.
func (*Code) CommandMenuLines ¶ added in v0.1.1
CommandMenuLines returns a menu function for commands for Lines.
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) ConfigLines ¶ added in v0.1.1
ConfigLines configures the text buffer according to the settings, for files that are being edited (not for output buffers).
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) CurrentTerminal ¶ added in v0.2.3
CurrentTerminal returns the terminal for terminal commands: the one in the selected tab, if it is a terminal, or else the last one used, or else the default one, which is made if needed.
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) DiffFileLines ¶ added in v0.1.1
DiffFileLines 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) EditorButtonByIndex ¶ added in v0.1.1
EditorButtonByIndex returns the top texteditor menu button by index (0 or 1)
func (*Code) EditorButtonMenu ¶ added in v0.1.1
func (*Code) EditorByIndex ¶ added in v0.1.1
func (cv *Code) EditorByIndex(idx int) *TextEditor
EditorByIndex returns the TextEditor by index (0 or 1), nil if not found
func (*Code) EditorForLines ¶ added in v0.1.1
EditorForLines finds a Editor that is viewing given Lines, and its index, or false if none is
func (*Code) EditorIndex ¶ added in v0.1.1
func (cv *Code) EditorIndex(av *TextEditor) int
EditorIndex finds index of given texteditor (0 or 1)
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) ExecCmdNameFile ¶ added in v0.1.1
ExecCmdNameFile executes command of given name on given file name
func (*Code) ExecCmdsFile ¶ added in v0.1.1
ExecCmdsFile executes a sequence of commands on file node
func (*Code) ExpandSelection ¶ added in v0.2.0
func (cv *Code) ExpandSelection()
ExpandSelection expands the selection to the next larger syntactic element around it, using the language server: word, expression, statement, block, function, etc.
func (*Code) FileNodeForFile ¶
FileNodeForFile returns file node for given file path. nil if not found or is a directory.
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 Locations, 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) FindImplementations ¶ added in v0.2.0
func (cv *Code) FindImplementations()
FindImplementations lists the implementations of the interface or method at the cursor, or the interfaces that the type at the cursor implements, using the language server, in a menu for selection.
func (*Code) FindReferences ¶ added in v0.2.0
func (cv *Code) FindReferences()
FindReferences lists all references to the symbol at the cursor, using the language server, in the References tab, where they can be clicked to go to them.
func (*Code) FocusActiveEditor ¶ added in v0.1.1
func (cv *Code) FocusActiveEditor() *TextEditor
FocusActiveEditor 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) GetOpenFile ¶ added in v0.1.1
GetOpenFile either returns the Lines for a file in OpenFiles.
func (*Code) GotoDefinition ¶ added in v0.2.0
func (cv *Code) GotoDefinition()
GotoDefinition jumps to the definition of the symbol at the cursor, using the active language backend.
func (*Code) GotoTypeDefinition ¶ added in v0.2.0
func (cv *Code) GotoTypeDefinition()
GotoTypeDefinition jumps to the definition of the type of the symbol at the cursor, e.g., the type of a variable, using the language server.
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) InRootPath ¶ added in v0.1.1
InRootPath returns true if the given path, which must be an absolute path, is under the current file browser root path.
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) LangFormat ¶ added in v0.2.0
func (cv *Code) LangFormat()
LangFormat formats the current file using the active language backend, if it supports formatting (e.g., gopls for Go).
func (*Code) LangSvc ¶ added in v0.2.0
func (cv *Code) LangSvc() *LangService
LangSvc returns the language service for this Code window, creating it if needed.
func (*Code) LinkViewFile ¶
func (cv *Code) LinkViewFile(fnm string) (*TextEditor, int, bool)
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. It uses SourceOfGenerated to get the source of any generated files.
func (*Code) LinkViewLines ¶ added in v0.1.1
func (cv *Code) LinkViewLines(ln *lines.Lines) (*TextEditor, int)
LinkViewLines opens the file Lines in the 2nd texteditor, which is next to the tabs where links are clicked, if it is not collapsed, else 1st.
func (*Code) Lookup ¶ added in v0.2.0
func (cv *Code) Lookup()
Lookup is the Ctrl+. action at the cursor: if there is an error with quick fixes from the language server there, it shows a menu of them, and otherwise it shows the completions for the text up to the cursor, headed by a go to definition item for the symbol at the cursor.
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) MenuSearch ¶ added in v0.1.1
func (cv *Code) MenuSearch(items *[]core.ChooserItem)
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 vcs.Types) *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) NewTerminal ¶ added in v0.2.3
func (cv *Code) NewTerminal()
NewTerminal makes a new terminal tab, in addition to the default one. The keymap.New key does this in a terminal (see terminal.KeyFunction).
func (*Code) NextProblem ¶ added in v0.2.1
func (cv *Code) NextProblem()
NextProblem goes to the current problem in the Problems tab, if the cursor is not already on it in the active editor, and otherwise to the next one. The current problem is the last one clicked or gone to, and when it goes away, e.g., after applying a fix for it, NextProblem goes to the next one, which is highlighted. The Problems tab is shown if it is not already.
func (*Code) NextTab ¶ added in v0.2.3
func (cv *Code) NextTab()
NextTab selects the next tab in the tabs panel, after the last one the first, and focuses it. Shift+RightArrow does this when the focus is in the tabs panel.
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 ¶
func (cv *Code) NextViewFile(fnm string) (*TextEditor, int, bool)
NextViewFile sets the next text view to view given file name. Will use a more robust search of file tree if file path is not directly openable. Returns texteditor and its index, false if not found.
func (*Code) NextViewLines ¶ added in v0.1.1
func (cv *Code) NextViewLines(ln *lines.Lines) (*TextEditor, int)
NextViewLines sets the next text view to view file in given lines. 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) OpenFileURL ¶
OpenFileURL is the link handler for command editors: opens given file:/// url
func (*Code) OpenFindURL ¶
OpenFindURL opens given find:/// url from Find; delegates to FindPanel
func (*Code) OpenLines ¶ added in v0.1.1
OpenLines opens a Lines buffer for given file path. Must already have determined that it is not in the list of OpenFiles, and it must be an Abs path. If file is outside the current root path, it is also added to external files in the file browser.
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) OpenTerminal ¶ added in v0.2.3
func (cv *Code) OpenTerminal()
OpenTerminal shows the default terminal tab, making it if needed. Terminals run the shell (or the command in the terminal settings) in the project root directory.
func (*Code) PanelIsOpen ¶
PanelIsOpen returns true if the given panel has not been collapsed and is avail and visible for displaying something
func (*Code) PrevTab ¶ added in v0.2.3
func (cv *Code) PrevTab()
PrevTab selects the previous tab in the tabs panel, before the first one the last, and focuses it. Shift+LeftArrow does this when the focus is in the tabs panel.
func (*Code) QuickFix ¶ added in v0.2.0
func (cv *Code) QuickFix()
QuickFix prompts for and applies a quick fix or refactoring from the language server at the cursor or selection, like other editors' Ctrl+. (Ctrl+period). The diagnostics cached for the position are sent as context, which is what turns the quick fixes on: organize imports, missing returns, error-check wrapping, typo fixes, etc, along with refactorings like extract function/variable.
func (*Code) ReCase ¶
ReCase replaces currently selected text in current active view with given case
func (*Code) RecycleCmdBuf ¶
RecycleCmdBuf creates the buffer for command output, or returns existing. Returns true if new buffer created.
func (*Code) RecycleCmdTab ¶
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) RecycleFile ¶ added in v0.1.1
RecycleFile either opens given file or returns already open one. Returns true if it is a new file, false otherwise. If file is outside the current root path, it is also added to external files in the file browser. Can return nil if not openable.
func (*Code) RecycleTabTextEditor ¶
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) RenameSymbol ¶ added in v0.2.0
func (cv *Code) RenameSymbol()
RenameSymbol prompts for a new name and renames the symbol at the cursor across the workspace, using the language server. The proposed edits are shown in the Find tab for review before applying: click a result to jump to it, Replace for one at a time, or All for all (open buffers are edited, unopened files are opened; save to write).
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) RunPostCmds ¶ added in v0.1.1
RunPostCmds runs any registered post commands on the given open file. 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) SaveAllOpenFiles ¶ added in v0.1.1
func (cv *Code) SaveAllOpenFiles()
SaveAllOpenFiles 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) SelectOpenFile ¶ added in v0.1.1
func (cv *Code) SelectOpenFile()
SelectOpenFile pops up a menu to select an open file 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) SetActiveEditor ¶ added in v0.1.1
func (cv *Code) SetActiveEditor(av *TextEditor) int
SetActiveEditor sets the given texteditor as the active one, configures it, and returns its index.
func (*Code) SetActiveEditorIndex ¶ added in v0.1.1
func (cv *Code) SetActiveEditorIndex(idx int) *TextEditor
SetActiveEditorIndex sets the given view index as the currently active Editor -- returns that texteditor. This is the main method for activating a text editor.
func (*Code) SetActiveFileInfo ¶
SetActiveFileInfo sets the active file info from Lines.
func (*Code) SetActiveLang ¶
SetActiveLang sets the Code.ActiveLang: language for current active filename
func (*Code) SetArgVarVals ¶
func (cv *Code) SetArgVarVals()
SetArgVarVals sets the ArgVar values for commands, from Code values
func (*Code) SetInlayHints ¶ added in v0.2.0
SetInlayHints turns the inlay hints setting on or off, applying it to the running language servers: already-running gopls re-fetches its settings through workspace/configuration (gopls supports dynamic configuration), so no restart is needed for it; servers that only read options at startup pick the change up when they next start. The server work runs in the background.
func (*Code) SetOpenFiles ¶ added in v0.1.1
SetOpenFiles sets the Code.OpenFiles: list of open files, 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(fpath string, ln int) (*TextEditor, error)
ShowFile shows given file name at given line, returning TextEditor showing it or error if not found.
func (*Code) ShowInlayHints ¶ added in v0.2.0
func (cv *Code) ShowInlayHints()
ShowInlayHints requests the language server's inlay hints for the current file and lists them in a dialog, as a display-only overview: nothing is inserted into the buffer (the per-hint TextEdits that would insert the label text are ignored). Requires the InlayHints setting to be on for servers like gopls that gate hints behind settings.
func (*Code) ShowProblems ¶ added in v0.2.0
ShowProblems shows the problems (errors and warnings) reported by the language servers for the files in the given scope in the Problems tab, where they can be clicked to go to them. The tab is updated as the problems change, while it is open.
func (*Code) ShowSignatureHelp ¶ added in v0.2.0
func (cv *Code) ShowSignatureHelp()
ShowSignatureHelp explicitly requests signature help at the cursor and shows all of the signatures in a dialog, for cases where the automatic display is not desired or the cursor is not in a call context.
func (*Code) ShrinkSelection ¶ added in v0.2.0
func (cv *Code) ShrinkSelection()
ShrinkSelection shrinks the selection back to the next smaller syntactic element, after it has been expanded with Code.ExpandSelection.
func (*Code) SourceOfGenerated ¶ added in v0.1.1
SourceOfGenerated returns the source of the given generated file. This should be listed in a //line comment right after the first comment line that indicates that it is generated. Returns the input lines if source comment 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 settings file
func (*Code) SplitsSaveAs ¶
SplitsSaveAs saves current splitter settings to new named splitter settings, and saves to settings 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) TerminalCdToFile ¶ added in v0.2.3
func (cv *Code) TerminalCdToFile()
TerminalCdToFile changes the directory of the shell in the current terminal to the directory of the file in the active editor.
func (*Code) TerminalCdToProject ¶ added in v0.2.3
func (cv *Code) TerminalCdToProject()
TerminalCdToProject changes the directory of the shell in the current terminal to the project root directory.
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 ¶
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 ViewLines in active buffer.
func (*Code) ViewFileInIndex ¶
ViewFileInIndex views file in given text view index
func (*Code) ViewLines ¶ added in v0.1.1
func (cv *Code) ViewLines(tv *TextEditor, vidx int, ln *lines.Lines)
ViewLines sets the given text view to view file lines.
func (*Code) WorkspaceSymbolPrompt ¶ added in v0.2.0
func (cv *Code) WorkspaceSymbolPrompt()
WorkspaceSymbolPrompt prompts for a symbol name and shows matching symbols from the entire workspace project, using the language server.
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 ¶
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 ¶
PromptUser prompts for values that need prompting for, and then runs RunAfterPrompts if not otherwise cancelled by user
func (*Command) Run ¶
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 ¶
RunAfterPrompts runs after any prompts have been set, if needed
func (*Command) RunBuf ¶
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 ¶
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
func (*Command) RunNoBuf ¶
func (cm *Command) RunNoBuf(cv *Code, cma *CmdAndArgs) bool
RunNoBuf runs a command without any output to the buffer -- can call using go as a goroutine for no-wait case -- 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 ¶
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 lines holding all output
Lines *lines.Lines `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 *lines.Lines `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() *textcore.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. The fpath can be just the path or any string fragment contained within the target filename.
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) SetKnown ¶ added in v0.1.1
func (t *DebugPanel) SetKnown(v fileinfo.Known) *DebugPanel
SetKnown sets the DebugPanel.Known: known file type to determine debugger
func (*DebugPanel) SetStatus ¶
func (dv *DebugPanel) SetStatus(stat cdebug.Status)
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()
SingleStep 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) DeleteFiles ¶ added in v0.1.1
func (fn *FileNode) DeleteFiles()
DeleteFiles calls DeleteFile on any selected nodes, after prompting.
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) OnClose ¶ added in v0.2.1
func (fn *FileNode) OnClose()
OnClose updates the Problems tab for the closed directory.
func (*FileNode) OnOpen ¶ added in v0.2.1
func (fn *FileNode) OnOpen()
OnOpen updates the Problems tab for the newly opened directory.
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
// Renaming indicates this panel is showing proposed symbol rename
// edits from a language server, instead of search results:
// the Find string is the old name and Replace is the new name.
// Replace and All then apply the rename, one at a time or all.
Renaming bool `json:"-" xml:"-"`
// Renamed counts the rename edits applied in this session.
Renamed int `json:"-" xml:"-"`
// OnReplace, if set, is called after a replace is applied in a
// buffer, e.g. to sync a language server with the new text.
OnReplace func(tv *TextEditor) `json:"-" xml:"-"`
}
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 ¶
HighlightFinds highlights all the find results in ftv buffer
func (*FindPanel) OpenFindURL ¶
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) SetCode ¶
SetCode sets the FindPanel.Code: parent code project
func (*FindPanel) SetOnReplace ¶ added in v0.2.0
func (t *FindPanel) SetOnReplace(v func(tv *TextEditor)) *FindPanel
SetOnReplace sets the FindPanel.OnReplace: OnReplace, if set, is called after a replace is applied in a buffer, e.g. to sync a language server with the new text.
func (*FindPanel) SetRe ¶
SetRe sets the FindPanel.Re: compiled regexp
func (*FindPanel) SetRenamed ¶ added in v0.2.0
SetRenamed sets the FindPanel.Renamed: Renamed counts the rename edits applied in this session.
func (*FindPanel) SetRenaming ¶ added in v0.2.0
SetRenaming sets the FindPanel.Renaming: Renaming indicates this panel is showing proposed symbol rename edits from a language server, instead of search results: the Find string is the old name and Replace is the new name. Replace and All then apply the rename, one at a time or all.
func (*FindPanel) SetTime ¶
SetTime sets the FindPanel.Time: time of last find
func (*FindPanel) ShowResults ¶
ShowResults shows the results in the buffer
func (*FindPanel) TextEditor ¶
TextEditor 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 Locations
// 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 LangBackends ¶ added in v0.2.0
type LangBackends int32 //enums:enum -trim-prefix LangBackend
LangBackends specifies which system provides the language services: diagnostics, completions, hover docs, navigation, and symbols.
const ( // LangBackendLSP uses external language servers (gopls etc), // which run as separate processes and provide full IDE-level // language features for any file with an available server, // except for languages set to use the parser in the Languages // settings (Markdown and TeX by default) LangBackendLSP LangBackends = iota // LangBackendParser uses the built-in interactive parse system, // which runs in-process LangBackendParser )
const LangBackendsN LangBackends = 2
LangBackendsN is the highest valid value for type LangBackends, plus one.
func LangBackendsValues ¶ added in v0.2.0
func LangBackendsValues() []LangBackends
LangBackendsValues returns all possible values for the type LangBackends.
func (LangBackends) Desc ¶ added in v0.2.0
func (i LangBackends) Desc() string
Desc returns the description of the LangBackends value.
func (LangBackends) Int64 ¶ added in v0.2.0
func (i LangBackends) Int64() int64
Int64 returns the LangBackends value as an int64.
func (LangBackends) MarshalText ¶ added in v0.2.0
func (i LangBackends) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*LangBackends) SetInt64 ¶ added in v0.2.0
func (i *LangBackends) SetInt64(in int64)
SetInt64 sets the LangBackends value from an int64.
func (*LangBackends) SetString ¶ added in v0.2.0
func (i *LangBackends) SetString(s string) error
SetString sets the LangBackends value from its string representation, and returns an error if the string is invalid.
func (LangBackends) String ¶ added in v0.2.0
func (i LangBackends) String() string
String returns the string representation of this LangBackends value.
func (*LangBackends) UnmarshalText ¶ added in v0.2.0
func (i *LangBackends) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
func (LangBackends) Values ¶ added in v0.2.0
func (i LangBackends) Values() []enums.Enum
Values returns all possible values for the type LangBackends.
type LangService ¶ added in v0.2.0
type LangService struct {
// contains filtered or unexported fields
}
LangService manages the language services for a Code window, routing editor actions to the lsp.Backend (external language servers such as gopls) when the ProjectSettings.LangBackend setting selects it and a server is available for a file, and otherwise leaving the built-in parse system to provide what it can through the standard editor machinery.
It syncs open files with the servers, applies diagnostics as buffer tags, provides completions, hover docs, definitions, references, and symbols to the editor and panels.
func NewLangService ¶ added in v0.2.0
func NewLangService(cv *Code) *LangService
NewLangService returns a new language service for given Code window.
func (*LangService) Activated ¶ added in v0.2.0
func (ls *LangService) Activated(tv *TextEditor)
Activated should be called when a texteditor becomes active, opening its file with the backend and configuring completion functions to use the active backend.
func (*LangService) Change ¶ added in v0.2.0
func (ls *LangService) Change(ln *lines.Lines)
Change syncs the current contents of the buffer to the backend now.
func (*LangService) Closed ¶ added in v0.2.0
func (ls *LangService) Closed(ln *lines.Lines)
Closed should be called when a file is closed in the editor. Language servers are shut down automatically when the last of their files closes. It can be called after the buffer has been closed, which clears its filename. Must be called from the event loop.
func (*LangService) DiagStatusMsg ¶ added in v0.2.0
func (ls *LangService) DiagStatusMsg(ln *lines.Lines) string
DiagStatusMsg returns the current status-bar summary of diagnostics for the given buffer, or "" if none. Called from UpdateStatusText when regenerating the official status line.
func (*LangService) EditorInput ¶ added in v0.2.0
func (ls *LangService) EditorInput(tv *TextEditor)
EditorInput should be called on editor Input events (text changes and cursor movements), to sync changed text to the language server with a debounce delay, and update the signature help.
func (*LangService) ExpandSelection ¶ added in v0.2.0
func (ls *LangService) ExpandSelection(tv *TextEditor) bool
ExpandSelection does Code.ExpandSelection in the given editor, returning false if there is no larger element.
func (*LangService) FilesChanged ¶ added in v0.2.2
func (ls *LangService) FilesChanged(changes []lsp.FileChange)
FilesChanged notifies the language servers of changes to files on disk, and refreshes the problems of files that are not open if the Problems tab is shown. Must be called from the event loop.
func (*LangService) HoverAt ¶ added in v0.2.0
func (ls *LangService) HoverAt(tv *TextEditor, pos textpos.Pos) string
HoverAt returns hover documentation for the word at the given position, using a short-lived cache. The request runs synchronously on the UI goroutine with the server's bounded quick timeout: tooltips are generated once, at LongHoverStart, so there is no second request that an async result could arrive on. Any diagnostic message tagged at that position is included first, from the local record, followed by the available quick fixes.
func (*LangService) Input ¶ added in v0.2.0
func (ls *LangService) Input(ln *lines.Lines)
Input should be called on editor Input events, to sync changed text to the language server with a debounce delay.
func (*LangService) LSPActive ¶ added in v0.2.0
func (ls *LangService) LSPActive(ln *lines.Lines) bool
LSPActive returns whether the language server backend is being used for the given buffer: the LSP backend must be selected in settings, the language must not be set to use the parser in its LanguageOptions, and a server must be registered for the file's language. Otherwise, the built-in parse system provides whatever features it can through the standard editor machinery.
func (*LangService) Lookup ¶ added in v0.2.0
func (ls *LangService) Lookup(tv *TextEditor) bool
Lookup does Code.Lookup for the given editor, returning true if it showed quick fixes or spelling corrections, and false if it offered completions.
func (*LangService) ProgressStatusMsg ¶ added in v0.2.0
func (ls *LangService) ProgressStatusMsg() string
ProgressStatusMsg returns the status bar message for the language server operation in progress, or "" if none.
func (*LangService) Saved ¶ added in v0.2.0
func (ls *LangService) Saved(ln *lines.Lines)
Saved should be called after a file has been saved.
func (*LangService) ScheduleSigHelp ¶ added in v0.2.0
func (ls *LangService) ScheduleSigHelp(tv *TextEditor)
ScheduleSigHelp schedules a LangService.SigHelpUpdate for after the current event has been fully processed and the editor rendered. It must be called from the event loop, for every key event and Input event: the Input event for typed text is sent before the editor moves the cursor past the new text, and some keys move the cursor without any Input event (e.g., typing over an auto-inserted ")").
func (*LangService) SemanticRefresh ¶ added in v0.2.0
func (ls *LangService) SemanticRefresh(ln *lines.Lines)
SemanticRefresh requests semantic tokens for the given buffer from the server asynchronously, replacing any prior semantic tags. The request runs in its own goroutine with the server's bounded timeout; results are applied with self-locking Lines methods, and discarded if a newer pass (or a change/close) has superseded this one.
func (*LangService) ShrinkSelection ¶ added in v0.2.0
func (ls *LangService) ShrinkSelection(tv *TextEditor)
ShrinkSelection does Code.ShrinkSelection in the given editor.
func (*LangService) SigHelpUpdate ¶ added in v0.2.0
func (ls *LangService) SigHelpUpdate(tv *TextEditor)
SigHelpUpdate checks whether the editor cursor is in a function-call parameter context and updates the signature display accordingly: a display-only popup anchored below the cursor (like the completion popup, but nothing is ever inserted) plus the status-bar line. It must be called from the event loop: see LangService.ScheduleSigHelp.
func (*LangService) SigStatusMsg ¶ added in v0.2.0
func (ls *LangService) SigStatusMsg() string
SigStatusMsg returns the current signature help status message, or "" if none. Called from UpdateStatusText when regenerating the official status line.
func (*LangService) Stop ¶ added in v0.2.0
func (ls *LangService) Stop()
Stop halts all language servers and ends the event loop. The service cannot be used after this.
type LanguageOptions ¶
type LanguageOptions struct {
// command(s) to run after a file of this type is saved
PostSaveCmds CmdNames
// Parser uses the built-in parser for this language, for highlighting,
// completion, lookup, symbols, and indentation, instead of a language
// server, when the project uses the LSP language backend. Other
// languages use a language server when one is available, and otherwise
// just chroma highlighting. With the Parser backend, the parser is used
// for all languages that it supports.
Parser bool
}
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 Locations ¶ added in v0.1.1
type Locations int32 //enums:enum
Locations are different locations to search in
const LocationsN Locations = 4
LocationsN is the highest valid value for type Locations, plus one.
func LocationsValues ¶ added in v0.1.1
func LocationsValues() []Locations
LocationsValues returns all possible values for the type Locations.
func (Locations) MarshalText ¶ added in v0.1.1
MarshalText implements the encoding.TextMarshaler interface.
func (*Locations) SetString ¶ added in v0.1.1
SetString sets the Locations value from its string representation, and returns an error if the string is invalid.
func (Locations) String ¶ added in v0.1.1
String returns the string representation of this Locations value.
func (*Locations) UnmarshalText ¶ added in v0.1.1
UnmarshalText implements the encoding.TextUnmarshaler interface.
type OpenFiles ¶ added in v0.1.1
OpenFiles is the ordered list of open files that are being edited. The key is the full filepath, and a recency order is maintained.
func (*OpenFiles) Add ¶ added in v0.1.1
Add adds given Lines buffer to list of open files. If already on the list, moves it to the top. Returns the Lines.
func (*OpenFiles) Move ¶ added in v0.1.1
Move moves item at given index to destination index. Item is deleted first and then inserted at given index.
func (*OpenFiles) ReMarkup ¶ added in v0.1.1
func (of *OpenFiles) ReMarkup()
ReMarkup all open files: when mode color changes etc, during rebuild
func (*OpenFiles) SearchInPaths ¶ added in v0.1.1
func (of *OpenFiles) SearchInPaths(paths []string, find string, ignoreCase bool, langs []fileinfo.Known) []search.Results
SearchInPaths returns search results for given string literal with ignoreCase setting, in all open files contained directly in given paths. If paths is nil then all open files are searched.
func (*OpenFiles) SearchRegexpInPaths ¶ added in v0.1.1
func (of *OpenFiles) SearchRegexpInPaths(paths []string, re *regexp.Regexp, langs []fileinfo.Known) []search.Results
SearchRegexpInPaths returns search results for given string literal with ignoreCase setting, in all open files contained directly in given paths. If paths is nil then all open files are searched.
type PreviewPanel ¶ added in v0.1.1
PreviewPanel is a widget that displays an interactive live preview of a MD, HTML, or SVG file currently open.
func NewPreviewPanel ¶ added in v0.1.1
func NewPreviewPanel(parent ...tree.Node) *PreviewPanel
NewPreviewPanel returns a new PreviewPanel with the given optional parent: PreviewPanel is a widget that displays an interactive live preview of a MD, HTML, or SVG file currently open.
func (*PreviewPanel) Init ¶ added in v0.1.1
func (pp *PreviewPanel) Init()
type ProjectSettings ¶
type ProjectSettings struct {
// file picker settings
Files FileSettings
// editor settings
Editor text.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
// backend that provides language services (diagnostics, completion, hover, navigation, symbols) for this project -- LSP uses external language servers such as gopls, except for languages set to use the parser in the Languages settings (Markdown and TeX by default)
LangBackend LangBackends
// if set, language servers that support inlay hints (e.g. gopls) are configured to return them, and the Show Inlay Hints command can display them; running servers pick the change up immediately through dynamic reconfiguration
InlayHints bool
// problem messages to ignore: the problems (diagnostics) from language servers whose message contains a key whose value is true are not shown, in the Problems tab or in the editor; commonly ignored Go warnings are listed, disabled, so that they are easy to enable
IgnoreProblems map[string]bool
// if set, info and hint problems from language servers (e.g., gopls modernize suggestions) are shown in the editor and the Problems tab, in addition to errors and warnings
ShowHints bool
// the type of version control system used in this project (git, svn, etc).
// filters commands available
VersionControl vcs.Types
// 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:"-"`
// saved scope of the problems shown in the Problems tab
ProblemsLoc Locations `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) Widget ¶ added in v0.1.3
func (rn RegisterName) Widget() core.Value
Widget 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
// Terminal has the settings for terminals.
Terminal TerminalSettings
// 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
// executable paths for language servers, keyed by server id (gopls, typescript-language-server, pyright-langserver, pylsp, rust-analyzer, clangd, bash-language-server, vscode-json-language-server) -- paths or names to search in PATH if not an absolute path -- empty by default, meaning just search the PATH for the standard executable
LSExecs map[string]string `display:"-"`
}
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) 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() textpos.Pos
UnkEndPos returns the end position of the current unknown word
func (*SpellPanel) UnkStartPos ¶
func (sv *SpellPanel) UnkStartPos() textpos.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) Widget ¶ added in v0.1.3
Widget 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
// contains filtered or unexported fields
}
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) 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) 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) 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 TerminalSettings ¶ added in v0.2.3
type TerminalSettings struct {
// Command is the command to run in terminals, with its arguments,
// such as goal; the default is the user's shell.
Command string
}
TerminalSettings are the settings for terminals.
type TextEditor ¶
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, pos image.Point)
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 textpos.Pos)
HandleDebugDoubleClick 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 textpos.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.Line)
func (*TextEditor) SetCode ¶
func (t *TextEditor) SetCode(v *Code) *TextEditor
SetCode sets the TextEditor.Code
func (*TextEditor) ShowContextMenu ¶ added in v0.2.0
func (ed *TextEditor) ShowContextMenu(e events.Event)
ShowContextMenu builds the text editor context menu ShowContextMenu shows the context menu, first moving the cursor to the position of the click if there is no selection, so that the language actions in the menu (lookup, code actions, etc) apply there.
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
- code.go
- commandbufs.go
- commands.go
- commandstd.go
- console.go
- debugpanel.go
- doc.go
- editor.go
- enumgen.go
- events.go
- files.go
- filetree.go
- filewatch.go
- findpanel.go
- keymap.go
- languages.go
- lsp.go
- lspcommands.go
- lspdocs.go
- lsppanels.go
- lspview.go
- panels.go
- previewpanel.go
- registers.go
- settings.go
- spellpanel.go
- splits.go
- symbolspanel.go
- terminal.go
- texteditor.go
- texteditors.go
- typegen.go
- values.go
- views.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cdebug provides the general interface for a debugger.
|
Package cdebug provides the general interface for a debugger. |
|
cdelve
Package cdelve provides the low-level implementation of the cdebug interface, for the the delve Go debugger.
|
Package cdelve provides the low-level implementation of the cdebug interface, for the the delve Go debugger. |
|
cmd
|
|
|
cogent-lsp
command
cogent-lsp is a command-line helper around the Cogent LSP client (cogentcore.org/cogent/code/lsp), exposing language server features (gopls and other registered servers) to shells, scripts, CI, and AI agents, without needing to open the editor.
|
cogent-lsp is a command-line helper around the Cogent LSP client (cogentcore.org/cogent/code/lsp), exposing language server features (gopls and other registered servers) to shells, scripts, CI, and AI agents, without needing to open the editor. |
|
cogentcode
command
|
|
|
lsp-server
command
lsp-server manages the language servers used by Cogent's Code editor LSP backend: it lists, installs, and tests the standard set of supported servers (gopls, typescript-language-server, pyright, rust-analyzer, clangd, bash-language-server, vscode-json-language-server, and optional alternatives such as pylsp).
|
lsp-server manages the language servers used by Cogent's Code editor LSP backend: it lists, installs, and tests the standard set of supported servers (gopls, typescript-language-server, pyright, rust-analyzer, clangd, bash-language-server, vscode-json-language-server, and optional alternatives such as pylsp). |
|
pie
command
|
|
|
Package lang defines backend-neutral data types for the language services used by the Cogent Code editor: diagnostics, locations, and symbols, with positions in editor-native units (0-based lines, rune offsets within lines).
|
Package lang defines backend-neutral data types for the language services used by the Cogent Code editor: diagnostics, locations, and symbols, with positions in editor-native units (0-based lines, rune offsets within lines). |
|
Package lsp implements a Language Server Protocol (LSP) client for the Cogent Code editor, driving external language server programs such as gopls (the Go language server) as subprocesses that speak JSON-RPC over stdio.
|
Package lsp implements a Language Server Protocol (LSP) client for the Cogent Code editor, driving external language server programs such as gopls (the Go language server) as subprocesses that speak JSON-RPC over stdio. |
|
Package piv provides the PiView object for the full GUI view of the interactive parser (pi) system.
|
Package piv provides the PiView object for the full GUI view of the interactive parser (pi) system. |