提交 a1d3c8a3 编写于 作者: B Benjamin Pasero

some ts linting

上级 3b72900e
......@@ -461,7 +461,7 @@ class TimeoutThrottledDomListener<R> extends Disposable {
constructor(node: any, type: string, handler: (event: R) => void, eventMerger: IEventMerger<R> = <any>DEFAULT_EVENT_MERGER, minimumTimeMs: number = MINIMUM_TIME_MS) {
super();
let lastEvent = null;
let lastEvent: R = null;
let lastHandlerTime = 0;
let timeout = this._register(new TimeoutTimer());
......@@ -899,7 +899,7 @@ class FocusTracker extends Disposable implements IFocusTracker {
this._eventEmitter = this._register(new EventEmitter());
let onFocus = (event) => {
let onFocus = (event: Event) => {
loosingFocus = false;
if (!hasFocus) {
hasFocus = true;
......@@ -907,7 +907,7 @@ class FocusTracker extends Disposable implements IFocusTracker {
}
};
let onBlur = (event) => {
let onBlur = (event: Event) => {
if (hasFocus) {
loosingFocus = true;
window.setTimeout(() => {
......
......@@ -210,7 +210,7 @@ export class Separator extends Action {
public static ID = 'vs.actions.separator';
constructor(label?: string, order?) {
constructor(label?: string, order?: number) {
super(Separator.ID, label, label ? 'separator text' : 'separator');
this.checked = false;
this.radio = false;
......@@ -648,7 +648,7 @@ export class ActionBar extends EventEmitter implements IActionRunner {
}
}
private doTrigger(event): void {
private doTrigger(event: StandardKeyboardEvent): void {
if (typeof this.focusedItem === 'undefined') {
return; //nothing to focus
}
......
......@@ -293,7 +293,7 @@ export class VSash extends Disposable implements IVerticalSashLayoutProvider {
private _onPositionChange: Emitter<number> = new Emitter<number>();
public get onPositionChange(): Event<number> { return this._onPositionChange.event; }
constructor(container: HTMLElement, private minWidth) {
constructor(container: HTMLElement, private minWidth: number) {
super();
this.ratio = 0.5;
this.sash = new Sash(container, this);
......
......@@ -243,7 +243,7 @@ export function flatten<T>(arr: T[][]): T[] {
}
export function range(to: number, from = 0): number[] {
const result = [];
const result: number[] = [];
for (let i = from; i < to; i++) {
result.push(i);
......
......@@ -658,10 +658,4 @@ export function ninvoke(thisArg: any, fn: Function, ...args: any[]): Promise;
export function ninvoke<T>(thisArg: any, fn: Function, ...args: any[]): TPromise<T>;
export function ninvoke(thisArg: any, fn: Function, ...args: any[]): any {
return new Promise((c, e) => fn.call(thisArg, ...args, (err, result) => err ? e(err) : c(result)));
}
interface IQueuedPromise<T> {
t: ITask<TPromise<T>>;
c: ValueCallback;
e: ErrorCallback;
}
\ No newline at end of file
......@@ -168,7 +168,7 @@ function _matchesCamelCase(word: string, camelCaseWord: string, i: number, j: nu
} else if (word[i] !== camelCaseWord[j].toLowerCase()) {
return null;
} else {
let result = null;
let result: IMatch[] = null;
let nextUpperIndex = j + 1;
result = _matchesCamelCase(word, camelCaseWord, i + 1, j + 1);
while (!result && (nextUpperIndex = nextAnchor(camelCaseWord, nextUpperIndex)) < camelCaseWord.length) {
......
......@@ -64,7 +64,7 @@ export function rimraf(path: string): TPromise<void> {
}
}, (err: NodeJS.ErrnoException) => {
if (err.code === 'ENOENT') {
return;
return void 0;
}
return TPromise.wrapError<void>(err);
......
......@@ -27,6 +27,7 @@ import { AskpassChannel } from 'vs/workbench/parts/git/common/gitIpc';
import { GitAskpassService } from 'vs/workbench/parts/git/electron-main/askpassService';
import { spawnSharedProcess } from 'vs/code/node/sharedProcess';
import { Mutex } from 'windows-mutex';
import { IDisposable } from 'vs/base/common/lifecycle';
import { LaunchService, ILaunchChannel, LaunchChannel, LaunchChannelClient, ILaunchService } from './launch';
import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
......@@ -57,9 +58,9 @@ import pkg from 'vs/platform/package';
import * as fs from 'original-fs';
import * as cp from 'child_process';
function quit(accessor: ServicesAccessor, error?: Error);
function quit(accessor: ServicesAccessor, message?: string);
function quit(accessor: ServicesAccessor, arg?: any) {
function quit(accessor: ServicesAccessor, error?: Error): void;
function quit(accessor: ServicesAccessor, message?: string): void;
function quit(accessor: ServicesAccessor, arg?: any): void {
const logService = accessor.get(ILogService);
let exitCode = 0;
......@@ -138,7 +139,7 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
debugPort: environmentService.isBuilt ? null : 5871
};
let sharedProcessDisposable;
let sharedProcessDisposable: IDisposable;
const sharedProcess = spawnSharedProcess(initData, options).then(disposable => {
sharedProcessDisposable = disposable;
......@@ -427,7 +428,7 @@ function createPaths(environmentService: IEnvironmentService): TPromise<any> {
return TPromise.join(paths.map(p => mkdirp(p))) as TPromise<any>;
}
function createServices(args): IInstantiationService {
function createServices(args: ParsedArgs): IInstantiationService {
const services = new ServiceCollection();
services.set(IEnvironmentService, new SyncDescriptor(EnvironmentService, args, process.execPath));
......
......@@ -25,7 +25,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { ILogService } from 'vs/code/electron-main/log';
import { getPathLabel } from 'vs/base/common/labels';
import { createDecorator, IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWindowSettings } from 'vs/platform/windows/common/windows';
import CommonEvent, { Emitter } from 'vs/base/common/event';
import product from 'vs/platform/product';
......@@ -63,11 +62,6 @@ export interface IRecentPathsList {
files: string[];
}
interface ILogEntry {
severity: string;
arguments: any;
}
interface INativeOpenDialogOptions {
pickFolders?: boolean;
pickFiles?: boolean;
......@@ -155,8 +149,7 @@ export class WindowsManager implements IWindowsMainService {
@IEnvironmentService private environmentService: IEnvironmentService,
@ILifecycleService private lifecycleService: ILifecycleService,
@IBackupMainService private backupService: IBackupMainService,
@IConfigurationService private configurationService: IConfigurationService,
@ITelemetryService private telemetryService: ITelemetryService
@IConfigurationService private configurationService: IConfigurationService
) { }
public ready(initialUserEnv: platform.IProcessEnvironment): void {
......
......@@ -22,7 +22,7 @@ export interface ISharedProcessOptions {
const boostrapPath = URI.parse(require.toUrl('bootstrap')).fsPath;
function _spawnSharedProcess(initData: ISharedProcessInitData, options: ISharedProcessOptions): cp.ChildProcess {
const execArgv = [];
const execArgv: string[] = [];
const env = assign({}, process.env, {
AMD_ENTRYPOINT: 'vs/code/node/sharedProcessMain',
ELECTRON_NO_ASAR: '1'
......
......@@ -25,7 +25,7 @@ export class BackupMainService implements IBackupMainService {
private mapWindowToBackupFolder: { [windowId: number]: string; };
constructor(
@IEnvironmentService private environmentService: IEnvironmentService
@IEnvironmentService environmentService: IEnvironmentService
) {
this.backupHome = environmentService.backupHome;
this.workspacesJsonPath = environmentService.backupWorkspacesPath;
......@@ -176,7 +176,7 @@ export class BackupMainService implements IBackupMainService {
});
}
private hasBackupsSync(backupPath): boolean {
private hasBackupsSync(backupPath: string): boolean {
try {
const backupSchemas = extfs.readdirSync(backupPath);
if (backupSchemas.length === 0) {
......@@ -211,7 +211,7 @@ export class BackupMainService implements IBackupMainService {
return (Date.now() + Math.round(Math.random() * 1000)).toString();
}
private sanitizePath(p) {
private sanitizePath(p: string): string {
return platform.isLinux ? p : p.toLowerCase();
}
......
......@@ -16,11 +16,6 @@ import Severity from 'vs/base/common/severity';
import { Action } from 'vs/base/common/actions';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
interface ILoaderChecksums {
[scriptSrc: string]: string;
}
interface IStorageData {
dontShowPrompt: boolean;
commit: string;
......
......@@ -15,7 +15,6 @@ import { mkdirp } from 'vs/base/node/extfs';
import { isString } from 'vs/base/common/types';
import { Promise, TPromise } from 'vs/base/common/winjs.base';
import { download, asJson } from 'vs/base/node/request';
import { ILifecycleService } from 'vs/code/electron-main/lifecycle';
import { IRequestService } from 'vs/platform/request/node/request';
import { IAutoUpdater } from 'vs/platform/update/common/update';
import product from 'vs/platform/product';
......@@ -36,7 +35,6 @@ export class Win32AutoUpdaterImpl extends EventEmitter implements IAutoUpdater {
private updatePackagePath: string = null;
constructor(
@ILifecycleService private lifecycleService: ILifecycleService,
@IRequestService private requestService: IRequestService
) {
super();
......
......@@ -30,7 +30,7 @@ export class WindowsService implements IWindowsService, IDisposable {
constructor(
@IWindowsMainService private windowsMainService: IWindowsMainService,
@IEnvironmentService private environmentService: IEnvironmentService,
@IURLService private urlService: IURLService
@IURLService urlService: IURLService
) {
chain(urlService.onOpenURL)
.filter(uri => uri.authority === 'file' && !!uri.path)
......
......@@ -306,7 +306,7 @@ export class TestStorageService extends EventEmitter implements IStorageService
super();
let context = new TestContextService();
this.storage = new StorageService(new InMemoryLocalStorage(), null, context, TestEnvironmentService);
this.storage = new StorageService(new InMemoryLocalStorage(), null, context);
}
store(key: string, value: any, scope: StorageScope = StorageScope.GLOBAL): void {
......
......@@ -254,7 +254,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
// Add overflow action as needed
if (visibleViewletsChange && overflows) {
this.viewletOverflowAction = this.instantiationService.createInstance(ViewletOverflowActivityAction, () => this.viewletOverflowActionItem.showMenu());
this.viewletOverflowActionItem = this.instantiationService.createInstance(ViewletOverflowActivityActionItem, this.viewletOverflowAction, () => this.getOverflowingViewlets(), viewlet => this.viewletIdToActivity[viewlet.id] && this.viewletIdToActivity[viewlet.id].badge);
this.viewletOverflowActionItem = this.instantiationService.createInstance(ViewletOverflowActivityActionItem, this.viewletOverflowAction, () => this.getOverflowingViewlets(), (viewlet: ViewletDescriptor) => this.viewletIdToActivity[viewlet.id] && this.viewletIdToActivity[viewlet.id].badge);
this.viewletSwitcherBar.push(this.viewletOverflowAction, { label: true, icon: true });
}
......
......@@ -113,7 +113,7 @@ export abstract class BaseEditor extends Panel implements IEditor {
return promise;
}
public setEditorVisible(visible, position: Position = null): void {
public setEditorVisible(visible: boolean, position: Position = null): void {
this._position = position;
}
......
......@@ -973,9 +973,7 @@ export class ReopenClosedEditorAction extends Action {
constructor(
id: string,
label: string,
@IHistoryService private historyService: IHistoryService,
@IEditorGroupService private editorGroupService: IEditorGroupService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService
@IHistoryService private historyService: IHistoryService
) {
super(id, label);
}
......
......@@ -25,7 +25,7 @@ export function setup(): void {
handleCommandDeprecations();
}
const isActiveEditorMoveArg = function (arg): boolean {
const isActiveEditorMoveArg = function (arg: ActiveEditorMoveArguments): boolean {
if (!types.isObject(arg)) {
return false;
}
......
......@@ -411,16 +411,20 @@ export class EditorStatus implements IStatusbarItem {
if (info.selections.length === 1) {
if (info.charactersSelected) {
return strings.format(nlsSingleSelectionRange, info.selections[0].positionLineNumber, info.selections[0].positionColumn, info.charactersSelected);
} else {
return strings.format(nlsSingleSelection, info.selections[0].positionLineNumber, info.selections[0].positionColumn);
}
} else {
if (info.charactersSelected) {
return strings.format(nlsMultiSelectionRange, info.selections.length, info.charactersSelected);
} else if (info.selections.length > 0) {
return strings.format(nlsMultiSelection, info.selections.length);
}
return strings.format(nlsSingleSelection, info.selections[0].positionLineNumber, info.selections[0].positionColumn);
}
if (info.charactersSelected) {
return strings.format(nlsMultiSelectionRange, info.selections.length, info.charactersSelected);
}
if (info.selections.length > 0) {
return strings.format(nlsMultiSelection, info.selections.length);
}
return null;
}
private onModeClick(): void {
......
......@@ -17,7 +17,6 @@ import { VSash } from 'vs/base/browser/ui/sash/sash';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
export class SideBySideEditor extends BaseEditor {
......@@ -35,8 +34,7 @@ export class SideBySideEditor extends BaseEditor {
constructor(
@ITelemetryService telemetryService: ITelemetryService,
@IInstantiationService private instantiationService: IInstantiationService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService
@IInstantiationService private instantiationService: IInstantiationService
) {
super(SideBySideEditor.ID, telemetryService);
}
......
......@@ -417,7 +417,7 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
this.pickOpenWidget.refresh(model, value ? { autoFocusFirstEntry: true } : autoFocus);
},
onShow: () => this.handleOnShow(true),
onHide: (reason) => this.handleOnHide(true, reason)
onHide: (reason: HideReason) => this.handleOnHide(true, reason)
};
this.pickOpenWidget.setCallbacks(callbacks);
......
......@@ -883,7 +883,7 @@ export interface IEditorStacksModel {
groups: IEditorGroup[];
activeGroup: IEditorGroup;
isActive(IEditorGroup): boolean;
isActive(group: IEditorGroup): boolean;
getGroup(id: GroupIdentifier): IEditorGroup;
......
......@@ -15,7 +15,6 @@ import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { Registry } from 'vs/platform/platform';
import { Position, Direction } from 'vs/platform/editor/common/editor';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
export interface GroupEvent extends IGroupEvent {
editor: EditorInput;
......@@ -701,8 +700,7 @@ export class EditorStacksModel implements IEditorStacksModel {
private restoreFromStorage: boolean,
@IStorageService private storageService: IStorageService,
@ILifecycleService private lifecycleService: ILifecycleService,
@IInstantiationService private instantiationService: IInstantiationService,
@ITelemetryService private telemetryService: ITelemetryService
@IInstantiationService private instantiationService: IInstantiationService
) {
this.toDispose = [];
......
......@@ -14,7 +14,6 @@ import { UntitledEditorInput as AbstractUntitledEditorInput, EncodingMode, Confi
import { UntitledEditorModel } from 'vs/workbench/common/editor/untitledEditorModel';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import Event, { Emitter } from 'vs/base/common/event';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
......@@ -43,7 +42,6 @@ export class UntitledEditorInput extends AbstractUntitledEditorInput {
modeId: string,
@IInstantiationService private instantiationService: IInstantiationService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IModeService private modeService: IModeService,
@ITextFileService private textFileService: ITextFileService
) {
super();
......
......@@ -19,7 +19,6 @@ import pkg from 'vs/platform/package';
import errors = require('vs/base/common/errors');
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IConfigurationEditingService, ConfigurationTarget } from 'vs/workbench/services/configuration/common/configurationEditing';
import { IExtensionManagementService, LocalExtensionType, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
......@@ -33,6 +32,7 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation
import * as browser from 'vs/base/browser/browser';
import { IIntegrityService } from 'vs/platform/integrity/common/integrity';
import { IStartupFingerprint } from 'vs/workbench/electron-browser/common';
import { IEntryRunContext } from 'vs/base/parts/quickopen/common/quickOpen';
import * as os from 'os';
import { webFrame } from 'electron';
......@@ -200,7 +200,6 @@ export abstract class BaseZoomAction extends Action {
constructor(
id: string,
label: string,
@IMessageService private messageService: IMessageService,
@IWorkspaceConfigurationService private configurationService: IWorkspaceConfigurationService,
@IConfigurationEditingService private configurationEditingService: IConfigurationEditingService
) {
......@@ -233,11 +232,10 @@ export class ZoomInAction extends BaseZoomAction {
constructor(
id: string,
label: string,
@IMessageService messageService: IMessageService,
@IWorkspaceConfigurationService configurationService: IWorkspaceConfigurationService,
@IConfigurationEditingService configurationEditingService: IConfigurationEditingService
) {
super(id, label, messageService, configurationService, configurationEditingService);
super(id, label, configurationService, configurationEditingService);
}
public run(): TPromise<boolean> {
......@@ -255,11 +253,10 @@ export class ZoomOutAction extends BaseZoomAction {
constructor(
id: string,
label: string,
@IMessageService messageService: IMessageService,
@IWorkspaceConfigurationService configurationService: IWorkspaceConfigurationService,
@IConfigurationEditingService configurationEditingService: IConfigurationEditingService
) {
super(id, label, messageService, configurationService, configurationEditingService);
super(id, label, configurationService, configurationEditingService);
}
public run(): TPromise<boolean> {
......@@ -277,11 +274,10 @@ export class ZoomResetAction extends BaseZoomAction {
constructor(
id: string,
label: string,
@IMessageService messageService: IMessageService,
@IWorkspaceConfigurationService configurationService: IWorkspaceConfigurationService,
@IConfigurationEditingService configurationEditingService: IConfigurationEditingService
) {
super(id, label, messageService, configurationService, configurationEditingService);
super(id, label, configurationService, configurationEditingService);
}
public run(): TPromise<boolean> {
......@@ -439,8 +435,7 @@ export class ReloadWindowAction extends Action {
constructor(
id: string,
label: string,
@IWindowService private windowService: IWindowService,
@IPartService private partService: IPartService
@IWindowService private windowService: IWindowService
) {
super(id, label);
}
......@@ -479,11 +474,11 @@ export class OpenRecentAction extends Action {
label: paths.basename(path),
description: paths.dirname(path),
separator,
run: (context) => runPick(path, context)
run: context => runPick(path, context)
};
}
const runPick = (path: string, context) => {
const runPick = (path: string, context: IEntryRunContext) => {
const newWindow = context.keymods.indexOf(KeyMod.CtrlCmd) >= 0;
this.windowsService.windowOpen([path], newWindow);
};
......@@ -538,10 +533,8 @@ export class ReportIssueAction extends Action {
constructor(
id: string,
label: string,
@IMessageService private messageService: IMessageService,
@IIntegrityService private integrityService: IIntegrityService,
@IExtensionManagementService private extensionManagementService: IExtensionManagementService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService
@IExtensionManagementService private extensionManagementService: IExtensionManagementService
) {
super(id, label);
}
......
......@@ -19,7 +19,6 @@ import { IAction, Action } from 'vs/base/common/actions';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { IMessageService } from 'vs/platform/message/common/message';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
......@@ -68,7 +67,6 @@ export class ElectronIntegration {
@IWindowIPCService private windowService: IWindowIPCService,
@IPartService private partService: IPartService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@ITelemetryService private telemetryService: ITelemetryService,
@IWorkspaceConfigurationService private configurationService: IWorkspaceConfigurationService,
@ICommandService private commandService: ICommandService,
@IConfigurationEditingService private configurationEditingService: IConfigurationEditingService,
......
......@@ -125,6 +125,7 @@ export class ElectronWindow {
const $this = this;
(<any>window).open = function (url: string, target: string, features: string, replace: boolean) {
$this.windowsService.openExternal(url);
return null;
};
}
......
......@@ -7,11 +7,9 @@
import Uri from 'vs/base/common/uri';
import errors = require('vs/base/common/errors');
import { IBackupModelService, IBackupFileService } from 'vs/workbench/services/backup/common/backup';
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { ITextFileService, TextFileModelChangeEvent, StateChange } from 'vs/workbench/services/textfile/common/textfiles';
import { IFileService } from 'vs/platform/files/common/files';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
......@@ -24,11 +22,8 @@ export class BackupModelTracker implements IWorkbenchContribution {
constructor(
@IBackupFileService private backupFileService: IBackupFileService,
@IBackupModelService private backupService: IBackupModelService,
@IFileService private fileService: IFileService,
@ITextFileService private textFileService: ITextFileService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IEnvironmentService private environmentService: IEnvironmentService
) {
this.toDispose = [];
......
......@@ -12,7 +12,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import errors = require('vs/base/common/errors');
import { IBackupModelService, IBackupFileService } from 'vs/workbench/services/backup/common/backup';
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { ITextModelResolverService } from 'vs/editor/common/services/resolverService';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
......@@ -26,7 +26,6 @@ export class BackupRestorer implements IWorkbenchContribution {
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IEnvironmentService private environmentService: IEnvironmentService,
@IPartService private partService: IPartService,
@IBackupModelService private backupService: IBackupModelService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IBackupFileService private backupFileService: IBackupFileService,
@ITextModelResolverService private textModelResolverService: ITextModelResolverService,
......
......@@ -13,16 +13,14 @@ import JSONContributionRegistry = require('vs/platform/jsonschemas/common/jsonCo
import { Registry } from 'vs/platform/platform';
import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { ITextModelResolverService } from 'vs/editor/common/services/resolverService';
import { IPreferencesService } from 'vs/workbench/parts/preferences/common/preferences';
let schemaRegistry = <JSONContributionRegistry.IJSONContributionRegistry>Registry.as(JSONContributionRegistry.Extensions.JSONContribution);
const schemaRegistry = Registry.as<JSONContributionRegistry.IJSONContributionRegistry>(JSONContributionRegistry.Extensions.JSONContribution);
export class WorkbenchContentProvider implements IWorkbenchContribution {
constructor(
@IModelService private modelService: IModelService,
@ITextModelResolverService private textModelResolverService: ITextModelResolverService,
@IPreferencesService private preferencesService: IPreferencesService,
@IModeService private modeService: IModeService
) {
this.start();
......
......@@ -7,7 +7,6 @@
import Event, { Emitter } from 'vs/base/common/event';
import { localize } from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { InternalTreeExplorerNode, InternalTreeExplorerNodeProvider } from 'vs/workbench/parts/explorers/common/treeExplorerViewModel';
import { ITreeExplorerService } from 'vs/workbench/parts/explorers/common/treeExplorerService';
......@@ -21,7 +20,6 @@ export class TreeExplorerService implements ITreeExplorerService {
private _treeExplorerNodeProviders: { [providerId: string]: InternalTreeExplorerNodeProvider };
constructor(
@IInstantiationService private _instantiationService: IInstantiationService,
@IMessageService private messageService: IMessageService,
) {
this._treeExplorerNodeProviders = Object.create(null);
......
......@@ -20,7 +20,6 @@ import { ITree } from 'vs/base/parts/tree/browser/tree';
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
import { TreeExplorerViewletState, TreeDataSource, TreeRenderer, TreeController } from 'vs/workbench/parts/explorers/browser/views/treeExplorerViewer';
import { RefreshViewExplorerAction } from 'vs/workbench/parts/explorers/browser/treeExplorerActions';
import { IProgressService } from 'vs/platform/progress/common/progress';
export class TreeExplorerView extends CollapsibleViewletView {
private workspace: IWorkspace;
......@@ -33,10 +32,9 @@ export class TreeExplorerView extends CollapsibleViewletView {
@IMessageService messageService: IMessageService,
@IKeybindingService keybindingService: IKeybindingService,
@IContextMenuService contextMenuService: IContextMenuService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
@IInstantiationService private instantiationService: IInstantiationService,
@ITreeExplorerService private treeExplorerService: ITreeExplorerService,
@IProgressService private progressService: IProgressService
@ITreeExplorerService private treeExplorerService: ITreeExplorerService
) {
super(actionRunner, false, nls.localize('treeExplorerViewlet.tree', "Tree Explorer Section"), messageService, keybindingService, contextMenuService, headerSize);
......
......@@ -13,9 +13,6 @@ import { IMouseEvent } from 'vs/base/browser/mouseEvent';
import { IActionRunner } from 'vs/base/common/actions';
import { IActionProvider, ActionsRenderer } from 'vs/base/parts/tree/browser/actionsRenderer';
import { ContributableActionProvider } from 'vs/workbench/browser/actionBarRegistry';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import { IModeService } from 'vs/editor/common/services/modeService';
import { ITreeExplorerService } from 'vs/workbench/parts/explorers/common/treeExplorerService';
import { IProgressService } from 'vs/platform/progress/common/progress';
......@@ -54,11 +51,7 @@ export class TreeRenderer extends ActionsRenderer implements IRenderer {
constructor(
state: TreeExplorerViewletState,
actionRunner: IActionRunner,
private container: HTMLElement,
@IContextViewService private contextViewService: IContextViewService,
@IExtensionService private extensionService: IExtensionService,
@IModeService private modeService: IModeService
actionRunner: IActionRunner
) {
super({
actionProvider: state.actionProvider,
......
......@@ -60,5 +60,7 @@ export class FeedbackStatusbarItem implements IStatusbarItem {
feedbackService: this.instantiationService.createInstance(TwitterFeedbackService)
});
}
return null;
}
}
\ No newline at end of file
......@@ -1648,7 +1648,7 @@ export class SaveAllInGroupAction extends BaseSaveAllAction {
}
const editorGroup = editorIdentifier.group;
const resourcesToSave = [];
const resourcesToSave: URI[] = [];
editorGroup.getEditors().forEach(editor => {
const resource = getUntitledOrFileResource(editor, true);
if (resource) {
......
......@@ -653,7 +653,7 @@ export class ExplorerView extends CollapsibleViewletView {
let targetsToExpand: URI[] = [];
if (this.settings[ExplorerView.MEMENTO_EXPANDED_FOLDER_RESOURCES]) {
targetsToExpand = this.settings[ExplorerView.MEMENTO_EXPANDED_FOLDER_RESOURCES].map(e => URI.parse(e));
targetsToExpand = this.settings[ExplorerView.MEMENTO_EXPANDED_FOLDER_RESOURCES].map((e: string) => URI.parse(e));
}
// First time refresh: Receive target through active editor input or selection and also include settings from previous session
......
......@@ -332,7 +332,7 @@ export class FileRenderer extends ActionsRenderer implements IRenderer {
inputBox.select({ start: 0, end: lastDot > 0 && !stat.isDirectory ? lastDot : value.length });
inputBox.focus();
const done = async.once(commit => {
const done = async.once((commit: boolean) => {
tree.clearHighlight();
if (commit && inputBox.value) {
......
......@@ -15,10 +15,8 @@ import { IFileOperationResult, FileOperationResult } from 'vs/platform/files/com
import { BINARY_FILE_EDITOR_ID, TEXT_FILE_EDITOR_ID, FILE_EDITOR_INPUT_ID, FileEditorInput as CommonFileEditorInput } from 'vs/workbench/parts/files/common/files';
import { ITextFileService, AutoSaveMode, ModelState, TextFileModelChangeEvent } from 'vs/workbench/services/textfile/common/textfiles';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IEventService } from 'vs/platform/event/common/event';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
/**
* A file editor input is the input type for the file editor of file system resources.
......@@ -42,8 +40,6 @@ export class FileEditorInput extends CommonFileEditorInput {
preferredEncoding: string,
@IInstantiationService private instantiationService: IInstantiationService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IHistoryService private historyService: IHistoryService,
@IEventService private eventService: IEventService,
@ITextFileService private textFileService: ITextFileService
) {
super();
......
......@@ -16,7 +16,6 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { GlobalQuickOpenAction } from 'vs/workbench/browser/parts/quickopen/quickopen.contribution';
import { KeybindingsReferenceAction, OpenRecentAction } from 'vs/workbench/electron-browser/actions';
import { ShowRecommendedKeymapExtensionsAction } from 'vs/workbench/parts/extensions/browser/extensionsActions';
......@@ -137,7 +136,6 @@ export class WatermarkContribution implements IWorkbenchContribution {
@IPartService private partService: IPartService,
@IKeybindingService private keybindingService: IKeybindingService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IStorageService private storageService: IStorageService,
@ITelemetryService private telemetryService: ITelemetryService
) {
lifecycleService.onShutdown(this.dispose, this);
......
......@@ -11,8 +11,7 @@ import { IBackupModelService, IBackupFileService, IBackupResult } from 'vs/workb
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { ITextFileEditorModel, ITextFileEditorModelManager } from 'vs/workbench/services/textfile/common/textfiles';
import { IFileService, IFilesConfiguration } from 'vs/platform/files/common/files';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IFilesConfiguration } from 'vs/platform/files/common/files';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { TPromise } from 'vs/base/common/winjs.base';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
......@@ -33,9 +32,7 @@ export class BackupModelService implements IBackupModelService {
constructor(
@IBackupFileService private backupFileService: IBackupFileService,
@IConfigurationService private configurationService: IConfigurationService,
@IFileService private fileService: IFileService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IEnvironmentService private environmentService: IEnvironmentService,
@IWindowsService private windowsService: IWindowsService
) {
......
......@@ -248,11 +248,7 @@ export class WorkspaceConfigurationService implements IWorkspaceConfigurationSer
return this.isWorkspaceConfigurationFile(this.contextService.toWorkspaceRelativePath(stat.resource)); // only workspace config files
}).map(stat => stat.resource));
}, (err) => {
if (err) {
return []; // never fail this call
}
}).then((contents: IContent[]) => {
}, err => [] /* never fail this call */).then((contents: IContent[]) => {
contents.forEach(content => this.workspaceFilePathToConfiguration[this.contextService.toWorkspaceRelativePath(content.resource)] = TPromise.as(newConfigFile(content.value, content.resource.toString())));
}, errors.onUnexpectedError);
}
......
......@@ -660,7 +660,7 @@ export class FileService implements IFileService {
});
// Errors
watcher.on('error', (error) => {
watcher.on('error', (error: string) => {
this.options.errorLogger(error);
});
}
......
......@@ -27,7 +27,6 @@ import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { Registry } from 'vs/platform/platform';
import { once } from 'vs/base/common/event';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IIntegrityService } from 'vs/platform/integrity/common/integrity';
......@@ -293,7 +292,6 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
@IConfigurationService configurationService: IConfigurationService,
@ILifecycleService private lifecycleService: ILifecycleService,
@IEventService private eventService: IEventService,
@IInstantiationService private instantiationService: IInstantiationService,
@IIntegrityService integrityService: IIntegrityService,
@ITitleService titleService: ITitleService,
@IWindowService private windowService: IWindowService
......
......@@ -60,10 +60,10 @@ export class MessageService extends WorkbenchMessageService implements IChoiceSe
return TPromise.wrap(this.showMessageBox({ message, buttons: options, type }));
}
let onCancel = null;
let onCancel: () => void = null;
const promise = new TPromise((c, e) => {
const callback = index => () => {
const callback = (index: number) => () => {
c(index);
return TPromise.as(true);
};
......
......@@ -9,7 +9,6 @@ import errors = require('vs/base/common/errors');
import strings = require('vs/base/common/strings');
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IWorkspaceContextService, IWorkspace } from 'vs/platform/workspace/common/workspace';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
// Browser localStorage interface
export interface IStorage {
......@@ -39,8 +38,7 @@ export class StorageService implements IStorageService {
constructor(
globalStorage: IStorage,
workspaceStorage: IStorage,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IEnvironmentService private environmentService: IEnvironmentService
@IWorkspaceContextService contextService: IWorkspaceContextService
) {
const workspace = contextService.getWorkspace();
......
......@@ -8,14 +8,14 @@
import * as assert from 'assert';
import { clone } from 'vs/base/common/objects';
import { StorageScope } from 'vs/platform/storage/common/storage';
import { TestContextService, TestWorkspace, TestEnvironmentService } from 'vs/test/utils/servicesTestUtils';
import { TestContextService, TestWorkspace } from 'vs/test/utils/servicesTestUtils';
import { StorageService, InMemoryLocalStorage } from 'vs/workbench/services/storage/common/storageService';
suite('Workbench StorageSevice', () => {
test('Swap Data with undefined default value', () => {
let context = new TestContextService();
let s = new StorageService(new InMemoryLocalStorage(), null, context, TestEnvironmentService);
let s = new StorageService(new InMemoryLocalStorage(), null, context);
s.swap('Monaco.IDE.Core.Storage.Test.swap', 'foobar', 'barfoo');
assert.strictEqual('foobar', s.get('Monaco.IDE.Core.Storage.Test.swap'));
......@@ -27,7 +27,7 @@ suite('Workbench StorageSevice', () => {
test('Remove Data', () => {
let context = new TestContextService();
let s = new StorageService(new InMemoryLocalStorage(), null, context, TestEnvironmentService);
let s = new StorageService(new InMemoryLocalStorage(), null, context);
s.store('Monaco.IDE.Core.Storage.Test.remove', 'foobar');
assert.strictEqual('foobar', s.get('Monaco.IDE.Core.Storage.Test.remove'));
......@@ -37,7 +37,7 @@ suite('Workbench StorageSevice', () => {
test('Get Data, Integer, Boolean', () => {
let context = new TestContextService();
let s = new StorageService(new InMemoryLocalStorage(), null, context, TestEnvironmentService);
let s = new StorageService(new InMemoryLocalStorage(), null, context);
assert.strictEqual(s.get('Monaco.IDE.Core.Storage.Test.get', StorageScope.GLOBAL, 'foobar'), 'foobar');
assert.strictEqual(s.get('Monaco.IDE.Core.Storage.Test.get', StorageScope.GLOBAL, ''), '');
......@@ -72,14 +72,14 @@ suite('Workbench StorageSevice', () => {
test('StorageSevice cleans up when workspace changes', () => {
let storageImpl = new InMemoryLocalStorage();
let context = new TestContextService();
let s = new StorageService(storageImpl, null, context, TestEnvironmentService);
let s = new StorageService(storageImpl, null, context);
s.store('key1', 'foobar');
s.store('key2', 'something');
s.store('wkey1', 'foo', StorageScope.WORKSPACE);
s.store('wkey2', 'foo2', StorageScope.WORKSPACE);
s = new StorageService(storageImpl, null, context, TestEnvironmentService);
s = new StorageService(storageImpl, null, context);
assert.strictEqual(s.get('key1', StorageScope.GLOBAL), 'foobar');
assert.strictEqual(s.get('key1', StorageScope.WORKSPACE, null), null);
......@@ -91,7 +91,7 @@ suite('Workbench StorageSevice', () => {
let ws: any = clone(TestWorkspace);
ws.uid = new Date().getTime() + 100;
context = new TestContextService(ws);
s = new StorageService(storageImpl, null, context, TestEnvironmentService);
s = new StorageService(storageImpl, null, context);
assert.strictEqual(s.get('key1', StorageScope.GLOBAL), 'foobar');
assert.strictEqual(s.get('key1', StorageScope.WORKSPACE, null), null);
......
......@@ -225,7 +225,7 @@ export interface ITextFileEditorModel extends ITextEditorModel, IEncodingSupport
revert(): TPromise<void>;
setConflictResolutionMode();
setConflictResolutionMode(): void;
getValue(): string;
......
......@@ -109,7 +109,7 @@ export class TextFileService extends AbstractTextFileService {
const dontSave = { label: this.mnemonicLabel(nls.localize({ key: 'dontSave', comment: ['&& denotes a mnemonic'] }, "Do&&n't Save")), result: ConfirmResult.DONT_SAVE };
const cancel = { label: nls.localize('cancel', "Cancel"), result: ConfirmResult.CANCEL };
const buttons = [];
const buttons: { label: string; result: ConfirmResult; }[] = [];
if (isWindows) {
buttons.push(save, dontSave, cancel);
} else if (isLinux) {
......
......@@ -99,7 +99,7 @@ export class TextModelResolverService implements ITextModelResolverService {
constructor(
@ITextFileService private textFileService: ITextFileService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IInstantiationService private instantiationService: IInstantiationService
@IInstantiationService instantiationService: IInstantiationService
) {
this.resourceModelCollection = instantiationService.createInstance(ResourceModelCollection);
}
......
......@@ -105,7 +105,7 @@ suite('Workbench Part', () => {
fixture.id = fixtureId;
document.body.appendChild(fixture);
context = new WorkspaceContextService(TestUtils.TestWorkspace);
storage = new StorageService(new InMemoryLocalStorage(), null, context, TestUtils.TestEnvironmentService);
storage = new StorageService(new InMemoryLocalStorage(), null, context);
});
teardown(() => {
......
......@@ -18,7 +18,7 @@ suite('Workbench Memento', () => {
setup(() => {
context = new WorkspaceContextService(TestUtils.TestWorkspace);
storage = new StorageService(new InMemoryLocalStorage(), null, context, TestUtils.TestEnvironmentService);
storage = new StorageService(new InMemoryLocalStorage(), null, context);
});
test('Loading and Saving Memento with Scopes', () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册