Skip to content

Commit

Permalink
debt: review implicit public fields that are actually protected (#166603
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Nov 23, 2022
1 parent 914ec50 commit 59f5d55
Show file tree
Hide file tree
Showing 22 changed files with 208 additions and 226 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export abstract class AbstractEditorNavigationQuickAccessProvider implements IQu

private rangeHighlightDecorationId: IEditorLineDecoration | undefined = undefined;

protected addDecorations(editor: IEditor, range: IRange): void {
addDecorations(editor: IEditor, range: IRange): void {
editor.changeDecorations(changeAccessor => {

// Reset old decorations if any
Expand Down Expand Up @@ -220,7 +220,7 @@ export abstract class AbstractEditorNavigationQuickAccessProvider implements IQu
});
}

protected clearDecorations(editor: IEditor): void {
clearDecorations(editor: IEditor): void {
const rangeHighlightDecorationId = this.rangeHighlightDecorationId;
if (rangeHighlightDecorationId) {
editor.changeDecorations(changeAccessor => {
Expand Down
128 changes: 64 additions & 64 deletions src/vs/platform/backup/test/electron-main/backupMainService.test.ts

Large diffs are not rendered by default.

54 changes: 25 additions & 29 deletions src/vs/platform/files/test/node/parcelWatcher.integrationTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { isLinux, isMacintosh, isWindows } from 'vs/base/common/platform';
import { Promises, RimRafMode } from 'vs/base/node/pfs';
import { flakySuite, getPathFromAmdModule, getRandomTestPath } from 'vs/base/test/node/testUtils';
import { FileChangeType } from 'vs/platform/files/common/files';
import { IParcelWatcherInstance, ParcelWatcher } from 'vs/platform/files/node/watcher/parcel/parcelWatcher';
import { ParcelWatcher } from 'vs/platform/files/node/watcher/parcel/parcelWatcher';
import { IRecursiveWatchRequest } from 'vs/platform/files/common/watcher';
import { getDriveLetter } from 'vs/base/common/extpath';
import { ltrim } from 'vs/base/common/strings';
Expand Down Expand Up @@ -47,13 +47,9 @@ import { ltrim } from 'vs/base/common/strings';
}
}

override toExcludePaths(path: string, excludes: string[] | undefined): string[] | undefined {
testToExcludePaths(path: string, excludes: string[] | undefined): string[] | undefined {
return super.toExcludePaths(path, excludes);
}

override restartWatching(watcher: IParcelWatcherInstance, delay = 10): void {
return super.restartWatching(watcher, delay);
}
}

let testDir: string;
Expand Down Expand Up @@ -573,39 +569,39 @@ import { ltrim } from 'vs/base/common/strings';

// undefined / empty

assert.strictEqual(watcher.toExcludePaths(testDir, undefined), undefined);
assert.strictEqual(watcher.toExcludePaths(testDir, []), undefined);
assert.strictEqual(watcher.testToExcludePaths(testDir, undefined), undefined);
assert.strictEqual(watcher.testToExcludePaths(testDir, []), undefined);

// absolute paths

let excludes = watcher.toExcludePaths(testDir, [testDir]);
let excludes = watcher.testToExcludePaths(testDir, [testDir]);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], testDir);

excludes = watcher.toExcludePaths(testDir, [`${testDir}${sep}`, join(testDir, 'foo', 'bar'), `${join(testDir, 'other', 'deep')}${sep}`]);
excludes = watcher.testToExcludePaths(testDir, [`${testDir}${sep}`, join(testDir, 'foo', 'bar'), `${join(testDir, 'other', 'deep')}${sep}`]);
assert.strictEqual(excludes?.length, 3);
assert.strictEqual(excludes[0], testDir);
assert.strictEqual(excludes[1], join(testDir, 'foo', 'bar'));
assert.strictEqual(excludes[2], join(testDir, 'other', 'deep'));

// wrong casing is normalized for root
if (!isLinux) {
excludes = watcher.toExcludePaths(testDir, [join(testDir.toUpperCase(), 'node_modules', '**')]);
excludes = watcher.testToExcludePaths(testDir, [join(testDir.toUpperCase(), 'node_modules', '**')]);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], join(testDir, 'node_modules'));
}

// exclude ignored if not parent of watched dir
excludes = watcher.toExcludePaths(testDir, [join(dirname(testDir), 'node_modules', '**')]);
excludes = watcher.testToExcludePaths(testDir, [join(dirname(testDir), 'node_modules', '**')]);
assert.strictEqual(excludes, undefined);

// relative paths

excludes = watcher.toExcludePaths(testDir, ['.']);
excludes = watcher.testToExcludePaths(testDir, ['.']);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], testDir);

excludes = watcher.toExcludePaths(testDir, ['foo', `bar${sep}`, join('foo', 'bar'), `${join('other', 'deep')}${sep}`]);
excludes = watcher.testToExcludePaths(testDir, ['foo', `bar${sep}`, join('foo', 'bar'), `${join('other', 'deep')}${sep}`]);
assert.strictEqual(excludes?.length, 4);
assert.strictEqual(excludes[0], join(testDir, 'foo'));
assert.strictEqual(excludes[1], join(testDir, 'bar'));
Expand All @@ -614,69 +610,69 @@ import { ltrim } from 'vs/base/common/strings';

// simple globs (relative)

excludes = watcher.toExcludePaths(testDir, ['**']);
excludes = watcher.testToExcludePaths(testDir, ['**']);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], testDir);

excludes = watcher.toExcludePaths(testDir, ['**/**']);
excludes = watcher.testToExcludePaths(testDir, ['**/**']);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], testDir);

excludes = watcher.toExcludePaths(testDir, ['**\\**']);
excludes = watcher.testToExcludePaths(testDir, ['**\\**']);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], testDir);

excludes = watcher.toExcludePaths(testDir, ['**/node_modules/**']);
excludes = watcher.testToExcludePaths(testDir, ['**/node_modules/**']);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], join(testDir, 'node_modules'));

excludes = watcher.toExcludePaths(testDir, ['**/.git/objects/**']);
excludes = watcher.testToExcludePaths(testDir, ['**/.git/objects/**']);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], join(testDir, '.git', 'objects'));

excludes = watcher.toExcludePaths(testDir, ['**/node_modules']);
excludes = watcher.testToExcludePaths(testDir, ['**/node_modules']);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], join(testDir, 'node_modules'));

excludes = watcher.toExcludePaths(testDir, ['**/.git/objects']);
excludes = watcher.testToExcludePaths(testDir, ['**/.git/objects']);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], join(testDir, '.git', 'objects'));

excludes = watcher.toExcludePaths(testDir, ['node_modules/**']);
excludes = watcher.testToExcludePaths(testDir, ['node_modules/**']);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], join(testDir, 'node_modules'));

excludes = watcher.toExcludePaths(testDir, ['.git/objects/**']);
excludes = watcher.testToExcludePaths(testDir, ['.git/objects/**']);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], join(testDir, '.git', 'objects'));

// simple globs (absolute)

excludes = watcher.toExcludePaths(testDir, [join(testDir, 'node_modules', '**')]);
excludes = watcher.testToExcludePaths(testDir, [join(testDir, 'node_modules', '**')]);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], join(testDir, 'node_modules'));

// Linux: more restrictive glob treatment
if (isLinux) {
excludes = watcher.toExcludePaths(testDir, ['**/node_modules/*/**']);
excludes = watcher.testToExcludePaths(testDir, ['**/node_modules/*/**']);
assert.strictEqual(excludes?.length, 1);
assert.strictEqual(excludes[0], join(testDir, 'node_modules'));
}

// unsupported globs

else {
excludes = watcher.toExcludePaths(testDir, ['**/node_modules/*/**']);
excludes = watcher.testToExcludePaths(testDir, ['**/node_modules/*/**']);
assert.strictEqual(excludes, undefined);
}

excludes = watcher.toExcludePaths(testDir, ['**/*.js']);
excludes = watcher.testToExcludePaths(testDir, ['**/*.js']);
assert.strictEqual(excludes, undefined);

excludes = watcher.toExcludePaths(testDir, ['*.js']);
excludes = watcher.testToExcludePaths(testDir, ['*.js']);
assert.strictEqual(excludes, undefined);

excludes = watcher.toExcludePaths(testDir, ['*']);
excludes = watcher.testToExcludePaths(testDir, ['*']);
assert.strictEqual(excludes, undefined);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import { localize } from 'vs/nls';
import { IKeyMods, IQuickPickSeparator, IQuickInputService, IQuickPick } from 'vs/platform/quickinput/common/quickInput';
import { IEditor } from 'vs/editor/common/editorCommon';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IRange } from 'vs/editor/common/core/range';
import { Registry } from 'vs/platform/registry/common/platform';
Expand Down Expand Up @@ -119,14 +118,6 @@ export class GotoSymbolQuickAccessProvider extends AbstractGotoSymbolQuickAccess
return this.doGetSymbolPicks(this.getDocumentSymbols(model, token), prepareQuery(filter), options, token);
}

override addDecorations(editor: IEditor, range: IRange): void {
super.addDecorations(editor, range);
}

override clearDecorations(editor: IEditor): void {
super.clearDecorations(editor);
}

//#endregion

protected override provideWithoutTextEditor(picker: IQuickPick<IGotoSymbolQuickPickItem>): IDisposable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ suite('EditorGroupsService', () => {

assert.strictEqual(part.groups.length, 3);

part.saveState();
part.testSaveState();
part.dispose();

const [restoredPart] = await createPart(instantiationService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ suite('EditorsObserver', function () {
assert.strictEqual(observer.hasEditor({ resource: input2.resource, typeId: input2.typeId, editorId: input2.editorId }), true);
assert.strictEqual(observer.hasEditor({ resource: input3.resource, typeId: input3.typeId, editorId: input3.editorId }), true);

storage.emitWillSaveState(WillSaveStateReason.SHUTDOWN);
storage.testEmitWillSaveState(WillSaveStateReason.SHUTDOWN);

const restoredObserver = disposables.add(new EditorsObserver(part, storage));
await part.whenReady;
Expand Down Expand Up @@ -424,7 +424,7 @@ suite('EditorsObserver', function () {
assert.strictEqual(observer.hasEditor({ resource: input2.resource, typeId: input2.typeId, editorId: input2.editorId }), true);
assert.strictEqual(observer.hasEditor({ resource: input3.resource, typeId: input3.typeId, editorId: input3.editorId }), true);

storage.emitWillSaveState(WillSaveStateReason.SHUTDOWN);
storage.testEmitWillSaveState(WillSaveStateReason.SHUTDOWN);

const restoredObserver = disposables.add(new EditorsObserver(part, storage));
await part.whenReady;
Expand Down Expand Up @@ -461,7 +461,7 @@ suite('EditorsObserver', function () {
assert.strictEqual(currentEditorsMRU[0].editor, input1);
assert.strictEqual(observer.hasEditor({ resource: input1.resource, typeId: input1.typeId, editorId: input1.editorId }), true);

storage.emitWillSaveState(WillSaveStateReason.SHUTDOWN);
storage.testEmitWillSaveState(WillSaveStateReason.SHUTDOWN);

const restoredObserver = disposables.add(new EditorsObserver(part, storage));
await part.whenReady;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ suite('Lifecycleservice', function () {

class TestLifecycleService extends NativeLifecycleService {

override handleBeforeShutdown(reason: ShutdownReason): Promise<boolean> {
testHandleBeforeShutdown(reason: ShutdownReason): Promise<boolean> {
return super.handleBeforeShutdown(reason);
}

override handleWillShutdown(reason: ShutdownReason): Promise<void> {
testHandleWillShutdown(reason: ShutdownReason): Promise<void> {
return super.handleWillShutdown(reason);
}
}
Expand Down Expand Up @@ -62,7 +62,7 @@ suite('Lifecycleservice', function () {
}, 'test');
});

const veto = await lifecycleService.handleBeforeShutdown(ShutdownReason.QUIT);
const veto = await lifecycleService.testHandleBeforeShutdown(ShutdownReason.QUIT);

assert.strictEqual(veto, true);
assert.strictEqual(vetoCalled, true);
Expand Down Expand Up @@ -93,7 +93,7 @@ suite('Lifecycleservice', function () {
}, 'test');
});

const veto = await lifecycleService.handleBeforeShutdown(ShutdownReason.QUIT);
const veto = await lifecycleService.testHandleBeforeShutdown(ShutdownReason.QUIT);

assert.strictEqual(veto, true);
assert.strictEqual(vetoCalled, true);
Expand All @@ -107,7 +107,7 @@ suite('Lifecycleservice', function () {
}), 'test');
});

const veto = await lifecycleService.handleBeforeShutdown(ShutdownReason.QUIT);
const veto = await lifecycleService.testHandleBeforeShutdown(ShutdownReason.QUIT);

assert.strictEqual(veto, true);
});
Expand All @@ -119,7 +119,7 @@ suite('Lifecycleservice', function () {
}), 'test');
});

const veto = await lifecycleService.handleBeforeShutdown(ShutdownReason.QUIT);
const veto = await lifecycleService.testHandleBeforeShutdown(ShutdownReason.QUIT);

assert.strictEqual(veto, true);
});
Expand All @@ -135,7 +135,7 @@ suite('Lifecycleservice', function () {
}), { id: 'test', label: 'test' });
});

await lifecycleService.handleWillShutdown(ShutdownReason.QUIT);
await lifecycleService.testHandleWillShutdown(ShutdownReason.QUIT);

assert.strictEqual(joinCalled, true);
});
Expand All @@ -151,7 +151,7 @@ suite('Lifecycleservice', function () {
}), { id: 'test', label: 'test' });
});

await lifecycleService.handleWillShutdown(ShutdownReason.QUIT);
await lifecycleService.testHandleWillShutdown(ShutdownReason.QUIT);

assert.strictEqual(joinCalled, true);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ suite('Progress Indicator', () => {
const testProgressBar = new TestProgressBar();
const progressScope = new class extends AbstractProgressScope {
constructor() { super('test.scopeId', true); }
override onScopeOpened(scopeId: string) { super.onScopeOpened(scopeId); }
override onScopeClosed(scopeId: string): void { super.onScopeClosed(scopeId); }
testOnScopeOpened(scopeId: string) { super.onScopeOpened(scopeId); }
testOnScopeClosed(scopeId: string): void { super.onScopeClosed(scopeId); }
}();
const testObject = new ScopedProgressIndicator((<any>testProgressBar), progressScope);

Expand All @@ -90,31 +90,31 @@ suite('Progress Indicator', () => {
assert.strictEqual(true, testProgressBar.fDone);

// Inactive: Show (Infinite)
progressScope.onScopeClosed('test.scopeId');
progressScope.testOnScopeClosed('test.scopeId');
testObject.show(true);
assert.strictEqual(false, !!testProgressBar.fInfinite);
progressScope.onScopeOpened('test.scopeId');
progressScope.testOnScopeOpened('test.scopeId');
assert.strictEqual(true, testProgressBar.fInfinite);

// Inactive: Show (Total / Worked)
progressScope.onScopeClosed('test.scopeId');
progressScope.testOnScopeClosed('test.scopeId');
fn = testObject.show(100);
fn.total(80);
fn.worked(20);
assert.strictEqual(false, !!testProgressBar.fTotal);
progressScope.onScopeOpened('test.scopeId');
progressScope.testOnScopeOpened('test.scopeId');
assert.strictEqual(20, testProgressBar.fWorked);
assert.strictEqual(80, testProgressBar.fTotal);

// Acive: Show While
let p = Promise.resolve(null);
await testObject.showWhile(p);
assert.strictEqual(true, testProgressBar.fDone);
progressScope.onScopeClosed('test.scopeId');
progressScope.testOnScopeClosed('test.scopeId');
p = Promise.resolve(null);
await testObject.showWhile(p);
assert.strictEqual(true, testProgressBar.fDone);
progressScope.onScopeOpened('test.scopeId');
progressScope.testOnScopeOpened('test.scopeId');
assert.strictEqual(true, testProgressBar.fDone);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE
this.mapResourceToModelListeners.set(model.resource, modelListeners);
}

protected add(resource: URI, model: TextFileEditorModel): void {
add(resource: URI, model: TextFileEditorModel): void {
const knownModel = this.mapResourceToModel.get(resource);
if (knownModel === model) {
return; // already cached
Expand All @@ -508,7 +508,7 @@ export class TextFileEditorModelManager extends Disposable implements ITextFileE
this.mapResourceToDisposeListener.set(resource, model.onWillDispose(() => this.remove(resource)));
}

protected remove(resource: URI): void {
remove(resource: URI): void {
const removed = this.mapResourceToModel.delete(resource);

const disposeListener = this.mapResourceToDisposeListener.get(resource);
Expand Down
Loading

0 comments on commit 59f5d55

Please sign in to comment.