mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-03 15:01:57 +01:00
Adopt prefer-readonly in JS/TS extension (#165089)
This commit is contained in:
@@ -16,10 +16,11 @@ export interface IExperimentationTelemetryReporter extends tas.IExperimentationT
|
||||
* but will only do so when passed to an {@link ExperimentationService}.
|
||||
*/
|
||||
|
||||
export class ExperimentationTelemetryReporter
|
||||
implements IExperimentationTelemetryReporter {
|
||||
export class ExperimentationTelemetryReporter implements IExperimentationTelemetryReporter {
|
||||
|
||||
private _sharedProperties: Record<string, string> = {};
|
||||
private _reporter: VsCodeTelemetryReporter;
|
||||
private readonly _reporter: VsCodeTelemetryReporter;
|
||||
|
||||
constructor(reporter: VsCodeTelemetryReporter) {
|
||||
this._reporter = reporter;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ interface ExperimentTypes {
|
||||
}
|
||||
|
||||
export class ExperimentationService {
|
||||
private _experimentationServicePromise: Promise<tas.IExperimentationService>;
|
||||
private _telemetryReporter: IExperimentationTelemetryReporter;
|
||||
private readonly _experimentationServicePromise: Promise<tas.IExperimentationService>;
|
||||
private readonly _telemetryReporter: IExperimentationTelemetryReporter;
|
||||
|
||||
constructor(telemetryReporter: IExperimentationTelemetryReporter, id: string, version: string, globalState: vscode.Memento) {
|
||||
this._telemetryReporter = telemetryReporter;
|
||||
|
||||
@@ -36,7 +36,7 @@ export abstract class TypeScriptBaseCodeLensProvider implements vscode.CodeLensP
|
||||
|
||||
public constructor(
|
||||
protected client: ITypeScriptServiceClient,
|
||||
private cachedResponse: CachedResponse<Proto.NavTreeResponse>
|
||||
private readonly cachedResponse: CachedResponse<Proto.NavTreeResponse>
|
||||
) { }
|
||||
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class TypeScriptDocumentSymbolProvider implements vscode.DocumentSymbolProvider
|
||||
|
||||
public constructor(
|
||||
private readonly client: ITypeScriptServiceClient,
|
||||
private cachedResponse: CachedResponse<Proto.NavTreeResponse>,
|
||||
private readonly cachedResponse: CachedResponse<Proto.NavTreeResponse>,
|
||||
) { }
|
||||
|
||||
public async provideDocumentSymbols(document: vscode.TextDocument, token: vscode.CancellationToken): Promise<vscode.DocumentSymbol[] | undefined> {
|
||||
|
||||
@@ -185,7 +185,7 @@ class SourceAddMissingImports extends SourceAction {
|
||||
|
||||
class TypeScriptAutoFixProvider implements vscode.CodeActionProvider {
|
||||
|
||||
private static kindProviders = [
|
||||
private static readonly kindProviders = [
|
||||
SourceFixAll,
|
||||
SourceRemoveUnused,
|
||||
SourceAddMissingImports,
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as ts from 'typescript/lib/tsserverlibrary';
|
||||
export = ts.server.protocol;
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ export class WorkerServerProcess implements TsServerProcess {
|
||||
]);
|
||||
}
|
||||
|
||||
private _onDataHandlers = new Set<(data: Proto.Response) => void>();
|
||||
private _onErrorHandlers = new Set<(err: Error) => void>();
|
||||
private _onExitHandlers = new Set<(code: number | null, signal: string | null) => void>();
|
||||
private readonly _onDataHandlers = new Set<(data: Proto.Response) => void>();
|
||||
private readonly _onErrorHandlers = new Set<(err: Error) => void>();
|
||||
private readonly _onExitHandlers = new Set<(code: number | null, signal: string | null) => void>();
|
||||
|
||||
public constructor(
|
||||
private readonly worker: Worker,
|
||||
|
||||
@@ -99,9 +99,9 @@ export default class TypeScriptServiceClient extends Disposable implements IType
|
||||
|
||||
private readonly workspaceState: vscode.Memento;
|
||||
|
||||
private _onReady?: { promise: Promise<void>; resolve: () => void; reject: () => void };
|
||||
private readonly _onReady?: { promise: Promise<void>; resolve: () => void; reject: () => void };
|
||||
private _configuration: TypeScriptServiceConfiguration;
|
||||
private pluginPathsProvider: TypeScriptPluginPathsProvider;
|
||||
private readonly pluginPathsProvider: TypeScriptPluginPathsProvider;
|
||||
private readonly _versionManager: TypeScriptVersionManager;
|
||||
|
||||
private readonly logger = new Logger();
|
||||
|
||||
@@ -50,7 +50,9 @@ export class CreateNewJSFileCommand {
|
||||
public static readonly id = 'javascript-walkthrough.commands.createJsFile';
|
||||
public readonly id = CreateNewJSFileCommand.id;
|
||||
|
||||
constructor(private walkthroughState: JsWalkthroughState) { }
|
||||
constructor(
|
||||
private readonly walkthroughState: JsWalkthroughState
|
||||
) { }
|
||||
|
||||
public execute() {
|
||||
createNewJSFile(this.walkthroughState);
|
||||
@@ -61,7 +63,9 @@ export class DebugJsFileCommand {
|
||||
public static readonly id = 'javascript-walkthrough.commands.debugJsFile';
|
||||
public readonly id = DebugJsFileCommand.id;
|
||||
|
||||
constructor(private walkthroughState: JsWalkthroughState) { }
|
||||
constructor(
|
||||
private readonly walkthroughState: JsWalkthroughState
|
||||
) { }
|
||||
|
||||
public execute() {
|
||||
debugJsFile(this.walkthroughState);
|
||||
|
||||
Reference in New Issue
Block a user