Skip to content

Commit

Permalink
Fixes more node 12 typing errors (#85420)
Browse files Browse the repository at this point in the history
* Fixes more node 12 typing errors

For #82514

* Remove Symbol.toStringTag usage for now

* Reverting a few fixes that are not comptible with current node typings

* Revert one more use of StringDecoder

Must wait until we actually pick up the new typings
  • Loading branch information
mjbvz committed Nov 26, 2019
1 parent 52bdec0 commit d4ab1fc
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/vs/editor/contrib/gotoError/gotoError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class MarkerModel {
this._markers = [];
this._nextIdx = -1;
this._ignoreSelectionChange = false;
this._onCurrentMarkerChanged = new Emitter<IMarker>();
this._onCurrentMarkerChanged = new Emitter<IMarker | undefined>();
this._onMarkerSetChanged = new Emitter<MarkerModel>();
this.setMarkers(markers);

Expand Down
4 changes: 2 additions & 2 deletions src/vs/platform/request/node/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ export async function getProxyAgent(rawRequestURL: string, options: IOptions = {
host: proxyEndpoint.hostname || '',
port: proxyEndpoint.port || (proxyEndpoint.protocol === 'https' ? '443' : '80'),
auth: proxyEndpoint.auth,
rejectUnauthorized: isBoolean(options.strictSSL) ? options.strictSSL : true
rejectUnauthorized: isBoolean(options.strictSSL) ? options.strictSSL : true,
};

return requestURL.protocol === 'http:'
? new (await import('http-proxy-agent'))(opts)
? new (await import('http-proxy-agent'))(opts as any as Url)
: new (await import('https-proxy-agent'))(opts);
}
8 changes: 4 additions & 4 deletions src/vs/workbench/api/browser/mainThreadWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
if (!isPromiseCanceledError(err)) {
return Promise.reject(err);
}
return undefined;
return null;
});
}

$startTextSearch(pattern: IPatternInfo, options: ITextQueryBuilderOptions, requestId: number, token: CancellationToken): Promise<ITextSearchComplete> {
$startTextSearch(pattern: IPatternInfo, options: ITextQueryBuilderOptions, requestId: number, token: CancellationToken): Promise<ITextSearchComplete | undefined> {
const workspace = this._contextService.getWorkspace();
const folders = workspace.folders.map(folder => folder.uri);

Expand Down Expand Up @@ -198,14 +198,14 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {

return this._searchService.fileSearch(query, token).then(
result => {
return result.limitHit;
return !!result.limitHit;
},
err => {
if (!isPromiseCanceledError(err)) {
return Promise.reject(err);
}

return undefined;
return false;
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHost.protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ export interface ITextSearchComplete {

export interface MainThreadWorkspaceShape extends IDisposable {
$startFileSearch(includePattern: string | null, includeFolder: UriComponents | null, excludePatternOrDisregardExcludes: string | false | null, maxResults: number | null, token: CancellationToken): Promise<UriComponents[] | null>;
$startTextSearch(query: search.IPatternInfo, options: ITextQueryBuilderOptions, requestId: number, token: CancellationToken): Promise<ITextSearchComplete>;
$startTextSearch(query: search.IPatternInfo, options: ITextQueryBuilderOptions, requestId: number, token: CancellationToken): Promise<ITextSearchComplete | undefined>;
$checkExists(folders: UriComponents[], includes: string[], token: CancellationToken): Promise<boolean>;
$saveAll(includeUntitled?: boolean): Promise<boolean>;
$updateWorkspaceFolders(extensionName: string, index: number, deleteCount: number, workspaceFoldersToAdd: { uri: UriComponents, name?: string; }[]): Promise<void>;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHostDebugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ export class ExtHostDebugServiceBase implements IExtHostDebugService, ExtHostDeb
public async $substituteVariables(folderUri: UriComponents | undefined, config: IConfig): Promise<IConfig> {
if (!this._variableResolver) {
const [workspaceFolders, configProvider] = await Promise.all([this._workspaceService.getWorkspaceFolders2(), this._configurationService.getConfigProvider()]);
this._variableResolver = this.createVariableResolver(workspaceFolders || [], this._editorsService, configProvider);
this._variableResolver = this.createVariableResolver(workspaceFolders || [], this._editorsService, configProvider!);
}
let ws: IWorkspaceFolder | undefined;
const folder = await this.getFolder(folderUri);
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHostQuickOpen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {

// ---- input

showInput(options?: InputBoxOptions, token: CancellationToken = CancellationToken.None): Promise<string> {
showInput(options?: InputBoxOptions, token: CancellationToken = CancellationToken.None): Promise<string | undefined> {

// global validate fn used in callback below
this._validateInput = options ? options.validateInput : undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHostTreeViews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ class ExtHostTreeView<T> extends Disposable {
// check if an ancestor of extElement is already in the elements to update list
let currentNode: TreeNode | undefined = elementNode;
while (currentNode && currentNode.parent && !elementsToUpdate.has(currentNode.parent.item.handle)) {
const parentElement = this.elements.get(currentNode.parent.item.handle);
const parentElement: T | undefined = this.elements.get(currentNode.parent.item.handle);
currentNode = parentElement ? this.nodes.get(parentElement) : undefined;
}
if (currentNode && !currentNode.parent) {
Expand Down
3 changes: 2 additions & 1 deletion src/vs/workbench/contrib/debug/browser/debugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { RunOnceScheduler } from 'vs/base/common/async';
import { IExtensionHostDebugService } from 'vs/platform/debug/common/extensionHostDebug';
import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
import { CancellationTokenSource } from 'vs/base/common/cancellation';
import { withUndefinedAsNull } from 'vs/base/common/types';

const DEBUG_BREAKPOINTS_KEY = 'debug.breakpoint';
const DEBUG_FUNCTION_BREAKPOINTS_KEY = 'debug.functionbreakpoint';
Expand Down Expand Up @@ -807,7 +808,7 @@ export class DebugService implements IDebugService {
return inactivePromise;
}

return taskPromise;
return taskPromise.then(withUndefinedAsNull);
});

return new Promise((c, e) => {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/files/browser/fileActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ async function deleteFiles(textFileService: ITextFileService, dialogService: IDi
});
});

return servicePromise;
return servicePromise.then(undefined);
});
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
});
}

public run(task: Task | undefined, options?: ProblemMatcherRunOptions, runSource: TaskRunSource = TaskRunSource.System): Promise<ITaskSummary> {
public run(task: Task | undefined, options?: ProblemMatcherRunOptions, runSource: TaskRunSource = TaskRunSource.System): Promise<ITaskSummary | undefined> {
if (!task) {
throw new TaskError(Severity.Info, nls.localize('TaskServer.noTask', 'Task to execute is undefined'), TaskErrors.TaskNotFound);
}
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/tasks/common/taskService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface ITaskService {
configureAction(): Action;
build(): Promise<ITaskSummary>;
runTest(): Promise<ITaskSummary>;
run(task: Task | undefined, options?: ProblemMatcherRunOptions): Promise<ITaskSummary>;
run(task: Task | undefined, options?: ProblemMatcherRunOptions): Promise<ITaskSummary | undefined>;
inTerminal(): boolean;
isActive(): Promise<boolean>;
getActiveTasks(): Promise<Task[]>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export class ConfigurationEditingService {
writeConfiguration(target: EditableConfigurationTarget, value: IConfigurationValue, options: IConfigurationEditingOptions = {}): Promise<void> {
const operation = this.getConfigurationEditOperation(target, value, options.scopes || {});
return Promise.resolve(this.queue.queue(() => this.doWriteConfiguration(operation, options) // queue up writes to prevent race conditions
.then(() => null,
.then(() => { },
error => {
if (!options.donotNotifyError) {
this.onError(error, operation, options.scopes);
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/services/search/node/rawSearchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export class SearchService implements IRawSearchService {
cancel() {
// Do nothing
}
then(resolve: any, reject: any) {
then<TResult1 = C, TResult2 = never>(resolve?: ((value: C) => TResult1 | Promise<TResult1>) | undefined | null, reject?: ((reason: any) => TResult2 | Promise<TResult2>) | undefined | null): Promise<TResult1 | TResult2> {
return promise.then(resolve, reject);
}
catch(reject?: any) {
Expand Down

0 comments on commit d4ab1fc

Please sign in to comment.