code

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: BSD-3-Clause Imports: 56 Imported by: 0

Documentation

Overview

Package code provides all the code infrastructure and supporting gui for filetree, commands, console, and 2-sequence key functions, settings, splitviews, etc.

CodeView is in a separate codev directory so that other packages can tap into the code infrastructure, and be callable directly from the CodeView editor, without creating circular import problems.

Index

Constants

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

Use these for more obvious command options

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 AvailableKeyMapsChanged = false

AvailableKeyMapsChanged is used to update views.KeyMapsView toolbars via following menu, toolbar properties update methods -- not accurate if editing any other map but works for now..

View Source
var AvailableLangsChanged = false

AvailableLangsChanged is used to update views.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..

View Source
var BreakViewType = types.AddType(&types.Type{Name: "cogentcore.org/cogent/code/code.BreakView", IDName: "break-view", Doc: "BreakView is a view of the breakpoints", Embeds: []types.Field{{Name: "Layout"}}, Instance: &BreakView{}})

BreakViewType is the types.Type for BreakView

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 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 views.CmdsView toolbars via following menu, toolbar properties update methods.

View Source
var DebugBreakColors = [DebugBreakStatusN]string{"pink", "red", "orange", "lightblue"}

DebugBreakColors are the colors indicating different breakpoint statuses

View Source
var DebugStatusColors = map[cdebug.Status]color.RGBA{
	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,
}
View Source
var DebugViewType = types.AddType(&types.Type{Name: "cogentcore.org/cogent/code/code.DebugView", IDName: "debug-view", Doc: "DebugView is the debugger", Embeds: []types.Field{{Name: "Layout"}}, Fields: []types.Field{{Name: "Sup", Doc: "supported file type to determine debugger"}, {Name: "ExePath", Doc: "path to executable / dir to debug"}, {Name: "DbgTime", Doc: "time when dbg was last restarted"}, {Name: "Dbg", Doc: "the debugger"}, {Name: "State", Doc: "all relevant debug state info"}, {Name: "CurFileLoc", Doc: "current ShowFile location -- cleared before next one or run"}, {Name: "BBreaks", Doc: "backup breakpoints list -- to track deletes"}, {Name: "OutputBuffer", Doc: "output from the debugger"}, {Name: "Code", Doc: "parent code project"}}, Instance: &DebugView{}})

DebugViewType is the types.Type for DebugView

View Source
var Debuggers = map[fileinfo.Known]func(path, rootPath string, outbuf *texteditor.Buffer, pars *cdebug.Params) (cdebug.GiDebug, error){
	fileinfo.Go: func(path, rootPath string, outbuf *texteditor.Buffer, pars *cdebug.Params) (cdebug.GiDebug, error) {
		return cdelve.NewGiDelve(path, rootPath, outbuf, pars)
	},
}

Debuggers is the list of supported debuggers

View Source
var DefaultKeyMap = KeyMapName("MacEmacs")

DefaultKeyMap is the overall default keymap -- reinitialized in gimain init() depending on platform

View Source
var FileNodeType = types.AddType(&types.Type{Name: "cogentcore.org/cogent/code/code.FileNode", IDName: "file-node", Doc: "FileNode is Code version of FileNode for FileTree view", Methods: []types.Method{{Name: "ExecCmdFile", Doc: "ExecCmdFile pops up a menu to select a command appropriate for the given node,\nand shows output in MainTab with name of command", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "EditFiles", Doc: "EditFiles calls EditFile on selected files", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}, {Name: "SetRunExecs", Doc: "SetRunExecs sets executable as the RunExec executable that will be run with Run / Debug buttons", Directives: []types.Directive{{Tool: "types", Directive: "add"}}}}, Embeds: []types.Field{{Name: "Node"}}, Instance: &FileNode{}})

FileNodeType is the types.Type for FileNode

View Source
var FindViewType = types.AddType(&types.Type{Name: "cogentcore.org/cogent/code/code.FindView", IDName: "find-view", Doc: "FindView is a find / replace widget that displays results in a TextEditor\nand has a toolbar for controlling find / replace process.", Embeds: []types.Field{{Name: "Layout"}}, Fields: []types.Field{{Name: "Code", Doc: "parent code project"}, {Name: "LangVV", Doc: "langs value view"}, {Name: "Time", Doc: "time of last find"}, {Name: "Re", Doc: "compiled regexp"}}, Instance: &FindView{}})

FindViewType is the types.Type for FindView

View Source
var Icons embed.FS
View Source
var KeyMapSettingsFilename = "key-map-settings.json"

KeyMapSettingsFilename is the name of the settings file in the app settings directory for saving / loading the default AvailableKeyMaps key maps list

View Source
var LangSettingsFilename = "lang-settings.toml"

LangSettingsFilename is the name of the settings file in the app settings directory for saving / loading the default AvailableLangs languages list

View Source
var Needs2KeyMap keymap.Map

Needs2KeyMap is a map of the starting key sequences that require a second key -- auto-generated from active keymap

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 SpellViewType = types.AddType(&types.Type{Name: "cogentcore.org/cogent/code/code.SpellView", IDName: "spell-view", Doc: "SpellView is a widget that displays results of spell check", Embeds: []types.Field{{Name: "Layout"}}, Fields: []types.Field{{Name: "Code", Doc: "parent code project"}, {Name: "Text", Doc: "texteditor that we're spell-checking"}, {Name: "Errs", Doc: "current spelling errors"}, {Name: "CurLn", Doc: "current line in text we're on"}, {Name: "CurIndex", Doc: "current index in Errs we're on"}, {Name: "UnkLex", Doc: "current unknown lex token"}, {Name: "UnkWord", Doc: "current unknown word"}, {Name: "Suggest", Doc: "a list of suggestions from spell checker"}, {Name: "LastAction", Doc: "last user action (ignore, change, learn)"}}, Instance: &SpellView{}})

SpellViewType is the types.Type for SpellView

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 StackViewType = types.AddType(&types.Type{Name: "cogentcore.org/cogent/code/code.StackView", IDName: "stack-view", Doc: "StackView is a view of the stack trace", Embeds: []types.Field{{Name: "Layout"}}, Fields: []types.Field{{Name: "FindFrames", Doc: "if true, this is a find frames, not a regular stack"}}, Instance: &StackView{}})

StackViewType is the types.Type for StackView

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 (updt) 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 view",
		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 = KeyMaps{
	{"MacStandard", "Standard Mac KeyMap", KeySeqMap{
		KeySeq{"Control+Tab", ""}:        KeyNextPanel,
		KeySeq{"Shift+Control+Tab", ""}:  KeyPrevPanel,
		KeySeq{"Control+M", "o"}:         KeyNextPanel,
		KeySeq{"Control+M", "Control+O"}: KeyNextPanel,
		KeySeq{"Control+M", "p"}:         KeyPrevPanel,
		KeySeq{"Control+M", "Control+P"}: KeyPrevPanel,
		KeySeq{"Control+O", ""}:          KeyFileOpen,
		KeySeq{"Control+M", "f"}:         KeyFileOpen,
		KeySeq{"Control+M", "Control+F"}: KeyFileOpen,
		KeySeq{"Control+M", "b"}:         KeyBufSelect,
		KeySeq{"Control+M", "Control+B"}: KeyBufSelect,
		KeySeq{"Control+S", ""}:          KeyBufSave,
		KeySeq{"Shift+Control+S", ""}:    KeyBufSaveAs,
		KeySeq{"Control+M", "s"}:         KeyBufSave,
		KeySeq{"Control+M", "Control+S"}: KeyBufSave,
		KeySeq{"Control+M", "w"}:         KeyBufSaveAs,
		KeySeq{"Control+M", "Control+W"}: KeyBufSaveAs,
		KeySeq{"Control+M", "k"}:         KeyBufClose,
		KeySeq{"Control+M", "Control+K"}: KeyBufClose,
		KeySeq{"Control+M", "c"}:         KeyExecCmd,
		KeySeq{"Control+M", "Control+C"}: KeyExecCmd,
		KeySeq{"Control+M", "n"}:         KeyBufClone,
		KeySeq{"Control+M", "Control+N"}: KeyBufClone,
		KeySeq{"Control+M", "x"}:         KeyRegCopy,
		KeySeq{"Control+M", "g"}:         KeyRegPaste,
		KeySeq{"Control+M", "Control+X"}: KeyRectCut,
		KeySeq{"Control+M", "Control+Y"}: KeyRectPaste,
		KeySeq{"Control+M", "Alt+∑"}:     KeyRectCopy,
		KeySeq{"Control+/", ""}:          KeyCommentOut,
		KeySeq{"Control+M", "t"}:         KeyCommentOut,
		KeySeq{"Control+M", "Control+T"}: KeyCommentOut,
		KeySeq{"Control+M", "i"}:         KeyIndent,
		KeySeq{"Control+M", "Control+I"}: KeyIndent,
		KeySeq{"Control+M", "j"}:         KeyJump,
		KeySeq{"Control+M", "Control+J"}: KeyJump,
		KeySeq{"Control+M", "v"}:         KeySetSplit,
		KeySeq{"Control+M", "Control+V"}: KeySetSplit,
		KeySeq{"Control+M", "m"}:         KeyBuildProject,
		KeySeq{"Control+M", "Control+M"}: KeyBuildProject,
		KeySeq{"Control+M", "r"}:         KeyRunProject,
		KeySeq{"Control+M", "Control+R"}: KeyRunProject,
	}},
	{"MacEmacs", "Mac with emacs-style navigation -- emacs wins in conflicts", KeySeqMap{
		KeySeq{"Control+Tab", ""}:        KeyNextPanel,
		KeySeq{"Shift+Control+Tab", ""}:  KeyPrevPanel,
		KeySeq{"Control+X", "o"}:         KeyNextPanel,
		KeySeq{"Control+X", "Control+O"}: KeyNextPanel,
		KeySeq{"Control+X", "p"}:         KeyPrevPanel,
		KeySeq{"Control+X", "Control+P"}: KeyPrevPanel,
		KeySeq{"Control+X", "f"}:         KeyFileOpen,
		KeySeq{"Control+X", "Control+F"}: KeyFileOpen,
		KeySeq{"Control+X", "b"}:         KeyBufSelect,
		KeySeq{"Control+X", "Control+B"}: KeyBufSelect,
		KeySeq{"Control+X", "s"}:         KeyBufSave,
		KeySeq{"Control+X", "Control+S"}: KeyBufSave,
		KeySeq{"Control+X", "w"}:         KeyBufSaveAs,
		KeySeq{"Control+X", "Control+W"}: KeyBufSaveAs,
		KeySeq{"Control+X", "k"}:         KeyBufClose,
		KeySeq{"Control+X", "Control+K"}: KeyBufClose,
		KeySeq{"Control+X", "c"}:         KeyExecCmd,
		KeySeq{"Control+X", "Control+C"}: KeyExecCmd,
		KeySeq{"Control+C", "c"}:         KeyExecCmd,
		KeySeq{"Control+C", "Control+C"}: KeyExecCmd,
		KeySeq{"Control+C", "o"}:         KeyBufClone,
		KeySeq{"Control+C", "Control+O"}: KeyBufClone,
		KeySeq{"Control+X", "x"}:         KeyRegCopy,
		KeySeq{"Control+X", "g"}:         KeyRegPaste,
		KeySeq{"Control+X", "Control+X"}: KeyRectCut,
		KeySeq{"Control+X", "Control+Y"}: KeyRectPaste,
		KeySeq{"Control+X", "Alt+∑"}:     KeyRectCopy,
		KeySeq{"Control+C", "k"}:         KeyCommentOut,
		KeySeq{"Control+C", "Control+K"}: KeyCommentOut,
		KeySeq{"Control+X", "i"}:         KeyIndent,
		KeySeq{"Control+X", "Control+I"}: KeyIndent,
		KeySeq{"Control+X", "j"}:         KeyJump,
		KeySeq{"Control+X", "Control+J"}: KeyJump,
		KeySeq{"Control+X", "v"}:         KeySetSplit,
		KeySeq{"Control+X", "Control+V"}: KeySetSplit,
		KeySeq{"Control+X", "m"}:         KeyBuildProject,
		KeySeq{"Control+X", "Control+M"}: KeyBuildProject,
		KeySeq{"Control+X", "r"}:         KeyRunProject,
		KeySeq{"Control+X", "Control+R"}: KeyRunProject,
	}},
	{"LinuxEmacs", "Linux with emacs-style navigation -- emacs wins in conflicts", KeySeqMap{
		KeySeq{"Control+Tab", ""}:        KeyNextPanel,
		KeySeq{"Shift+Control+Tab", ""}:  KeyPrevPanel,
		KeySeq{"Control+X", "o"}:         KeyNextPanel,
		KeySeq{"Control+X", "Control+O"}: KeyNextPanel,
		KeySeq{"Control+X", "p"}:         KeyPrevPanel,
		KeySeq{"Control+X", "Control+P"}: KeyPrevPanel,
		KeySeq{"Control+X", "f"}:         KeyFileOpen,
		KeySeq{"Control+X", "Control+F"}: KeyFileOpen,
		KeySeq{"Control+X", "b"}:         KeyBufSelect,
		KeySeq{"Control+X", "Control+B"}: KeyBufSelect,
		KeySeq{"Control+X", "s"}:         KeyBufSave,
		KeySeq{"Control+X", "Control+S"}: KeyBufSave,
		KeySeq{"Control+X", "w"}:         KeyBufSaveAs,
		KeySeq{"Control+X", "Control+W"}: KeyBufSaveAs,
		KeySeq{"Control+X", "k"}:         KeyBufClose,
		KeySeq{"Control+X", "Control+K"}: KeyBufClose,
		KeySeq{"Control+X", "c"}:         KeyExecCmd,
		KeySeq{"Control+X", "Control+C"}: KeyExecCmd,
		KeySeq{"Control+C", "c"}:         KeyExecCmd,
		KeySeq{"Control+C", "Control+C"}: KeyExecCmd,
		KeySeq{"Control+C", "o"}:         KeyBufClone,
		KeySeq{"Control+C", "Control+O"}: KeyBufClone,
		KeySeq{"Control+X", "x"}:         KeyRegCopy,
		KeySeq{"Control+X", "g"}:         KeyRegPaste,
		KeySeq{"Control+X", "Control+X"}: KeyRectCut,
		KeySeq{"Control+X", "Control+Y"}: KeyRectPaste,
		KeySeq{"Control+X", "Alt+∑"}:     KeyRectCopy,
		KeySeq{"Control+C", "k"}:         KeyCommentOut,
		KeySeq{"Control+C", "Control+K"}: KeyCommentOut,
		KeySeq{"Control+X", "i"}:         KeyIndent,
		KeySeq{"Control+X", "Control+I"}: KeyIndent,
		KeySeq{"Control+X", "j"}:         KeyJump,
		KeySeq{"Control+X", "Control+J"}: KeyJump,
		KeySeq{"Control+X", "v"}:         KeySetSplit,
		KeySeq{"Control+X", "Control+V"}: KeySetSplit,
		KeySeq{"Control+M", "m"}:         KeyBuildProject,
		KeySeq{"Control+M", "Control+M"}: KeyBuildProject,
		KeySeq{"Control+M", "r"}:         KeyRunProject,
		KeySeq{"Control+M", "Control+R"}: KeyRunProject,
	}},
	{"LinuxStandard", "Standard Linux KeySeqMap", KeySeqMap{
		KeySeq{"Control+Tab", ""}:        KeyNextPanel,
		KeySeq{"Shift+Control+Tab", ""}:  KeyPrevPanel,
		KeySeq{"Control+M", "o"}:         KeyNextPanel,
		KeySeq{"Control+M", "Control+O"}: KeyNextPanel,
		KeySeq{"Control+M", "p"}:         KeyPrevPanel,
		KeySeq{"Control+M", "Control+P"}: KeyPrevPanel,
		KeySeq{"Control+O", ""}:          KeyFileOpen,
		KeySeq{"Control+M", "f"}:         KeyFileOpen,
		KeySeq{"Control+M", "Control+F"}: KeyFileOpen,
		KeySeq{"Control+M", "b"}:         KeyBufSelect,
		KeySeq{"Control+M", "Control+B"}: KeyBufSelect,
		KeySeq{"Control+S", ""}:          KeyBufSave,
		KeySeq{"Shift+Control+S", ""}:    KeyBufSaveAs,
		KeySeq{"Control+M", "s"}:         KeyBufSave,
		KeySeq{"Control+M", "Control+S"}: KeyBufSave,
		KeySeq{"Control+M", "w"}:         KeyBufSaveAs,
		KeySeq{"Control+M", "Control+W"}: KeyBufSaveAs,
		KeySeq{"Control+M", "k"}:         KeyBufClose,
		KeySeq{"Control+M", "Control+K"}: KeyBufClose,
		KeySeq{"Control+M", "c"}:         KeyExecCmd,
		KeySeq{"Control+M", "Control+C"}: KeyExecCmd,
		KeySeq{"Control+M", "n"}:         KeyBufClone,
		KeySeq{"Control+M", "Control+N"}: KeyBufClone,
		KeySeq{"Control+M", "x"}:         KeyRegCopy,
		KeySeq{"Control+M", "g"}:         KeyRegPaste,
		KeySeq{"Control+M", "Control+X"}: KeyRectCut,
		KeySeq{"Control+M", "Control+Y"}: KeyRectPaste,
		KeySeq{"Control+M", "Alt+∑"}:     KeyRectCopy,
		KeySeq{"Control+/", ""}:          KeyCommentOut,
		KeySeq{"Control+M", "t"}:         KeyCommentOut,
		KeySeq{"Control+M", "Control+T"}: KeyCommentOut,
		KeySeq{"Control+M", "i"}:         KeyIndent,
		KeySeq{"Control+M", "Control+I"}: KeyIndent,
		KeySeq{"Control+M", "j"}:         KeyJump,
		KeySeq{"Control+M", "Control+J"}: KeyJump,
		KeySeq{"Control+M", "v"}:         KeySetSplit,
		KeySeq{"Control+M", "Control+V"}: KeySetSplit,
		KeySeq{"Control+M", "m"}:         KeyBuildProject,
		KeySeq{"Control+M", "Control+M"}: KeyBuildProject,
		KeySeq{"Control+M", "r"}:         KeyRunProject,
		KeySeq{"Control+M", "Control+R"}: KeyRunProject,
	}},
	{"WindowsStandard", "Standard Windows KeySeqMap", KeySeqMap{
		KeySeq{"Control+Tab", ""}:        KeyNextPanel,
		KeySeq{"Shift+Control+Tab", ""}:  KeyPrevPanel,
		KeySeq{"Control+M", "o"}:         KeyNextPanel,
		KeySeq{"Control+M", "Control+O"}: KeyNextPanel,
		KeySeq{"Control+M", "p"}:         KeyPrevPanel,
		KeySeq{"Control+M", "Control+P"}: KeyPrevPanel,
		KeySeq{"Control+O", ""}:          KeyFileOpen,
		KeySeq{"Control+M", "f"}:         KeyFileOpen,
		KeySeq{"Control+M", "Control+F"}: KeyFileOpen,
		KeySeq{"Control+M", "b"}:         KeyBufSelect,
		KeySeq{"Control+M", "Control+B"}: KeyBufSelect,
		KeySeq{"Control+S", ""}:          KeyBufSave,
		KeySeq{"Shift+Control+S", ""}:    KeyBufSaveAs,
		KeySeq{"Control+M", "s"}:         KeyBufSave,
		KeySeq{"Control+M", "Control+S"}: KeyBufSave,
		KeySeq{"Control+M", "w"}:         KeyBufSaveAs,
		KeySeq{"Control+M", "Control+W"}: KeyBufSaveAs,
		KeySeq{"Control+M", "k"}:         KeyBufClose,
		KeySeq{"Control+M", "Control+K"}: KeyBufClose,
		KeySeq{"Control+M", "c"}:         KeyExecCmd,
		KeySeq{"Control+M", "Control+C"}: KeyExecCmd,
		KeySeq{"Control+M", "n"}:         KeyBufClone,
		KeySeq{"Control+M", "Control+N"}: KeyBufClone,
		KeySeq{"Control+M", "x"}:         KeyRegCopy,
		KeySeq{"Control+M", "g"}:         KeyRegPaste,
		KeySeq{"Control+M", "Control+X"}: KeyRectCut,
		KeySeq{"Control+M", "Control+Y"}: KeyRectPaste,
		KeySeq{"Control+M", "Alt+∑"}:     KeyRectCopy,
		KeySeq{"Control+/", ""}:          KeyCommentOut,
		KeySeq{"Control+M", "t"}:         KeyCommentOut,
		KeySeq{"Control+M", "Control+T"}: KeyCommentOut,
		KeySeq{"Control+M", "i"}:         KeyIndent,
		KeySeq{"Control+M", "Control+I"}: KeyIndent,
		KeySeq{"Control+M", "j"}:         KeyJump,
		KeySeq{"Control+M", "Control+J"}: KeyJump,
		KeySeq{"Control+M", "v"}:         KeySetSplit,
		KeySeq{"Control+M", "Control+V"}: KeySetSplit,
		KeySeq{"Control+M", "m"}:         KeyBuildProject,
		KeySeq{"Control+M", "Control+M"}: KeyBuildProject,
		KeySeq{"Control+M", "r"}:         KeyRunProject,
		KeySeq{"Control+M", "Control+R"}: KeyRunProject,
	}},
	{"ChromeStd", "Standard chrome-browser and linux-under-chrome bindings", KeySeqMap{
		KeySeq{"Control+Tab", ""}:        KeyNextPanel,
		KeySeq{"Shift+Control+Tab", ""}:  KeyPrevPanel,
		KeySeq{"Control+M", "o"}:         KeyNextPanel,
		KeySeq{"Control+M", "Control+O"}: KeyNextPanel,
		KeySeq{"Control+M", "p"}:         KeyPrevPanel,
		KeySeq{"Control+M", "Control+P"}: KeyPrevPanel,
		KeySeq{"Control+O", ""}:          KeyFileOpen,
		KeySeq{"Control+M", "f"}:         KeyFileOpen,
		KeySeq{"Control+M", "Control+F"}: KeyFileOpen,
		KeySeq{"Control+M", "b"}:         KeyBufSelect,
		KeySeq{"Control+M", "Control+B"}: KeyBufSelect,
		KeySeq{"Control+S", ""}:          KeyBufSave,
		KeySeq{"Shift+Control+S", ""}:    KeyBufSaveAs,
		KeySeq{"Control+M", "s"}:         KeyBufSave,
		KeySeq{"Control+M", "Control+S"}: KeyBufSave,
		KeySeq{"Control+M", "w"}:         KeyBufSaveAs,
		KeySeq{"Control+M", "Control+W"}: KeyBufSaveAs,
		KeySeq{"Control+M", "k"}:         KeyBufClose,
		KeySeq{"Control+M", "Control+K"}: KeyBufClose,
		KeySeq{"Control+M", "c"}:         KeyExecCmd,
		KeySeq{"Control+M", "Control+C"}: KeyExecCmd,
		KeySeq{"Control+M", "n"}:         KeyBufClone,
		KeySeq{"Control+M", "Control+N"}: KeyBufClone,
		KeySeq{"Control+M", "x"}:         KeyRegCopy,
		KeySeq{"Control+M", "g"}:         KeyRegPaste,
		KeySeq{"Control+M", "Control+X"}: KeyRectCut,
		KeySeq{"Control+M", "Control+Y"}: KeyRectPaste,
		KeySeq{"Control+M", "Alt+∑"}:     KeyRectCopy,
		KeySeq{"Control+/", ""}:          KeyCommentOut,
		KeySeq{"Control+M", "t"}:         KeyCommentOut,
		KeySeq{"Control+M", "Control+T"}: KeyCommentOut,
		KeySeq{"Control+M", "i"}:         KeyIndent,
		KeySeq{"Control+M", "Control+I"}: KeyIndent,
		KeySeq{"Control+M", "j"}:         KeyJump,
		KeySeq{"Control+M", "Control+J"}: KeyJump,
		KeySeq{"Control+M", "v"}:         KeySetSplit,
		KeySeq{"Control+M", "Control+V"}: KeySetSplit,
		KeySeq{"Control+M", "m"}:         KeyBuildProject,
		KeySeq{"Control+M", "Control+M"}: KeyBuildProject,
		KeySeq{"Control+M", "r"}:         KeyRunProject,
		KeySeq{"Control+M", "Control+R"}: KeyRunProject,
	}},
}

StandardKeyMaps is the original compiled-in set of standard keymaps that have the lastest key functions bound to standard key chords.

View Source
var StandardLangs = Langs{
	fileinfo.Go: {CmdNames{"Go: Imports File"}},
}

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

View Source
var StandardSplits = Splits{
	{"Code", "2 text views, tabs", []float32{.1, .325, .325, .25}},
	{"Small", "1 text view, tabs", []float32{.1, .5, 0, .4}},
	{"BigTabs", "1 text view, big tabs", []float32{.1, .3, 0, .6}},
	{"Debug", "big command panel for debugging", []float32{0.1, 0.29539588, 0.2949658, 0.30963832}},
}

StandardSplits is the original compiled-in set of standard named splits.

View Source
var SymNodeType = types.AddType(&types.Type{Name: "cogentcore.org/cogent/code/code.SymNode", IDName: "sym-node", Doc: "SymNode represents a language symbol -- the name of the node is\nthe name of the symbol. Some symbols, e.g. type have children", Embeds: []types.Field{{Name: "NodeBase"}}, Fields: []types.Field{{Name: "Symbol", Doc: "the symbol"}}, Instance: &SymNode{}})

SymNodeType is the types.Type for SymNode

View Source
var SymTreeViewType = types.AddType(&types.Type{Name: "cogentcore.org/cogent/code/code.SymTreeView", IDName: "sym-tree-view", Doc: "SymTreeView is a TreeView that knows how to operate on FileNode nodes", Embeds: []types.Field{{Name: "TreeView"}}, Instance: &SymTreeView{}})

SymTreeViewType is the types.Type for SymTreeView

View Source
var SymbolsViewType = types.AddType(&types.Type{Name: "cogentcore.org/cogent/code/code.SymbolsView", IDName: "symbols-view", Doc: "SymbolsView is a widget that displays results of a file or package parse", Embeds: []types.Field{{Name: "Layout"}}, Fields: []types.Field{{Name: "Code", Doc: "parent code project"}, {Name: "SymParams", Doc: "params for structure display"}, {Name: "Syms", Doc: "all the symbols for the file or package in a tree"}, {Name: "Match", Doc: "only show symbols that match this string"}}, Instance: &SymbolsView{}})

SymbolsViewType is the types.Type for SymbolsView

View Source
var TaskViewType = types.AddType(&types.Type{Name: "cogentcore.org/cogent/code/code.TaskView", IDName: "task-view", Doc: "TaskView is a view of the threads", Embeds: []types.Field{{Name: "Layout"}}, Instance: &TaskView{}})

TaskViewType is the types.Type for TaskView

View Source
var TextEditorType = types.AddType(&types.Type{Name: "cogentcore.org/cogent/code/code.TextEditor", IDName: "text-editor", Doc: "TextEditor is the Code-specific version of the TextEditor, with support for\nsetting / clearing breakpoints, etc", Embeds: []types.Field{{Name: "Editor"}}, Fields: []types.Field{{Name: "Code"}}, Instance: &TextEditor{}})

TextEditorType is the types.Type for TextEditor

View Source
var ThreadViewType = types.AddType(&types.Type{Name: "cogentcore.org/cogent/code/code.ThreadView", IDName: "thread-view", Doc: "ThreadView is a view of the threads", Embeds: []types.Field{{Name: "Layout"}}, Instance: &ThreadView{}})

ThreadViewType is the types.Type for ThreadView

View Source
var VarViewType = types.AddType(&types.Type{Name: "cogentcore.org/cogent/code/code.VarView", IDName: "var-view", Doc: "VarView shows a debug variable in an inspector-like framework,\nwith sub-variables in a tree.", Embeds: []types.Field{{Name: "Frame"}}, Fields: []types.Field{{Name: "Var", Doc: "variable being edited"}, {Name: "SelectVar"}, {Name: "FrameInfo", Doc: "frame info"}, {Name: "DbgView", Doc: "parent DebugView"}}, Instance: &VarView{}})

VarViewType is the types.Type for VarView

View Source
var VarsViewType = types.AddType(&types.Type{Name: "cogentcore.org/cogent/code/code.VarsView", IDName: "vars-view", Doc: "VarsView is a view of the variables", Embeds: []types.Field{{Name: "Layout"}}, Fields: []types.Field{{Name: "GlobalVars", Doc: "if true, this is global vars, not local ones"}}, Instance: &VarsView{}})

VarsViewType is the types.Type for VarsView

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 CmdsView

func CmdsView(pt *Commands)

CmdsView opens a view of a commands table

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 CompleteArg

func CompleteArg(data any, text string, posLn, posCh int) (md complete.Matches)

CompleteArg supplies directory variables to the completer

func CompleteArgEdit

func CompleteArgEdit(data any, text string, cursorPos int, c complete.Completion, seed string) (ed complete.Edit)

CompleteArgEdit edits completer text field after the user chooses from the candidate completions

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 DebugSettingsView added in v0.0.1

func DebugSettingsView(pf *cdebug.Params) *views.StructView

DebugSettingsView opens a view of project Debug settings, returns structview if not already open

func KeyMapsView

func KeyMapsView(km *KeyMaps)

KeyMapsView opens a view of a key maps table

func LangsView

func LangsView(pt *Langs)

LangsView opens a view of a languages options map

func MarkupCmdOutput

func MarkupCmdOutput(out []byte) []byte

MarkupCmdOutput 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 added in v0.0.2

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 ProjectSettingsView added in v0.0.2

func ProjectSettingsView(pf *ProjectSettings) *views.StructView

ProjectSettingsView opens a view of project settings, returns structview if not already open

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(ge Code, ssym syms.Symbol)

func SetActiveKeyMap

func SetActiveKeyMap(km *KeySeqMap, kmName KeyMapName)

SetActiveKeyMap sets the current ActiveKeyMap, calling Update on the map prior to setting it to ensure that it is a valid, complete map

func SetActiveKeyMapName

func SetActiveKeyMapName(mapnm KeyMapName)

SetActiveKeyMapName sets the current ActiveKeyMap by name from those defined in AvailKeyMaps, calling Update on the map prior to setting it to ensure that it is a valid, complete map

func SetGoMod

func SetGoMod(gomod bool)

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

func SplitsView

func SplitsView(pt *Splits)

SplitsView opens a view of a splits table

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 BreakView

type BreakView struct {
	core.Layout
}

BreakView is a view of the breakpoints

func NewBreakView

func NewBreakView(parent tree.Node, name ...string) *BreakView

NewBreakView adds a new BreakView with the given name to the given parent: BreakView is a view of the breakpoints

func (*BreakView) ConfigBreakView

func (sv *BreakView) ConfigBreakView(dv *DebugView)

func (*BreakView) DebugVw

func (sv *BreakView) DebugVw() *DebugView

func (*BreakView) New

func (t *BreakView) New() tree.Node

New returns a new *BreakView value

func (*BreakView) NodeType added in v0.0.2

func (t *BreakView) NodeType() *types.Type

NodeType returns the *types.Type of BreakView

func (*BreakView) SetTooltip

func (t *BreakView) SetTooltip(v string) *BreakView

SetTooltip sets the [BreakView.Tooltip]

func (*BreakView) ShowBreaks

func (sv *BreakView) ShowBreaks()

ShowBreaks triggers update of view of State.Breaks

func (*BreakView) TableView

func (sv *BreakView) TableView() *views.TableView

TableView returns the tableview

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 -- just start typing { and you'll get a completion menu of options, and 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 (e.g., on Windows).
	Args CmdArgs `complete:"arg" 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

func (*CmdArgs) SetCompleter

func (cm *CmdArgs) SetCompleter(tf *core.TextField, id string)

SetCompleter specifies the functions that do completion and post selection editing when inserting the chosen completion

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() views.Value

Value registers CmdValue as the views.Value for CmdName.

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 added in v0.0.2

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 CmdValue

type CmdValue struct {
	views.ValueBase[*core.Button]
}

CmdValue represents a CmdName value with a button.

func (*CmdValue) Config added in v0.0.1

func (v *CmdValue) Config()

func (*CmdValue) ConfigDialog

func (vv *CmdValue) ConfigDialog(d *core.Body) (bool, func())

func (*CmdValue) Update added in v0.0.1

func (v *CmdValue) Update()

type Code

type Code interface {
	core.Widget

	// ProjectSettings returns the [ProjectSettings]
	ProjectSettings() *ProjectSettings

	// FileTree returns the code.Files file tree
	FileTree() *filetree.Tree

	// LastSaveTime returns the time stamp when a file was last saved within project --
	// can be used for dirty flag state relative to other time stamps.
	LastSaveTime() time.Time

	// VersionControl returns the version control system in effect, using the file tree detected
	// version or whatever is set in project settings
	VersionControl() filetree.VersionControlName

	// CmdRuns returns the CmdRuns manager of running commands, used extensively
	// in commands.go
	CmdRuns() *CmdRuns

	// history of commands executed in this session
	CmdHist() *CmdNames

	// ArgVarVals returns the ArgVarVals argument variable values
	ArgVarVals() *ArgVarVals

	// SetStatus updates the statusbar label with given message, to be rendered next time
	SetStatus(msg string)

	// UpdateStatusLabel updates the statusbar label with current data
	UpdateStatusLabel()

	// SelectTabByName Selects given main tab, and returns all of its contents as well.
	SelectTabByName(label string) core.Widget

	// FocusOnTabs moves keyboard focus to Tabs panel -- returns false if nothing at that tab
	FocusOnTabs() bool

	// ShowFile shows given file name at given line, returning TextEditor showing it
	// or error if not found.
	ShowFile(fname string, ln int) (*TextEditor, error)

	// FileNodeOpened is called whenever file node is double-clicked in file tree
	FileNodeOpened(fn *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.
	FileNodeForFile(fpath string, add bool) *filetree.Node

	// TextBufForFile returns the 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.
	TextBufForFile(fpath string, add bool) *texteditor.Buffer

	// 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
	NextViewFileNode(fn *filetree.Node) (*TextEditor, int)

	// ActiveTextEditor returns the currently-active TextEditor
	ActiveTextEditor() *TextEditor

	// SetActiveTextEditor sets the given texteditor as the active one, and returns its index
	SetActiveTextEditor(av *TextEditor) int

	// ActiveFileNode returns the file node for the active file -- nil if none
	ActiveFileNode() *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
	ExecCmdFileNode(fn *filetree.Node)

	// ExecCmdNameFileNode executes command of given name on given node
	ExecCmdNameFileNode(fn *filetree.Node, cmdNm CmdName, sel bool, clearBuf bool)

	// ExecCmdNameFilename executes command of given name on given file name
	ExecCmdNameFilename(fn string, cmdNm CmdName, sel bool, clearBuf bool)

	// Find does Find / Replace in files, using given options and filters -- opens up a
	// main tab with the results and further controls.
	Find(find, repl string, ignoreCase, regExp bool, loc FindLoc, langs []fileinfo.Known)

	// 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
	ParseOpenFindURL(ur string, ftv *texteditor.Editor) (tv *TextEditor, reg textbuf.Region, findBufStLn, findCount int, ok bool)

	// OpenFileAtRegion opens the specified file, highlights the region and sets the cursor
	OpenFileAtRegion(filename core.Filename, reg textbuf.Region) (tv *TextEditor, ok bool)

	// SaveAllCheck checks 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.
	SaveAllCheck(cancelOpt bool, fun func()) bool

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

	// CloseOpenNodes closes any nodes with open views (including those in directories under nodes).
	// called prior to rename.
	CloseOpenNodes(nodes []*FileNode)

	// CurOpenNodes returns the current open nodes list
	CurOpenNodes() *OpenNodes

	// LookupFun is the completion system Lookup function that makes a custom
	// texteditor dialog that has option to edit resulting file.
	LookupFun(data any, text string, posLn, posCh int) (ld complete.Lookup)

	// Spell checks spelling in active text view
	Spell()

	// Symbols calls a function to parse file or package
	Symbols()

	// Debug runs debugger on default exe
	Debug()

	// CurDebug returns the current debug view, or nil
	CurDebug() *DebugView

	// ClearDebug clears the current debugger setting -- no more debugger active.
	ClearDebug()
}

Code provides the interface for the CodeView functionality that is needed by the core code infrastructure, to allow CodeView to be in a separate package. It is not intended to be the full functionality of the CodeView.

func ParentCode

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

ParentCode returns the Code parent of given node

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 `tableview-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" complete:"arg"`

	// 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(ge 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

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

func (*Command) PromptUser

func (cm *Command) PromptUser(ge 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(ge 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(ge Code, buf *texteditor.Buffer)

RunAfterPrompts runs after any prompts have been set, if needed

func (*Command) RunBuf

func (cm *Command) RunBuf(ge 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(ge 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(ge 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(ge 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

func (*Command) SetCompleter

func (cmd *Command) SetCompleter(tf *core.TextField, id string)

SetCompleter adds a completer to the textfield - each field can have its own match and edit functions For this to be called add a "complete" tag to the struct field

type Commands

type Commands []*Command

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 added in v0.0.2

func (cm *Commands) SaveSettings() error

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

func (*Commands) ViewStandard added in v0.0.2

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
	Buf *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

DebugBreakStatus is the status of a given 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

	DebugBreakStatusN
)

type DebugView

type DebugView struct {
	core.Layout

	// supported file type to determine debugger
	Sup 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:"-"`
}

DebugView is the debugger

func NewDebugView

func NewDebugView(parent tree.Node, name ...string) *DebugView

NewDebugView adds a new DebugView with the given name to the given parent: DebugView is the debugger

func (*DebugView) ActionActivate

func (dv *DebugView) ActionActivate(act *core.Button)

ActionActivate is the update function for actions that depend on the debugger being avail for input commands

func (*DebugView) AddBreak

func (dv *DebugView) 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 (*DebugView) AllVarVw

func (dv *DebugView) AllVarVw() *VarsView

AllVarVw returns the all vars view from tabs

func (*DebugView) BackupBreaks

func (dv *DebugView) BackupBreaks()

BackupBreaks makes a backup copy of current breaks

func (*DebugView) BreakVw

func (dv *DebugView) BreakVw() *BreakView

BreakVw returns the break view from tabs

func (*DebugView) Config added in v0.0.1

func (dv *DebugView) Config()

func (*DebugView) ConfigDebugView

func (dv *DebugView) ConfigDebugView(ge Code, sup fileinfo.Known, exePath string)

ConfigDebugView configures the view -- parameters for the job must have already been set in [ProjectSettings.Debug].

func (*DebugView) ConfigTabs

func (dv *DebugView) ConfigTabs()

ConfigTabs configures the tabs

func (*DebugView) ConfigToolbar

func (dv *DebugView) ConfigToolbar()

func (*DebugView) ConsoleText

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

ConsoleText returns the console TextEditor

func (*DebugView) Continue

func (dv *DebugView) Continue()

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

func (*DebugView) DbgCanStep

func (dv *DebugView) 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 (*DebugView) DbgIsActive

func (dv *DebugView) DbgIsActive() bool

DbgIsActive means debugger is started.

func (*DebugView) DbgIsAvail

func (dv *DebugView) DbgIsAvail() bool

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

func (*DebugView) DeleteAllBreaks

func (dv *DebugView) DeleteAllBreaks()

DeleteAllBreaks deletes all breakpoints

func (*DebugView) DeleteBreak

func (dv *DebugView) 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 (*DebugView) DeleteBreakImpl

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

DeleteBreakImpl deletes given breakpoint with no other updates

func (*DebugView) DeleteBreakInBuf

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

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

func (*DebugView) DeleteBreakIndex added in v0.0.2

func (dv *DebugView) DeleteBreakIndex(bidx int)

DeleteBreakIndex deletes break at given index in list of breaks

func (*DebugView) DeleteCurPCInBuf

func (dv *DebugView) DeleteCurPCInBuf()

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

func (*DebugView) Destroy

func (dv *DebugView) Destroy()

func (*DebugView) Detach

func (dv *DebugView) Detach()

Detach from debugger

func (*DebugView) FindFrames

func (dv *DebugView) 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 (*DebugView) FindFramesVw

func (dv *DebugView) FindFramesVw() *StackView

FindFramesVw returns the find frames view from tabs

func (*DebugView) InitState

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

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

func (*DebugView) ListGlobalVars

func (dv *DebugView) ListGlobalVars(filter string)

ListGlobalVars lists global vars matching given optional filter in Global Vars tab

func (*DebugView) New

func (t *DebugView) New() tree.Node

New returns a new *DebugView value

func (*DebugView) NodeType added in v0.0.2

func (t *DebugView) NodeType() *types.Type

NodeType returns the *types.Type of DebugView

func (*DebugView) SetBreaks

func (dv *DebugView) SetBreaks()

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

func (*DebugView) SetCurPCInBuf

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

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

func (*DebugView) SetDbgTime

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

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

func (*DebugView) SetExePath

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

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

func (*DebugView) SetFrame

func (dv *DebugView) SetFrame(depth int)

SetFrame sets the given frame depth level as active

func (*DebugView) SetStatus

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

func (*DebugView) SetSup

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

SetSup sets the [DebugView.Sup]: supported file type to determine debugger

func (*DebugView) SetThread

func (dv *DebugView) SetThread(threadID int)

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

func (*DebugView) SetThreadIndex added in v0.0.2

func (dv *DebugView) 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 (*DebugView) SetTooltip

func (t *DebugView) SetTooltip(v string) *DebugView

SetTooltip sets the [DebugView.Tooltip]

func (*DebugView) ShowBreakFile

func (dv *DebugView) ShowBreakFile(bidx int)

ShowBreakFile shows the file for given break index

func (*DebugView) ShowBreaks

func (dv *DebugView) ShowBreaks(selTab bool)

ShowBreaks shows the current breaks

func (*DebugView) ShowFile

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

ShowFile shows the file name in code

func (*DebugView) ShowFindFrames

func (dv *DebugView) ShowFindFrames(selTab bool)

ShowFindFrames shows the current find frames

func (*DebugView) ShowGlobalVars

func (dv *DebugView) ShowGlobalVars(selTab bool)

ShowGlobalVars shows the current allvars

func (*DebugView) ShowStack

func (dv *DebugView) ShowStack(selTab bool)

ShowStack shows the current stack

func (*DebugView) ShowTasks

func (dv *DebugView) ShowTasks(selTab bool)

ShowTasks shows the current tasks

func (*DebugView) ShowThreads

func (dv *DebugView) ShowThreads(selTab bool)

ShowThreads shows the current threads

func (*DebugView) ShowVar

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

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

func (*DebugView) ShowVars

func (dv *DebugView) ShowVars(selTab bool)

ShowVars shows the current vars

func (*DebugView) SingleStep

func (dv *DebugView) SingleStep()

StepSingle steps a single cpu instruction.

func (*DebugView) StackVw

func (dv *DebugView) StackVw() *StackView

StackVw returns the stack view from tabs

func (*DebugView) Start

func (dv *DebugView) Start()

Start starts the debuger

func (*DebugView) StepInto

func (dv *DebugView) StepInto()

StepInto continues to the next source line, entering function calls.

func (*DebugView) StepOut

func (dv *DebugView) StepOut()

StepOut continues to the return point of the current function

func (*DebugView) StepOver

func (dv *DebugView) StepOver()

StepOver continues to the next source line, not entering function calls.

func (*DebugView) Stop

func (dv *DebugView) Stop()

Stop stops a running process

func (*DebugView) Tabs

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

Tabs returns the tabs

func (*DebugView) TaskVw

func (dv *DebugView) TaskVw() *TaskView

TaskVw returns the task view from tabs

func (*DebugView) ThreadVw

func (dv *DebugView) ThreadVw() *ThreadView

ThreadVw returns the thread view from tabs

func (*DebugView) Toolbar

func (dv *DebugView) Toolbar() *core.Toolbar

Toolbar returns the debug toolbar

func (*DebugView) UpdateAllBreaks

func (dv *DebugView) UpdateAllBreaks()

UpdateAllBreaks updates all breakpoints

func (*DebugView) UpdateBreakInBuf

func (dv *DebugView) UpdateBreakInBuf(fpath string, line int, stat DebugBreakStatus)

UpdateBreakInBuf updates break status in its TextBuf line is 1-based line number

func (*DebugView) UpdateFromState added in v0.0.2

func (dv *DebugView) UpdateFromState()

UpdateFromState updates the view from current debugger state

func (*DebugView) UpdateToolbar

func (dv *DebugView) UpdateToolbar()

func (*DebugView) UpdateView

func (dv *DebugView) UpdateView()

UpdateView updates current view of state

func (*DebugView) VarValue

func (dv *DebugView) VarValue(varNm string) string

VarValue returns the value of given variable, first looking in local stack vars and then in global vars

func (*DebugView) VarVw

func (dv *DebugView) VarVw() *VarsView

VarVw returns the vars view from tabs

type FileNode

type FileNode struct {
	filetree.Node
}

FileNode is Code version of FileNode for FileTree view

func NewFileNode

func NewFileNode(parent tree.Node, name ...string) *FileNode

NewFileNode adds a new FileNode with the given name to the given parent: FileNode is Code version of FileNode for FileTree view

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

func (t *FileNode) New() tree.Node

New returns a new *FileNode value

func (*FileNode) NodeType added in v0.0.2

func (t *FileNode) NodeType() *types.Type

NodeType returns the *types.Type of FileNode

func (*FileNode) OnDoubleClick

func (fn *FileNode) OnDoubleClick(e events.Event)

func (*FileNode) OnInit

func (fn *FileNode) OnInit()

func (*FileNode) RenameFiles

func (fn *FileNode) RenameFiles()

RenameFiles calls RenameFile on any selected nodes

func (*FileNode) SetIcon

func (t *FileNode) SetIcon(v icons.Icon) *FileNode

SetIcon sets the [FileNode.Icon]

func (*FileNode) SetIconClosed added in v0.0.1

func (t *FileNode) SetIconClosed(v icons.Icon) *FileNode

SetIconClosed sets the [FileNode.IconClosed]

func (*FileNode) SetIconLeaf added in v0.0.1

func (t *FileNode) SetIconLeaf(v icons.Icon) *FileNode

SetIconLeaf sets the [FileNode.IconLeaf]

func (*FileNode) SetIconOpen added in v0.0.1

func (t *FileNode) SetIconOpen(v icons.Icon) *FileNode

SetIconOpen sets the [FileNode.IconOpen]

func (*FileNode) SetIndent

func (t *FileNode) SetIndent(v units.Value) *FileNode

SetIndent sets the [FileNode.Indent]

func (*FileNode) SetOpenDepth

func (t *FileNode) SetOpenDepth(v int) *FileNode

SetOpenDepth sets the [FileNode.OpenDepth]

func (*FileNode) SetRootView

func (t *FileNode) SetRootView(v *views.TreeView) *FileNode

SetRootView sets the [FileNode.RootView]

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

func (*FileNode) SetSelectedNodes

func (t *FileNode) SetSelectedNodes(v ...views.TreeViewer) *FileNode

SetSelectedNodes sets the [FileNode.SelectedNodes]

func (*FileNode) SetText

func (t *FileNode) SetText(v string) *FileNode

SetText sets the [FileNode.Text]

func (*FileNode) SetTooltip

func (t *FileNode) SetTooltip(v string) *FileNode

SetTooltip sets the [FileNode.Tooltip]

func (*FileNode) SetViewIndex added in v0.0.2

func (t *FileNode) SetViewIndex(v int) *FileNode

SetViewIndex sets the [FileNode.ViewIndex]

func (*FileNode) SetWidgetSize

func (t *FileNode) SetWidgetSize(v math32.Vector2) *FileNode

SetWidgetSize sets the [FileNode.WidgetSize]

type FileSearchResults

type FileSearchResults struct {
	Node    *filetree.Node
	Count   int
	Matches []textbuf.Match
}

FileSearchResults is used to report search results

func FileTreeSearch

func FileTreeSearch(ge Code, start *filetree.Node, find string, ignoreCase, regExp bool, loc FindLoc, activeDir string, langs []fileinfo.Known) []FileSearchResults

FileTreeSearch returns list of all nodes starting at given node of given language(s) that contain the given string, sorted in descending order by number of occurrences -- ignoreCase transforms everything into lowercase

func FindAll added in v0.0.1

func FindAll(ge Code, start *filetree.Node, find string, ignoreCase, regExp bool, langs []fileinfo.Known) []FileSearchResults

FindAll returns list of all files (regardless of what is currently open) starting at given node of given language(s) that contain the given string, sorted in descending order by number of occurrences. ignoreCase transforms everything into lowercase.

type FileSettings

type FileSettings struct {

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

FileSettings contains file view settings

func (*FileSettings) Defaults

func (se *FileSettings) Defaults()

Defaults are the defaults for FileSettings

type FindLoc

type FindLoc int32 //enums:enum -trim-prefix FindLoc

FindLoc corresponds to the search scope

const (
	// FindOpen finds in all open folders in the left file browser
	FindLocOpen FindLoc = iota

	// FindLocAll finds in all directories under the root path. can be slow for large file trees
	FindLocAll

	// FindLocFile only finds in the current active file
	FindLocFile

	// FindLocDir only finds in the directory of the current active file
	FindLocDir

	// FindLocNotTop finds in all open folders *except* the top-level folder
	FindLocNotTop
)
const FindLocN FindLoc = 5

FindLocN is the highest valid value for type FindLoc, plus one.

func FindLocValues

func FindLocValues() []FindLoc

FindLocValues returns all possible values for the type FindLoc.

func (FindLoc) Desc

func (i FindLoc) Desc() string

Desc returns the description of the FindLoc value.

func (FindLoc) Int64

func (i FindLoc) Int64() int64

Int64 returns the FindLoc value as an int64.

func (FindLoc) MarshalText

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

MarshalText implements the encoding.TextMarshaler interface.

func (*FindLoc) SetInt64

func (i *FindLoc) SetInt64(in int64)

SetInt64 sets the FindLoc value from an int64.

func (*FindLoc) SetString

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

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

func (FindLoc) String

func (i FindLoc) String() string

String returns the string representation of this FindLoc value.

func (*FindLoc) UnmarshalText

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

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (FindLoc) Values

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

Values returns all possible values for the type FindLoc.

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 FindLoc

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

	// history of finds
	FindHist []string

	// history of replaces
	ReplHist []string
}

FindParams are parameters for find / replace

type FindView

type FindView struct {
	core.Layout

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

	// langs value view
	LangVV views.Value

	// time of last find
	Time time.Time

	// compiled regexp
	Re *regexp.Regexp
}

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

func NewFindView

func NewFindView(parent tree.Node, name ...string) *FindView

NewFindView adds a new FindView with the given name to the given parent: FindView is a find / replace widget that displays results in a TextEditor and has a toolbar for controlling find / replace process.

func (*FindView) CheckValidRegexp

func (fv *FindView) CheckValidRegexp() bool

CheckValidRegexp returns false if using regexp and it is not valid

func (*FindView) CompileRegexp

func (fv *FindView) CompileRegexp() bool

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

func (*FindView) Config added in v0.0.1

func (fv *FindView) Config()

func (*FindView) ConfigFindView

func (fv *FindView) ConfigFindView()

Config configures the view

func (*FindView) ConfigToolbars

func (fv *FindView) ConfigToolbars(fb, rb *core.BasicBar)

ConfigToolbars

func (*FindView) FindAction

func (fv *FindView) FindAction()

FindAction runs a new find with current params

func (*FindView) FindBar

func (fv *FindView) FindBar() *core.BasicBar

FindBar returns the find toolbar

func (*FindView) FindNextAct

func (fv *FindView) FindNextAct() *core.Button

FindNextAct returns the find next action in toolbar -- selected first

func (*FindView) FindText

func (fv *FindView) FindText() *core.Chooser

FindText returns the find textfield in toolbar

func (*FindView) HighlightFinds

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

HighlightFinds highlights all the find results in ftv buffer

func (*FindView) IgnoreBox

func (fv *FindView) IgnoreBox() *core.Switch

IgnoreBox returns the ignore case checkbox in toolbar

func (*FindView) LocCombo

func (fv *FindView) LocCombo() *core.Chooser

LocCombo returns the loc combobox

func (*FindView) New

func (t *FindView) New() tree.Node

New returns a new *FindView value

func (*FindView) NextFind

func (fv *FindView) NextFind()

NextFind shows next find result

func (*FindView) NodeType added in v0.0.2

func (t *FindView) NodeType() *types.Type

NodeType returns the *types.Type of FindView

func (*FindView) OpenFindURL

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

OpenFindURL opens given find:/// url from Find

func (*FindView) Params

func (fv *FindView) Params() *FindParams

Params returns the find params

func (*FindView) PrevFind

func (fv *FindView) PrevFind()

PrevFind shows previous find result

func (*FindView) RegexpBox

func (fv *FindView) RegexpBox() *core.Switch

RegexpBox returns the regexp checkbox in toolbar

func (*FindView) ReplBar

func (fv *FindView) ReplBar() *core.BasicBar

ReplBar returns the replace toolbar

func (*FindView) ReplText

func (fv *FindView) ReplText() *core.Chooser

ReplText returns the replace textfield in toolbar

func (*FindView) ReplaceAction

func (fv *FindView) ReplaceAction() bool

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

func (*FindView) ReplaceAll

func (fv *FindView) ReplaceAll()

ReplaceAll performs replace all

func (*FindView) ReplaceAllAction

func (fv *FindView) ReplaceAllAction()

ReplaceAllAction performs replace all, prompting before proceeding

func (*FindView) SaveFindString

func (fv *FindView) SaveFindString(find string)

SaveFindString saves the given find string to the find params history and current str

func (*FindView) SaveReplString

func (fv *FindView) SaveReplString(repl string)

SaveReplString saves the given replace string to the find params history and current str

func (*FindView) SetCode

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

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

func (*FindView) SetLangVV added in v0.0.2

func (t *FindView) SetLangVV(v views.Value) *FindView

SetLangVV sets the [FindView.LangVV]: langs value view

func (*FindView) SetRe

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

SetRe sets the [FindView.Re]: compiled regexp

func (*FindView) SetTime

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

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

func (*FindView) SetTooltip

func (t *FindView) SetTooltip(v string) *FindView

SetTooltip sets the [FindView.Tooltip]

func (*FindView) ShowResults

func (fv *FindView) ShowResults(res []FileSearchResults)

ShowResults shows the results in the buffer

func (*FindView) TextEditor

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

TextEditorLay returns the find results TextEditor

func (*FindView) UpdateFromParams

func (fv *FindView) UpdateFromParams()

UpdateFromParams is called in Find function with new params

type KeyFunctions added in v0.0.2

type KeyFunctions int32 //enums:enum -trim-prefix Key

KeyFunctions are special functions for the overall control of the system: moving between windows, running commands, etc. Multi-key sequences can be used.

const (
	KeyNone KeyFunctions = iota
	// special internal signal returned by KeyFunction indicating need for second key
	KeyNeeds2
	// move to next panel to the right
	KeyNextPanel
	// move to prev panel to the left
	KeyPrevPanel
	// open a new file in active texteditor
	KeyFileOpen
	// select an open buffer to edit in active texteditor
	KeyBufSelect
	// open active file in other view
	KeyBufClone
	// save active texteditor buffer to its file
	KeyBufSave
	// save as active texteditor buffer to its file
	KeyBufSaveAs
	// close active texteditor buffer
	KeyBufClose
	// execute a command on active texteditor buffer
	KeyExecCmd
	// copy rectangle
	KeyRectCopy
	// cut rectangle
	KeyRectCut
	// paste rectangle
	KeyRectPaste
	// copy selection to named register
	KeyRegCopy
	// paste selection from named register
	KeyRegPaste
	// comment out region
	KeyCommentOut
	// indent region
	KeyIndent
	// jump to line (same as keyfun.Jump)
	KeyJump
	// set named splitter config
	KeySetSplit
	// build overall project
	KeyBuildProject
	// run overall project
	KeyRunProject
)
const KeyFunctionsN KeyFunctions = 22

KeyFunctionsN is the highest valid value for type KeyFunctions, plus one.

func KeyFunction added in v0.0.2

func KeyFunction(key1, key2 key.Chord) KeyFunctions

KeyFunction translates chord into keyboard function; use events.Event.KeyChord to get chord; it returns KeyFunNeeds2 if the key sequence requires 2 keys to be entered, and only the first is present

func KeyFunctionsValues added in v0.0.2

func KeyFunctionsValues() []KeyFunctions

KeyFunctionsValues returns all possible values for the type KeyFunctions.

func (KeyFunctions) Desc added in v0.0.2

func (i KeyFunctions) Desc() string

Desc returns the description of the KeyFunctions value.

func (KeyFunctions) Int64 added in v0.0.2

func (i KeyFunctions) Int64() int64

Int64 returns the KeyFunctions value as an int64.

func (KeyFunctions) MarshalText added in v0.0.2

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

MarshalText implements the encoding.TextMarshaler interface.

func (*KeyFunctions) SetInt64 added in v0.0.2

func (i *KeyFunctions) SetInt64(in int64)

SetInt64 sets the KeyFunctions value from an int64.

func (*KeyFunctions) SetString added in v0.0.2

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

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

func (KeyFunctions) String added in v0.0.2

func (i KeyFunctions) String() string

String returns the string representation of this KeyFunctions value.

func (*KeyFunctions) UnmarshalText added in v0.0.2

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

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (KeyFunctions) Values added in v0.0.2

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

Values returns all possible values for the type KeyFunctions.

type KeyMapItem

type KeyMapItem struct {

	// the key chord sequence that activates a function
	Keys KeySeq

	// the function of that key
	Fun KeyFunctions
}

KeyMapItem records one element of the key map -- used for organizing the map.

type KeyMapName

type KeyMapName string

KeyMapName has an associated ValueView for selecting from the list of available key map names, for use in settings etc.

var ActiveKeyMapName KeyMapName

ActiveKeyMapName is the name of the active keymap

func (KeyMapName) Value

func (kn KeyMapName) Value() views.Value

Value registers KeyMapValue as the views.Value for KeyMapName.

type KeyMapValue

type KeyMapValue struct {
	views.ValueBase[*core.Button]
}

KeyMapValue represents a KeyMapName value with a button.

func (*KeyMapValue) Config added in v0.0.1

func (v *KeyMapValue) Config()

func (*KeyMapValue) ConfigDialog

func (vv *KeyMapValue) ConfigDialog(d *core.Body) (bool, func())

func (*KeyMapValue) Update added in v0.0.1

func (v *KeyMapValue) Update()

type KeyMaps

type KeyMaps []KeyMapsItem //types:add

KeyMaps is a list of KeyMap's -- users can edit these in Settings -- to create a custom one, just duplicate an existing map, rename, and customize

var AvailableKeyMaps KeyMaps

AvailableKeyMaps is the current list of available keymaps for use -- can be loaded / saved / edited with settings. This is set to StdKeyMaps at startup.

func (*KeyMaps) CopyFrom

func (km *KeyMaps) CopyFrom(cp KeyMaps)

CopyFrom copies keymaps from given other map

func (*KeyMaps) MapByName

func (km *KeyMaps) MapByName(name KeyMapName) (*KeySeqMap, int, bool)

MapByName returns a keymap and index by name -- returns false and emits a message to stdout if not found

func (*KeyMaps) Open

func (km *KeyMaps) Open(filename core.Filename) error

Open opens keymaps from a json-formatted file.

func (*KeyMaps) OpenSettings

func (km *KeyMaps) OpenSettings() error

OpenSettings opens the KeyMaps from the app settings directory, using KeyMapSettingsFilename.

func (*KeyMaps) RevertToStandard added in v0.0.2

func (km *KeyMaps) RevertToStandard()

RevertToStandard reverts this map to using the StdKeyMaps that are compiled into the program and have all the lastest key functions bound to standard values. If you have edited your maps, and are finding things not working, it is a good idea to save your current maps and try this, or at least do ViewStdMaps to see the current standards. <b>Your current map edits will be lost if you proceed!</b>

func (*KeyMaps) Save

func (km *KeyMaps) Save(filename core.Filename) error

Save saves keymaps to a json-formatted file.

func (*KeyMaps) SaveSettings added in v0.0.2

func (km *KeyMaps) SaveSettings() error

SaveSettings saves the KeyMaps to the app setttings directory, using KeyMapSettingsFilename.

func (*KeyMaps) ViewStandard added in v0.0.2

func (km *KeyMaps) ViewStandard()

ViewStandard shows the standard maps that are compiled into the program and have all the lastest key functions bound to standard values. Useful for comparing against custom maps.

type KeyMapsItem

type KeyMapsItem struct {

	// name of keymap
	Name string `width:"20"`

	// description of keymap -- good idea to include source it was derived from
	Desc string

	// to edit key sequence click button and type new key combination; to edit function mapped to key sequence choose from menu
	Map KeySeqMap
}

KeyMapsItem is an entry in a KeyMaps list

func (KeyMapsItem) Label

func (km KeyMapsItem) Label() string

Label satisfies the Labeler interface

type KeySeq

type KeySeq struct {
	Key1 key.Chord // first key
	Key2 key.Chord // second key (optional)
}

KeySeq defines a multiple-key sequence to initiate a key function

func ChordForFunction added in v0.0.2

func ChordForFunction(kf KeyFunctions) KeySeq

ChordForFunction returns first key sequence trigger for given KeyFunctions in ActiveKeyMap

func (KeySeq) Label

func (kf KeySeq) Label() string

Label satisfies core.Labeler interface

func (KeySeq) MarshalText

func (kf KeySeq) MarshalText() ([]byte, error)

MarshalText is required for encoding of struct keys

func (KeySeq) String

func (kf KeySeq) String() string

String() satisfies fmt.Stringer interface

func (*KeySeq) UnmarshalText

func (kf *KeySeq) UnmarshalText(b []byte) error

UnmarshalText is required for decoding of struct keys

type KeySeqMap

type KeySeqMap map[KeySeq]KeyFunctions

KeySeqMap is a map between a multi-key sequence (multiple chords) and a specific key function. This mapping must be unique, in that each chord has a unique key function, but multiple chords can trigger the same function.

var ActiveKeyMap *KeySeqMap

ActiveKeyMap points to the active map -- users can set this to an alternative map in Settings

func (*KeySeqMap) ChordForFunction added in v0.0.2

func (km *KeySeqMap) ChordForFunction(kf KeyFunctions) KeySeq

ChordForFunction returns first key sequence trigger for given KeyFunctions in map

func (*KeySeqMap) ToSlice

func (km *KeySeqMap) ToSlice() []KeyMapItem

ToSlice copies this keymap to a slice of KeyMapItem's

func (*KeySeqMap) Update

func (km *KeySeqMap) Update(kmName KeyMapName)

Update ensures that the given keymap has at least one entry for every defined KeyFunctions, grabbing ones from the default map if not, and also eliminates any Nil entries which might reflect out-of-date functions

type LangOpts

type LangOpts struct {

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

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

type Langs

type Langs map[fileinfo.Known]*LangOpts

Langs is a map of language options

var AvailableLangs Langs

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

func (*Langs) CopyFrom

func (lt *Langs) CopyFrom(cp Langs)

CopyFrom copies languages from given other map

func (*Langs) Open

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

Open opens languages from a toml-formatted file.

func (*Langs) OpenSettings

func (lt *Langs) OpenSettings() error

OpenSettings opens the Langs from the app settings directory, using LangSettingsFilename.

func (*Langs) RevertToStandard added in v0.0.2

func (lt *Langs) RevertToStandard()

RevertToStandard reverts this map to using the StdLangs that are compiled into the program and have all the lastest standards.

func (*Langs) Save

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

Save saves languages to a toml-formatted file.

func (*Langs) SaveSettings added in v0.0.2

func (lt *Langs) SaveSettings() error

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

func (Langs) Validate

func (lt Langs) Validate() bool

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

func (*Langs) ViewStandard added in v0.0.2

func (lt *Langs) ViewStandard()

ViewStandard shows the standard langs 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 added in v0.0.2

func (on *OpenNodes) DeleteIndex(idx int)

DeleteIndex deletes at given index

func (*OpenNodes) FindPath added in v0.0.1

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 added in v0.0.2

type ProjectSettings struct {

	// file view settings
	Files FileSettings

	// editor settings
	Editor core.EditorSettings `view:"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 `ext:".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 `view:"-"`

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

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

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

	// current splitter splits
	Splits []float32 `view:"-"`
}

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

func (*ProjectSettings) Open added in v0.0.2

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

Open open from file

func (*ProjectSettings) RunExecIsExec added in v0.0.2

func (se *ProjectSettings) RunExecIsExec() bool

RunExecIsExec returns true if the RunExec is actually executable

func (*ProjectSettings) Save added in v0.0.2

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

Save save to file

func (*ProjectSettings) Update added in v0.0.2

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() views.Value

Value registers RegisterValue as the views.Value for RegisterName.

type RegisterValue

type RegisterValue struct {
	views.ValueBase[*core.Button]
}

RegisterValue represents a RegisterName value with a button.

func (*RegisterValue) Config added in v0.0.1

func (v *RegisterValue) Config()

func (*RegisterValue) OpenDialog

func (v *RegisterValue) OpenDialog(ctx core.Widget, fun func())

func (*RegisterValue) Update added in v0.0.1

func (v *RegisterValue) Update()

type Registers

type Registers map[string]string

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 added in v0.0.2

func (lt *Registers) SaveSettings() error

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

type SettingsData

type SettingsData struct {
	core.SettingsBase

	// file view 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

	// key map for code-specific keyboard sequences
	KeyMap KeyMapName

	// if set, the current available set of key maps is saved to your settings directory, and automatically loaded at startup -- this should be set if you are using custom key maps, but it may be safer to keep it <i>OFF</i> if you are <i>not</i> using custom key maps, so that you'll always have the latest compiled-in standard key maps with all the current key functions bound to standard key chords
	SaveKeyMaps bool

	// 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) ConfigToolbar added in v0.0.1

func (se *SettingsData) ConfigToolbar(tb *core.Toolbar)

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

func (se *SettingsData) EditKeyMaps()

EditKeyMaps opens the KeyMapsView editor to create new keymaps / save / load from other files, etc. Current avail keymaps are saved and loaded with settings automatically.

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

func (se *SettingsData) Open() error

func (*SettingsData) Save

func (se *SettingsData) Save() error

type SpellView

type SpellView struct {
	core.Layout

	// 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
}

SpellView is a widget that displays results of spell check

func NewSpellView

func NewSpellView(parent tree.Node, name ...string) *SpellView

NewSpellView adds a new SpellView with the given name to the given parent: SpellView is a widget that displays results of spell check

func (*SpellView) AcceptSuggestion

func (sv *SpellView) AcceptSuggestion(s string)

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

func (*SpellView) ChangeAct

func (sv *SpellView) ChangeAct() *core.Button

ChangeAct returns the spell change action from toolbar

func (*SpellView) ChangeAction

func (sv *SpellView) ChangeAction()

ChangeAction replaces the known word with the selected suggested word and call CheckNextAction

func (*SpellView) ChangeAllAct

func (sv *SpellView) ChangeAllAct() *core.Button

ChangeAllAct returns the spell change action from toolbar

func (*SpellView) ChangeAllAction

func (sv *SpellView) ChangeAllAction()

ChangeAllAction replaces the known word with the selected suggested word and call CheckNextAction

func (*SpellView) ChangeBar

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

ChangeBar returns the suggest toolbar

func (*SpellView) ChangeText

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

ChangeText returns the unknown word textfield from toolbar

func (*SpellView) CheckNext

func (sv *SpellView) CheckNext()

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

func (*SpellView) ConfigSpellView

func (sv *SpellView) ConfigSpellView(ge Code, atv *TextEditor)

Config configures the view

func (*SpellView) ConfigToolbar

func (sv *SpellView) ConfigToolbar()

ConfigToolbar adds toolbar.

func (*SpellView) Destroy

func (sv *SpellView) Destroy()

func (*SpellView) IgnoreAct

func (sv *SpellView) IgnoreAct() *core.Button

IgnoreAct returns the ignore action from toolbar

func (*SpellView) IgnoreAction

func (sv *SpellView) IgnoreAction()

IgnoreAction will skip this and future instances of misspelled/unknown word and call CheckNextAction

func (*SpellView) LearnAct

func (sv *SpellView) LearnAct() *core.Button

LearnAct returns the learn action from toolbar

func (*SpellView) LearnAction

func (sv *SpellView) LearnAction()

LearnAction will add the current unknown word to corpus and call CheckNext

func (*SpellView) New

func (t *SpellView) New() tree.Node

New returns a new *SpellView value

func (*SpellView) NodeType added in v0.0.2

func (t *SpellView) NodeType() *types.Type

NodeType returns the *types.Type of SpellView

func (*SpellView) SetCode

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

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

func (*SpellView) SetCurIndex added in v0.0.2

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

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

func (*SpellView) SetCurLn

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

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

func (*SpellView) SetErrs

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

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

func (*SpellView) SetLastAction

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

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

func (*SpellView) SetSuggest

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

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

func (*SpellView) SetText

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

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

func (*SpellView) SetTooltip

func (t *SpellView) SetTooltip(v string) *SpellView

SetTooltip sets the [SpellView.Tooltip]

func (*SpellView) SetUnkLex

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

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

func (*SpellView) SetUnkWord

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

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

func (*SpellView) SkipAct

func (sv *SpellView) SkipAct() *core.Button

SkipAct returns the skip action from toolbar

func (*SpellView) SkipAction

func (sv *SpellView) SkipAction()

SkipAction will skip this single instance of misspelled/unknown word and call CheckNextAction

func (*SpellView) SpellAction

func (sv *SpellView) SpellAction()

SpellAction runs a new spell check with current params

func (*SpellView) SpellBar

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

SpellBar returns the spell toolbar

func (*SpellView) SuggestView

func (sv *SpellView) SuggestView() *views.SliceView

SuggestView returns the view for the list of suggestions

func (*SpellView) TrainAction

func (sv *SpellView) TrainAction()

TrainAction allows you to train on additional text files and also to rebuild the spell model

func (*SpellView) UnkEndPos

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

UnkEndPos returns the end position of the current unknown word

func (*SpellView) UnkStartPos

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

UnkStartPos returns the start position of the current unknown word

func (*SpellView) UnknownBar

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

UnknownBar returns the toolbar that displays the unknown word

func (*SpellView) UnknownText

func (sv *SpellView) 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 []float32 `min:"0" max:"1" step:".05" fixed-len:"4"`
}

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() views.Value

Value registers SplitValue as the views.Value for SplitName.

type SplitValue

type SplitValue struct {
	views.ValueBase[*core.Button]
}

SplitValue represents a SplitName value with a button.

func (*SplitValue) Config added in v0.0.1

func (v *SplitValue) Config()

func (*SplitValue) OpenDialog

func (v *SplitValue) OpenDialog(ctx core.Widget, fun func())

func (*SplitValue) Update added in v0.0.1

func (v *SplitValue) Update()

type Splits

type Splits []*Split

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) (*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) FixLen

func (lt *Splits) FixLen()

FixLen ensures that there are exactly 4 splits in each

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 added in v0.0.2

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 StackView

type StackView struct {
	core.Layout

	// if true, this is a find frames, not a regular stack
	FindFrames bool
}

StackView is a view of the stack trace

func NewStackView

func NewStackView(parent tree.Node, name ...string) *StackView

NewStackView adds a new StackView with the given name to the given parent: StackView is a view of the stack trace

func (*StackView) ConfigStackView

func (sv *StackView) ConfigStackView(dv *DebugView, findFrames bool)

func (*StackView) DebugVw

func (sv *StackView) DebugVw() *DebugView

func (*StackView) New

func (t *StackView) New() tree.Node

New returns a new *StackView value

func (*StackView) NodeType added in v0.0.2

func (t *StackView) NodeType() *types.Type

NodeType returns the *types.Type of StackView

func (*StackView) SetFindFrames

func (t *StackView) SetFindFrames(v bool) *StackView

SetFindFrames sets the [StackView.FindFrames]: if true, this is a find frames, not a regular stack

func (*StackView) SetTooltip

func (t *StackView) SetTooltip(v string) *StackView

SetTooltip sets the [StackView.Tooltip]

func (*StackView) ShowStack

func (sv *StackView) ShowStack()

ShowStack triggers update of view of State.Stack

func (*StackView) TableView

func (sv *StackView) TableView() *views.TableView

TableView returns the tableview

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, name ...string) *SymNode

NewSymNode adds a new SymNode with the given name to the given 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) New

func (t *SymNode) New() tree.Node

New returns a new *SymNode value

func (*SymNode) NodeType added in v0.0.2

func (t *SymNode) NodeType() *types.Type

NodeType returns the *types.Type of SymNode

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 SymTreeView

type SymTreeView struct {
	views.TreeView
}

SymTreeView is a TreeView that knows how to operate on FileNode nodes

func NewSymTreeView

func NewSymTreeView(parent tree.Node, name ...string) *SymTreeView

NewSymTreeView adds a new SymTreeView with the given name to the given parent: SymTreeView is a TreeView that knows how to operate on FileNode nodes

func (*SymTreeView) New

func (t *SymTreeView) New() tree.Node

New returns a new *SymTreeView value

func (*SymTreeView) NodeType added in v0.0.2

func (t *SymTreeView) NodeType() *types.Type

NodeType returns the *types.Type of SymTreeView

func (*SymTreeView) OnInit

func (st *SymTreeView) OnInit()

func (*SymTreeView) SetIcon

func (t *SymTreeView) SetIcon(v icons.Icon) *SymTreeView

SetIcon sets the [SymTreeView.Icon]

func (*SymTreeView) SetIconClosed added in v0.0.1

func (t *SymTreeView) SetIconClosed(v icons.Icon) *SymTreeView

SetIconClosed sets the [SymTreeView.IconClosed]

func (*SymTreeView) SetIconLeaf added in v0.0.1

func (t *SymTreeView) SetIconLeaf(v icons.Icon) *SymTreeView

SetIconLeaf sets the [SymTreeView.IconLeaf]

func (*SymTreeView) SetIconOpen added in v0.0.1

func (t *SymTreeView) SetIconOpen(v icons.Icon) *SymTreeView

SetIconOpen sets the [SymTreeView.IconOpen]

func (*SymTreeView) SetIndent

func (t *SymTreeView) SetIndent(v units.Value) *SymTreeView

SetIndent sets the [SymTreeView.Indent]

func (*SymTreeView) SetOpenDepth

func (t *SymTreeView) SetOpenDepth(v int) *SymTreeView

SetOpenDepth sets the [SymTreeView.OpenDepth]

func (*SymTreeView) SetRootView

func (t *SymTreeView) SetRootView(v *views.TreeView) *SymTreeView

SetRootView sets the [SymTreeView.RootView]

func (*SymTreeView) SetSelectedNodes

func (t *SymTreeView) SetSelectedNodes(v ...views.TreeViewer) *SymTreeView

SetSelectedNodes sets the [SymTreeView.SelectedNodes]

func (*SymTreeView) SetSymIcon

func (st *SymTreeView) SetSymIcon()

func (*SymTreeView) SetText

func (t *SymTreeView) SetText(v string) *SymTreeView

SetText sets the [SymTreeView.Text]

func (*SymTreeView) SetTooltip

func (t *SymTreeView) SetTooltip(v string) *SymTreeView

SetTooltip sets the [SymTreeView.Tooltip]

func (*SymTreeView) SetViewIndex added in v0.0.2

func (t *SymTreeView) SetViewIndex(v int) *SymTreeView

SetViewIndex sets the [SymTreeView.ViewIndex]

func (*SymTreeView) SetWidgetSize

func (t *SymTreeView) SetWidgetSize(v math32.Vector2) *SymTreeView

SetWidgetSize sets the [SymTreeView.WidgetSize]

func (*SymTreeView) SymNode

func (st *SymTreeView) SymNode() *SymNode

SymNode returns the SrcNode as a *code* SymNode

func (*SymTreeView) UpdateBranchIcons

func (st *SymTreeView) UpdateBranchIcons()

type SymbolsParams

type SymbolsParams struct {

	// scope of symbols to list
	Scope SymScopes
}

SymbolsParams are parameters for structure view of file or package

type SymbolsView

type SymbolsView struct {
	core.Layout

	// 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
}

SymbolsView is a widget that displays results of a file or package parse

func NewSymbolsView

func NewSymbolsView(parent tree.Node, name ...string) *SymbolsView

NewSymbolsView adds a new SymbolsView with the given name to the given parent: SymbolsView is a widget that displays results of a file or package parse

func (*SymbolsView) ConfigSymbolsView

func (sv *SymbolsView) ConfigSymbolsView(ge Code, sp SymbolsParams)

Config configures the view

func (*SymbolsView) ConfigToolbar

func (sv *SymbolsView) ConfigToolbar()

ConfigToolbar adds toolbar.

func (*SymbolsView) ConfigTree

func (sv *SymbolsView) ConfigTree(scope SymScopes)

ConfigTree adds a treeview to the symbolsview. This is called for refresh action.

func (*SymbolsView) Frame

func (sv *SymbolsView) Frame() *core.Frame

Toolbar returns the spell toolbar

func (*SymbolsView) New

func (t *SymbolsView) New() tree.Node

New returns a new *SymbolsView value

func (*SymbolsView) NodeType added in v0.0.2

func (t *SymbolsView) NodeType() *types.Type

NodeType returns the *types.Type of SymbolsView

func (*SymbolsView) OpenFile

func (sv *SymbolsView) OpenFile()

OpenFile opens file-level symbols for current active texteditor

func (*SymbolsView) OpenPackage

func (sv *SymbolsView) OpenPackage()

OpenPackage opens package-level symbols for current active texteditor

func (*SymbolsView) Params

func (sv *SymbolsView) Params() *SymbolsParams

Params returns the symbols params

func (*SymbolsView) RefreshAction

func (sv *SymbolsView) RefreshAction()

RefreshAction loads symbols for current file and scope

func (*SymbolsView) ScopeChooser

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

ScopeChooser returns the scope Chooser

func (*SymbolsView) SearchText

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

SearchText returns the unknown word textfield from toolbar

func (*SymbolsView) SetCode

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

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

func (*SymbolsView) SetMatch

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

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

func (*SymbolsView) SetSymParams

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

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

func (*SymbolsView) SetSyms

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

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

func (*SymbolsView) SetTooltip

func (t *SymbolsView) SetTooltip(v string) *SymbolsView

SetTooltip sets the [SymbolsView.Tooltip]

func (*SymbolsView) Toolbar

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

Toolbar returns the symbols toolbar

type TaskView

type TaskView struct {
	core.Layout
}

TaskView is a view of the threads

func NewTaskView

func NewTaskView(parent tree.Node, name ...string) *TaskView

NewTaskView adds a new TaskView with the given name to the given parent: TaskView is a view of the threads

func (*TaskView) ConfigTaskView

func (sv *TaskView) ConfigTaskView(dv *DebugView)

func (*TaskView) DebugVw

func (sv *TaskView) DebugVw() *DebugView

func (*TaskView) New

func (t *TaskView) New() tree.Node

New returns a new *TaskView value

func (*TaskView) NodeType added in v0.0.2

func (t *TaskView) NodeType() *types.Type

NodeType returns the *types.Type of TaskView

func (*TaskView) SetTooltip

func (t *TaskView) SetTooltip(v string) *TaskView

SetTooltip sets the [TaskView.Tooltip]

func (*TaskView) ShowTasks

func (sv *TaskView) ShowTasks()

ShowTasks triggers update of view of State.Tasks

func (*TaskView) TableView

func (sv *TaskView) TableView() *views.TableView

TableView returns the tableview

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, name ...string) *TextEditor

NewTextEditor adds a new TextEditor with the given name to the given 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() (*DebugView, 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) HandleEvents

func (ed *TextEditor) HandleEvents()

HandleEvents sets connections between mouse and key events and actions

func (*TextEditor) HasBreakpoint

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

HasBreakpoint checks if line has a breakpoint

func (*TextEditor) LineNoDoubleClick

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

LineNoDoubleClick processes double-clicks on the line-number section

func (*TextEditor) New

func (t *TextEditor) New() tree.Node

New returns a new *TextEditor value

func (*TextEditor) NodeType added in v0.0.2

func (t *TextEditor) NodeType() *types.Type

NodeType returns the *types.Type of TextEditor

func (*TextEditor) OnInit

func (ed *TextEditor) OnInit()

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

func (t *TextEditor) SetCursorColor(v image.Image) *TextEditor

SetCursorColor sets the [TextEditor.CursorColor]

func (*TextEditor) SetCursorWidth

func (t *TextEditor) SetCursorWidth(v units.Value) *TextEditor

SetCursorWidth sets the [TextEditor.CursorWidth]

func (*TextEditor) SetHighlightColor

func (t *TextEditor) SetHighlightColor(v image.Image) *TextEditor

SetHighlightColor sets the [TextEditor.HighlightColor]

func (*TextEditor) SetLineNumberColor

func (t *TextEditor) SetLineNumberColor(v image.Image) *TextEditor

SetLineNumberColor sets the [TextEditor.LineNumberColor]

func (*TextEditor) SetLinkHandler

func (t *TextEditor) SetLinkHandler(v func(tl *paint.TextLink)) *TextEditor

SetLinkHandler sets the [TextEditor.LinkHandler]

func (*TextEditor) SetSelectColor

func (t *TextEditor) SetSelectColor(v image.Image) *TextEditor

SetSelectColor sets the [TextEditor.SelectColor]

func (*TextEditor) SetStyles

func (ed *TextEditor) SetStyles()

func (*TextEditor) SetTooltip

func (t *TextEditor) SetTooltip(v string) *TextEditor

SetTooltip sets the [TextEditor.Tooltip]

func (*TextEditor) ToggleBreakpoint

func (ed *TextEditor) ToggleBreakpoint(ln int)

type ThreadView

type ThreadView struct {
	core.Layout
}

ThreadView is a view of the threads

func NewThreadView

func NewThreadView(parent tree.Node, name ...string) *ThreadView

NewThreadView adds a new ThreadView with the given name to the given parent: ThreadView is a view of the threads

func (*ThreadView) ConfigThreadView

func (sv *ThreadView) ConfigThreadView(dv *DebugView)

func (*ThreadView) DebugVw

func (sv *ThreadView) DebugVw() *DebugView

func (*ThreadView) New

func (t *ThreadView) New() tree.Node

New returns a new *ThreadView value

func (*ThreadView) NodeType added in v0.0.2

func (t *ThreadView) NodeType() *types.Type

NodeType returns the *types.Type of ThreadView

func (*ThreadView) SetTooltip

func (t *ThreadView) SetTooltip(v string) *ThreadView

SetTooltip sets the [ThreadView.Tooltip]

func (*ThreadView) ShowThreads

func (sv *ThreadView) ShowThreads()

ShowThreads triggers update of view of State.Threads

func (*ThreadView) TableView

func (sv *ThreadView) TableView() *views.TableView

TableView returns the tableview

type VarView

type VarView struct {
	core.Frame

	// variable being edited
	Var *cdebug.Variable `set:"-"`

	SelectVar *cdebug.Variable `set:"-"`

	// frame info
	FrameInfo string `set:"-"`

	// parent DebugView
	DbgView *DebugView `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, name ...string) *VarView

NewVarView adds a new VarView with the given name to the given 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 *DebugView) *VarView

VarViewDialog opens an interactive editor of the given variable.

func (*VarView) ConfigSplits

func (vv *VarView) ConfigSplits()

ConfigSplits configures the Splits.

func (*VarView) ConfigToolbar

func (vv *VarView) ConfigToolbar(tb *core.Toolbar)

func (*VarView) ConfigVarView

func (vv *VarView) ConfigVarView()

Config configures the widget

func (*VarView) New

func (t *VarView) New() tree.Node

New returns a new *VarView value

func (*VarView) NodeType added in v0.0.2

func (t *VarView) NodeType() *types.Type

NodeType returns the *types.Type of VarView

func (*VarView) SetDbgView

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

SetDbgView sets the [VarView.DbgView]: parent DebugView

func (*VarView) SetFrameInfo

func (vv *VarView) SetFrameInfo(finfo string)

SetFrameInfo sets the frame info

func (*VarView) SetTooltip

func (t *VarView) SetTooltip(v string) *VarView

SetTooltip sets the [VarView.Tooltip]

func (*VarView) SetVar

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

SetVar sets the source variable and ensures configuration

func (*VarView) Splits added in v0.0.1

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

Splits returns the main Splits

func (*VarView) StructView

func (vv *VarView) StructView() *views.StructView

StructView returns the main StructView

func (*VarView) TreeView

func (vv *VarView) TreeView() *views.TreeView

TreeView returns the main TreeView

type VarsView

type VarsView struct {
	core.Layout

	// if true, this is global vars, not local ones
	GlobalVars bool
}

VarsView is a view of the variables

func NewVarsView

func NewVarsView(parent tree.Node, name ...string) *VarsView

NewVarsView adds a new VarsView with the given name to the given parent: VarsView is a view of the variables

func (*VarsView) ConfigVarsView

func (sv *VarsView) ConfigVarsView(dv *DebugView, globalVars bool)

func (*VarsView) DebugVw

func (sv *VarsView) DebugVw() *DebugView

func (*VarsView) New

func (t *VarsView) New() tree.Node

New returns a new *VarsView value

func (*VarsView) NodeType added in v0.0.2

func (t *VarsView) NodeType() *types.Type

NodeType returns the *types.Type of VarsView

func (*VarsView) SetGlobalVars

func (t *VarsView) SetGlobalVars(v bool) *VarsView

SetGlobalVars sets the [VarsView.GlobalVars]: if true, this is global vars, not local ones

func (*VarsView) SetTooltip

func (t *VarsView) SetTooltip(v string) *VarsView

SetTooltip sets the [VarsView.Tooltip]

func (*VarsView) ShowVars

func (sv *VarsView) ShowVars()

ShowVars triggers update of view of State.Vars

func (*VarsView) TableView

func (sv *VarsView) TableView() *views.TableView

TableView returns the tableview

Jump to

Keyboard shortcuts

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