Skip to content

Commit f493f68

Browse files
committed
mark private properties that are used in tests as public
We have tests that use any-casts to make private properties accessible (in an untyped way). This fails when private property names are mangled and therefore they should be marked as public
1 parent 15cb324 commit f493f68

File tree

12 files changed

+19
-17
lines changed

12 files changed

+19
-17
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ export class SplitView<TLayoutContext = undefined> extends Disposable {
414414
private contentSize = 0;
415415
private proportions: undefined | number[] = undefined;
416416
private viewItems: ViewItem<TLayoutContext>[] = [];
417-
private sashItems: ISashItem[] = [];
417+
sashItems: ISashItem[] = []; // used in tests
418418
private sashDragState: ISashDragState | undefined;
419419
private state: State = State.Idle;
420420
private inverseAltBehavior: boolean;

src/vs/base/parts/quickinput/browser/quickInput.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ class QuickPick<T extends IQuickPickItem> extends QuickInput implements IQuickPi
540540
return this._items;
541541
}
542542

543-
private get scrollTop() {
543+
get scrollTop() {
544544
return this.ui.list.scrollTop;
545545
}
546546

src/vs/base/parts/quickinput/common/quickInput.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ export interface IQuickPick<T extends IQuickPickItem> extends IQuickInput {
295295

296296
items: ReadonlyArray<T | IQuickPickSeparator>;
297297

298+
scrollTop: number; // used in tests
299+
298300
canSelectMany: boolean;
299301

300302
matchOnDescription: boolean;

src/vs/base/parts/quickinput/test/browser/quickinput.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ suite('QuickInput', () => { // https://github.com/microsoft/vscode/issues/147543
2929
let fixture: HTMLElement, controller: QuickInputController, quickpick: IQuickPick<IQuickPickItem>;
3030

3131
function getScrollTop(): number {
32-
return (quickpick as any).scrollTop;
32+
return quickpick.scrollTop;
3333
}
3434

3535
setup(() => {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class TestView implements IView<number> {
6262
}
6363

6464
function getSashes(splitview: SplitView): Sash[] {
65-
return (splitview as any).sashItems.map((i: any) => i.sash) as Sash[];
65+
return splitview.sashItems.map((i: any) => i.sash) as Sash[];
6666
}
6767

6868
suite('Splitview', () => {

src/vs/editor/common/model/textModel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ const enum StringOffsetValidationType {
172172

173173
export class TextModel extends Disposable implements model.ITextModel, IDecorationsTreesHost {
174174

175-
private static readonly MODEL_SYNC_LIMIT = 50 * 1024 * 1024; // 50 MB
175+
static _MODEL_SYNC_LIMIT = 50 * 1024 * 1024; // 50 MB, // used in tests
176176
private static readonly LARGE_FILE_SIZE_THRESHOLD = 20 * 1024 * 1024; // 20 MB;
177177
private static readonly LARGE_FILE_LINE_COUNT_THRESHOLD = 300 * 1000; // 300K lines
178178

@@ -346,7 +346,7 @@ export class TextModel extends Disposable implements model.ITextModel, IDecorati
346346
this._isTooLargeForTokenization = false;
347347
}
348348

349-
this._isTooLargeForSyncing = (bufferTextLength > TextModel.MODEL_SYNC_LIMIT);
349+
this._isTooLargeForSyncing = (bufferTextLength > TextModel._MODEL_SYNC_LIMIT);
350350

351351
this._versionId = 1;
352352
this._alternativeVersionId = 1;

src/vs/workbench/api/test/browser/mainThreadDocumentsAndEditors.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ suite('MainThreadDocumentsAndEditors', () => {
145145

146146
test('ignore huge model', function () {
147147

148-
const oldLimit = (<any>TextModel).MODEL_SYNC_LIMIT;
148+
const oldLimit = TextModel._MODEL_SYNC_LIMIT;
149149
try {
150150
const largeModelString = 'abc'.repeat(1024);
151-
(<any>TextModel).MODEL_SYNC_LIMIT = largeModelString.length / 2;
151+
TextModel._MODEL_SYNC_LIMIT = largeModelString.length / 2;
152152

153153
const model = modelService.createModel(largeModelString, null);
154154
assert.ok(model.isTooLargeForSyncing());
@@ -162,16 +162,16 @@ suite('MainThreadDocumentsAndEditors', () => {
162162
assert.strictEqual(delta.removedEditors, undefined);
163163

164164
} finally {
165-
(<any>TextModel).MODEL_SYNC_LIMIT = oldLimit;
165+
TextModel._MODEL_SYNC_LIMIT = oldLimit;
166166
}
167167
});
168168

169169
test('ignore huge model from editor', function () {
170170

171-
const oldLimit = (<any>TextModel).MODEL_SYNC_LIMIT;
171+
const oldLimit = TextModel._MODEL_SYNC_LIMIT;
172172
try {
173173
const largeModelString = 'abc'.repeat(1024);
174-
(<any>TextModel).MODEL_SYNC_LIMIT = largeModelString.length / 2;
174+
TextModel._MODEL_SYNC_LIMIT = largeModelString.length / 2;
175175

176176
const model = modelService.createModel(largeModelString, null);
177177
const editor = myCreateTestCodeEditor(model);
@@ -182,7 +182,7 @@ suite('MainThreadDocumentsAndEditors', () => {
182182
editor.dispose();
183183

184184
} finally {
185-
(<any>TextModel).MODEL_SYNC_LIMIT = oldLimit;
185+
TextModel._MODEL_SYNC_LIMIT = oldLimit;
186186
}
187187
});
188188

src/vs/workbench/contrib/debug/browser/debugSession.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/b
4242
export class DebugSession implements IDebugSession {
4343

4444
private _subId: string | undefined;
45-
raw: RawDebugSession | undefined; // made public because tests assume this exists
45+
raw: RawDebugSession | undefined; // used in tests
4646
private initialized = false;
4747
private _options: IDebugSessionOptions;
4848

src/vs/workbench/contrib/files/common/explorerModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class ExplorerModel implements IDisposable {
8383
}
8484

8585
export class ExplorerItem {
86-
protected _isDirectoryResolved: boolean;
86+
_isDirectoryResolved: boolean; // used in tests
8787
public isError = false;
8888
private _isExcluded = false;
8989

src/vs/workbench/contrib/files/test/browser/explorerModel.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ suite('Files - View Model', function () {
265265
const child = new ExplorerItem(URI.file(join('C:\\', '/path/to/foo.html')), fileService, configService, undefined, true, false, false, 'foo.html', Date.now());
266266
merge2.removeChild(child);
267267
merge2.addChild(child);
268-
(<any>merge2)._isDirectoryResolved = true;
268+
merge2._isDirectoryResolved = true;
269269
ExplorerItem.mergeLocalWithDisk(merge2, merge1);
270270
assert.strictEqual(merge1.getChild('foo.html')!.name, 'foo.html');
271271
assert.deepStrictEqual(merge1.getChild('foo.html')!.parent, merge1, 'Check parent');

0 commit comments

Comments
 (0)