Convert a lot of top level consts to const enums
This commit is contained in:
@@ -10,8 +10,10 @@ import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
||||
import { IBufferService, ILogService, IOptionsService, type IBufferResizeEvent } from 'common/services/Services';
|
||||
import { Emitter } from 'common/Event';
|
||||
|
||||
export const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars
|
||||
export const MINIMUM_ROWS = 1;
|
||||
export const enum BufferServiceConstants {
|
||||
MINIMUM_COLS = 2, // Less than 2 can mess with wide chars
|
||||
MINIMUM_ROWS = 1
|
||||
}
|
||||
|
||||
export class BufferService extends Disposable implements IBufferService {
|
||||
public serviceBrand: any;
|
||||
@@ -37,8 +39,8 @@ export class BufferService extends Disposable implements IBufferService {
|
||||
@ILogService logService: ILogService
|
||||
) {
|
||||
super();
|
||||
this.cols = Math.max(optionsService.rawOptions.cols || 0, MINIMUM_COLS);
|
||||
this.rows = Math.max(optionsService.rawOptions.rows || 0, MINIMUM_ROWS);
|
||||
this.cols = Math.max(optionsService.rawOptions.cols || 0, BufferServiceConstants.MINIMUM_COLS);
|
||||
this.rows = Math.max(optionsService.rawOptions.rows || 0, BufferServiceConstants.MINIMUM_ROWS);
|
||||
this.buffers = this._register(new BufferSet(optionsService, this, logService));
|
||||
this._register(this.buffers.onBufferActivate(e => {
|
||||
this._onScroll.fire(e.activeBuffer.ydisp);
|
||||
|
||||
@@ -11,13 +11,15 @@
|
||||
|
||||
import { IServiceIdentifier } from 'common/services/Services';
|
||||
|
||||
const DI_TARGET = 'di$target';
|
||||
const DI_DEPENDENCIES = 'di$dependencies';
|
||||
const enum Constants {
|
||||
DI_TARGET = 'di$target',
|
||||
DI_DEPENDENCIES = 'di$dependencies'
|
||||
}
|
||||
|
||||
export const serviceRegistry: Map<string, IServiceIdentifier<any>> = new Map();
|
||||
|
||||
export function getServiceDependencies(ctor: any): { id: IServiceIdentifier<any>, index: number, optional: boolean }[] {
|
||||
return ctor[DI_DEPENDENCIES] || [];
|
||||
return ctor[Constants.DI_DEPENDENCIES] || [];
|
||||
}
|
||||
|
||||
export function createDecorator<T>(id: string): IServiceIdentifier<T> {
|
||||
@@ -40,10 +42,10 @@ export function createDecorator<T>(id: string): IServiceIdentifier<T> {
|
||||
}
|
||||
|
||||
function storeServiceDependency(id: Function, target: Function, index: number): void {
|
||||
if ((target as any)[DI_TARGET] === target) {
|
||||
(target as any)[DI_DEPENDENCIES].push({ id, index });
|
||||
if ((target as any)[Constants.DI_TARGET] === target) {
|
||||
(target as any)[Constants.DI_DEPENDENCIES].push({ id, index });
|
||||
} else {
|
||||
(target as any)[DI_DEPENDENCIES] = [{ id, index }];
|
||||
(target as any)[DI_TARGET] = target;
|
||||
(target as any)[Constants.DI_DEPENDENCIES] = [{ id, index }];
|
||||
(target as any)[Constants.DI_TARGET] = target;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user