Documentation ¶
Overview ¶
Package codev implements the CodeView editor, using all the elements from the code interface. Having it in a separate package allows CodeView to also include other packages that tap into the code interface, such as the Cogent Core interactive parser.
Index ¶
- Constants
- Variables
- func CheckForProjectAtPath(path string) (string, bool)
- func CodeViewOpenNodes(it any, sc *core.Scene) []string
- func ExecCmds(ge *CodeView) [][]string
- func ProjectPathParse(path string) (root, projnm, fnm string, ok bool)
- func TextLinkHandler(tl paint.TextLink) bool
- type CodeView
- func (ge *CodeView) ActiveFileNode() *filetree.Node
- func (ge *CodeView) ActiveTextEditor() *code.TextEditor
- func (ge *CodeView) AddChooserFiles(ac *core.Chooser)
- func (ge *CodeView) AddChooserSymbols(ac *core.Chooser)
- func (ge *CodeView) AddCloseDialog()
- func (ge *CodeView) AppBarConfig(parent core.Widget)
- func (ge *CodeView) ApplySettings()
- func (ge *CodeView) ApplySettingsAction()
- func (ge *CodeView) ArgVarVals() *code.ArgVarVals
- func (ge *CodeView) AutoSaveCheck(tv *code.TextEditor, vidx int, fn *filetree.Node) bool
- func (ge *CodeView) Build()
- func (ge *CodeView) CallFind(ctx core.Widget)
- func (ge *CodeView) CallSaveActiveViewAs(ctx core.Widget)
- func (ge *CodeView) CallSplitsSetView(ctx core.Widget)
- func (ge *CodeView) CallViewFile(ctx core.Widget)
- func (ge *CodeView) ChooseRunExec(exePath core.Filename)
- func (ge *CodeView) ClearDebug()
- func (ge *CodeView) CloneActiveView() (*code.TextEditor, int)
- func (ge *CodeView) CloseActiveView()
- func (ge *CodeView) CloseOpenNodes(nodes []*code.FileNode)
- func (ge *CodeView) CmdHist() *code.CmdNames
- func (ge *CodeView) CmdRuns() *code.CmdRuns
- func (ge *CodeView) CodeViewKeys(kt events.Event)
- func (ge *CodeView) CommandFromMenu(fn *filetree.Node)
- func (ge *CodeView) CommentOut() bool
- func (ge *CodeView) Commit()
- func (ge *CodeView) CommitNoChecks()
- func (ge *CodeView) Config()
- func (ge *CodeView) ConfigActiveFilename(fb *views.FuncButton) *views.FuncButton
- func (ge *CodeView) ConfigCodeView()
- func (ge *CodeView) ConfigFindButton(fb *views.FuncButton) *views.FuncButton
- func (ge *CodeView) ConfigSplits()
- func (ge *CodeView) ConfigStatusBar()
- func (ge *CodeView) ConfigTextBuffer(tb *texteditor.Buffer)
- func (ge *CodeView) ConfigToolbar(tb *core.Toolbar)
- func (ge *CodeView) CopyRect()
- func (ge *CodeView) CountWords() string
- func (ge *CodeView) CountWordsRegion() string
- func (ge *CodeView) CurDebug() *code.DebugView
- func (ge *CodeView) CurOpenNodes() *code.OpenNodes
- func (ge *CodeView) CurPanel() int
- func (ge *CodeView) CursorToHistNext() bool
- func (ge *CodeView) CursorToHistPrev() bool
- func (ge *CodeView) CutRect()
- func (ge *CodeView) Debug()
- func (ge *CodeView) DebugAttach(pid uint64)
- func (ge *CodeView) DebugTest()
- func (ge *CodeView) Defaults()
- func (ge *CodeView) DiffFileNode(fna *filetree.Node, fnmB core.Filename)
- func (ge *CodeView) DiffFiles(fnmA, fnmB core.Filename)
- func (ge *CodeView) EditProjectSettings()
- func (ge *CodeView) EditRecentPaths()
- func (ge *CodeView) ExecCmd()
- func (ge *CodeView) ExecCmdFileNode(fn *filetree.Node)
- func (ge *CodeView) ExecCmdName(cmdNm code.CmdName, sel bool, clearBuf bool)
- func (ge *CodeView) ExecCmdNameActive(cmdNm string)
- func (ge *CodeView) ExecCmdNameFileNode(fn *filetree.Node, cmdNm code.CmdName, sel bool, clearBuf bool)
- func (ge *CodeView) ExecCmdNameFilename(fn string, cmdNm code.CmdName, sel bool, clearBuf bool)
- func (ge *CodeView) ExecCmds(cmdNms code.CmdNames, sel bool, clearBuf bool)
- func (ge *CodeView) ExecCmdsFileNode(fn *filetree.Node, cmdNms code.CmdNames, sel bool, clearBuf bool)
- func (ge *CodeView) FileNodeForFile(fpath string, add bool) *filetree.Node
- func (ge *CodeView) FileNodeOpened(fn *filetree.Node)
- func (ge *CodeView) FileNodeRunExe(fn *filetree.Node)
- func (ge *CodeView) FileNodeSelected(fn *filetree.Node)
- func (ge *CodeView) FileTree() *filetree.Tree
- func (ge *CodeView) Find(find string, repl string, ignoreCase bool, regExp bool, loc code.FindLoc, ...)
- func (ge *CodeView) FocusActiveTextEditor() *code.TextEditor
- func (ge *CodeView) FocusNextPanel()
- func (ge *CodeView) FocusOnPanel(panel int) bool
- func (ge *CodeView) FocusOnTabs() bool
- func (ge *CodeView) FocusPrevPanel()
- func (ge *CodeView) GrabSettings()
- func (ge *CodeView) GuessMainLang() bool
- func (ge *CodeView) HandleEvents()
- func (ge *CodeView) HelpWiki()
- func (ge *CodeView) Indent() bool
- func (ge *CodeView) IsConfiged() bool
- func (ge *CodeView) IsEmpty() bool
- func (ge *CodeView) JoinParaLines()
- func (ge *CodeView) LangDefaults()
- func (ge *CodeView) LastSaveTime() time.Time
- func (ge *CodeView) LinkViewFile(fnm core.Filename) (*code.TextEditor, int, bool)
- func (ge *CodeView) LinkViewFileNode(fn *filetree.Node) (*code.TextEditor, int)
- func (ge *CodeView) LookupFun(data any, text string, posLn, posCh int) (ld complete.Lookup)
- func (ge *CodeView) NChangedFiles() int
- func (t *CodeView) New() tree.Node
- func (ge *CodeView) NewFile(filename string, addToVcs bool)
- func (ge *CodeView) NewProject(path core.Filename, folder string, mainLang fileinfo.Known, ...) *CodeView
- func (ge *CodeView) NextTextEditor() (*code.TextEditor, int)
- func (ge *CodeView) NextViewFile(fnm core.Filename) (*code.TextEditor, int, bool)
- func (ge *CodeView) NextViewFileNode(fn *filetree.Node) (*code.TextEditor, int)
- func (t *CodeView) NodeType() *types.Type
- func (ge *CodeView) OnAdd()
- func (ge *CodeView) OnInit()
- func (ge *CodeView) OpenConsoleTab()
- func (ge *CodeView) OpenFile(fnm string)
- func (ge *CodeView) OpenFileAtRegion(filename core.Filename, tr textbuf.Region) (tv *code.TextEditor, ok bool)
- func (ge *CodeView) OpenFileNode(fn *filetree.Node) (bool, error)
- func (ge *CodeView) OpenFileURL(ur string, ftv *texteditor.Editor) bool
- func (ge *CodeView) OpenFindURL(ur string, ftv *texteditor.Editor) bool
- func (ge *CodeView) OpenNodeForTextEditor(tv *code.TextEditor) (*filetree.Node, int, bool)
- func (ge *CodeView) OpenPath(path core.Filename) *CodeView
- func (ge *CodeView) OpenProject(filename core.Filename) *CodeView
- func (ge *CodeView) OpenRecent(filename core.Filename)
- func (ge *CodeView) PanelIsOpen(panel int) bool
- func (ge *CodeView) ParseOpenFindURL(ur string, ftv *texteditor.Editor) (tv *code.TextEditor, reg textbuf.Region, findBufStLn, findCount int, ok bool)
- func (ge *CodeView) PasteRect()
- func (ge *CodeView) ProjectSettings() *code.ProjectSettings
- func (ge *CodeView) ReCase(c strcase.Cases) string
- func (ge *CodeView) RecycleCmdBuf(cmdNm string, clear bool) (*texteditor.Buffer, bool)
- func (ge *CodeView) RecycleCmdTab(cmdNm string, sel bool, clearBuf bool) (*texteditor.Buffer, *texteditor.Editor, bool)
- func (ge *CodeView) RecycleTabTextEditor(label string, sel bool) *texteditor.Editor
- func (ge *CodeView) RegisterCopy(name string) bool
- func (ge *CodeView) RegisterPaste(name code.RegisterName) bool
- func (ge *CodeView) ReplaceInActive()
- func (ge *CodeView) RevertActiveView()
- func (ge *CodeView) Run()
- func (ge *CodeView) RunPostCmdsActiveView() bool
- func (ge *CodeView) RunPostCmdsFileNode(fn *filetree.Node) bool
- func (ge *CodeView) SaveActiveView()
- func (ge *CodeView) SaveActiveViewAs(filename core.Filename)
- func (ge *CodeView) SaveAll()
- func (ge *CodeView) SaveAllCheck(cancelOpt bool, fun func()) bool
- func (ge *CodeView) SaveAllOpenNodes()
- func (ge *CodeView) SaveProject()
- func (ge *CodeView) SaveProjectAs(filename core.Filename) bool
- func (ge *CodeView) SaveProjectIfExists(saveAllFiles bool) bool
- func (ge *CodeView) SelectOpenNode()
- func (ge *CodeView) SelectTabByName(label string) core.Widget
- func (ge *CodeView) SelectedFileNode() *filetree.Node
- func (ge *CodeView) SetActiveFileInfo(buf *texteditor.Buffer)
- func (t *CodeView) SetActiveLang(v fileinfo.Known) *CodeView
- func (ge *CodeView) SetActiveTextEditor(av *code.TextEditor) int
- func (ge *CodeView) SetActiveTextEditorIndex(idx int) *code.TextEditor
- func (ge *CodeView) SetArgVarVals()
- func (t *CodeView) SetOpenNodes(v code.OpenNodes) *CodeView
- func (t *CodeView) SetProjectFilename(v core.Filename) *CodeView
- func (t *CodeView) SetProjectRoot(v core.Filename) *CodeView
- func (ge *CodeView) SetStatus(msg string)
- func (t *CodeView) SetStatusMessage(v string) *CodeView
- func (t *CodeView) SetTooltip(v string) *CodeView
- func (ge *CodeView) SetWindowNameTitle()
- func (ge *CodeView) ShowFile(fname string, ln int) (*code.TextEditor, error)
- func (ge *CodeView) SpacesToTabs()
- func (ge *CodeView) Spell()
- func (ge *CodeView) Splits() *core.Splits
- func (ge *CodeView) SplitsEdit()
- func (ge *CodeView) SplitsSave(split code.SplitName)
- func (ge *CodeView) SplitsSaveAs(name, desc string)
- func (ge *CodeView) SplitsSetView(split code.SplitName)
- func (ge *CodeView) StatusBar() *core.Frame
- func (ge *CodeView) StatusLabel() *core.Label
- func (ge *CodeView) SwapTextEditors() bool
- func (ge *CodeView) Symbols()
- func (ge *CodeView) TabByName(label string) core.Widget
- func (ge *CodeView) TabDeleted(tabnm string)
- func (ge *CodeView) Tabs() *core.Tabs
- func (ge *CodeView) TabsToSpaces()
- func (ge *CodeView) TextBufForFile(fpath string, add bool) *texteditor.Buffer
- func (ge *CodeView) TextEditorButtonByIndex(idx int) *core.Button
- func (ge *CodeView) TextEditorButtonMenu(idx int, m *core.Scene)
- func (ge *CodeView) TextEditorByIndex(idx int) *code.TextEditor
- func (ge *CodeView) TextEditorForFile(fnm core.Filename) (*code.TextEditor, int, bool)
- func (ge *CodeView) TextEditorForFileNode(fn *filetree.Node) (*code.TextEditor, int, bool)
- func (ge *CodeView) TextEditorIndex(av *code.TextEditor) int
- func (ge *CodeView) UpdateFiles()
- func (ge *CodeView) UpdateStatusLabel()
- func (ge *CodeView) UpdateTextButtons()
- func (ge *CodeView) VCSLog(since string) (vcs.Log, error)
- func (ge *CodeView) VCSUpdateAll()
- func (ge *CodeView) VersionControl() filetree.VersionControlName
- func (ge *CodeView) ViewFile(fnm core.Filename) (*code.TextEditor, int, bool)
- func (ge *CodeView) ViewFileInIndex(fnm core.Filename, idx int) (*code.TextEditor, int, bool)
- func (ge *CodeView) ViewFileNode(tv *code.TextEditor, vidx int, fn *filetree.Node)
- func (ge *CodeView) ViewOpenNodeName(name string)
Constants ¶
const ( FileTreeIndex = iota TextEditor1Index TextEditor2Index TabsIndex )
These are then the fixed indices of the different elements in the splitview
const NTextEditors = 2
NTextEditors is the number of text views to create -- to keep things simple and consistent (e.g., splitter settings always have the same number of values), we fix this degree of freedom, and have flexibility in the splitter settings for what to actually show.
Variables ¶
var 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 CodeViewType = types.AddType(&types.Type{Name: "cogentcore.org/cogent/code/codev.CodeView", IDName: "code-view", Doc: "CodeView is the core editor and tab viewer framework for the Code system. The\ndefault view has a tree browser of files on the left, editor panels in the\nmiddle, and a tabbed viewer on the right.", Methods: []types.Method{{Name: "ConfigToolbar", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"tb"}}, {Name: "UpdateFiles", Doc: "UpdateFiles updates the list of files saved in project", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "OpenRecent", Doc: "OpenRecent opens a recently-used file", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"filename"}}, {Name: "OpenFile", Doc: "OpenFile opens file in an open project if it has the same path as the file\nor in a new window.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"fnm"}}, {Name: "OpenPath", Doc: "OpenPath creates a new project by opening given path, which can either be a\nspecific file or a folder containing multiple files of interest -- opens in\ncurrent CodeView object if it is empty, or otherwise opens a new window.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"path"}, Returns: []string{"CodeView"}}, {Name: "OpenProject", Doc: "OpenProject opens .code project file and its settings from given filename, in a standard\ntoml-formatted file", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"filename"}, Returns: []string{"CodeView"}}, {Name: "NewProject", Doc: "NewProject creates a new project at given path, making a new folder in that\npath -- all CodeView projects are essentially defined by a path to a folder\ncontaining files. If the folder already exists, then use OpenPath.\nCan also specify main language and version control type", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"path", "folder", "mainLang", "VersionControl"}, Returns: []string{"CodeView"}}, {Name: "NewFile", Doc: "NewFile creates a new file in the project", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"filename", "addToVcs"}}, {Name: "SaveProject", Doc: "SaveProject saves project file containing custom project settings, in a\nstandard toml-formatted file", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "SaveProjectAs", Doc: "SaveProjectAs saves project custom settings to given filename, in a standard\ntoml-formatted file\nsaveAllFiles indicates if user should be prompted for saving all files\nreturns true if the user was prompted, false otherwise", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"filename"}, Returns: []string{"bool"}}, {Name: "ExecCmdNameActive", Doc: "ExecCmdNameActive calls given command on current active texteditor", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"cmdNm"}}, {Name: "ExecCmd", Doc: "ExecCmd pops up a menu to select a command appropriate for the current\nactive text view, and shows output in Tab with name of command", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "Build", Doc: "Build runs the BuildCmds set for this project", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "Run", Doc: "Run runs the RunCmds set for this project", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "Commit", Doc: "Commit commits the current changes using relevant VCS tool.\nChecks for VCS setting and for unsaved files.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "CursorToHistPrev", Doc: "CursorToHistPrev moves back to the previous history item.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Returns: []string{"bool"}}, {Name: "CursorToHistNext", Doc: "CursorToHistNext moves forward to the next history item.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Returns: []string{"bool"}}, {Name: "ReplaceInActive", Doc: "ReplaceInActive does query-replace in active file only", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "CutRect", Doc: "CutRect cuts rectangle in active text view", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "CopyRect", Doc: "CopyRect copies rectangle in active text view", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "PasteRect", Doc: "PasteRect cuts rectangle in active text view", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "RegisterCopy", Doc: "RegisterCopy saves current selection in active text view to register of given name\nreturns true if saved", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"name"}, Returns: []string{"bool"}}, {Name: "RegisterPaste", Doc: "RegisterPaste pastes register of given name into active text view\nreturns true if pasted", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"name"}, Returns: []string{"bool"}}, {Name: "CommentOut", Doc: "CommentOut comments-out selected lines in active text view\nand uncomments if already commented\nIf multiple lines are selected and any line is uncommented all will be commented", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Returns: []string{"bool"}}, {Name: "Indent", Doc: "Indent indents selected lines in active view", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Returns: []string{"bool"}}, {Name: "ReCase", Doc: "ReCase replaces currently selected text in current active view with given case", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"c"}, Returns: []string{"string"}}, {Name: "JoinParaLines", Doc: "JoinParaLines merges sequences of lines with hard returns forming paragraphs,\nseparated by blank lines, into a single line per paragraph,\nfor given selected region (full text if no selection)", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "TabsToSpaces", Doc: "TabsToSpaces converts tabs to spaces\nfor given selected region (full text if no selection)", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "SpacesToTabs", Doc: "SpacesToTabs converts spaces to tabs\nfor given selected region (full text if no selection)", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "DiffFiles", Doc: "DiffFiles shows the differences between two given files\nin side-by-side DiffView and in the console as a context diff.\nIt opens the files as file nodes and uses existing contents if open already.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"fnmA", "fnmB"}}, {Name: "DiffFileNode", Doc: "DiffFileNode shows the differences between given file node as the A file,\nand another given file as the B file,\nin side-by-side DiffView and in the console as a context diff.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"fna", "fnmB"}}, {Name: "CountWords", Doc: "CountWords counts number of words (and lines) in active file\nreturns a string report thereof.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Returns: []string{"string"}}, {Name: "CountWordsRegion", Doc: "CountWordsRegion counts number of words (and lines) in selected region in file\nif no selection, returns numbers for entire file.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Returns: []string{"string"}}, {Name: "SaveActiveView", Doc: "SaveActiveView saves the contents of the currently-active texteditor", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "SaveActiveViewAs", Doc: "SaveActiveViewAs save with specified filename the contents of the\ncurrently-active texteditor", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"filename"}}, {Name: "RevertActiveView", Doc: "RevertActiveView revert active view to saved version", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "CloseActiveView", Doc: "CloseActiveView closes the buffer associated with active view", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "NextViewFile", Doc: "NextViewFile sets the next text view to view given file name -- include as\nmuch of name as possible to disambiguate -- will use the first matching --\nif already being viewed, that is activated -- returns texteditor and its\nindex, false if not found", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"fnm"}, Returns: []string{"TextEditor", "int", "bool"}}, {Name: "ViewFile", Doc: "ViewFile views file in an existing TextEditor if it is already viewing that\nfile, otherwise opens ViewFileNode in active buffer", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"fnm"}, Returns: []string{"TextEditor", "int", "bool"}}, {Name: "CloneActiveView", Doc: "CloneActiveView sets the next text view to view the same file currently being vieweds\nin the active view. returns text view and index", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Returns: []string{"TextEditor", "int"}}, {Name: "SaveAll", Doc: "SaveAll saves all of the open filenodes to their current file names\nand saves the project state if it has been saved before (i.e., the .code file exists)", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "FocusNextPanel", Doc: "FocusNextPanel moves the keyboard focus to the next panel to the right", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "FocusPrevPanel", Doc: "FocusPrevPanel moves the keyboard focus to the previous panel to the left", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "EditProjectSettings", Doc: "EditProjectSettings allows editing of project settings (settings specific to this project)", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "SplitsSetView", Doc: "SplitsSetView sets split view splitters to given named setting", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"split"}}, {Name: "SplitsSave", Doc: "SplitsSave saves current splitter settings to named splitter settings under\nexisting name, and saves to prefs file", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"split"}}, {Name: "SplitsSaveAs", Doc: "SplitsSaveAs saves current splitter settings to new named splitter settings, and\nsaves to prefs file", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"name", "desc"}}, {Name: "SplitsEdit", Doc: "SplitsEdit opens the SplitsView editor to customize saved splitter settings", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "Find", Doc: "Find does Find / Replace in files, using given options and filters -- opens up a\nmain tab with the results and further controls.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"find", "repl", "ignoreCase", "regExp", "loc", "langs"}}, {Name: "Spell", Doc: "Spell checks spelling in active text view", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "Symbols", Doc: "Symbols displays the Symbols of a file or package", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "Debug", Doc: "Debug starts the debugger on the RunExec executable.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "DebugTest", Doc: "DebugTest runs the debugger using testing mode in current active texteditor path", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "DebugAttach", Doc: "DebugAttach runs the debugger by attaching to an already-running process.\npid is the process id to attach to.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"pid"}}, {Name: "VCSUpdateAll", Doc: "VCSUpdateAll does an Update (e.g., Pull) on all VCS repositories within\nthe open tree nodes in FileTree.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "VCSLog", Doc: "VCSLog shows the VCS log of commits for this file, optionally with a\nsince date qualifier: If since is non-empty, it should be\na date-like expression that the VCS will understand, such as\n1/1/2020, yesterday, last year, etc. SVN only understands a\nnumber as a maximum number of items to return.\nIf allFiles is true, then the log will show revisions for all files, not just\nthis one.\nReturns the Log and also shows it in a VCSLogView which supports further actions.", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"since"}, Returns: []string{"Log", "error"}}, {Name: "OpenConsoleTab", Doc: "OpenConsoleTab opens a main tab displaying console output (stdout, stderr)", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "ChooseRunExec", Doc: "ChooseRunExec selects the executable to run for the project", Directives: []types.Directive{{Tool: "types", Directive: "add"}}, Args: []string{"exePath"}}, {Name: "HelpWiki", Doc: "HelpWiki opens wiki page for code on github", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}}, Embeds: []types.Field{{Name: "Frame"}}, Fields: []types.Field{{Name: "ProjectRoot", Doc: "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"}, {Name: "ProjectFilename", Doc: "current project filename for saving / loading specific Code configuration information in a .code file (optional)"}, {Name: "ActiveFilename", Doc: "filename of the currently-active texteditor"}, {Name: "ActiveLang", Doc: "language for current active filename"}, {Name: "ActiveVCS", Doc: "VCS repo for current active filename"}, {Name: "ActiveVCSInfo", Doc: "VCS info for current active filename (typically branch or revision) -- for status"}, {Name: "Changed", Doc: "has the root changed? we receive update signals from root for changes"}, {Name: "StatusMessage", Doc: "the last status update message"}, {Name: "LastSaveTStamp", Doc: "timestamp for when a file was last saved -- provides dirty state for various updates including rebuilding in debugger"}, {Name: "Files", Doc: "all the files in the project directory and subdirectories"}, {Name: "ActiveTextEditorIndex", Doc: "index of the currently-active texteditor -- new files will be viewed in other views if available"}, {Name: "OpenNodes", Doc: "list of open nodes, most recent first"}, {Name: "CmdBufs", Doc: "the command buffers for commands run in this project"}, {Name: "CmdHistory", Doc: "history of commands executed in this session"}, {Name: "RunningCmds", Doc: "currently running commands in this project"}, {Name: "ArgVals", Doc: "current arg var vals"}, {Name: "Settings", Doc: "settings for this project -- this is what is saved in a .code project file"}, {Name: "CurDbg", Doc: "current debug view"}, {Name: "KeySeq1", Doc: "first key in sequence if needs2 key pressed"}, {Name: "UpdateMu", Doc: "mutex for protecting overall updates to CodeView"}}, Instance: &CodeView{}})
CodeViewType is the types.Type for CodeView
Functions ¶
func CheckForProjectAtPath ¶ added in v0.0.2
CheckForProjectAtPath checks if there is a .code project at the given path returns project path and true if found, otherwise false
func CodeViewOpenNodes ¶
CodeViewOpenNodes gets list of open nodes for submenu-func
func ProjectPathParse ¶ added in v0.0.2
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 TextLinkHandler ¶
TextLinkHandler is the CodeView handler for text links -- preferred one b/c directly connects to correct CodeView project
Types ¶
type CodeView ¶
type CodeView 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 `ext:".code"` // filename of the currently-active texteditor ActiveFilename core.Filename `set:"-"` // language for current active filename ActiveLang fileinfo.Known // VCS repo for current active filename ActiveVCS vcs.Repo `set:"-"` // VCS info for current active filename (typically branch or revision) -- for status ActiveVCSInfo string `set:"-"` // has the root changed? we receive update signals from root for changes Changed bool `set:"-" json:"-"` // the last status update message StatusMessage string // timestamp for when a file was last saved -- provides dirty state for various updates including rebuilding in debugger LastSaveTStamp time.Time `set:"-" json:"-"` // all the files in the project directory and subdirectories Files *filetree.Tree `set:"-" json:"-"` // index of the currently-active texteditor -- new files will be viewed in other views if available ActiveTextEditorIndex int `set:"-" json:"-"` // list of open nodes, most recent first OpenNodes code.OpenNodes `json:"-"` // the command buffers for commands run in this project CmdBufs map[string]*texteditor.Buffer `set:"-" json:"-"` // history of commands executed in this session CmdHistory code.CmdNames `set:"-" json:"-"` // currently running commands in this project RunningCmds code.CmdRuns `set:"-" json:"-" xml:"-"` // current arg var vals ArgVals code.ArgVarVals `set:"-" json:"-" xml:"-"` // settings for this project -- this is what is saved in a .code project file Settings code.ProjectSettings `set:"-"` // current debug view CurDbg *code.DebugView `set:"-"` // first key in sequence if needs2 key pressed KeySeq1 key.Chord `set:"-"` // mutex for protecting overall updates to CodeView UpdateMu sync.Mutex `set:"-"` }
CodeView is the core editor and tab viewer framework 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 NewCodeProjectPath ¶ added in v0.0.2
NewCodeProjectPath creates a new CodeView window with a new CodeView project for given path, returning the window and the path
func NewCodeView ¶
NewCodeView adds a new CodeView with the given name to the given parent: CodeView is the core editor and tab viewer framework 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 NewCodeWindow ¶
NewCodeWindow is common code for Open CodeWindow from Project or Path
func OpenCodeProject ¶ added in v0.0.2
OpenCodeProject creates a new CodeView window opened to given CodeView project, returning the window and the path
func (*CodeView) ActiveFileNode ¶
ActiveFileNode returns the file node for the active file -- nil if none
func (*CodeView) ActiveTextEditor ¶
func (ge *CodeView) ActiveTextEditor() *code.TextEditor
ActiveTextEditor returns the currently-active TextEditor
func (*CodeView) AddChooserFiles ¶ added in v0.0.1
AddChooserFiles adds the files to the app chooser.
func (*CodeView) AddChooserSymbols ¶ added in v0.0.1
AddChooserSymbols adds the symbols to the app chooser.
func (*CodeView) AddCloseDialog ¶ added in v0.0.1
func (ge *CodeView) 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 (*CodeView) AppBarConfig ¶
func (*CodeView) ApplySettings ¶ added in v0.0.2
func (ge *CodeView) ApplySettings()
ApplySettings applies current project preference settings into places where they are used -- only for those done prior to loading
func (*CodeView) ApplySettingsAction ¶ added in v0.0.2
func (ge *CodeView) ApplySettingsAction()
ApplySettingsAction applies current settings to the project, and updates the project
func (*CodeView) ArgVarVals ¶
func (ge *CodeView) ArgVarVals() *code.ArgVarVals
func (*CodeView) AutoSaveCheck ¶
AutoSaveCheck checks for an autosave file and prompts user about opening it -- returns true if autosave file does exist for a file that currently unchanged (means just opened)
func (*CodeView) CallSaveActiveViewAs ¶
func (*CodeView) CallSplitsSetView ¶
func (*CodeView) CallViewFile ¶
CallViewFile calls ViewFile with ActiveFilename set as arg
func (*CodeView) ChooseRunExec ¶
ChooseRunExec selects the executable to run for the project
func (*CodeView) ClearDebug ¶
func (ge *CodeView) ClearDebug()
ClearDebug clears the current debugger setting -- no more debugger active.
func (*CodeView) CloneActiveView ¶
func (ge *CodeView) CloneActiveView() (*code.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 (*CodeView) CloseActiveView ¶
func (ge *CodeView) CloseActiveView()
CloseActiveView closes the buffer associated with active view
func (*CodeView) CloseOpenNodes ¶
CloseOpenNodes closes any nodes with open views (including those in directories under nodes). called prior to rename.
func (*CodeView) CodeViewKeys ¶
func (*CodeView) CommandFromMenu ¶
CommandFromMenu pops up a menu of commands for given language, with given last command selected by default, and runs selected command.
func (*CodeView) 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 (*CodeView) Commit ¶
func (ge *CodeView) Commit()
Commit commits the current changes using relevant VCS tool. Checks for VCS setting and for unsaved files.
func (*CodeView) CommitNoChecks ¶
func (ge *CodeView) CommitNoChecks()
CommitNoChecks does the commit without any further checks for VCS, and unsaved files
func (*CodeView) ConfigActiveFilename ¶
func (ge *CodeView) ConfigActiveFilename(fb *views.FuncButton) *views.FuncButton
ConfigActiveFilename configures the first arg of given FuncButton to use the ActiveFilename
func (*CodeView) ConfigFindButton ¶
func (ge *CodeView) ConfigFindButton(fb *views.FuncButton) *views.FuncButton
ConfigFindButton configures the Find FuncButton with current params
func (*CodeView) ConfigSplits ¶
func (ge *CodeView) ConfigSplits()
ConfigSplits configures the Splits.
func (*CodeView) ConfigStatusBar ¶
func (ge *CodeView) ConfigStatusBar()
ConfigStatusBar configures statusbar with label
func (*CodeView) ConfigTextBuffer ¶ added in v0.0.2
func (ge *CodeView) ConfigTextBuffer(tb *texteditor.Buffer)
ConfigTextBuffer configures the text buffer according to the settings.
func (*CodeView) ConfigToolbar ¶
func (*CodeView) CopyRect ¶
func (ge *CodeView) CopyRect()
CopyRect copies rectangle in active text view
func (*CodeView) CountWords ¶
CountWords counts number of words (and lines) in active file returns a string report thereof.
func (*CodeView) CountWordsRegion ¶
CountWordsRegion counts number of words (and lines) in selected region in file if no selection, returns numbers for entire file.
func (*CodeView) CurOpenNodes ¶ added in v0.0.1
func (*CodeView) CursorToHistNext ¶
CursorToHistNext moves forward to the next history item.
func (*CodeView) CursorToHistPrev ¶
CursorToHistPrev moves back to the previous history item.
func (*CodeView) Debug ¶
func (ge *CodeView) Debug()
Debug starts the debugger on the RunExec executable.
func (*CodeView) DebugAttach ¶
DebugAttach runs the debugger by attaching to an already-running process. pid is the process id to attach to.
func (*CodeView) DebugTest ¶
func (ge *CodeView) DebugTest()
DebugTest runs the debugger using testing mode in current active texteditor path
func (*CodeView) Defaults ¶
func (ge *CodeView) Defaults()
Defaults sets new project defaults based on overall settings
func (*CodeView) DiffFileNode ¶
DiffFileNode shows the differences between given file node as the A file, and another given file as the B file, in side-by-side DiffView and in the console as a context diff.
func (*CodeView) DiffFiles ¶
DiffFiles shows the differences between two given files in side-by-side DiffView and in the console as a context diff. It opens the files as file nodes and uses existing contents if open already.
func (*CodeView) EditProjectSettings ¶ added in v0.0.2
func (ge *CodeView) EditProjectSettings()
EditProjectSettings allows editing of project settings (settings specific to this project)
func (*CodeView) EditRecentPaths ¶ added in v0.0.1
func (ge *CodeView) EditRecentPaths()
EditRecentPaths opens a dialog editor for editing the recent project paths list
func (*CodeView) ExecCmd ¶
func (ge *CodeView) 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 (*CodeView) 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 (*CodeView) ExecCmdName ¶
ExecCmdName executes command of given name -- this is the final common pathway for all command invokation except on a node. if sel, select tab. if clearBuf, clear the buffer prior to command
func (*CodeView) ExecCmdNameActive ¶
ExecCmdNameActive calls given command on current active texteditor
func (*CodeView) ExecCmdNameFileNode ¶
func (ge *CodeView) ExecCmdNameFileNode(fn *filetree.Node, cmdNm code.CmdName, sel bool, clearBuf bool)
ExecCmdNameFileNode executes command of given name on given node
func (*CodeView) ExecCmdNameFilename ¶
ExecCmdNameFilename executes command of given name on given file name
func (*CodeView) ExecCmds ¶
ExecCmds executes a sequence of commands, sel = select tab, clearBuf = clear buffer
func (*CodeView) ExecCmdsFileNode ¶
func (ge *CodeView) ExecCmdsFileNode(fn *filetree.Node, cmdNms code.CmdNames, sel bool, clearBuf bool)
ExecCmdsFileNode executes a sequence of commands on file node, sel = select tab, clearBuf = clear buffer
func (*CodeView) FileNodeForFile ¶
FileNodeForFile returns file node for given file path add: if not found in existing tree and external files, then if add is true, it is added to the ExtFiles list.
func (*CodeView) FileNodeOpened ¶
FileNodeOpened is called whenever file node is double-clicked in file tree
func (*CodeView) FileNodeRunExe ¶
FileNodeRunExe runs the given executable file node
func (*CodeView) FileNodeSelected ¶
FileNodeSelected is called whenever tree browser has file node selected
func (*CodeView) Find ¶
func (ge *CodeView) Find(find string, repl string, ignoreCase bool, regExp bool, loc code.FindLoc, 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 (*CodeView) FocusActiveTextEditor ¶ added in v0.0.1
func (ge *CodeView) FocusActiveTextEditor() *code.TextEditor
FocusActiveTextEditor sets focus to active text editor
func (*CodeView) FocusNextPanel ¶
func (ge *CodeView) FocusNextPanel()
FocusNextPanel moves the keyboard focus to the next panel to the right
func (*CodeView) FocusOnPanel ¶
FocusOnPanel moves keyboard focus to given panel -- returns false if nothing at that tab
func (*CodeView) FocusOnTabs ¶
func (*CodeView) FocusPrevPanel ¶
func (ge *CodeView) FocusPrevPanel()
FocusPrevPanel moves the keyboard focus to the previous panel to the left
func (*CodeView) GrabSettings ¶ added in v0.0.2
func (ge *CodeView) GrabSettings()
GrabSettings grabs the current project preference settings from various places, e.g., prior to saving or editing.
func (*CodeView) GuessMainLang ¶
GuessMainLang guesses the main language in the project -- returns true if successful
func (*CodeView) HandleEvents ¶
func (ge *CodeView) HandleEvents()
func (*CodeView) HelpWiki ¶
func (ge *CodeView) HelpWiki()
HelpWiki opens wiki page for code on github
func (*CodeView) IsConfiged ¶
IsConfiged returns true if the view is configured
func (*CodeView) JoinParaLines ¶
func (ge *CodeView) 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 (*CodeView) LangDefaults ¶
func (ge *CodeView) LangDefaults()
LangDefaults applies default language settings based on MainLang
func (*CodeView) LastSaveTime ¶
func (*CodeView) LinkViewFile ¶
LinkViewFile opens the file in the 2nd texteditor, which is next to the tabs where links are clicked, if it is not collapsed -- else 1st
func (*CodeView) LinkViewFileNode ¶
LinkViewFileNode opens the file node in the 2nd texteditor, which is next to the tabs where links are clicked, if it is not collapsed -- else 1st
func (*CodeView) LookupFun ¶
LookupFun is the completion system Lookup function that makes a custom texteditor dialog that has option to edit resulting file.
func (*CodeView) NChangedFiles ¶
NChangedFiles returns number of opened files with unsaved changes
func (*CodeView) NewProject ¶ added in v0.0.2
func (ge *CodeView) NewProject(path core.Filename, folder string, mainLang fileinfo.Known, VersionControl filetree.VersionControlName) *CodeView
NewProject creates a new project at given path, making a new folder in that path -- all CodeView 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 (*CodeView) NextTextEditor ¶
func (ge *CodeView) NextTextEditor() (*code.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 (*CodeView) NextViewFile ¶
NextViewFile sets the next text view to view given file name -- include as much of name as possible to disambiguate -- will use the first matching -- if already being viewed, that is activated -- returns texteditor and its index, false if not found
func (*CodeView) NextViewFileNode ¶
NextViewFileNode sets the next text view to view file in given node (opens buffer if not already opened) -- if already being viewed, that is activated, returns text view and index
func (*CodeView) NodeType ¶ added in v0.0.2
NodeType returns the *types.Type of CodeView
func (*CodeView) OpenConsoleTab ¶
func (ge *CodeView) OpenConsoleTab()
OpenConsoleTab opens a main tab displaying console output (stdout, stderr)
func (*CodeView) OpenFile ¶
OpenFile opens file in an open project if it has the same path as the file or in a new window.
func (*CodeView) OpenFileAtRegion ¶
func (*CodeView) OpenFileNode ¶
OpenFileNode opens file for file node -- returns new bool and error
func (*CodeView) OpenFileURL ¶
func (ge *CodeView) OpenFileURL(ur string, ftv *texteditor.Editor) bool
OpenFileURL opens given file:/// url
func (*CodeView) OpenFindURL ¶
func (ge *CodeView) OpenFindURL(ur string, ftv *texteditor.Editor) bool
OpenFindURL opens given find:/// url from Find -- delegates to FindView
func (*CodeView) OpenNodeForTextEditor ¶
OpenNodeForTextEditor finds the FileNode that a given TextEditor is viewing, returning its index within OpenNodes list, or false if not found
func (*CodeView) 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 CodeView object if it is empty, or otherwise opens a new window.
func (*CodeView) OpenProject ¶ added in v0.0.2
OpenProject opens .code project file and its settings from given filename, in a standard toml-formatted file
func (*CodeView) OpenRecent ¶
OpenRecent opens a recently-used file
func (*CodeView) PanelIsOpen ¶
PanelIsOpen returns true if the given panel has not been collapsed and is avail and visible for displaying something
func (*CodeView) ParseOpenFindURL ¶
func (ge *CodeView) ParseOpenFindURL(ur string, ftv *texteditor.Editor) (tv *code.TextEditor, reg textbuf.Region, findBufStLn, findCount int, ok bool)
ParseOpenFindURL parses and opens given find:/// url from Find, return text region encoded in url, and starting line of results in find buffer, and number of results returned -- for parsing all the find results
func (*CodeView) PasteRect ¶
func (ge *CodeView) PasteRect()
PasteRect cuts rectangle in active text view
func (*CodeView) ProjectSettings ¶ added in v0.0.2
func (ge *CodeView) ProjectSettings() *code.ProjectSettings
func (*CodeView) ReCase ¶
ReCase replaces currently selected text in current active view with given case
func (*CodeView) RecycleCmdBuf ¶
RecycleCmdBuf creates the buffer for command output, or returns existing. If clear is true, then any existing buffer is cleared. Returns true if new buffer created.
func (*CodeView) RecycleCmdTab ¶
func (ge *CodeView) RecycleCmdTab(cmdNm string, sel bool, clearBuf bool) (*texteditor.Buffer, *texteditor.Editor, bool)
RecycleCmdTab creates the tab to show command output, including making a buffer object to save output from the command. returns true if a new buffer was created, false if one already existed. if sel, select tab. if clearBuf, then any existing buffer is cleared. Also returns index of tab.
func (*CodeView) RecycleTabTextEditor ¶
func (ge *CodeView) RecycleTabTextEditor(label string, sel bool) *texteditor.Editor
RecycleTabTextEditor returns a tab with given name, first by looking for an existing one, and if not found, making a new one with a TextEditor in it. if sel, then select it. returns widget
func (*CodeView) RegisterCopy ¶
RegisterCopy saves current selection in active text view to register of given name returns true if saved
func (*CodeView) RegisterPaste ¶
func (ge *CodeView) RegisterPaste(name code.RegisterName) bool
RegisterPaste pastes register of given name into active text view returns true if pasted
func (*CodeView) ReplaceInActive ¶
func (ge *CodeView) ReplaceInActive()
ReplaceInActive does query-replace in active file only
func (*CodeView) RevertActiveView ¶
func (ge *CodeView) RevertActiveView()
RevertActiveView revert active view to saved version
func (*CodeView) RunPostCmdsActiveView ¶
RunPostCmdsActiveView runs any registered post commands on the active view -- returns true if commands were run and file was reverted after that -- uses MainLang to disambiguate if multiple languages associated with extension.
func (*CodeView) RunPostCmdsFileNode ¶
RunPostCmdsFileNode runs any registered post commands on the given file node -- returns true if commands were run and file was reverted after that -- uses MainLang to disambiguate if multiple languages associated with extension.
func (*CodeView) SaveActiveView ¶
func (ge *CodeView) SaveActiveView()
SaveActiveView saves the contents of the currently-active texteditor
func (*CodeView) SaveActiveViewAs ¶
SaveActiveViewAs save with specified filename the contents of the currently-active texteditor
func (*CodeView) SaveAll ¶
func (ge *CodeView) 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 (*CodeView) 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 (*CodeView) SaveAllOpenNodes ¶
func (ge *CodeView) SaveAllOpenNodes()
SaveAllOpenNodes saves all of the open filenodes to their current file names
func (*CodeView) SaveProject ¶ added in v0.0.2
func (ge *CodeView) SaveProject()
SaveProject saves project file containing custom project settings, in a standard toml-formatted file
func (*CodeView) SaveProjectAs ¶ added in v0.0.2
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 (*CodeView) SaveProjectIfExists ¶ added in v0.0.2
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 (*CodeView) SelectOpenNode ¶
func (ge *CodeView) SelectOpenNode()
SelectOpenNode pops up a menu to select an open node (aka buffer) to view in current active texteditor
func (*CodeView) SelectTabByName ¶ added in v0.0.1
SelectTabByName Selects given main tab, and returns all of its contents as well.
func (*CodeView) SelectedFileNode ¶
SelectedFileNode returns currently selected file tree node as a *filetree.Node could be nil.
func (*CodeView) SetActiveFileInfo ¶
func (ge *CodeView) SetActiveFileInfo(buf *texteditor.Buffer)
SetActiveFileInfo sets the active file info from textbuf
func (*CodeView) SetActiveLang ¶
SetActiveLang sets the [CodeView.ActiveLang]: language for current active filename
func (*CodeView) SetActiveTextEditor ¶
func (ge *CodeView) SetActiveTextEditor(av *code.TextEditor) int
SetActiveTextEditor sets the given texteditor as the active one, and returns its index
func (*CodeView) SetActiveTextEditorIndex ¶ added in v0.0.2
func (ge *CodeView) SetActiveTextEditorIndex(idx int) *code.TextEditor
SetActiveTextEditorIndex sets the given view index as the currently-active TextEditor -- returns that texteditor. This is the main method for activating a text editor.
func (*CodeView) SetArgVarVals ¶
func (ge *CodeView) SetArgVarVals()
SetArgVarVals sets the ArgVar values for commands, from CodeView values
func (*CodeView) SetOpenNodes ¶
SetOpenNodes sets the [CodeView.OpenNodes]: list of open nodes, most recent first
func (*CodeView) SetProjectFilename ¶ added in v0.0.2
SetProjectFilename sets the [CodeView.ProjectFilename]: current project filename for saving / loading specific Code configuration information in a .code file (optional)
func (*CodeView) SetProjectRoot ¶ added in v0.0.2
SetProjectRoot sets the [CodeView.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 (*CodeView) SetStatus ¶
SetStatus sets the current status update message for the StatusBar next time it renders
func (*CodeView) SetStatusMessage ¶
SetStatusMessage sets the [CodeView.StatusMessage]: the last status update message
func (*CodeView) SetTooltip ¶
SetTooltip sets the [CodeView.Tooltip]
func (*CodeView) SetWindowNameTitle ¶
func (ge *CodeView) SetWindowNameTitle()
SetWindowNameTitle sets the window name and title based on current project name
func (*CodeView) ShowFile ¶
ShowFile shows given file name at given line, returning TextEditor showing it or error if not found.
func (*CodeView) SpacesToTabs ¶
func (ge *CodeView) SpacesToTabs()
SpacesToTabs converts spaces to tabs for given selected region (full text if no selection)
func (*CodeView) SplitsEdit ¶
func (ge *CodeView) SplitsEdit()
SplitsEdit opens the SplitsView editor to customize saved splitter settings
func (*CodeView) SplitsSave ¶
SplitsSave saves current splitter settings to named splitter settings under existing name, and saves to prefs file
func (*CodeView) SplitsSaveAs ¶
SplitsSaveAs saves current splitter settings to new named splitter settings, and saves to prefs file
func (*CodeView) SplitsSetView ¶
SplitsSetView sets split view splitters to given named setting
func (*CodeView) StatusLabel ¶
StatusLabel returns the statusbar label widget
func (*CodeView) SwapTextEditors ¶
SwapTextEditors switches the buffers for the two open texteditors only operates if both panels are open
func (*CodeView) Symbols ¶
func (ge *CodeView) Symbols()
Symbols displays the Symbols of a file or package
func (*CodeView) TabByName ¶ added in v0.0.1
TabByName returns a tab with given name, nil if not found.
func (*CodeView) TabDeleted ¶
TabDeleted is called when a main tab is deleted -- we cancel any running commmands
func (*CodeView) TabsToSpaces ¶
func (ge *CodeView) TabsToSpaces()
TabsToSpaces converts tabs to spaces for given selected region (full text if no selection)
func (*CodeView) TextBufForFile ¶
func (ge *CodeView) TextBufForFile(fpath string, add bool) *texteditor.Buffer
TextBufForFile returns TextBuf for given file path. add: if not found in existing tree and external files, then if add is true, it is added to the ExtFiles list.
func (*CodeView) TextEditorButtonByIndex ¶
TextEditorButtonByIndex returns the top texteditor menu button by index (0 or 1)
func (*CodeView) TextEditorButtonMenu ¶
func (*CodeView) TextEditorByIndex ¶
func (ge *CodeView) TextEditorByIndex(idx int) *code.TextEditor
TextEditorByIndex returns the TextEditor by index (0 or 1), nil if not found
func (*CodeView) TextEditorForFile ¶
TextEditorForFile finds FileNode for file, and returns TextEditor and index that is viewing that FileNode, or false if none is
func (*CodeView) TextEditorForFileNode ¶
TextEditorForFileNode finds a TextEditor that is viewing given FileNode, and its index, or false if none is
func (*CodeView) TextEditorIndex ¶
func (ge *CodeView) TextEditorIndex(av *code.TextEditor) int
TextEditorIndex finds index of given texteditor (0 or 1)
func (*CodeView) UpdateFiles ¶
func (ge *CodeView) UpdateFiles()
UpdateFiles updates the list of files saved in project
func (*CodeView) UpdateStatusLabel ¶
func (ge *CodeView) UpdateStatusLabel()
UpdateStatusLabel updates the statusbar label, called for each render!
func (*CodeView) UpdateTextButtons ¶
func (ge *CodeView) UpdateTextButtons()
UpdateTextButtons updates texteditor menu buttons is called by SetStatus and is generally under cover of TopUpdateStart / End doesn't do anything unless a change is required -- safe to call frequently.
func (*CodeView) VCSLog ¶
VCSLog shows the VCS log of commits for this file, optionally with a since date qualifier: If since is non-empty, it should be a date-like expression that the VCS will understand, such as 1/1/2020, yesterday, last year, etc. SVN only understands a number as a maximum number of items to return. If allFiles is true, then the log will show revisions for all files, not just this one. Returns the Log and also shows it in a VCSLogView which supports further actions.
func (*CodeView) VCSUpdateAll ¶
func (ge *CodeView) VCSUpdateAll()
VCSUpdateAll does an Update (e.g., Pull) on all VCS repositories within the open tree nodes in FileTree.
func (*CodeView) VersionControl ¶ added in v0.0.1
func (ge *CodeView) VersionControl() filetree.VersionControlName
VersionControl returns the version control system in effect, using the file tree detected version or whatever is set in project settings
func (*CodeView) ViewFile ¶
ViewFile views file in an existing TextEditor if it is already viewing that file, otherwise opens ViewFileNode in active buffer
func (*CodeView) ViewFileInIndex ¶ added in v0.0.2
ViewFileInIndex views file in given text view index
func (*CodeView) ViewFileNode ¶
ViewFileNode sets the given text view to view file in given node (opens buffer if not already opened). This is the main method for viewing a file.
func (*CodeView) ViewOpenNodeName ¶
ViewOpenNodeName views given open node (by name) in active view