未验证 提交 d4ab1fcd 编写于 作者: M Matt Bierner 提交者: GitHub

Fixes more node 12 typing errors (#85420)

* 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
上级 52bdec0d
......@@ -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);
......
......@@ -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);
}
......@@ -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);
......@@ -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;
});
}
......
......@@ -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>;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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) {
......
......@@ -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';
......@@ -807,7 +808,7 @@ export class DebugService implements IDebugService {
return inactivePromise;
}
return taskPromise;
return taskPromise.then(withUndefinedAsNull);
});
return new Promise((c, e) => {
......
......@@ -275,7 +275,7 @@ async function deleteFiles(textFileService: ITextFileService, dialogService: IDi
});
});
return servicePromise;
return servicePromise.then(undefined);
});
});
}
......
......@@ -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);
}
......
......@@ -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[]>;
......
......@@ -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);
......
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册