Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark _serviceBrand properties using declare #99312

Merged
merged 1 commit into from Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Expand Up @@ -95,7 +95,7 @@ class MainProcessService implements IMainProcessService {
private mainRouter: StaticRouter
) { }

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

getChannel(channelName: string): IChannel {
return this.server.getChannel(channelName, this.mainRouter);
Expand Down
2 changes: 1 addition & 1 deletion src/vs/code/electron-main/auth.ts
Expand Up @@ -23,7 +23,7 @@ type Credentials = {

export class ProxyAuthHandler extends Disposable {

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

private retryCount = 0;

Expand Down
4 changes: 2 additions & 2 deletions src/vs/editor/browser/core/keybindingCancellation.ts
Expand Up @@ -17,7 +17,7 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
const IEditorCancellationTokens = createDecorator<IEditorCancellationTokens>('IEditorCancelService');

interface IEditorCancellationTokens {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;
add(editor: ICodeEditor, cts: CancellationTokenSource): () => void;
cancel(editor: ICodeEditor): void;
}
Expand All @@ -26,7 +26,7 @@ const ctxCancellableOperation = new RawContextKey('cancellableOperation', false)

registerSingleton(IEditorCancellationTokens, class implements IEditorCancellationTokens {

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

private readonly _tokens = new WeakMap<ICodeEditor, { key: IContextKey<boolean>, tokens: LinkedList<CancellationTokenSource> }>();

Expand Down
Expand Up @@ -13,7 +13,7 @@ import { IResourceEditorInput } from 'vs/platform/editor/common/editor';

export abstract class AbstractCodeEditorService extends Disposable implements ICodeEditorService {

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For abstract classes, the abstract modifier makes more sense to me.


private readonly _onCodeEditorAdd: Emitter<ICodeEditor> = this._register(new Emitter<ICodeEditor>());
public readonly onCodeEditorAdd: Event<ICodeEditor> = this._onCodeEditorAdd.event;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/browser/services/bulkEditService.ts
Expand Up @@ -26,7 +26,7 @@ export interface IBulkEditResult {
export type IBulkEditPreviewHandler = (edit: WorkspaceEdit, options?: IBulkEditOptions) => Promise<WorkspaceEdit>;

export interface IBulkEditService {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;

hasPreviewHandler(): boolean;

Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/browser/services/codeEditorService.ts
Expand Up @@ -13,7 +13,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
export const ICodeEditorService = createDecorator<ICodeEditorService>('codeEditorService');

export interface ICodeEditorService {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;

readonly onCodeEditorAdd: Event<ICodeEditor>;
readonly onCodeEditorRemove: Event<ICodeEditor>;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/browser/services/openerService.ts
Expand Up @@ -85,7 +85,7 @@ class EditorOpener implements IOpener {

export class OpenerService implements IOpenerService {

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

private readonly _openers = new LinkedList<IOpener>();
private readonly _validators = new LinkedList<IValidator>();
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/common/services/editorWorkerService.ts
Expand Up @@ -19,7 +19,7 @@ export interface IDiffComputationResult {
}

export interface IEditorWorkerService {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;

canComputeDiff(original: URI, modified: URI): boolean;
computeDiff(original: URI, modified: URI, ignoreTrimWhitespace: boolean, maxComputationTime: number): Promise<IDiffComputationResult | null>;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/common/services/editorWorkerServiceImpl.ts
Expand Up @@ -46,7 +46,7 @@ function canSyncModel(modelService: IModelService, resource: URI): boolean {

export class EditorWorkerServiceImpl extends Disposable implements IEditorWorkerService {

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

private readonly _modelService: IModelService;
private readonly _workerManager: WorkerManager;
Expand Down
Expand Up @@ -70,7 +70,7 @@ class MarkerDecorations extends Disposable {

export class MarkerDecorationsService extends Disposable implements IMarkerDecorationsService {

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

private readonly _onDidChangeMarker = this._register(new Emitter<ITextModel>());
readonly onDidChangeMarker: Event<ITextModel> = this._onDidChangeMarker.event;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/common/services/markersDecorationService.ts
Expand Up @@ -12,7 +12,7 @@ import { Range } from 'vs/editor/common/core/range';
export const IMarkerDecorationsService = createDecorator<IMarkerDecorationsService>('markerDecorationsService');

export interface IMarkerDecorationsService {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;

onDidChangeMarker: Event<ITextModel>;

Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/common/services/modeService.ts
Expand Up @@ -28,7 +28,7 @@ export interface ILanguageSelection extends IDisposable {
}

export interface IModeService {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;

onDidCreateMode: Event<IMode>;
onLanguagesMaybeChanged: Event<void>;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/common/services/modelService.ts
Expand Up @@ -16,7 +16,7 @@ export const IModelService = createDecorator<IModelService>('modelService');
export type DocumentTokensProvider = DocumentSemanticTokensProvider | DocumentRangeSemanticTokensProvider;

export interface IModelService {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;

createModel(value: string | ITextBufferFactory, languageSelection: ILanguageSelection | null, resource?: URI, isForSimpleWidget?: boolean): ITextModel;

Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/common/services/resolverService.ts
Expand Up @@ -12,7 +12,7 @@ import { createDecorator } from 'vs/platform/instantiation/common/instantiation'
export const ITextModelService = createDecorator<ITextModelService>('textModelService');

export interface ITextModelService {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;

/**
* Provided a resource URI, it will return a model reference
Expand Down
Expand Up @@ -31,7 +31,7 @@ export interface ITextResourceConfigurationChangeEvent {

export interface ITextResourceConfigurationService {

_serviceBrand: undefined;
readonly _serviceBrand: undefined;

/**
* Event that fires when the configuration changes.
Expand Down Expand Up @@ -70,7 +70,7 @@ export const ITextResourcePropertiesService = createDecorator<ITextResourcePrope

export interface ITextResourcePropertiesService {

_serviceBrand: undefined;
readonly _serviceBrand: undefined;

/**
* Returns the End of Line characters for the given resource
Expand Down
4 changes: 2 additions & 2 deletions src/vs/editor/contrib/codelens/codeLensCache.ts
Expand Up @@ -17,7 +17,7 @@ import { once } from 'vs/base/common/functional';
export const ICodeLensCache = createDecorator<ICodeLensCache>('ICodeLensCache');

export interface ICodeLensCache {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;
put(model: ITextModel, data: CodeLensModel): void;
get(model: ITextModel): CodeLensModel | undefined;
delete(model: ITextModel): void;
Expand All @@ -38,7 +38,7 @@ class CacheItem {

export class CodeLensCache implements ICodeLensCache {

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

private readonly _fakeProvider = new class implements CodeLensProvider {
provideCodeLenses(): CodeLensList {
Expand Down
4 changes: 2 additions & 2 deletions src/vs/editor/contrib/gotoSymbol/symbolNavigation.ts
Expand Up @@ -26,15 +26,15 @@ export const ctxHasSymbols = new RawContextKey('hasSymbols', false);
export const ISymbolNavigationService = createDecorator<ISymbolNavigationService>('ISymbolNavigationService');

export interface ISymbolNavigationService {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;
reset(): void;
put(anchor: OneReference): void;
revealNext(source: ICodeEditor): Promise<any>;
}

class SymbolNavigationService implements ISymbolNavigationService {

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

private readonly _ctxHasSymbols: IContextKey<boolean>;

Expand Down
6 changes: 3 additions & 3 deletions src/vs/editor/contrib/peekView/peekView.ts
Expand Up @@ -30,12 +30,12 @@ import { Codicon } from 'vs/base/common/codicons';

export const IPeekViewService = createDecorator<IPeekViewService>('IPeekViewService');
export interface IPeekViewService {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;
addExclusiveWidget(editor: ICodeEditor, widget: PeekViewWidget): void;
}

registerSingleton(IPeekViewService, class implements IPeekViewService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

private readonly _widgets = new Map<ICodeEditor, { widget: PeekViewWidget, listener: IDisposable; }>();

Expand Down Expand Up @@ -103,7 +103,7 @@ const defaultOptions: IPeekViewOptions = {

export abstract class PeekViewWidget extends ZoneWidget {

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

private readonly _onDidClose = new Emitter<PeekViewWidget>();
readonly onDidClose = this._onDidClose.event;
Expand Down
Expand Up @@ -302,7 +302,7 @@ suite('Snippet Variables Resolver', function () {
let workspace: IWorkspace;
let resolver: VariableResolver;
const workspaceService = new class implements IWorkspaceContextService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
_throw = () => { throw new Error(); };
onDidChangeWorkbenchState = this._throw;
onDidChangeWorkspaceName = this._throw;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/contrib/suggest/suggestMemory.ts
Expand Up @@ -308,7 +308,7 @@ export class SuggestMemoryService implements ISuggestMemoryService {
export const ISuggestMemoryService = createDecorator<ISuggestMemoryService>('ISuggestMemories');

export interface ISuggestMemoryService {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;
memorize(model: ITextModel, pos: IPosition, item: CompletionItem): void;
select(model: ITextModel, pos: IPosition, items: CompletionItem[]): number;
}
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/contrib/suggest/test/suggestModel.test.ts
Expand Up @@ -51,7 +51,7 @@ function createMockEditor(model: TextModel): ITestCodeEditor {
[IStorageService, new InMemoryStorageService()],
[IKeybindingService, new MockKeybindingService()],
[ISuggestMemoryService, new class implements ISuggestMemoryService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
memorize(): void {
}
select(): number {
Expand Down
Expand Up @@ -52,7 +52,7 @@ export class EditorScopedQuickInputServiceImpl extends QuickInputService {

export class StandaloneQuickInputServiceImpl implements IQuickInputService {

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

private mapEditorToService = new Map<ICodeEditor, EditorScopedQuickInputServiceImpl>();
private get activeService(): IQuickInputService {
Expand Down
18 changes: 9 additions & 9 deletions src/vs/editor/standalone/browser/simpleServices.ts
Expand Up @@ -155,7 +155,7 @@ export class SimpleEditorModelResolverService implements ITextModelService {
}

export class SimpleEditorProgressService implements IEditorProgressService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

private static NULL_PROGRESS_RUNNER: IProgressRunner = {
done: () => { },
Expand Down Expand Up @@ -251,7 +251,7 @@ export class SimpleNotificationService implements INotificationService {
}

export class StandaloneCommandService implements ICommandService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

private readonly _instantiationService: IInstantiationService;

Expand Down Expand Up @@ -420,7 +420,7 @@ function isConfigurationOverrides(thing: any): thing is IConfigurationOverrides

export class SimpleConfigurationService implements IConfigurationService {

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

private readonly _onDidChangeConfiguration = new Emitter<IConfigurationChangeEvent>();
public readonly onDidChangeConfiguration: Event<IConfigurationChangeEvent> = this._onDidChangeConfiguration.event;
Expand Down Expand Up @@ -498,7 +498,7 @@ export class SimpleConfigurationService implements IConfigurationService {

export class SimpleResourceConfigurationService implements ITextResourceConfigurationService {

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

private readonly _onDidChangeConfiguration = new Emitter<ITextResourceConfigurationChangeEvent>();
public readonly onDidChangeConfiguration = this._onDidChangeConfiguration.event;
Expand Down Expand Up @@ -527,7 +527,7 @@ export class SimpleResourceConfigurationService implements ITextResourceConfigur

export class SimpleResourcePropertiesService implements ITextResourcePropertiesService {

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

constructor(
@IConfigurationService private readonly configurationService: IConfigurationService,
Expand All @@ -544,7 +544,7 @@ export class SimpleResourcePropertiesService implements ITextResourcePropertiesS
}

export class StandaloneTelemetryService implements ITelemetryService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

public isOptedIn = false;
public sendErrorTelemetry = false;
Expand Down Expand Up @@ -648,7 +648,7 @@ export function applyConfigurationValues(configurationService: IConfigurationSer
}

export class SimpleBulkEditService implements IBulkEditService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

constructor(private readonly _modelService: IModelService) {
//
Expand Down Expand Up @@ -703,7 +703,7 @@ export class SimpleBulkEditService implements IBulkEditService {

export class SimpleUriLabelService implements ILabelService {

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

public readonly onDidChangeFormatters: Event<IFormatterChangeEvent> = Event.None;

Expand Down Expand Up @@ -736,7 +736,7 @@ export class SimpleUriLabelService implements ILabelService {
}

export class SimpleLayoutService implements ILayoutService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

public onLayout = Event.None;

Expand Down
Expand Up @@ -172,7 +172,7 @@ function newBuiltInTheme(builtinTheme: BuiltinTheme): StandaloneTheme {

export class StandaloneThemeServiceImpl extends Disposable implements IStandaloneThemeService {

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

private readonly _onColorThemeChange = this._register(new Emitter<IStandaloneTheme>());
public readonly onDidColorThemeChange = this._onColorThemeChange.event;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/standalone/common/standaloneThemeService.ts
Expand Up @@ -26,7 +26,7 @@ export interface IStandaloneTheme extends IColorTheme {
}

export interface IStandaloneThemeService extends IThemeService {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;

setTheme(themeName: string): string;

Expand Down
Expand Up @@ -33,7 +33,7 @@ suite('TokenizationSupport2Adapter', () => {
}

class MockThemeService implements IStandaloneThemeService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
public setTheme(themeName: string): string {
throw new Error('Not implemented');
}
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/test/browser/editorTestServices.ts
Expand Up @@ -25,7 +25,7 @@ export class TestCodeEditorService extends AbstractCodeEditorService {
}

export class TestCommandService implements ICommandService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

private readonly _instantiationService: IInstantiationService;

Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/test/browser/services/openerService.test.ts
Expand Up @@ -16,7 +16,7 @@ suite('OpenerService', function () {
let lastCommand: { id: string; args: any[] } | undefined;

const commandService = new (class implements ICommandService {
_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;
onWillExecuteCommand = () => Disposable.None;
onDidExecuteCommand = () => Disposable.None;
executeCommand(id: string, ...args: any[]): Promise<any> {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/editor/test/common/services/modelService.test.ts
Expand Up @@ -442,7 +442,7 @@ assertComputeEdits(file1, file2);

export class TestTextResourcePropertiesService implements ITextResourcePropertiesService {

_serviceBrand: undefined;
declare readonly _serviceBrand: undefined;

constructor(
@IConfigurationService private readonly configurationService: IConfigurationService,
Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/accessibility/common/accessibility.ts
Expand Up @@ -10,7 +10,7 @@ import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
export const IAccessibilityService = createDecorator<IAccessibilityService>('accessibilityService');

export interface IAccessibilityService {
_serviceBrand: undefined;
readonly _serviceBrand: undefined;

readonly onDidChangeScreenReaderOptimized: Event<void>;

Expand Down