EditorVCSInterface

package
v0.0.0-...-357ca8a Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 23 Imported by: 0

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

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 Any

type Any interface {
	gd.IsClass
	AsEditorVCSInterface() Instance
}

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 Commit

type Commit map[interface{}]interface{}

type DiffFile

type DiffFile map[interface{}]interface{}

type DiffHunk

type DiffHunk map[interface{}]interface{}

type DiffLine

type DiffLine map[interface{}]interface{}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

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

func (self *Extension[T]) AsEditorVCSInterface() Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

type ID

type ID Object.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.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

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 New

func New() Instance

func (Instance) AddDiffHunksIntoDiffFile

func (self Instance) AddDiffHunksIntoDiffFile(diff_file DiffFile, diff_hunks []DiffHunk) DiffFile

Helper function to add an array of 'diff_hunks' into a 'diff_file'.

func (Instance) AddLineDiffsIntoDiffHunk

func (self Instance) AddLineDiffsIntoDiffHunk(diff_hunk DiffHunk, line_diffs []DiffLine) DiffHunk

Helper function to add an array of 'line_diffs' into a 'diff_hunk'.

func (Instance) AsEditorVCSInterface

func (self Instance) AsEditorVCSInterface() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

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

func (self Instance) CreateDiffFile(new_file string, old_file string) DiffFile

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

func (self Instance) ID() ID

func (Instance) PopupError

func (self Instance) PopupError(msg string)

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.

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

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

type TreeArea

type TreeArea int //gd:EditorVCSInterface.TreeArea
const (
	// A commit is encountered from the commit area.
	TreeAreaCommit TreeArea = 0
	// A file is encountered from the staged area.
	TreeAreaStaged TreeArea = 1
	// A file is encountered from the unstaged area.
	TreeAreaUnstaged TreeArea = 2
)

Jump to

Keyboard shortcuts

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