import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
import { Schemas } from '../../../../base/common/network.js';
import { sep } from '../../../../base/common/path.js';
import { isWindows } from '../../../../base/common/platform.js';
import { ModesRegistry } from '../../../../editor/common/languages/modesRegistry.js';
import { localizeWithPath } from '../../../../nls.js';
import { SyncDescriptor } from '../../../../platform/instantiation/common/descriptors.js';
import { ILabelService } from '../../../../platform/label/common/label.service.js';
import { Registry } from '../../../../platform/registry/common/platform.js';
import { EditorPaneDescriptor } from '../../../browser/editor.js';
import { registerWorkbenchContribution2, WorkbenchPhase } from '../../../common/contributions.js';
import { EditorExtensions } from '../../../common/editor.js';
import { BinaryFileEditor } from './editors/binaryFileEditor.js';
import { FileEditorInputSerializer, FileEditorWorkingCopyEditorHandler } from './editors/fileEditorHandler.js';
import { FileEditorInput } from './editors/fileEditorInput.js';
import { TextFileEditor } from './editors/textFileEditor.js';
import { TextFileEditorTracker } from './editors/textFileEditorTracker.js';
import { TextFileSaveErrorHandler } from './editors/textFileSaveErrorHandler.js';
import { WorkspaceWatcher } from './workspaceWatcher.js';
import { DirtyFilesIndicator } from '../common/dirtyFilesIndicator.js';
import { FILE_EDITOR_INPUT_ID, BINARY_TEXT_FILE_MODE } from '../common/files.js';
import './files.contribution._fileEditorFactory.js';
const _moduleId = "vs/workbench/contrib/files/browser/files.contribution";
let FileUriLabelContribution = class FileUriLabelContribution {
    static { this.ID = 'workbench.contrib.fileUriLabel'; }
    constructor(labelService) {
        labelService.registerFormatter({
            scheme: Schemas.file,
            formatting: {
                label: '${authority}${path}',
                separator: sep,
                tildify: !isWindows,
                normalizeDriveLetter: isWindows,
                authorityPrefix: sep + sep,
                workspaceSuffix: ''
            }
        });
    }
};
FileUriLabelContribution = ( (__decorate([
    ( (__param(0, ILabelService)))
], FileUriLabelContribution)));
( (Registry.as(EditorExtensions.EditorPane))).registerEditorPane(EditorPaneDescriptor.create(TextFileEditor, TextFileEditor.ID, ( localizeWithPath(_moduleId, 103, "Text File Editor"))), [
    ( (new SyncDescriptor(FileEditorInput)))
]);
( (Registry.as(EditorExtensions.EditorPane))).registerEditorPane(EditorPaneDescriptor.create(BinaryFileEditor, BinaryFileEditor.ID, ( localizeWithPath(_moduleId, 104, "Binary File Editor"))), [
    ( (new SyncDescriptor(FileEditorInput)))
]);
( (Registry.as(EditorExtensions.EditorFactory))).registerEditorSerializer(FILE_EDITOR_INPUT_ID, FileEditorInputSerializer);
registerWorkbenchContribution2(FileEditorWorkingCopyEditorHandler.ID, FileEditorWorkingCopyEditorHandler, WorkbenchPhase.BlockRestore);
registerWorkbenchContribution2(TextFileEditorTracker.ID, TextFileEditorTracker, WorkbenchPhase.BlockStartup);
registerWorkbenchContribution2(TextFileSaveErrorHandler.ID, TextFileSaveErrorHandler, WorkbenchPhase.BlockStartup);
registerWorkbenchContribution2(FileUriLabelContribution.ID, FileUriLabelContribution, WorkbenchPhase.BlockStartup);
registerWorkbenchContribution2(WorkspaceWatcher.ID, WorkspaceWatcher, WorkbenchPhase.AfterRestored);
registerWorkbenchContribution2(DirtyFilesIndicator.ID, DirtyFilesIndicator, WorkbenchPhase.BlockStartup);
ModesRegistry.registerLanguage({
    id: BINARY_TEXT_FILE_MODE,
    aliases: ['Binary'],
    mimetypes: ['text/x-code-binary']
});
