refactor: set showErrorNotification as a function for reuse

This commit is contained in:
Levi Yan
2025-03-23 17:15:33 +08:00
parent 5813fe2c20
commit 4188072065
2 changed files with 10 additions and 6 deletions

View File

@@ -106,4 +106,13 @@ export async function getVsCodeCommitId(): Promise<string> {
export function getDevstarDomain(): string | undefined {
// 从用户配置中读取
return vscode.workspace.getConfiguration('devstar').get('devstarDomain')
}
export async function showErrorNotification(message: string): Promise<void> {
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'));
}
}