提交 a460624f 编写于 作者: M Matt Bierner 提交者: GitHub

Fix more Compiler Errors for TS 2.4 in the VSCode codebase (#29055)

* Fix more Compiler Errors for TS 2.4 in the VSCode codebase

* Fix compile error for 2.3
上级 5b4f203e
此差异已折叠。
......@@ -471,10 +471,13 @@ export class SimpleResourceConfigurationService implements ITextResourceConfigur
_serviceBrand: any;
public readonly onDidUpdateConfiguration: Event<any>;
public readonly onDidUpdateConfiguration: Event<void>;
private readonly _onDidUpdateConfigurationEmitter = new Emitter();
constructor(private configurationService: SimpleConfigurationService) {
this.onDidUpdateConfiguration = this.configurationService.onDidUpdateConfiguration;
this.configurationService.onDidUpdateConfiguration(() => {
this._onDidUpdateConfigurationEmitter.fire();
});
}
public getConfiguration<T>(): T {
......
......@@ -83,7 +83,7 @@ export class ConfigurationService<T> extends Disposable implements IConfiguratio
return this._configuration.values();
}
public getConfigurationData(): IConfigurationData<T> {
public getConfigurationData<T2>(): IConfigurationData<T2> {
return this.configuration().toData();
}
......
......@@ -17,7 +17,7 @@ import { IHighlightEvent, ITree } from 'vs/base/parts/tree/browser/tree';
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
import { CollapsibleState, ViewSizing } from 'vs/base/browser/ui/splitview/splitview';
import { CollapseAction } from 'vs/workbench/browser/viewlet';
import { CollapsibleView, IViewletViewOptions } from 'vs/workbench/parts/views/browser/views';
import { CollapsibleView, IViewletViewOptions, IViewOptions } from 'vs/workbench/parts/views/browser/views';
import { IDebugService, State, IBreakpoint, IExpression, CONTEXT_BREAKPOINTS_FOCUSED, CONTEXT_WATCH_EXPRESSIONS_FOCUSED, CONTEXT_VARIABLES_FOCUSED } from 'vs/workbench/parts/debug/common/debug';
import { Expression, Variable, ExceptionBreakpoint, FunctionBreakpoint, Thread, StackFrame, Breakpoint, ThreadAndProcessIds } from 'vs/workbench/parts/debug/common/debugModel';
import * as viewer from 'vs/workbench/parts/debug/electron-browser/debugViewer';
......@@ -60,7 +60,7 @@ export class VariablesView extends CollapsibleView {
@IListService private listService: IListService,
@IThemeService private themeService: IThemeService
) {
super({ ...options, sizing: ViewSizing.Flexible, ariaHeaderLabel: nls.localize('variablesSection', "Variables Section") }, keybindingService, contextMenuService);
super({ ...(options as IViewOptions), sizing: ViewSizing.Flexible, ariaHeaderLabel: nls.localize('variablesSection', "Variables Section") }, keybindingService, contextMenuService);
this.settings = options.viewletSettings;
this.variablesFocusedContext = CONTEXT_VARIABLES_FOCUSED.bindTo(contextKeyService);
......@@ -168,7 +168,7 @@ export class WatchExpressionsView extends CollapsibleView {
@IListService private listService: IListService,
@IThemeService private themeService: IThemeService
) {
super({ ...options, ariaHeaderLabel: nls.localize('expressionsSection', "Expressions Section"), sizing: ViewSizing.Flexible }, keybindingService, contextMenuService);
super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('expressionsSection', "Expressions Section"), sizing: ViewSizing.Flexible }, keybindingService, contextMenuService);
this.settings = options.viewletSettings;
this.toDispose.push(this.debugService.getModel().onDidChangeWatchExpressions(we => {
......@@ -267,7 +267,7 @@ export class CallStackView extends CollapsibleView {
@IListService private listService: IListService,
@IThemeService private themeService: IThemeService
) {
super({ ...options, ariaHeaderLabel: nls.localize('callstackSection', "Call Stack Section"), sizing: ViewSizing.Flexible }, keybindingService, contextMenuService);
super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('callstackSection', "Call Stack Section"), sizing: ViewSizing.Flexible }, keybindingService, contextMenuService);
this.settings = options.viewletSettings;
// Create scheduler to prevent unnecessary flashing of tree when reacting to changes
......@@ -402,7 +402,7 @@ export class BreakpointsView extends CollapsibleView {
@IThemeService private themeService: IThemeService
) {
super({
...options,
...(options as IViewOptions),
ariaHeaderLabel: nls.localize('breakpointsSection', "Breakpoints Section"),
sizing: ViewSizing.Fixed, initialBodySize: BreakpointsView.getExpandedBodySize(
debugService.getModel().getBreakpoints().length + debugService.getModel().getFunctionBreakpoints().length + debugService.getModel().getExceptionBreakpoints().length)
......
......@@ -512,9 +512,9 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
return this.extensionService.installFromGallery(gallery, promptToInstallDependencies);
}
setEnablement(extension: IExtension, enable: boolean, workspace: boolean = false): TPromise<any> {
setEnablement(extension: IExtension, enable: boolean, workspace: boolean = false): TPromise<void> {
if (extension.type === LocalExtensionType.System) {
return TPromise.wrap(null);
return TPromise.wrap<void>(void 0);
}
return this.promptAndSetEnablement(extension, enable, workspace).then(reload => {
......
......@@ -13,7 +13,7 @@ import { IAction } from 'vs/base/common/actions';
import { Button } from 'vs/base/browser/ui/button/button';
import { $ } from 'vs/base/browser/builder';
import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { CollapsibleView, IViewletViewOptions } from 'vs/workbench/parts/views/browser/views';
import { CollapsibleView, IViewletViewOptions, IViewOptions } from 'vs/workbench/parts/views/browser/views';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { OpenFolderAction, OpenFileFolderAction } from 'vs/workbench/browser/actions/fileActions';
import { attachButtonStyler } from 'vs/platform/theme/common/styler';
......@@ -36,7 +36,7 @@ export class EmptyView extends CollapsibleView {
@IKeybindingService keybindingService: IKeybindingService,
@IContextMenuService contextMenuService: IContextMenuService
) {
super({ ...options, ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section"), sizing: ViewSizing.Flexible }, keybindingService, contextMenuService);
super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section"), sizing: ViewSizing.Flexible }, keybindingService, contextMenuService);
}
public renderHeader(container: HTMLElement): void {
......
......@@ -26,7 +26,7 @@ import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import * as DOM from 'vs/base/browser/dom';
import { CollapseAction } from 'vs/workbench/browser/viewlet';
import { CollapsibleView, IViewletViewOptions } from 'vs/workbench/parts/views/browser/views';
import { CollapsibleView, IViewletViewOptions, IViewOptions } from 'vs/workbench/parts/views/browser/views';
import { FileStat, Model } from 'vs/workbench/parts/files/common/explorerModel';
import { IListService } from 'vs/platform/list/browser/listService';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
......@@ -101,7 +101,7 @@ export class ExplorerView extends CollapsibleView {
@IWorkbenchThemeService private themeService: IWorkbenchThemeService,
@IEnvironmentService private environmentService: IEnvironmentService
) {
super({ ...options, ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section"), sizing: ViewSizing.Flexible }, keybindingService, contextMenuService);
super({ ...(options as IViewOptions), ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section"), sizing: ViewSizing.Flexible }, keybindingService, contextMenuService);
this.settings = options.viewletSettings;
this.viewletState = options.viewletState;
......
......@@ -18,7 +18,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IEditorStacksModel, IStacksModelChangeEvent, IEditorGroup } from 'vs/workbench/common/editor';
import { SaveAllAction } from 'vs/workbench/parts/files/browser/fileActions';
import { CollapsibleView, IViewletViewOptions } from 'vs/workbench/parts/views/browser/views';
import { CollapsibleView, IViewletViewOptions, IViewOptions } from 'vs/workbench/parts/views/browser/views';
import { IFilesConfiguration, VIEWLET_ID, OpenEditorsFocussedContext, ExplorerFocussedContext } from 'vs/workbench/parts/files/common/files';
import { ITextFileService, AutoSaveMode } from 'vs/workbench/services/textfile/common/textfiles';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
......@@ -71,7 +71,7 @@ export class OpenEditorsView extends CollapsibleView {
@IThemeService private themeService: IThemeService
) {
super({
...options,
...(options as IViewOptions),
ariaHeaderLabel: nls.localize({ key: 'openEditosrSection', comment: ['Open is an adjective'] }, "Open Editors Section"),
sizing: ViewSizing.Fixed,
initialBodySize: OpenEditorsView.computeExpandedBodySize(editorGroupService.getStacksModel())
......
......@@ -885,7 +885,7 @@ namespace ProblemMatcherConverter {
JSON.stringify(config, null, 4)));
return result;
} else if (kind === ProblemMatcherKind.String || kind === ProblemMatcherKind.ProblemMatcher) {
let matcher = resolveProblemMatcher(config, context);
let matcher = resolveProblemMatcher(config as ProblemMatcherConfig.ProblemMatcher, context);
if (matcher) {
result.push(matcher);
}
......
......@@ -972,7 +972,7 @@ class TaskService extends EventEmitter implements ITaskService {
public terminate(task: string | Task): TPromise<TaskTerminateResponse> {
if (!this._taskSystem) {
return TPromise.as({ success: true });
return TPromise.as({ success: true, task: undefined });
}
const id: string = Types.isString(task) ? task : task._id;
return this._taskSystem.terminate(id);
......@@ -1138,7 +1138,7 @@ class TaskService extends EventEmitter implements ITaskService {
{
let { config, hasParseErrors } = this.getConfiguration();
if (hasParseErrors) {
return TPromise.as({ set: undefined, hasErrors: true });
return TPromise.as({ set: undefined, hasErrors: true, annotatingTasks: undefined });
}
let engine = TaskConfig.ExecutionEngine._default;
if (config) {
......
......@@ -6,7 +6,7 @@
'use strict';
import * as assert from 'assert';
import { IConfigurationService, getConfigurationValue } from 'vs/platform/configuration/common/configuration';
import { IConfigurationService, getConfigurationValue, IConfigurationValue, IConfigurationOverrides } from 'vs/platform/configuration/common/configuration';
import { Platform } from 'vs/base/common/platform';
import { TPromise } from 'vs/base/common/winjs.base';
import { TerminalConfigHelper } from 'vs/workbench/parts/terminal/electron-browser/terminalConfigHelper';
......@@ -18,7 +18,7 @@ class MockConfigurationService implements IConfigurationService {
public serviceId = IConfigurationService;
public constructor(private configuration: any = {}) { }
public reloadConfiguration<T>(section?: string): TPromise<T> { return TPromise.as(this.getConfiguration()); }
public lookup(key: string) { return { value: getConfigurationValue(this.getConfiguration(), key), default: getConfigurationValue(this.getConfiguration(), key), user: getConfigurationValue(this.getConfiguration(), key), workspace: void 0 }; }
public lookup<T>(key: string, overrides?: IConfigurationOverrides): IConfigurationValue<T> { return { value: getConfigurationValue<T>(this.getConfiguration(), key), default: getConfigurationValue<T>(this.getConfiguration(), key), user: getConfigurationValue<T>(this.getConfiguration(), key), workspace: void 0 }; }
public keys() { return { default: [], user: [], workspace: [] }; }
public values() { return {}; }
public getConfiguration(): any { return this.configuration; }
......
......@@ -29,7 +29,7 @@ import { ViewsRegistry } from 'vs/workbench/parts/views/browser/viewsRegistry';
import { ITreeViewDataProvider, ITreeItem, TreeItemCollapsibleState, TreeViewItemHandleArg } from 'vs/workbench/parts/views/common/views';
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import { CollapsibleState, ViewSizing } from 'vs/base/browser/ui/splitview/splitview';
import { CollapsibleView, IViewletViewOptions } from 'vs/workbench/parts/views/browser/views';
import { CollapsibleView, IViewletViewOptions, IViewOptions } from 'vs/workbench/parts/views/browser/views';
import { ICommandService } from 'vs/platform/commands/common/commands';
export class TreeView extends CollapsibleView {
......@@ -55,7 +55,7 @@ export class TreeView extends CollapsibleView {
@IExtensionService private extensionService: IExtensionService,
@ICommandService private commandService: ICommandService
) {
super({ ...options, ariaHeaderLabel: options.name, sizing: ViewSizing.Flexible, collapsed: options.collapsed === void 0 ? true : options.collapsed }, keybindingService, contextMenuService);
super({ ...(options as IViewOptions), ariaHeaderLabel: options.name, sizing: ViewSizing.Flexible, collapsed: options.collapsed === void 0 ? true : options.collapsed }, keybindingService, contextMenuService);
this.menus = this.instantiationService.createInstance(Menus, this.id);
this.viewFocusContext = this.contextKeyService.createKey<boolean>(this.id, void 0);
this.menus.onDidChangeTitle(() => this.updateActions(), this, this.disposables);
......
......@@ -7,7 +7,7 @@ import assert = require('assert');
import uri from 'vs/base/common/uri';
import platform = require('vs/base/common/platform');
import { TPromise } from 'vs/base/common/winjs.base';
import { IConfigurationService, getConfigurationValue } from 'vs/platform/configuration/common/configuration';
import { IConfigurationService, getConfigurationValue, IConfigurationOverrides, IConfigurationValue } from 'vs/platform/configuration/common/configuration';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
import { ConfigurationResolverService } from 'vs/workbench/services/configurationResolver/node/configurationResolverService';
......@@ -340,7 +340,7 @@ class MockConfigurationService implements IConfigurationService {
public serviceId = IConfigurationService;
public constructor(private configuration: any = {}) { }
public reloadConfiguration<T>(section?: string): TPromise<T> { return TPromise.as(this.getConfiguration()); }
public lookup(key: string) { return { value: getConfigurationValue(this.getConfiguration(), key), default: getConfigurationValue(this.getConfiguration(), key), user: getConfigurationValue(this.getConfiguration(), key), workspace: void 0 }; }
public lookup<T>(key: string, overrides?: IConfigurationOverrides): IConfigurationValue<T> { return { value: getConfigurationValue<T>(this.getConfiguration(), key), default: getConfigurationValue<T>(this.getConfiguration(), key), user: getConfigurationValue<T>(this.getConfiguration(), key), workspace: void 0 }; }
public keys() { return { default: [], user: [], workspace: [] }; }
public values() { return {}; }
public getConfiguration(): any { return this.configuration; }
......
......@@ -260,7 +260,7 @@ suite('WorkbenchEditorService', () => {
}
let ed = instantiationService.createInstance(MyEditor, 'my.editor');
let inp = instantiationService.createInstance(ResourceEditorInput, 'name', 'description', URI.from('my://resource'));
let inp = instantiationService.createInstance(ResourceEditorInput, 'name', 'description', URI.parse('my://resource'));
let delegate = instantiationService.createInstance(DelegatingWorkbenchEditorService);
delegate.setEditorOpenHandler((input, options?) => {
assert.strictEqual(input, inp);
......
......@@ -146,20 +146,20 @@ export class FileWalker {
}
// For each root folder
flow.parallel<string, void>(rootFolders, (rootFolder: string, rootFolderDone: (err?: Error) => void) => {
flow.parallel<string, void>(rootFolders, (rootFolder: string, rootFolderDone: (err: Error, result: void) => void) => {
this.call(traverse, this, rootFolder, onResult, (err?: Error) => {
if (err) {
if (isNodeTraversal) {
rootFolderDone(err);
rootFolderDone(err, undefined);
} else {
// fallback
const errorMessage = toErrorMessage(err);
console.error(errorMessage);
this.errors.push(errorMessage);
this.nodeJSTraversal(rootFolder, onResult, rootFolderDone);
this.nodeJSTraversal(rootFolder, onResult, err => rootFolderDone(err, undefined));
}
} else {
rootFolderDone();
rootFolderDone(undefined, undefined);
}
});
}, (err, result) => {
......@@ -478,11 +478,11 @@ export class FileWalker {
private doWalk(rootFolder: string, relativeParentPath: string, files: string[], onResult: (result: IRawFileMatch) => void, done: (error: Error) => void): void {
// Execute tasks on each file in parallel to optimize throughput
flow.parallel(files, (file: string, clb: (error: Error) => void): void => {
flow.parallel(files, (file: string, clb: (error: Error, result: {}) => void): void => {
// Check canceled
if (this.isCanceled || this.isLimitHit) {
return clb(null);
return clb(null, undefined);
}
// If the user searches for the exact file name, we adjust the glob matching
......@@ -496,14 +496,14 @@ export class FileWalker {
// Check exclude pattern
let currentRelativePath = relativeParentPath ? [relativeParentPath, file].join(paths.sep) : file;
if (this.excludePattern(currentRelativePath, file, () => siblings)) {
return clb(null);
return clb(null, undefined);
}
// Use lstat to detect links
let currentAbsolutePath = [rootFolder, currentRelativePath].join(paths.sep);
fs.lstat(currentAbsolutePath, (error, lstat) => {
if (error || this.isCanceled || this.isLimitHit) {
return clb(null);
return clb(null, undefined);
}
// If the path is a link, we must instead use fs.stat() to find out if the
......@@ -511,7 +511,7 @@ export class FileWalker {
// the link which is always a file.
this.statLinkIfNeeded(currentAbsolutePath, lstat, (error, stat) => {
if (error || this.isCanceled || this.isLimitHit) {
return clb(null);
return clb(null, undefined);
}
// Directory: Follow directories
......@@ -521,11 +521,11 @@ export class FileWalker {
// to really prevent loops with links we need to resolve the real path of them
return this.realPathIfNeeded(currentAbsolutePath, lstat, (error, realpath) => {
if (error || this.isCanceled || this.isLimitHit) {
return clb(null);
return clb(null, undefined);
}
if (this.walkedPaths[realpath]) {
return clb(null); // escape when there are cycles (can happen with symlinks)
return clb(null, undefined); // escape when there are cycles (can happen with symlinks)
}
this.walkedPaths[realpath] = true; // remember as walked
......@@ -533,10 +533,10 @@ export class FileWalker {
// Continue walking
return extfs.readdir(currentAbsolutePath, (error: Error, children: string[]): void => {
if (error || this.isCanceled || this.isLimitHit) {
return clb(null);
return clb(null, undefined);
}
this.doWalk(rootFolder, currentRelativePath, children, onResult, clb);
this.doWalk(rootFolder, currentRelativePath, children, onResult, err => clb(err, undefined));
});
});
}
......@@ -545,18 +545,18 @@ export class FileWalker {
else {
this.filesWalked++;
if (currentRelativePath === this.filePattern) {
return clb(null); // ignore file if its path matches with the file pattern because checkFilePatternRelativeMatch() takes care of those
return clb(null, undefined); // ignore file if its path matches with the file pattern because checkFilePatternRelativeMatch() takes care of those
}
if (this.maxFilesize && types.isNumber(stat.size) && stat.size > this.maxFilesize) {
return clb(null); // ignore file if max file size is hit
return clb(null, undefined); // ignore file if max file size is hit
}
this.matchFile(onResult, { base: rootFolder, relativePath: currentRelativePath, basename: file, size: stat.size });
}
// Unwind
return clb(null);
return clb(null, undefined);
});
});
}, (error: Error[]): void => {
......
......@@ -144,7 +144,7 @@ export class SearchService implements ISearchService {
fileMatch.lineMatches.push(new LineMatch(model.getLineContent(match.range.startLineNumber), match.range.startLineNumber - 1, [[match.range.startColumn - 1, match.range.endColumn - match.range.startColumn]]));
});
} else {
localResults.set(resource, false);
localResults.set(resource, null);
}
});
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册