|
1 | | -// Copyright (c) Microsoft Corporation. All rights reserved. |
2 | | -// Licensed under the MIT License. |
3 | | -'use strict'; |
4 | | - |
5 | | -// tslint:disable:no-var-requires no-any unified-signatures |
6 | | - |
7 | | -import { injectable } from 'inversify'; |
8 | | -import { CancellationToken, Disposable, env, InputBox, InputBoxOptions, MessageItem, MessageOptions, OpenDialogOptions, Progress, ProgressOptions, QuickPick, QuickPickItem, QuickPickOptions, SaveDialogOptions, StatusBarAlignment, StatusBarItem, TreeView, TreeViewOptions, Uri, window, WorkspaceFolder, WorkspaceFolderPickOptions } from 'vscode'; |
9 | | -import { IApplicationShell } from './types'; |
10 | | - |
11 | | -@injectable() |
12 | | -export class ApplicationShell implements IApplicationShell { |
13 | | - public showInformationMessage(message: string, ...items: string[]): Thenable<string>; |
14 | | - public showInformationMessage(message: string, options: MessageOptions, ...items: string[]): Thenable<string>; |
15 | | - public showInformationMessage<T extends MessageItem>(message: string, ...items: T[]): Thenable<T>; |
16 | | - public showInformationMessage<T extends MessageItem>(message: string, options: MessageOptions, ...items: T[]): Thenable<T>; |
17 | | - public showInformationMessage(message: string, options?: any, ...items: any[]): Thenable<any> { |
18 | | - return window.showInformationMessage(message, options, ...items); |
19 | | - } |
20 | | - |
21 | | - public showWarningMessage(message: string, ...items: string[]): Thenable<string>; |
22 | | - public showWarningMessage(message: string, options: MessageOptions, ...items: string[]): Thenable<string>; |
23 | | - public showWarningMessage<T extends MessageItem>(message: string, ...items: T[]): Thenable<T>; |
24 | | - public showWarningMessage<T extends MessageItem>(message: string, options: MessageOptions, ...items: T[]): Thenable<T>; |
25 | | - public showWarningMessage(message: any, options?: any, ...items: any[]) { |
26 | | - return window.showWarningMessage(message, options, ...items); |
27 | | - } |
28 | | - |
29 | | - public showErrorMessage(message: string, ...items: string[]): Thenable<string>; |
30 | | - public showErrorMessage(message: string, options: MessageOptions, ...items: string[]): Thenable<string>; |
31 | | - public showErrorMessage<T extends MessageItem>(message: string, ...items: T[]): Thenable<T>; |
32 | | - public showErrorMessage<T extends MessageItem>(message: string, options: MessageOptions, ...items: T[]): Thenable<T>; |
33 | | - public showErrorMessage(message: any, options?: any, ...items: any[]) { |
34 | | - return window.showErrorMessage(message, options, ...items); |
35 | | - } |
36 | | - |
37 | | - public showQuickPick(items: string[] | Thenable<string[]>, options?: QuickPickOptions, token?: CancellationToken): Thenable<string>; |
38 | | - public showQuickPick<T extends QuickPickItem>(items: T[] | Thenable<T[]>, options?: QuickPickOptions, token?: CancellationToken): Thenable<T>; |
39 | | - public showQuickPick(items: any, options?: any, token?: any): Thenable<any> { |
40 | | - return window.showQuickPick(items, options, token); |
41 | | - } |
42 | | - |
43 | | - public showOpenDialog(options: OpenDialogOptions): Thenable<Uri[] | undefined> { |
44 | | - return window.showOpenDialog(options); |
45 | | - } |
46 | | - public showSaveDialog(options: SaveDialogOptions): Thenable<Uri | undefined> { |
47 | | - return window.showSaveDialog(options); |
48 | | - } |
49 | | - public showInputBox(options?: InputBoxOptions, token?: CancellationToken): Thenable<string | undefined> { |
50 | | - return window.showInputBox(options, token); |
51 | | - } |
52 | | - public openUrl(url: string): void { |
53 | | - env.openExternal(Uri.parse(url)); |
54 | | - } |
55 | | - |
56 | | - public setStatusBarMessage(text: string, hideAfterTimeout: number): Disposable; |
57 | | - public setStatusBarMessage(text: string, hideWhenDone: Thenable<any>): Disposable; |
58 | | - public setStatusBarMessage(text: string): Disposable; |
59 | | - public setStatusBarMessage(text: string, arg?: any): Disposable { |
60 | | - return window.setStatusBarMessage(text, arg); |
61 | | - } |
62 | | - |
63 | | - public createStatusBarItem(alignment?: StatusBarAlignment, priority?: number): StatusBarItem { |
64 | | - return window.createStatusBarItem(alignment, priority); |
65 | | - } |
66 | | - public showWorkspaceFolderPick(options?: WorkspaceFolderPickOptions): Thenable<WorkspaceFolder | undefined> { |
67 | | - return window.showWorkspaceFolderPick(options); |
68 | | - } |
69 | | - public withProgress<R>(options: ProgressOptions, task: (progress: Progress<{ message?: string; increment?: number }>, token: CancellationToken) => Thenable<R>): Thenable<R> { |
70 | | - return window.withProgress<R>(options, task); |
71 | | - } |
72 | | - public createQuickPick<T extends QuickPickItem>(): QuickPick<T> { |
73 | | - return window.createQuickPick<T>(); |
74 | | - } |
75 | | - public createInputBox(): InputBox { |
76 | | - return window.createInputBox(); |
77 | | - } |
78 | | - public createTreeView<T>(viewId: string, options: TreeViewOptions<T>): TreeView<T> { |
79 | | - return window.createTreeView<T>(viewId, options); |
80 | | - } |
81 | | - |
82 | | -} |
| 1 | +// Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | +// Licensed under the MIT License. |
| 3 | +'use strict'; |
| 4 | + |
| 5 | +// tslint:disable:no-var-requires no-any unified-signatures |
| 6 | + |
| 7 | +import { injectable } from 'inversify'; |
| 8 | +import { CancellationToken, Disposable, env, InputBox, InputBoxOptions, MessageItem, MessageOptions, OpenDialogOptions, OutputChannel, Progress, ProgressOptions, QuickPick, QuickPickItem, QuickPickOptions, SaveDialogOptions, StatusBarAlignment, StatusBarItem, TreeView, TreeViewOptions, Uri, window, WorkspaceFolder, WorkspaceFolderPickOptions } from 'vscode'; |
| 9 | +import { IApplicationShell } from './types'; |
| 10 | + |
| 11 | +@injectable() |
| 12 | +export class ApplicationShell implements IApplicationShell { |
| 13 | + public showInformationMessage(message: string, ...items: string[]): Thenable<string>; |
| 14 | + public showInformationMessage(message: string, options: MessageOptions, ...items: string[]): Thenable<string>; |
| 15 | + public showInformationMessage<T extends MessageItem>(message: string, ...items: T[]): Thenable<T>; |
| 16 | + public showInformationMessage<T extends MessageItem>(message: string, options: MessageOptions, ...items: T[]): Thenable<T>; |
| 17 | + public showInformationMessage(message: string, options?: any, ...items: any[]): Thenable<any> { |
| 18 | + return window.showInformationMessage(message, options, ...items); |
| 19 | + } |
| 20 | + |
| 21 | + public showWarningMessage(message: string, ...items: string[]): Thenable<string>; |
| 22 | + public showWarningMessage(message: string, options: MessageOptions, ...items: string[]): Thenable<string>; |
| 23 | + public showWarningMessage<T extends MessageItem>(message: string, ...items: T[]): Thenable<T>; |
| 24 | + public showWarningMessage<T extends MessageItem>(message: string, options: MessageOptions, ...items: T[]): Thenable<T>; |
| 25 | + public showWarningMessage(message: any, options?: any, ...items: any[]) { |
| 26 | + return window.showWarningMessage(message, options, ...items); |
| 27 | + } |
| 28 | + |
| 29 | + public showErrorMessage(message: string, ...items: string[]): Thenable<string>; |
| 30 | + public showErrorMessage(message: string, options: MessageOptions, ...items: string[]): Thenable<string>; |
| 31 | + public showErrorMessage<T extends MessageItem>(message: string, ...items: T[]): Thenable<T>; |
| 32 | + public showErrorMessage<T extends MessageItem>(message: string, options: MessageOptions, ...items: T[]): Thenable<T>; |
| 33 | + public showErrorMessage(message: any, options?: any, ...items: any[]) { |
| 34 | + return window.showErrorMessage(message, options, ...items); |
| 35 | + } |
| 36 | + |
| 37 | + public showQuickPick(items: string[] | Thenable<string[]>, options?: QuickPickOptions, token?: CancellationToken): Thenable<string>; |
| 38 | + public showQuickPick<T extends QuickPickItem>(items: T[] | Thenable<T[]>, options?: QuickPickOptions, token?: CancellationToken): Thenable<T>; |
| 39 | + public showQuickPick(items: any, options?: any, token?: any): Thenable<any> { |
| 40 | + return window.showQuickPick(items, options, token); |
| 41 | + } |
| 42 | + |
| 43 | + public showOpenDialog(options: OpenDialogOptions): Thenable<Uri[] | undefined> { |
| 44 | + return window.showOpenDialog(options); |
| 45 | + } |
| 46 | + public showSaveDialog(options: SaveDialogOptions): Thenable<Uri | undefined> { |
| 47 | + return window.showSaveDialog(options); |
| 48 | + } |
| 49 | + public showInputBox(options?: InputBoxOptions, token?: CancellationToken): Thenable<string | undefined> { |
| 50 | + return window.showInputBox(options, token); |
| 51 | + } |
| 52 | + public openUrl(url: string): void { |
| 53 | + env.openExternal(Uri.parse(url)); |
| 54 | + } |
| 55 | + |
| 56 | + public setStatusBarMessage(text: string, hideAfterTimeout: number): Disposable; |
| 57 | + public setStatusBarMessage(text: string, hideWhenDone: Thenable<any>): Disposable; |
| 58 | + public setStatusBarMessage(text: string): Disposable; |
| 59 | + public setStatusBarMessage(text: string, arg?: any): Disposable { |
| 60 | + return window.setStatusBarMessage(text, arg); |
| 61 | + } |
| 62 | + |
| 63 | + public createStatusBarItem(alignment?: StatusBarAlignment, priority?: number): StatusBarItem { |
| 64 | + return window.createStatusBarItem(alignment, priority); |
| 65 | + } |
| 66 | + public showWorkspaceFolderPick(options?: WorkspaceFolderPickOptions): Thenable<WorkspaceFolder | undefined> { |
| 67 | + return window.showWorkspaceFolderPick(options); |
| 68 | + } |
| 69 | + public withProgress<R>(options: ProgressOptions, task: (progress: Progress<{ message?: string; increment?: number }>, token: CancellationToken) => Thenable<R>): Thenable<R> { |
| 70 | + return window.withProgress<R>(options, task); |
| 71 | + } |
| 72 | + public createQuickPick<T extends QuickPickItem>(): QuickPick<T> { |
| 73 | + return window.createQuickPick<T>(); |
| 74 | + } |
| 75 | + public createInputBox(): InputBox { |
| 76 | + return window.createInputBox(); |
| 77 | + } |
| 78 | + public createTreeView<T>(viewId: string, options: TreeViewOptions<T>): TreeView<T> { |
| 79 | + return window.createTreeView<T>(viewId, options); |
| 80 | + } |
| 81 | + public createOutputChannel(name: string): OutputChannel { |
| 82 | + return window.createOutputChannel(name); |
| 83 | + } |
| 84 | + |
| 85 | +} |
0 commit comments