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

tslint: less implicit any use

上级 7215ec28
......@@ -692,7 +692,7 @@ export class Builder implements IDisposable {
}
};
return this.on(arg1, fn, listenerToUnbindContainer);
return this.on(arg1, fn, listenerToUnbindContainer, useCapture);
}
/**
......
......@@ -114,14 +114,14 @@ export interface IDomEvent {
(element: EventHandler, type: string, useCapture?: boolean): _Event<any>;
}
export const domEvent: IDomEvent = (element: EventHandler, type: string, useCapture?) => {
export const domEvent: IDomEvent = (element: EventHandler, type: string, useCapture?: boolean) => {
const fn = e => emitter.fire(e);
const emitter = new Emitter<any>({
onFirstListenerAdd: () => {
element.addEventListener(type, fn);
element.addEventListener(type, fn, useCapture);
},
onLastListenerRemove: () => {
element.removeEventListener(type, fn);
element.removeEventListener(type, fn, useCapture);
}
});
......
......@@ -91,7 +91,7 @@ function _renderHtml(content: IHTMLContentElement, options: RenderOptions = {}):
const renderer = new marked.Renderer();
renderer.image = (href: string, title: string, text: string) => {
let dimensions = [];
let dimensions: string[] = [];
if (href) {
const splitted = href.split('|').map(s => s.trim());
href = splitted[0];
......
......@@ -240,7 +240,7 @@ export class ListView<T> implements IDisposable {
return DOM.addDisposableListener(domNode, type, handler, useCapture);
}
private fireScopedEvent(handler: (event: any) => void, index) {
private fireScopedEvent(handler: (event: any) => void, index: number) {
if (index < 0) {
return;
}
......
......@@ -65,7 +65,7 @@ class Trait<T> implements IDisposable {
splice(start: number, deleteCount: number, insertCount: number): void {
const diff = insertCount - deleteCount;
const end = start + deleteCount;
const indexes = [];
const indexes: number[] = [];
for (let index of indexes) {
if (index >= start && index < end) {
......@@ -110,7 +110,7 @@ class Trait<T> implements IDisposable {
class FocusTrait<T> extends Trait<T> {
constructor(private getElementId: (number) => string) {
constructor(private getElementId: (number: number) => string) {
super('focused');
}
......
......@@ -402,7 +402,7 @@ export function sequence<T>(promiseFactories: ITask<TPromise<T>>[]): TPromise<T[
export function first<T>(promiseFactories: ITask<TPromise<T>>[], shouldStop: (t: T) => boolean = t => !!t): TPromise<T> {
promiseFactories = [...promiseFactories.reverse()];
const loop = () => {
const loop: () => TPromise<T> = () => {
if (promiseFactories.length === 0) {
return TPromise.as(null);
}
......
......@@ -65,12 +65,12 @@ function hsla2rgba(hsla: HSLA): RGBA {
let s = Math.min(hsla.s, 1);
let l = Math.min(hsla.l, 1);
let a = hsla.a === void 0 ? hsla.a : 1;
let r, g, b;
let r: number, g: number, b: number;
if (s === 0) {
r = g = b = l; // achromatic
} else {
let hue2rgb = function hue2rgb(p, q, t) {
let hue2rgb = function hue2rgb(p: number, q: number, t: number) {
if (t < 0) {
t += 1;
}
......@@ -115,7 +115,7 @@ export class Color {
* Returns the number in the set [0, 1]. O => Darkest Black. 1 => Lightest white.
*/
public getLuminosity(): number {
let luminosityFor = function (color): number {
let luminosityFor = function (color: number): number {
let c = color / 255;
return (c <= 0.03928) ? c / 12.92 : Math.pow(((c + 0.055) / 1.055), 2.4);
};
......
......@@ -83,8 +83,8 @@ export function compareByPrefix(one: string, other: string, lookFor: string): nu
}
export interface IScorableResourceAccessor<T> {
getLabel(T): string;
getResourcePath(T): string;
getLabel(t: T): string;
getResourcePath(t: T): string;
}
export function compareByScore<T>(elementA: T, elementB: T, accessor: IScorableResourceAccessor<T>, lookFor: string, lookForNormalizedLower: string, scorerCache?: { [key: string]: number }): number {
......
......@@ -23,7 +23,7 @@ export function memoize(target: any, key: string, descriptor: any) {
const memoizeKey = `$memoize$${key}`;
descriptor[fnKey] = function (...args) {
descriptor[fnKey] = function (...args: any[]) {
if (!this.hasOwnProperty(memoizeKey)) {
Object.defineProperty(this, memoizeKey, {
configurable: false,
......
......@@ -19,7 +19,7 @@ globals.Monaco.Diagnostics = {};
var switches = globals.Monaco.Diagnostics;
var map = {};
var data = [];
var data: any[] = [];
function fifo(array: any[], size: number) {
while (array.length > size) {
......
......@@ -148,8 +148,8 @@ export class LcsDiff2 {
// Construct the changes
let i = 0;
let j = 0;
let xChangeStart, yChangeStart;
let changes = [];
let xChangeStart: number, yChangeStart: number;
let changes: DiffChange[] = [];
while (i < xLength && j < yLength) {
if (this.resultX[i] && this.resultY[j]) {
// No change
......
......@@ -218,7 +218,7 @@ export function once<T>(event: Event<T>): Event<T> {
}
export function any<T>(...events: Event<T>[]): Event<T> {
let listeners = [];
let listeners: IDisposable[] = [];
const emitter = new Emitter<T>({
onFirstListenerAdd() {
......@@ -297,7 +297,7 @@ export class EventBufferer {
}
bufferEvents(fn: () => void): void {
const buffer = [];
const buffer: Function[] = [];
this.buffers.push(buffer);
fn();
this.buffers.pop();
......@@ -334,7 +334,7 @@ class ChainableEvent<T> implements IChainableEvent<T> {
return new ChainableEvent(filterEvent(this._event, fn));
}
on(listener, thisArgs, disposables) {
on(listener, thisArgs, disposables: IDisposable[]) {
return this._event(listener, thisArgs, disposables);
}
}
......
......@@ -209,7 +209,7 @@ function analyzeCamelCaseWord(word: string): ICamelCaseAnalysis {
}
function isUpperCaseWord(analysis: ICamelCaseAnalysis): boolean {
const { upperPercent, lowerPercent, alphaPercent, numericPercent } = analysis;
const { upperPercent, lowerPercent } = analysis;
return lowerPercent === 0 && upperPercent > 0.6;
}
......@@ -298,7 +298,7 @@ function _matchesWords(word: string, target: string, i: number, j: number): IMat
} else if (word[i] !== target[j].toLowerCase()) {
return null;
} else {
let result = null;
let result: IMatch[] = null;
let nextWordIndex = j + 1;
result = _matchesWords(word, target, i + 1, j + 1);
while (!result && (nextWordIndex = nextWord(target, nextWordIndex)) < target.length) {
......
......@@ -42,7 +42,7 @@ export interface JSONScanner {
/**
* Sets the scan position to a new offset. A call to 'scan' is needed to get the first token.
*/
setPosition(pos: number);
setPosition(pos: number): void;
/**
* Read the next token. Returns the tolen code.
*/
......
......@@ -310,7 +310,7 @@ class Node<E> {
*/
export class TrieMap<E> {
static PathSplitter = s => s.split(/[\\/]/).filter(s => !!s);
static PathSplitter = (s: string) => s.split(/[\\/]/).filter(s => !!s);
private _splitter: (s: string) => string[];
private _root = new Node<E>();
......
......@@ -13,8 +13,8 @@ let _isRootUser = false;
let _isNative = false;
let _isWeb = false;
let _isQunit = false;
let _locale = undefined;
let _language = undefined;
let _locale: string = undefined;
let _language: string = undefined;
interface NLSConfig {
locale: string;
......@@ -124,7 +124,7 @@ interface IGlobals {
clearTimeout(token: TimeoutToken): void;
setInterval(callback: (...args: any[]) => void, delay: number, ...args: any[]): IntervalToken;
clearInterval(token: IntervalToken);
clearInterval(token: IntervalToken): void;
}
const _globals = <IGlobals>(typeof self === 'object' ? self : global);
......
......@@ -106,7 +106,7 @@ function read(zipPath: string, filePath: string): TPromise<Readable> {
export function buffer(zipPath: string, filePath: string): TPromise<Buffer> {
return read(zipPath, filePath).then(stream => {
return new TPromise<Buffer>((c, e) => {
const buffers = [];
const buffers: Buffer[] = [];
stream.once('error', e);
stream.on('data', b => buffers.push(b));
stream.on('end', () => c(Buffer.concat(buffers)));
......
......@@ -148,7 +148,7 @@ export function formatOptions(options: { [name: string]: string; }, columns: num
}
function wrapText(text: string, columns: number): string[] {
let lines = [];
let lines: string[] = [];
while (text.length) {
let index = text.length < columns ? text.length : text.lastIndexOf(' ', columns);
let line = text.slice(0, index).trim();
......
......@@ -23,7 +23,7 @@ export interface ICommandAndKeybindingRule extends IKeybindingRule {
}
export interface IKeybindingsRegistry {
registerKeybindingRule(rule: IKeybindingRule);
registerKeybindingRule(rule: IKeybindingRule): void;
registerCommandAndKeybindingRule(desc: ICommandAndKeybindingRule): void;
getDefaultKeybindings(): IKeybindingItem[];
......
......@@ -579,7 +579,7 @@ export class MainThreadEditorsTracker {
}
private _findVisibleTextEditorIds(): string[] {
let result = [];
let result: string[] = [];
let modelUris = Object.keys(this._model2TextEditors);
for (let i = 0, len = modelUris.length; i < len; i++) {
let editors = this._model2TextEditors[modelUris[i]];
......
......@@ -16,7 +16,7 @@ export class MainThreadTreeExplorers extends MainThreadTreeExplorersShape {
private _proxy: ExtHostTreeExplorersShape;
constructor(
@IThreadService private threadService: IThreadService,
@IThreadService threadService: IThreadService,
@ITreeExplorerService private treeExplorerService: ITreeExplorerService,
@IMessageService private messageService: IMessageService,
@ICommandService private commandService: ICommandService
......
......@@ -30,9 +30,9 @@ export class MainThreadWorkspace extends MainThreadWorkspaceShape {
constructor(
@ISearchService searchService: ISearchService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
@ITextFileService textFileService,
@IWorkbenchEditorService editorService,
@ITextModelResolverService textModelResolverService,
@ITextFileService textFileService: ITextFileService,
@IWorkbenchEditorService editorService: IWorkbenchEditorService,
@ITextModelResolverService textModelResolverService: ITextModelResolverService,
@IFileService fileService: IFileService
) {
super();
......
......@@ -22,7 +22,6 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi
import { Position, POSITIONS } from 'vs/platform/editor/common/editor';
import { IEditorGroupService, ITabOptions, GroupArrangement, GroupOrientation } from 'vs/workbench/services/group/common/groupService';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
......@@ -139,7 +138,6 @@ export class EditorGroupsControl implements IEditorGroupsControl, IVerticalSashL
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IEditorGroupService private editorGroupService: IEditorGroupService,
@ITelemetryService private telemetryService: ITelemetryService,
@IConfigurationService private configurationService: IConfigurationService,
@IContextKeyService private contextKeyService: IContextKeyService,
@IExtensionService private extensionService: IExtensionService,
@IInstantiationService private instantiationService: IInstantiationService,
......
......@@ -425,7 +425,7 @@ export class TabsTitleControl extends TitleControl {
}
private hookTabListeners(tab: HTMLElement, index: number): IDisposable {
const disposables = [];
const disposables: IDisposable[] = [];
// Open on Click
disposables.push(DOM.addDisposableListener(tab, DOM.EventType.MOUSE_DOWN, (e: MouseEvent) => {
......
......@@ -559,7 +559,7 @@ export class EditorGroup implements IEditorGroup {
// It is possible to have the same resource opened twice (once as normal input and once as diff input)
// So we need to do ref counting on the resource to provide the correct picture
let counter = this.mapResourceToEditorCount[resource.toString()] || 0;
let newCounter;
let newCounter: number;
if (remove) {
if (counter > 1) {
newCounter = counter - 1;
......
......@@ -66,7 +66,7 @@ export class DebugEditorContribution implements IDebugEditorContribution {
}
private getContextMenuActions(breakpoint: IBreakpoint, uri: uri, lineNumber: number): TPromise<IAction[]> {
const actions = [];
const actions: IAction[] = [];
if (breakpoint) {
actions.push(this.instantiationService.createInstance(RemoveBreakpointAction, RemoveBreakpointAction.ID, RemoveBreakpointAction.LABEL));
actions.push(this.instantiationService.createInstance(EditConditionalBreakpointAction, EditConditionalBreakpointAction.ID, EditConditionalBreakpointAction.LABEL, this.editor, lineNumber));
......
......@@ -110,13 +110,13 @@ export class DebugHoverWidget implements IContentWidget {
}
private getExactExpressionRange(lineContent: string, range: Range): Range {
let matchingExpression = undefined;
let matchingExpression: string = undefined;
let startOffset = 0;
// Some example supported expressions: myVar.prop, a.b.c.d, myVar?.prop, myVar->prop, MyClass::StaticProp, *myVar
// Match any character except a set of characters which often break interesting sub-expressions
let expression: RegExp = /([^()\[\]{}<>\s+\-/%~#^;=|,`!]|\->)+/g;
let result = undefined;
let result: RegExpExecArray = undefined;
// First find the full expression under the cursor
while (result = expression.exec(lineContent)) {
......@@ -134,7 +134,7 @@ export class DebugHoverWidget implements IContentWidget {
// For example in expression 'a.b.c.d', if the focus was under 'b', 'a.b' would be evaluated.
if (matchingExpression) {
let subExpression: RegExp = /\w+/g;
let subExpressionResult = undefined;
let subExpressionResult: RegExpExecArray = undefined;
while (subExpressionResult = subExpression.exec(matchingExpression)) {
let subEnd = subExpressionResult.index + 1 + startOffset + subExpressionResult[0].length;
if (subEnd >= range.endColumn) {
......
......@@ -29,7 +29,6 @@ import { MenuId } from 'vs/platform/actions/common/actions';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { IContextKeyService, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IInstantiationService, createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { ReplExpressionsRenderer, ReplExpressionsController, ReplExpressionsDataSource, ReplExpressionsActionProvider, ReplExpressionsAccessibilityProvider } from 'vs/workbench/parts/debug/electron-browser/replViewer';
......@@ -81,7 +80,6 @@ export class Repl extends Panel implements IPrivateReplService {
constructor(
@debug.IDebugService private debugService: debug.IDebugService,
@IContextMenuService private contextMenuService: IContextMenuService,
@ITelemetryService telemetryService: ITelemetryService,
@IInstantiationService private instantiationService: IInstantiationService,
@IStorageService private storageService: IStorageService,
......
......@@ -373,7 +373,7 @@ export class ReplExpressionsRenderer implements IRenderer {
pattern.lastIndex = 0; // the holy grail of software development
const match = pattern.exec(text);
let resource = null;
let resource: uri = null;
try {
resource = match && uri.file(match[1]);
} catch (e) { }
......
......@@ -50,19 +50,11 @@ export class TreeExplorerView extends CollapsibleViewletView {
const dataSource = this.instantiationService.createInstance(TreeDataSource, this.treeNodeProviderId);
const renderer = this.instantiationService.createInstance(TreeRenderer, this.viewletState, this.actionRunner, container.getHTMLElement());
const controller = this.instantiationService.createInstance(TreeController, this.treeNodeProviderId);
const sorter = null;
const filter = null;
const dnd = null;
const accessibilityProvider = null;
return new Tree(container.getHTMLElement(), {
dataSource,
renderer,
controller,
sorter,
filter,
dnd,
accessibilityProvider
controller
});
}
......
......@@ -313,7 +313,7 @@ export class DropDownMenuActionItem extends ActionItem {
}
private getActions(): IAction[] {
let actions = [];
let actions: IAction[] = [];
const menuActionGroups = this.menuActionGroups.filter(group => group.some(action => action.enabled));
for (const menuActions of menuActionGroups) {
actions = [...actions, ...menuActions, new Separator()];
......
......@@ -72,7 +72,7 @@ export class GalleryExtensionsHandler extends QuickOpenHandler {
}
getResults(text: string): TPromise<IModel<any>> {
const entries = [];
const entries: SimpleEntry[] = [];
if (text) {
const label = nls.localize('searchFor', "Press Enter to search for '{0}' in the Marketplace.", text);
......
......@@ -1174,7 +1174,6 @@ export class CompareResourcesAction extends Action {
constructor(
resource: URI,
tree: ITree,
@IInstantiationService private instantiationService: IInstantiationService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService
) {
super('workbench.files.action.compareFiles', CompareResourcesAction.computeLabel());
......
......@@ -183,7 +183,6 @@ class ResolveSaveConflictMessage implements IMessageWithAction {
model: ITextFileEditorModel,
message: string,
@IMessageService private messageService: IMessageService,
@IInstantiationService private instantiationService: IInstantiationService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IEnvironmentService private environmentService: IEnvironmentService
) {
......
......@@ -97,7 +97,7 @@ export class DefaultPreferencesEditor extends BaseTextEditor {
public static ID: string = 'workbench.editor.defaultPreferences';
private static VIEW_STATE: Map<URI, editorCommon.IEditorViewState> = new Map<URI, editorCommon.IEditorViewState>();
private inputDisposeListener;
private inputDisposeListener: IDisposable;
private defaultSettingHeaderWidget: DefaultSettingsHeaderWidget;
private delayedFilterLogging: Delayer<void>;
......@@ -244,8 +244,8 @@ class DefaultPreferencesCodeEditor extends CodeEditor {
}
export interface IPreferencesRenderer {
render();
dispose();
render(): void;
dispose(): void;
}
export abstract class PreferencesEditorContribution extends Disposable implements editorCommon.IEditorContribution {
......
......@@ -503,7 +503,7 @@ export class SearchModel extends Disposable {
private currentRequest: PPromise<ISearchComplete, ISearchProgressItem>;
constructor( @ISearchService private searchService, @ITelemetryService private telemetryService: ITelemetryService, @IInstantiationService private instantiationService: IInstantiationService) {
constructor( @ISearchService private searchService: ISearchService, @ITelemetryService private telemetryService: ITelemetryService, @IInstantiationService private instantiationService: IInstantiationService) {
super();
this._searchResult = this.instantiationService.createInstance(SearchResult, this);
}
......
......@@ -14,7 +14,6 @@ import { mkdirp, fileExists, readdir } from 'vs/base/node/pfs';
import { onUnexpectedError } from 'vs/base/common/errors';
import lifecycle = require('vs/base/common/lifecycle');
import { readAndRegisterSnippets } from 'vs/editor/node/textMate/TMSnippets';
import { IFileService } from 'vs/platform/files/common/files';
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { watch, FSWatcher } from 'fs';
......@@ -28,7 +27,6 @@ export class SnippetsTracker implements workbenchExt.IWorkbenchContribution {
private fileWatchDelayer: async.ThrottledDelayer<void>;
constructor(
@IFileService private fileService: IFileService,
@ILifecycleService private lifecycleService: ILifecycleService,
@IEnvironmentService environmentService: IEnvironmentService
) {
......
......@@ -306,7 +306,7 @@ export class TerminalInstance implements ITerminalInstance {
}
protected _getCwd(workspace: IWorkspace, ignoreCustomCwd: boolean): string {
let cwd;
let cwd: string;
// TODO: Handle non-existent customCwd
if (!ignoreCustomCwd) {
......@@ -355,7 +355,7 @@ export class TerminalInstance implements ITerminalInstance {
this._onProcessIdReady.fire(this);
}
});
this._process.on('exit', (exitCode) => {
this._process.on('exit', (exitCode: number) => {
// Prevent dispose functions being triggered multiple times
if (!this._isExiting) {
this.dispose();
......
......@@ -16,10 +16,7 @@ import { IThemeService } from 'vs/workbench/services/themes/common/themeService'
import { ReleaseNotesInput } from './releaseNotesInput';
import { EditorOptions } from 'vs/workbench/common/editor';
import WebView from 'vs/workbench/parts/html/browser/webview';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IRequestService } from 'vs/platform/request/node/request';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IModeService } from 'vs/editor/common/services/modeService';
import { tokenizeToString } from 'vs/editor/common/modes/textToHtmlTokenizer';
......@@ -46,10 +43,7 @@ export class ReleaseNotesEditor extends BaseEditor {
constructor(
@ITelemetryService telemetryService: ITelemetryService,
@IThemeService private themeService: IThemeService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IRequestService private requestService: IRequestService,
@IOpenerService private openerService: IOpenerService,
@IKeybindingService private keybindingService: IKeybindingService,
@IModeService private modeService: IModeService
) {
super(ReleaseNotesEditor.ID, telemetryService);
......
......@@ -119,13 +119,12 @@ export class OpenLatestReleaseNotesInBrowserAction extends Action {
export abstract class AbstractShowReleaseNotesAction extends Action {
constructor(
id,
label,
id: string,
label: string,
private returnValue: boolean,
private version: string,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService,
@IInstantiationService private instantiationService: IInstantiationService,
@IOpenerService private openerService: IOpenerService
@IInstantiationService private instantiationService: IInstantiationService
) {
super(id, label, null, true);
}
......@@ -153,10 +152,9 @@ export class ShowReleaseNotesAction extends AbstractShowReleaseNotesAction {
returnValue: boolean,
version: string,
@IWorkbenchEditorService editorService: IWorkbenchEditorService,
@IInstantiationService instantiationService: IInstantiationService,
@IOpenerService openerService: IOpenerService
@IInstantiationService instantiationService: IInstantiationService
) {
super('update.showReleaseNotes', nls.localize('releaseNotes', "Release Notes"), returnValue, version, editorService, instantiationService, openerService);
super('update.showReleaseNotes', nls.localize('releaseNotes', "Release Notes"), returnValue, version, editorService, instantiationService);
}
}
......@@ -169,10 +167,9 @@ export class ShowCurrentReleaseNotesAction extends AbstractShowReleaseNotesActio
id = ShowCurrentReleaseNotesAction.ID,
label = ShowCurrentReleaseNotesAction.LABEL,
@IWorkbenchEditorService editorService: IWorkbenchEditorService,
@IInstantiationService instantiationService: IInstantiationService,
@IOpenerService openerService: IOpenerService
@IInstantiationService instantiationService: IInstantiationService
) {
super(id, label, true, pkg.version, editorService, instantiationService, openerService);
super(id, label, true, pkg.version, editorService, instantiationService);
}
}
......
......@@ -187,7 +187,7 @@ export class WorkspaceConfigurationService implements IWorkspaceConfigurationSer
this.cachedWorkspaceConfig = workspaceConfig;
// Cache keys
const workspaceConfigKeys = [];
const workspaceConfigKeys: string[] = [];
Object.keys(workspaceConfigFiles).forEach(path => {
if (path === WORKSPACE_CONFIG_DEFAULT_PATH) {
workspaceConfigKeys.push(...Object.keys(workspaceConfigFiles[path].raw));
......
......@@ -25,7 +25,6 @@ import URI from 'vs/base/common/uri';
import { FileService } from 'vs/workbench/services/files/node/fileService';
import { ConfigurationEditingService } from 'vs/workbench/services/configuration/node/configurationEditingService';
import { ConfigurationTarget, IConfigurationEditingError, ConfigurationEditingErrorCode } from 'vs/workbench/services/configuration/common/configurationEditing';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IFileService } from 'vs/platform/files/common/files';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
......@@ -56,7 +55,6 @@ class TestDirtyTextFileService extends TestTextFileService {
@IConfigurationService configurationService: IConfigurationService,
@ITelemetryService telemetryService: ITelemetryService,
@IWorkbenchEditorService editorService: IWorkbenchEditorService,
@IEditorGroupService editorGroupService: IEditorGroupService,
@IFileService fileService: IFileService,
@IUntitledEditorService untitledEditorService: IUntitledEditorService,
@IInstantiationService instantiationService: IInstantiationService,
......@@ -64,7 +62,7 @@ class TestDirtyTextFileService extends TestTextFileService {
@IBackupFileService backupFileService: IBackupFileService,
@IWindowsService windowsService: IWindowsService
) {
super(lifecycleService, contextService, configurationService, telemetryService, editorService, editorGroupService, fileService, untitledEditorService, instantiationService, messageService, backupFileService, windowsService);
super(lifecycleService, contextService, configurationService, telemetryService, editorService, fileService, untitledEditorService, instantiationService, messageService, backupFileService, windowsService);
}
public isDirty(resource?: URI): boolean {
......
......@@ -221,7 +221,7 @@ export class ConfigurationResolverService implements IConfigurationResolverServi
const factory: { (): TPromise<any> }[] = Object.keys(interactiveVariablesToSubstitutes).map(interactiveVariable => {
return () => {
let commandId = null;
let commandId: string = null;
commandId = interactiveVariablesMap ? interactiveVariablesMap[interactiveVariable] : null;
if (!commandId) {
// Just launch any command if the interactive variable is not contributed by the adapter #12735
......
......@@ -121,7 +121,7 @@ export class Engine implements ISearchEngine<ISerializedFileMatch> {
};
// Walk over the file system
let nextBatch = [];
let nextBatch: string[] = [];
let nextBatchBytes = 0;
const batchFlushBytes = 2 ** 20; // 1MB
this.walker.walk(this.config.rootFolders, this.config.extraFiles, result => {
......
......@@ -177,7 +177,7 @@ export class SearchWorkerEngine {
let lineNumber = 0;
let lastBufferHadTraillingCR = false;
const decodeBuffer = (buffer: NodeBuffer, start, end): string => {
const decodeBuffer = (buffer: NodeBuffer, start: number, end: number): string => {
if (options.encoding === UTF8 || options.encoding === UTF8_with_bom) {
return buffer.toString(undefined, start, end); // much faster to use built in toString() when encoding is default
}
......
......@@ -60,7 +60,8 @@ function extractDomain(url: string): string {
}
export function getDomainsOfRemotes(text: string, whitelist: string[]): string[] {
let domains = new ArraySet<string>(), match;
let domains = new ArraySet<string>();
let match: RegExpExecArray;
while (match = RemoteMatcher.exec(text)) {
let domain = extractDomain(match[1]);
if (domain) {
......@@ -242,7 +243,7 @@ export class WorkspaceStats {
);
}
private reportAzure(uri) {
private reportAzure(uri: URI) {
const tags: Tags = Object.create(null);
this.reportAzureNode(uri, tags).then((tags) => {
return this.reportAzureJava(uri, tags);
......
......@@ -23,7 +23,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { UntitledEditorModel } from 'vs/workbench/common/editor/untitledEditorModel';
import { TextFileEditorModelManager } from 'vs/workbench/services/textfile/common/textFileEditorModelManager';
......@@ -61,7 +60,6 @@ export abstract class TextFileService implements ITextFileService {
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IConfigurationService private configurationService: IConfigurationService,
@ITelemetryService private telemetryService: ITelemetryService,
@IEditorGroupService private editorGroupService: IEditorGroupService,
@IFileService protected fileService: IFileService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IInstantiationService private instantiationService: IInstantiationService,
......
......@@ -22,7 +22,6 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IWindowIPCService } from 'vs/workbench/services/window/electron-browser/windowService';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { ModelBuilder } from 'vs/editor/node/model/modelBuilder';
import product from 'vs/platform/node/product';
......@@ -46,7 +45,6 @@ export class TextFileService extends AbstractTextFileService {
@ITelemetryService telemetryService: ITelemetryService,
@IConfigurationService configurationService: IConfigurationService,
@IModeService private modeService: IModeService,
@IEditorGroupService editorGroupService: IEditorGroupService,
@IWindowIPCService private windowService: IWindowIPCService,
@IModelService private modelService: IModelService,
@IEnvironmentService environmentService: IEnvironmentService,
......@@ -55,7 +53,7 @@ export class TextFileService extends AbstractTextFileService {
@IStorageService private storageService: IStorageService,
@IWindowsService windowsService: IWindowsService
) {
super(lifecycleService, contextService, configurationService, telemetryService, editorGroupService, fileService, untitledEditorService, instantiationService, messageService, environmentService, backupFileService, windowsService);
super(lifecycleService, contextService, configurationService, telemetryService, fileService, untitledEditorService, instantiationService, messageService, environmentService, backupFileService, windowsService);
}
public resolveTextContent(resource: URI, options?: IResolveContentOptions): TPromise<IRawTextContent> {
......
......@@ -94,7 +94,7 @@ export class TokenStylesContribution {
public contributeStyles(themeId: string, themeDocument: IThemeDocument, cssRules: string[]): void {
let theme = new Theme(themeId, themeDocument);
theme.getSettings().forEach((s: IThemeSetting, index, arr) => {
theme.getSettings().forEach((s: IThemeSetting, index: number, arr: IThemeSetting[]) => {
// @martin TS(2.0.2) - s.scope is already a string[] so no need for all this checking.
// However will add a cast at split to keep semantic in case s.scope is wrongly typed.
let scope: string | string[] = s.scope;
......@@ -127,7 +127,7 @@ export class TokenStylesContribution {
//statements.push(`background-color: ${background};`);
break;
case 'fontStyle':
let segments = value.split(' ');
let segments: string[] = value.split(' ');
segments.forEach(s => {
switch (s) {
case 'italic':
......
......@@ -434,7 +434,7 @@ export class ThemeService implements IThemeService {
private _updateIconTheme(onApply: (theme: IInternalThemeData) => void): TPromise<boolean> {
return this.getFileIconThemes().then(allIconSets => {
let iconSetData;
let iconSetData: IInternalThemeData;
for (let iconSet of allIconSets) {
if (iconSet.id === this.currentIconTheme) {
iconSetData = <IInternalThemeData>iconSet;
......@@ -533,7 +533,7 @@ function _processIconThemeDocument(id: string, iconThemeDocumentPath: string, ic
let fileExtensions = associations.fileExtensions;
if (fileExtensions) {
for (let fileExtension in fileExtensions) {
let selectors = [];
let selectors: string[] = [];
let segments = fileExtension.toLowerCase().split('.');
for (let i = 0; i < segments.length; i++) {
selectors.push(`.${escapeCSS(segments.slice(i).join('.'))}-ext-file-icon`);
......@@ -544,7 +544,7 @@ function _processIconThemeDocument(id: string, iconThemeDocumentPath: string, ic
let fileNames = associations.fileNames;
if (fileNames) {
for (let fileName in fileNames) {
let selectors = [];
let selectors: string[] = [];
let segments = fileName.toLowerCase().split('.');
if (segments[0]) {
selectors.push(`.${escapeCSS(segments[0])}-name-file-icon`);
......
......@@ -110,7 +110,6 @@ export class TestTextFileService extends TextFileService {
@IConfigurationService configurationService: IConfigurationService,
@ITelemetryService telemetryService: ITelemetryService,
@IWorkbenchEditorService editorService: IWorkbenchEditorService,
@IEditorGroupService editorGroupService: IEditorGroupService,
@IFileService fileService: IFileService,
@IUntitledEditorService untitledEditorService: IUntitledEditorService,
@IInstantiationService instantiationService: IInstantiationService,
......@@ -118,7 +117,7 @@ export class TestTextFileService extends TextFileService {
@IBackupFileService backupFileService: IBackupFileService,
@IWindowsService windowsService: IWindowsService
) {
super(lifecycleService, contextService, configurationService, telemetryService, editorGroupService, fileService, untitledEditorService, instantiationService, messageService, TestEnvironmentService, backupFileService, windowsService);
super(lifecycleService, contextService, configurationService, telemetryService, fileService, untitledEditorService, instantiationService, messageService, TestEnvironmentService, backupFileService, windowsService);
}
public setPromptPath(path: string): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册