Documentation
¶
Overview ¶
Defines the API that the editor uses to extract information from the underlying VCS. The implementation of this API is included in VCS plugins, which are GDExtension plugins that inherit EditorVCSInterface and are attached (on demand) to the singleton instance of EditorVCSInterface. Instead of performing the task themselves, all the virtual functions listed below are calling the internally overridden functions in the VCS plugins to provide a plug-n-play experience. A custom VCS plugin is supposed to inherit from EditorVCSInterface and override each of these virtual functions.
Index ¶
- type Advanced
- type Any
- type ChangeType
- type Commit
- type DiffFile
- type DiffHunk
- type DiffLine
- type Extension
- type ID
- type Implementation
- type Instance
- func (self Instance) AddDiffHunksIntoDiffFile(diff_file DiffFile, diff_hunks []DiffHunk) DiffFile
- func (self Instance) AddLineDiffsIntoDiffHunk(diff_hunk DiffHunk, line_diffs []DiffLine) DiffHunk
- func (self Instance) AsEditorVCSInterface() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) CreateCommit(msg string, author string, id string, unix_timestamp int, offset_minutes int) Commit
- func (self Instance) CreateDiffFile(new_file string, old_file string) DiffFile
- func (self Instance) CreateDiffHunk(old_start int, new_start int, old_lines int, new_lines int) DiffHunk
- func (self Instance) CreateDiffLine(new_line_no int, old_line_no int, content string, status string) DiffLine
- func (self Instance) CreateStatusFile(file_path string, change_type ChangeType, area TreeArea) StatusFile
- func (self Instance) ID() ID
- func (self Instance) PopupError(msg string)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) Virtual(name string) reflect.Value
- type Interface
- type StatusFile
- type TreeArea
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type ChangeType ¶
type ChangeType int //gd:EditorVCSInterface.ChangeType
const ( // A new file has been added. ChangeTypeNew ChangeType = 0 // An earlier added file has been modified. ChangeTypeModified ChangeType = 1 // An earlier added file has been renamed. ChangeTypeRenamed ChangeType = 2 // An earlier added file has been deleted. ChangeTypeDeleted ChangeType = 3 // An earlier added file has been typechanged. ChangeTypeTypechange ChangeType = 4 // A file is left unmerged. ChangeTypeUnmerged ChangeType = 5 )
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this [Extension]See Interface for methods that can be overridden by T.
func (*Extension[T]) AsEditorVCSInterface ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Implementation ¶
type Implementation = implementation
Implementation implements Interface with empty methods.
type Instance ¶
type Instance [1]gdclass.EditorVCSInterface
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AddDiffHunksIntoDiffFile ¶
Helper function to add an array of 'diff_hunks' into a 'diff_file'.
func (Instance) AddLineDiffsIntoDiffHunk ¶
Helper function to add an array of 'line_diffs' into a 'diff_hunk'.
func (Instance) AsEditorVCSInterface ¶
func (Instance) CreateCommit ¶
func (self Instance) CreateCommit(msg string, author string, id string, unix_timestamp int, offset_minutes int) Commit
Helper function to create a commit data structure item. 'msg' is the commit message of the commit. 'author' is a single human-readable string containing all the author's details, e.g. the email and name configured in the VCS. 'id' is the identifier of the commit, in whichever format your VCS may provide an identifier to commits. 'unix_timestamp' is the UTC Unix timestamp of when the commit was created. 'offset_minutes' is the timezone offset in minutes, recorded from the system timezone where the commit was created.
func (Instance) CreateDiffFile ¶
Helper function to create a data structure for storing old and new diff file paths.
func (Instance) CreateDiffHunk ¶
func (self Instance) CreateDiffHunk(old_start int, new_start int, old_lines int, new_lines int) DiffHunk
Helper function to create a data structure for storing diff hunk data. 'old_start' is the starting line number in old file. 'new_start' is the starting line number in new file. 'old_lines' is the number of lines in the old file. 'new_lines' is the number of lines in the new file.
func (Instance) CreateDiffLine ¶
func (self Instance) CreateDiffLine(new_line_no int, old_line_no int, content string, status string) DiffLine
Helper function to create a data structure for storing a line diff. 'new_line_no' is the line number in the new file (can be -1 if the line is deleted). 'old_line_no' is the line number in the old file (can be -1 if the line is added). 'content' is the diff text. 'status' is a single character string which stores the line origin.
func (Instance) CreateStatusFile ¶
func (self Instance) CreateStatusFile(file_path string, change_type ChangeType, area TreeArea) StatusFile
Helper function to create a data structure used by editor to read the status of a file.
func (Instance) PopupError ¶
Pops up an error message in the editor which is shown as coming from the underlying VCS. Use this to show VCS specific error messages.
type Interface ¶
type Interface interface { // Initializes the VCS plugin when called from the editor. Returns whether or not the plugin was successfully initialized. A VCS project is initialized at 'project_path'. Initialize(project_path string) bool // Set user credentials in the underlying VCS. 'username' and 'password' are used only during HTTPS authentication unless not already mentioned in the remote URL. 'ssh_public_key_path', 'ssh_private_key_path', and 'ssh_passphrase' are only used during SSH authentication. SetCredentials(username string, password string, ssh_public_key_path string, ssh_private_key_path string, ssh_passphrase string) // Returns an slice of data structure items (see [CreateStatusFile]), each containing the status data of every modified file in the project folder. // // [CreateStatusFile]: https://pkg.go.dev/graphics.gd/classdb/EditorVCSInterface#Instance.CreateStatusFile GetModifiedFilesData() [][]StatusFile // Stages the file present at 'file_path' to the staged area. StageFile(file_path string) // Unstages the file present at 'file_path' from the staged area to the unstaged area. UnstageFile(file_path string) // Discards the changes made in a file present at 'file_path'. DiscardFile(file_path string) // Commits the currently staged changes and applies the commit 'msg' to the resulting commit. Commit(msg string) // Returns an array of data structure items (see [CreateDiffFile], [CreateDiffHunk], [CreateDiffLine], [AddLineDiffsIntoDiffHunk] and [AddDiffHunksIntoDiffFile]), each containing information about a diff. If 'identifier' is a file path, returns a file diff, and if it is a commit identifier, then returns a commit diff. // // [AddDiffHunksIntoDiffFile]: https://pkg.go.dev/graphics.gd/classdb/EditorVCSInterface#Instance.AddDiffHunksIntoDiffFile // [AddLineDiffsIntoDiffHunk]: https://pkg.go.dev/graphics.gd/classdb/EditorVCSInterface#Instance.AddLineDiffsIntoDiffHunk // [CreateDiffFile]: https://pkg.go.dev/graphics.gd/classdb/EditorVCSInterface#Instance.CreateDiffFile // [CreateDiffHunk]: https://pkg.go.dev/graphics.gd/classdb/EditorVCSInterface#Instance.CreateDiffHunk // [CreateDiffLine]: https://pkg.go.dev/graphics.gd/classdb/EditorVCSInterface#Instance.CreateDiffLine GetDiff(identifier string, area int) [][]DiffFile // Shuts down VCS plugin instance. Called when the user either closes the editor or shuts down the VCS plugin through the editor UI. ShutDown() bool // Returns the name of the underlying VCS provider. GetVcsName() string // Returns an slice of data structure items (see [CreateCommit]), each containing the data for a past commit. // // [CreateCommit]: https://pkg.go.dev/graphics.gd/classdb/EditorVCSInterface#Instance.CreateCommit GetPreviousCommits(max_commits int) [][]Commit // Gets an instance of an slice of strings containing available branch names in the VCS. GetBranchList() []string // Returns an slice of strings, each containing the name of a remote configured in the VCS. GetRemotes() []string // Creates a new branch named 'branch_name' in the VCS. CreateBranch(branch_name string) // Remove a branch from the local VCS. RemoveBranch(branch_name string) // Creates a new remote destination with name 'remote_name' and points it to 'remote_url'. This can be an HTTPS remote or an SSH remote. CreateRemote(remote_name string, remote_url string) // Remove a remote from the local VCS. RemoveRemote(remote_name string) // Gets the current branch name defined in the VCS. GetCurrentBranchName() string // Checks out a 'branch_name' in the VCS. CheckoutBranch(branch_name string) bool // Pulls changes from the remote. This can give rise to merge conflicts. Pull(remote string) // Pushes changes to the 'remote'. If 'force' is true, a force push will override the change history already present on the remote. Push(remote string, force bool) // Fetches new changes from the 'remote', but doesn't write changes to the current working directory. Equivalent to git fetch. Fetch(remote string) // Returns an slice of data structure items (see [CreateDiffHunk]), each containing a line diff between a file at 'file_path' and the 'text' which is passed in. // // [CreateDiffHunk]: https://pkg.go.dev/graphics.gd/classdb/EditorVCSInterface#Instance.CreateDiffHunk GetLineDiff(file_path string, text string) [][]DiffLine }
type StatusFile ¶
type StatusFile map[interface{}]interface{}