"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const nls = require("../../../nls.js");
const event = require("../../../base/common/event.js");
const languageConfigurationRegistry = require("./languageConfigurationRegistry.js");
const platform = require("../../../platform/registry/common/platform.js");
const mime = require("../../../base/common/mime.js");
const configurationRegistry = require("../../../platform/configuration/common/configurationRegistry.js");
const Extensions = {
  ModesRegistry: "editor.modesRegistry"
};
class EditorModesRegistry {
  constructor() {
    this._onDidChangeLanguages = new event.Emitter();
    this.onDidChangeLanguages = this._onDidChangeLanguages.event;
    this._languages = [];
  }
  registerLanguage(def) {
    this._languages.push(def);
    this._onDidChangeLanguages.fire(void 0);
    return {
      dispose: () => {
        for (let i = 0, len = this._languages.length; i < len; i++) {
          if (this._languages[i] === def) {
            this._languages.splice(i, 1);
            return;
          }
        }
      }
    };
  }
  getLanguages() {
    return this._languages;
  }
}
const ModesRegistry = new EditorModesRegistry();
platform.Registry.add(Extensions.ModesRegistry, ModesRegistry);
const PLAINTEXT_LANGUAGE_ID = "plaintext";
const PLAINTEXT_EXTENSION = ".txt";
ModesRegistry.registerLanguage({
  id: PLAINTEXT_LANGUAGE_ID,
  extensions: [PLAINTEXT_EXTENSION],
  aliases: [nls.localize("plainText.alias", "Plain Text"), "text"],
  mimetypes: [mime.Mimes.text]
});
languageConfigurationRegistry.LanguageConfigurationRegistry.register(PLAINTEXT_LANGUAGE_ID, {
  brackets: [
    ["(", ")"],
    ["[", "]"],
    ["{", "}"]
  ],
  surroundingPairs: [
    { open: "{", close: "}" },
    { open: "[", close: "]" },
    { open: "(", close: ")" },
    { open: "<", close: ">" },
    { open: '"', close: '"' },
    { open: "'", close: "'" },
    { open: "`", close: "`" }
  ],
  colorizedBracketPairs: [],
  folding: {
    offSide: true
  }
}, 0);
platform.Registry.as(configurationRegistry.Extensions.Configuration).registerDefaultConfigurations([{
  overrides: {
    "[plaintext]": {
      "editor.unicodeHighlight.ambiguousCharacters": false,
      "editor.unicodeHighlight.invisibleCharacters": false
    }
  }
}]);
exports.EditorModesRegistry = EditorModesRegistry;
exports.Extensions = Extensions;
exports.ModesRegistry = ModesRegistry;
exports.PLAINTEXT_EXTENSION = PLAINTEXT_EXTENSION;
exports.PLAINTEXT_LANGUAGE_ID = PLAINTEXT_LANGUAGE_ID;
