提交 e80300ad 编写于 作者: M Matt Bierner

Auto let -> const and auto mark privates as readonly in vs/code

上级 a4b49166
......@@ -64,14 +64,14 @@ export class IssueReporter extends Disposable {
private environmentService: IEnvironmentService;
private telemetryService: ITelemetryService;
private logService: ILogService;
private issueReporterModel: IssueReporterModel;
private readonly issueReporterModel: IssueReporterModel;
private numberOfSearchResultsDisplayed = 0;
private receivedSystemInfo = false;
private receivedPerformanceInfo = false;
private shouldQueueSearch = false;
private hasBeenSubmitted = false;
private previewButton: Button;
private readonly previewButton: Button;
constructor(configuration: IssueReporterConfiguration) {
super();
......
......@@ -34,7 +34,7 @@ export interface IssueReporterData {
}
export class IssueReporterModel {
private _data: IssueReporterData;
private readonly _data: IssueReporterData;
constructor(initialData?: Partial<IssueReporterData>) {
const defaultData = {
......@@ -196,7 +196,7 @@ ${this._data.workspaceInfo};
return 'Extensions: none' + themeExclusionStr;
}
let tableHeader = `Extension|Author (truncated)|Version
const tableHeader = `Extension|Author (truncated)|Version
---|---|---`;
const table = this._data.enabledNonThemeExtesions.map(e => {
return `${e.name}|${e.publisher.substr(0, 3)}|${e.version}`;
......@@ -226,7 +226,7 @@ Literal matches: ${this._data.filterResultCount}`;
return `No fuzzy results`;
}
let tableHeader = `Setting|Extension|Score
const tableHeader = `Setting|Extension|Score
---|---|---`;
const table = this._data.actualSearchResults.map(setting => {
return `${setting.key}|${setting.extensionId}|${String(setting.score).slice(0, 5)}`;
......
......@@ -57,15 +57,15 @@ export class LanguagePackCachedDataCleaner {
? 1000 * 60 * 60 * 24 * 7 // roughly 1 week
: 1000 * 60 * 60 * 24 * 30 * 3; // roughly 3 months
try {
let installed: IStringDictionary<boolean> = Object.create(null);
const installed: IStringDictionary<boolean> = Object.create(null);
const metaData: LanguagePackFile = JSON.parse(await pfs.readFile(path.join(this._environmentService.userDataPath, 'languagepacks.json'), 'utf8'));
for (let locale of Object.keys(metaData)) {
let entry = metaData[locale];
const entry = metaData[locale];
installed[`${entry.hash}.${locale}`] = true;
}
// Cleanup entries for language packs that aren't installed anymore
const cacheDir = path.join(this._environmentService.userDataPath, 'clp');
let exists = await pfs.exists(cacheDir);
const exists = await pfs.exists(cacheDir);
if (!exists) {
return;
}
......
......@@ -91,8 +91,8 @@ export class CodeApplication extends Disposable {
private sharedProcessClient: Promise<Client>;
constructor(
private mainIpcServer: Server,
private userEnv: IProcessEnvironment,
private readonly mainIpcServer: Server,
private readonly userEnv: IProcessEnvironment,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@ILogService private readonly logService: ILogService,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
......@@ -648,9 +648,9 @@ export class CodeApplication extends Disposable {
const isBuilt = this.environmentService.isBuilt;
class ActiveConnection {
private _authority: string;
private _client: Promise<Client<RemoteAgentConnectionContext>>;
private _disposeRunner: RunOnceScheduler;
private readonly _authority: string;
private readonly _client: Promise<Client<RemoteAgentConnectionContext>>;
private readonly _disposeRunner: RunOnceScheduler;
constructor(authority: string, host: string, port: number) {
this._authority = authority;
......@@ -707,7 +707,7 @@ export class CodeApplication extends Disposable {
if (connectionPool.has(uri.authority)) {
activeConnection = connectionPool.get(uri.authority);
} else {
let resolvedAuthority = resolveAuthority(uri.authority);
const resolvedAuthority = resolveAuthority(uri.authority);
if (!resolvedAuthority) {
callback(undefined);
return;
......
......@@ -69,14 +69,14 @@ export class CodeWindow extends Disposable implements ICodeWindow {
private currentMenuBarVisibility: MenuBarVisibility;
private representedFilename: string;
private whenReadyCallbacks: { (window: ICodeWindow): void }[];
private readonly whenReadyCallbacks: { (window: ICodeWindow): void }[];
private currentConfig: IWindowConfiguration;
private pendingLoadConfig?: IWindowConfiguration;
private marketplaceHeadersPromise: Promise<object>;
private touchBarGroups: Electron.TouchBarSegmentedControl[];
private readonly touchBarGroups: Electron.TouchBarSegmentedControl[];
constructor(
config: IWindowCreationOptions,
......
......@@ -158,11 +158,11 @@ export class WindowsManager implements IWindowsMainService {
private initialUserEnv: IProcessEnvironment;
private windowsState: IWindowsState;
private readonly windowsState: IWindowsState;
private lastClosedWindowState?: IWindowState;
private dialogs: Dialogs;
private workspacesManager: WorkspacesManager;
private readonly dialogs: Dialogs;
private readonly workspacesManager: WorkspacesManager;
private _onWindowReady = new Emitter<ICodeWindow>();
onWindowReady: CommonEvent<ICodeWindow> = this._onWindowReady.event;
......@@ -367,7 +367,7 @@ export class WindowsManager implements IWindowsMainService {
this.logService.trace('windowsManager#open');
openConfig = this.validateOpenConfig(openConfig);
let pathsToOpen = this.getPathsToOpen(openConfig);
const pathsToOpen = this.getPathsToOpen(openConfig);
const foldersToAdd: IFolderPathToOpen[] = [];
const foldersToOpen: IFolderPathToOpen[] = [];
......@@ -439,7 +439,7 @@ export class WindowsManager implements IWindowsMainService {
// Make sure to pass focus to the most relevant of the windows if we open multiple
if (usedWindows.length > 1) {
let focusLastActive = this.windowsState.lastActiveWindow && !openConfig.forceEmpty && !hasArgs(openConfig.cli._) && !hasArgs(openConfig.cli['file-uri']) && !hasArgs(openConfig.cli['folder-uri']) && !(openConfig.urisToOpen && openConfig.urisToOpen.length);
const focusLastActive = this.windowsState.lastActiveWindow && !openConfig.forceEmpty && !hasArgs(openConfig.cli._) && !hasArgs(openConfig.cli['file-uri']) && !hasArgs(openConfig.cli['folder-uri']) && !(openConfig.urisToOpen && openConfig.urisToOpen.length);
let focusLastOpened = true;
let focusLastWindow = true;
......@@ -550,7 +550,7 @@ export class WindowsManager implements IWindowsMainService {
// only look at the windows with correct authority
const windows = WindowsManager.WINDOWS.filter(w => w.remoteAuthority === fileInputs!.remoteAuthority);
let bestWindowOrFolder = findBestWindowOrFolderForFile({
const bestWindowOrFolder = findBestWindowOrFolderForFile({
windows,
newWindow: openFilesInNewWindow,
context: openConfig.context,
......@@ -819,7 +819,7 @@ export class WindowsManager implements IWindowsMainService {
if (!openConfig.addMode && isCommandLineOrAPICall) {
const foldersToOpen = windowsToOpen.filter(path => !!path.folderUri);
if (foldersToOpen.length > 1) {
let remoteAuthority = foldersToOpen[0].remoteAuthority;
const remoteAuthority = foldersToOpen[0].remoteAuthority;
if (foldersToOpen.every(f => f.remoteAuthority === remoteAuthority)) { // only if all folder have the same authority
const workspace = this.workspacesMainService.createUntitledWorkspaceSync(foldersToOpen.map(folder => ({ uri: folder.folderUri! })));
......@@ -836,7 +836,7 @@ export class WindowsManager implements IWindowsMainService {
private doExtractPathsFromAPI(openConfig: IOpenConfiguration): IPathToOpen[] {
const pathsToOpen: IPathToOpen[] = [];
const cli = openConfig.cli;
let parseOptions: IPathParseOptions = { gotoLineMode: cli && cli.goto, forceOpenWorkspaceAsFile: openConfig.forceOpenWorkspaceAsFile };
const parseOptions: IPathParseOptions = { gotoLineMode: cli && cli.goto, forceOpenWorkspaceAsFile: openConfig.forceOpenWorkspaceAsFile };
for (const pathToOpen of openConfig.urisToOpen || []) {
if (!pathToOpen) {
continue;
......@@ -979,7 +979,7 @@ export class WindowsManager implements IWindowsMainService {
private argToUri(arg: string): URI | undefined {
try {
let uri = URI.parse(arg);
const uri = URI.parse(arg);
if (!uri.scheme) {
this.logService.error(`Invalid URI input string, scheme missing: ${arg}`);
return undefined;
......@@ -1547,7 +1547,7 @@ export class WindowsManager implements IWindowsMainService {
openNewWindow(context: OpenContext, options?: INewWindowOptions): ICodeWindow[] {
let cli = this.environmentService.args;
let remote = options && options.remoteAuthority || undefined;
const remote = options && options.remoteAuthority || undefined;
if (cli && (cli.remote !== remote)) {
cli = { ...cli, remote };
}
......@@ -1784,14 +1784,14 @@ class Dialogs {
private static readonly workingDirPickerStorageKey = 'pickerWorkingDir';
private mapWindowToDialogQueue: Map<number, Queue<any>>;
private noWindowDialogQueue: Queue<any>;
private readonly mapWindowToDialogQueue: Map<number, Queue<any>>;
private readonly noWindowDialogQueue: Queue<any>;
constructor(
private environmentService: IEnvironmentService,
private telemetryService: ITelemetryService,
private stateService: IStateService,
private windowsMainService: IWindowsMainService,
private readonly environmentService: IEnvironmentService,
private readonly telemetryService: ITelemetryService,
private readonly stateService: IStateService,
private readonly windowsMainService: IWindowsMainService,
) {
this.mapWindowToDialogQueue = new Map<number, Queue<any>>();
this.noWindowDialogQueue = new Queue<any>();
......
......@@ -104,7 +104,7 @@ export class Main {
}
private async installExtensions(extensions: string[], force: boolean): Promise<void> {
let failed: string[] = [];
const failed: string[] = [];
for (const extension of extensions) {
try {
await this.installExtension(extension, force);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册