diff --git a/src/home.ts b/src/home.ts index 37baf94..c923747 100644 --- a/src/home.ts +++ b/src/home.ts @@ -132,12 +132,7 @@ export default class DSHome { vscode.window.showWarningMessage(data.message) break; case 'showErrorNotification': - const selection = await vscode.window.showErrorMessage(data.message, 'Open Console', 'Report a problem',); - if (selection === 'Open Console') { - vscode.commands.executeCommand('workbench.action.toggleDevTools'); - } else if (selection === 'Report a problem') { - vscode.commands.executeCommand('vscode.open', vscode.Uri.parse('https://gitee.com/SuperIDE/DevStar/issues')); - } + await utils.showErrorNotification(data.message) break; } } diff --git a/src/utils.ts b/src/utils.ts index b9ba852..ad1e4e4 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -106,4 +106,13 @@ export async function getVsCodeCommitId(): Promise { export function getDevstarDomain(): string | undefined { // 从用户配置中读取 return vscode.workspace.getConfiguration('devstar').get('devstarDomain') +} + +export async function showErrorNotification(message: string): Promise { + const selection = await vscode.window.showErrorMessage(message, 'Open Console', 'Report a problem',); + if (selection === 'Open Console') { + vscode.commands.executeCommand('workbench.action.toggleDevTools'); + } else if (selection === 'Report a problem') { + vscode.commands.executeCommand('vscode.open', vscode.Uri.parse('https://gitee.com/SuperIDE/DevStar/issues')); + } } \ No newline at end of file