package
0.1.0
Repository: https://github.com/cogentcore/cogent.git
Documentation: pkg.go.dev

# README

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

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

Some of the main features of Code include:

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

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

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

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

Install

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

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

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

Current Status

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

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

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

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

Screenshots

Screenshot

Screenshot, darker

TODO

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

  • line number too conservative in not rendering bottom

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

  • always display cursor when typing!

  • drag-n-drop table

  • color highlighting for diff output in commandshell!

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

  • more helpers for URI api

  • filter function for chooser for URI case

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

  • Find not selecting first item (sometimes?)

  • filepicker global priority key shortcuts

  • editor rendering overflow

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

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

DONE:

# Packages

No description provided by the author
No description provided by the author
Package piv provides the PiView object for the full GUI view of the interactive parser (pi) system.

# Functions

ArgVarKeys creates a slice of string to hold the keys.
ArgVarPrompts returns any Prompt* variables required by this string, false if none.
ArgVarTypesValues returns all possible values for the type ArgVarTypes.
CheckForProjectAtPath checks if there is a .code project at the given path returns project path and true if found, otherwise false.
CmdsView opens a view of a commands table.
No description provided by the author
CodeOpenNodes gets list of open nodes for submenu-func.
CommandMenu returns a menu function for commands for given language and vcs name.
CommandName returns a qualified command name as cat: cmd.
ConfigEditorTextEditor configures an editor texteditor.
ConfigOutputTextEditor configures a command-output texteditor within given parent layout.
DebugBreakStatusValues returns all possible values for the type DebugBreakStatus.
DebugSettingsEditor opens a view of project Debug settings, returns form if not already open.
ExecCmds gets list of available commands for current active file.
LanguagesView opens a view of a languages options map.
MarkupCmdOutput applies links to the first element in command output line if it looks like a file name / position, and runs markup using given lexer name if provided (default is "bash").
No description provided by the author
No description provided by the author
MarkupStdOutput applies links to the first element in command output line if it looks like a file name / position.
MergeAvailableCmds updates the AvailCmds list from CustomCmds and StdCmds.
NewCmdButton returns a new [CmdButton] with the given optional parent: CmdButton represents a [CmdName] value with a button that opens a [CmdView].
NewCode returns a new [Code] with the given optional parent: Code is the core editor and tab viewer widget for the Code system.
NewCodeProjectPath creates a new Code window with a new Code project for given path, returning the window and the path.
NewCodeWindow is common code for Open CodeWindow from Project or Path.
NewDebugger returns a new debugger for given supported file type.
NewDebugPanel returns a new [DebugPanel] with the given optional parent: DebugPanel is the debugger panel.
NewFileNode returns a new [FileNode] with the given optional parent: FileNode is Code version of FileNode for FileTree.
NewFindPanel returns a new [FindPanel] with the given optional parent: FindPanel is a find / replace widget that displays results in a [TextEditor] and has a toolbar for controlling find / replace process.
NewSpellPanel returns a new [SpellPanel] with the given optional parent: SpellPanel is a widget that displays results of a spell check.
NewSymbolsPanel returns a new [SymbolsPanel] with the given optional parent: SymbolsPanel is a widget that displays results of a file or package parse of symbols.
NewSymNode returns a new [SymNode] with the given optional parent: SymNode represents a language symbol -- the name of the node is the name of the symbol.
NewSymTree returns a new [SymTree] with the given optional parent: SymTree is a Tree that knows how to operate on FileNode nodes.
NewTextEditor returns a new [TextEditor] with the given optional parent: TextEditor is the Code-specific version of the TextEditor, with support for setting / clearing breakpoints, etc.
NewVarView returns a new [VarView] with the given optional parent: VarView shows a debug variable in an inspector-like framework, with sub-variables in a tree.
OpenCodeProject creates a new Code window opened to given Code project, returning the window and the path.
OpenPaths loads the active SavedPaths from prefs dir.
ParentCode returns the Code parent of given node.
ProjectPathParse parses given project path into a root directory (which could be the path or just the directory portion of the path, depending in whether the path is a directory or not), and a bool if all is good (otherwise error message has been reported).
ProjectSettingsEditor opens a view of project settings, returns form if not already open.
RegistersMenu presents a menu of existing registers, calling the given function with the selected register name.
RegistersView opens a view of a commands table.
RepoCurBranches returns the current branch and a list of all branches ensuring that the current also appears on the list of all.
SavePaths saves the active SavedPaths to prefs dir.
No description provided by the author
SetGoMod applies the given gomod setting, setting the GO111MODULE env var.
SplitsView opens a view of a splits table.
SymScopesValues returns all possible values for the type SymScopes.
TextLinkHandler is the Code handler for text links -- preferred one b/c directly connects to correct Code project.
VarViewDialog opens an interactive editor of the given variable.

# Constants

ArgVarDir is a directory name, not a file.
ArgVarExt is a file extension.
ArgVarFile is a file name, not a directory.
ArgVarPos is a text position.
ArgVarPrompt is a user-prompted variable.
ArgVarText is text from a buffer.
ArgVarTypesN is the highest valid value for type ArgVarTypes, plus one.
Use these for more obvious command options.
Use these for more obvious command options.
Use these for more obvious command options.
Use these for more obvious command options.
Use these for more obvious command options.
Use these for more obvious command options.
DebugBreakActive is an active break point.
DebugBreakCurrent is the current break point.
DebugBreakInactive is an inactive break point.
DebugBreakStatusN is the highest valid value for type DebugBreakStatus, plus one.
DebugPCCurrent is the current program execution point, updated for every ShowFile action.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
These are then the fixed indices of the different elements in the splitview.
open active file in other view.
close active texteditor buffer.
save active texteditor buffer to its file.
save as active texteditor buffer to its file.
select an open buffer to edit in active texteditor.
build overall project.
comment out region.
execute a command on active texteditor buffer.
open a new file in active texteditor.
indent region.
jump to line (same as keyfun.Jump).
move to next panel to the right.
move to prev panel to the left.
copy rectangle.
cut rectangle.
paste rectangle.
copy selection to named register.
paste selection from named register.
run overall project.
set named splitter config.
NTextEditors is the number of text views to create -- to keep things simple and consistent (e.g., splitter settings always have the same number of values), we fix this degree of freedom, and have flexibility in the splitter settings for what to actually show.
SymScopeFile restricts the list of symbols to the active file.
SymScopePackage scopes list of symbols to the package of the active file.
SymScopesN is the highest valid value for type SymScopes, plus one.
These are then the fixed indices of the different elements in the splitview.
These are then the fixed indices of the different elements in the splitview.
These are then the fixed indices of the different elements in the splitview.

# Variables

ArgVars are variables that can be used for arguments to commands in CmdAndArgs.
AvailableCommands is the current list of ALL available commands for use -- it combines StdCmds and CustomCmds.
AvailableLanguages is the current set of language options -- can be loaded / saved / edited with settings.
AvailableLanguagesChanged is used to update core.LangsView toolbars via following menu, toolbar properties update methods -- not accurate if editing any other map but works for now..
AvailableRegisterNames are the names of the current AvailRegisters -- used for some choosers.
AvailableRegisters are available named registers.
AvailableRegistersChanged is used to update toolbars via following menu, toolbar properties update methods -- not accurate if editing any other map but works for now..
AvailableSplitNames are the names of the current AvailableSplits -- used for some choosers.
AvailableSplits are available named splitter settings.
AvailableSplitsChanged is used to update toolbars via following menu, toolbar properties update methods -- not accurate if editing any other map but works for now..
CatNoEdit are the files to NOT edit from categories: Doc, Data.
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.
CmdOutStatusLen is amount of command output to include in the status update.
CmdPrompt1Vals holds last values for PromptString1 per command, so that each such command has its own appropriate history.
CmdPrompt2Vals holds last values for PromptString2 per command, so that each such command has its own appropriate history.
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.
No description provided by the author
CommandSettingsFilename is the name of the settings file in the app settings directory for saving / loading your CustomCommands commands list.
CustomCommands is user-specific list of commands saved in settings available for all Code projects.
CustomCommandsChanged is used to update core.CmdsView toolbars via following menu, toolbar properties update methods.
DebugBreakColors are the colors indicating different breakpoint statuses.
DebugStatusColors contains the status colors for different debugging states.
LanguageSettingsFilename is the name of the settings file in the app settings directory for saving / loading the default [AvailableLanguages] languages list.
RecentPaths is a slice of recent file paths.
RegisterSettingsFilename is the name of the settings file in the app settings directory for saving / loading the default AvailableRegisters.
SavedPathsFilename is the name of the saved file paths file in Cogent Code data directory.
Settings are the overall Code settings.
SplitsSettingsFilename is the name of the settings file in App prefs directory for saving / loading the default AvailSplits.
StandardCommands is the original compiled-in set of standard commands.
StandardKeyMaps are the standard extended maps for Code.
StandardLanguages is the original compiled-in set of standard language options.
StandardSplits is the original compiled-in set of standard named splits.
No description provided by the author

# Structs

ArgVarInfo has info about argument variables that fill in relevant values for commands, used in ArgVars list of variables.
CmdAndArgs contains the name of an external program to execute and args to pass to that program.
CmdButton represents a [CmdName] value with a button that opens a [CmdView].
CmdRun tracks running commands.
Code is the core editor and tab viewer widget for the Code system.
Command defines different types of commands that can be run in the project.
Console redirects our os.Stdout and os.Stderr to a buffer for display within app.
DebugPanel is the debugger panel.
FileNode is Code version of FileNode for FileTree.
FileSettings contains file picker settings.
FindPanel is a find / replace widget that displays results in a [TextEditor] and has a toolbar for controlling find / replace process.
FindParams are parameters for find / replace.
LanguageOptions defines options associated with a given language / file format only languages in fileinfo.Known list are supported..
ProjectSettings are the settings for saving for a project.
SettingsData is the data type for the overall user settings for Code.
SpellPanel is a widget that displays results of a spell check.
Split is a named splitter configuration.
SymbolsPanel is a widget that displays results of a file or package parse of symbols.
SymbolsParams are parameters for structure view of file or package.
SymNode represents a language symbol -- the name of the node is the name of the symbol.
SymTree is a Tree that knows how to operate on FileNode nodes.
TextEditor is the Code-specific version of the TextEditor, with support for setting / clearing breakpoints, etc.
VarView shows a debug variable in an inspector-like framework, with sub-variables in a tree.

# Type aliases

ArgVarTypes describe the type of information in the arg var -- used for checking usage and special features.
ArgVarVals are current values of arg var vals -- updated on demand when a command is invoked.
CmdArgs is a slice of arguments for a command.
CmdName has an associated ValueView for selecting from the list of available command names, for use in settings etc.
CmdNames is a slice of command names.
CmdRuns is a slice list of running commands.
Commands is a list of different commands.
DebugBreakStatus represents the status of a certain breakpoint.
Languages is a map of language options.
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.
RegisterName has an associated ValueView for selecting from the list of available named registers.
Registers is a list of named strings.
SplitName has an associated ValueView for selecting from the list of available named splits.
Splits is a list of named splitter configurations.
SymScopes corresponds to the search scope.