import { editorOptionsRegistry } from "./editorOptions.mjs";
import { EDITOR_MODEL_DEFAULTS } from "../core/textModelDefaults.mjs";
import { localize } from "../../../nls.mjs";
import { Extensions } from "../../../platform/configuration/common/configurationRegistry.mjs";
import { Registry } from "../../../platform/registry/common/platform.mjs";
const editorConfigurationBaseNode = Object.freeze({
  id: "editor",
  order: 5,
  type: "object",
  title: localize("editorConfigurationTitle", "Editor"),
  scope: 5
});
const editorConfiguration = Object.assign(Object.assign({}, editorConfigurationBaseNode), { properties: {
  "editor.tabSize": {
    type: "number",
    default: EDITOR_MODEL_DEFAULTS.tabSize,
    minimum: 1,
    markdownDescription: localize("tabSize", "The number of spaces a tab is equal to. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.")
  },
  // 'editor.indentSize': {
  // 	'anyOf': [
  // 		{
  // 			type: 'string',
  // 			enum: ['tabSize']
  // 		},
  // 		{
  // 			type: 'number',
  // 			minimum: 1
  // 		}
  // 	],
  // 	default: 'tabSize',
  // 	markdownDescription: nls.localize('indentSize', "The number of spaces used for indentation or 'tabSize' to use the value from `#editor.tabSize#`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.")
  // },
  "editor.insertSpaces": {
    type: "boolean",
    default: EDITOR_MODEL_DEFAULTS.insertSpaces,
    markdownDescription: localize("insertSpaces", "Insert spaces when pressing `Tab`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.")
  },
  "editor.detectIndentation": {
    type: "boolean",
    default: EDITOR_MODEL_DEFAULTS.detectIndentation,
    markdownDescription: localize("detectIndentation", "Controls whether `#editor.tabSize#` and `#editor.insertSpaces#` will be automatically detected when a file is opened based on the file contents.")
  },
  "editor.trimAutoWhitespace": {
    type: "boolean",
    default: EDITOR_MODEL_DEFAULTS.trimAutoWhitespace,
    description: localize("trimAutoWhitespace", "Remove trailing auto inserted whitespace.")
  },
  "editor.largeFileOptimizations": {
    type: "boolean",
    default: EDITOR_MODEL_DEFAULTS.largeFileOptimizations,
    description: localize("largeFileOptimizations", "Special handling for large files to disable certain memory intensive features.")
  },
  "editor.wordBasedSuggestions": {
    type: "boolean",
    default: true,
    description: localize("wordBasedSuggestions", "Controls whether completions should be computed based on words in the document.")
  },
  "editor.wordBasedSuggestionsMode": {
    enum: ["currentDocument", "matchingDocuments", "allDocuments"],
    default: "matchingDocuments",
    enumDescriptions: [
      localize("wordBasedSuggestionsMode.currentDocument", "Only suggest words from the active document."),
      localize("wordBasedSuggestionsMode.matchingDocuments", "Suggest words from all open documents of the same language."),
      localize("wordBasedSuggestionsMode.allDocuments", "Suggest words from all open documents.")
    ],
    description: localize("wordBasedSuggestionsMode", "Controls from which documents word based completions are computed.")
  },
  "editor.semanticHighlighting.enabled": {
    enum: [true, false, "configuredByTheme"],
    enumDescriptions: [
      localize("semanticHighlighting.true", "Semantic highlighting enabled for all color themes."),
      localize("semanticHighlighting.false", "Semantic highlighting disabled for all color themes."),
      localize("semanticHighlighting.configuredByTheme", "Semantic highlighting is configured by the current color theme's `semanticHighlighting` setting.")
    ],
    default: "configuredByTheme",
    description: localize("semanticHighlighting.enabled", "Controls whether the semanticHighlighting is shown for the languages that support it.")
  },
  "editor.stablePeek": {
    type: "boolean",
    default: false,
    markdownDescription: localize("stablePeek", "Keep peek editors open even when double clicking their content or when hitting `Escape`.")
  },
  "editor.maxTokenizationLineLength": {
    type: "integer",
    default: 2e4,
    description: localize("maxTokenizationLineLength", "Lines above this length will not be tokenized for performance reasons")
  },
  "editor.language.brackets": {
    type: "array",
    default: false,
    description: localize("schema.brackets", "Defines the bracket symbols that increase or decrease the indentation."),
    items: {
      type: "array",
      items: [
        {
          type: "string",
          description: localize("schema.openBracket", "The opening bracket character or string sequence.")
        },
        {
          type: "string",
          description: localize("schema.closeBracket", "The closing bracket character or string sequence.")
        }
      ]
    }
  },
  "editor.language.colorizedBracketPairs": {
    type: "array",
    default: false,
    description: localize("schema.colorizedBracketPairs", "Defines the bracket pairs that are colorized by their nesting level if bracket pair colorization is enabled."),
    items: {
      type: "array",
      items: [
        {
          type: "string",
          description: localize("schema.openBracket", "The opening bracket character or string sequence.")
        },
        {
          type: "string",
          description: localize("schema.closeBracket", "The closing bracket character or string sequence.")
        }
      ]
    }
  },
  "diffEditor.maxComputationTime": {
    type: "number",
    default: 5e3,
    description: localize("maxComputationTime", "Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.")
  },
  "diffEditor.maxFileSize": {
    type: "number",
    default: 50,
    description: localize("maxFileSize", "Maximum file size in MB for which to compute diffs. Use 0 for no limit.")
  },
  "diffEditor.renderSideBySide": {
    type: "boolean",
    default: true,
    description: localize("sideBySide", "Controls whether the diff editor shows the diff side by side or inline.")
  },
  "diffEditor.ignoreTrimWhitespace": {
    type: "boolean",
    default: true,
    description: localize("ignoreTrimWhitespace", "When enabled, the diff editor ignores changes in leading or trailing whitespace.")
  },
  "diffEditor.renderIndicators": {
    type: "boolean",
    default: true,
    description: localize("renderIndicators", "Controls whether the diff editor shows +/- indicators for added/removed changes.")
  },
  "diffEditor.codeLens": {
    type: "boolean",
    default: false,
    description: localize("codeLens", "Controls whether the editor shows CodeLens.")
  },
  "diffEditor.wordWrap": {
    type: "string",
    enum: ["off", "on", "inherit"],
    default: "inherit",
    markdownEnumDescriptions: [
      localize("wordWrap.off", "Lines will never wrap."),
      localize("wordWrap.on", "Lines will wrap at the viewport width."),
      localize("wordWrap.inherit", "Lines will wrap according to the `#editor.wordWrap#` setting.")
    ]
  }
} });
function isConfigurationPropertySchema(x) {
  return typeof x.type !== "undefined" || typeof x.anyOf !== "undefined";
}
for (const editorOption of editorOptionsRegistry) {
  const schema = editorOption.schema;
  if (typeof schema !== "undefined") {
    if (isConfigurationPropertySchema(schema)) {
      editorConfiguration.properties[`editor.${editorOption.name}`] = schema;
    } else {
      for (const key in schema) {
        if (Object.hasOwnProperty.call(schema, key)) {
          editorConfiguration.properties[key] = schema[key];
        }
      }
    }
  }
}
let cachedEditorConfigurationKeys = null;
function getEditorConfigurationKeys() {
  if (cachedEditorConfigurationKeys === null) {
    cachedEditorConfigurationKeys = /* @__PURE__ */ Object.create(null);
    Object.keys(editorConfiguration.properties).forEach((prop) => {
      cachedEditorConfigurationKeys[prop] = true;
    });
  }
  return cachedEditorConfigurationKeys;
}
function isEditorConfigurationKey(key) {
  const editorConfigurationKeys = getEditorConfigurationKeys();
  return editorConfigurationKeys[`editor.${key}`] || false;
}
function isDiffEditorConfigurationKey(key) {
  const editorConfigurationKeys = getEditorConfigurationKeys();
  return editorConfigurationKeys[`diffEditor.${key}`] || false;
}
const configurationRegistry = Registry.as(Extensions.Configuration);
configurationRegistry.registerConfiguration(editorConfiguration);
export {
  editorConfigurationBaseNode,
  isDiffEditorConfigurationKey,
  isEditorConfigurationKey
};
