From a1d3c8a3006d0a3d68495122ea09a2a37bca69db Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 5 Dec 2016 11:30:21 +0100 Subject: [PATCH] some ts linting --- src/vs/base/browser/dom.ts | 6 ++--- src/vs/base/browser/ui/actionbar/actionbar.ts | 4 ++-- src/vs/base/browser/ui/sash/sash.ts | 2 +- src/vs/base/common/arrays.ts | 2 +- src/vs/base/common/async.ts | 6 ----- src/vs/base/common/filters.ts | 2 +- src/vs/base/node/pfs.ts | 2 +- src/vs/code/electron-main/main.ts | 11 +++++---- src/vs/code/electron-main/windows.ts | 9 +------- src/vs/code/node/sharedProcess.ts | 2 +- .../backup/electron-main/backupMainService.ts | 6 ++--- .../integrity/node/integrityServiceImpl.ts | 5 ---- .../electron-main/auto-updater.win32.ts | 2 -- .../windows/electron-main/windowsService.ts | 2 +- src/vs/test/utils/servicesTestUtils.ts | 2 +- .../parts/activitybar/activitybarPart.ts | 2 +- .../browser/parts/editor/baseEditor.ts | 2 +- .../browser/parts/editor/editorActions.ts | 4 +--- .../browser/parts/editor/editorCommands.ts | 2 +- .../browser/parts/editor/editorStatus.ts | 20 +++++++++------- .../browser/parts/editor/sideBySideEditor.ts | 4 +--- .../parts/quickopen/quickOpenController.ts | 2 +- src/vs/workbench/common/editor.ts | 2 +- .../common/editor/editorStacksModel.ts | 4 +--- .../common/editor/untitledEditorInput.ts | 2 -- src/vs/workbench/electron-browser/actions.ts | 23 +++++++------------ .../workbench/electron-browser/integration.ts | 2 -- src/vs/workbench/electron-browser/window.ts | 1 + .../parts/backup/common/backupModelTracker.ts | 7 +----- .../parts/backup/common/backupRestorer.ts | 3 +-- .../common/contentprovider.contribution.ts | 4 +--- .../explorers/browser/treeExplorerService.ts | 2 -- .../browser/views/treeExplorerView.ts | 6 ++--- .../browser/views/treeExplorerViewer.ts | 9 +------- .../feedback/browser/feedbackStatusbarItem.ts | 2 ++ .../parts/files/browser/fileActions.ts | 2 +- .../parts/files/browser/views/explorerView.ts | 2 +- .../files/browser/views/explorerViewer.ts | 2 +- .../files/common/editors/fileEditorInput.ts | 4 ---- .../watermark/electron-browser/watermark.ts | 2 -- .../backup/node/backupModelService.ts | 5 +--- .../node/configurationService.ts | 6 +---- .../services/files/node/fileService.ts | 2 +- .../services/history/browser/history.ts | 2 -- .../electron-browser/messageService.ts | 4 ++-- .../services/storage/common/storageService.ts | 4 +--- .../storage/test/storageService.test.ts | 14 +++++------ .../services/textfile/common/textfiles.ts | 2 +- .../electron-browser/textFileService.ts | 2 +- .../common/textModelResolverService.ts | 2 +- src/vs/workbench/test/browser/part.test.ts | 2 +- src/vs/workbench/test/common/memento.test.ts | 2 +- 52 files changed, 80 insertions(+), 145 deletions(-) diff --git a/src/vs/base/browser/dom.ts b/src/vs/base/browser/dom.ts index d680de1f001..ab8b9e2631c 100644 --- a/src/vs/base/browser/dom.ts +++ b/src/vs/base/browser/dom.ts @@ -461,7 +461,7 @@ class TimeoutThrottledDomListener extends Disposable { constructor(node: any, type: string, handler: (event: R) => void, eventMerger: IEventMerger = 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(() => { diff --git a/src/vs/base/browser/ui/actionbar/actionbar.ts b/src/vs/base/browser/ui/actionbar/actionbar.ts index 28fd2b37e27..03f72a5eee6 100644 --- a/src/vs/base/browser/ui/actionbar/actionbar.ts +++ b/src/vs/base/browser/ui/actionbar/actionbar.ts @@ -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 } diff --git a/src/vs/base/browser/ui/sash/sash.ts b/src/vs/base/browser/ui/sash/sash.ts index e8cc11b316f..62016bb17e9 100644 --- a/src/vs/base/browser/ui/sash/sash.ts +++ b/src/vs/base/browser/ui/sash/sash.ts @@ -293,7 +293,7 @@ export class VSash extends Disposable implements IVerticalSashLayoutProvider { private _onPositionChange: Emitter = new Emitter(); public get onPositionChange(): Event { 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); diff --git a/src/vs/base/common/arrays.ts b/src/vs/base/common/arrays.ts index 805d6241d19..7c6db6d75d8 100644 --- a/src/vs/base/common/arrays.ts +++ b/src/vs/base/common/arrays.ts @@ -243,7 +243,7 @@ export function flatten(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); diff --git a/src/vs/base/common/async.ts b/src/vs/base/common/async.ts index ba914be9bf5..55442230b02 100644 --- a/src/vs/base/common/async.ts +++ b/src/vs/base/common/async.ts @@ -658,10 +658,4 @@ export function ninvoke(thisArg: any, fn: Function, ...args: any[]): Promise; export function ninvoke(thisArg: any, fn: Function, ...args: any[]): TPromise; 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: ITask>; - c: ValueCallback; - e: ErrorCallback; } \ No newline at end of file diff --git a/src/vs/base/common/filters.ts b/src/vs/base/common/filters.ts index 99377700998..ad0bc3ef508 100644 --- a/src/vs/base/common/filters.ts +++ b/src/vs/base/common/filters.ts @@ -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) { diff --git a/src/vs/base/node/pfs.ts b/src/vs/base/node/pfs.ts index 24fe7a919b5..4a316565e57 100644 --- a/src/vs/base/node/pfs.ts +++ b/src/vs/base/node/pfs.ts @@ -64,7 +64,7 @@ export function rimraf(path: string): TPromise { } }, (err: NodeJS.ErrnoException) => { if (err.code === 'ENOENT') { - return; + return void 0; } return TPromise.wrapError(err); diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index c9c7d41fa55..2d953670e38 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -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 { return TPromise.join(paths.map(p => mkdirp(p))) as TPromise; } -function createServices(args): IInstantiationService { +function createServices(args: ParsedArgs): IInstantiationService { const services = new ServiceCollection(); services.set(IEnvironmentService, new SyncDescriptor(EnvironmentService, args, process.execPath)); diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index c081ce7e2b3..8df98fa0ec5 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -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 { diff --git a/src/vs/code/node/sharedProcess.ts b/src/vs/code/node/sharedProcess.ts index 6d2fa73bcb8..46f0f1ea9b5 100644 --- a/src/vs/code/node/sharedProcess.ts +++ b/src/vs/code/node/sharedProcess.ts @@ -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' diff --git a/src/vs/platform/backup/electron-main/backupMainService.ts b/src/vs/platform/backup/electron-main/backupMainService.ts index 70652ed3bef..eb198ba6291 100644 --- a/src/vs/platform/backup/electron-main/backupMainService.ts +++ b/src/vs/platform/backup/electron-main/backupMainService.ts @@ -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(); } diff --git a/src/vs/platform/integrity/node/integrityServiceImpl.ts b/src/vs/platform/integrity/node/integrityServiceImpl.ts index c8bc44909bb..930bf306551 100644 --- a/src/vs/platform/integrity/node/integrityServiceImpl.ts +++ b/src/vs/platform/integrity/node/integrityServiceImpl.ts @@ -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; diff --git a/src/vs/platform/update/electron-main/auto-updater.win32.ts b/src/vs/platform/update/electron-main/auto-updater.win32.ts index a1526cfad65..a368f5ae273 100644 --- a/src/vs/platform/update/electron-main/auto-updater.win32.ts +++ b/src/vs/platform/update/electron-main/auto-updater.win32.ts @@ -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(); diff --git a/src/vs/platform/windows/electron-main/windowsService.ts b/src/vs/platform/windows/electron-main/windowsService.ts index 12159a4db22..8209ff53b5a 100644 --- a/src/vs/platform/windows/electron-main/windowsService.ts +++ b/src/vs/platform/windows/electron-main/windowsService.ts @@ -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) diff --git a/src/vs/test/utils/servicesTestUtils.ts b/src/vs/test/utils/servicesTestUtils.ts index e75ed035c12..8962379ced5 100644 --- a/src/vs/test/utils/servicesTestUtils.ts +++ b/src/vs/test/utils/servicesTestUtils.ts @@ -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 { diff --git a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts index d93e2afe0cc..43fcefbc709 100644 --- a/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts +++ b/src/vs/workbench/browser/parts/activitybar/activitybarPart.ts @@ -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 }); } diff --git a/src/vs/workbench/browser/parts/editor/baseEditor.ts b/src/vs/workbench/browser/parts/editor/baseEditor.ts index e5b10493214..c0536ea4e54 100644 --- a/src/vs/workbench/browser/parts/editor/baseEditor.ts +++ b/src/vs/workbench/browser/parts/editor/baseEditor.ts @@ -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; } diff --git a/src/vs/workbench/browser/parts/editor/editorActions.ts b/src/vs/workbench/browser/parts/editor/editorActions.ts index feb5faa327c..dbd55bb1081 100644 --- a/src/vs/workbench/browser/parts/editor/editorActions.ts +++ b/src/vs/workbench/browser/parts/editor/editorActions.ts @@ -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); } diff --git a/src/vs/workbench/browser/parts/editor/editorCommands.ts b/src/vs/workbench/browser/parts/editor/editorCommands.ts index 8e5db5b81f9..d4a9f7bdb42 100644 --- a/src/vs/workbench/browser/parts/editor/editorCommands.ts +++ b/src/vs/workbench/browser/parts/editor/editorCommands.ts @@ -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; } diff --git a/src/vs/workbench/browser/parts/editor/editorStatus.ts b/src/vs/workbench/browser/parts/editor/editorStatus.ts index 5b9b5b5c3e6..9b6d9967f55 100644 --- a/src/vs/workbench/browser/parts/editor/editorStatus.ts +++ b/src/vs/workbench/browser/parts/editor/editorStatus.ts @@ -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 { diff --git a/src/vs/workbench/browser/parts/editor/sideBySideEditor.ts b/src/vs/workbench/browser/parts/editor/sideBySideEditor.ts index 61890d1bb76..18cb3c9b181 100644 --- a/src/vs/workbench/browser/parts/editor/sideBySideEditor.ts +++ b/src/vs/workbench/browser/parts/editor/sideBySideEditor.ts @@ -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); } diff --git a/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts b/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts index 33ebd02fc04..5f79da38305 100644 --- a/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts +++ b/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts @@ -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); diff --git a/src/vs/workbench/common/editor.ts b/src/vs/workbench/common/editor.ts index 73cd417fdab..0b1e4790150 100644 --- a/src/vs/workbench/common/editor.ts +++ b/src/vs/workbench/common/editor.ts @@ -883,7 +883,7 @@ export interface IEditorStacksModel { groups: IEditorGroup[]; activeGroup: IEditorGroup; - isActive(IEditorGroup): boolean; + isActive(group: IEditorGroup): boolean; getGroup(id: GroupIdentifier): IEditorGroup; diff --git a/src/vs/workbench/common/editor/editorStacksModel.ts b/src/vs/workbench/common/editor/editorStacksModel.ts index 82d2eeb2721..0c761a5822a 100644 --- a/src/vs/workbench/common/editor/editorStacksModel.ts +++ b/src/vs/workbench/common/editor/editorStacksModel.ts @@ -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 = []; diff --git a/src/vs/workbench/common/editor/untitledEditorInput.ts b/src/vs/workbench/common/editor/untitledEditorInput.ts index 67fa5424347..db0daff70fd 100644 --- a/src/vs/workbench/common/editor/untitledEditorInput.ts +++ b/src/vs/workbench/common/editor/untitledEditorInput.ts @@ -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(); diff --git a/src/vs/workbench/electron-browser/actions.ts b/src/vs/workbench/electron-browser/actions.ts index 84240a65602..a104f8394bb 100644 --- a/src/vs/workbench/electron-browser/actions.ts +++ b/src/vs/workbench/electron-browser/actions.ts @@ -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 { @@ -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 { @@ -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 { @@ -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); } diff --git a/src/vs/workbench/electron-browser/integration.ts b/src/vs/workbench/electron-browser/integration.ts index 7818d5d6fae..04d467e157c 100644 --- a/src/vs/workbench/electron-browser/integration.ts +++ b/src/vs/workbench/electron-browser/integration.ts @@ -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, diff --git a/src/vs/workbench/electron-browser/window.ts b/src/vs/workbench/electron-browser/window.ts index 64555c4774e..067a550f054 100644 --- a/src/vs/workbench/electron-browser/window.ts +++ b/src/vs/workbench/electron-browser/window.ts @@ -125,6 +125,7 @@ export class ElectronWindow { const $this = this; (window).open = function (url: string, target: string, features: string, replace: boolean) { $this.windowsService.openExternal(url); + return null; }; } diff --git a/src/vs/workbench/parts/backup/common/backupModelTracker.ts b/src/vs/workbench/parts/backup/common/backupModelTracker.ts index 55e66963bc8..95a59514a3b 100644 --- a/src/vs/workbench/parts/backup/common/backupModelTracker.ts +++ b/src/vs/workbench/parts/backup/common/backupModelTracker.ts @@ -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 = []; diff --git a/src/vs/workbench/parts/backup/common/backupRestorer.ts b/src/vs/workbench/parts/backup/common/backupRestorer.ts index 451e82336c8..9f1db8e7971 100644 --- a/src/vs/workbench/parts/backup/common/backupRestorer.ts +++ b/src/vs/workbench/parts/backup/common/backupRestorer.ts @@ -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, diff --git a/src/vs/workbench/parts/contentprovider/common/contentprovider.contribution.ts b/src/vs/workbench/parts/contentprovider/common/contentprovider.contribution.ts index d82c95436f2..71221391976 100644 --- a/src/vs/workbench/parts/contentprovider/common/contentprovider.contribution.ts +++ b/src/vs/workbench/parts/contentprovider/common/contentprovider.contribution.ts @@ -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 = Registry.as(JSONContributionRegistry.Extensions.JSONContribution); +const schemaRegistry = Registry.as(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(); diff --git a/src/vs/workbench/parts/explorers/browser/treeExplorerService.ts b/src/vs/workbench/parts/explorers/browser/treeExplorerService.ts index 28db0e0c146..5046d42c534 100644 --- a/src/vs/workbench/parts/explorers/browser/treeExplorerService.ts +++ b/src/vs/workbench/parts/explorers/browser/treeExplorerService.ts @@ -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); diff --git a/src/vs/workbench/parts/explorers/browser/views/treeExplorerView.ts b/src/vs/workbench/parts/explorers/browser/views/treeExplorerView.ts index e8326f1461b..2d0ad9f5619 100644 --- a/src/vs/workbench/parts/explorers/browser/views/treeExplorerView.ts +++ b/src/vs/workbench/parts/explorers/browser/views/treeExplorerView.ts @@ -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); diff --git a/src/vs/workbench/parts/explorers/browser/views/treeExplorerViewer.ts b/src/vs/workbench/parts/explorers/browser/views/treeExplorerViewer.ts index 6ed86f1c419..794ce7146d4 100644 --- a/src/vs/workbench/parts/explorers/browser/views/treeExplorerViewer.ts +++ b/src/vs/workbench/parts/explorers/browser/views/treeExplorerViewer.ts @@ -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, diff --git a/src/vs/workbench/parts/feedback/browser/feedbackStatusbarItem.ts b/src/vs/workbench/parts/feedback/browser/feedbackStatusbarItem.ts index 0afb1544592..323665c1293 100644 --- a/src/vs/workbench/parts/feedback/browser/feedbackStatusbarItem.ts +++ b/src/vs/workbench/parts/feedback/browser/feedbackStatusbarItem.ts @@ -60,5 +60,7 @@ export class FeedbackStatusbarItem implements IStatusbarItem { feedbackService: this.instantiationService.createInstance(TwitterFeedbackService) }); } + + return null; } } \ No newline at end of file diff --git a/src/vs/workbench/parts/files/browser/fileActions.ts b/src/vs/workbench/parts/files/browser/fileActions.ts index 10003bec050..6d9995addab 100644 --- a/src/vs/workbench/parts/files/browser/fileActions.ts +++ b/src/vs/workbench/parts/files/browser/fileActions.ts @@ -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) { diff --git a/src/vs/workbench/parts/files/browser/views/explorerView.ts b/src/vs/workbench/parts/files/browser/views/explorerView.ts index f554a373d9a..13582f30140 100644 --- a/src/vs/workbench/parts/files/browser/views/explorerView.ts +++ b/src/vs/workbench/parts/files/browser/views/explorerView.ts @@ -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 diff --git a/src/vs/workbench/parts/files/browser/views/explorerViewer.ts b/src/vs/workbench/parts/files/browser/views/explorerViewer.ts index a3c357841b8..c2ade6eb9bc 100644 --- a/src/vs/workbench/parts/files/browser/views/explorerViewer.ts +++ b/src/vs/workbench/parts/files/browser/views/explorerViewer.ts @@ -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) { diff --git a/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts b/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts index 56a5d388455..14d1268f120 100644 --- a/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts +++ b/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts @@ -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(); diff --git a/src/vs/workbench/parts/watermark/electron-browser/watermark.ts b/src/vs/workbench/parts/watermark/electron-browser/watermark.ts index 94aa2ef23ba..6e09f5fb416 100644 --- a/src/vs/workbench/parts/watermark/electron-browser/watermark.ts +++ b/src/vs/workbench/parts/watermark/electron-browser/watermark.ts @@ -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); diff --git a/src/vs/workbench/services/backup/node/backupModelService.ts b/src/vs/workbench/services/backup/node/backupModelService.ts index f321204fd5f..b8995c93eb2 100644 --- a/src/vs/workbench/services/backup/node/backupModelService.ts +++ b/src/vs/workbench/services/backup/node/backupModelService.ts @@ -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 ) { diff --git a/src/vs/workbench/services/configuration/node/configurationService.ts b/src/vs/workbench/services/configuration/node/configurationService.ts index 1c05bcc5d50..66f7288bd8f 100644 --- a/src/vs/workbench/services/configuration/node/configurationService.ts +++ b/src/vs/workbench/services/configuration/node/configurationService.ts @@ -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); } diff --git a/src/vs/workbench/services/files/node/fileService.ts b/src/vs/workbench/services/files/node/fileService.ts index ed348617312..2add9acc0b6 100644 --- a/src/vs/workbench/services/files/node/fileService.ts +++ b/src/vs/workbench/services/files/node/fileService.ts @@ -660,7 +660,7 @@ export class FileService implements IFileService { }); // Errors - watcher.on('error', (error) => { + watcher.on('error', (error: string) => { this.options.errorLogger(error); }); } diff --git a/src/vs/workbench/services/history/browser/history.ts b/src/vs/workbench/services/history/browser/history.ts index fdc9461bca2..2ed7501f303 100644 --- a/src/vs/workbench/services/history/browser/history.ts +++ b/src/vs/workbench/services/history/browser/history.ts @@ -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 diff --git a/src/vs/workbench/services/message/electron-browser/messageService.ts b/src/vs/workbench/services/message/electron-browser/messageService.ts index 0c930127383..70dfd1b0e39 100644 --- a/src/vs/workbench/services/message/electron-browser/messageService.ts +++ b/src/vs/workbench/services/message/electron-browser/messageService.ts @@ -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); }; diff --git a/src/vs/workbench/services/storage/common/storageService.ts b/src/vs/workbench/services/storage/common/storageService.ts index ee585b8b6fd..21245d629ab 100644 --- a/src/vs/workbench/services/storage/common/storageService.ts +++ b/src/vs/workbench/services/storage/common/storageService.ts @@ -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(); diff --git a/src/vs/workbench/services/storage/test/storageService.test.ts b/src/vs/workbench/services/storage/test/storageService.test.ts index ed97dd7d6d6..3bb7f80309f 100644 --- a/src/vs/workbench/services/storage/test/storageService.test.ts +++ b/src/vs/workbench/services/storage/test/storageService.test.ts @@ -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); diff --git a/src/vs/workbench/services/textfile/common/textfiles.ts b/src/vs/workbench/services/textfile/common/textfiles.ts index e323d8c045f..2c621b049e7 100644 --- a/src/vs/workbench/services/textfile/common/textfiles.ts +++ b/src/vs/workbench/services/textfile/common/textfiles.ts @@ -225,7 +225,7 @@ export interface ITextFileEditorModel extends ITextEditorModel, IEncodingSupport revert(): TPromise; - setConflictResolutionMode(); + setConflictResolutionMode(): void; getValue(): string; diff --git a/src/vs/workbench/services/textfile/electron-browser/textFileService.ts b/src/vs/workbench/services/textfile/electron-browser/textFileService.ts index f099562c343..3cbc00c8325 100644 --- a/src/vs/workbench/services/textfile/electron-browser/textFileService.ts +++ b/src/vs/workbench/services/textfile/electron-browser/textFileService.ts @@ -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) { diff --git a/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts b/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts index 4a033541e84..d517328dd17 100644 --- a/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts +++ b/src/vs/workbench/services/textmodelResolver/common/textModelResolverService.ts @@ -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); } diff --git a/src/vs/workbench/test/browser/part.test.ts b/src/vs/workbench/test/browser/part.test.ts index eb16071c7ee..364d08916b3 100644 --- a/src/vs/workbench/test/browser/part.test.ts +++ b/src/vs/workbench/test/browser/part.test.ts @@ -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(() => { diff --git a/src/vs/workbench/test/common/memento.test.ts b/src/vs/workbench/test/common/memento.test.ts index de3e5abc969..6bf9bb6ca60 100644 --- a/src/vs/workbench/test/common/memento.test.ts +++ b/src/vs/workbench/test/common/memento.test.ts @@ -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', () => { -- GitLab