mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Fix VSCode/Extensions for TS 2.3.1 (#25248)
From: https://github.com/Microsoft/TypeScript/issues/15352 TS 2.3.1 introduced a breaking change around checking of generic types. This change tries to fix these compiler errors in the extensions codebase
This commit is contained in:
@@ -117,13 +117,15 @@ export default class TypeScriptFormattingProvider implements DocumentRangeFormat
|
||||
if (!absPath) {
|
||||
return Promise.resolve(Object.create(null));
|
||||
}
|
||||
|
||||
const formatOptions = this.getFormatOptions(options);
|
||||
const args: Proto.ConfigureRequestArguments = {
|
||||
file: absPath,
|
||||
formatOptions: this.getFormatOptions(options)
|
||||
formatOptions: formatOptions
|
||||
};
|
||||
return this.client.execute('configure', args, token).then(_ => {
|
||||
this.formatOptions[key] = args.formatOptions;
|
||||
return args.formatOptions;
|
||||
this.formatOptions[key] = formatOptions;
|
||||
return formatOptions;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ export function activate(context: ExtensionContext): void {
|
||||
window.onDidChangeActiveTextEditor(VersionStatus.showHideStatus, null, context.subscriptions);
|
||||
client.onReady().then(() => {
|
||||
context.subscriptions.push(ProjectStatus.create(client,
|
||||
path => new Promise(resolve => setTimeout(() => resolve(clientHost.handles(path)), 750)),
|
||||
path => new Promise<boolean>(resolve => setTimeout(() => resolve(clientHost.handles(path)), 750)),
|
||||
context.workspaceState));
|
||||
}, () => {
|
||||
// Nothing to do here. The client did show a message;
|
||||
|
||||
@@ -686,7 +686,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
|
||||
if (localModulePath) {
|
||||
tryShowRestart(localModulePath);
|
||||
}
|
||||
return localModulePath;
|
||||
return localModulePath || '';
|
||||
});
|
||||
case MessageAction.useBundled:
|
||||
return this.workspaceState.update(TypeScriptServiceClient.useWorkspaceTsdkStorageKey, false)
|
||||
|
||||
@@ -13,7 +13,7 @@ export class Delayer<T> {
|
||||
|
||||
public defaultDelay: number;
|
||||
private timeout: any; // Timer
|
||||
private completionPromise: Promise<T> | null;
|
||||
private completionPromise: Promise<T | null> | null;
|
||||
private onSuccess: ((value?: T | Thenable<T>) => void) | null;
|
||||
private task: ITask<T> | null;
|
||||
|
||||
@@ -25,7 +25,7 @@ export class Delayer<T> {
|
||||
this.task = null;
|
||||
}
|
||||
|
||||
public trigger(task: ITask<T>, delay: number = this.defaultDelay): Promise<T> {
|
||||
public trigger(task: ITask<T>, delay: number = this.defaultDelay): Promise<T | null> {
|
||||
this.task = task;
|
||||
if (delay >= 0) {
|
||||
this.cancelTimeout();
|
||||
@@ -55,7 +55,7 @@ export class Delayer<T> {
|
||||
return this.completionPromise;
|
||||
}
|
||||
|
||||
public forceDelivery(): Promise<T> | null {
|
||||
public forceDelivery(): Promise<T | null> | null {
|
||||
if (!this.completionPromise) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user