code

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2024 License: BSD-3-Clause Imports: 57 Imported by: 0

README

Cogent Code is a flexible IDE (integrated development environment) framework in pure Go, using the Cogent Core GUI (for which it serves as a continuous testing platform) and the parse interactive parser for syntax highlighting and more advanced IDE code processing.

There are many existing, excellent choices for text editors and IDEs, but Code is possibly the best pure Go option available. The Go language represents a special combination of simplicity, elegance, and power, and is a joy to program in, and is currently the main language fully supported by Code. Our ambition is to capture some of those Go attributes in an IDE.

Some of the main features of Code include:

  • Designed to function as both a general-purpose text editor and an IDE. It comes configured with command support for LaTeX, Markdown, and Makefiles, in addition to Go,a and the command system is fully extensible to support any command-line tools.

  • Provides a tree-based file browser on the left, with builtin support for version control (git, svn, etc) and standard file management functionality through drag-and-drop, etc. You can look at git logs, diffs, etc through this interface.

  • Command actions show output on a tabbed output display on the right, along with other special interfaces such as Find / Replace, Symbols, Debugger, etc. Thus, the overall design is extensible and new interfaces can be easily added to supply new functionality. You don't spend any time fiddling around with lots of different panels all over the place, and you always know where to look to find something. Maybe the result is less fancy and "bespoke" for a given use-case (e.g., Debugging), but our guiding principle is to use a simple framework that does most things well, much like the Go language itself.

  • Strongly keyboard focused, inspired by Emacs -- existing Emacs users should be immediately productive. However, other common keyboard bindings are also supported, and key bindings are entirely customizable. If you're considering actually using it, we strongly recommend reading the Wiki tips to get the most out of it, and understand the key design principles (e.g., why there are no tabs for open files!).

Install

  • Wiki instructions: Install -- for building directly from source.

  • See Releases on this github page for pre-built OS-specific app packages that install the compiled binaries.

  • See install directory for OS-specific Makefiles to install apps and build packages.

Current Status

As of April 2020, it is feature complete as a Go IDE, including type-comprehension-based completion, and an integrated GUI debugger, running on top of delve. It is in daily use by the primary developers, and very stable at this point, with the initial 1.0 release now available.

In addition to Issues shown on github, some important features to be added longer-term include:

  • More coding automation, refactoring, etc. We don't want to go too crazy here, preferring the more general-purpose and simple approach, but probably some more could be done.

  • Full support for Python, including extending the parse interactive parser to handle Python, so it will have been worth writing instead of just using the native Go parser.

Screenshots

Screenshot

Screenshot, darker

TODO

  • symbolspanel icons not updating immediately -- fix from filenodedid not fix here

  • line number too conservative in not rendering bottom

  • don't render top text, line number if out of range

  • always display cursor when typing!

  • drag-n-drop table

  • color highlighting for diff output in commandshell!

  • outbuf use textview markup in addition to link formatting and other formatting. tried but failed

  • more helpers for URI api

  • filter function for chooser for URI case

  • Editable Chooser doesn't work with shift-tab -- requires focus prev fix to work properly!

  • Find not selecting first item (sometimes?)

  • filepicker global priority key shortcuts

  • editor rendering overflow

  • filetree --get rid of empty upper level or not?

  • list / table should activate select and focus on selectidx item in readonly chooser mode -- select is working, but focus is not -- cannot move selection via keyboard

DONE:

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

View Source
const (
	CmdWait      = true
	CmdNoWait    = false
	CmdFocus     = true
	CmdNoFocus   = false
	CmdConfirm   = true
	CmdNoConfirm = false
)

Use these for more obvious command options

View Source
const (
	FileTreeIndex = iota
	TextEditor1Index
	TextEditor2Index
	TabsIndex
)

These are then the fixed indices of the different elements in the splitview

View Source
const (
	DebugTabConsole = "Console"
	DebugTabBreaks  = "Breaks"
	DebugTabStack   = "Stack"
	DebugTabTasks   = "Tasks"
	DebugTabThreads = "Threads"
	DebugTabVars    = "Vars"
	DebugTabFrames  = "Find Frames"
	DebugTabGlobals = "Global Vars"
)
View Source
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
)
View Source
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

View Source
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"
)
View Source
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

View Source
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..

View Source
var AvailableRegisterNames []string

AvailableRegisterNames are the names of the current AvailRegisters -- used for some choosers

View Source
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..

View Source
var AvailableSplitNames []string

AvailableSplitNames are the names of the current AvailableSplits -- used for some choosers

View Source
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..

CatNoEdit are the files to NOT edit from categories: Doc, Data

View Source
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.

View Source
var CmdOutStatusLen = 80

CmdOutStatusLen is amount of command output to include in the status update

View Source
var CmdPrompt1Vals = map[string]string{}

CmdPrompt1Vals holds last values for PromptString1 per command, so that each such command has its own appropriate history

View Source
var CmdPrompt2Vals = map[string]string{}

CmdPrompt2Vals holds last values for PromptString2 per command, so that each such command has its own appropriate history

View Source
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.

View Source
var CommandIcons = map[string]icons.Icon{"File": icons.File, "Git": icons.Git, "Build": icons.Build, "Core": icons.CogentCore, "Go": icons.Go}
View Source
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

View Source
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.

View Source
var CustomCommandsChanged = false

CustomCommandsChanged is used to update core.CmdsView toolbars via following menu, toolbar properties update methods.

View Source
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,
	}
)
View Source
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.

View Source
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

View Source
var RegisterSettingsFilename = "register-settings.toml"

RegisterSettingsFilename is the name of the settings file in the app settings directory for saving / loading the default AvailableRegisters

View Source
var Settings = &SettingsData{
	SettingsBase: core.SettingsBase{
		Name: "Code",
		File: filepath.Join(core.TheApp.DataDir(), "Cogent Code", "settings.toml"),
	},
}

Settings are the overall Code settings

View Source
var SplitsSettingsFilename = "splits-settings.json"

SplitsSettingsFilename is the name of the settings file in App prefs directory for saving / loading the default AvailSplits

View Source
var StandardCommands = Commands{
	{Cat: "Build", Name: "Run Project",
		Desc: "run RunExec executable set in project",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "{RunExecPath}"}},
		Dir:  "{RunExecDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},
	{Cat: "Build", Name: "Run Prompt",
		Desc: "run any command you enter at the prompt",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "{PromptString1}"}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Build", Name: "Make",
		Desc: "run make with no args",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "make"}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Build", Name: "Make Prompt",
		Desc: "run make with prompted make target",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "make",
			Args: []string{"{PromptString1}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "File", Name: "Grep",
		Desc: "recursive grep of all files for prompted value",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "grep",
			Args: []string{"-R", "-e", "{PromptString1}", "{FileDirPath}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "File", Name: "Open",
		Desc: "open file using OS 'open' command",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "open",
			Args: []string{"{FilePath}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "File", Name: "Open Target",
		Desc: "open project target file using OS 'open' command",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "open",
			Args: []string{"{RunExecPath}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Go", Name: "Imports File",
		Desc: "run goimports on file",
		Lang: fileinfo.Go,
		Cmds: []CmdAndArgs{{Cmd: "goimports",
			Args: []string{"-w", "{FilePath}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Go", Name: "Fmt File",
		Desc: "run go fmt on file",
		Lang: fileinfo.Go,
		Cmds: []CmdAndArgs{{Cmd: "gofmt",
			Args: []string{"-w", "{FilePath}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Go", Name: "Build Dir",
		Desc: "run go build to build in current dir",
		Lang: fileinfo.Go,
		Cmds: []CmdAndArgs{{Cmd: "go",
			Args: []string{"build", "-v"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Go", Name: "Build Proj",
		Desc: "run go build for project BuildDir",
		Lang: fileinfo.Go,
		Cmds: []CmdAndArgs{{Cmd: "go",
			Args: []string{"build", "-v"}}},
		Dir:  "{BuildDir}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Go", Name: "Install Dir",
		Desc: "run go install in current dir",
		Lang: fileinfo.Go,
		Cmds: []CmdAndArgs{{Cmd: "go",
			Args: []string{"install", "-v"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Go", Name: "Generate",
		Desc: "run go generate in current dir",
		Lang: fileinfo.Go,
		Cmds: []CmdAndArgs{{Cmd: "go",
			Args: []string{"generate"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Go", Name: "Test",
		Desc: "run go test in current dir.  Options include: -run TestName or -bench",
		Lang: fileinfo.Go,
		Cmds: []CmdAndArgs{{Cmd: "go",
			Args: []string{"test", "-v", "{PromptString1}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Go", Name: "Vet",
		Desc: "run go vet in current dir",
		Lang: fileinfo.Go,
		Cmds: []CmdAndArgs{{Cmd: "go",
			Args: []string{"vet"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Go", Name: "Mod Tidy",
		Desc: "run go mod tidy in current dir",
		Lang: fileinfo.Go,
		Cmds: []CmdAndArgs{{Cmd: "go",
			Args: []string{"mod", "tidy"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Go", Name: "Mod Init",
		Desc: "run go mod init in current dir with module path from prompt",
		Lang: fileinfo.Go,
		Cmds: []CmdAndArgs{{Cmd: "go",
			Args: []string{"mod", "init", "{PromptString1}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Go", Name: "Get",
		Desc: "run go get on package(s) you enter at prompt",
		Lang: fileinfo.Go,
		Cmds: []CmdAndArgs{{Cmd: "go",
			Args: []string{"get", "{PromptString1}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Go", Name: "Get Update",
		Desc: "run go get -u (update) on package(s) you enter at prompt.  use ./... for all.",
		Lang: fileinfo.Go,
		Cmds: []CmdAndArgs{{Cmd: "go",
			Args:    []string{"get", "-u", "{PromptString1}"},
			Default: "./..."}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Add",
		Desc: "git add file",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args: []string{"add", "{FilePath}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Switch To Branch",
		Desc: "git switch to an existing branch",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args: []string{"switch", "{PromptBranch}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Switch",
		Desc: "git switch to new branch or existing commit: -c or -C (force) <branch> to create new; --detatch <commit> to switch to older (non-HEAD) commit; --orphan to abandon history",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args:    []string{"switch", "{PromptString1}"},
			Default: "-c "}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Restore",
		Desc: "git restore: file, directory -- undoes any current changes and restores from last commit; -s option specifies source -- also available as revert in file picker",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args: []string{"restore", "{PromptString1}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Checkout",
		Desc: "git checkout: file, directory, branch; -b <branch> creates a new branch",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args: []string{"checkout", "{PromptString1}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Status",
		Desc: "git status",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args: []string{"status"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Diff",
		Desc: "git diff -- see changes since last checkin",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args: []string{"diff"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm, Hilight: fileinfo.Diff},

	{Cat: "Git", Name: "Log",
		Desc: "git log",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args: []string{"log"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Commit",
		Desc: "git commit",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args: []string{"commit", "-am", "{PromptString1}"}, PromptIsString: true}},
		Dir:  "{FileDirPath}",
		Wait: CmdWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Pull Branch",
		Desc: "git pull from existing branch",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args: []string{"pull", "origin", "{PromptBranch}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Pull",
		Desc: "git pull",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args:    []string{"pull", "{PromptString1}"},
			Default: "origin"}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Push",
		Desc: "git push to update remote (origin) for given branch",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args:    []string{"push", "origin", "{PromptBranch}"},
			Default: "origin"}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Push Force",
		Desc: "git push to update remote (origin) for given branch -- force -- needed for example after rebase or merge with conflicts",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args:    []string{"push", "--force", "origin", "{PromptBranch}"},
			Default: "origin"}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Stash",
		Desc: "git stash: push / pop local changes for later without committing, resetting to HEAD: also list, show, drop, clear",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args:    []string{"stash", "{PromptString1}"},
			Default: "push"}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Branch",
		Desc: "git branch: -a shows all; --list shows local; <branchname> makes a new one, optionally given sha; -d to delete; -r delete remote; -D force delete",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args:    []string{"branch", "{PromptString1}"},
			Default: "-a"}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Branch Delete",
		Desc: "git branch -d -r selected branch name",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args: []string{"branch", "-d", "-r", "{PromptBranch}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Rebase",
		Desc: "git rebase: updates current branch to given branch, often master",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args:    []string{"rebase", "{PromptBranch}"},
			Default: "master"}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Rebase Continue",
		Desc: "git rebase: updates current branch to given branch, often master -- does --continue to continue process",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args: []string{"rebase", "--continue"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Reset",
		Desc: "git reset: resets current state to given source -- use --hard to override -- CAN RESULT IN LOSS OF CHANGES -- make sure everything is committed",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args:    []string{"reset", "{PromptString1}"},
			Default: "--hard origin/master"}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Remote",
		Desc: "git remote: prune origin = remove stale branches; show; add <name> <URL>; remove <name>; get-url / set-url <name>",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "git",
			Args:    []string{"remote", "{PromptString1}"},
			Default: "prune origin"}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Git", Name: "Count LOC",
		Desc: "runs bash -c git ls-files with command sequence that counts lines of code in git repository -- edit with extra | grep steps to filter accordingly",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "bash",
			Args:    []string{"-c", "{PromptString1}"},
			Default: `"git ls-files | xargs wc -l"`}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "SVN", Name: "Add",
		Desc: "svn add file",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "svn",
			Args: []string{"add", "{FilePath}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "SVN", Name: "Status",
		Desc: "svn status",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "svn",
			Args: []string{"status"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "SVN", Name: "Info",
		Desc: "svn info",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "svn",
			Args: []string{"info"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "SVN", Name: "Log",
		Desc: "svn log",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "svn",
			Args: []string{"log", "-v"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "SVN", Name: "Commit Project",
		Desc: "svn commit for entire project directory",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "svn",
			Args: []string{"commit", "-m", "{PromptString1}"}, PromptIsString: true}},
		Dir:  "{ProjectPath}",
		Wait: CmdWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "SVN", Name: "Commit Dir",
		Desc: "svn commit in directory of current file",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "svn",
			Args: []string{"commit", "-m", "{PromptString1}"}, PromptIsString: true}},
		Dir:  "{FileDirPath}",
		Wait: CmdWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "SVN", Name: "Update",
		Desc: "svn update",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "svn",
			Args: []string{"update"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "LaTeX", Name: "LaTeX PDF",
		Desc: "run PDFLaTeX on file",
		Lang: fileinfo.TeX,
		Cmds: []CmdAndArgs{{Cmd: "pdflatex",
			Args: []string{"-file-line-error", "-interaction=nonstopmode", "{FilePath}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "LaTeX", Name: "BibTeX",
		Desc: "run BibTeX on file",
		Lang: fileinfo.TeX,
		Cmds: []CmdAndArgs{{Cmd: "bibtex",
			Args: []string{"{FilenameNoExt}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "LaTeX", Name: "Biber",
		Desc: "run Biber on file",
		Lang: fileinfo.TeX,
		Cmds: []CmdAndArgs{{Cmd: "biber",
			Args: []string{"{FilenameNoExt}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "LaTeX", Name: "CleanTeX",
		Desc: "remove aux LaTeX files",
		Lang: fileinfo.TeX,
		Cmds: []CmdAndArgs{{Cmd: "rm",
			Args: []string{"*.aux", "*.log", "*.blg", "*.bbl", "*.fff", "*.lof", "*.ttt", "*.toc", "*.spl"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Core", Name: "Run",
		Desc: "Builds and runs go executable in current directory: core run [ios | android | web | darwin | windows | linux]",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "core",
			Args: []string{"run", "{PromptString1}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Core", Name: "Install",
		Desc: "Installs go executable in current directory: core install -t [ios | android | web | darwin | windows | linux]",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "core",
			Args: []string{"install", "{PromptString1}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Core", Name: "Next-Release",
		Desc: "increments the patch-level version number and pushes a release tag at this new version",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "core",
			Args: []string{"next-release"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Core", Name: "Release",
		Desc: "sets the version to the given value at the prompt and pushes a release tag at this version",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "core",
			Args: []string{"release", "{PromptString1}"}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Core", Name: "Generate All",
		Desc: "runs core generate ./... to update all generated files in current dir and below",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "core",
			Args: []string{"generate", "./..."}}},
		Dir:  "{FileDirPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Core", Name: "Changed",
		Desc: "show which packages are changed, at the root project level",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "core",
			Args: []string{"changed"}}},
		Dir:  "{ProjectPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},

	{Cat: "Core", Name: "Pull",
		Desc: "pull all packages at the root project level",
		Lang: fileinfo.Any,
		Cmds: []CmdAndArgs{{Cmd: "core",
			Args: []string{"pull"}}},
		Dir:  "{ProjectPath}",
		Wait: CmdNoWait, Focus: CmdNoFocus, Confirm: CmdNoConfirm},
}

StandardCommands is the original compiled-in set of standard commands.

View Source
var StandardKeyMaps = keymap.Maps{
	{"MacStandard", "Standard Mac KeyMap", keymap.Map{
		"Control+Tab":         KeyNextPanel,
		"Control+Shift+Tab":   KeyPrevPanel,
		"Control+X o":         KeyNextPanel,
		"Control+X Control+O": KeyNextPanel,
		"Control+X p":         KeyPrevPanel,
		"Control+X Control+P": KeyPrevPanel,
		"Control+X f":         KeyFileOpen,
		"Control+X Control+F": KeyFileOpen,
		"Control+X b":         KeyBufSelect,
		"Control+X Control+B": KeyBufSelect,
		"Control+X s":         KeyBufSave,
		"Control+X Control+S": KeyBufSave,
		"Control+X w":         KeyBufSaveAs,
		"Control+X Control+W": KeyBufSaveAs,
		"Control+X k":         KeyBufClose,
		"Control+X Control+K": KeyBufClose,
		"Control+X c":         KeyExecCmd,
		"Control+X Control+C": KeyExecCmd,
		"Control+C c":         KeyExecCmd,
		"Control+C Control+C": KeyExecCmd,
		"Control+C o":         KeyBufClone,
		"Control+C Control+O": KeyBufClone,
		"Control+X x":         KeyRegCopy,
		"Control+X g":         KeyRegPaste,
		"Control+X Control+X": KeyRectCut,
		"Control+X Control+Y": KeyRectPaste,
		"Control+X Alt+∑":     KeyRectCopy,
		"Control+C k":         KeyCommentOut,
		"Control+C Control+K": KeyCommentOut,
		"Control+X i":         KeyIndent,
		"Control+X Control+I": KeyIndent,
		"Control+X j":         KeyJump,
		"Control+X Control+J": KeyJump,
		"Control+X v":         KeySetSplit,
		"Control+X Control+V": KeySetSplit,
		"Control+X m":         KeyBuildProject,
		"Control+X Control+M": KeyBuildProject,
		"Control+X r":         KeyRunProject,
		"Control+X Control+R": KeyRunProject,
	}},
	{"MacEmacs", "Mac with emacs-style navigation -- emacs wins in conflicts", keymap.Map{
		"Control+Tab":         KeyNextPanel,
		"Control+Shift+Tab":   KeyPrevPanel,
		"Control+X o":         KeyNextPanel,
		"Control+X Control+O": KeyNextPanel,
		"Control+X p":         KeyPrevPanel,
		"Control+X Control+P": KeyPrevPanel,
		"Control+X f":         KeyFileOpen,
		"Control+X Control+F": KeyFileOpen,
		"Control+X b":         KeyBufSelect,
		"Control+X Control+B": KeyBufSelect,
		"Control+X s":         KeyBufSave,
		"Control+X Control+S": KeyBufSave,
		"Control+X w":         KeyBufSaveAs,
		"Control+X Control+W": KeyBufSaveAs,
		"Control+X k":         KeyBufClose,
		"Control+X Control+K": KeyBufClose,
		"Control+X c":         KeyExecCmd,
		"Control+X Control+C": KeyExecCmd,
		"Control+C c":         KeyExecCmd,
		"Control+C Control+C": KeyExecCmd,
		"Control+C o":         KeyBufClone,
		"Control+C Control+O": KeyBufClone,
		"Control+X x":         KeyRegCopy,
		"Control+X g":         KeyRegPaste,
		"Control+X Control+X": KeyRectCut,
		"Control+X Control+Y": KeyRectPaste,
		"Control+X Alt+∑":     KeyRectCopy,
		"Control+C k":         KeyCommentOut,
		"Control+C Control+K": KeyCommentOut,
		"Control+X i":         KeyIndent,
		"Control+X Control+I": KeyIndent,
		"Control+X j":         KeyJump,
		"Control+X Control+J": KeyJump,
		"Control+X v":         KeySetSplit,
		"Control+X Control+V": KeySetSplit,
		"Control+X m":         KeyBuildProject,
		"Control+X Control+M": KeyBuildProject,
		"Control+X r":         KeyRunProject,
		"Control+X Control+R": KeyRunProject,
	}},
	{"LinuxEmacs", "Linux with emacs-style navigation -- emacs wins in conflicts", keymap.Map{
		"Control+Tab":         KeyNextPanel,
		"Control+Shift+Tab":   KeyPrevPanel,
		"Control+X o":         KeyNextPanel,
		"Control+X Control+O": KeyNextPanel,
		"Control+X p":         KeyPrevPanel,
		"Control+X Control+P": KeyPrevPanel,
		"Control+X f":         KeyFileOpen,
		"Control+X Control+F": KeyFileOpen,
		"Control+X b":         KeyBufSelect,
		"Control+X Control+B": KeyBufSelect,
		"Control+X s":         KeyBufSave,
		"Control+X Control+S": KeyBufSave,
		"Control+X w":         KeyBufSaveAs,
		"Control+X Control+W": KeyBufSaveAs,
		"Control+X k":         KeyBufClose,
		"Control+X Control+K": KeyBufClose,
		"Control+X c":         KeyExecCmd,
		"Control+X Control+C": KeyExecCmd,
		"Control+C c":         KeyExecCmd,
		"Control+C Control+C": KeyExecCmd,
		"Control+C o":         KeyBufClone,
		"Control+C Control+O": KeyBufClone,
		"Control+X x":         KeyRegCopy,
		"Control+X g":         KeyRegPaste,
		"Control+X Control+X": KeyRectCut,
		"Control+X Control+Y": KeyRectPaste,
		"Control+X Alt+∑":     KeyRectCopy,
		"Control+C k":         KeyCommentOut,
		"Control+C Control+K": KeyCommentOut,
		"Control+X i":         KeyIndent,
		"Control+X Control+I": KeyIndent,
		"Control+X j":         KeyJump,
		"Control+X Control+J": KeyJump,
		"Control+X v":         KeySetSplit,
		"Control+X Control+V": KeySetSplit,
		"Control+M m":         KeyBuildProject,
		"Control+M Control+M": KeyBuildProject,
		"Control+M r":         KeyRunProject,
		"Control+M Control+R": KeyRunProject,
	}},
	{"LinuxStandard", "Standard Linux key map", keymap.Map{
		"Control+Tab":         KeyNextPanel,
		"Control+Shift+Tab":   KeyPrevPanel,
		"Control+E o":         KeyNextPanel,
		"Control+E Control+O": KeyNextPanel,
		"Control+E p":         KeyPrevPanel,
		"Control+E Control+P": KeyPrevPanel,
		"Control+O":           KeyFileOpen,
		"Control+E f":         KeyFileOpen,
		"Control+E Control+F": KeyFileOpen,
		"Control+E b":         KeyBufSelect,
		"Control+E Control+B": KeyBufSelect,
		"Control+S":           KeyBufSave,
		"Control+Shift+S":     KeyBufSaveAs,
		"Control+E s":         KeyBufSave,
		"Control+E Control+S": KeyBufSave,
		"Control+E w":         KeyBufSaveAs,
		"Control+E Control+W": KeyBufSaveAs,
		"Control+E k":         KeyBufClose,
		"Control+E Control+K": KeyBufClose,
		"Control+B c":         KeyExecCmd,
		"Control+B Control+C": KeyExecCmd,
		"Control+B o":         KeyBufClone,
		"Control+B Control+O": KeyBufClone,
		"Control+E x":         KeyRegCopy,
		"Control+E g":         KeyRegPaste,
		"Control+E Control+X": KeyRectCut,
		"Control+E Control+Y": KeyRectPaste,
		"Control+E Alt+∑":     KeyRectCopy,
		"Control+/":           KeyCommentOut,
		"Control+B k":         KeyCommentOut,
		"Control+B Control+K": KeyCommentOut,
		"Control+E i":         KeyIndent,
		"Control+E Control+I": KeyIndent,
		"Control+E j":         KeyJump,
		"Control+E Control+J": KeyJump,
		"Control+E v":         KeySetSplit,
		"Control+E Control+V": KeySetSplit,
		"Control+E m":         KeyBuildProject,
		"Control+E Control+M": KeyBuildProject,
		"Control+E r":         KeyRunProject,
		"Control+E Control+R": KeyRunProject,
	}},
	{"WindowsStandard", "Standard Windows key map", keymap.Map{
		"Control+Tab":         KeyNextPanel,
		"Control+Shift+Tab":   KeyPrevPanel,
		"Control+E o":         KeyNextPanel,
		"Control+E Control+O": KeyNextPanel,
		"Control+E p":         KeyPrevPanel,
		"Control+E Control+P": KeyPrevPanel,
		"Control+O":           KeyFileOpen,
		"Control+E f":         KeyFileOpen,
		"Control+E Control+F": KeyFileOpen,
		"Control+E b":         KeyBufSelect,
		"Control+E Control+B": KeyBufSelect,
		"Control+S":           KeyBufSave,
		"Control+Shift+S":     KeyBufSaveAs,
		"Control+E s":         KeyBufSave,
		"Control+E Control+S": KeyBufSave,
		"Control+E w":         KeyBufSaveAs,
		"Control+E Control+W": KeyBufSaveAs,
		"Control+E k":         KeyBufClose,
		"Control+E Control+K": KeyBufClose,
		"Control+B c":         KeyExecCmd,
		"Control+B Control+C": KeyExecCmd,
		"Control+B o":         KeyBufClone,
		"Control+B Control+O": KeyBufClone,
		"Control+E x":         KeyRegCopy,
		"Control+E g":         KeyRegPaste,
		"Control+E Control+X": KeyRectCut,
		"Control+E Control+Y": KeyRectPaste,
		"Control+E Alt+∑":     KeyRectCopy,
		"Control+/":           KeyCommentOut,
		"Control+B k":         KeyCommentOut,
		"Control+B Control+K": KeyCommentOut,
		"Control+E i":         KeyIndent,
		"Control+E Control+I": KeyIndent,
		"Control+E j":         KeyJump,
		"Control+E Control+J": KeyJump,
		"Control+E v":         KeySetSplit,
		"Control+E Control+V": KeySetSplit,
		"Control+E m":         KeyBuildProject,
		"Control+E Control+M": KeyBuildProject,
		"Control+E r":         KeyRunProject,
		"Control+E Control+R": KeyRunProject,
	}},
	{"ChromeStd", "Standard chrome-browser and linux-under-chrome bindings", keymap.Map{
		"Control+Tab":         KeyNextPanel,
		"Control+Shift+Tab":   KeyPrevPanel,
		"Control+E o":         KeyNextPanel,
		"Control+E Control+O": KeyNextPanel,
		"Control+E p":         KeyPrevPanel,
		"Control+E Control+P": KeyPrevPanel,
		"Control+O":           KeyFileOpen,
		"Control+E f":         KeyFileOpen,
		"Control+E Control+F": KeyFileOpen,
		"Control+E b":         KeyBufSelect,
		"Control+E Control+B": KeyBufSelect,
		"Control+S":           KeyBufSave,
		"Control+Shift+S":     KeyBufSaveAs,
		"Control+E s":         KeyBufSave,
		"Control+E Control+S": KeyBufSave,
		"Control+E w":         KeyBufSaveAs,
		"Control+E Control+W": KeyBufSaveAs,
		"Control+E k":         KeyBufClose,
		"Control+E Control+K": KeyBufClose,
		"Control+B c":         KeyExecCmd,
		"Control+B Control+C": KeyExecCmd,
		"Control+B o":         KeyBufClone,
		"Control+B Control+O": KeyBufClone,
		"Control+E x":         KeyRegCopy,
		"Control+E g":         KeyRegPaste,
		"Control+E Control+X": KeyRectCut,
		"Control+E Control+Y": KeyRectPaste,
		"Control+E Alt+∑":     KeyRectCopy,
		"Control+/":           KeyCommentOut,
		"Control+B k":         KeyCommentOut,
		"Control+B Control+K": KeyCommentOut,
		"Control+E i":         KeyIndent,
		"Control+E Control+I": KeyIndent,
		"Control+E j":         KeyJump,
		"Control+E Control+J": KeyJump,
		"Control+E v":         KeySetSplit,
		"Control+E Control+V": KeySetSplit,
		"Control+E m":         KeyBuildProject,
		"Control+E Control+M": KeyBuildProject,
		"Control+E r":         KeyRunProject,
		"Control+E Control+R": KeyRunProject,
	}},
}

StandardKeyMaps are the standard extended maps for Code

View Source
var StandardLanguages = Languages{
	fileinfo.Go: {CmdNames{"Go: Imports File"}},
}

StandardLanguages is the original compiled-in set of standard language options.

View Source
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 ArgVarKeys

func ArgVarKeys() []string

ArgVarKeys creates a slice of string to hold the keys

func ArgVarPrompts

func ArgVarPrompts(arg string) (map[string]struct{}, bool)

ArgVarPrompts returns any Prompt* variables required by this string, false if none

func CheckForProjectAtPath

func CheckForProjectAtPath(path string) (string, bool)

CheckForProjectAtPath checks if there is a .code project at the given path returns project path and true if found, otherwise false

func CmdsView

func CmdsView(pt *Commands)

CmdsView opens a view of a commands table

func CodeOpenNodes

func CodeOpenNodes(it any, sc *core.Scene) []string

CodeOpenNodes gets list of open nodes for submenu-func

func CommandMenu

func CommandMenu(fn *filetree.Node) func(mm *core.Scene)

CommandMenu returns a menu function for commands for given language and vcs name

func CommandName

func CommandName(cat, cmd string) string

CommandName returns a qualified command name as cat: cmd

func ConfigEditorTextEditor

func ConfigEditorTextEditor(ed *texteditor.Editor)

ConfigEditorTextEditor configures an editor texteditor

func ConfigOutputTextEditor

func ConfigOutputTextEditor(ed *texteditor.Editor)

ConfigOutputTextEditor configures a command-output texteditor within given parent layout

func DebugSettingsEditor

func DebugSettingsEditor(pf *cdebug.Params) *core.Form

DebugSettingsEditor opens a view of project Debug settings, returns form if not already open

func ExecCmds

func ExecCmds(cv *Code) [][]string

ExecCmds gets list of available commands for current active file

func LanguagesView

func LanguagesView(pt *Languages)

LanguagesView opens a view of a languages options map

func MarkupCmdOutput

func MarkupCmdOutput(out []byte, lexName string) []byte

MarkupCmdOutput applies links to the first element in command output line if it looks like a file name / position, and runs markup using given lexer name if provided (default is "bash")

func MarkupStdOutput added in v0.1.0

func MarkupStdOutput(out []byte) []byte

MarkupStdOutput applies links to the first element in command output line if it looks like a file name / position

func MarkupStderr

func MarkupStderr(out []byte) []byte

func MarkupStdout

func MarkupStdout(out []byte) []byte

func MergeAvailableCmds

func MergeAvailableCmds()

MergeAvailableCmds updates the AvailCmds list from CustomCmds and StdCmds

func NewDebugger

func NewDebugger(sup fileinfo.Known, path, rootPath string, outbuf *texteditor.Buffer, pars *cdebug.Params) (cdebug.GiDebug, error)

NewDebugger returns a new debugger for given supported file type

func OpenPaths

func OpenPaths()

OpenPaths loads the active SavedPaths from prefs dir

func ProjectPathParse

func ProjectPathParse(path string) (root, projnm, fnm string, ok bool)

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

func RegistersMenu(ctx core.Widget, curVal string, fun func(regNm string))

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

func RepoCurBranches(repo vcs.Repo) (string, []string, error)

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 SavePaths

func SavePaths()

SavePaths saves the active SavedPaths to prefs dir

func SelectSymbol

func SelectSymbol(cv *Code, ssym syms.Symbol)

func SetGoMod

func SetGoMod(gomod bool)

SetGoMod applies the given gomod setting, setting the GO111MODULE env var

func SplitsView

func SplitsView(pt *Splits)

SplitsView opens a view of a splits table

func TextLinkHandler

func TextLinkHandler(tl paint.TextLink) bool

TextLinkHandler is the Code handler for text links -- preferred one b/c directly connects to correct Code project

Types

type ArgVarInfo

type ArgVarInfo struct {

	// description of arg var
	Desc string

	// type of variable -- used for checking usage and other special features such as prompting
	Type ArgVarTypes
}

ArgVarInfo has info about argument variables that fill in relevant values for commands, used in ArgVars list of variables

type ArgVarTypes

type ArgVarTypes int32 //enums:enum -trim-prefix ArgVar

ArgVarTypes describe the type of information in the arg var -- used for checking usage and special features.

const (
	// ArgVarFile is a file name, not a directory
	ArgVarFile ArgVarTypes = iota

	// ArgVarDir is a directory name, not a file
	ArgVarDir

	// ArgVarExt is a file extension
	ArgVarExt

	// ArgVarPos is a text position
	ArgVarPos

	// ArgVarText is text from a buffer
	ArgVarText

	// ArgVarPrompt is a user-prompted variable
	ArgVarPrompt
)
const ArgVarTypesN ArgVarTypes = 6

ArgVarTypesN is the highest valid value for type ArgVarTypes, plus one.

func ArgVarTypesValues

func ArgVarTypesValues() []ArgVarTypes

ArgVarTypesValues returns all possible values for the type ArgVarTypes.

func (ArgVarTypes) Desc

func (i ArgVarTypes) Desc() string

Desc returns the description of the ArgVarTypes value.

func (ArgVarTypes) Int64

func (i ArgVarTypes) Int64() int64

Int64 returns the ArgVarTypes value as an int64.

func (ArgVarTypes) MarshalText

func (i ArgVarTypes) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*ArgVarTypes) SetInt64

func (i *ArgVarTypes) SetInt64(in int64)

SetInt64 sets the ArgVarTypes value from an int64.

func (*ArgVarTypes) SetString

func (i *ArgVarTypes) SetString(s string) error

SetString sets the ArgVarTypes value from its string representation, and returns an error if the string is invalid.

func (ArgVarTypes) String

func (i ArgVarTypes) String() string

String returns the string representation of this ArgVarTypes value.

func (*ArgVarTypes) UnmarshalText

func (i *ArgVarTypes) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (ArgVarTypes) Values

func (i ArgVarTypes) Values() []enums.Enum

Values returns all possible values for the type ArgVarTypes.

type ArgVarVals

type ArgVarVals map[string]string

ArgVarVals are current values of arg var vals -- updated on demand when a command is invoked

func (*ArgVarVals) Bind

func (avp *ArgVarVals) Bind(arg string) string

Bind replaces the variables in the given arg string with their values

func (*ArgVarVals) Set

func (avp *ArgVarVals) Set(fpath string, ppref *ProjectSettings, tv *texteditor.Editor)

Set sets the current values for arg variables -- prompts must be already set!

type CmdAndArgs

type CmdAndArgs struct {

	// external program to execute -- must be on path or have full path specified -- use {RunExec} for the project RunExec executable.
	Cmd string `width:"25"`

	// args to pass to the program, one string per arg.
	// Use {Filename} etc to refer to special variables.
	// Use backslash-quoted bracket to insert a literal curly bracket.
	// Use unix-standard path separators (/); they will be replaced with
	// proper os-specific path separator on Windows.
	Args CmdArgs `width:"25"`

	// default value for prompt string, for first use -- thereafter it uses last value provided for given command
	Default string `width:"25"`

	// if true, then do not split any prompted string into separate space-separated fields -- otherwise do so, except for values within quotes
	PromptIsString bool
}

CmdAndArgs contains the name of an external program to execute and args to pass to that program

func (*CmdAndArgs) BindArgs

func (cm *CmdAndArgs) BindArgs(avp *ArgVarVals) []string

BindArgs replaces any variables in the args with their values, and returns resulting args

func (*CmdAndArgs) HasPrompts

func (cm *CmdAndArgs) HasPrompts() (map[string]struct{}, bool)

HasPrompts returns true if any prompts are required before running command, and the set of such args

func (CmdAndArgs) Label

func (cm CmdAndArgs) Label() string

Label satisfies the Labeler interface

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 CmdArgs

type CmdArgs []string

CmdArgs is a slice of arguments for a command

type CmdButton

type CmdButton struct {
	core.Button
}

CmdButton represents a CmdName value with a button that opens a [CmdView].

func NewCmdButton

func NewCmdButton(parent ...tree.Node) *CmdButton

NewCmdButton returns a new CmdButton with the given optional parent: CmdButton represents a CmdName value with a button that opens a [CmdView].

func (*CmdButton) Init

func (cb *CmdButton) Init()

func (*CmdButton) WidgetValue

func (cb *CmdButton) WidgetValue() any

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

func (cn CmdName) Command() (*Command, bool)

Command returns command associated with command name in AvailCmds, and false if it doesn't exist

func (CmdName) IsValid

func (cn CmdName) IsValid() bool

IsValid checks if command name exists on AvailCmds list

func (CmdName) Value

func (cn CmdName) Value() core.Value

type CmdNames

type CmdNames []CmdName

CmdNames is a slice of command names

func (*CmdNames) Add

func (cn *CmdNames) Add(cmd CmdName)

Add adds a name to the list

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

func (*CmdRun) Kill

func (cm *CmdRun) Kill()

Kill kills the process

type CmdRuns

type CmdRuns []*CmdRun

CmdRuns is a slice list of running commands

func (*CmdRuns) Add

func (rc *CmdRuns) Add(cm *CmdRun)

Add adds a new running command

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) ByName

func (rc *CmdRuns) ByName(name string) (*CmdRun, int)

ByName returns command with given name

func (*CmdRuns) DeleteByName

func (rc *CmdRuns) DeleteByName(name string) bool

DeleteByName deletes command by name

func (*CmdRuns) DeleteIndex

func (rc *CmdRuns) DeleteIndex(idx int)

DeleteIndex delete command at given index

func (*CmdRuns) KillByName

func (rc *CmdRuns) KillByName(name string) bool

KillByName kills a running process by name, and removes it from the list of running commands

type Code

type Code struct {
	core.Frame

	// root directory for the project -- all projects must be organized within a top-level root directory, with all the files therein constituting the scope of the project -- by default it is the path for ProjectFilename
	ProjectRoot core.Filename

	// current project filename for saving / loading specific Code configuration information in a .code file (optional)
	ProjectFilename core.Filename `extension:".code"`

	// filename of the currently active texteditor
	ActiveFilename core.Filename `set:"-"`

	// language for current active filename
	ActiveLang fileinfo.Known

	// VCS repo for current active filename
	ActiveVCS vcs.Repo `set:"-"`

	// VCS info for current active filename (typically branch or revision) -- for status
	ActiveVCSInfo string `set:"-"`

	// has the root changed?  we receive update signals from root for changes
	Changed bool `set:"-" json:"-"`

	// the last status update message
	StatusMessage string

	// timestamp for when a file was last saved -- provides dirty state for various updates including rebuilding in debugger
	LastSaveTStamp time.Time `set:"-" json:"-"`

	// all the files in the project directory and subdirectories
	Files *filetree.Tree `set:"-" json:"-"`

	// index of the currently active texteditor -- new files will be viewed in other views if available
	ActiveTextEditorIndex int `set:"-" json:"-"`

	// list of open nodes, most recent first
	OpenNodes OpenNodes `json:"-"`

	// the command buffers for commands run in this project
	CmdBufs map[string]*texteditor.Buffer `set:"-" json:"-"`

	// history of commands executed in this session
	CmdHistory CmdNames `set:"-" json:"-"`

	// currently running commands in this project
	RunningCmds CmdRuns `set:"-" json:"-" xml:"-"`

	// current arg var vals
	ArgVals ArgVarVals `set:"-" json:"-" xml:"-"`

	// settings for this project -- this is what is saved in a .code project file
	Settings ProjectSettings `set:"-"`

	// current debug view
	CurDbg *DebugPanel `set:"-"`

	// first key in sequence if needs2 key pressed
	KeySeq1 key.Chord `set:"-"`

	// mutex for protecting overall updates to Code
	UpdateMu sync.Mutex `set:"-"`
}

Code is the core editor and tab viewer widget for the Code system. The default view has a tree browser of files on the left, editor panels in the middle, and a tabbed viewer on the right.

func CodeInScene

func CodeInScene(sc *core.Scene) *Code

func NewCode

func NewCode(parent ...tree.Node) *Code

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

func NewCodeProjectPath(path string) *Code

NewCodeProjectPath creates a new Code window with a new Code project for given path, returning the window and the path

func NewCodeWindow

func NewCodeWindow(path, projnm, root string, doPath bool) *Code

NewCodeWindow is common code for Open CodeWindow from Project or Path

func OpenCodeProject

func OpenCodeProject(projfile string) *Code

OpenCodeProject creates a new Code window opened to given Code project, returning the window and the path

func ParentCode

func ParentCode(tn tree.Node) (*Code, bool)

ParentCode returns the Code parent of given node

func (*Code) ActiveFileNode

func (cv *Code) ActiveFileNode() *filetree.Node

ActiveFileNode returns the file node for the active file -- nil if none

func (*Code) ActiveTextEditor

func (cv *Code) ActiveTextEditor() *TextEditor

ActiveTextEditor returns the currently active TextEditor

func (*Code) AddChooserFiles

func (cv *Code) AddChooserFiles(ac *core.Chooser)

AddChooserFiles adds the files to the app chooser.

func (*Code) AddChooserSymbols

func (cv *Code) AddChooserSymbols(ac *core.Chooser)

AddChooserSymbols adds the symbols to the app chooser.

func (*Code) AddCloseDialog

func (cv *Code) AddCloseDialog()

AddCloseDialog adds the close dialog that automatically saves the project and prompts the user to save open files when they try to close the scene containing this code view.

func (*Code) ApplySettings

func (cv *Code) ApplySettings()

ApplySettings applies current project preference settings into places where they are used -- only for those done prior to loading

func (*Code) ApplySettingsAction

func (cv *Code) ApplySettingsAction()

ApplySettingsAction applies current settings to the project, and updates the project

func (*Code) ApplySplitsSettings added in v0.1.0

func (cv *Code) ApplySplitsSettings(sv *core.Splits)

func (*Code) AutoSaveCheck

func (cv *Code) AutoSaveCheck(tv *TextEditor, vidx int, fn *filetree.Node) bool

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) CallFind

func (cv *Code) CallFind(ctx core.Widget)

func (*Code) CallSaveActiveViewAs

func (cv *Code) CallSaveActiveViewAs(ctx core.Widget)

func (*Code) CallSplitsSetView

func (cv *Code) CallSplitsSetView(ctx core.Widget)

func (*Code) CallViewFile

func (cv *Code) CallViewFile(ctx core.Widget)

CallViewFile calls ViewFile with ActiveFilename set as arg

func (*Code) ChooseRunExec

func (cv *Code) ChooseRunExec(exePath core.Filename)

ChooseRunExec selects the executable to run for the project

func (*Code) ClearDebug

func (cv *Code) ClearDebug()

ClearDebug clears the current debugger setting -- no more debugger active.

func (*Code) CloneActiveView

func (cv *Code) CloneActiveView() (*TextEditor, int)

CloneActiveView sets the next text view to view the same file currently being vieweds in the active view. returns text view and index

func (*Code) CloseActiveView

func (cv *Code) CloseActiveView()

CloseActiveView closes the buffer associated with active view

func (*Code) CloseOpenNodes

func (cv *Code) CloseOpenNodes(nodes []*FileNode)

CloseOpenNodes closes any nodes with open views (including those in directories under nodes). called prior to rename.

func (*Code) CommandFromMenu

func (cv *Code) CommandFromMenu(fn *filetree.Node)

CommandFromMenu pops up a menu of commands for given language, with given last command selected by default, and runs selected command.

func (*Code) CommentOut

func (cv *Code) CommentOut() bool

CommentOut comments-out selected lines in active text view and uncomments if already commented If multiple lines are selected and any line is uncommented all will be commented

func (*Code) Commit

func (cv *Code) Commit()

Commit commits the current changes using relevant VCS tool. Checks for VCS setting and for unsaved files.

func (*Code) CommitNoChecks

func (cv *Code) CommitNoChecks()

CommitNoChecks does the commit without any further checks for VCS, and unsaved files

func (*Code) ConfigActiveFilename

func (cv *Code) ConfigActiveFilename(fb *core.FuncButton) *core.FuncButton

ConfigActiveFilename configures the first arg of given FuncButton to use the ActiveFilename

func (*Code) ConfigFindButton

func (cv *Code) ConfigFindButton(fb *core.FuncButton) *core.FuncButton

ConfigFindButton configures the Find FuncButton with current params

func (*Code) ConfigTextBuffer

func (cv *Code) ConfigTextBuffer(tb *texteditor.Buffer)

ConfigTextBuffer configures the text buffer according to the settings.

func (*Code) CopyRect

func (cv *Code) CopyRect()

CopyRect copies rectangle in active text view

func (*Code) CountWords

func (cv *Code) CountWords() string

CountWords counts number of words (and lines) in active file returns a string report thereof.

func (*Code) CountWordsRegion

func (cv *Code) CountWordsRegion() string

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) CurPanel

func (cv *Code) CurPanel() int

CurPanel returns the splitter panel that currently has keyboard focus

func (*Code) CursorToHistNext

func (cv *Code) CursorToHistNext() bool

CursorToHistNext moves forward to the next history item.

func (*Code) CursorToHistPrev

func (cv *Code) CursorToHistPrev() bool

CursorToHistPrev moves back to the previous history item.

func (*Code) CutRect

func (cv *Code) CutRect()

CutRect cuts rectangle in active text view

func (*Code) Debug

func (cv *Code) Debug()

Debug starts the debugger on the RunExec executable.

func (*Code) DebugAttach

func (cv *Code) DebugAttach(pid uint64)

DebugAttach runs the debugger by attaching to an already-running process. pid is the process id to attach to.

func (*Code) DebugTest

func (cv *Code) DebugTest(testName string)

DebugTest runs the debugger using testing mode in current active texteditor path. testName specifies which test(s) to run according to the standard go test -run specification.

func (*Code) Defaults

func (cv *Code) Defaults()

Defaults sets new project defaults based on overall settings

func (*Code) DiffFileNode

func (cv *Code) DiffFileNode(fna *filetree.Node, fnmB core.Filename)

DiffFileNode shows the differences between given file node as the A file, and another given file as the B file, in side-by-side DiffEditor and in the console as a context diff.

func (*Code) DiffFiles

func (cv *Code) DiffFiles(fnmA, fnmB core.Filename)

DiffFiles shows the differences between two given files in side-by-side DiffEditor and in the console as a context diff. It opens the files as file nodes and uses existing contents if open already.

func (*Code) EditProjectSettings

func (cv *Code) EditProjectSettings()

EditProjectSettings allows editing of project settings (settings specific to this project)

func (*Code) EditRecentPaths

func (cv *Code) EditRecentPaths()

EditRecentPaths opens a dialog editor for editing the recent project paths list

func (*Code) ExecCmd

func (cv *Code) ExecCmd()

ExecCmd pops up a menu to select a command appropriate for the current active text view, and shows output in Tab with name of command

func (*Code) ExecCmdFileNode

func (cv *Code) ExecCmdFileNode(fn *filetree.Node)

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

func (cv *Code) ExecCmdName(cmdName CmdName)

ExecCmdName executes command of given name; this is the final common pathway for all command invocation except on a node.

func (*Code) ExecCmdNameActive

func (cv *Code) ExecCmdNameActive(cmdName string)

ExecCmdNameActive calls given command on current active texteditor

func (*Code) ExecCmdNameFileNode

func (cv *Code) ExecCmdNameFileNode(fn *filetree.Node, cmdNm CmdName)

ExecCmdNameFileNode executes command of given name on given node

func (*Code) ExecCmdNameFilename

func (cv *Code) ExecCmdNameFilename(fn string, cmdNm CmdName)

ExecCmdNameFilename executes command of given name on given file name

func (*Code) ExecCmds

func (cv *Code) ExecCmds(cmdNms CmdNames)

ExecCmds executes a sequence of commands.

func (*Code) ExecCmdsFileNode

func (cv *Code) ExecCmdsFileNode(fn *filetree.Node, cmdNames CmdNames)

ExecCmdsFileNode executes a sequence of commands on file node

func (*Code) FileNodeForFile

func (cv *Code) FileNodeForFile(fpath string, add bool) *filetree.Node

FileNodeForFile returns file node for given file path add: if not found in existing tree and external files, then if add is true, it is added to the ExtFiles list.

func (*Code) FileNodeOpened

func (cv *Code) FileNodeOpened(fn *filetree.Node)

FileNodeOpened is called whenever file node is double-clicked in file tree

func (*Code) FileNodeRunExe

func (cv *Code) FileNodeRunExe(fn *filetree.Node)

FileNodeRunExe runs the given executable file node

func (*Code) FileNodeSelected

func (cv *Code) FileNodeSelected(fn *filetree.Node)

FileNodeSelected is called whenever tree browser has file node selected

func (*Code) Find

func (cv *Code) Find(find string, repl string, ignoreCase bool, regExp bool, loc filetree.FindLocation, langs []fileinfo.Known)

Find does Find / Replace in files, using given options and filters -- opens up a main tab with the results and further controls.

func (*Code) FocusActiveTextEditor

func (cv *Code) FocusActiveTextEditor() *TextEditor

FocusActiveTextEditor sets focus to active text editor

func (*Code) FocusNextPanel

func (cv *Code) FocusNextPanel()

FocusNextPanel moves the keyboard focus to the next panel to the right

func (*Code) FocusOnPanel

func (cv *Code) FocusOnPanel(panel int) bool

FocusOnPanel moves keyboard focus to given panel -- returns false if nothing at that tab

func (*Code) FocusOnTabs

func (cv *Code) FocusOnTabs() bool

func (*Code) FocusPrevPanel

func (cv *Code) FocusPrevPanel()

FocusPrevPanel moves the keyboard focus to the previous panel to the left

func (*Code) GrabSettings

func (cv *Code) GrabSettings()

GrabSettings grabs the current project preference settings from various places, e.g., prior to saving or editing.

func (*Code) GuessMainLang

func (cv *Code) GuessMainLang() bool

GuessMainLang guesses the main language in the project -- returns true if successful

func (*Code) HelpWiki

func (cv *Code) HelpWiki()

HelpWiki opens wiki page for code on github

func (*Code) Indent

func (cv *Code) Indent() bool

Indent indents selected lines in active view

func (*Code) Init

func (cv *Code) Init()

func (*Code) IsEmpty

func (cv *Code) IsEmpty() bool

func (*Code) JoinParaLines

func (cv *Code) JoinParaLines()

JoinParaLines merges sequences of lines with hard returns forming paragraphs, separated by blank lines, into a single line per paragraph, for given selected region (full text if no selection)

func (*Code) LangDefaults

func (cv *Code) LangDefaults()

LangDefaults applies default language settings based on MainLang

func (*Code) LinkViewFile

func (cv *Code) LinkViewFile(fnm core.Filename) (*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

func (*Code) LinkViewFileNode

func (cv *Code) LinkViewFileNode(fn *filetree.Node) (*TextEditor, int)

LinkViewFileNode opens the file node in the 2nd texteditor, which is next to the tabs where links are clicked, if it is not collapsed -- else 1st

func (*Code) LookupFun

func (cv *Code) LookupFun(data any, txt string, posLine, posChar int) (ld complete.Lookup)

LookupFun is the completion system Lookup function that makes a custom texteditor dialog that has option to edit resulting file.

func (*Code) MakeToolbar

func (cv *Code) MakeToolbar(p *tree.Plan)

func (*Code) NChangedFiles

func (cv *Code) NChangedFiles() int

NChangedFiles returns number of opened files with unsaved changes

func (*Code) NewFile

func (cv *Code) NewFile(filename string, addToVcs bool)

NewFile creates a new file in the project

func (*Code) NewProject

func (cv *Code) NewProject(path core.Filename, folder string, mainLang fileinfo.Known, VersionControl filetree.VersionControlName) *Code

NewProject creates a new project at given path, making a new folder in that path -- all Code projects are essentially defined by a path to a folder containing files. If the folder already exists, then use OpenPath. Can also specify main language and version control type

func (*Code) NextTextEditor

func (cv *Code) NextTextEditor() (*TextEditor, int)

NextTextEditor returns the next text view available for viewing a file and its index -- if the active text view is empty, then it is used, otherwise it is the next one (if visible)

func (*Code) NextViewFile

func (cv *Code) NextViewFile(fnm core.Filename) (*TextEditor, int, bool)

NextViewFile sets the next text view to view given file name -- include as much of name as possible to disambiguate -- will use the first matching -- if already being viewed, that is activated -- returns texteditor and its index, false if not found

func (*Code) NextViewFileNode

func (cv *Code) NextViewFileNode(fn *filetree.Node) (*TextEditor, int)

NextViewFileNode sets the next text view to view file in given node (opens buffer if not already opened) -- if already being viewed, that is activated, returns text view and index

func (*Code) OpenConsoleTab

func (cv *Code) OpenConsoleTab()

OpenConsoleTab opens a main tab displaying console output (stdout, stderr)

func (*Code) OpenFile

func (cv *Code) OpenFile(fnm string)

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 (cv *Code) OpenFileAtRegion(filename core.Filename, tr text.Region) (tv *TextEditor, ok bool)

func (*Code) OpenFileNode

func (cv *Code) OpenFileNode(fn *filetree.Node) (bool, error)

OpenFileNode opens file for file node -- returns new bool and error

func (*Code) OpenFileURL

func (cv *Code) OpenFileURL(ur string, ftv *texteditor.Editor) bool

OpenFileURL opens given file:/// url

func (*Code) OpenFindURL

func (cv *Code) OpenFindURL(ur string, ftv *texteditor.Editor) bool

OpenFindURL opens given find:/// url from Find; delegates to FindPanel

func (*Code) OpenNodeForTextEditor

func (cv *Code) OpenNodeForTextEditor(tv *TextEditor) (*filetree.Node, int, bool)

OpenNodeForTextEditor finds the FileNode that a given TextEditor is viewing, returning its index within OpenNodes list, or false if not found

func (*Code) OpenPath

func (cv *Code) OpenPath(path core.Filename) *Code

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

func (cv *Code) OpenProject(filename core.Filename) *Code

OpenProject opens .code project file and its settings from given filename, in a standard toml-formatted file

func (*Code) OpenRecent

func (cv *Code) OpenRecent(filename core.Filename)

OpenRecent opens a recently used file

func (*Code) OverflowMenu

func (cv *Code) OverflowMenu(m *core.Scene)

func (*Code) PanelIsOpen

func (cv *Code) PanelIsOpen(panel int) bool

PanelIsOpen returns true if the given panel has not been collapsed and is avail and visible for displaying something

func (*Code) ParseOpenFindURL

func (cv *Code) ParseOpenFindURL(ur string, ftv *texteditor.Editor) (tv *TextEditor, reg text.Region, findBufStLn, findCount int, ok bool)

ParseOpenFindURL parses and opens given find:/// url from Find, return text region encoded in url, and starting line of results in find buffer, and number of results returned -- for parsing all the find results

func (*Code) PasteRect

func (cv *Code) PasteRect()

PasteRect cuts rectangle in active text view

func (*Code) ReCase

func (cv *Code) ReCase(c strcase.Cases) string

ReCase replaces currently selected text in current active view with given case

func (*Code) RecycleCmdBuf

func (cv *Code) RecycleCmdBuf(cmdName string) (*texteditor.Buffer, bool)

RecycleCmdBuf creates the buffer for command output, or returns existing. Returns true if new buffer created.

func (*Code) RecycleCmdTab

func (cv *Code) RecycleCmdTab(cmdName string) (*texteditor.Buffer, *texteditor.Editor, bool)

RecycleCmdTab creates the tab to show command output, including making a buffer object to save output from the command. Returns true if a new buffer was created, false if one already existed.

func (*Code) RecycleTabTextEditor

func (cv *Code) RecycleTabTextEditor(name string, buf *texteditor.Buffer) *texteditor.Editor

RecycleTabTextEditor returns a text editor in a tab with the given name, first by looking for an existing one, and if not found, making a new one with a text editor in it.

func (*Code) RegisterCopy

func (cv *Code) RegisterCopy(regNm RegisterName)

RegisterCopy saves current selection in active text view to register of given name returns true if saved.

func (*Code) RegisterPaste

func (cv *Code) RegisterPaste(ctx core.Widget)

RegisterPaste prompts user for available registers, and pastes selected one into active text view

func (*Code) ReplaceInActive

func (cv *Code) ReplaceInActive()

ReplaceInActive does query-replace in active file only

func (*Code) RevertActiveView

func (cv *Code) RevertActiveView()

RevertActiveView revert active view to saved version

func (*Code) Run

func (cv *Code) Run()

Run runs the RunCmds set for this project

func (*Code) RunBuild

func (cv *Code) RunBuild()

RunBuild runs the BuildCmds set for this project

func (*Code) RunPostCmdsActiveView

func (cv *Code) RunPostCmdsActiveView() bool

RunPostCmdsActiveView runs any registered post commands on the active view -- returns true if commands were run and file was reverted after that -- uses MainLang to disambiguate if multiple languages associated with extension.

func (*Code) RunPostCmdsFileNode

func (cv *Code) RunPostCmdsFileNode(fn *filetree.Node) bool

RunPostCmdsFileNode runs any registered post commands on the given file node -- returns true if commands were run and file was reverted after that -- uses MainLang to disambiguate if multiple languages associated with extension.

func (*Code) SaveActiveView

func (cv *Code) SaveActiveView()

SaveActiveView saves the contents of the currently active texteditor

func (*Code) SaveActiveViewAs

func (cv *Code) SaveActiveViewAs(filename core.Filename)

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

func (cv *Code) SaveAllCheck(cancelOpt bool, fun func()) bool

SaveAllCheck -- check if any files have not been saved, and prompt to save them returns true if there were unsaved files, false otherwise. cancelOpt presents an option to cancel current command, in which case function is not called. if function is passed, then it is called in all cases except if the user selects cancel.

func (*Code) SaveAllOpenNodes

func (cv *Code) SaveAllOpenNodes()

SaveAllOpenNodes saves all of the open filenodes to their current file names

func (*Code) SaveProject

func (cv *Code) SaveProject()

SaveProject saves project file containing custom project settings, in a standard toml-formatted file

func (*Code) SaveProjectAs

func (cv *Code) SaveProjectAs(filename core.Filename) bool

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

func (cv *Code) SaveProjectIfExists(saveAllFiles bool) bool

SaveProjectIfExists saves project file containing custom project settings, in a standard toml-formatted file, only if it already exists -- returns true if saved saveAllFiles indicates if user should be prompted for saving all files

func (*Code) SelectOpenNode

func (cv *Code) SelectOpenNode()

SelectOpenNode pops up a menu to select an open node (aka buffer) to view in current active texteditor

func (*Code) SelectTabByName

func (cv *Code) SelectTabByName(name string) core.Widget

SelectTabByName Selects given main tab, and returns all of its contents as well.

func (*Code) SelectedFileNode

func (cv *Code) SelectedFileNode() *filetree.Node

SelectedFileNode returns currently selected file tree node as a *filetree.Node could be nil.

func (*Code) SetActiveFileInfo

func (cv *Code) SetActiveFileInfo(buf *texteditor.Buffer)

SetActiveFileInfo sets the active file info from text

func (*Code) SetActiveLang

func (t *Code) SetActiveLang(v fileinfo.Known) *Code

SetActiveLang sets the [Code.ActiveLang]: language for current active filename

func (*Code) SetActiveTextEditor

func (cv *Code) SetActiveTextEditor(av *TextEditor) int

SetActiveTextEditor sets the given texteditor as the active one, and returns its index

func (*Code) SetActiveTextEditorIndex

func (cv *Code) SetActiveTextEditorIndex(idx int) *TextEditor

SetActiveTextEditorIndex sets the given view index as the currently active TextEditor -- returns that texteditor. This is the main method for activating a text editor.

func (*Code) SetArgVarVals

func (cv *Code) SetArgVarVals()

SetArgVarVals sets the ArgVar values for commands, from Code values

func (*Code) SetOpenNodes

func (t *Code) SetOpenNodes(v OpenNodes) *Code

SetOpenNodes sets the [Code.OpenNodes]: list of open nodes, most recent first

func (*Code) SetProjectFilename

func (t *Code) SetProjectFilename(v core.Filename) *Code

SetProjectFilename sets the [Code.ProjectFilename]: current project filename for saving / loading specific Code configuration information in a .code file (optional)

func (*Code) SetProjectRoot

func (t *Code) SetProjectRoot(v core.Filename) *Code

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

func (cv *Code) SetStatus(msg string)

SetStatus sets the current status update message for the StatusBar next time it renders

func (*Code) SetStatusMessage

func (t *Code) SetStatusMessage(v string) *Code

SetStatusMessage sets the [Code.StatusMessage]: the last status update message

func (*Code) SetWindowNameTitle

func (cv *Code) SetWindowNameTitle()

SetWindowNameTitle sets the window name and title based on current project name

func (*Code) ShowFile

func (cv *Code) ShowFile(fname string, ln int) (*TextEditor, error)

ShowFile shows given file name at given line, returning TextEditor showing it or error if not found.

func (*Code) SpacesToTabs

func (cv *Code) SpacesToTabs()

SpacesToTabs converts spaces to tabs for given selected region (full text if no selection)

func (*Code) Spell

func (cv *Code) Spell()

Spell checks spelling in active text view

func (*Code) Splits

func (cv *Code) Splits() *core.Splits

Splits returns the main Splits

func (*Code) SplitsEdit

func (cv *Code) SplitsEdit()

SplitsEdit opens the SplitsView editor to customize saved splitter settings

func (*Code) SplitsSave

func (cv *Code) SplitsSave(split SplitName)

SplitsSave saves current splitter settings to named splitter settings under existing name, and saves to prefs file

func (*Code) SplitsSaveAs

func (cv *Code) SplitsSaveAs(name, desc string)

SplitsSaveAs saves current splitter settings to new named splitter settings, and saves to prefs file

func (*Code) SplitsSetView

func (cv *Code) SplitsSetView(split SplitName)

SplitsSetView sets split view splitters to given named setting

func (*Code) StatusBar

func (cv *Code) StatusBar() *core.Frame

StatusBar returns the statusbar widget

func (*Code) StatusText

func (cv *Code) StatusText() *core.Text

StatusText returns the status bar text widget

func (*Code) SwapTextEditors

func (cv *Code) SwapTextEditors() bool

SwapTextEditors switches the buffers for the two open texteditors only operates if both panels are open

func (*Code) Symbols

func (cv *Code) Symbols()

Symbols displays the Symbols of a file or package

func (*Code) TabByName

func (cv *Code) TabByName(name string) core.Widget

TabByName returns a tab with given name, nil if not found.

func (*Code) TabDeleted

func (cv *Code) TabDeleted(tabnm string)

TabDeleted is called when a main tab is deleted -- we cancel any running commands

func (*Code) Tabs

func (cv *Code) Tabs() *core.Tabs

Tabs returns the main TabView

func (*Code) TabsToSpaces

func (cv *Code) TabsToSpaces()

TabsToSpaces converts tabs to spaces for given selected region (full text if no selection)

func (*Code) TextBufForFile

func (cv *Code) TextBufForFile(fpath string, add bool) *texteditor.Buffer

TextBufForFile returns TextBuf for given file path. add: if not found in existing tree and external files, then if add is true, it is added to the ExtFiles list.

func (*Code) TextEditorButtonByIndex

func (cv *Code) TextEditorButtonByIndex(idx int) *core.Button

TextEditorButtonByIndex returns the top texteditor menu button by index (0 or 1)

func (*Code) TextEditorButtonMenu

func (cv *Code) TextEditorButtonMenu(idx int, m *core.Scene)

func (*Code) TextEditorByIndex

func (cv *Code) TextEditorByIndex(idx int) *TextEditor

TextEditorByIndex returns the TextEditor by index (0 or 1), nil if not found

func (*Code) TextEditorForFile

func (cv *Code) TextEditorForFile(fnm core.Filename) (*TextEditor, int, bool)

TextEditorForFile finds FileNode for file, and returns TextEditor and index that is viewing that FileNode, or false if none is

func (*Code) TextEditorForFileNode

func (cv *Code) TextEditorForFileNode(fn *filetree.Node) (*TextEditor, int, bool)

TextEditorForFileNode finds a TextEditor that is viewing given FileNode, and its index, or false if none is

func (*Code) TextEditorIndex

func (cv *Code) TextEditorIndex(av *TextEditor) int

TextEditorIndex finds index of given texteditor (0 or 1)

func (*Code) UpdateFiles

func (cv *Code) UpdateFiles()

UpdateFiles updates the list of files saved in project

func (*Code) UpdateStatusText

func (cv *Code) UpdateStatusText()

UpdateStatusText updates the status bar text with current data.

func (*Code) UpdateTextButtons

func (cv *Code) UpdateTextButtons()

UpdateTextButtons updates texteditor menu buttons is called by SetStatus. Doesn't do anything unless a change is required, so safe to call frequently.

func (*Code) VCSLog

func (cv *Code) VCSLog() (vcs.Log, error)

VCSLog shows the VCS log of commits in this project, in an interactive browser from which any revisions can be compared and diffs browsed.

func (*Code) VCSUpdateAll

func (cv *Code) VCSUpdateAll()

VCSUpdateAll does an Update (e.g., Pull) on all VCS repositories within the open tree nodes in FileTree.

func (*Code) VersionControl

func (cv *Code) VersionControl() filetree.VersionControlName

VersionControl returns the version control system in effect, using the file tree detected version or whatever is set in project settings

func (*Code) ViewFile

func (cv *Code) ViewFile(fnm core.Filename) (*TextEditor, int, bool)

ViewFile views file in an existing TextEditor if it is already viewing that file, otherwise opens ViewFileNode in active buffer

func (*Code) ViewFileInIndex

func (cv *Code) ViewFileInIndex(fnm core.Filename, idx int) (*TextEditor, int, bool)

ViewFileInIndex views file in given text view index

func (*Code) ViewFileNode

func (cv *Code) ViewFileNode(tv *TextEditor, vidx int, fn *filetree.Node)

ViewFileNode sets the given text view to view file in given node (opens buffer if not already opened). This is the main method for viewing a file.

func (*Code) ViewOpenNodeName

func (cv *Code) ViewOpenNodeName(name string)

ViewOpenNodeName views given open node (by name) in active view

type Command

type Command struct {

	// category for the command -- commands are organized in to hierarchical menus according to category
	Cat string

	// name of this command (must be unique in list of commands)
	Name string `width:"20"`

	// brief description of this command
	Desc string `width:"40"`

	// supported language / file type that this command applies to -- choose Any or e.g., AnyCode for subtypes -- filters the list of commands shown based on file language type
	Lang fileinfo.Known

	// sequence of commands to run for this overall command.
	Cmds []CmdAndArgs `table-select:"-"`

	// if specified, will change to this directory before executing the command;
	// e.g., use {FileDirPath} for current file's directory. Only use directory
	// values here; if not specified, directory will be project root directory.
	Dir string `width:"20"`

	// if true, we wait for the command to run before displaying output -- mainly for post-save commands and those with subsequent steps: if multiple commands are present, then it uses Wait mode regardless.
	Wait bool

	// if true, keyboard focus is directed to the command output tab panel after the command runs.
	Focus bool

	// if true, command requires Ok / Cancel confirmation dialog -- only needed for non-prompt commands
	Confirm bool

	//	what type of file to use for syntax highlighting.  Bash is the default.
	Hilight fileinfo.Known
}

Command defines different types of commands that can be run in the project. The output of the commands shows up in an associated tab.

func (*Command) AppendCmdOut

func (cm *Command) AppendCmdOut(cv *Code, buf *texteditor.Buffer, out []byte)

AppendCmdOut appends command output to buffer, applying markup for links

func (*Command) HasPrompts

func (cm *Command) HasPrompts() (map[string]struct{}, bool)

HasPrompts returns true if any prompts are required before running command, and the set of such args

func (Command) Label

func (cm Command) Label() string

Label satisfies the Labeler interface

func (*Command) LangMatch

func (cm *Command) LangMatch(lang fileinfo.Known) bool

LangMatch returns true if the given language matches the command Lang constraints

func (*Command) MarkupCmdOutput

func (cm *Command) MarkupCmdOutput(out []byte) []byte

func (*Command) PromptUser

func (cm *Command) PromptUser(cv *Code, buf *texteditor.Buffer, pvals map[string]struct{})

PromptUser prompts for values that need prompting for, and then runs RunAfterPrompts if not otherwise cancelled by user

func (*Command) Run

func (cm *Command) Run(cv *Code, buf *texteditor.Buffer)

Run runs the command and saves the output in the Buf if it is non-nil, which can be displayed -- if !wait, then Buf is updated online as output occurs. Status is updated with status of command exec. User is prompted for any values that might be needed for command.

func (*Command) RunAfterPrompts

func (cm *Command) RunAfterPrompts(cv *Code, buf *texteditor.Buffer)

RunAfterPrompts runs after any prompts have been set, if needed

func (*Command) RunBuf

func (cm *Command) RunBuf(cv *Code, buf *texteditor.Buffer, cma *CmdAndArgs) bool

RunBuf runs a command with output to the buffer, incrementally updating the buffer with new results line-by-line as they come in

func (*Command) RunBufWait

func (cm *Command) RunBufWait(cv *Code, buf *texteditor.Buffer, cma *CmdAndArgs) bool

RunBufWait runs a command with output to the buffer, using CombinedOutput so it waits for completion -- returns overall command success, and logs one line of the command output to code statusbar

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

func (*Command) RunStatus

func (cm *Command) RunStatus(cv *Code, buf *texteditor.Buffer, cmdstr string, err error, out []byte) bool

RunStatus reports the status of the command run (given in cmdstr) to ge.StatusBar -- returns true if there are no errors, and false if there were errors

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

func (cm *Commands) CmdByName(name CmdName, msg bool) (*Command, int, bool)

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) CopyFrom

func (cm *Commands) CopyFrom(cp Commands)

CopyFrom copies commands from given other map

func (*Commands) FilterCmdNames

func (cm *Commands) FilterCmdNames(lang fileinfo.Known, vcnm filetree.VersionControlName) [][]string

FilterCmdNames returns a slice of commands organized by category that are compatible with given language and version control system.

func (*Commands) Open

func (cm *Commands) Open(filename core.Filename) error

Open opens commands from a toml-formatted file.

func (*Commands) OpenSettings

func (cm *Commands) OpenSettings() error

OpenSettings opens custom Commands from the app settings directory, using CommandSettingsFilename.

func (*Commands) Save

func (cm *Commands) Save(filename core.Filename) error

Save saves commands to a toml-formatted file.

func (*Commands) SaveSettings

func (cm *Commands) SaveSettings() error

SaveSettings saves custom Commands to the app settings directory, using CommandSettingsFilename.

func (*Commands) ViewStandard

func (cm *Commands) ViewStandard()

ViewStandard shows the standard types that are compiled into the program and have all the lastest standards. Useful for comparing against custom lists.

type Console

type Console struct {

	// std out writer -- set to os.Stdout
	StdoutWrite *os.File `json:"-" xml:"-"`

	// std out reader -- used to read os.Stdout
	StdoutRead *os.File `json:"-" xml:"-"`

	// std err writer -- set to os.Stderr
	StderrWrite *os.File `json:"-" xml:"-"`

	// std err reader -- used to read os.Stderr
	StderrRead *os.File `json:"-" xml:"-"`

	// text buffer holding all output
	Buffer *texteditor.Buffer `json:"-" xml:"-"`

	// set to true to cancel monitoring
	Cancel bool `json:"-" xml:"-"`

	// mutex protecting updating of buffer between out / err
	Mu sync.Mutex `json:"-" xml:"-"`

	// original os.Stdout writer
	OrgoutWrite *os.File `json:"-" xml:"-"`

	// original os.Stderr writer
	OrgerrWrite *os.File `json:"-" xml:"-"`

	// log file writer
	LogWrite *os.File `json:"-" xml:"-"`
}

Console redirects our os.Stdout and os.Stderr to a buffer for display within app

var TheConsole Console

func (*Console) Close

func (cn *Console) Close()

Close closes all the files -- call on exit

func (*Console) Init

func (cn *Console) Init(logFile string)

Init initializes the console -- sets up the capture, Buf, and starts the routine that monitors output. if logFile is non-empty, writes output to that file as well.

func (*Console) MonitorErr

func (cn *Console) MonitorErr()

MonitorErr monitors std error and appends it to the buffer should be in a separate routine

func (*Console) MonitorOut

func (cn *Console) MonitorOut()

MonitorOut monitors std output and appends it to the buffer should be in a separate routine

type DebugBreakStatus

type DebugBreakStatus int32 //enums:enum -trim-prefix Debug

DebugBreakStatus represents the status of a certain breakpoint.

const (
	// DebugBreakInactive is an inactive break point
	DebugBreakInactive DebugBreakStatus = iota

	// DebugBreakActive is an active break point
	DebugBreakActive

	// DebugBreakCurrent is the current break point
	DebugBreakCurrent

	// DebugPCCurrent is the current program execution point,
	// updated for every ShowFile action
	DebugPCCurrent
)
const DebugBreakStatusN DebugBreakStatus = 4

DebugBreakStatusN is the highest valid value for type DebugBreakStatus, plus one.

func DebugBreakStatusValues

func DebugBreakStatusValues() []DebugBreakStatus

DebugBreakStatusValues returns all possible values for the type DebugBreakStatus.

func (DebugBreakStatus) Desc

func (i DebugBreakStatus) Desc() string

Desc returns the description of the DebugBreakStatus value.

func (DebugBreakStatus) Int64

func (i DebugBreakStatus) Int64() int64

Int64 returns the DebugBreakStatus value as an int64.

func (DebugBreakStatus) MarshalText

func (i DebugBreakStatus) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*DebugBreakStatus) SetInt64

func (i *DebugBreakStatus) SetInt64(in int64)

SetInt64 sets the DebugBreakStatus value from an int64.

func (*DebugBreakStatus) SetString

func (i *DebugBreakStatus) SetString(s string) error

SetString sets the DebugBreakStatus value from its string representation, and returns an error if the string is invalid.

func (DebugBreakStatus) String

func (i DebugBreakStatus) String() string

String returns the string representation of this DebugBreakStatus value.

func (*DebugBreakStatus) UnmarshalText

func (i *DebugBreakStatus) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (DebugBreakStatus) Values

func (i DebugBreakStatus) Values() []enums.Enum

Values returns all possible values for the type DebugBreakStatus.

type DebugPanel

type DebugPanel struct {
	core.Frame

	// known file type to determine debugger
	Known fileinfo.Known

	// path to executable / dir to debug
	ExePath string

	// time when dbg was last restarted
	DbgTime time.Time

	// the debugger
	Dbg cdebug.GiDebug `set:"-" json:"-" xml:"-"`

	// all relevant debug state info
	State cdebug.AllState `set:"-" json:"-" xml:"-"`

	// current ShowFile location -- cleared before next one or run
	CurFileLoc cdebug.Location `set:"-" json:"-" xml:"-"`

	// backup breakpoints list -- to track deletes
	BBreaks []*cdebug.Break `set:"-" json:"-" xml:"-"`

	// output from the debugger
	OutputBuffer *texteditor.Buffer `set:"-" json:"-" xml:"-"`

	// parent code project
	Code *Code `set:"-" json:"-" xml:"-"`
}

DebugPanel is the debugger panel.

func NewDebugPanel

func NewDebugPanel(parent ...tree.Node) *DebugPanel

NewDebugPanel returns a new DebugPanel with the given optional parent: DebugPanel is the debugger panel.

func (*DebugPanel) AddBreak

func (dv *DebugPanel) AddBreak(fpath string, line int)

AddBreak adds a breakpoint at given file path and line number. note: all breakpoints are just set in our master list and uploaded to the system right before starting running.

func (*DebugPanel) BackupBreaks

func (dv *DebugPanel) BackupBreaks()

BackupBreaks makes a backup copy of current breaks

func (*DebugPanel) Config

func (dv *DebugPanel) Config(cv *Code, known fileinfo.Known, exePath string)

Config sets parameters that must be set for a new view

func (*DebugPanel) ConsoleText

func (dv *DebugPanel) ConsoleText() *texteditor.Editor

ConsoleText returns the console TextEditor

func (*DebugPanel) Continue

func (dv *DebugPanel) Continue()

Continue continues running from current point -- this MUST be called in a separate goroutine!

func (*DebugPanel) DbgCanStep

func (dv *DebugPanel) DbgCanStep() bool

DbgCanStep means the debugger is started AND process is not currently running, AND it is not already waiting for a next step

func (*DebugPanel) DbgIsActive

func (dv *DebugPanel) DbgIsActive() bool

DbgIsActive means debugger is started.

func (*DebugPanel) DbgIsAvail

func (dv *DebugPanel) DbgIsAvail() bool

DbgIsAvail means the debugger is started AND process is not currently running -- it is available for command input.

func (*DebugPanel) DeleteAllBreaks

func (dv *DebugPanel) DeleteAllBreaks()

DeleteAllBreaks deletes all breakpoints

func (*DebugPanel) DeleteBreak

func (dv *DebugPanel) DeleteBreak(fpath string, line int)

DeleteBreak deletes given breakpoint. If debugger is not yet activated then it just deletes from master list. Note that breakpoints can be turned on and off directly using On flag.

func (*DebugPanel) DeleteBreakImpl

func (dv *DebugPanel) DeleteBreakImpl(fpath string, line int)

DeleteBreakImpl deletes given breakpoint with no other updates

func (*DebugPanel) DeleteBreakInBuf

func (dv *DebugPanel) DeleteBreakInBuf(fpath string, line int)

DeleteBreakInBuf delete breakpoint in its TextBuf line is 1-based line number

func (*DebugPanel) DeleteBreakIndex

func (dv *DebugPanel) DeleteBreakIndex(bidx int)

DeleteBreakIndex deletes break at given index in list of breaks

func (*DebugPanel) DeleteCurPCInBuf

func (dv *DebugPanel) DeleteCurPCInBuf()

DeleteCurPCInBuf deletes the current PC location in given file line is 1-based line number

func (*DebugPanel) Destroy

func (dv *DebugPanel) Destroy()

func (*DebugPanel) Detach

func (dv *DebugPanel) Detach()

Detach from debugger

func (*DebugPanel) FindFrames

func (dv *DebugPanel) FindFrames(fpath string, line int)

FindFrames finds the frames where given file and line are active Selects the one that is closest and shows the others in Find Tab

func (*DebugPanel) Init

func (dv *DebugPanel) Init()

func (*DebugPanel) InitState

func (dv *DebugPanel) InitState(ds *cdebug.State)

InitState updates the State and View from given debug state Call this when debugger returns from any action update

func (*DebugPanel) InitTabs

func (dv *DebugPanel) InitTabs()

func (*DebugPanel) ListGlobalVars

func (dv *DebugPanel) ListGlobalVars(filter string)

ListGlobalVars lists global vars matching the given optional filter.

func (*DebugPanel) MakeToolbar

func (dv *DebugPanel) MakeToolbar(p *tree.Plan)

func (*DebugPanel) SetBreaks

func (dv *DebugPanel) SetBreaks()

SetBreaks sets the current breakpoints from State, call this prior to running

func (*DebugPanel) SetCurPCInBuf

func (dv *DebugPanel) SetCurPCInBuf(fpath string, line int)

SetCurPCInBuf sets the current PC location in given file line is 1-based line number

func (*DebugPanel) SetDbgTime

func (t *DebugPanel) SetDbgTime(v time.Time) *DebugPanel

SetDbgTime sets the [DebugPanel.DbgTime]: time when dbg was last restarted

func (*DebugPanel) SetExePath

func (t *DebugPanel) SetExePath(v string) *DebugPanel

SetExePath sets the [DebugPanel.ExePath]: path to executable / dir to debug

func (*DebugPanel) SetFrame

func (dv *DebugPanel) SetFrame(depth int)

SetFrame sets the given frame depth level as active

func (*DebugPanel) SetStatus

func (dv *DebugPanel) SetStatus(stat cdebug.Status)

func (*DebugPanel) SetSup

func (t *DebugPanel) SetSup(v fileinfo.Known) *DebugPanel

SetSup sets the [DebugPanel.Known]: supported file type to determine debugger

func (*DebugPanel) SetThread

func (dv *DebugPanel) SetThread(threadID int)

SetThread sets the given thread as active -- this must be TaskID if HasTasks and ThreadID if not.

func (*DebugPanel) SetThreadIndex

func (dv *DebugPanel) SetThreadIndex(thridx int)

SetThreadIndex sets the given thread by index in threads list as active this must be TaskID if HasTasks and ThreadID if not.

func (*DebugPanel) ShowBreakFile

func (dv *DebugPanel) ShowBreakFile(bidx int)

ShowBreakFile shows the file for given break index

func (*DebugPanel) ShowFile

func (dv *DebugPanel) ShowFile(fpath string, line int)

ShowFile shows the file name in code

func (*DebugPanel) ShowTab

func (dv *DebugPanel) ShowTab(tab string)

ShowTab shows given tab

func (*DebugPanel) ShowVar

func (dv *DebugPanel) ShowVar(name string) error

ShowVar shows info on a given variable within the current frame scope in a text view dialog

func (*DebugPanel) SingleStep

func (dv *DebugPanel) SingleStep()

StepSingle steps a single CPU instruction.

func (*DebugPanel) Start

func (dv *DebugPanel) Start()

Start starts the debuger

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) Stop

func (dv *DebugPanel) Stop()

Stop stops a running process.

func (*DebugPanel) SyncBreaks

func (dv *DebugPanel) SyncBreaks()

SyncBreaks synchronizes backup breaks with current breaks, after Breaks Changed

func (*DebugPanel) Tabs

func (dv *DebugPanel) Tabs() *core.Tabs

Tabs returns the tabs

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

type FileNode struct {
	filetree.Node
}

FileNode is Code version of FileNode for FileTree

func NewFileNode

func NewFileNode(parent ...tree.Node) *FileNode

NewFileNode returns a new FileNode with the given optional parent: FileNode is Code version of FileNode for FileTree

func (*FileNode) ContextMenu

func (fn *FileNode) ContextMenu(m *core.Scene)

func (*FileNode) EditFile

func (fn *FileNode) EditFile()

EditFile pulls up this file in Code

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

func (fn *FileNode) ExecCmdNameFile(cmdNm string)

ExecCmdNameFile executes given command name on node

func (*FileNode) Init

func (fn *FileNode) Init()

func (*FileNode) RenameFiles

func (fn *FileNode) RenameFiles()

RenameFiles calls RenameFile on any selected nodes

func (*FileNode) SetRunExec

func (fn *FileNode) SetRunExec()

SetRunExec sets executable as the RunExec executable that will be run with Run / Debug buttons

func (*FileNode) SetRunExecs

func (fn *FileNode) SetRunExecs()

SetRunExecs sets executable as the RunExec executable that will be run with Run / Debug buttons

type FileSettings

type FileSettings struct {

	// if true, then all directories are placed at the top of the tree -- otherwise everything is alpha sorted
	DirsOnTop bool
}

FileSettings contains file picker settings

func (*FileSettings) Defaults

func (se *FileSettings) Defaults()

Defaults are the defaults for FileSettings

type FindPanel

type FindPanel struct {
	core.Frame

	// parent code project
	Code *Code `json:"-" xml:"-"`

	// time of last find
	Time time.Time

	// compiled regexp
	Re *regexp.Regexp
}

FindPanel is a find / replace widget that displays results in a TextEditor and has a toolbar for controlling find / replace process.

func NewFindPanel

func NewFindPanel(parent ...tree.Node) *FindPanel

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

func (fv *FindPanel) CheckValidRegexp() bool

CheckValidRegexp returns false if using regexp and it is not valid

func (*FindPanel) CompileRegexp

func (fv *FindPanel) CompileRegexp() bool

CompileRegexp compiles the regexp if necessary -- returns false if it is invalid

func (*FindPanel) FindAction

func (fv *FindPanel) FindAction()

FindAction runs a new find with current params

func (*FindPanel) HighlightFinds

func (fv *FindPanel) HighlightFinds(tv, ftv *texteditor.Editor, fbStLn, fCount int, find string)

HighlightFinds highlights all the find results in ftv buffer

func (*FindPanel) Init

func (fv *FindPanel) Init()

func (*FindPanel) NextFind

func (fv *FindPanel) NextFind()

NextFind shows next find result

func (*FindPanel) OnAdd

func (fv *FindPanel) OnAdd()

func (*FindPanel) OpenFindURL

func (fv *FindPanel) OpenFindURL(ur string, ftv *texteditor.Editor) bool

OpenFindURL opens given find:/// url from Find

func (*FindPanel) Params

func (fv *FindPanel) Params() *FindParams

Params returns the find params

func (*FindPanel) PrevFind

func (fv *FindPanel) PrevFind()

PrevFind shows previous find result

func (*FindPanel) ReplaceAction

func (fv *FindPanel) ReplaceAction() bool

ReplaceAction performs the replace -- if using regexp mode, regexp must be compiled in advance

func (*FindPanel) ReplaceAll

func (fv *FindPanel) ReplaceAll()

ReplaceAll performs replace all

func (*FindPanel) ReplaceAllAction

func (fv *FindPanel) ReplaceAllAction()

ReplaceAllAction performs replace all, prompting before proceeding

func (*FindPanel) SetCode

func (t *FindPanel) SetCode(v *Code) *FindPanel

SetCode sets the [FindPanel.Code]: parent code project

func (*FindPanel) SetRe

func (t *FindPanel) SetRe(v *regexp.Regexp) *FindPanel

SetRe sets the [FindPanel.Re]: compiled regexp

func (*FindPanel) SetTime

func (t *FindPanel) SetTime(v time.Time) *FindPanel

SetTime sets the [FindPanel.Time]: time of last find

func (*FindPanel) ShowResults

func (fv *FindPanel) ShowResults(res []filetree.SearchResults)

ShowResults shows the results in the buffer

func (*FindPanel) TextEditor

func (fv *FindPanel) TextEditor() *texteditor.Editor

TextEditorLay returns the find results TextEditor

type FindParams

type FindParams struct {

	// find string
	Find string

	// replace string
	Replace string

	// ignore case
	IgnoreCase bool

	// use regexp regular expression search and replace
	Regexp bool

	// locations to search in
	Loc filetree.FindLocation

	// languages for files to search
	Languages []fileinfo.Known

	// history of finds
	FindHist []string

	// history of replaces
	ReplHist []string
}

FindParams are parameters for find / replace

type LanguageOptions

type LanguageOptions struct {

	// command(s) to run after a file of this type is saved
	PostSaveCmds CmdNames
}

LanguageOptions defines options associated with a given language / file format only languages in fileinfo.Known list are supported..

type Languages

type Languages map[fileinfo.Known]*LanguageOptions

Languages is a map of language options

var AvailableLanguages Languages

AvailableLanguages is the current set of language options -- can be loaded / saved / edited with settings. This is set to StandardLanguages at startup.

func (*Languages) CopyFrom

func (lt *Languages) CopyFrom(cp Languages)

CopyFrom copies languages from given other map

func (*Languages) Open

func (lt *Languages) Open(filename core.Filename) error

Open opens languages from a toml-formatted file.

func (*Languages) OpenSettings

func (lt *Languages) OpenSettings() error

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) Save

func (lt *Languages) Save(filename core.Filename) error

Save saves languages to a toml-formatted file.

func (*Languages) SaveSettings

func (lt *Languages) SaveSettings() error

SaveSettings saves the Langs to the app settings directory, using LanguageSettingsFilename.

func (Languages) Validate

func (lt Languages) Validate() bool

Validate checks to make sure post save command names exist, issuing warnings to log for those that don't

func (*Languages) ViewStandard

func (lt *Languages) ViewStandard()

ViewStandard shows the standard languages that are compiled into the program and have all the lastest standards. Useful for comparing against custom lists.

type OpenNodes

type OpenNodes []*filetree.Node

OpenNodes is a list of file nodes that have been opened for editing -- it is maintained in recency order -- most recent on top -- call Add every time a node is opened / visited for editing

func (*OpenNodes) Add

func (on *OpenNodes) Add(fn *filetree.Node) bool

Add adds given node to list of open nodes -- if already on the list it is moved to the top -- returns true if actually added. Connects to fn.TextBuf signal and auto-closes when buffer closes.

func (*OpenNodes) AddImpl

func (on *OpenNodes) AddImpl(fn *filetree.Node) bool

AddImpl adds given node to list of open nodes -- if already on the list it is moved to the top -- returns true if actually added.

func (*OpenNodes) ByStringName

func (on *OpenNodes) ByStringName(name string) *filetree.Node

ByStringName returns the open node with given strings name

func (*OpenNodes) Delete

func (on *OpenNodes) Delete(fn *filetree.Node) bool

Delete deletes given node in list of open nodes, returning true if found and deleted

func (*OpenNodes) DeleteDeleted

func (on *OpenNodes) DeleteDeleted()

DeleteDeleted deletes deleted nodes on list

func (*OpenNodes) DeleteIndex

func (on *OpenNodes) DeleteIndex(idx int)

DeleteIndex deletes at given index

func (*OpenNodes) FindPath

func (on *OpenNodes) FindPath(path string) *filetree.Node

FindPath finds node for given path, nil if not found

func (*OpenNodes) NChanged

func (on *OpenNodes) NChanged() int

NChanged returns number of changed open files

func (*OpenNodes) Strings

func (on *OpenNodes) Strings() []string

Strings returns a string list of nodes, with paths relative to proj root

type ProjectSettings

type ProjectSettings struct {

	// file picker settings
	Files FileSettings

	// editor settings
	Editor core.EditorSettings `display:"inline"`

	// current named-split config in use for configuring the splitters
	SplitName SplitName

	// the language associated with the most frequently encountered file
	// extension in the file tree -- can be manually set here as well
	MainLang fileinfo.Known

	// the type of version control system used in this project (git, svn, etc).
	// filters commands available
	VersionControl filetree.VersionControlName

	// current project filename for saving / loading specific Code
	// configuration information in a .code file (optional)
	ProjectFilename core.Filename `extension:".code"`

	// root directory for the project. all projects must be organized within
	// a top-level root directory, with all the files therein constituting
	// the scope of the project. By default it is the path for ProjectFilename
	ProjectRoot core.Filename

	// if true, use Go modules, otherwise use GOPATH -- this sets your effective GO111MODULE environment variable accordingly, dynamically -- updated by toolbar checkbox, dynamically
	GoMod bool

	// command(s) to run for main Build button
	BuildCmds CmdNames

	// build directory for main Build button -- set this to the directory where you want to build the main target for this project -- avail as {BuildDir} in commands
	BuildDir core.Filename

	// build target for main Build button, if relevant for your  BuildCmds
	BuildTarg core.Filename

	// executable to run for this project via main Run button -- called by standard Run Project command
	RunExec core.Filename

	// command(s) to run for main Run button (typically Run Project)
	RunCmds CmdNames

	// custom debugger parameters for this project
	Debug cdebug.Params

	// saved find params
	Find FindParams `display:"-"`

	// saved structure params
	Symbols SymbolsParams `display:"-"`

	// directory properties
	Dirs filetree.DirFlagMap `display:"-"`

	// last register used
	Register RegisterName `display:"-"`

	// current splitter splits
	Splits [4]float32 `display:"-"`

	// current tabUnder setting for splits
	TabsUnder bool `display:"-"`
}

ProjectSettings are the settings for saving for a project. This IS the project file

func (*ProjectSettings) Open

func (se *ProjectSettings) Open(filename core.Filename) error

Open open from file

func (*ProjectSettings) RunExecIsExec

func (se *ProjectSettings) RunExecIsExec() bool

RunExecIsExec returns true if the RunExec is actually executable

func (*ProjectSettings) Save

func (se *ProjectSettings) Save(filename core.Filename) error

Save save to file

func (*ProjectSettings) Update

func (se *ProjectSettings) Update()

type RegisterName

type RegisterName string

RegisterName has an associated ValueView for selecting from the list of available named registers

func (RegisterName) Value

func (rn RegisterName) Value() core.Value

Value registers core.Chooser as the core.Value widget for RegisterName

type Registers

type Registers map[string]string //types:add

Registers is a list of named strings

var AvailableRegisters Registers

AvailableRegisters are available named registers. can be loaded / saved / edited with settings.

func (*Registers) Names

func (lt *Registers) Names() []string

Names returns a slice of current register names

func (*Registers) Open

func (lt *Registers) Open(filename core.Filename) error

Open opens named registers from a toml-formatted file.

func (*Registers) OpenSettings

func (lt *Registers) OpenSettings() error

OpenSettings opens the Registers from the app settings directory, using RegisterSettingsFilename.

func (*Registers) Save

func (lt *Registers) Save(filename core.Filename) error

Save saves named registers to a toml-formatted file.

func (*Registers) SaveSettings

func (lt *Registers) SaveSettings() error

SaveSettings saves the Registers to the app settings directory, using RegisterSettingsFilename.

type SettingsData

type SettingsData struct {
	core.SettingsBase

	// file picker settings
	Files FileSettings

	// environment variables to set for this app -- if run from the command line, standard shell environment variables are inherited, but on some OS's (Mac), they are not set when run as a gui app
	EnvVars map[string]string

	// if set, the current customized set of language options (see Edit Lang Opts) is saved / loaded along with other settings -- if not set, then you always are using the default compiled-in standard set (which will be updated)
	SaveLangOpts bool

	// if set, the current customized set of command parameters (see Edit Cmds) is saved / loaded along with other settings -- if not set, then you always are using the default compiled-in standard set (which will be updated)
	SaveCmds bool
}

SettingsData is the data type for the overall user settings for Code.

func (*SettingsData) Apply

func (se *SettingsData) Apply()

Apply settings updates things according with settings

func (*SettingsData) ApplyEnvVars

func (se *SettingsData) ApplyEnvVars()

ApplyEnvVars applies environment variables set in EnvVars

func (*SettingsData) Defaults

func (se *SettingsData) Defaults()

Defaults are the defaults for Settings

func (*SettingsData) EditCmds

func (se *SettingsData) EditCmds()

EditCmds opens the CmdsView editor to customize commands you can run.

func (*SettingsData) EditLangOpts

func (se *SettingsData) EditLangOpts()

EditLangOpts opens the LangsView editor to customize options for each type of language / data / file type.

func (*SettingsData) EditRegisters

func (se *SettingsData) EditRegisters()

EditRegisters opens the RegistersView editor to customize saved registers

func (*SettingsData) EditSplits

func (se *SettingsData) EditSplits()

EditSplits opens the SplitsView editor to customize saved splitter settings

func (*SettingsData) MakeToolbar

func (se *SettingsData) MakeToolbar(p *tree.Plan)

func (*SettingsData) Open

func (se *SettingsData) Open() error

func (*SettingsData) Save

func (se *SettingsData) Save() error

type SpellPanel

type SpellPanel struct {
	core.Frame

	// parent code project
	Code *Code `json:"-" xml:"-" copier:"-"`

	// texteditor that we're spell-checking
	Text *TextEditor `json:"-" xml:"-" copier:"-"`

	// current spelling errors
	Errs lexer.Line

	// current line in text we're on
	CurLn int

	// current index in Errs we're on
	CurIndex int

	// current unknown lex token
	UnkLex lexer.Lex

	// current unknown word
	UnkWord string

	// a list of suggestions from spell checker
	Suggest []string

	// last user action (ignore, change, learn)
	LastAction *core.Button
}

SpellPanel is a widget that displays results of a spell check.

func NewSpellPanel

func NewSpellPanel(parent ...tree.Node) *SpellPanel

NewSpellPanel returns a new SpellPanel with the given optional parent: SpellPanel is a widget that displays results of a spell check.

func (*SpellPanel) AcceptSuggestion

func (sv *SpellPanel) AcceptSuggestion(s string)

AcceptSuggestion replaces the misspelled word with the word in the ChangeText field

func (*SpellPanel) Change

func (sv *SpellPanel) Change()

func (*SpellPanel) ChangeBar

func (sv *SpellPanel) ChangeBar() *core.Toolbar

ChangeBar returns the suggest toolbar

func (*SpellPanel) ChangeText

func (sv *SpellPanel) ChangeText() *core.TextField

ChangeText returns the unknown word textfield from toolbar

func (*SpellPanel) CheckNext

func (sv *SpellPanel) CheckNext()

CheckNext will find the next misspelled/unknown word and get suggestions for replacing it

func (*SpellPanel) Config

func (sv *SpellPanel) Config(cv *Code, atv *TextEditor)

func (*SpellPanel) Destroy

func (sv *SpellPanel) Destroy()

func (*SpellPanel) Init

func (sv *SpellPanel) Init()

func (*SpellPanel) SetCode

func (t *SpellPanel) SetCode(v *Code) *SpellPanel

SetCode sets the [SpellPanel.Code]: parent code project

func (*SpellPanel) SetCurIndex

func (t *SpellPanel) SetCurIndex(v int) *SpellPanel

SetCurIndex sets the [SpellPanel.CurIndex]: current index in Errs we're on

func (*SpellPanel) SetCurLn

func (t *SpellPanel) SetCurLn(v int) *SpellPanel

SetCurLn sets the [SpellPanel.CurLn]: current line in text we're on

func (*SpellPanel) SetErrs

func (t *SpellPanel) SetErrs(v lexer.Line) *SpellPanel

SetErrs sets the [SpellPanel.Errs]: current spelling errors

func (*SpellPanel) SetLastAction

func (t *SpellPanel) SetLastAction(v *core.Button) *SpellPanel

SetLastAction sets the [SpellPanel.LastAction]: last user action (ignore, change, learn)

func (*SpellPanel) SetSuggest

func (t *SpellPanel) SetSuggest(v ...string) *SpellPanel

SetSuggest sets the [SpellPanel.Suggest]: a list of suggestions from spell checker

func (*SpellPanel) SetText

func (t *SpellPanel) SetText(v *TextEditor) *SpellPanel

SetText sets the [SpellPanel.Text]: texteditor that we're spell-checking

func (*SpellPanel) SetUnkLex

func (t *SpellPanel) SetUnkLex(v lexer.Lex) *SpellPanel

SetUnkLex sets the [SpellPanel.UnkLex]: current unknown lex token

func (*SpellPanel) SetUnkWord

func (t *SpellPanel) SetUnkWord(v string) *SpellPanel

SetUnkWord sets the [SpellPanel.UnkWord]: current unknown word

func (*SpellPanel) SpellBar

func (sv *SpellPanel) SpellBar() *core.Toolbar

SpellBar returns the spell toolbar

func (*SpellPanel) SuggestView

func (sv *SpellPanel) SuggestView() *core.List

SuggestView returns the view for the list of suggestions

func (*SpellPanel) UnkEndPos

func (sv *SpellPanel) UnkEndPos() lexer.Pos

UnkEndPos returns the end position of the current unknown word

func (*SpellPanel) UnkStartPos

func (sv *SpellPanel) UnkStartPos() lexer.Pos

UnkStartPos returns the start position of the current unknown word

func (*SpellPanel) UnknownBar

func (sv *SpellPanel) UnknownBar() *core.Toolbar

UnknownBar returns the toolbar that displays the unknown word

func (*SpellPanel) UnknownText

func (sv *SpellPanel) UnknownText() *core.TextField

UnknownText returns the unknown word textfield from toolbar

type Split

type Split struct {

	// name of splitter config
	Name string

	// brief description
	Desc string

	// splitter panel proportions
	Splits [4]float32 `min:"0" max:"1" step:".05"`

	// TabsUnder sets the tabs under the editors, making a more compact layout,
	// suitable for laptop and smaller displays.
	TabsUnder bool
}

Split is a named splitter configuration

func (Split) Label

func (sp Split) Label() string

Label satisfies the Labeler interface

func (*Split) SaveSplits

func (lt *Split) SaveSplits(sp []float32)

SaveSplits saves given splits to this setting -- must use copy!

type SplitName

type SplitName string

SplitName has an associated ValueView for selecting from the list of available named splits

func (SplitName) Value

func (sn SplitName) Value() core.Value

Value registers core.Chooser as the core.Value widget for SplitName

type Splits

type Splits []*Split //types:add

Splits is a list of named splitter configurations

var AvailableSplits Splits

AvailableSplits are available named splitter settings. can be loaded / saved / edited with settings. This is set to StandardSplits at startup.

func (*Splits) Add

func (lt *Splits) Add(name, desc string, splits []float32, tabsUnder bool) (*Split, int)

Add adds a new splitter setting, returns split and index

func (*Splits) CopyFrom

func (lt *Splits) CopyFrom(cp Splits)

CopyFrom copies named splits from given other map

func (*Splits) Names

func (lt *Splits) Names() []string

Names returns a slice of current names

func (*Splits) Open

func (lt *Splits) Open(filename core.Filename) error

Open opens named splits from a json-formatted file.

func (*Splits) OpenSettings

func (lt *Splits) OpenSettings() error

OpenSettings opens Splits from App standard prefs directory, using PrefSplitsFilename

func (*Splits) Save

func (lt *Splits) Save(filename core.Filename) error

Save saves named splits to a json-formatted file.

func (*Splits) SaveSettings

func (lt *Splits) SaveSettings() error

SaveSettings saves Splits to App standard prefs directory, using PrefSplitsFilename

func (*Splits) SplitByName

func (lt *Splits) SplitByName(name SplitName) (*Split, int, bool)

SplitByName returns a named split and index by name -- returns false and emits a message to stdout if not found

type SymNode

type SymNode struct {
	tree.NodeBase

	// the symbol
	Symbol syms.Symbol
}

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

func NewSymNode(parent ...tree.Node) *SymNode

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

func (*SymNode) GetIcon

func (sy *SymNode) GetIcon() icons.Icon

GetIcon returns the appropriate Icon for this symbol type

func (*SymNode) OpenSyms

func (sn *SymNode) OpenSyms(pkg *syms.Symbol, fname, match string)

OpenSyms opens symbols from given symbol map (assumed to be package-level symbols) filtered by filename and match -- called on root node of tree.

func (*SymNode) SetSymbol

func (t *SymNode) SetSymbol(v syms.Symbol) *SymNode

SetSymbol sets the [SymNode.Symbol]: the symbol

type SymScopes

type SymScopes int32 //enums:enum -trim-prefix SymScope

SymScopes corresponds to the search scope

const (
	// SymScopePackage scopes list of symbols to the package of the active file
	SymScopePackage SymScopes = iota

	// SymScopeFile restricts the list of symbols to the active file
	SymScopeFile
)
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) Desc

func (i SymScopes) Desc() string

Desc returns the description of the SymScopes value.

func (SymScopes) Int64

func (i SymScopes) Int64() int64

Int64 returns the SymScopes value as an int64.

func (SymScopes) MarshalText

func (i SymScopes) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*SymScopes) SetInt64

func (i *SymScopes) SetInt64(in int64)

SetInt64 sets the SymScopes value from an int64.

func (*SymScopes) SetString

func (i *SymScopes) SetString(s string) error

SetString sets the SymScopes value from its string representation, and returns an error if the string is invalid.

func (SymScopes) String

func (i SymScopes) String() string

String returns the string representation of this SymScopes value.

func (*SymScopes) UnmarshalText

func (i *SymScopes) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (SymScopes) Values

func (i SymScopes) Values() []enums.Enum

Values returns all possible values for the type SymScopes.

type SymTree

type SymTree struct {
	core.Tree
}

SymTree is a Tree that knows how to operate on FileNode nodes

func NewSymTree

func NewSymTree(parent ...tree.Node) *SymTree

NewSymTree returns a new SymTree with the given optional parent: SymTree is a Tree that knows how to operate on FileNode nodes

func (*SymTree) Init

func (st *SymTree) Init()

func (*SymTree) SymNode

func (st *SymTree) SymNode() *SymNode

SymNode returns the SrcNode as a *code* SymNode

type SymbolsPanel

type SymbolsPanel struct {
	core.Frame

	// parent code project
	Code *Code `json:"-" xml:"-"`

	// params for structure display
	SymParams SymbolsParams

	// all the symbols for the file or package in a tree
	Syms *SymNode

	// only show symbols that match this string
	Match string
}

SymbolsPanel is a widget that displays results of a file or package parse of symbols.

func NewSymbolsPanel

func NewSymbolsPanel(parent ...tree.Node) *SymbolsPanel

NewSymbolsPanel returns a new SymbolsPanel with the given optional parent: SymbolsPanel is a widget that displays results of a file or package parse of symbols.

func (*SymbolsPanel) Config

func (sv *SymbolsPanel) Config(cv *Code, sp SymbolsParams)

func (*SymbolsPanel) FrameWidget

func (sv *SymbolsPanel) FrameWidget() *core.Frame

FrameWidget returns the frame widget.

func (*SymbolsPanel) Init

func (sv *SymbolsPanel) Init()

func (*SymbolsPanel) OpenFile

func (sv *SymbolsPanel) OpenFile()

OpenFile opens file-level symbols for current active texteditor

func (*SymbolsPanel) OpenPackage

func (sv *SymbolsPanel) OpenPackage()

OpenPackage opens package-level symbols for current active texteditor

func (*SymbolsPanel) Params

func (sv *SymbolsPanel) Params() *SymbolsParams

Params returns the symbols params

func (*SymbolsPanel) RefreshAction

func (sv *SymbolsPanel) RefreshAction()

RefreshAction loads symbols for current file and scope

func (*SymbolsPanel) ScopeChooser

func (sv *SymbolsPanel) ScopeChooser() *core.Chooser

ScopeChooser returns the scope Chooser

func (*SymbolsPanel) SearchText

func (sv *SymbolsPanel) SearchText() *core.TextField

SearchText returns the unknown word textfield from toolbar

func (*SymbolsPanel) SetCode

func (t *SymbolsPanel) SetCode(v *Code) *SymbolsPanel

SetCode sets the [SymbolsPanel.Code]: parent code project

func (*SymbolsPanel) SetMatch

func (t *SymbolsPanel) SetMatch(v string) *SymbolsPanel

SetMatch sets the [SymbolsPanel.Match]: only show symbols that match this string

func (*SymbolsPanel) SetSymParams

func (t *SymbolsPanel) SetSymParams(v SymbolsParams) *SymbolsPanel

SetSymParams sets the [SymbolsPanel.SymParams]: params for structure display

func (*SymbolsPanel) SetSyms

func (t *SymbolsPanel) SetSyms(v *SymNode) *SymbolsPanel

SetSyms sets the [SymbolsPanel.Syms]: all the symbols for the file or package in a tree

func (*SymbolsPanel) Toolbar

func (sv *SymbolsPanel) Toolbar() *core.Toolbar

Toolbar returns the symbols toolbar

func (*SymbolsPanel) UpdateSymbols

func (sv *SymbolsPanel) UpdateSymbols()

type SymbolsParams

type SymbolsParams struct {

	// scope of symbols to list
	Scope SymScopes
}

SymbolsParams are parameters for structure view of file or package

type TextEditor

type TextEditor struct {
	texteditor.Editor

	Code *Code
}

TextEditor is the Code-specific version of the TextEditor, with support for setting / clearing breakpoints, etc

func NewTextEditor

func NewTextEditor(parent ...tree.Node) *TextEditor

NewTextEditor returns a new TextEditor with the given optional parent: TextEditor is the Code-specific version of the TextEditor, with support for setting / clearing breakpoints, etc

func (*TextEditor) ClearBreakpoint

func (ed *TextEditor) ClearBreakpoint(ln int)

func (*TextEditor) ContextMenu

func (ed *TextEditor) ContextMenu(m *core.Scene)

ContextMenu builds the text editor context menu

func (*TextEditor) CurDebug

func (ed *TextEditor) CurDebug() (*DebugPanel, bool)

CurDebug returns the current debugger, true if it is present

func (*TextEditor) DebugVarValueAtPos

func (ed *TextEditor) DebugVarValueAtPos(pos image.Point) string

DebugVarValueAtPos returns debugger variable value for given mouse position

func (*TextEditor) FindFrames

func (ed *TextEditor) FindFrames(ln int)

FindFrames finds stack frames in the debugger containing this file and line

func (*TextEditor) HandleDebugDoubleClick

func (ed *TextEditor) HandleDebugDoubleClick(e events.Event, tpos lexer.Pos)

DoubleClickEvent processes double-clicks NOT on the line-number section

func (*TextEditor) HasBreakpoint

func (ed *TextEditor) HasBreakpoint(ln int) bool

HasBreakpoint checks if line has a breakpoint

func (*TextEditor) Init

func (ed *TextEditor) Init()

func (*TextEditor) LineNumberDoubleClick

func (ed *TextEditor) LineNumberDoubleClick(tpos lexer.Pos)

LineNumberDoubleClick processes double-clicks on the line-number section

func (*TextEditor) SetBreakpoint

func (ed *TextEditor) SetBreakpoint(ln int)

SetBreakpoint sets breakpoint at given line (e.g., tv.CursorPos.Ln)

func (*TextEditor) SetCode

func (t *TextEditor) SetCode(v *Code) *TextEditor

SetCode sets the [TextEditor.Code]

func (*TextEditor) ToggleBreakpoint

func (ed *TextEditor) ToggleBreakpoint(ln int)

func (*TextEditor) WidgetTooltip

func (ed *TextEditor) WidgetTooltip(pos image.Point) (string, image.Point)

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

func NewVarView(parent ...tree.Node) *VarView

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) Form

func (vv *VarView) Form() *core.Form

Form returns the main Form

func (*VarView) Init

func (vv *VarView) Init()

func (*VarView) MakeToolbar

func (vv *VarView) MakeToolbar(p *tree.Plan)

func (*VarView) SetDbgView

func (t *VarView) SetDbgView(v *DebugPanel) *VarView

SetDbgView sets the [VarView.DbgView]: parent DebugPanel

func (*VarView) SetVar

func (vv *VarView) SetVar(vr *cdebug.Variable, frinfo string)

SetVar sets the source variable and ensures configuration

func (*VarView) Splits

func (vv *VarView) Splits() *core.Splits

Splits returns the main Splits

func (*VarView) Tree

func (vv *VarView) Tree() *core.Tree

Tree returns the main Tree

Directories

Path Synopsis
cmd
pie
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL