-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Modal class (mirror Toast) (#3294)
- Loading branch information
1 parent
d8ae4a0
commit 7390615
Showing
7 changed files
with
59 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
import { window } from 'vscode' | ||
import { Response } from './response' | ||
|
||
export const warnOfConsequences = ( | ||
text: string, | ||
...items: Response[] | ||
): Thenable<string | undefined> => | ||
window.showWarningMessage(text, { modal: true }, ...items) | ||
|
||
export const showInformation = ( | ||
text: string, | ||
...items: Response[] | ||
): Thenable<string | undefined> => | ||
window.showInformationMessage(text, { modal: true }, ...items) | ||
enum Level { | ||
INFORMATION = 'Information', | ||
WARNING = 'Warning' | ||
} | ||
|
||
export class Modal { | ||
public static showInformation(text: string, ...items: Response[]) { | ||
return Modal.show(Level.INFORMATION, text, ...items) | ||
} | ||
|
||
public static warnOfConsequences(text: string, ...items: Response[]) { | ||
return Modal.show(Level.WARNING, text, ...items) | ||
} | ||
|
||
private static show( | ||
level: Level, | ||
message: string, | ||
...items: Response[] | ||
): Thenable<Response | undefined> { | ||
return window[`show${level}Message`](message, { modal: true }, ...items) | ||
} | ||
} |