mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
fix ts 2.4.1 compile errors in workbench/api
This commit is contained in:
@@ -129,7 +129,7 @@ export function createApiFactory(
|
||||
return extHostCommands.registerCommand(id, command, thisArgs);
|
||||
},
|
||||
registerTextEditorCommand(id: string, callback: (textEditor: vscode.TextEditor, edit: vscode.TextEditorEdit, ...args: any[]) => void, thisArg?: any): vscode.Disposable {
|
||||
return extHostCommands.registerCommand(id, (...args: any[]) => {
|
||||
return extHostCommands.registerCommand(id, (...args: any[]): any => {
|
||||
let activeTextEditor = extHostEditors.getActiveTextEditor();
|
||||
if (!activeTextEditor) {
|
||||
console.warn('Cannot execute ' + id + ' because there is no active text editor.');
|
||||
@@ -313,7 +313,7 @@ export function createApiFactory(
|
||||
},
|
||||
withScmProgress<R>(task: (progress: vscode.Progress<number>) => Thenable<R>) {
|
||||
console.warn(`[Deprecation Warning] function 'withScmProgress' is deprecated and should no longer be used. Use 'withProgress' instead.`);
|
||||
return extHostProgress.withProgress(extension, { location: extHostTypes.ProgressLocation.SourceControl }, task);
|
||||
return extHostProgress.withProgress(extension, { location: extHostTypes.ProgressLocation.SourceControl }, (progress, token) => task({ report(n: number) { /*noop*/ } }));
|
||||
},
|
||||
withProgress<R>(options: vscode.ProgressOptions, task: (progress: vscode.Progress<{ message?: string; percentage?: number }>) => Thenable<R>) {
|
||||
return extHostProgress.withProgress(extension, options, task);
|
||||
|
||||
@@ -84,9 +84,9 @@ export class InstanceCollection {
|
||||
public define<T>(id: ProxyIdentifier<T>): InstanceSetter<T> {
|
||||
let that = this;
|
||||
return new class {
|
||||
set(value: T) {
|
||||
set<R extends T>(value: T): R {
|
||||
that._set(id, value);
|
||||
return value;
|
||||
return <R>value;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ export class CommandsConverter {
|
||||
}
|
||||
}
|
||||
|
||||
private _executeConvertedCommand(...args: any[]) {
|
||||
private _executeConvertedCommand<R>(...args: any[]): Thenable<R> {
|
||||
const actualCmd = this._heap.get<vscode.Command>(args[0]);
|
||||
return this._commands.executeCommand(actualCmd.command, ...actualCmd.arguments);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,9 @@ export class ExtHostMessageService {
|
||||
this._proxy = threadService.get(MainContext.MainThreadMessageService);
|
||||
}
|
||||
|
||||
showMessage(severity: Severity, message: string, optionsOrFirstItem: vscode.MessageOptions | string | vscode.MessageItem, rest: (string | vscode.MessageItem)[]): Thenable<string | vscode.MessageItem> {
|
||||
showMessage(severity: Severity, message: string, optionsOrFirstItem: vscode.MessageOptions | string, rest: string[]): Thenable<string | undefined>;
|
||||
showMessage(severity: Severity, message: string, optionsOrFirstItem: vscode.MessageOptions | vscode.MessageItem, rest: vscode.MessageItem[]): Thenable<vscode.MessageItem | undefined>;
|
||||
showMessage(severity: Severity, message: string, optionsOrFirstItem: vscode.MessageOptions | string | vscode.MessageItem, rest: (string | vscode.MessageItem)[]): Thenable<string | vscode.MessageItem | undefined> {
|
||||
const { options, items } = parseMessageArguments(optionsOrFirstItem, rest);
|
||||
const commands: { title: string; isCloseAffordance: boolean; handle: number; }[] = [];
|
||||
|
||||
|
||||
@@ -24,7 +24,9 @@ export class ExtHostQuickOpen extends ExtHostQuickOpenShape {
|
||||
this._proxy = threadService.get(MainContext.MainThreadQuickOpen);
|
||||
}
|
||||
|
||||
showQuickPick(itemsOrItemsPromise: Item[] | Thenable<Item[]>, options?: QuickPickOptions, token: CancellationToken = CancellationToken.None): Thenable<Item> {
|
||||
showQuickPick(itemsOrItemsPromise: string[] | Thenable<string[]>, options?: QuickPickOptions, token?: CancellationToken): Thenable<string | undefined>;
|
||||
showQuickPick(itemsOrItemsPromise: QuickPickItem[] | Thenable<QuickPickItem[]>, options?: QuickPickOptions, token?: CancellationToken): Thenable<QuickPickItem | undefined>;
|
||||
showQuickPick(itemsOrItemsPromise: Item[] | Thenable<Item[]>, options?: QuickPickOptions, token: CancellationToken = CancellationToken.None): Thenable<Item | undefined> {
|
||||
|
||||
// clear state from last invocation
|
||||
this._onDidSelectItem = undefined;
|
||||
|
||||
Reference in New Issue
Block a user