EditorVCSInterface

package
v0.0.0-...-80877a9 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package EditorVCSInterface provides methods for working with EditorVCSInterface object instances.

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 = gdclass.EditorVCSInterfaceChangeType //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 Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.EditorVCSInterface

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.

See [Interface] for methods that can be overridden by a [Class] that extends it.

%!(EXTRA string=EditorVCSInterface)

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 [param diff_hunks] into a [param diff_file].

func (Instance) AddLineDiffsIntoDiffHunk

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

Helper function to add an array of [param line_diffs] into a [param 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 [Dictionary] item. [param msg] is the commit message of the commit. [param author] is a single human-readable string containing all the author's details, e.g. the email and name configured in the VCS. [param id] is the identifier of the commit, in whichever format your VCS may provide an identifier to commits. [param unix_timestamp] is the UTC Unix timestamp of when the commit was created. [param 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 [Dictionary] 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 [Dictionary] for storing diff hunk data. [param old_start] is the starting line number in old file. [param new_start] is the starting line number in new file. [param old_lines] is the number of lines in the old file. [param 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 [Dictionary] for storing a line diff. [param new_line_no] is the line number in the new file (can be [code]-1[/code] if the line is deleted). [param old_line_no] is the line number in the old file (can be [code]-1[/code] if the line is added). [param content] is the diff text. [param status] is a single character string which stores the line origin.

func (Instance) CreateStatusFile

func (self Instance) CreateStatusFile(file_path string, change_type gdclass.EditorVCSInterfaceChangeType, area gdclass.EditorVCSInterfaceTreeArea) StatusFile

Helper function to create a [Dictionary] used by editor to read the status of a file.

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

func (self *Instance) UnsafePointer() unsafe.Pointer

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 [param project_path].
	Initialize(project_path string) bool
	//Set user credentials in the underlying VCS. [param username] and [param password] are used only during HTTPS authentication unless not already mentioned in the remote URL. [param ssh_public_key_path], [param ssh_private_key_path], and [param 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 [Array] of [Dictionary] items (see [method create_status_file]), each containing the status data of every modified file in the project folder.
	GetModifiedFilesData() []map[any]any
	//Stages the file present at [param file_path] to the staged area.
	StageFile(file_path string)
	//Unstages the file present at [param file_path] from the staged area to the unstaged area.
	UnstageFile(file_path string)
	//Discards the changes made in a file present at [param file_path].
	DiscardFile(file_path string)
	//Commits the currently staged changes and applies the commit [param msg] to the resulting commit.
	Commit(msg string)
	//Returns an array of [Dictionary] items (see [method create_diff_file], [method create_diff_hunk], [method create_diff_line], [method add_line_diffs_into_diff_hunk] and [method add_diff_hunks_into_diff_file]), each containing information about a diff. If [param identifier] is a file path, returns a file diff, and if it is a commit identifier, then returns a commit diff.
	GetDiff(identifier string, area int) []map[any]any
	//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 [Array] of [Dictionary] items (see [method create_commit]), each containing the data for a past commit.
	GetPreviousCommits(max_commits int) []map[any]any
	//Gets an instance of an [Array] of [String]s containing available branch names in the VCS.
	GetBranchList() []string
	//Returns an [Array] of [String]s, each containing the name of a remote configured in the VCS.
	GetRemotes() []string
	//Creates a new branch named [param 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 [param remote_name] and points it to [param 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 [param 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 [param remote]. If [param force] is [code]true[/code], a force push will override the change history already present on the remote.
	Push(remote string, force bool)
	//Fetches new changes from the [param remote], but doesn't write changes to the current working directory. Equivalent to [code]git fetch[/code].
	Fetch(remote string)
	//Returns an [Array] of [Dictionary] items (see [method create_diff_hunk]), each containing a line diff between a file at [param file_path] and the [param text] which is passed in.
	GetLineDiff(file_path string, text string) []map[any]any
}

type StatusFile

type StatusFile map[interface{}]interface{}

type TreeArea

type TreeArea = gdclass.EditorVCSInterfaceTreeArea //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