File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import * as vscode from 'vscode';
22import { createPanel } from './panel' ;
33import { Parser } from './parser' ;
44import { Tree } from './types/tree' ;
5+ import { showNotification } from './utils/modal' ;
56
67let tree : Parser | undefined = undefined ;
78let panel : vscode . WebviewPanel | undefined = undefined ;
@@ -27,7 +28,7 @@ function activate(context: vscode.ExtensionContext) {
2728
2829 // Throw error message if no file was selected
2930 if ( ! fileArray || fileArray . length === 0 ) {
30- vscode . window . showErrorMessage ( 'No file selected' ) ;
31+ showNotification ( { message : 'No file selected' } ) ;
3132 return ;
3233 }
3334
Original file line number Diff line number Diff line change 1+ import * as vscode from 'vscode' ;
2+
3+ export async function showNotification ( { message, timeout = 5000 } : { message : string , timeout ?: number } ) {
4+ await vscode . window . withProgress (
5+ {
6+ location : vscode . ProgressLocation . Notification ,
7+ cancellable : false
8+ } ,
9+ async ( progress ) => {
10+ progress . report ( { increment : 100 , message : `${ message } ` } ) ;
11+ await new Promise ( ( resolve ) => setTimeout ( resolve , timeout ) ) ;
12+ }
13+ ) ;
14+ }
You can’t perform that action at this time.
0 commit comments