refactor: set showErrorNotification as a function for reuse
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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'));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user