소스 검색

Replaces enums with types

main
Eric Amodio 1 년 전
부모
커밋
dc73fec0c1
25개의 변경된 파일147개의 추가작업 그리고 144개의 파일을 삭제
  1. +3
    -6
      src/codelens/codeLensProvider.ts
  2. +2
    -2
      src/commands/browseRepoAtRevision.ts
  3. +2
    -2
      src/commands/diffWith.ts
  4. +2
    -2
      src/commands/generateCommitMessage.ts
  5. +1
    -2
      src/commands/git/coauthors.ts
  6. +2
    -2
      src/commands/refreshHover.ts
  7. +3
    -3
      src/commands/setViewsLayout.ts
  8. +36
    -38
      src/constants.ts
  9. +3
    -3
      src/context.ts
  10. +2
    -2
      src/extension.ts
  11. +1
    -2
      src/git/actions/worktree.ts
  12. +4
    -10
      src/git/models/repository.ts
  13. +1
    -1
      src/hovers/hovers.ts
  14. +2
    -2
      src/partners.ts
  15. +3
    -3
      src/plus/webviews/graph/graphWebview.ts
  16. +31
    -3
      src/system/command.ts
  17. +6
    -6
      src/system/utils.ts
  18. +10
    -14
      src/views/nodes/mergeConflictCurrentChangesNode.ts
  19. +11
    -13
      src/views/nodes/mergeConflictFileNode.ts
  20. +9
    -15
      src/views/nodes/mergeConflictIncomingChangesNode.ts
  21. +2
    -2
      src/views/nodes/rebaseStatusNode.ts
  22. +4
    -4
      src/views/viewCommands.ts
  23. +2
    -2
      src/webviews/commitDetails/commitDetailsWebview.ts
  24. +2
    -2
      src/webviews/home/homeWebview.ts
  25. +3
    -3
      src/webviews/rebase/rebaseEditor.ts

+ 3
- 6
src/codelens/codeLensProvider.ts 파일 보기

@ -20,7 +20,7 @@ import type {
} from '../commands';
import type { CodeLensConfig, CodeLensLanguageScope } from '../config';
import { CodeLensCommand, CodeLensScopes, FileAnnotationType } from '../config';
import { Commands, CoreCommands, Schemes } from '../constants';
import { Commands, Schemes } from '../constants';
import type { Container } from '../container';
import type { GitUri } from '../git/gitUri';
import type { GitBlame, GitBlameLines } from '../git/models/blame';
@ -150,7 +150,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
[blame, symbols] = await Promise.all([
this.container.git.getBlame(gitUri, document),
executeCoreCommand<[Uri], SymbolInformation[]>(
CoreCommands.ExecuteDocumentSymbolProvider,
'vscode.executeDocumentSymbolProvider',
document.uri,
),
]);
@ -161,10 +161,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
let tracked;
[tracked, symbols] = await Promise.all([
this.container.git.isTracked(gitUri),
executeCoreCommand<[Uri], SymbolInformation[]>(
CoreCommands.ExecuteDocumentSymbolProvider,
document.uri,
),
executeCoreCommand<[Uri], SymbolInformation[]>('vscode.executeDocumentSymbolProvider', document.uri),
]);
if (!tracked) return lenses;

+ 2
- 2
src/commands/browseRepoAtRevision.ts 파일 보기

@ -1,5 +1,5 @@
import type { TextEditor, Uri } from 'vscode';
import { Commands, CoreCommands } from '../constants';
import { Commands } from '../constants';
import type { Container } from '../container';
import { GitUri } from '../git/gitUri';
import { showGenericErrorMessage } from '../messages';
@ -70,7 +70,7 @@ export class BrowseRepoAtRevisionCommand extends ActiveEditorCommand {
});
if (!args.openInNewWindow) {
void executeCoreCommand(CoreCommands.FocusFilesExplorer);
void executeCoreCommand('workbench.files.action.focusFilesExplorer');
}
} catch (ex) {
Logger.error(ex, 'BrowseRepoAtRevisionCommand');

+ 2
- 2
src/commands/diffWith.ts 파일 보기

@ -1,6 +1,6 @@
import type { TextDocumentShowOptions, Uri } from 'vscode';
import { Range, ViewColumn } from 'vscode';
import { Commands, CoreCommands, GlyphChars } from '../constants';
import { Commands, GlyphChars } from '../constants';
import type { Container } from '../container';
import type { GitCommit } from '../git/models/commit';
import { isCommit } from '../git/models/commit';
@ -180,7 +180,7 @@ export class DiffWithCommand extends Command {
}
void (await executeCoreCommand(
CoreCommands.Diff,
'vscode.diff',
lhs ?? this.container.git.getRevisionUri(deletedOrMissing, args.lhs.uri.fsPath, args.repoPath),
rhs ?? this.container.git.getRevisionUri(deletedOrMissing, args.rhs.uri.fsPath, args.repoPath),
title,

+ 2
- 2
src/commands/generateCommitMessage.ts 파일 보기

@ -1,7 +1,7 @@
import type { Disposable, MessageItem, QuickInputButton, TextEditor } from 'vscode';
import { env, ProgressLocation, ThemeIcon, Uri, window } from 'vscode';
import { fetch } from '@env/fetch';
import { Commands, CoreCommands } from '../constants';
import { Commands } from '../constants';
import type { Container } from '../container';
import { GitUri } from '../git/gitUri';
import { uncommittedStaged } from '../git/models/constants';
@ -172,7 +172,7 @@ export class GenerateCommitMessageCommand extends ActiveEditorCommand {
const completion: OpenAIChatCompletionResponse = await rsp.json();
void executeCoreCommand(CoreCommands.ShowSCM);
void executeCoreCommand('workbench.view.scm');
const message = completion.choices[0].message.content.trim();
scmRepo.inputBox.value = `${currentMessage ? `${currentMessage}\n\n` : ''}${message}`;

+ 1
- 2
src/commands/git/coauthors.ts 파일 보기

@ -1,4 +1,3 @@
import { CoreCommands } from '../../constants';
import type { Container } from '../../container';
import type { GitContributor } from '../../git/models/contributor';
import type { Repository } from '../../git/models/repository';
@ -85,7 +84,7 @@ export class CoAuthorsGitCommand extends QuickCommand {
}
repo.inputBox.value = message;
void (await executeCoreCommand(CoreCommands.ShowSCM));
void (await executeCoreCommand('workbench.view.scm'));
}
protected async *steps(state: PartialStepState<State>): StepGenerator {

+ 2
- 2
src/commands/refreshHover.ts 파일 보기

@ -1,4 +1,4 @@
import { Commands, CoreCommands } from '../constants';
import { Commands } from '../constants';
import type { Container } from '../container';
import { command, executeCoreCommand } from '../system/command';
import { Command } from './base';
@ -11,6 +11,6 @@ export class RefreshHoverCommand extends Command {
async execute() {
// TODO@eamodio figure out how to really refresh/update a hover
await executeCoreCommand(CoreCommands.EditorShowHover);
await executeCoreCommand('editor.action.showHover');
}
}

+ 3
- 3
src/commands/setViewsLayout.ts 파일 보기

@ -1,6 +1,6 @@
import { window } from 'vscode';
import { viewsConfigKeys } from '../config';
import { Commands, CoreCommands } from '../constants';
import { Commands } from '../constants';
import type { Container } from '../container';
import { command, executeCommand, executeCoreCommand } from '../system/command';
import { Command } from './base';
@ -57,7 +57,7 @@ export class SetViewsLayoutCommand extends Command {
// Because of https://github.com/microsoft/vscode/issues/105774, run the command twice which seems to fix things
let count = 0;
while (count++ < 2) {
void (await executeCoreCommand(CoreCommands.MoveViews, {
void (await executeCoreCommand('vscode.moveViews', {
viewIds: views.map(v => `gitlens.views.${v}`),
destinationId: 'workbench.view.extension.gitlens',
}));
@ -70,7 +70,7 @@ export class SetViewsLayoutCommand extends Command {
// Because of https://github.com/microsoft/vscode/issues/105774, run the command twice which seems to fix things
let count = 0;
while (count++ < 2) {
void (await executeCoreCommand(CoreCommands.MoveViews, {
void (await executeCoreCommand('vscode.moveViews', {
viewIds: views.map(v => `gitlens.views.${v}`),
destinationId: 'workbench.view.scm',
}));

+ 36
- 38
src/constants.ts 파일 보기

@ -319,45 +319,43 @@ export const enum ContextKeys {
PlusState = 'gitlens:plus:state',
}
export const enum CoreCommands {
CloseActiveEditor = 'workbench.action.closeActiveEditor',
CloseAllEditors = 'workbench.action.closeAllEditors',
CursorMove = 'cursorMove',
CustomEditorShowFindWidget = 'editor.action.webvieweditor.showFind',
Diff = 'vscode.diff',
EditorScroll = 'editorScroll',
EditorShowHover = 'editor.action.showHover',
ExecuteDocumentSymbolProvider = 'vscode.executeDocumentSymbolProvider',
ExecuteCodeLensProvider = 'vscode.executeCodeLensProvider',
FocusFilesExplorer = 'workbench.files.action.focusFilesExplorer',
InstallExtension = 'workbench.extensions.installExtension',
MoveViews = 'vscode.moveViews',
Open = 'vscode.open',
OpenFolder = 'vscode.openFolder',
OpenInTerminal = 'openInTerminal',
OpenWalkthrough = 'workbench.action.openWalkthrough',
OpenWith = 'vscode.openWith',
NextEditor = 'workbench.action.nextEditor',
PreviewHtml = 'vscode.previewHtml',
RevealLine = 'revealLine',
RevealInExplorer = 'revealInExplorer',
RevealInFileExplorer = 'revealFileInOS',
SetContext = 'setContext',
ShowExplorer = 'workbench.view.explorer',
ShowReferences = 'editor.action.showReferences',
ShowSCM = 'workbench.view.scm',
UninstallExtension = 'workbench.extensions.uninstallExtension',
}
export type CoreCommands =
| 'cursorMove'
| 'editor.action.showHover'
| 'editor.action.showReferences'
| 'editor.action.webvieweditor.showFind'
| 'editorScroll'
| 'openInTerminal'
| 'revealFileInOS'
| 'revealInExplorer'
| 'revealLine'
| 'setContext'
| 'vscode.open'
| 'vscode.openFolder'
| 'vscode.openWith'
| 'vscode.diff'
| 'vscode.executeCodeLensProvider'
| 'vscode.executeDocumentSymbolProvider'
| 'vscode.moveViews'
| 'vscode.previewHtml'
| 'workbench.action.closeActiveEditor'
| 'workbench.action.openWalkthrough'
| 'workbench.action.closeAllEditors'
| 'workbench.action.nextEditor'
| 'workbench.extensions.installExtension'
| 'workbench.extensions.uninstallExtension'
| 'workbench.files.action.focusFilesExplorer'
| 'workbench.view.explorer'
| 'workbench.view.scm';
export const enum CoreGitCommands {
Publish = 'git.publish',
Pull = 'git.pull',
PullRebase = 'git.pullRebase',
Push = 'git.push',
PushForce = 'git.pushForce',
UndoCommit = 'git.undoCommit',
Fetch = 'git.fetch',
}
export type CoreGitCommands =
| 'git.fetch'
| 'git.publish'
| 'git.pull'
| 'git.pullRebase'
| 'git.push'
| 'git.pushForce'
| 'git.undoCommit';
export const enum CoreGitConfiguration {
AutoRepositoryDetection = 'git.autoRepositoryDetection',

+ 3
- 3
src/context.ts 파일 보기

@ -1,6 +1,6 @@
import { commands, EventEmitter } from 'vscode';
import { EventEmitter } from 'vscode';
import type { ContextKeys } from './constants';
import { CoreCommands } from './constants';
import { executeCoreCommand } from './system/command';
import type { WebviewIds, WebviewViewIds } from './webviews/webviewsController';
const contextStorage = new Map<string, unknown>();
@ -35,6 +35,6 @@ export function getContext(key: AllContextKeys, defaultValue?: T): T | undefi
export async function setContext(key: AllContextKeys, value: unknown): Promise<void> {
contextStorage.set(key, value);
void (await commands.executeCommand(CoreCommands.SetContext, key, value));
void (await executeCoreCommand('setContext', key, value));
_onDidChangeContext.fire(key);
}

+ 2
- 2
src/extension.ts 파일 보기

@ -6,7 +6,7 @@ import { Api } from './api/api';
import type { CreatePullRequestActionContext, GitLensApi, OpenPullRequestActionContext } from './api/gitlens';
import type { CreatePullRequestOnRemoteCommandArgs, OpenPullRequestOnRemoteCommandArgs } from './commands';
import { fromOutputLevel, OutputLevel } from './config';
import { Commands, ContextKeys, CoreCommands } from './constants';
import { Commands, ContextKeys } from './constants';
import { Container } from './container';
import { setContext } from './context';
import { isGitUri } from './git/gitUri';
@ -351,5 +351,5 @@ async function showWelcomeOrWhatsNew(container: Container, version: string, prev
function uninstallDeprecatedAuthentication() {
if (extensions.getExtension('gitkraken.gitkraken-authentication') == null) return;
void executeCoreCommand(CoreCommands.UninstallExtension, 'gitkraken.gitkraken-authentication');
void executeCoreCommand('workbench.extensions.uninstallExtension', 'gitkraken.gitkraken-authentication');
}

+ 1
- 2
src/git/actions/worktree.ts 파일 보기

@ -1,6 +1,5 @@
import type { Uri } from 'vscode';
import type { WorktreeGitCommandArgs } from '../../commands/git/worktree';
import { CoreCommands } from '../../constants';
import { Container } from '../../container';
import { ensure } from '../../system/array';
import { executeCoreCommand } from '../../system/command';
@ -67,7 +66,7 @@ export async function reveal(
}
export async function revealInFileExplorer(worktree: GitWorktree) {
void (await executeCoreCommand(CoreCommands.RevealInFileExplorer, worktree.uri));
void (await executeCoreCommand('revealInExplorer', worktree.uri));
}
type OpenFlagsArray = Extract<NonNullable<Required<WorktreeGitCommandArgs['state']>>, { subcommand: 'open' }>['flags'];

+ 4
- 10
src/git/models/repository.ts 파일 보기

@ -3,7 +3,7 @@ import { Disposable, EventEmitter, ProgressLocation, RelativePattern, Uri, windo
import { md5 } from '@env/crypto';
import { ForcePushMode } from '../../@types/vscode.git.enums';
import type { CreatePullRequestActionContext } from '../../api/gitlens';
import { CoreGitCommands, CoreGitConfiguration, Schemes } from '../../constants';
import { CoreGitConfiguration, Schemes } from '../../constants';
import type { Container } from '../../container';
import type { FeatureAccess, Features, PlusFeatures } from '../../features';
import { showCreatePullRequestPrompt, showGenericErrorMessage } from '../../messages';
@ -580,7 +580,7 @@ export class Repository implements Disposable {
if (options?.branch != null) {
await this.container.git.fetch(this.path, options);
} else {
void (await executeCoreGitCommand(CoreGitCommands.Fetch, this.path));
void (await executeCoreGitCommand('git.fetch', this.path));
}
this.fireChange(RepositoryChange.Unknown);
@ -803,10 +803,7 @@ export class Repository implements Disposable {
try {
const upstream = await this.hasUpstreamBranch();
if (upstream) {
void (await executeCoreGitCommand(
options?.rebase ? CoreGitCommands.PullRebase : CoreGitCommands.Pull,
this.path,
));
void (await executeCoreGitCommand(options?.rebase ? 'git.pullRebase' : 'git.pull', this.path));
} else if (configuration.getAny<boolean>(CoreGitConfiguration.FetchOnPull, Uri.file(this.path))) {
await this.container.git.fetch(this.path);
}
@ -913,10 +910,7 @@ export class Repository implements Disposable {
options?.force ? ForcePushMode.ForceWithLease : undefined,
);
} else {
void (await executeCoreGitCommand(
options?.force ? CoreGitCommands.PushForce : CoreGitCommands.Push,
this.path,
));
void (await executeCoreGitCommand(options?.force ? 'git.pushForce' : 'git.push', this.path));
}
this.fireChange(RepositoryChange.Unknown);

+ 1
- 1
src/hovers/hovers.ts 파일 보기

@ -347,7 +347,7 @@ async function getAutoLinkedIssuesOrPullRequests(message: string, remotes: GitRe
// scope,
// `${GlyphChars.Dot} ${count} issue/pull request queries completed; refreshing...`,
// );
// void executeCoreCommand(CoreCommands.EditorShowHover);
// void executeCoreCommand('editor.action.showHover');
// });
return autolinks;

+ 2
- 2
src/partners.ts 파일 보기

@ -2,7 +2,7 @@ import type { CancellationTokenSource, Extension, ExtensionContext, Uri } from '
import { extensions } from 'vscode';
import type { ActionContext, HoverCommandsActionContext } from './api/gitlens';
import type { InviteToLiveShareCommandArgs } from './commands';
import { Commands, CoreCommands } from './constants';
import { Commands } from './constants';
import { Container } from './container';
import { executeCommand, executeCoreCommand } from './system/command';
import type { ContactPresence } from './vsls/vsls';
@ -36,7 +36,7 @@ export async function installExtension(
});
});
await executeCoreCommand(CoreCommands.InstallExtension, vsix ?? extensionId);
await executeCoreCommand('workbench.extensions.installExtension', vsix ?? extensionId);
// Wait for extension activation until timeout expires
timer = setTimeout(() => {
timer = undefined;

+ 3
- 3
src/plus/webviews/graph/graphWebview.ts 파일 보기

@ -12,7 +12,7 @@ import type {
} from '../../../commands';
import { parseCommandContext } from '../../../commands/base';
import type { Config } from '../../../config';
import { Commands, ContextKeys, CoreCommands, CoreGitCommands, GlyphChars } from '../../../constants';
import { Commands, ContextKeys, GlyphChars } from '../../../constants';
import type { Container } from '../../../container';
import { getContext, onDidChangeContext } from '../../../context';
import type { CommitSelectedEvent } from '../../../eventBus';
@ -2112,7 +2112,7 @@ export class GraphWebviewProvider implements WebviewProvider {
const ref = this.getGraphItemRef(item, 'revision');
if (ref == null) return Promise.resolve();
return executeCoreCommand(CoreCommands.ShowSCM);
return executeCoreCommand('workbench.view.scm');
}
@debug()
@ -2270,7 +2270,7 @@ export class GraphWebviewProvider implements WebviewProvider {
return;
}
return void executeCoreGitCommand(CoreGitCommands.UndoCommit, ref.repoPath);
return void executeCoreGitCommand('git.undoCommit', ref.repoPath);
}
@debug()

+ 31
- 3
src/system/command.ts 파일 보기

@ -2,8 +2,8 @@ import type { Command as CoreCommand, Disposable, Uri } from 'vscode';
import { commands } from 'vscode';
import type { Action, ActionContext } from '../api/gitlens';
import type { Command } from '../commands/base';
import type { CoreGitCommands } from '../constants';
import { Commands, CoreCommands } from '../constants';
import type { CoreCommands, CoreGitCommands } from '../constants';
import { Commands } from '../constants';
import { Container } from '../container';
interface CommandConstructor {
@ -44,6 +44,14 @@ export function executeActionCommand(action: Action,
type SupportedCommands = Commands | `gitlens.views.${string}.focus` | `gitlens.views.${string}.resetViewLocation`;
export function createCommand<T extends unknown[]>(command: SupportedCommands, title: string, ...args: T): CoreCommand {
return {
command: command,
title: title,
arguments: args,
};
}
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>(
@ -57,6 +65,14 @@ export function executeCommand(
return commands.executeCommand<U>(command, ...args);
}
export function createCoreCommand<T extends unknown[]>(command: CoreCommands, title: string, ...args: T): CoreCommand {
return {
command: command,
title: title,
arguments: args,
};
}
export function executeCoreCommand<T = unknown, U = any>(command: CoreCommands, arg: T): Thenable<U>;
export function executeCoreCommand<T extends [...unknown[]] = [], U = any>(
command: CoreCommands,
@ -66,12 +82,24 @@ export function executeCoreCommand(
command: CoreCommands,
...args: T
): Thenable<U> {
if (command !== CoreCommands.ExecuteDocumentSymbolProvider) {
if (command != 'setContext' && command !== 'vscode.executeDocumentSymbolProvider') {
Container.instance.telemetry.sendEvent('command/core', { command: command });
}
return commands.executeCommand<U>(command, ...args);
}
export function createCoreGitCommand<T extends unknown[]>(
command: CoreGitCommands,
title: string,
...args: T
): CoreCommand {
return {
command: command,
title: title,
arguments: 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>(

+ 6
- 6
src/system/utils.ts 파일 보기

@ -1,6 +1,6 @@
import type { ColorTheme, TextDocument, TextDocumentShowOptions, TextEditor, Uri } from 'vscode';
import { version as codeVersion, ColorThemeKind, env, ViewColumn, window, workspace } from 'vscode';
import { CoreCommands, ImageMimetypes, Schemes } from '../constants';
import { ImageMimetypes, Schemes } from '../constants';
import { isGitUri } from '../git/gitUri';
import { executeCoreCommand } from './command';
import { configuration } from './configuration';
@ -54,7 +54,7 @@ export function findOrOpenEditors(uris: Uri[]): void {
}
for (const uri of normalizedUris.values()) {
void executeCoreCommand(CoreCommands.Open, uri, { background: true, preview: false });
void executeCoreCommand('vscode.open', uri, { background: true, preview: false });
}
}
@ -112,7 +112,7 @@ export async function openEditor(
}
if (uri.scheme === Schemes.GitLens && ImageMimetypes[extname(uri.fsPath)]) {
await executeCoreCommand(CoreCommands.Open, uri);
await executeCoreCommand('vscode.open', uri);
return undefined;
}
@ -127,7 +127,7 @@ export async function openEditor(
} catch (ex) {
const msg: string = ex?.toString() ?? '';
if (msg.includes('File seems to be binary and cannot be opened as text')) {
await executeCoreCommand(CoreCommands.Open, uri);
await executeCoreCommand('vscode.open', uri);
return undefined;
}
@ -152,7 +152,7 @@ export async function openWalkthrough(
// Takes the following params: walkthroughID: string | { category: string, step: string } | undefined, toSide: boolean | undefined
void (await executeCoreCommand(
CoreCommands.OpenWalkthrough,
'workbench.action.openWalkthrough',
{
category: `${extensionId}#${walkthroughId}`,
step: stepId ? `${extensionId}#${walkthroughId}#${stepId}` : undefined,
@ -176,7 +176,7 @@ export function openWorkspace(
return void workspace.updateWorkspaceFolders(count, 0, { uri: uri, name: options?.name });
}
return void executeCoreCommand(CoreCommands.OpenFolder, uri, {
return void executeCoreCommand('vscode.openFolder', uri, {
forceNewWindow: options?.location === OpenWorkspaceLocation.NewWindow,
});
}

+ 10
- 14
src/views/nodes/mergeConflictCurrentChangesNode.ts 파일 보기

@ -1,13 +1,14 @@
import type { Command } from 'vscode';
import { MarkdownString, ThemeIcon, TreeItem, TreeItemCollapsibleState } from 'vscode';
import type { DiffWithCommandArgs } from '../../commands';
import { Commands, CoreCommands, GlyphChars } from '../../constants';
import { Commands, GlyphChars } from '../../constants';
import { CommitFormatter } from '../../git/formatters/commitFormatter';
import { GitUri } from '../../git/gitUri';
import type { GitFile } from '../../git/models/file';
import type { GitMergeStatus } from '../../git/models/merge';
import type { GitRebaseStatus } from '../../git/models/rebase';
import { getReferenceLabel } from '../../git/models/reference';
import { createCommand, createCoreCommand } from '../../system/command';
import { configuration } from '../../system/configuration';
import type { FileHistoryView } from '../fileHistoryView';
import type { LineHistoryView } from '../lineHistoryView';
@ -70,16 +71,16 @@ export class MergeConflictCurrentChangesNode extends ViewNode
return item;
}
override getCommand(): Command | undefined {
override getCommand(): Command {
if (this.status.mergeBase == null) {
return {
title: 'Open Revision',
command: CoreCommands.Open,
arguments: [this.view.container.git.getRevisionUri('HEAD', this.file.path, this.status.repoPath)],
};
return createCoreCommand(
'vscode.open',
'Open Revision',
this.view.container.git.getRevisionUri('HEAD', this.file.path, this.status.repoPath),
);
}
const commandArgs: DiffWithCommandArgs = {
return createCommand<[DiffWithCommandArgs]>(Commands.DiffWith, 'Open Changes', {
lhs: {
sha: this.status.mergeBase,
uri: GitUri.fromFile(this.file, this.status.repoPath, undefined, true),
@ -99,11 +100,6 @@ export class MergeConflictCurrentChangesNode extends ViewNode
preserveFocus: true,
preview: true,
},
};
return {
title: 'Open Changes',
command: Commands.DiffWith,
arguments: [commandArgs],
};
});
}
}

+ 11
- 13
src/views/nodes/mergeConflictFileNode.ts 파일 보기

@ -1,11 +1,11 @@
import type { Command, Uri } from 'vscode';
import { MarkdownString, ThemeIcon, TreeItem, TreeItemCollapsibleState } from 'vscode';
import { CoreCommands } from '../../constants';
import { StatusFileFormatter } from '../../git/formatters/statusFormatter';
import { GitUri } from '../../git/gitUri';
import type { GitFile } from '../../git/models/file';
import type { GitMergeStatus } from '../../git/models/merge';
import type { GitRebaseStatus } from '../../git/models/rebase';
import { createCoreCommand } from '../../system/command';
import { relativeDir } from '../../system/path';
import type { ViewsWithCommits } from '../viewBase';
import type { FileNode } from './folderNode';
@ -116,17 +116,15 @@ export class MergeConflictFileNode extends ViewFileNode implem
this._description = undefined;
}
override getCommand(): Command | undefined {
return {
title: 'Open File',
command: CoreCommands.Open,
arguments: [
this.view.container.git.getAbsoluteUri(this.file.path, this.repoPath),
{
preserveFocus: true,
preview: true,
},
],
};
override getCommand(): Command {
return createCoreCommand(
'vscode.open',
'Open File',
this.view.container.git.getAbsoluteUri(this.file.path, this.repoPath),
{
preserveFocus: true,
preview: true,
},
);
}
}

+ 9
- 15
src/views/nodes/mergeConflictIncomingChangesNode.ts 파일 보기

@ -1,13 +1,14 @@
import type { Command } from 'vscode';
import { MarkdownString, ThemeIcon, TreeItem, TreeItemCollapsibleState } from 'vscode';
import type { DiffWithCommandArgs } from '../../commands';
import { Commands, CoreCommands, GlyphChars } from '../../constants';
import { Commands, GlyphChars } from '../../constants';
import { CommitFormatter } from '../../git/formatters/commitFormatter';
import { GitUri } from '../../git/gitUri';
import type { GitFile } from '../../git/models/file';
import type { GitMergeStatus } from '../../git/models/merge';
import type { GitRebaseStatus } from '../../git/models/rebase';
import { getReferenceLabel } from '../../git/models/reference';
import { createCommand, createCoreCommand } from '../../system/command';
import { configuration } from '../../system/configuration';
import type { FileHistoryView } from '../fileHistoryView';
import type { LineHistoryView } from '../lineHistoryView';
@ -90,16 +91,14 @@ export class MergeConflictIncomingChangesNode extends ViewNode
override getCommand(): Command | undefined {
if (this.status.mergeBase == null) {
return {
title: 'Open Revision',
command: CoreCommands.Open,
arguments: [
this.view.container.git.getRevisionUri(this.status.HEAD.ref, this.file.path, this.status.repoPath),
],
};
return createCoreCommand(
'vscode.open',
'Open Revision',
this.view.container.git.getRevisionUri(this.status.HEAD.ref, this.file.path, this.status.repoPath),
);
}
const commandArgs: DiffWithCommandArgs = {
return createCommand<[DiffWithCommandArgs]>(Commands.DiffWith, 'Open Changes', {
lhs: {
sha: this.status.mergeBase,
uri: GitUri.fromFile(this.file, this.status.repoPath, undefined, true),
@ -120,11 +119,6 @@ export class MergeConflictIncomingChangesNode extends ViewNode
preserveFocus: true,
preview: true,
},
};
return {
title: 'Open Changes',
command: Commands.DiffWith,
arguments: [commandArgs],
};
});
}
}

+ 2
- 2
src/views/nodes/rebaseStatusNode.ts 파일 보기

@ -2,7 +2,7 @@ import type { Command } from 'vscode';
import { MarkdownString, ThemeColor, ThemeIcon, TreeItem, TreeItemCollapsibleState, Uri } from 'vscode';
import type { DiffWithPreviousCommandArgs } from '../../commands';
import { ViewFilesLayout } from '../../config';
import { Commands, CoreCommands } from '../../constants';
import { Commands } from '../../constants';
import { CommitFormatter } from '../../git/formatters/commitFormatter';
import { GitUri } from '../../git/gitUri';
import type { GitBranch } from '../../git/models/branch';
@ -117,7 +117,7 @@ export class RebaseStatusNode extends ViewNode {
async openEditor() {
const rebaseTodoUri = Uri.joinPath(this.uri, '.git', 'rebase-merge', 'git-rebase-todo');
await executeCoreCommand(CoreCommands.OpenWith, rebaseTodoUri, 'gitlens.rebase', {
await executeCoreCommand('vscode.openWith', rebaseTodoUri, 'gitlens.rebase', {
preview: false,
});
}

+ 4
- 4
src/views/viewCommands.ts 파일 보기

@ -8,7 +8,7 @@ import type {
OpenFileAtRevisionCommandArgs,
} from '../commands';
import { FileAnnotationType, ViewShowBranchComparison } from '../config';
import { Commands, ContextKeys, CoreCommands, CoreGitCommands } from '../constants';
import { Commands, ContextKeys } from '../constants';
import type { Container } from '../container';
import { setContext } from '../context';
import { browseAtRevision } from '../git/actions';
@ -549,7 +549,7 @@ export class ViewCommands {
private openInTerminal(node: RepositoryNode | RepositoryFolderNode) {
if (!(node instanceof RepositoryNode) && !(node instanceof RepositoryFolderNode)) return Promise.resolve();
return executeCoreCommand(CoreCommands.OpenInTerminal, Uri.file(node.repo.path));
return executeCoreCommand('openInTerminal', Uri.file(node.repo.path));
}
@debug()
@ -602,7 +602,7 @@ export class ViewCommands {
@debug()
private publishRepository(node: BranchNode | BranchTrackingStatusNode) {
if (node instanceof BranchNode || node instanceof BranchTrackingStatusNode) {
return executeCoreGitCommand(CoreGitCommands.Publish, Uri.file(node.repoPath));
return executeCoreGitCommand('git.publish', Uri.file(node.repoPath));
}
return Promise.resolve();
}
@ -823,7 +823,7 @@ export class ViewCommands {
return;
}
await executeCoreGitCommand(CoreGitCommands.UndoCommit, node.repoPath);
await executeCoreGitCommand('git.undoCommit', node.repoPath);
}
@debug()

+ 2
- 2
src/webviews/commitDetails/commitDetailsWebview.ts 파일 보기

@ -2,7 +2,7 @@ import type { CancellationToken, ConfigurationChangeEvent, TextDocumentShowOptio
import { CancellationTokenSource, Disposable, Uri, ViewColumn, window } from 'vscode';
import { serializeAutolink } from '../../annotations/autolinks';
import type { CopyShaToClipboardCommandArgs } from '../../commands';
import { Commands, ContextKeys, CoreCommands } from '../../constants';
import { Commands, ContextKeys } from '../../constants';
import type { Container } from '../../container';
import { getContext } from '../../context';
import type { CommitSelectedEvent } from '../../eventBus';
@ -326,7 +326,7 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
this.showCommitActions();
break;
case 'scm':
void executeCoreCommand(CoreCommands.ShowSCM);
void executeCoreCommand('workbench.view.scm');
break;
case 'sha':
if (params.alt) {

+ 2
- 2
src/webviews/home/homeWebview.ts 파일 보기

@ -2,7 +2,7 @@ import type { ConfigurationChangeEvent } from 'vscode';
import { Disposable, window } from 'vscode';
import { getAvatarUriFromGravatarEmail } from '../../avatars';
import { ViewsLayout } from '../../commands/setViewsLayout';
import { ContextKeys, CoreCommands } from '../../constants';
import { ContextKeys } from '../../constants';
import type { Container } from '../../container';
import { getContext, onDidChangeContext } from '../../context';
import type { RepositoriesVisibility } from '../../git/gitProviderService';
@ -124,7 +124,7 @@ export class HomeWebviewProvider implements WebviewProvider {
void this.notifyDidChangeData();
}
await executeCoreCommand(CoreCommands.ShowSCM);
await executeCoreCommand('workbench.view.scm');
}),
];
}

+ 3
- 3
src/webviews/rebase/rebaseEditor.ts 파일 보기

@ -8,7 +8,7 @@ import type {
import { ConfigurationTarget, Disposable, Position, Range, Uri, window, workspace, WorkspaceEdit } from 'vscode';
import { getNonce } from '@env/crypto';
import { ShowCommitsInViewCommand } from '../../commands';
import { ContextKeys, CoreCommands } from '../../constants';
import { ContextKeys } from '../../constants';
import type { Container } from '../../container';
import { emojify } from '../../emojis';
import type { GitCommit } from '../../git/models/commit';
@ -320,7 +320,7 @@ export class RebaseEditorProvider implements CustomTextEditorProvider, Disposabl
break;
case SearchCommandType.method:
onIpc(SearchCommandType, e, () => executeCoreCommand(CoreCommands.CustomEditorShowFindWidget));
onIpc(SearchCommandType, e, () => executeCoreCommand('editor.action.webvieweditor.showFind'));
break;
case StartCommandType.method:
@ -582,7 +582,7 @@ export class RebaseEditorProvider implements CustomTextEditorProvider, Disposabl
void showRebaseSwitchToTextWarningMessage();
// Open the text version of the document
void executeCoreCommand(CoreCommands.Open, context.document.uri, {
void executeCoreCommand('vscode.open', context.document.uri, {
override: false,
preview: false,
});

불러오는 중...
취소
저장