diff --git a/CREDITS.md b/CREDITS.md index c312ea4..6267177 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -9,3 +9,4 @@ - [BrianKmdy](https://github.com/BrianKmdy) - [tomoum](https://github.com/tomoum) - [grooc](https://github.com/grooc) +- [jackiotyu](https://github.com/jackiotyu) diff --git a/src/git/operations/worktree/gitWorktreeAdd.ts b/src/git/operations/worktree/gitWorktreeAdd.ts index 206e45c..3b11db6 100644 --- a/src/git/operations/worktree/gitWorktreeAdd.ts +++ b/src/git/operations/worktree/gitWorktreeAdd.ts @@ -83,13 +83,12 @@ const gitWorktreeAdd = async (): Promise => { } } catch (e: any) { const errorMessage = e.message; - const buttonName = "Open an Issue"; - // const buttonName = "Copy Error and Open an Issue"; + const buttonName = "Copy Error and Open an Issue"; const answer = await showErrorMessageWithButton({ errorMessage, buttonName }); if (answer !== buttonName) return; - // await copyToClipboard(errorMessage); + await copyToClipboard(errorMessage); await openBrowser(OPEN_ISSUE_URL); } }; diff --git a/src/git/operations/worktree/gitWorktreeList.ts b/src/git/operations/worktree/gitWorktreeList.ts index 15c425d..a2e2909 100644 --- a/src/git/operations/worktree/gitWorktreeList.ts +++ b/src/git/operations/worktree/gitWorktreeList.ts @@ -19,13 +19,12 @@ const gitWorktreeList = async (): Promise => { await moveIntoWorktree(workspaceFolder, worktree.detail); } catch (e: any) { const errorMessage = e.message; - const buttonName = "Open an Issue"; - // const buttonName = "Copy Error and Open an Issue"; + const buttonName = "Copy Error and Open an Issue"; const answer = await showErrorMessageWithButton({ errorMessage, buttonName }); if (answer !== buttonName) return; - // await copyToClipboard(errorMessage); + await copyToClipboard(errorMessage); await openBrowser(OPEN_ISSUE_URL); } }; diff --git a/src/git/operations/worktree/gitWorktreeRemove.ts b/src/git/operations/worktree/gitWorktreeRemove.ts index 506fb4c..33e8084 100644 --- a/src/git/operations/worktree/gitWorktreeRemove.ts +++ b/src/git/operations/worktree/gitWorktreeRemove.ts @@ -25,13 +25,12 @@ const gitWorktreeRemove = async (): Promise => { await showInformationMessage(`Worktree named '${worktree.label}' was removed successfully`); } catch (e: any) { const errorMessage = e.message; - const buttonName = "Open an Issue"; - // const buttonName = "Copy Error and Open an Issue"; + const buttonName = "Copy Error and Open an Issue"; const answer = await showErrorMessageWithButton({ errorMessage, buttonName }); if (answer !== buttonName) return; - // await copyToClipboard(errorMessage); + await copyToClipboard(errorMessage); await openBrowser(OPEN_ISSUE_URL); } }; diff --git a/src/helpers/helpers.ts b/src/helpers/helpers.ts index b0d489a..4094fa9 100644 --- a/src/helpers/helpers.ts +++ b/src/helpers/helpers.ts @@ -10,9 +10,8 @@ export const getCurrentPath = () => vscode.workspace.rootPath; export const getWorkspaceFilePath = () => vscode.workspace.workspaceFile; -// TODO: fix this function export const copyToClipboard = async (content = "") => - await require("child_process").spawn("clip").stdin.end(util.inspect(content)); + await vscode.env.clipboard.writeText(util.inspect(content)); const calculateBrowserStart = async () => { let start = "xdg-open";