diff --git a/packages/grafana-ui/src/components/Monaco/types.ts b/packages/grafana-ui/src/components/Monaco/types.ts index fc8918e8c2e..876a941b02e 100644 --- a/packages/grafana-ui/src/components/Monaco/types.ts +++ b/packages/grafana-ui/src/components/Monaco/types.ts @@ -16,7 +16,7 @@ export type CodeEditorSuggestionProvider = () => CodeEditorSuggestionItem[]; export type { monacoType as monacoTypes }; export type Monaco = typeof monacoType; export type MonacoEditor = monacoType.editor.IStandaloneCodeEditor; -export type MonacoOptions = monacoType.editor.IStandaloneEditorConstructionOptions; +export type MonacoOptions = MonacoOptionsWithGrafanaDefaults; export interface CodeEditorProps { value: string; @@ -96,3 +96,50 @@ export interface CodeEditorSuggestionItem { */ insertText?: string; } + +/** + * This interface will extend the original Monaco editor options interface + * but changing the code comments to contain the proper default values to + * prevent the consumer of the CodeEditor to get incorrect documentation in editor. + */ +export interface MonacoOptionsWithGrafanaDefaults extends monacoType.editor.IStandaloneEditorConstructionOptions { + /** + * Enable custom contextmenu. + * Defaults to false. + */ + contextmenu?: boolean; + /** + * The number of spaces a tab is equal to. + * This setting is overridden based on the file contents when `detectIndentation` is on. + * Defaults to 4. + */ + tabSize?: number; + /** + * Show code lens + * Defaults to false. + */ + codeLens?: boolean; + /** + * Control the width of line numbers, by reserving horizontal space for rendering at least an amount of digits. + * Defaults to 4. + */ + lineNumbersMinChars?: number; + /** + * The width reserved for line decorations (in px). + * Line decorations are placed between line numbers and the editor content. + * You can pass in a string in the format floating point followed by "ch". e.g. 1.3ch. + * Defaults to 1 * theme.spacing.gridSize. + */ + lineDecorationsWidth?: number | string; + /** + * Controls if a border should be drawn around the overview ruler. + * Defaults to `false`. + */ + overviewRulerBorder?: boolean; + /** + * Enable that the editor will install an interval to check if its container dom node size has changed. + * Enabling this might have a severe performance impact. + * Defaults to true. + */ + automaticLayout?: boolean; +}