Skip to content

Commit d8e926b

Browse files
committed
Mark most private static constants as private static readonly
1 parent 6663fcd commit d8e926b

162 files changed

Lines changed: 365 additions & 365 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

extensions/git/src/autofetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { eventToPromise, filterEvent } from './util';
1212

1313
export class AutoFetcher {
1414

15-
private static Period = 3 * 60 * 1000 /* three minutes */;
15+
private static readonly Period = 3 * 60 * 1000 /* three minutes */;
1616

1717
private _onDidChange = new EventEmitter<boolean>();
1818
private onDidChange = this._onDidChange.event;

src/vs/base/browser/touch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ interface TouchEvent extends Event {
6767

6868
export class Gesture implements IDisposable {
6969

70-
private static HOLD_DELAY = 700;
71-
private static SCROLL_FRICTION = -0.005;
70+
private static readonly HOLD_DELAY = 700;
71+
private static readonly SCROLL_FRICTION = -0.005;
7272

7373
private targetElement: HTMLElement;
7474
private callOnTarget: IDisposable[];

src/vs/base/browser/ui/contextview/contextview.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ function layout(view: ISize, around: IView, viewport: IView, anchorPosition: Anc
104104

105105
export class ContextView {
106106

107-
private static BUBBLE_UP_EVENTS = ['click', 'keydown', 'focus', 'blur'];
108-
private static BUBBLE_DOWN_EVENTS = ['click'];
107+
private static readonly BUBBLE_UP_EVENTS = ['click', 'keydown', 'focus', 'blur'];
108+
private static readonly BUBBLE_DOWN_EVENTS = ['click'];
109109

110110
private $container: Builder;
111111
private $view: Builder;

src/vs/base/browser/ui/resourceviewer/resourceViewer.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ function imageSrc(descriptor: IResourceDescriptor): string {
110110
*/
111111
export class ResourceViewer {
112112

113-
private static KB = 1024;
114-
private static MB = ResourceViewer.KB * ResourceViewer.KB;
115-
private static GB = ResourceViewer.MB * ResourceViewer.KB;
116-
private static TB = ResourceViewer.GB * ResourceViewer.KB;
113+
private static readonly KB = 1024;
114+
private static readonly MB = ResourceViewer.KB * ResourceViewer.KB;
115+
private static readonly GB = ResourceViewer.MB * ResourceViewer.KB;
116+
private static readonly TB = ResourceViewer.GB * ResourceViewer.KB;
117117

118-
private static MAX_IMAGE_SIZE = ResourceViewer.MB; // showing images inline is memory intense, so we have a limit
118+
private static readonly MAX_IMAGE_SIZE = ResourceViewer.MB; // showing images inline is memory intense, so we have a limit
119119

120120
public static show(
121121
descriptor: IResourceDescriptor,

src/vs/base/browser/ui/splitview/panelview.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export interface IPanelStyles {
3232

3333
export abstract class Panel implements IView {
3434

35-
private static HEADER_SIZE = 22;
35+
private static readonly HEADER_SIZE = 22;
3636

3737
protected _expanded: boolean;
3838
private expandedSize: number | undefined = undefined;
@@ -226,7 +226,7 @@ interface IDndContext {
226226

227227
class PanelDraggable implements IDisposable {
228228

229-
private static DefaultDragOverBackgroundColor = new Color(new RGBA(128, 128, 128, 0.5));
229+
private static readonly DefaultDragOverBackgroundColor = new Color(new RGBA(128, 128, 128, 0.5));
230230

231231
// see https://github.com/Microsoft/vscode/issues/14470
232232
private dragOverCounter = 0;

src/vs/base/common/event.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export interface EmitterOptions {
5757
*/
5858
export class Emitter<T> {
5959

60-
private static _noop = function () { };
60+
private static readonly _noop = function () { };
6161

6262
private _event: Event<T>;
6363
private _listeners: LinkedList<Listener>;

src/vs/base/common/map.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ export class StringIterator implements IKeyIterator {
7878

7979
export class PathIterator implements IKeyIterator {
8080

81-
private static _fwd = '/'.charCodeAt(0);
82-
private static _bwd = '\\'.charCodeAt(0);
81+
private static readonly _fwd = '/'.charCodeAt(0);
82+
private static readonly _bwd = '\\'.charCodeAt(0);
8383

8484
private _value: string;
8585
private _from: number;

src/vs/base/common/uuid.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ class ValueUUID implements UUID {
2828

2929
class V4UUID extends ValueUUID {
3030

31-
private static _chars = ['0', '1', '2', '3', '4', '5', '6', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
31+
private static readonly _chars = ['0', '1', '2', '3', '4', '5', '6', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
3232

33-
private static _timeHighBits = ['8', '9', 'a', 'b'];
33+
private static readonly _timeHighBits = ['8', '9', 'a', 'b'];
3434

3535
private static _oneOf(array: string[]): string {
3636
return array[Math.floor(array.length * Math.random())];

src/vs/base/node/processes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ export abstract class AbstractProcess<TProgressData> {
275275
// Default is to do nothing.
276276
}
277277

278-
private static regexp = /^[^"].* .*[^"]/;
278+
private static readonly regexp = /^[^"].* .*[^"]/;
279279
private ensureQuotes(value: string) {
280280
if (AbstractProcess.regexp.test(value)) {
281281
return {

src/vs/base/parts/ipc/node/ipc.net.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function generateRandomPipeName(): string {
2525

2626
export class Protocol implements IMessagePassingProtocol {
2727

28-
private static _headerLen = 17;
28+
private static readonly _headerLen = 17;
2929

3030
private _onMessage = new Emitter<any>();
3131

0 commit comments

Comments
 (0)