Browse Source

Fixes #35 - Traps xclip error and notifies

main
Eric Amodio 6 years ago
parent
commit
edfd0327e6
3 changed files with 25 additions and 2 deletions
  1. +3
    -0
      CHANGELOG.md
  2. +11
    -1
      src/commands/copyMessageToClipboard.ts
  3. +11
    -1
      src/commands/copyShaToClipboard.ts

+ 3
- 0
CHANGELOG.md View File

@ -71,6 +71,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Removes `gitlens.annotations.line.hover.changes` setting, use `gitlens.hovers.annotations.changes` instead
- Removes `gitlens.annotations.line.hover.details` setting, use `gitlens.hovers.annotations.details` instead
### Fixed
- Fixes [#35](https://github.com/eamodio/vscode-gitlens/issues/35) - Copy Commit Sha to Clipboard not working (linux)
## [7.5.10] - 2018-02-01
### Added
- Adds support for custom remotes with split project/repo url structure — closes [#267](https://github.com/eamodio/vscode-gitlens/issues/267)

+ 11
- 1
src/commands/copyMessageToClipboard.ts View File

@ -81,7 +81,17 @@ export class CopyMessageToClipboardCommand extends ActiveEditorCommand {
args.message = commit.message;
}
clipboard.copy(args.message);
clipboard.copy(args.message, (err: Error) => {
if (err) {
if (err.message.includes('xclip')) {
window.showErrorMessage(`Unable to copy message, xclip is not installed. You can install it via \`sudo apt-get install xclip\``);
return;
}
Logger.error(err, 'CopyMessageToClipboardCommand');
window.showErrorMessage(`Unable to copy message. See output channel for more details`);
}
});
return undefined;
}
catch (ex) {

+ 11
- 1
src/commands/copyShaToClipboard.ts View File

@ -66,7 +66,17 @@ export class CopyShaToClipboardCommand extends ActiveEditorCommand {
}
}
clipboard.copy(args.sha);
clipboard.copy(args.sha, (err: Error) => {
if (err) {
if (err.message.includes('xclip')) {
window.showErrorMessage(`Unable to copy commit id, xclip is not installed. You can install it via \`sudo apt-get install xclip\``);
return;
}
Logger.error(err, 'CopyShaToClipboardCommand');
window.showErrorMessage(`Unable to copy commit id. See output channel for more details`);
}
});
return undefined;
}
catch (ex) {

Loading…
Cancel
Save