diff --git a/src/vs/editor/browser/editorExtensions.ts b/src/vs/editor/browser/editorExtensions.ts index e7494cc7a976a444d8850eedfa4d4fee41a872ee..c467768414b1bf09dbb9bef5c3620462e2991961 100644 --- a/src/vs/editor/browser/editorExtensions.ts +++ b/src/vs/editor/browser/editorExtensions.ts @@ -241,7 +241,7 @@ export abstract class EditorAction extends EditorCommand { // --- Registration of commands and actions -export function registerLanguageCommand(id: string, handler: (accessor: ServicesAccessor, args: { [n: string]: any }) => any) { +export function registerLanguageCommand(id: string, handler: (accessor: ServicesAccessor, args: Args) => any) { CommandsRegistry.registerCommand(id, (accessor, args) => handler(accessor, args || {})); } diff --git a/src/vs/platform/instantiation/common/instantiation.ts b/src/vs/platform/instantiation/common/instantiation.ts index 735c035934cca1726130affcd2a12bec68b5ad41..ef35c1f030a8b9686a8982817e2d4c81a6271afb 100644 --- a/src/vs/platform/instantiation/common/instantiation.ts +++ b/src/vs/platform/instantiation/common/instantiation.ts @@ -22,40 +22,42 @@ export namespace _util { // --- interfaces ------ +type BrandedService = { _serviceBrand: undefined }; + export interface IConstructorSignature0 { - new(...services: { _serviceBrand: undefined; }[]): T; + new(...services: BrandedService[]): T; } export interface IConstructorSignature1 { - new(first: A1, ...services: { _serviceBrand: undefined; }[]): T; + new(first: A1, ...services: BrandedService[]): T; } export interface IConstructorSignature2 { - new(first: A1, second: A2, ...services: { _serviceBrand: undefined; }[]): T; + new(first: A1, second: A2, ...services: BrandedService[]): T; } export interface IConstructorSignature3 { - new(first: A1, second: A2, third: A3, ...services: { _serviceBrand: undefined; }[]): T; + new(first: A1, second: A2, third: A3, ...services: BrandedService[]): T; } export interface IConstructorSignature4 { - new(first: A1, second: A2, third: A3, fourth: A4, ...services: { _serviceBrand: undefined; }[]): T; + new(first: A1, second: A2, third: A3, fourth: A4, ...services: BrandedService[]): T; } export interface IConstructorSignature5 { - new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, ...services: { _serviceBrand: undefined; }[]): T; + new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, ...services: BrandedService[]): T; } export interface IConstructorSignature6 { - new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, ...services: { _serviceBrand: undefined; }[]): T; + new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, ...services: BrandedService[]): T; } export interface IConstructorSignature7 { - new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, seventh: A7, ...services: { _serviceBrand: undefined; }[]): T; + new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, seventh: A7, ...services: BrandedService[]): T; } export interface IConstructorSignature8 { - new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, seventh: A7, eigth: A8, ...services: { _serviceBrand: undefined; }[]): T; + new(first: A1, second: A2, third: A3, fourth: A4, fifth: A5, sixth: A6, seventh: A7, eigth: A8, ...services: BrandedService[]): T; } export interface ServicesAccessor { diff --git a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts index f25cd1c755488094506e3e497cb3d985cba93cab..95aa5d90a6e78da2fdb76a160e07ce3fffb65502 100644 --- a/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts +++ b/src/vs/workbench/contrib/files/browser/views/openEditorsView.ts @@ -244,8 +244,9 @@ export class OpenEditorsView extends ViewletPanel { this.dirtyEditorFocusedContext.reset(); const element = e.elements.length ? e.elements[0] : undefined; if (element instanceof OpenEditor) { - this.dirtyEditorFocusedContext.set(this.textFileService.isDirty(withNullAsUndefined(element.getResource()))); - this.resourceContext.set(withUndefinedAsNull(element.getResource())); + const resource = element.getResource(); + this.dirtyEditorFocusedContext.set(this.textFileService.isDirty(resource)); + this.resourceContext.set(withUndefinedAsNull(resource)); } else if (!!element) { this.groupFocusedContext.set(true); } diff --git a/src/vs/workbench/services/textfile/common/textFileEditorModel.ts b/src/vs/workbench/services/textfile/common/textFileEditorModel.ts index bd6332610d8058c1b846a3b56940c45c0552f910..3181a91d1c1c08fa70b240be497b1c586d8917d3 100644 --- a/src/vs/workbench/services/textfile/common/textFileEditorModel.ts +++ b/src/vs/workbench/services/textfile/common/textFileEditorModel.ts @@ -80,7 +80,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil private contentEncoding: string; // encoding as reported from disk private preferredEncoding: string; // encoding as chosen by the user - private preferredMode: string; // mode as chosen by the user + private preferredMode: string | undefined; // mode as chosen by the user private versionId: number; private bufferSavedVersionId: number; @@ -108,7 +108,7 @@ export class TextFileEditorModel extends BaseTextEditorModel implements ITextFil constructor( resource: URI, preferredEncoding: string, - preferredMode: string, + preferredMode: string | undefined, @INotificationService private readonly notificationService: INotificationService, @IModeService modeService: IModeService, @IModelService modelService: IModelService,