ソースを参照

Removes outdated clibboard error handling

main
Eric Amodio 4年前
コミット
9d8ff1cc36
4個のファイルの変更15行の追加64行の削除
  1. +6
    -15
      src/commands/copyMessageToClipboard.ts
  2. +6
    -15
      src/commands/copyShaToClipboard.ts
  3. +2
    -18
      src/commands/openPullRequestOnRemote.ts
  4. +1
    -16
      src/git/remotes/provider.ts

+ 6
- 15
src/commands/copyMessageToClipboard.ts ファイルの表示

@ -1,10 +1,5 @@
'use strict';
import { env, TextEditor, Uri, window } from 'vscode';
import { Container } from '../container';
import { GitUri } from '../git/gitUri';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { Iterables } from '../system';
import { env, TextEditor, Uri } from 'vscode';
import {
ActiveEditorCommand,
command,
@ -15,6 +10,11 @@ import {
isCommandContextViewNodeHasCommit,
isCommandContextViewNodeHasTag,
} from './common';
import { Container } from '../container';
import { GitUri } from '../git/gitUri';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { Iterables } from '../system';
export interface CopyMessageToClipboardCommandArgs {
message?: string;
@ -97,15 +97,6 @@ export class CopyMessageToClipboardCommand extends ActiveEditorCommand {
void (await env.clipboard.writeText(args.message));
} catch (ex) {
const msg: string = ex?.message ?? '';
if (msg.includes("Couldn't find the required `xsel` binary")) {
void window.showErrorMessage(
'Unable to copy message, xsel is not installed. Please install it via your package manager, e.g. `sudo apt install xsel`',
);
return;
}
Logger.error(ex, 'CopyMessageToClipboardCommand');
void Messages.showGenericErrorMessage('Unable to copy message');
}

+ 6
- 15
src/commands/copyShaToClipboard.ts ファイルの表示

@ -1,10 +1,5 @@
'use strict';
import { env, TextEditor, Uri, window } from 'vscode';
import { Container } from '../container';
import { GitUri } from '../git/gitUri';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { Iterables } from '../system';
import { env, TextEditor, Uri } from 'vscode';
import {
ActiveEditorCommand,
command,
@ -15,6 +10,11 @@ import {
isCommandContextViewNodeHasCommit,
isCommandContextViewNodeHasTag,
} from './common';
import { Container } from '../container';
import { GitUri } from '../git/gitUri';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { Iterables } from '../system';
export interface CopyShaToClipboardCommandArgs {
sha?: string;
@ -80,15 +80,6 @@ export class CopyShaToClipboardCommand extends ActiveEditorCommand {
void (await env.clipboard.writeText(args.sha));
} catch (ex) {
const msg: string = ex?.message ?? '';
if (msg.includes("Couldn't find the required `xsel` binary")) {
void window.showErrorMessage(
'Unable to copy commit SHA, xsel is not installed. Please install it via your package manager, e.g. `sudo apt install xsel`',
);
return;
}
Logger.error(ex, 'CopyShaToClipboardCommand');
void Messages.showGenericErrorMessage('Unable to copy commit SHA');
}

+ 2
- 18
src/commands/openPullRequestOnRemote.ts ファイルの表示

@ -1,10 +1,8 @@
'use strict';
import { env, Uri, window } from 'vscode';
import { env, Uri } from 'vscode';
import { Command, command, CommandContext, Commands } from './common';
import { Container } from '../container';
import { PullRequestNode } from '../views/nodes';
import { Logger } from '../logger';
import { Messages } from '../messages';
export interface OpenPullRequestOnRemoteCommandArgs {
clipboard?: boolean;
@ -46,21 +44,7 @@ export class OpenPullRequestOnRemoteCommand extends Command {
}
if (args.clipboard) {
try {
void (await env.clipboard.writeText(args.pr.url));
} catch (ex) {
const msg: string = ex?.toString() ?? '';
if (msg.includes("Couldn't find the required `xsel` binary")) {
void window.showErrorMessage(
'Unable to copy remote url, xsel is not installed. Please install it via your package manager, e.g. `sudo apt install xsel`',
);
return;
}
Logger.error(ex, 'CopyRemotePullRequestCommand');
void Messages.showGenericErrorMessage('Unable to copy pull request url');
}
void (await env.clipboard.writeText(args.pr.url));
} else {
void env.openExternal(Uri.parse(args.pr.url));
}

+ 1
- 16
src/git/remotes/provider.ts ファイルの表示

@ -17,7 +17,6 @@ import { SyncedState, WorkspaceState } from '../../constants';
import { Container } from '../../container';
import { setKeysForSync } from '../../extension';
import { Logger } from '../../logger';
import { Messages } from '../../messages';
import { Account, GitLogCommit, IssueOrPullRequest, PullRequest, PullRequestState, Repository } from '../models/models';
import { debug, gate, log, Promises } from '../../system';
@ -120,21 +119,7 @@ export abstract class RemoteProvider {
const url = this.url(resource);
if (url == null) return;
try {
void (await env.clipboard.writeText(url));
} catch (ex) {
const msg: string = ex?.toString() ?? '';
if (msg.includes("Couldn't find the required `xsel` binary")) {
void window.showErrorMessage(
'Unable to copy remote url, xsel is not installed. Please install it via your package manager, e.g. `sudo apt install xsel`',
);
return;
}
Logger.error(ex, 'CopyRemoteUrlCommand');
void Messages.showGenericErrorMessage('Unable to copy remote url');
}
void (await env.clipboard.writeText(url));
}
hasApi(): this is RichRemoteProvider {

読み込み中…
キャンセル
保存