|
|
@ -10,8 +10,8 @@ import { |
|
|
|
Uri, |
|
|
|
window, |
|
|
|
} from 'vscode'; |
|
|
|
import type { Action, ActionContext } from '../api/gitlens'; |
|
|
|
import { CoreCommands, CoreGitCommands } from '../constants'; |
|
|
|
import type { ActionContext } from '../api/gitlens'; |
|
|
|
import { Commands } from '../constants'; |
|
|
|
import { Container } from '../container'; |
|
|
|
import { |
|
|
|
GitBranch, |
|
|
@ -26,227 +26,6 @@ import { |
|
|
|
} from '../git/models'; |
|
|
|
import { ViewNode, ViewRefNode } from '../views/nodes'; |
|
|
|
|
|
|
|
export const enum Commands { |
|
|
|
ActionPrefix = 'gitlens.action.', |
|
|
|
AddAuthors = 'gitlens.addAuthors', |
|
|
|
BrowseRepoAtRevision = 'gitlens.browseRepoAtRevision', |
|
|
|
BrowseRepoAtRevisionInNewWindow = 'gitlens.browseRepoAtRevisionInNewWindow', |
|
|
|
BrowseRepoBeforeRevision = 'gitlens.browseRepoBeforeRevision', |
|
|
|
BrowseRepoBeforeRevisionInNewWindow = 'gitlens.browseRepoBeforeRevisionInNewWindow', |
|
|
|
ClearFileAnnotations = 'gitlens.clearFileAnnotations', |
|
|
|
CloseUnchangedFiles = 'gitlens.closeUnchangedFiles', |
|
|
|
CloseWelcomeView = 'gitlens.closeWelcomeView', |
|
|
|
CompareWith = 'gitlens.compareWith', |
|
|
|
CompareHeadWith = 'gitlens.compareHeadWith', |
|
|
|
CompareWorkingWith = 'gitlens.compareWorkingWith', |
|
|
|
ComputingFileAnnotations = 'gitlens.computingFileAnnotations', |
|
|
|
ConnectRemoteProvider = 'gitlens.connectRemoteProvider', |
|
|
|
CopyCurrentBranch = 'gitlens.copyCurrentBranch', |
|
|
|
CopyMessageToClipboard = 'gitlens.copyMessageToClipboard', |
|
|
|
CopyRemoteBranchesUrl = 'gitlens.copyRemoteBranchesUrl', |
|
|
|
CopyRemoteBranchUrl = 'gitlens.copyRemoteBranchUrl', |
|
|
|
CopyRemoteCommitUrl = 'gitlens.copyRemoteCommitUrl', |
|
|
|
CopyRemoteComparisonUrl = 'gitlens.copyRemoteComparisonUrl', |
|
|
|
CopyRemoteFileUrl = 'gitlens.copyRemoteFileUrlToClipboard', |
|
|
|
CopyRemoteFileUrlWithoutRange = 'gitlens.copyRemoteFileUrlWithoutRange', |
|
|
|
CopyRemoteFileUrlFrom = 'gitlens.copyRemoteFileUrlFrom', |
|
|
|
CopyRemoteIssueUrl = 'gitlens.copyRemoteIssueUrl', |
|
|
|
CopyRemotePullRequestUrl = 'gitlens.copyRemotePullRequestUrl', |
|
|
|
CopyRemoteRepositoryUrl = 'gitlens.copyRemoteRepositoryUrl', |
|
|
|
CopyShaToClipboard = 'gitlens.copyShaToClipboard', |
|
|
|
CreatePullRequestOnRemote = 'gitlens.createPullRequestOnRemote', |
|
|
|
DiffDirectory = 'gitlens.diffDirectory', |
|
|
|
DiffDirectoryWithHead = 'gitlens.diffDirectoryWithHead', |
|
|
|
DiffWith = 'gitlens.diffWith', |
|
|
|
DiffWithNext = 'gitlens.diffWithNext', |
|
|
|
DiffWithNextInDiffLeft = 'gitlens.diffWithNextInDiffLeft', |
|
|
|
DiffWithNextInDiffRight = 'gitlens.diffWithNextInDiffRight', |
|
|
|
DiffWithPrevious = 'gitlens.diffWithPrevious', |
|
|
|
DiffWithPreviousInDiffLeft = 'gitlens.diffWithPreviousInDiffLeft', |
|
|
|
DiffWithPreviousInDiffRight = 'gitlens.diffWithPreviousInDiffRight', |
|
|
|
DiffLineWithPrevious = 'gitlens.diffLineWithPrevious', |
|
|
|
DiffWithRevision = 'gitlens.diffWithRevision', |
|
|
|
DiffWithRevisionFrom = 'gitlens.diffWithRevisionFrom', |
|
|
|
DiffWithWorking = 'gitlens.diffWithWorking', |
|
|
|
DiffWithWorkingInDiffLeft = 'gitlens.diffWithWorkingInDiffLeft', |
|
|
|
DiffWithWorkingInDiffRight = 'gitlens.diffWithWorkingInDiffRight', |
|
|
|
DiffLineWithWorking = 'gitlens.diffLineWithWorking', |
|
|
|
DisconnectRemoteProvider = 'gitlens.disconnectRemoteProvider', |
|
|
|
DisableDebugLogging = 'gitlens.disableDebugLogging', |
|
|
|
EnableDebugLogging = 'gitlens.enableDebugLogging', |
|
|
|
DisableRebaseEditor = 'gitlens.disableRebaseEditor', |
|
|
|
EnableRebaseEditor = 'gitlens.enableRebaseEditor', |
|
|
|
ExternalDiff = 'gitlens.externalDiff', |
|
|
|
ExternalDiffAll = 'gitlens.externalDiffAll', |
|
|
|
FetchRepositories = 'gitlens.fetchRepositories', |
|
|
|
InviteToLiveShare = 'gitlens.inviteToLiveShare', |
|
|
|
OpenBlamePriorToChange = 'gitlens.openBlamePriorToChange', |
|
|
|
OpenBranchesOnRemote = 'gitlens.openBranchesOnRemote', |
|
|
|
OpenBranchOnRemote = 'gitlens.openBranchOnRemote', |
|
|
|
OpenChangedFiles = 'gitlens.openChangedFiles', |
|
|
|
OpenCommitOnRemote = 'gitlens.openCommitOnRemote', |
|
|
|
OpenComparisonOnRemote = 'gitlens.openComparisonOnRemote', |
|
|
|
OpenFileHistory = 'gitlens.openFileHistory', |
|
|
|
OpenFileFromRemote = 'gitlens.openFileFromRemote', |
|
|
|
OpenFileOnRemote = 'gitlens.openFileOnRemote', |
|
|
|
OpenFileOnRemoteFrom = 'gitlens.openFileOnRemoteFrom', |
|
|
|
OpenFileAtRevision = 'gitlens.openFileRevision', |
|
|
|
OpenFileAtRevisionFrom = 'gitlens.openFileRevisionFrom', |
|
|
|
OpenFolderHistory = 'gitlens.openFolderHistory', |
|
|
|
OpenOnRemote = 'gitlens.openOnRemote', |
|
|
|
OpenIssueOnRemote = 'gitlens.openIssueOnRemote', |
|
|
|
OpenPullRequestOnRemote = 'gitlens.openPullRequestOnRemote', |
|
|
|
OpenAssociatedPullRequestOnRemote = 'gitlens.openAssociatedPullRequestOnRemote', |
|
|
|
OpenRepoOnRemote = 'gitlens.openRepoOnRemote', |
|
|
|
OpenRevisionFile = 'gitlens.openRevisionFile', |
|
|
|
OpenRevisionFileInDiffLeft = 'gitlens.openRevisionFileInDiffLeft', |
|
|
|
OpenRevisionFileInDiffRight = 'gitlens.openRevisionFileInDiffRight', |
|
|
|
OpenWorkingFile = 'gitlens.openWorkingFile', |
|
|
|
OpenWorkingFileInDiffLeft = 'gitlens.openWorkingFileInDiffLeft', |
|
|
|
OpenWorkingFileInDiffRight = 'gitlens.openWorkingFileInDiffRight', |
|
|
|
PullRepositories = 'gitlens.pullRepositories', |
|
|
|
PushRepositories = 'gitlens.pushRepositories', |
|
|
|
GitCommands = 'gitlens.gitCommands', |
|
|
|
GitCommandsBranch = 'gitlens.gitCommands.branch', |
|
|
|
GitCommandsCherryPick = 'gitlens.gitCommands.cherryPick', |
|
|
|
GitCommandsMerge = 'gitlens.gitCommands.merge', |
|
|
|
GitCommandsRebase = 'gitlens.gitCommands.rebase', |
|
|
|
GitCommandsReset = 'gitlens.gitCommands.reset', |
|
|
|
GitCommandsRevert = 'gitlens.gitCommands.revert', |
|
|
|
GitCommandsSwitch = 'gitlens.gitCommands.switch', |
|
|
|
GitCommandsTag = 'gitlens.gitCommands.tag', |
|
|
|
QuickOpenFileHistory = 'gitlens.quickOpenFileHistory', |
|
|
|
RefreshHover = 'gitlens.refreshHover', |
|
|
|
ResetAvatarCache = 'gitlens.resetAvatarCache', |
|
|
|
ResetSuppressedWarnings = 'gitlens.resetSuppressedWarnings', |
|
|
|
RevealCommitInView = 'gitlens.revealCommitInView', |
|
|
|
SearchCommits = 'gitlens.showCommitSearch', |
|
|
|
SearchCommitsInView = 'gitlens.views.searchAndCompare.searchCommits', |
|
|
|
SetViewsLayout = 'gitlens.setViewsLayout', |
|
|
|
ShowBranchesView = 'gitlens.showBranchesView', |
|
|
|
ShowCommitInView = 'gitlens.showCommitInView', |
|
|
|
ShowCommitsInView = 'gitlens.showCommitsInView', |
|
|
|
ShowCommitsView = 'gitlens.showCommitsView', |
|
|
|
ShowContributorsView = 'gitlens.showContributorsView', |
|
|
|
ShowFileHistoryView = 'gitlens.showFileHistoryView', |
|
|
|
ShowLastQuickPick = 'gitlens.showLastQuickPick', |
|
|
|
ShowLineHistoryView = 'gitlens.showLineHistoryView', |
|
|
|
ShowQuickBranchHistory = 'gitlens.showQuickBranchHistory', |
|
|
|
ShowQuickCommit = 'gitlens.showQuickCommitDetails', |
|
|
|
ShowQuickCommitFile = 'gitlens.showQuickCommitFileDetails', |
|
|
|
ShowQuickCurrentBranchHistory = 'gitlens.showQuickRepoHistory', |
|
|
|
ShowQuickFileHistory = 'gitlens.showQuickFileHistory', |
|
|
|
ShowQuickRepoStatus = 'gitlens.showQuickRepoStatus', |
|
|
|
ShowQuickCommitRevision = 'gitlens.showQuickRevisionDetails', |
|
|
|
ShowQuickCommitRevisionInDiffLeft = 'gitlens.showQuickRevisionDetailsInDiffLeft', |
|
|
|
ShowQuickCommitRevisionInDiffRight = 'gitlens.showQuickRevisionDetailsInDiffRight', |
|
|
|
ShowQuickStashList = 'gitlens.showQuickStashList', |
|
|
|
ShowRemotesView = 'gitlens.showRemotesView', |
|
|
|
ShowRepositoriesView = 'gitlens.showRepositoriesView', |
|
|
|
ShowSearchAndCompareView = 'gitlens.showSearchAndCompareView', |
|
|
|
ShowSettingsPage = 'gitlens.showSettingsPage', |
|
|
|
ShowSettingsPageAndJumpToBranchesView = 'gitlens.showSettingsPage#branches-view', |
|
|
|
ShowSettingsPageAndJumpToCommitsView = 'gitlens.showSettingsPage#commits-view', |
|
|
|
ShowSettingsPageAndJumpToContributorsView = 'gitlens.showSettingsPage#contributors-view', |
|
|
|
ShowSettingsPageAndJumpToFileHistoryView = 'gitlens.showSettingsPage#file-history-view', |
|
|
|
ShowSettingsPageAndJumpToLineHistoryView = 'gitlens.showSettingsPage#line-history-view', |
|
|
|
ShowSettingsPageAndJumpToRemotesView = 'gitlens.showSettingsPage#remotes-view', |
|
|
|
ShowSettingsPageAndJumpToRepositoriesView = 'gitlens.showSettingsPage#repositories-view', |
|
|
|
ShowSettingsPageAndJumpToSearchAndCompareView = 'gitlens.showSettingsPage#search-compare-view', |
|
|
|
ShowSettingsPageAndJumpToStashesView = 'gitlens.showSettingsPage#stashes-view', |
|
|
|
ShowSettingsPageAndJumpToTagsView = 'gitlens.showSettingsPage#tags-view', |
|
|
|
ShowSettingsPageAndJumpToViews = 'gitlens.showSettingsPage#views', |
|
|
|
ShowStashesView = 'gitlens.showStashesView', |
|
|
|
ShowTagsView = 'gitlens.showTagsView', |
|
|
|
ShowWelcomePage = 'gitlens.showWelcomePage', |
|
|
|
ShowWelcomeView = 'gitlens.showWelcomeView', |
|
|
|
StashApply = 'gitlens.stashApply', |
|
|
|
StashSave = 'gitlens.stashSave', |
|
|
|
StashSaveFiles = 'gitlens.stashSaveFiles', |
|
|
|
SwitchMode = 'gitlens.switchMode', |
|
|
|
ToggleCodeLens = 'gitlens.toggleCodeLens', |
|
|
|
ToggleFileBlame = 'gitlens.toggleFileBlame', |
|
|
|
ToggleFileBlameInDiffLeft = 'gitlens.toggleFileBlameInDiffLeft', |
|
|
|
ToggleFileBlameInDiffRight = 'gitlens.toggleFileBlameInDiffRight', |
|
|
|
ToggleFileChanges = 'gitlens.toggleFileChanges', |
|
|
|
ToggleFileChangesOnly = 'gitlens.toggleFileChangesOnly', |
|
|
|
ToggleFileHeatmap = 'gitlens.toggleFileHeatmap', |
|
|
|
ToggleFileHeatmapInDiffLeft = 'gitlens.toggleFileHeatmapInDiffLeft', |
|
|
|
ToggleFileHeatmapInDiffRight = 'gitlens.toggleFileHeatmapInDiffRight', |
|
|
|
ToggleLineBlame = 'gitlens.toggleLineBlame', |
|
|
|
ToggleReviewMode = 'gitlens.toggleReviewMode', |
|
|
|
ToggleZenMode = 'gitlens.toggleZenMode', |
|
|
|
ViewsCopy = 'gitlens.views.copy', |
|
|
|
ViewsOpenDirectoryDiff = 'gitlens.views.openDirectoryDiff', |
|
|
|
ViewsOpenDirectoryDiffWithWorking = 'gitlens.views.openDirectoryDiffWithWorking', |
|
|
|
|
|
|
|
Deprecated_DiffHeadWith = 'gitlens.diffHeadWith', |
|
|
|
Deprecated_DiffWorkingWith = 'gitlens.diffWorkingWith', |
|
|
|
Deprecated_OpenBranchesInRemote = 'gitlens.openBranchesInRemote', |
|
|
|
Deprecated_OpenBranchInRemote = 'gitlens.openBranchInRemote', |
|
|
|
Deprecated_OpenCommitInRemote = 'gitlens.openCommitInRemote', |
|
|
|
Deprecated_OpenFileInRemote = 'gitlens.openFileInRemote', |
|
|
|
Deprecated_OpenInRemote = 'gitlens.openInRemote', |
|
|
|
Deprecated_OpenRepoInRemote = 'gitlens.openRepoInRemote', |
|
|
|
Deprecated_ShowFileHistoryInView = 'gitlens.showFileHistoryInView', |
|
|
|
} |
|
|
|
|
|
|
|
export function executeActionCommand<T extends ActionContext>(action: Action<T>, args: Omit<T, 'type'>) { |
|
|
|
return commands.executeCommand(`${Commands.ActionPrefix}${action}`, { ...args, type: action }); |
|
|
|
} |
|
|
|
|
|
|
|
export function getMarkdownActionCommand<T extends ActionContext>(action: Action<T>, args: Omit<T, 'type'>): string { |
|
|
|
return Command.getMarkdownCommandArgsCore(`${Commands.ActionPrefix}${action}`, { |
|
|
|
...args, |
|
|
|
type: action, |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
type SupportedCommands = Commands | `gitlens.views.${string}.focus` | `gitlens.views.${string}.resetViewLocation`; |
|
|
|
|
|
|
|
export function executeCommand<U = any>(command: SupportedCommands): Thenable<U>; |
|
|
|
export function executeCommand<T = unknown, U = any>(command: SupportedCommands, arg: T): Thenable<U>; |
|
|
|
export function executeCommand<T extends [...unknown[]] = [], U = any>( |
|
|
|
command: SupportedCommands, |
|
|
|
...args: T |
|
|
|
): Thenable<U>; |
|
|
|
export function executeCommand<T extends [...unknown[]] = [], U = any>( |
|
|
|
command: SupportedCommands, |
|
|
|
...args: T |
|
|
|
): Thenable<U> { |
|
|
|
return commands.executeCommand<U>(command, args); |
|
|
|
} |
|
|
|
|
|
|
|
export function executeCoreCommand<U = any>(command: CoreCommands): Thenable<U>; |
|
|
|
export function executeCoreCommand<T = unknown, U = any>(command: CoreCommands, arg: T): Thenable<U>; |
|
|
|
export function executeCoreCommand<T extends [...unknown[]] = [], U = any>( |
|
|
|
command: CoreCommands, |
|
|
|
...args: T |
|
|
|
): Thenable<U>; |
|
|
|
export function executeCoreCommand<T extends [...unknown[]] = [], U = any>( |
|
|
|
command: CoreCommands, |
|
|
|
...args: T |
|
|
|
): Thenable<U> { |
|
|
|
return commands.executeCommand<U>(command, ...args); |
|
|
|
} |
|
|
|
|
|
|
|
export function executeCoreGitCommand<U = any>(command: CoreGitCommands): Thenable<U>; |
|
|
|
export function executeCoreGitCommand<T = unknown, U = any>(command: CoreGitCommands, arg: T): Thenable<U>; |
|
|
|
export function executeCoreGitCommand<T extends [...unknown[]] = [], U = any>( |
|
|
|
command: CoreGitCommands, |
|
|
|
...args: T |
|
|
|
): Thenable<U>; |
|
|
|
export function executeCoreGitCommand<T extends [...unknown[]] = [], U = any>( |
|
|
|
command: CoreGitCommands, |
|
|
|
...args: T |
|
|
|
): Thenable<U> { |
|
|
|
return commands.executeCommand<U>(command, ...args); |
|
|
|
} |
|
|
|
|
|
|
|
export function executeEditorCommand<T>(command: Commands, uri: Uri | undefined, args: T) { |
|
|
|
return commands.executeCommand(command, uri, args); |
|
|
|
} |
|
|
|
|
|
|
|
interface CommandConstructor { |
|
|
|
new (container: Container): Command; |
|
|
|
} |