Path: blob/main/src/vs/editor/common/config/editorOptions.ts
5240 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import * as arrays from '../../../base/common/arrays.js';6import { IMarkdownString } from '../../../base/common/htmlContent.js';7import { IJSONSchema } from '../../../base/common/jsonSchema.js';8import * as objects from '../../../base/common/objects.js';9import * as platform from '../../../base/common/platform.js';10import { ScrollbarVisibility } from '../../../base/common/scrollable.js';11import { Constants } from '../../../base/common/uint.js';12import { EDITOR_FONT_DEFAULTS, FONT_VARIATION_OFF, FONT_VARIATION_TRANSLATE, FontInfo } from './fontInfo.js';13import { EDITOR_MODEL_DEFAULTS } from '../core/misc/textModelDefaults.js';14import { USUAL_WORD_SEPARATORS } from '../core/wordHelper.js';15import * as nls from '../../../nls.js';16import { AccessibilitySupport } from '../../../platform/accessibility/common/accessibility.js';17import { IConfigurationPropertySchema } from '../../../platform/configuration/common/configurationRegistry.js';1819//#region typed options2021/**22* Configuration options for auto closing quotes and brackets23*/24export type EditorAutoClosingStrategy = 'always' | 'languageDefined' | 'beforeWhitespace' | 'never';2526/**27* Configuration options for auto wrapping quotes and brackets28*/29export type EditorAutoSurroundStrategy = 'languageDefined' | 'quotes' | 'brackets' | 'never';3031/**32* Configuration options for typing over closing quotes or brackets33*/34export type EditorAutoClosingEditStrategy = 'always' | 'auto' | 'never';3536type Unknown<T> = { [K in keyof T]: unknown };3738/**39* Configuration options for auto indentation in the editor40*/41export const enum EditorAutoIndentStrategy {42None = 0,43Keep = 1,44Brackets = 2,45Advanced = 3,46Full = 447}4849/**50* Configuration options for the editor.51*/52export interface IEditorOptions {53/**54* This editor is used inside a diff editor.55*/56inDiffEditor?: boolean;57/**58* This editor is allowed to use variable line heights.59*/60allowVariableLineHeights?: boolean;61/**62* This editor is allowed to use variable font-sizes and font-families63*/64allowVariableFonts?: boolean;65/**66* This editor is allowed to use variable font-sizes and font-families in accessibility mode67*/68allowVariableFontsInAccessibilityMode?: boolean;69/**70* The aria label for the editor's textarea (when it is focused).71*/72ariaLabel?: string;7374/**75* Whether the aria-required attribute should be set on the editors textarea.76*/77ariaRequired?: boolean;78/**79* Control whether a screen reader announces inline suggestion content immediately.80*/81screenReaderAnnounceInlineSuggestion?: boolean;82/**83* The `tabindex` property of the editor's textarea84*/85tabIndex?: number;86/**87* Render vertical lines at the specified columns.88* Defaults to empty array.89*/90rulers?: (number | IRulerOption)[];91/**92* Locales used for segmenting lines into words when doing word related navigations or operations.93*94* Specify the BCP 47 language tag of the word you wish to recognize (e.g., ja, zh-CN, zh-Hant-TW, etc.).95* Defaults to empty array96*/97wordSegmenterLocales?: string | string[];98/**99* A string containing the word separators used when doing word navigation.100* Defaults to `~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?101*/102wordSeparators?: string;103/**104* Enable Linux primary clipboard.105* Defaults to true.106*/107selectionClipboard?: boolean;108/**109* Control the rendering of line numbers.110* If it is a function, it will be invoked when rendering a line number and the return value will be rendered.111* Otherwise, if it is a truthy, line numbers will be rendered normally (equivalent of using an identity function).112* Otherwise, line numbers will not be rendered.113* Defaults to `on`.114*/115lineNumbers?: LineNumbersType;116/**117* Controls the minimal number of visible leading and trailing lines surrounding the cursor.118* Defaults to 0.119*/120cursorSurroundingLines?: number;121/**122* Controls when `cursorSurroundingLines` should be enforced123* Defaults to `default`, `cursorSurroundingLines` is not enforced when cursor position is changed124* by mouse.125*/126cursorSurroundingLinesStyle?: 'default' | 'all';127/**128* Render last line number when the file ends with a newline.129* Defaults to 'on' for Windows and macOS and 'dimmed' for Linux.130*/131renderFinalNewline?: 'on' | 'off' | 'dimmed';132/**133* Remove unusual line terminators like LINE SEPARATOR (LS), PARAGRAPH SEPARATOR (PS).134* Defaults to 'prompt'.135*/136unusualLineTerminators?: 'auto' | 'off' | 'prompt';137/**138* Should the corresponding line be selected when clicking on the line number?139* Defaults to true.140*/141selectOnLineNumbers?: boolean;142/**143* Control the width of line numbers, by reserving horizontal space for rendering at least an amount of digits.144* Defaults to 5.145*/146lineNumbersMinChars?: number;147/**148* Enable the rendering of the glyph margin.149* Defaults to true in vscode and to false in monaco-editor.150*/151glyphMargin?: boolean;152/**153* The width reserved for line decorations (in px).154* Line decorations are placed between line numbers and the editor content.155* You can pass in a string in the format floating point followed by "ch". e.g. 1.3ch.156* Defaults to 10.157*/158lineDecorationsWidth?: number | string;159/**160* When revealing the cursor, a virtual padding (px) is added to the cursor, turning it into a rectangle.161* This virtual padding ensures that the cursor gets revealed before hitting the edge of the viewport.162* Defaults to 30 (px).163*/164revealHorizontalRightPadding?: number;165/**166* Render the editor selection with rounded borders.167* Defaults to true.168*/169roundedSelection?: boolean;170/**171* Class name to be added to the editor.172*/173extraEditorClassName?: string;174/**175* Should the editor be read only. See also `domReadOnly`.176* Defaults to false.177*/178readOnly?: boolean;179/**180* The message to display when the editor is readonly.181*/182readOnlyMessage?: IMarkdownString;183/**184* Should the textarea used for input use the DOM `readonly` attribute.185* Defaults to false.186*/187domReadOnly?: boolean;188/**189* Enable linked editing.190* Defaults to false.191*/192linkedEditing?: boolean;193/**194* deprecated, use linkedEditing instead195*/196renameOnType?: boolean;197/**198* Should the editor render validation decorations.199* Defaults to editable.200*/201renderValidationDecorations?: 'editable' | 'on' | 'off';202/**203* Control the behavior and rendering of the scrollbars.204*/205scrollbar?: IEditorScrollbarOptions;206/**207* Control the behavior of sticky scroll options208*/209stickyScroll?: IEditorStickyScrollOptions;210/**211* Control the behavior and rendering of the minimap.212*/213minimap?: IEditorMinimapOptions;214/**215* Control the behavior of the find widget.216*/217find?: IEditorFindOptions;218/**219* Display overflow widgets as `fixed`.220* Defaults to `false`.221*/222fixedOverflowWidgets?: boolean;223/**224* Allow content widgets and overflow widgets to overflow the editor viewport.225* Defaults to `true`.226*/227allowOverflow?: boolean;228/**229* The number of vertical lanes the overview ruler should render.230* Defaults to 3.231*/232overviewRulerLanes?: number;233/**234* Controls if a border should be drawn around the overview ruler.235* Defaults to `true`.236*/237overviewRulerBorder?: boolean;238/**239* Control the cursor animation style, possible values are 'blink', 'smooth', 'phase', 'expand' and 'solid'.240* Defaults to 'blink'.241*/242cursorBlinking?: 'blink' | 'smooth' | 'phase' | 'expand' | 'solid';243/**244* Zoom the font in the editor when using the mouse wheel in combination with holding Ctrl.245* Defaults to false.246*/247mouseWheelZoom?: boolean;248/**249* Control the mouse pointer style, either 'text' or 'default' or 'copy'250* Defaults to 'text'251*/252mouseStyle?: 'text' | 'default' | 'copy';253/**254* Enable smooth caret animation.255* Defaults to 'off'.256*/257cursorSmoothCaretAnimation?: 'off' | 'explicit' | 'on';258/**259* Control the cursor style in insert mode.260* Defaults to 'line'.261*/262cursorStyle?: 'line' | 'block' | 'underline' | 'line-thin' | 'block-outline' | 'underline-thin';263/**264* Control the cursor style in overtype mode.265* Defaults to 'block'.266*/267overtypeCursorStyle?: 'line' | 'block' | 'underline' | 'line-thin' | 'block-outline' | 'underline-thin';268/**269* Controls whether paste in overtype mode should overwrite or insert.270*/271overtypeOnPaste?: boolean;272/**273* Control the width of the cursor when cursorStyle is set to 'line'274*/275cursorWidth?: number;276/**277* Control the height of the cursor when cursorStyle is set to 'line'278*/279cursorHeight?: number;280/**281* Enable font ligatures.282* Defaults to false.283*/284fontLigatures?: boolean | string;285/**286* Enable font variations.287* Defaults to false.288*/289fontVariations?: boolean | string;290/**291* Controls whether to use default color decorations or not using the default document color provider292*/293defaultColorDecorators?: 'auto' | 'always' | 'never';294/**295* Disable the use of `transform: translate3d(0px, 0px, 0px)` for the editor margin and lines layers.296* The usage of `transform: translate3d(0px, 0px, 0px)` acts as a hint for browsers to create an extra layer.297* Defaults to false.298*/299disableLayerHinting?: boolean;300/**301* Disable the optimizations for monospace fonts.302* Defaults to false.303*/304disableMonospaceOptimizations?: boolean;305/**306* Should the cursor be hidden in the overview ruler.307* Defaults to false.308*/309hideCursorInOverviewRuler?: boolean;310/**311* Enable that scrolling can go one screen size after the last line.312* Defaults to true.313*/314scrollBeyondLastLine?: boolean;315/**316* Scroll editor on middle click317*/318scrollOnMiddleClick?: boolean;319/**320* Enable that scrolling can go beyond the last column by a number of columns.321* Defaults to 5.322*/323scrollBeyondLastColumn?: number;324/**325* Enable that the editor animates scrolling to a position.326* Defaults to false.327*/328smoothScrolling?: boolean;329/**330* Enable that the editor will install a ResizeObserver to check if its container dom node size has changed.331* Defaults to false.332*/333automaticLayout?: boolean;334/**335* Control the wrapping of the editor.336* When `wordWrap` = "off", the lines will never wrap.337* When `wordWrap` = "on", the lines will wrap at the viewport width.338* When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.339* When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).340* Defaults to "off".341*/342wordWrap?: 'off' | 'on' | 'wordWrapColumn' | 'bounded';343/**344* Override the `wordWrap` setting.345*/346wordWrapOverride1?: 'off' | 'on' | 'inherit';347/**348* Override the `wordWrapOverride1` setting.349*/350wordWrapOverride2?: 'off' | 'on' | 'inherit';351/**352* Control the wrapping of the editor.353* When `wordWrap` = "off", the lines will never wrap.354* When `wordWrap` = "on", the lines will wrap at the viewport width.355* When `wordWrap` = "wordWrapColumn", the lines will wrap at `wordWrapColumn`.356* When `wordWrap` = "bounded", the lines will wrap at min(viewport width, wordWrapColumn).357* Defaults to 80.358*/359wordWrapColumn?: number;360/**361* Control indentation of wrapped lines. Can be: 'none', 'same', 'indent' or 'deepIndent'.362* Defaults to 'same' in vscode and to 'none' in monaco-editor.363*/364wrappingIndent?: 'none' | 'same' | 'indent' | 'deepIndent';365/**366* Controls the wrapping strategy to use.367* Defaults to 'simple'.368*/369wrappingStrategy?: 'simple' | 'advanced';370/**371* Create a softwrap on every quoted "\n" literal.372* Defaults to false.373*/374wrapOnEscapedLineFeeds?: boolean;375/**376* Configure word wrapping characters. A break will be introduced before these characters.377*/378wordWrapBreakBeforeCharacters?: string;379/**380* Configure word wrapping characters. A break will be introduced after these characters.381*/382wordWrapBreakAfterCharacters?: string;383/**384* Sets whether line breaks appear wherever the text would otherwise overflow its content box.385* When wordBreak = 'normal', Use the default line break rule.386* When wordBreak = 'keepAll', Word breaks should not be used for Chinese/Japanese/Korean (CJK) text. Non-CJK text behavior is the same as for normal.387*/388wordBreak?: 'normal' | 'keepAll';389/**390* Performance guard: Stop rendering a line after x characters.391* Defaults to 10000.392* Use -1 to never stop rendering393*/394stopRenderingLineAfter?: number;395/**396* Configure the editor's hover.397*/398hover?: IEditorHoverOptions;399/**400* Enable detecting links and making them clickable.401* Defaults to true.402*/403links?: boolean;404/**405* Enable inline color decorators and color picker rendering.406*/407colorDecorators?: boolean;408/**409* Controls what is the condition to spawn a color picker from a color dectorator410*/411colorDecoratorsActivatedOn?: 'clickAndHover' | 'click' | 'hover';412/**413* Controls the max number of color decorators that can be rendered in an editor at once.414*/415colorDecoratorsLimit?: number;416/**417* Control the behaviour of comments in the editor.418*/419comments?: IEditorCommentsOptions;420/**421* Enable custom contextmenu.422* Defaults to true.423*/424contextmenu?: boolean;425/**426* A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.427* Defaults to 1.428*/429mouseWheelScrollSensitivity?: number;430/**431* FastScrolling mulitplier speed when pressing `Alt`432* Defaults to 5.433*/434fastScrollSensitivity?: number;435/**436* Enable that the editor scrolls only the predominant axis. Prevents horizontal drift when scrolling vertically on a trackpad.437* Defaults to true.438*/439scrollPredominantAxis?: boolean;440/**441* Make scrolling inertial - mostly useful with touchpad on linux.442*/443inertialScroll?: boolean;444/**445* Enable that the selection with the mouse and keys is doing column selection.446* Defaults to false.447*/448columnSelection?: boolean;449/**450* The modifier to be used to add multiple cursors with the mouse.451* Defaults to 'alt'452*/453multiCursorModifier?: 'ctrlCmd' | 'alt';454/**455* Merge overlapping selections.456* Defaults to true457*/458multiCursorMergeOverlapping?: boolean;459/**460* Configure the behaviour when pasting a text with the line count equal to the cursor count.461* Defaults to 'spread'.462*/463multiCursorPaste?: 'spread' | 'full';464/**465* Controls the max number of text cursors that can be in an active editor at once.466*/467multiCursorLimit?: number;468/**469* Enables middle mouse button to open links and Go To Definition470*/471mouseMiddleClickAction?: MouseMiddleClickAction;472/**473* Configure the editor's accessibility support.474* Defaults to 'auto'. It is best to leave this to 'auto'.475*/476accessibilitySupport?: 'auto' | 'off' | 'on';477/**478* Controls the number of lines in the editor that can be read out by a screen reader479*/480accessibilityPageSize?: number;481/**482* Suggest options.483*/484suggest?: ISuggestOptions;485inlineSuggest?: IInlineSuggestOptions;486/**487* Smart select options.488*/489smartSelect?: ISmartSelectOptions;490/**491*492*/493gotoLocation?: IGotoLocationOptions;494/**495* Enable quick suggestions (shadow suggestions)496* Defaults to true.497*/498quickSuggestions?: boolean | IQuickSuggestionsOptions;499/**500* Quick suggestions show delay (in ms)501* Defaults to 10 (ms)502*/503quickSuggestionsDelay?: number;504/**505* Controls the spacing around the editor.506*/507padding?: IEditorPaddingOptions;508/**509* Parameter hint options.510*/511parameterHints?: IEditorParameterHintOptions;512/**513* Options for auto closing brackets.514* Defaults to language defined behavior.515*/516autoClosingBrackets?: EditorAutoClosingStrategy;517/**518* Options for auto closing comments.519* Defaults to language defined behavior.520*/521autoClosingComments?: EditorAutoClosingStrategy;522/**523* Options for auto closing quotes.524* Defaults to language defined behavior.525*/526autoClosingQuotes?: EditorAutoClosingStrategy;527/**528* Options for pressing backspace near quotes or bracket pairs.529*/530autoClosingDelete?: EditorAutoClosingEditStrategy;531/**532* Options for typing over closing quotes or brackets.533*/534autoClosingOvertype?: EditorAutoClosingEditStrategy;535/**536* Options for auto surrounding.537* Defaults to always allowing auto surrounding.538*/539autoSurround?: EditorAutoSurroundStrategy;540/**541* Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.542* Defaults to advanced.543*/544autoIndent?: 'none' | 'keep' | 'brackets' | 'advanced' | 'full';545/**546* Boolean which controls whether to autoindent on paste547*/548autoIndentOnPaste?: boolean;549/**550* Boolean which controls whether to autoindent on paste within a string when autoIndentOnPaste is enabled.551*/552autoIndentOnPasteWithinString?: boolean;553/**554* Emulate selection behaviour of tab characters when using spaces for indentation.555* This means selection will stick to tab stops.556*/557stickyTabStops?: boolean;558/**559* Enable format on type.560* Defaults to false.561*/562formatOnType?: boolean;563/**564* Enable format on paste.565* Defaults to false.566*/567formatOnPaste?: boolean;568/**569* Controls if the editor should allow to move selections via drag and drop.570* Defaults to false.571*/572dragAndDrop?: boolean;573/**574* Enable the suggestion box to pop-up on trigger characters.575* Defaults to true.576*/577suggestOnTriggerCharacters?: boolean;578/**579* Accept suggestions on ENTER.580* Defaults to 'on'.581*/582acceptSuggestionOnEnter?: 'on' | 'smart' | 'off';583/**584* Accept suggestions on provider defined characters.585* Defaults to true.586*/587acceptSuggestionOnCommitCharacter?: boolean;588/**589* Enable snippet suggestions. Default to 'true'.590*/591snippetSuggestions?: 'top' | 'bottom' | 'inline' | 'none';592/**593* Copying without a selection copies the current line.594*/595emptySelectionClipboard?: boolean;596/**597* Syntax highlighting is copied.598*/599copyWithSyntaxHighlighting?: boolean;600/**601* The history mode for suggestions.602*/603suggestSelection?: 'first' | 'recentlyUsed' | 'recentlyUsedByPrefix';604/**605* The font size for the suggest widget.606* Defaults to the editor font size.607*/608suggestFontSize?: number;609/**610* The line height for the suggest widget.611* Defaults to the editor line height.612*/613suggestLineHeight?: number;614/**615* Enable tab completion.616*/617tabCompletion?: 'on' | 'off' | 'onlySnippets';618/**619* Enable selection highlight.620* Defaults to true.621*/622selectionHighlight?: boolean;623/**624* Enable selection highlight for multiline selections.625* Defaults to false.626*/627selectionHighlightMultiline?: boolean;628/**629* Maximum length (in characters) for selection highlights.630* Set to 0 to have an unlimited length.631*/632selectionHighlightMaxLength?: number;633/**634* Enable semantic occurrences highlight.635* Defaults to 'singleFile'.636* 'off' disables occurrence highlighting637* 'singleFile' triggers occurrence highlighting in the current document638* 'multiFile' triggers occurrence highlighting across valid open documents639*/640occurrencesHighlight?: 'off' | 'singleFile' | 'multiFile';641/**642* Controls delay for occurrences highlighting643* Defaults to 250.644* Minimum value is 0645* Maximum value is 2000646*/647occurrencesHighlightDelay?: number;648/**649* Show code lens650* Defaults to true.651*/652codeLens?: boolean;653/**654* Code lens font family. Defaults to editor font family.655*/656codeLensFontFamily?: string;657/**658* Code lens font size. Default to 90% of the editor font size659*/660codeLensFontSize?: number;661/**662* Control the behavior and rendering of the code action lightbulb.663*/664lightbulb?: IEditorLightbulbOptions;665/**666* Timeout for running code actions on save.667*/668codeActionsOnSaveTimeout?: number;669/**670* Enable code folding.671* Defaults to true.672*/673folding?: boolean;674/**675* Selects the folding strategy. 'auto' uses the strategies contributed for the current document, 'indentation' uses the indentation based folding strategy.676* Defaults to 'auto'.677*/678foldingStrategy?: 'auto' | 'indentation';679/**680* Enable highlight for folded regions.681* Defaults to true.682*/683foldingHighlight?: boolean;684/**685* Auto fold imports folding regions.686* Defaults to true.687*/688foldingImportsByDefault?: boolean;689/**690* Maximum number of foldable regions.691* Defaults to 5000.692*/693foldingMaximumRegions?: number;694/**695* Controls whether the fold actions in the gutter stay always visible or hide unless the mouse is over the gutter.696* Defaults to 'mouseover'.697*/698showFoldingControls?: 'always' | 'never' | 'mouseover';699/**700* Controls whether clicking on the empty content after a folded line will unfold the line.701* Defaults to false.702*/703unfoldOnClickAfterEndOfLine?: boolean;704/**705* Enable highlighting of matching brackets.706* Defaults to 'always'.707*/708matchBrackets?: 'never' | 'near' | 'always';709/**710* Enable experimental rendering using WebGPU.711* Defaults to 'off'.712*/713experimentalGpuAcceleration?: 'on' | 'off';714/**715* Enable experimental whitespace rendering.716* Defaults to 'svg'.717*/718experimentalWhitespaceRendering?: 'svg' | 'font' | 'off';719/**720* Enable rendering of whitespace.721* Defaults to 'selection'.722*/723renderWhitespace?: 'none' | 'boundary' | 'selection' | 'trailing' | 'all';724/**725* Enable rendering of control characters.726* Defaults to true.727*/728renderControlCharacters?: boolean;729/**730* Enable rendering of current line highlight.731* Defaults to all.732*/733renderLineHighlight?: 'none' | 'gutter' | 'line' | 'all';734/**735* Control if the current line highlight should be rendered only the editor is focused.736* Defaults to false.737*/738renderLineHighlightOnlyWhenFocus?: boolean;739/**740* Inserting and deleting whitespace follows tab stops.741*/742useTabStops?: boolean;743/**744* Controls whether the editor should automatically remove indentation whitespace when joining lines with Delete.745* Defaults to false.746*/747trimWhitespaceOnDelete?: boolean;748/**749* The font family750*/751fontFamily?: string;752/**753* The font weight754*/755fontWeight?: string;756/**757* The font size758*/759fontSize?: number;760/**761* The line height762*/763lineHeight?: number;764/**765* The letter spacing766*/767letterSpacing?: number;768/**769* Controls fading out of unused variables.770*/771showUnused?: boolean;772/**773* Controls whether to focus the inline editor in the peek widget by default.774* Defaults to false.775*/776peekWidgetDefaultFocus?: 'tree' | 'editor';777778/**779* Sets a placeholder for the editor.780* If set, the placeholder is shown if the editor is empty.781*/782placeholder?: string | undefined;783784/**785* Controls whether the definition link opens element in the peek widget.786* Defaults to false.787*/788definitionLinkOpensInPeek?: boolean;789/**790* Controls strikethrough deprecated variables.791*/792showDeprecated?: boolean;793/**794* Controls whether suggestions allow matches in the middle of the word instead of only at the beginning795*/796matchOnWordStartOnly?: boolean;797/**798* Control the behavior and rendering of the inline hints.799*/800inlayHints?: IEditorInlayHintsOptions;801/**802* Control if the editor should use shadow DOM.803*/804useShadowDOM?: boolean;805/**806* Controls the behavior of editor guides.807*/808guides?: IGuidesOptions;809810/**811* Controls the behavior of the unicode highlight feature812* (by default, ambiguous and invisible characters are highlighted).813*/814unicodeHighlight?: IUnicodeHighlightOptions;815816/**817* Configures bracket pair colorization (disabled by default).818*/819bracketPairColorization?: IBracketPairColorizationOptions;820821/**822* Controls dropping into the editor from an external source.823*824* When enabled, this shows a preview of the drop location and triggers an `onDropIntoEditor` event.825*/826dropIntoEditor?: IDropIntoEditorOptions;827828/**829* Sets whether the new experimental edit context should be used instead of the text area.830*/831editContext?: boolean;832833/**834* Controls whether to render rich HTML screen reader content when the EditContext is enabled835*/836renderRichScreenReaderContent?: boolean;837838/**839* Controls support for changing how content is pasted into the editor.840*/841pasteAs?: IPasteAsOptions;842843/**844* Controls whether the editor / terminal receives tabs or defers them to the workbench for navigation.845*/846tabFocusMode?: boolean;847848/**849* Controls whether the accessibility hint should be provided to screen reader users when an inline completion is shown.850*/851inlineCompletionsAccessibilityVerbose?: boolean;852}853854/**855* @internal856* The width of the minimap gutter, in pixels.857*/858export const MINIMAP_GUTTER_WIDTH = 8;859860export interface IDiffEditorBaseOptions {861/**862* Allow the user to resize the diff editor split view.863* Defaults to true.864*/865enableSplitViewResizing?: boolean;866867/**868* The default ratio when rendering side-by-side editors.869* Must be a number between 0 and 1, min sizes apply.870* Defaults to 0.5871*/872splitViewDefaultRatio?: number;873874/**875* Render the differences in two side-by-side editors.876* Defaults to true.877*/878renderSideBySide?: boolean;879880/**881* When `renderSideBySide` is enabled, `useInlineViewWhenSpaceIsLimited` is set,882* and the diff editor has a width less than `renderSideBySideInlineBreakpoint`, the inline view is used.883*/884renderSideBySideInlineBreakpoint?: number | undefined;885886/**887* When `renderSideBySide` is enabled, `useInlineViewWhenSpaceIsLimited` is set,888* and the diff editor has a width less than `renderSideBySideInlineBreakpoint`, the inline view is used.889*/890useInlineViewWhenSpaceIsLimited?: boolean;891892/**893* If set, the diff editor is optimized for small views.894* Defaults to `false`.895*/896compactMode?: boolean;897898/**899* Timeout in milliseconds after which diff computation is cancelled.900* Defaults to 5000.901*/902maxComputationTime?: number;903904/**905* Maximum supported file size in MB.906* Defaults to 50.907*/908maxFileSize?: number;909910/**911* Compute the diff by ignoring leading/trailing whitespace912* Defaults to true.913*/914ignoreTrimWhitespace?: boolean;915916/**917* Render +/- indicators for added/deleted changes.918* Defaults to true.919*/920renderIndicators?: boolean;921922/**923* Shows icons in the glyph margin to revert changes.924* Default to true.925*/926renderMarginRevertIcon?: boolean;927928/**929* Indicates if the gutter menu should be rendered.930*/931renderGutterMenu?: boolean;932933/**934* Original model should be editable?935* Defaults to false.936*/937originalEditable?: boolean;938939/**940* Should the diff editor enable code lens?941* Defaults to false.942*/943diffCodeLens?: boolean;944945/**946* Is the diff editor should render overview ruler947* Defaults to true948*/949renderOverviewRuler?: boolean;950951/**952* Control the wrapping of the diff editor.953*/954diffWordWrap?: 'off' | 'on' | 'inherit';955956/**957* Diff Algorithm958*/959diffAlgorithm?: 'legacy' | 'advanced';960961/**962* Whether the diff editor aria label should be verbose.963*/964accessibilityVerbose?: boolean;965966experimental?: {967/**968* Defaults to false.969*/970showMoves?: boolean;971972showEmptyDecorations?: boolean;973974/**975* Only applies when `renderSideBySide` is set to false.976*/977useTrueInlineView?: boolean;978};979980/**981* Is the diff editor inside another editor982* Defaults to false983*/984isInEmbeddedEditor?: boolean;985986/**987* If the diff editor should only show the difference review mode.988*/989onlyShowAccessibleDiffViewer?: boolean;990991hideUnchangedRegions?: {992enabled?: boolean;993revealLineCount?: number;994minimumLineCount?: number;995contextLineCount?: number;996};997}998999/**1000* Configuration options for the diff editor.1001*/1002export interface IDiffEditorOptions extends IEditorOptions, IDiffEditorBaseOptions {1003}10041005/**1006* @internal1007*/1008export type ValidDiffEditorBaseOptions = Readonly<Required<IDiffEditorBaseOptions>>;10091010//#endregion10111012/**1013* An event describing that the configuration of the editor has changed.1014*/1015export class ConfigurationChangedEvent {1016private readonly _values: boolean[];1017/**1018* @internal1019*/1020constructor(values: boolean[]) {1021this._values = values;1022}1023public hasChanged(id: EditorOption): boolean {1024return this._values[id];1025}1026}10271028/**1029* All computed editor options.1030*/1031export interface IComputedEditorOptions {1032get<T extends EditorOption>(id: T): FindComputedEditorOptionValueById<T>;1033}10341035//#region IEditorOption10361037/**1038* @internal1039*/1040export interface IEnvironmentalOptions {1041readonly memory: ComputeOptionsMemory | null;1042readonly outerWidth: number;1043readonly outerHeight: number;1044readonly fontInfo: FontInfo;1045readonly extraEditorClassName: string;1046readonly isDominatedByLongLines: boolean;1047readonly viewLineCount: number;1048readonly lineNumbersDigitCount: number;1049readonly emptySelectionClipboard: boolean;1050readonly pixelRatio: number;1051readonly tabFocusMode: boolean;1052readonly inputMode: 'insert' | 'overtype';1053readonly accessibilitySupport: AccessibilitySupport;1054readonly glyphMarginDecorationLaneCount: number;1055readonly editContextSupported: boolean;1056}10571058/**1059* @internal1060*/1061export class ComputeOptionsMemory {10621063public stableMinimapLayoutInput: IMinimapLayoutInput | null;1064public stableFitMaxMinimapScale: number;1065public stableFitRemainingWidth: number;10661067constructor() {1068this.stableMinimapLayoutInput = null;1069this.stableFitMaxMinimapScale = 0;1070this.stableFitRemainingWidth = 0;1071}1072}10731074export interface IEditorOption<K extends EditorOption, V> {1075readonly id: K;1076readonly name: string;1077defaultValue: V;1078/**1079* @internal1080*/1081readonly schema: IConfigurationPropertySchema | { [path: string]: IConfigurationPropertySchema } | undefined;1082/**1083* @internal1084*/1085validate(input: unknown): V;1086/**1087* @internal1088*/1089compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: V): V;10901091/**1092* Might modify `value`.1093*/1094applyUpdate(value: V | undefined, update: V): ApplyUpdateResult<V>;1095}10961097/**1098* @internal1099*/1100type PossibleKeyName0<V> = { [K in keyof IEditorOptions]: IEditorOptions[K] extends V | undefined ? K : never }[keyof IEditorOptions];1101/**1102* @internal1103*/1104type PossibleKeyName<V> = NonNullable<PossibleKeyName0<V>>;11051106/**1107* @internal1108*/1109abstract class BaseEditorOption<K extends EditorOption, T, V> implements IEditorOption<K, V> {11101111public readonly id: K;1112public readonly name: string;1113public readonly defaultValue: V;1114public readonly schema: IConfigurationPropertySchema | { [path: string]: IConfigurationPropertySchema } | undefined;11151116constructor(id: K, name: PossibleKeyName<T>, defaultValue: V, schema?: IConfigurationPropertySchema | { [path: string]: IConfigurationPropertySchema }) {1117this.id = id;1118this.name = name;1119this.defaultValue = defaultValue;1120this.schema = schema;1121}11221123public applyUpdate(value: V | undefined, update: V): ApplyUpdateResult<V> {1124return applyUpdate(value, update);1125}11261127public abstract validate(input: unknown): V;11281129public compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: V): V {1130return value;1131}1132}11331134export class ApplyUpdateResult<T> {1135constructor(1136public readonly newValue: T,1137public readonly didChange: boolean1138) { }1139}11401141function applyUpdate<T>(value: T | undefined, update: T): ApplyUpdateResult<T> {1142if (typeof value !== 'object' || typeof update !== 'object' || !value || !update) {1143return new ApplyUpdateResult(update, value !== update);1144}1145if (Array.isArray(value) || Array.isArray(update)) {1146const arrayEquals = Array.isArray(value) && Array.isArray(update) && arrays.equals(value, update);1147return new ApplyUpdateResult(update, !arrayEquals);1148}1149let didChange = false;1150for (const key in update) {1151if (update.hasOwnProperty(key)) {1152const result = applyUpdate(value[key], update[key]);1153if (result.didChange) {1154value[key] = result.newValue;1155didChange = true;1156}1157}1158}1159return new ApplyUpdateResult(value, didChange);1160}11611162/**1163* @internal1164*/1165abstract class ComputedEditorOption<K extends EditorOption, V> implements IEditorOption<K, V> {11661167public readonly id: K;1168public readonly name: '_never_';1169public readonly defaultValue: V;1170public readonly schema: IConfigurationPropertySchema | undefined = undefined;11711172constructor(id: K, defaultValue: V) {1173this.id = id;1174this.name = '_never_';1175this.defaultValue = defaultValue;1176}11771178public applyUpdate(value: V | undefined, update: V): ApplyUpdateResult<V> {1179return applyUpdate(value, update);1180}11811182public validate(input: unknown): V {1183return this.defaultValue;1184}11851186public abstract compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: V): V;1187}11881189abstract class SimpleEditorOption<K extends EditorOption, V> implements IEditorOption<K, V> {11901191public readonly id: K;1192public readonly name: PossibleKeyName<V>;1193public readonly defaultValue: V;1194public readonly schema: IConfigurationPropertySchema | undefined;11951196constructor(id: K, name: PossibleKeyName<V>, defaultValue: V, schema?: IConfigurationPropertySchema) {1197this.id = id;1198this.name = name;1199this.defaultValue = defaultValue;1200this.schema = schema;1201}12021203public applyUpdate(value: V | undefined, update: V): ApplyUpdateResult<V> {1204return applyUpdate(value, update);1205}12061207public abstract validate(input: unknown): V;12081209public compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: V): V {1210return value;1211}1212}12131214/**1215* @internal1216*/1217export function boolean(value: unknown, defaultValue: boolean): boolean {1218if (typeof value === 'undefined') {1219return defaultValue;1220}1221if (value === 'false') {1222// treat the string 'false' as false1223return false;1224}1225return Boolean(value);1226}12271228class EditorBooleanOption<K extends EditorOption> extends SimpleEditorOption<K, boolean> {12291230constructor(id: K, name: PossibleKeyName<boolean>, defaultValue: boolean, schema: IConfigurationPropertySchema | undefined = undefined) {1231if (typeof schema !== 'undefined') {1232schema.type = 'boolean';1233schema.default = defaultValue;1234}1235super(id, name, defaultValue, schema);1236}12371238public override validate(input: unknown): boolean {1239return boolean(input, this.defaultValue);1240}1241}12421243/**1244* @internal1245*/1246export function clampedInt<T = number>(value: unknown, defaultValue: T, minimum: number, maximum: number): number | T {1247if (typeof value === 'string') {1248value = parseInt(value, 10);1249}1250if (typeof value !== 'number' || isNaN(value)) {1251return defaultValue;1252}1253let r = value;1254r = Math.max(minimum, r);1255r = Math.min(maximum, r);1256return r | 0;1257}12581259class EditorIntOption<K extends EditorOption> extends SimpleEditorOption<K, number> {12601261public static clampedInt<T>(value: unknown, defaultValue: T, minimum: number, maximum: number): number | T {1262return clampedInt(value, defaultValue, minimum, maximum);1263}12641265public readonly minimum: number;1266public readonly maximum: number;12671268constructor(id: K, name: PossibleKeyName<number>, defaultValue: number, minimum: number, maximum: number, schema: IConfigurationPropertySchema | undefined = undefined) {1269if (typeof schema !== 'undefined') {1270schema.type = 'integer';1271schema.default = defaultValue;1272schema.minimum = minimum;1273schema.maximum = maximum;1274}1275super(id, name, defaultValue, schema);1276this.minimum = minimum;1277this.maximum = maximum;1278}12791280public override validate(input: unknown): number {1281return EditorIntOption.clampedInt(input, this.defaultValue, this.minimum, this.maximum);1282}1283}1284/**1285* @internal1286*/1287export function clampedFloat<T extends number>(value: unknown, defaultValue: T, minimum: number, maximum: number): number | T {1288if (typeof value === 'undefined') {1289return defaultValue;1290}1291const r = EditorFloatOption.float(value, defaultValue);1292return EditorFloatOption.clamp(r, minimum, maximum);1293}12941295class EditorFloatOption<K extends EditorOption> extends SimpleEditorOption<K, number> {12961297public readonly minimum: number | undefined;1298public readonly maximum: number | undefined;12991300public static clamp(n: number, min: number, max: number): number {1301if (n < min) {1302return min;1303}1304if (n > max) {1305return max;1306}1307return n;1308}13091310public static float(value: unknown, defaultValue: number): number {1311if (typeof value === 'string') {1312value = parseFloat(value);1313}1314if (typeof value !== 'number' || isNaN(value)) {1315return defaultValue;1316}1317return value;1318}13191320public readonly validationFn: (value: number) => number;13211322constructor(id: K, name: PossibleKeyName<number>, defaultValue: number, validationFn: (value: number) => number, schema?: IConfigurationPropertySchema, minimum?: number, maximum?: number) {1323if (typeof schema !== 'undefined') {1324schema.type = 'number';1325schema.default = defaultValue;1326schema.minimum = minimum;1327schema.maximum = maximum;1328}1329super(id, name, defaultValue, schema);1330this.validationFn = validationFn;1331this.minimum = minimum;1332this.maximum = maximum;1333}13341335public override validate(input: unknown): number {1336return this.validationFn(EditorFloatOption.float(input, this.defaultValue));1337}1338}13391340class EditorStringOption<K extends EditorOption> extends SimpleEditorOption<K, string> {13411342public static string(value: unknown, defaultValue: string): string {1343if (typeof value !== 'string') {1344return defaultValue;1345}1346return value;1347}13481349constructor(id: K, name: PossibleKeyName<string>, defaultValue: string, schema: IConfigurationPropertySchema | undefined = undefined) {1350if (typeof schema !== 'undefined') {1351schema.type = 'string';1352schema.default = defaultValue;1353}1354super(id, name, defaultValue, schema);1355}13561357public override validate(input: unknown): string {1358return EditorStringOption.string(input, this.defaultValue);1359}1360}13611362/**1363* @internal1364*/1365export function stringSet<T extends string>(value: unknown, defaultValue: T, allowedValues: ReadonlyArray<T>, renamedValues?: Record<string, T>): T {1366if (typeof value !== 'string') {1367return defaultValue;1368}1369if (renamedValues && value in renamedValues) {1370return renamedValues[value];1371}1372if (allowedValues.indexOf(value as T) === -1) {1373return defaultValue;1374}1375return value as T;1376}13771378class EditorStringEnumOption<K extends EditorOption, V extends string> extends SimpleEditorOption<K, V> {13791380private readonly _allowedValues: ReadonlyArray<V>;13811382constructor(id: K, name: PossibleKeyName<V>, defaultValue: V, allowedValues: ReadonlyArray<V>, schema: IConfigurationPropertySchema | undefined = undefined) {1383if (typeof schema !== 'undefined') {1384schema.type = 'string';1385schema.enum = allowedValues.slice(0);1386schema.default = defaultValue;1387}1388super(id, name, defaultValue, schema);1389this._allowedValues = allowedValues;1390}13911392public override validate(input: unknown): V {1393return stringSet<V>(input, this.defaultValue, this._allowedValues);1394}1395}13961397class EditorEnumOption<K extends EditorOption, T extends string, V> extends BaseEditorOption<K, T, V> {13981399private readonly _allowedValues: T[];1400private readonly _convert: (value: T) => V;14011402constructor(id: K, name: PossibleKeyName<T>, defaultValue: V, defaultStringValue: string, allowedValues: T[], convert: (value: T) => V, schema: IConfigurationPropertySchema | undefined = undefined) {1403if (typeof schema !== 'undefined') {1404schema.type = 'string';1405schema.enum = allowedValues;1406schema.default = defaultStringValue;1407}1408super(id, name, defaultValue, schema);1409this._allowedValues = allowedValues;1410this._convert = convert;1411}14121413public validate(input: unknown): V {1414if (typeof input !== 'string') {1415return this.defaultValue;1416}1417if (this._allowedValues.indexOf(<T>input) === -1) {1418return this.defaultValue;1419}1420return this._convert(<T>input);1421}1422}14231424//#endregion14251426//#region autoIndent14271428function _autoIndentFromString(autoIndent: 'none' | 'keep' | 'brackets' | 'advanced' | 'full'): EditorAutoIndentStrategy {1429switch (autoIndent) {1430case 'none': return EditorAutoIndentStrategy.None;1431case 'keep': return EditorAutoIndentStrategy.Keep;1432case 'brackets': return EditorAutoIndentStrategy.Brackets;1433case 'advanced': return EditorAutoIndentStrategy.Advanced;1434case 'full': return EditorAutoIndentStrategy.Full;1435}1436}14371438//#endregion14391440//#region accessibilitySupport14411442class EditorAccessibilitySupport extends BaseEditorOption<EditorOption.accessibilitySupport, 'auto' | 'off' | 'on', AccessibilitySupport> {14431444constructor() {1445super(1446EditorOption.accessibilitySupport, 'accessibilitySupport', AccessibilitySupport.Unknown,1447{1448type: 'string',1449enum: ['auto', 'on', 'off'],1450enumDescriptions: [1451nls.localize('accessibilitySupport.auto', "Use platform APIs to detect when a Screen Reader is attached."),1452nls.localize('accessibilitySupport.on', "Optimize for usage with a Screen Reader."),1453nls.localize('accessibilitySupport.off', "Assume a screen reader is not attached."),1454],1455default: 'auto',1456tags: ['accessibility'],1457description: nls.localize('accessibilitySupport', "Controls if the UI should run in a mode where it is optimized for screen readers.")1458}1459);1460}14611462public validate(input: unknown): AccessibilitySupport {1463switch (input) {1464case 'auto': return AccessibilitySupport.Unknown;1465case 'off': return AccessibilitySupport.Disabled;1466case 'on': return AccessibilitySupport.Enabled;1467}1468return this.defaultValue;1469}14701471public override compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: AccessibilitySupport): AccessibilitySupport {1472if (value === AccessibilitySupport.Unknown) {1473// The editor reads the `accessibilitySupport` from the environment1474return env.accessibilitySupport;1475}1476return value;1477}1478}14791480//#endregion14811482//#region comments14831484/**1485* Configuration options for editor comments1486*/1487export interface IEditorCommentsOptions {1488/**1489* Insert a space after the line comment token and inside the block comments tokens.1490* Defaults to true.1491*/1492insertSpace?: boolean;1493/**1494* Ignore empty lines when inserting line comments.1495* Defaults to true.1496*/1497ignoreEmptyLines?: boolean;1498}14991500/**1501* @internal1502*/1503export type EditorCommentsOptions = Readonly<Required<IEditorCommentsOptions>>;15041505class EditorComments extends BaseEditorOption<EditorOption.comments, IEditorCommentsOptions, EditorCommentsOptions> {15061507constructor() {1508const defaults: EditorCommentsOptions = {1509insertSpace: true,1510ignoreEmptyLines: true,1511};1512super(1513EditorOption.comments, 'comments', defaults,1514{1515'editor.comments.insertSpace': {1516type: 'boolean',1517default: defaults.insertSpace,1518description: nls.localize('comments.insertSpace', "Controls whether a space character is inserted when commenting.")1519},1520'editor.comments.ignoreEmptyLines': {1521type: 'boolean',1522default: defaults.ignoreEmptyLines,1523description: nls.localize('comments.ignoreEmptyLines', 'Controls if empty lines should be ignored with toggle, add or remove actions for line comments.')1524},1525}1526);1527}15281529public validate(_input: unknown): EditorCommentsOptions {1530if (!_input || typeof _input !== 'object') {1531return this.defaultValue;1532}1533const input = _input as Unknown<IEditorCommentsOptions>;1534return {1535insertSpace: boolean(input.insertSpace, this.defaultValue.insertSpace),1536ignoreEmptyLines: boolean(input.ignoreEmptyLines, this.defaultValue.ignoreEmptyLines),1537};1538}1539}15401541//#endregion15421543//#region cursorBlinking15441545/**1546* The kind of animation in which the editor's cursor should be rendered.1547*/1548export const enum TextEditorCursorBlinkingStyle {1549/**1550* Hidden1551*/1552Hidden = 0,1553/**1554* Blinking1555*/1556Blink = 1,1557/**1558* Blinking with smooth fading1559*/1560Smooth = 2,1561/**1562* Blinking with prolonged filled state and smooth fading1563*/1564Phase = 3,1565/**1566* Expand collapse animation on the y axis1567*/1568Expand = 4,1569/**1570* No-Blinking1571*/1572Solid = 51573}15741575/**1576* @internal1577*/1578export function cursorBlinkingStyleFromString(cursorBlinkingStyle: 'blink' | 'smooth' | 'phase' | 'expand' | 'solid'): TextEditorCursorBlinkingStyle {1579switch (cursorBlinkingStyle) {1580case 'blink': return TextEditorCursorBlinkingStyle.Blink;1581case 'smooth': return TextEditorCursorBlinkingStyle.Smooth;1582case 'phase': return TextEditorCursorBlinkingStyle.Phase;1583case 'expand': return TextEditorCursorBlinkingStyle.Expand;1584case 'solid': return TextEditorCursorBlinkingStyle.Solid;1585}1586}15871588//#endregion15891590//#region cursorStyle15911592/**1593* The style in which the editor's cursor should be rendered.1594*/1595export enum TextEditorCursorStyle {1596/**1597* As a vertical line (sitting between two characters).1598*/1599Line = 1,1600/**1601* As a block (sitting on top of a character).1602*/1603Block = 2,1604/**1605* As a horizontal line (sitting under a character).1606*/1607Underline = 3,1608/**1609* As a thin vertical line (sitting between two characters).1610*/1611LineThin = 4,1612/**1613* As an outlined block (sitting on top of a character).1614*/1615BlockOutline = 5,1616/**1617* As a thin horizontal line (sitting under a character).1618*/1619UnderlineThin = 61620}16211622/**1623* @internal1624*/1625export function cursorStyleToString(cursorStyle: TextEditorCursorStyle): 'line' | 'block' | 'underline' | 'line-thin' | 'block-outline' | 'underline-thin' {1626switch (cursorStyle) {1627case TextEditorCursorStyle.Line: return 'line';1628case TextEditorCursorStyle.Block: return 'block';1629case TextEditorCursorStyle.Underline: return 'underline';1630case TextEditorCursorStyle.LineThin: return 'line-thin';1631case TextEditorCursorStyle.BlockOutline: return 'block-outline';1632case TextEditorCursorStyle.UnderlineThin: return 'underline-thin';1633}1634}16351636/**1637* @internal1638*/1639export function cursorStyleFromString(cursorStyle: 'line' | 'block' | 'underline' | 'line-thin' | 'block-outline' | 'underline-thin'): TextEditorCursorStyle {1640switch (cursorStyle) {1641case 'line': return TextEditorCursorStyle.Line;1642case 'block': return TextEditorCursorStyle.Block;1643case 'underline': return TextEditorCursorStyle.Underline;1644case 'line-thin': return TextEditorCursorStyle.LineThin;1645case 'block-outline': return TextEditorCursorStyle.BlockOutline;1646case 'underline-thin': return TextEditorCursorStyle.UnderlineThin;1647}1648}16491650//#endregion16511652//#region editorClassName16531654class EditorClassName extends ComputedEditorOption<EditorOption.editorClassName, string> {16551656constructor() {1657super(EditorOption.editorClassName, '');1658}16591660public compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, _: string): string {1661const classNames = ['monaco-editor'];1662if (options.get(EditorOption.extraEditorClassName)) {1663classNames.push(options.get(EditorOption.extraEditorClassName));1664}1665if (env.extraEditorClassName) {1666classNames.push(env.extraEditorClassName);1667}1668if (options.get(EditorOption.mouseStyle) === 'default') {1669classNames.push('mouse-default');1670} else if (options.get(EditorOption.mouseStyle) === 'copy') {1671classNames.push('mouse-copy');1672}16731674if (options.get(EditorOption.showUnused)) {1675classNames.push('showUnused');1676}16771678if (options.get(EditorOption.showDeprecated)) {1679classNames.push('showDeprecated');1680}16811682return classNames.join(' ');1683}1684}16851686//#endregion16871688//#region emptySelectionClipboard16891690class EditorEmptySelectionClipboard extends EditorBooleanOption<EditorOption.emptySelectionClipboard> {16911692constructor() {1693super(1694EditorOption.emptySelectionClipboard, 'emptySelectionClipboard', true,1695{ description: nls.localize('emptySelectionClipboard', "Controls whether copying without a selection copies the current line.") }1696);1697}16981699public override compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: boolean): boolean {1700return value && env.emptySelectionClipboard;1701}1702}17031704//#endregion17051706//#region find17071708/**1709* Configuration options for editor find widget1710*/1711export interface IEditorFindOptions {1712/**1713* Controls whether the cursor should move to find matches while typing.1714*/1715cursorMoveOnType?: boolean;1716/**1717* Controls whether the find widget should search as you type.1718*/1719findOnType?: boolean;1720/**1721* Controls if we seed search string in the Find Widget with editor selection.1722*/1723seedSearchStringFromSelection?: 'never' | 'always' | 'selection';1724/**1725* Controls if Find in Selection flag is turned on in the editor.1726*/1727autoFindInSelection?: 'never' | 'always' | 'multiline';1728/*1729* Controls whether the Find Widget should add extra lines on top of the editor.1730*/1731addExtraSpaceOnTop?: boolean;1732/**1733* @internal1734* Controls if the Find Widget should read or modify the shared find clipboard on macOS1735*/1736globalFindClipboard?: boolean;1737/**1738* Controls whether the search result and diff result automatically restarts from the beginning (or the end) when no further matches can be found1739*/1740loop?: boolean;1741/**1742* @internal1743* Controls how the find widget search history should be stored1744*/1745history?: 'never' | 'workspace';1746/**1747* @internal1748* Controls how the replace widget search history should be stored1749*/1750replaceHistory?: 'never' | 'workspace';1751}17521753/**1754* @internal1755*/1756export type EditorFindOptions = Readonly<Required<IEditorFindOptions>>;17571758class EditorFind extends BaseEditorOption<EditorOption.find, IEditorFindOptions, EditorFindOptions> {17591760constructor() {1761const defaults: EditorFindOptions = {1762cursorMoveOnType: true,1763findOnType: true,1764seedSearchStringFromSelection: 'always',1765autoFindInSelection: 'never',1766globalFindClipboard: false,1767addExtraSpaceOnTop: true,1768loop: true,1769history: 'workspace',1770replaceHistory: 'workspace',1771};1772super(1773EditorOption.find, 'find', defaults,1774{1775'editor.find.cursorMoveOnType': {1776type: 'boolean',1777default: defaults.cursorMoveOnType,1778description: nls.localize('find.cursorMoveOnType', "Controls whether the cursor should jump to find matches while typing.")1779},1780'editor.find.seedSearchStringFromSelection': {1781type: 'string',1782enum: ['never', 'always', 'selection'],1783default: defaults.seedSearchStringFromSelection,1784enumDescriptions: [1785nls.localize('editor.find.seedSearchStringFromSelection.never', 'Never seed search string from the editor selection.'),1786nls.localize('editor.find.seedSearchStringFromSelection.always', 'Always seed search string from the editor selection, including word at cursor position.'),1787nls.localize('editor.find.seedSearchStringFromSelection.selection', 'Only seed search string from the editor selection.')1788],1789description: nls.localize('find.seedSearchStringFromSelection', "Controls whether the search string in the Find Widget is seeded from the editor selection.")1790},1791'editor.find.autoFindInSelection': {1792type: 'string',1793enum: ['never', 'always', 'multiline'],1794default: defaults.autoFindInSelection,1795enumDescriptions: [1796nls.localize('editor.find.autoFindInSelection.never', 'Never turn on Find in Selection automatically (default).'),1797nls.localize('editor.find.autoFindInSelection.always', 'Always turn on Find in Selection automatically.'),1798nls.localize('editor.find.autoFindInSelection.multiline', 'Turn on Find in Selection automatically when multiple lines of content are selected.')1799],1800description: nls.localize('find.autoFindInSelection', "Controls the condition for turning on Find in Selection automatically.")1801},1802'editor.find.globalFindClipboard': {1803type: 'boolean',1804default: defaults.globalFindClipboard,1805description: nls.localize('find.globalFindClipboard', "Controls whether the Find Widget should read or modify the shared find clipboard on macOS."),1806included: platform.isMacintosh1807},1808'editor.find.addExtraSpaceOnTop': {1809type: 'boolean',1810default: defaults.addExtraSpaceOnTop,1811description: nls.localize('find.addExtraSpaceOnTop', "Controls whether the Find Widget should add extra lines on top of the editor. When true, you can scroll beyond the first line when the Find Widget is visible.")1812},1813'editor.find.loop': {1814type: 'boolean',1815default: defaults.loop,1816description: nls.localize('find.loop', "Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.")1817},1818'editor.find.history': {1819type: 'string',1820enum: ['never', 'workspace'],1821default: 'workspace',1822enumDescriptions: [1823nls.localize('editor.find.history.never', 'Do not store search history from the find widget.'),1824nls.localize('editor.find.history.workspace', 'Store search history across the active workspace'),1825],1826description: nls.localize('find.history', "Controls how the find widget history should be stored")1827},1828'editor.find.replaceHistory': {1829type: 'string',1830enum: ['never', 'workspace'],1831default: 'workspace',1832enumDescriptions: [1833nls.localize('editor.find.replaceHistory.never', 'Do not store history from the replace widget.'),1834nls.localize('editor.find.replaceHistory.workspace', 'Store replace history across the active workspace'),1835],1836description: nls.localize('find.replaceHistory', "Controls how the replace widget history should be stored")1837},1838'editor.find.findOnType': {1839type: 'boolean',1840default: defaults.findOnType,1841description: nls.localize('find.findOnType', "Controls whether the Find Widget should search as you type.")1842},1843}1844);1845}18461847public validate(_input: unknown): EditorFindOptions {1848if (!_input || typeof _input !== 'object') {1849return this.defaultValue;1850}1851const input = _input as Unknown<IEditorFindOptions>;1852return {1853cursorMoveOnType: boolean(input.cursorMoveOnType, this.defaultValue.cursorMoveOnType),1854findOnType: boolean(input.findOnType, this.defaultValue.findOnType),1855seedSearchStringFromSelection: typeof input.seedSearchStringFromSelection === 'boolean'1856? (input.seedSearchStringFromSelection ? 'always' : 'never')1857: stringSet<'never' | 'always' | 'selection'>(input.seedSearchStringFromSelection, this.defaultValue.seedSearchStringFromSelection, ['never', 'always', 'selection']),1858autoFindInSelection: typeof input.autoFindInSelection === 'boolean'1859? (input.autoFindInSelection ? 'always' : 'never')1860: stringSet<'never' | 'always' | 'multiline'>(input.autoFindInSelection, this.defaultValue.autoFindInSelection, ['never', 'always', 'multiline']),1861globalFindClipboard: boolean(input.globalFindClipboard, this.defaultValue.globalFindClipboard),1862addExtraSpaceOnTop: boolean(input.addExtraSpaceOnTop, this.defaultValue.addExtraSpaceOnTop),1863loop: boolean(input.loop, this.defaultValue.loop),1864history: stringSet<'never' | 'workspace'>(input.history, this.defaultValue.history, ['never', 'workspace']),1865replaceHistory: stringSet<'never' | 'workspace'>(input.replaceHistory, this.defaultValue.replaceHistory, ['never', 'workspace']),1866};1867}1868}18691870//#endregion18711872//#region fontLigatures18731874/**1875* @internal1876*/1877export class EditorFontLigatures extends BaseEditorOption<EditorOption.fontLigatures, boolean | string, string> {18781879public static OFF = '"liga" off, "calt" off';1880public static ON = '"liga" on, "calt" on';18811882constructor() {1883super(1884EditorOption.fontLigatures, 'fontLigatures', EditorFontLigatures.OFF,1885{1886anyOf: [1887{1888type: 'boolean',1889description: nls.localize('fontLigatures', "Enables/Disables font ligatures ('calt' and 'liga' font features). Change this to a string for fine-grained control of the 'font-feature-settings' CSS property."),1890},1891{1892type: 'string',1893description: nls.localize('fontFeatureSettings', "Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.")1894}1895],1896description: nls.localize('fontLigaturesGeneral', "Configures font ligatures or font features. Can be either a boolean to enable/disable ligatures or a string for the value of the CSS 'font-feature-settings' property."),1897default: false1898}1899);1900}19011902public validate(input: unknown): string {1903if (typeof input === 'undefined') {1904return this.defaultValue;1905}1906if (typeof input === 'string') {1907if (input === 'false' || input.length === 0) {1908return EditorFontLigatures.OFF;1909}1910if (input === 'true') {1911return EditorFontLigatures.ON;1912}1913return input;1914}1915if (Boolean(input)) {1916return EditorFontLigatures.ON;1917}1918return EditorFontLigatures.OFF;1919}1920}19211922//#endregion19231924//#region fontVariations19251926/**1927* @internal1928*/1929export class EditorFontVariations extends BaseEditorOption<EditorOption.fontVariations, boolean | string, string> {1930// Text is laid out using default settings.1931public static OFF = FONT_VARIATION_OFF;19321933// Translate `fontWeight` config to the `font-variation-settings` CSS property.1934public static TRANSLATE = FONT_VARIATION_TRANSLATE;19351936constructor() {1937super(1938EditorOption.fontVariations, 'fontVariations', EditorFontVariations.OFF,1939{1940anyOf: [1941{1942type: 'boolean',1943description: nls.localize('fontVariations', "Enables/Disables the translation from font-weight to font-variation-settings. Change this to a string for fine-grained control of the 'font-variation-settings' CSS property."),1944},1945{1946type: 'string',1947description: nls.localize('fontVariationSettings', "Explicit 'font-variation-settings' CSS property. A boolean can be passed instead if one only needs to translate font-weight to font-variation-settings.")1948}1949],1950description: nls.localize('fontVariationsGeneral', "Configures font variations. Can be either a boolean to enable/disable the translation from font-weight to font-variation-settings or a string for the value of the CSS 'font-variation-settings' property."),1951default: false1952}1953);1954}19551956public validate(input: unknown): string {1957if (typeof input === 'undefined') {1958return this.defaultValue;1959}1960if (typeof input === 'string') {1961if (input === 'false') {1962return EditorFontVariations.OFF;1963}1964if (input === 'true') {1965return EditorFontVariations.TRANSLATE;1966}1967return input;1968}1969if (Boolean(input)) {1970return EditorFontVariations.TRANSLATE;1971}1972return EditorFontVariations.OFF;1973}19741975public override compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: string): string {1976// The value is computed from the fontWeight if it is true.1977// So take the result from env.fontInfo1978return env.fontInfo.fontVariationSettings;1979}1980}19811982//#endregion19831984//#region fontInfo19851986class EditorFontInfo extends ComputedEditorOption<EditorOption.fontInfo, FontInfo> {19871988constructor() {1989super(EditorOption.fontInfo, new FontInfo({1990pixelRatio: 0,1991fontFamily: '',1992fontWeight: '',1993fontSize: 0,1994fontFeatureSettings: '',1995fontVariationSettings: '',1996lineHeight: 0,1997letterSpacing: 0,1998isMonospace: false,1999typicalHalfwidthCharacterWidth: 0,2000typicalFullwidthCharacterWidth: 0,2001canUseHalfwidthRightwardsArrow: false,2002spaceWidth: 0,2003middotWidth: 0,2004wsmiddotWidth: 0,2005maxDigitWidth: 0,2006}, false));2007}20082009public compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, _: FontInfo): FontInfo {2010return env.fontInfo;2011}2012}20132014//#endregion20152016//#region effectiveCursorStyle20172018class EffectiveCursorStyle extends ComputedEditorOption<EditorOption.effectiveCursorStyle, TextEditorCursorStyle> {20192020constructor() {2021super(EditorOption.effectiveCursorStyle, TextEditorCursorStyle.Line);2022}20232024public compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, _: TextEditorCursorStyle): TextEditorCursorStyle {2025return env.inputMode === 'overtype' ?2026options.get(EditorOption.overtypeCursorStyle) :2027options.get(EditorOption.cursorStyle);2028}2029}20302031//#endregion20322033//#region effectiveExperimentalEditContext20342035class EffectiveEditContextEnabled extends ComputedEditorOption<EditorOption.effectiveEditContext, boolean> {20362037constructor() {2038super(EditorOption.effectiveEditContext, false);2039}20402041public compute(env: IEnvironmentalOptions, options: IComputedEditorOptions): boolean {2042return env.editContextSupported && options.get(EditorOption.editContext);2043}2044}20452046//#endregion20472048//#region effectiveAllowVariableFonts20492050class EffectiveAllowVariableFonts extends ComputedEditorOption<EditorOption.effectiveAllowVariableFonts, boolean> {20512052constructor() {2053super(EditorOption.effectiveAllowVariableFonts, false);2054}20552056public compute(env: IEnvironmentalOptions, options: IComputedEditorOptions): boolean {2057const accessibilitySupport = env.accessibilitySupport;2058if (accessibilitySupport === AccessibilitySupport.Enabled) {2059return options.get(EditorOption.allowVariableFontsInAccessibilityMode);2060} else {2061return options.get(EditorOption.allowVariableFonts);2062}2063}2064}20652066//#engregion20672068//#region fontSize20692070class EditorFontSize extends SimpleEditorOption<EditorOption.fontSize, number> {20712072constructor() {2073super(2074EditorOption.fontSize, 'fontSize', EDITOR_FONT_DEFAULTS.fontSize,2075{2076type: 'number',2077minimum: 6,2078maximum: 100,2079default: EDITOR_FONT_DEFAULTS.fontSize,2080description: nls.localize('fontSize', "Controls the font size in pixels.")2081}2082);2083}20842085public override validate(input: unknown): number {2086const r = EditorFloatOption.float(input, this.defaultValue);2087if (r === 0) {2088return EDITOR_FONT_DEFAULTS.fontSize;2089}2090return EditorFloatOption.clamp(r, 6, 100);2091}2092public override compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: number): number {2093// The final fontSize respects the editor zoom level.2094// So take the result from env.fontInfo2095return env.fontInfo.fontSize;2096}2097}20982099//#endregion21002101//#region fontWeight21022103class EditorFontWeight extends BaseEditorOption<EditorOption.fontWeight, string, string> {2104private static SUGGESTION_VALUES = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];2105private static MINIMUM_VALUE = 1;2106private static MAXIMUM_VALUE = 1000;21072108constructor() {2109super(2110EditorOption.fontWeight, 'fontWeight', EDITOR_FONT_DEFAULTS.fontWeight,2111{2112anyOf: [2113{2114type: 'number',2115minimum: EditorFontWeight.MINIMUM_VALUE,2116maximum: EditorFontWeight.MAXIMUM_VALUE,2117errorMessage: nls.localize('fontWeightErrorMessage', "Only \"normal\" and \"bold\" keywords or numbers between 1 and 1000 are allowed.")2118},2119{2120type: 'string',2121pattern: '^(normal|bold|1000|[1-9][0-9]{0,2})$'2122},2123{2124enum: EditorFontWeight.SUGGESTION_VALUES2125}2126],2127default: EDITOR_FONT_DEFAULTS.fontWeight,2128description: nls.localize('fontWeight', "Controls the font weight. Accepts \"normal\" and \"bold\" keywords or numbers between 1 and 1000.")2129}2130);2131}21322133public validate(input: unknown): string {2134if (input === 'normal' || input === 'bold') {2135return input;2136}2137return String(EditorIntOption.clampedInt(input, EDITOR_FONT_DEFAULTS.fontWeight, EditorFontWeight.MINIMUM_VALUE, EditorFontWeight.MAXIMUM_VALUE));2138}2139}21402141//#endregion21422143//#region gotoLocation21442145export type GoToLocationValues = 'peek' | 'gotoAndPeek' | 'goto';21462147/**2148* Configuration options for go to location2149*/2150export interface IGotoLocationOptions {21512152multiple?: GoToLocationValues;21532154multipleDefinitions?: GoToLocationValues;2155multipleTypeDefinitions?: GoToLocationValues;2156multipleDeclarations?: GoToLocationValues;2157multipleImplementations?: GoToLocationValues;2158multipleReferences?: GoToLocationValues;2159multipleTests?: GoToLocationValues;21602161alternativeDefinitionCommand?: string;2162alternativeTypeDefinitionCommand?: string;2163alternativeDeclarationCommand?: string;2164alternativeImplementationCommand?: string;2165alternativeReferenceCommand?: string;2166alternativeTestsCommand?: string;2167}21682169/**2170* @internal2171*/2172export type GoToLocationOptions = Readonly<Required<IGotoLocationOptions>>;21732174class EditorGoToLocation extends BaseEditorOption<EditorOption.gotoLocation, IGotoLocationOptions, GoToLocationOptions> {21752176constructor() {2177const defaults: GoToLocationOptions = {2178multiple: 'peek',2179multipleDefinitions: 'peek',2180multipleTypeDefinitions: 'peek',2181multipleDeclarations: 'peek',2182multipleImplementations: 'peek',2183multipleReferences: 'peek',2184multipleTests: 'peek',2185alternativeDefinitionCommand: 'editor.action.goToReferences',2186alternativeTypeDefinitionCommand: 'editor.action.goToReferences',2187alternativeDeclarationCommand: 'editor.action.goToReferences',2188alternativeImplementationCommand: '',2189alternativeReferenceCommand: '',2190alternativeTestsCommand: '',2191};2192const jsonSubset: IJSONSchema = {2193type: 'string',2194enum: ['peek', 'gotoAndPeek', 'goto'],2195default: defaults.multiple,2196enumDescriptions: [2197nls.localize('editor.gotoLocation.multiple.peek', 'Show Peek view of the results (default)'),2198nls.localize('editor.gotoLocation.multiple.gotoAndPeek', 'Go to the primary result and show a Peek view'),2199nls.localize('editor.gotoLocation.multiple.goto', 'Go to the primary result and enable Peek-less navigation to others')2200]2201};2202const alternativeCommandOptions = ['', 'editor.action.referenceSearch.trigger', 'editor.action.goToReferences', 'editor.action.peekImplementation', 'editor.action.goToImplementation', 'editor.action.peekTypeDefinition', 'editor.action.goToTypeDefinition', 'editor.action.peekDeclaration', 'editor.action.revealDeclaration', 'editor.action.peekDefinition', 'editor.action.revealDefinitionAside', 'editor.action.revealDefinition'];2203super(2204EditorOption.gotoLocation, 'gotoLocation', defaults,2205{2206'editor.gotoLocation.multiple': {2207deprecationMessage: nls.localize('editor.gotoLocation.multiple.deprecated', "This setting is deprecated, please use separate settings like 'editor.editor.gotoLocation.multipleDefinitions' or 'editor.editor.gotoLocation.multipleImplementations' instead."),2208},2209'editor.gotoLocation.multipleDefinitions': {2210description: nls.localize('editor.editor.gotoLocation.multipleDefinitions', "Controls the behavior the 'Go to Definition'-command when multiple target locations exist."),2211...jsonSubset,2212},2213'editor.gotoLocation.multipleTypeDefinitions': {2214description: nls.localize('editor.editor.gotoLocation.multipleTypeDefinitions', "Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist."),2215...jsonSubset,2216},2217'editor.gotoLocation.multipleDeclarations': {2218description: nls.localize('editor.editor.gotoLocation.multipleDeclarations', "Controls the behavior the 'Go to Declaration'-command when multiple target locations exist."),2219...jsonSubset,2220},2221'editor.gotoLocation.multipleImplementations': {2222description: nls.localize('editor.editor.gotoLocation.multipleImplemenattions', "Controls the behavior the 'Go to Implementations'-command when multiple target locations exist."),2223...jsonSubset,2224},2225'editor.gotoLocation.multipleReferences': {2226description: nls.localize('editor.editor.gotoLocation.multipleReferences', "Controls the behavior the 'Go to References'-command when multiple target locations exist."),2227...jsonSubset,2228},2229'editor.gotoLocation.alternativeDefinitionCommand': {2230type: 'string',2231default: defaults.alternativeDefinitionCommand,2232enum: alternativeCommandOptions,2233description: nls.localize('alternativeDefinitionCommand', "Alternative command id that is being executed when the result of 'Go to Definition' is the current location.")2234},2235'editor.gotoLocation.alternativeTypeDefinitionCommand': {2236type: 'string',2237default: defaults.alternativeTypeDefinitionCommand,2238enum: alternativeCommandOptions,2239description: nls.localize('alternativeTypeDefinitionCommand', "Alternative command id that is being executed when the result of 'Go to Type Definition' is the current location.")2240},2241'editor.gotoLocation.alternativeDeclarationCommand': {2242type: 'string',2243default: defaults.alternativeDeclarationCommand,2244enum: alternativeCommandOptions,2245description: nls.localize('alternativeDeclarationCommand', "Alternative command id that is being executed when the result of 'Go to Declaration' is the current location.")2246},2247'editor.gotoLocation.alternativeImplementationCommand': {2248type: 'string',2249default: defaults.alternativeImplementationCommand,2250enum: alternativeCommandOptions,2251description: nls.localize('alternativeImplementationCommand', "Alternative command id that is being executed when the result of 'Go to Implementation' is the current location.")2252},2253'editor.gotoLocation.alternativeReferenceCommand': {2254type: 'string',2255default: defaults.alternativeReferenceCommand,2256enum: alternativeCommandOptions,2257description: nls.localize('alternativeReferenceCommand', "Alternative command id that is being executed when the result of 'Go to Reference' is the current location.")2258},2259}2260);2261}22622263public validate(_input: unknown): GoToLocationOptions {2264if (!_input || typeof _input !== 'object') {2265return this.defaultValue;2266}2267const input = _input as Unknown<IGotoLocationOptions>;2268return {2269multiple: stringSet<GoToLocationValues>(input.multiple, this.defaultValue.multiple, ['peek', 'gotoAndPeek', 'goto']),2270multipleDefinitions: stringSet<GoToLocationValues>(input.multipleDefinitions, 'peek', ['peek', 'gotoAndPeek', 'goto']),2271multipleTypeDefinitions: stringSet<GoToLocationValues>(input.multipleTypeDefinitions, 'peek', ['peek', 'gotoAndPeek', 'goto']),2272multipleDeclarations: stringSet<GoToLocationValues>(input.multipleDeclarations, 'peek', ['peek', 'gotoAndPeek', 'goto']),2273multipleImplementations: stringSet<GoToLocationValues>(input.multipleImplementations, 'peek', ['peek', 'gotoAndPeek', 'goto']),2274multipleReferences: stringSet<GoToLocationValues>(input.multipleReferences, 'peek', ['peek', 'gotoAndPeek', 'goto']),2275multipleTests: stringSet<GoToLocationValues>(input.multipleTests, 'peek', ['peek', 'gotoAndPeek', 'goto']),2276alternativeDefinitionCommand: EditorStringOption.string(input.alternativeDefinitionCommand, this.defaultValue.alternativeDefinitionCommand),2277alternativeTypeDefinitionCommand: EditorStringOption.string(input.alternativeTypeDefinitionCommand, this.defaultValue.alternativeTypeDefinitionCommand),2278alternativeDeclarationCommand: EditorStringOption.string(input.alternativeDeclarationCommand, this.defaultValue.alternativeDeclarationCommand),2279alternativeImplementationCommand: EditorStringOption.string(input.alternativeImplementationCommand, this.defaultValue.alternativeImplementationCommand),2280alternativeReferenceCommand: EditorStringOption.string(input.alternativeReferenceCommand, this.defaultValue.alternativeReferenceCommand),2281alternativeTestsCommand: EditorStringOption.string(input.alternativeTestsCommand, this.defaultValue.alternativeTestsCommand),2282};2283}2284}22852286//#endregion22872288//#region hover22892290/**2291* Configuration options for editor hover2292*/2293export interface IEditorHoverOptions {2294/**2295* Enable the hover.2296* Defaults to 'on'.2297*/2298enabled?: 'on' | 'off' | 'onKeyboardModifier';2299/**2300* Delay for showing the hover.2301* Defaults to 300.2302*/2303delay?: number;2304/**2305* Is the hover sticky such that it can be clicked and its contents selected?2306* Defaults to true.2307*/2308sticky?: boolean;2309/**2310* Controls how long the hover is visible after you hovered out of it.2311* Require sticky setting to be true.2312*/2313hidingDelay?: number;2314/**2315* Should the hover be shown above the line if possible?2316* Defaults to false.2317*/2318above?: boolean;2319}23202321/**2322* @internal2323*/2324export type EditorHoverOptions = Readonly<Required<IEditorHoverOptions>>;23252326class EditorHover extends BaseEditorOption<EditorOption.hover, IEditorHoverOptions, EditorHoverOptions> {23272328constructor() {2329const defaults: EditorHoverOptions = {2330enabled: 'on',2331delay: 300,2332hidingDelay: 300,2333sticky: true,2334above: true,2335};2336super(2337EditorOption.hover, 'hover', defaults,2338{2339'editor.hover.enabled': {2340type: 'string',2341enum: ['on', 'off', 'onKeyboardModifier'],2342default: defaults.enabled,2343markdownEnumDescriptions: [2344nls.localize('hover.enabled.on', "Hover is enabled."),2345nls.localize('hover.enabled.off', "Hover is disabled."),2346nls.localize('hover.enabled.onKeyboardModifier', "Hover is shown when holding `{0}` or `Alt` (the opposite modifier of `#editor.multiCursorModifier#`)", platform.isMacintosh ? `Command` : `Control`)2347],2348description: nls.localize('hover.enabled', "Controls whether the hover is shown.")2349},2350'editor.hover.delay': {2351type: 'number',2352default: defaults.delay,2353minimum: 0,2354maximum: 10000,2355description: nls.localize('hover.delay', "Controls the delay in milliseconds after which the hover is shown.")2356},2357'editor.hover.sticky': {2358type: 'boolean',2359default: defaults.sticky,2360description: nls.localize('hover.sticky', "Controls whether the hover should remain visible when mouse is moved over it.")2361},2362'editor.hover.hidingDelay': {2363type: 'integer',2364minimum: 0,2365default: defaults.hidingDelay,2366markdownDescription: nls.localize('hover.hidingDelay', "Controls the delay in milliseconds after which the hover is hidden. Requires `#editor.hover.sticky#` to be enabled.")2367},2368'editor.hover.above': {2369type: 'boolean',2370default: defaults.above,2371description: nls.localize('hover.above', "Prefer showing hovers above the line, if there's space.")2372},2373}2374);2375}23762377public validate(_input: unknown): EditorHoverOptions {2378if (!_input || typeof _input !== 'object') {2379return this.defaultValue;2380}2381const input = _input as Unknown<IEditorHoverOptions>;2382return {2383enabled: stringSet<'on' | 'off' | 'onKeyboardModifier'>(input.enabled, this.defaultValue.enabled, ['on', 'off', 'onKeyboardModifier']),2384delay: EditorIntOption.clampedInt(input.delay, this.defaultValue.delay, 0, 10000),2385sticky: boolean(input.sticky, this.defaultValue.sticky),2386hidingDelay: EditorIntOption.clampedInt(input.hidingDelay, this.defaultValue.hidingDelay, 0, 600000),2387above: boolean(input.above, this.defaultValue.above),2388};2389}2390}23912392//#endregion23932394//#region layoutInfo23952396/**2397* A description for the overview ruler position.2398*/2399export interface OverviewRulerPosition {2400/**2401* Width of the overview ruler2402*/2403readonly width: number;2404/**2405* Height of the overview ruler2406*/2407readonly height: number;2408/**2409* Top position for the overview ruler2410*/2411readonly top: number;2412/**2413* Right position for the overview ruler2414*/2415readonly right: number;2416}24172418export const enum RenderMinimap {2419None = 0,2420Text = 1,2421Blocks = 2,2422}24232424/**2425* The internal layout details of the editor.2426*/2427export interface EditorLayoutInfo {24282429/**2430* Full editor width.2431*/2432readonly width: number;2433/**2434* Full editor height.2435*/2436readonly height: number;24372438/**2439* Left position for the glyph margin.2440*/2441readonly glyphMarginLeft: number;2442/**2443* The width of the glyph margin.2444*/2445readonly glyphMarginWidth: number;24462447/**2448* The number of decoration lanes to render in the glyph margin.2449*/2450readonly glyphMarginDecorationLaneCount: number;24512452/**2453* Left position for the line numbers.2454*/2455readonly lineNumbersLeft: number;2456/**2457* The width of the line numbers.2458*/2459readonly lineNumbersWidth: number;24602461/**2462* Left position for the line decorations.2463*/2464readonly decorationsLeft: number;2465/**2466* The width of the line decorations.2467*/2468readonly decorationsWidth: number;24692470/**2471* Left position for the content (actual text)2472*/2473readonly contentLeft: number;2474/**2475* The width of the content (actual text)2476*/2477readonly contentWidth: number;24782479/**2480* Layout information for the minimap2481*/2482readonly minimap: EditorMinimapLayoutInfo;24832484/**2485* The number of columns (of typical characters) fitting on a viewport line.2486*/2487readonly viewportColumn: number;24882489readonly isWordWrapMinified: boolean;2490readonly isViewportWrapping: boolean;2491readonly wrappingColumn: number;24922493/**2494* The width of the vertical scrollbar.2495*/2496readonly verticalScrollbarWidth: number;2497/**2498* The height of the horizontal scrollbar.2499*/2500readonly horizontalScrollbarHeight: number;25012502/**2503* The position of the overview ruler.2504*/2505readonly overviewRuler: OverviewRulerPosition;2506}25072508/**2509* The internal layout details of the editor.2510*/2511export interface EditorMinimapLayoutInfo {2512readonly renderMinimap: RenderMinimap;2513readonly minimapLeft: number;2514readonly minimapWidth: number;2515readonly minimapHeightIsEditorHeight: boolean;2516readonly minimapIsSampling: boolean;2517readonly minimapScale: number;2518readonly minimapLineHeight: number;2519readonly minimapCanvasInnerWidth: number;2520readonly minimapCanvasInnerHeight: number;2521readonly minimapCanvasOuterWidth: number;2522readonly minimapCanvasOuterHeight: number;2523}25242525/**2526* @internal2527*/2528export interface EditorLayoutInfoComputerEnv {2529readonly memory: ComputeOptionsMemory | null;2530readonly outerWidth: number;2531readonly outerHeight: number;2532readonly isDominatedByLongLines: boolean;2533readonly lineHeight: number;2534readonly viewLineCount: number;2535readonly lineNumbersDigitCount: number;2536readonly typicalHalfwidthCharacterWidth: number;2537readonly maxDigitWidth: number;2538readonly pixelRatio: number;2539readonly glyphMarginDecorationLaneCount: number;2540}25412542/**2543* @internal2544*/2545export interface IEditorLayoutComputerInput {2546readonly outerWidth: number;2547readonly outerHeight: number;2548readonly isDominatedByLongLines: boolean;2549readonly lineHeight: number;2550readonly lineNumbersDigitCount: number;2551readonly typicalHalfwidthCharacterWidth: number;2552readonly maxDigitWidth: number;2553readonly pixelRatio: number;2554readonly glyphMargin: boolean;2555readonly lineDecorationsWidth: string | number;2556readonly folding: boolean;2557readonly minimap: Readonly<Required<IEditorMinimapOptions>>;2558readonly scrollbar: InternalEditorScrollbarOptions;2559readonly lineNumbers: InternalEditorRenderLineNumbersOptions;2560readonly lineNumbersMinChars: number;2561readonly scrollBeyondLastLine: boolean;2562readonly wordWrap: 'wordWrapColumn' | 'on' | 'off' | 'bounded';2563readonly wordWrapColumn: number;2564readonly wordWrapMinified: boolean;2565readonly accessibilitySupport: AccessibilitySupport;2566}25672568/**2569* @internal2570*/2571export interface IMinimapLayoutInput {2572readonly outerWidth: number;2573readonly outerHeight: number;2574readonly lineHeight: number;2575readonly typicalHalfwidthCharacterWidth: number;2576readonly pixelRatio: number;2577readonly scrollBeyondLastLine: boolean;2578readonly paddingTop: number;2579readonly paddingBottom: number;2580readonly minimap: Readonly<Required<IEditorMinimapOptions>>;2581readonly verticalScrollbarWidth: number;2582readonly viewLineCount: number;2583readonly remainingWidth: number;2584readonly isViewportWrapping: boolean;2585}25862587/**2588* @internal2589*/2590export class EditorLayoutInfoComputer extends ComputedEditorOption<EditorOption.layoutInfo, EditorLayoutInfo> {25912592constructor() {2593super(EditorOption.layoutInfo, {2594width: 0,2595height: 0,2596glyphMarginLeft: 0,2597glyphMarginWidth: 0,2598glyphMarginDecorationLaneCount: 0,2599lineNumbersLeft: 0,2600lineNumbersWidth: 0,2601decorationsLeft: 0,2602decorationsWidth: 0,2603contentLeft: 0,2604contentWidth: 0,2605minimap: {2606renderMinimap: RenderMinimap.None,2607minimapLeft: 0,2608minimapWidth: 0,2609minimapHeightIsEditorHeight: false,2610minimapIsSampling: false,2611minimapScale: 1,2612minimapLineHeight: 1,2613minimapCanvasInnerWidth: 0,2614minimapCanvasInnerHeight: 0,2615minimapCanvasOuterWidth: 0,2616minimapCanvasOuterHeight: 0,2617},2618viewportColumn: 0,2619isWordWrapMinified: false,2620isViewportWrapping: false,2621wrappingColumn: -1,2622verticalScrollbarWidth: 0,2623horizontalScrollbarHeight: 0,2624overviewRuler: {2625top: 0,2626width: 0,2627height: 0,2628right: 02629}2630});2631}26322633public compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, _: EditorLayoutInfo): EditorLayoutInfo {2634return EditorLayoutInfoComputer.computeLayout(options, {2635memory: env.memory,2636outerWidth: env.outerWidth,2637outerHeight: env.outerHeight,2638isDominatedByLongLines: env.isDominatedByLongLines,2639lineHeight: env.fontInfo.lineHeight,2640viewLineCount: env.viewLineCount,2641lineNumbersDigitCount: env.lineNumbersDigitCount,2642typicalHalfwidthCharacterWidth: env.fontInfo.typicalHalfwidthCharacterWidth,2643maxDigitWidth: env.fontInfo.maxDigitWidth,2644pixelRatio: env.pixelRatio,2645glyphMarginDecorationLaneCount: env.glyphMarginDecorationLaneCount2646});2647}26482649public static computeContainedMinimapLineCount(input: {2650viewLineCount: number;2651scrollBeyondLastLine: boolean;2652paddingTop: number;2653paddingBottom: number;2654height: number;2655lineHeight: number;2656pixelRatio: number;2657}): { typicalViewportLineCount: number; extraLinesBeforeFirstLine: number; extraLinesBeyondLastLine: number; desiredRatio: number; minimapLineCount: number } {2658const typicalViewportLineCount = input.height / input.lineHeight;2659const extraLinesBeforeFirstLine = Math.floor(input.paddingTop / input.lineHeight);2660let extraLinesBeyondLastLine = Math.floor(input.paddingBottom / input.lineHeight);2661if (input.scrollBeyondLastLine) {2662extraLinesBeyondLastLine = Math.max(extraLinesBeyondLastLine, typicalViewportLineCount - 1);2663}2664const desiredRatio = (extraLinesBeforeFirstLine + input.viewLineCount + extraLinesBeyondLastLine) / (input.pixelRatio * input.height);2665const minimapLineCount = Math.floor(input.viewLineCount / desiredRatio);2666return { typicalViewportLineCount, extraLinesBeforeFirstLine, extraLinesBeyondLastLine, desiredRatio, minimapLineCount };2667}26682669private static _computeMinimapLayout(input: IMinimapLayoutInput, memory: ComputeOptionsMemory): EditorMinimapLayoutInfo {2670const outerWidth = input.outerWidth;2671const outerHeight = input.outerHeight;2672const pixelRatio = input.pixelRatio;26732674if (!input.minimap.enabled) {2675return {2676renderMinimap: RenderMinimap.None,2677minimapLeft: 0,2678minimapWidth: 0,2679minimapHeightIsEditorHeight: false,2680minimapIsSampling: false,2681minimapScale: 1,2682minimapLineHeight: 1,2683minimapCanvasInnerWidth: 0,2684minimapCanvasInnerHeight: Math.floor(pixelRatio * outerHeight),2685minimapCanvasOuterWidth: 0,2686minimapCanvasOuterHeight: outerHeight,2687};2688}26892690// Can use memory if only the `viewLineCount` and `remainingWidth` have changed2691const stableMinimapLayoutInput = memory.stableMinimapLayoutInput;2692const couldUseMemory = (2693stableMinimapLayoutInput2694// && input.outerWidth === lastMinimapLayoutInput.outerWidth !!! INTENTIONAL OMITTED2695&& input.outerHeight === stableMinimapLayoutInput.outerHeight2696&& input.lineHeight === stableMinimapLayoutInput.lineHeight2697&& input.typicalHalfwidthCharacterWidth === stableMinimapLayoutInput.typicalHalfwidthCharacterWidth2698&& input.pixelRatio === stableMinimapLayoutInput.pixelRatio2699&& input.scrollBeyondLastLine === stableMinimapLayoutInput.scrollBeyondLastLine2700&& input.paddingTop === stableMinimapLayoutInput.paddingTop2701&& input.paddingBottom === stableMinimapLayoutInput.paddingBottom2702&& input.minimap.enabled === stableMinimapLayoutInput.minimap.enabled2703&& input.minimap.side === stableMinimapLayoutInput.minimap.side2704&& input.minimap.size === stableMinimapLayoutInput.minimap.size2705&& input.minimap.showSlider === stableMinimapLayoutInput.minimap.showSlider2706&& input.minimap.renderCharacters === stableMinimapLayoutInput.minimap.renderCharacters2707&& input.minimap.maxColumn === stableMinimapLayoutInput.minimap.maxColumn2708&& input.minimap.scale === stableMinimapLayoutInput.minimap.scale2709&& input.verticalScrollbarWidth === stableMinimapLayoutInput.verticalScrollbarWidth2710// && input.viewLineCount === lastMinimapLayoutInput.viewLineCount !!! INTENTIONAL OMITTED2711// && input.remainingWidth === lastMinimapLayoutInput.remainingWidth !!! INTENTIONAL OMITTED2712&& input.isViewportWrapping === stableMinimapLayoutInput.isViewportWrapping2713);27142715const lineHeight = input.lineHeight;2716const typicalHalfwidthCharacterWidth = input.typicalHalfwidthCharacterWidth;2717const scrollBeyondLastLine = input.scrollBeyondLastLine;2718const minimapRenderCharacters = input.minimap.renderCharacters;2719let minimapScale = (pixelRatio >= 2 ? Math.round(input.minimap.scale * 2) : input.minimap.scale);2720const minimapMaxColumn = input.minimap.maxColumn;2721const minimapSize = input.minimap.size;2722const minimapSide = input.minimap.side;2723const verticalScrollbarWidth = input.verticalScrollbarWidth;2724const viewLineCount = input.viewLineCount;2725const remainingWidth = input.remainingWidth;2726const isViewportWrapping = input.isViewportWrapping;27272728const baseCharHeight = minimapRenderCharacters ? 2 : 3;2729let minimapCanvasInnerHeight = Math.floor(pixelRatio * outerHeight);2730const minimapCanvasOuterHeight = minimapCanvasInnerHeight / pixelRatio;2731let minimapHeightIsEditorHeight = false;2732let minimapIsSampling = false;2733let minimapLineHeight = baseCharHeight * minimapScale;2734let minimapCharWidth = minimapScale / pixelRatio;2735let minimapWidthMultiplier: number = 1;27362737if (minimapSize === 'fill' || minimapSize === 'fit') {2738const { typicalViewportLineCount, extraLinesBeforeFirstLine, extraLinesBeyondLastLine, desiredRatio, minimapLineCount } = EditorLayoutInfoComputer.computeContainedMinimapLineCount({2739viewLineCount: viewLineCount,2740scrollBeyondLastLine: scrollBeyondLastLine,2741paddingTop: input.paddingTop,2742paddingBottom: input.paddingBottom,2743height: outerHeight,2744lineHeight: lineHeight,2745pixelRatio: pixelRatio2746});2747// ratio is intentionally not part of the layout to avoid the layout changing all the time2748// when doing sampling2749const ratio = viewLineCount / minimapLineCount;27502751if (ratio > 1) {2752minimapHeightIsEditorHeight = true;2753minimapIsSampling = true;2754minimapScale = 1;2755minimapLineHeight = 1;2756minimapCharWidth = minimapScale / pixelRatio;2757} else {2758let fitBecomesFill = false;2759let maxMinimapScale = minimapScale + 1;27602761if (minimapSize === 'fit') {2762const effectiveMinimapHeight = Math.ceil((extraLinesBeforeFirstLine + viewLineCount + extraLinesBeyondLastLine) * minimapLineHeight);2763if (isViewportWrapping && couldUseMemory && remainingWidth <= memory.stableFitRemainingWidth) {2764// There is a loop when using `fit` and viewport wrapping:2765// - view line count impacts minimap layout2766// - minimap layout impacts viewport width2767// - viewport width impacts view line count2768// To break the loop, once we go to a smaller minimap scale, we try to stick with it.2769fitBecomesFill = true;2770maxMinimapScale = memory.stableFitMaxMinimapScale;2771} else {2772fitBecomesFill = (effectiveMinimapHeight > minimapCanvasInnerHeight);2773}2774}27752776if (minimapSize === 'fill' || fitBecomesFill) {2777minimapHeightIsEditorHeight = true;2778const configuredMinimapScale = minimapScale;2779minimapLineHeight = Math.min(lineHeight * pixelRatio, Math.max(1, Math.floor(1 / desiredRatio)));2780if (isViewportWrapping && couldUseMemory && remainingWidth <= memory.stableFitRemainingWidth) {2781// There is a loop when using `fill` and viewport wrapping:2782// - view line count impacts minimap layout2783// - minimap layout impacts viewport width2784// - viewport width impacts view line count2785// To break the loop, once we go to a smaller minimap scale, we try to stick with it.2786maxMinimapScale = memory.stableFitMaxMinimapScale;2787}2788minimapScale = Math.min(maxMinimapScale, Math.max(1, Math.floor(minimapLineHeight / baseCharHeight)));2789if (minimapScale > configuredMinimapScale) {2790minimapWidthMultiplier = Math.min(2, minimapScale / configuredMinimapScale);2791}2792minimapCharWidth = minimapScale / pixelRatio / minimapWidthMultiplier;2793minimapCanvasInnerHeight = Math.ceil((Math.max(typicalViewportLineCount, extraLinesBeforeFirstLine + viewLineCount + extraLinesBeyondLastLine)) * minimapLineHeight);2794if (isViewportWrapping) {2795// remember for next time2796memory.stableMinimapLayoutInput = input;2797memory.stableFitRemainingWidth = remainingWidth;2798memory.stableFitMaxMinimapScale = minimapScale;2799} else {2800memory.stableMinimapLayoutInput = null;2801memory.stableFitRemainingWidth = 0;2802}2803}2804}2805}28062807// Given:2808// (leaving 2px for the cursor to have space after the last character)2809// viewportColumn = (contentWidth - verticalScrollbarWidth - 2) / typicalHalfwidthCharacterWidth2810// minimapWidth = viewportColumn * minimapCharWidth2811// contentWidth = remainingWidth - minimapWidth2812// What are good values for contentWidth and minimapWidth ?28132814// minimapWidth = ((contentWidth - verticalScrollbarWidth - 2) / typicalHalfwidthCharacterWidth) * minimapCharWidth2815// typicalHalfwidthCharacterWidth * minimapWidth = (contentWidth - verticalScrollbarWidth - 2) * minimapCharWidth2816// typicalHalfwidthCharacterWidth * minimapWidth = (remainingWidth - minimapWidth - verticalScrollbarWidth - 2) * minimapCharWidth2817// (typicalHalfwidthCharacterWidth + minimapCharWidth) * minimapWidth = (remainingWidth - verticalScrollbarWidth - 2) * minimapCharWidth2818// minimapWidth = ((remainingWidth - verticalScrollbarWidth - 2) * minimapCharWidth) / (typicalHalfwidthCharacterWidth + minimapCharWidth)28192820const minimapMaxWidth = Math.floor(minimapMaxColumn * minimapCharWidth);2821const minimapWidth = Math.min(minimapMaxWidth, Math.max(0, Math.floor(((remainingWidth - verticalScrollbarWidth - 2) * minimapCharWidth) / (typicalHalfwidthCharacterWidth + minimapCharWidth))) + MINIMAP_GUTTER_WIDTH);28222823let minimapCanvasInnerWidth = Math.floor(pixelRatio * minimapWidth);2824const minimapCanvasOuterWidth = minimapCanvasInnerWidth / pixelRatio;2825minimapCanvasInnerWidth = Math.floor(minimapCanvasInnerWidth * minimapWidthMultiplier);28262827const renderMinimap = (minimapRenderCharacters ? RenderMinimap.Text : RenderMinimap.Blocks);2828const minimapLeft = (minimapSide === 'left' ? 0 : (outerWidth - minimapWidth - verticalScrollbarWidth));28292830return {2831renderMinimap,2832minimapLeft,2833minimapWidth,2834minimapHeightIsEditorHeight,2835minimapIsSampling,2836minimapScale,2837minimapLineHeight,2838minimapCanvasInnerWidth,2839minimapCanvasInnerHeight,2840minimapCanvasOuterWidth,2841minimapCanvasOuterHeight,2842};2843}28442845public static computeLayout(options: IComputedEditorOptions, env: EditorLayoutInfoComputerEnv): EditorLayoutInfo {2846const outerWidth = env.outerWidth | 0;2847const outerHeight = env.outerHeight | 0;2848const lineHeight = env.lineHeight | 0;2849const lineNumbersDigitCount = env.lineNumbersDigitCount | 0;2850const typicalHalfwidthCharacterWidth = env.typicalHalfwidthCharacterWidth;2851const maxDigitWidth = env.maxDigitWidth;2852const pixelRatio = env.pixelRatio;2853const viewLineCount = env.viewLineCount;28542855const wordWrapOverride2 = options.get(EditorOption.wordWrapOverride2);2856const wordWrapOverride1 = (wordWrapOverride2 === 'inherit' ? options.get(EditorOption.wordWrapOverride1) : wordWrapOverride2);2857const wordWrap = (wordWrapOverride1 === 'inherit' ? options.get(EditorOption.wordWrap) : wordWrapOverride1);28582859const wordWrapColumn = options.get(EditorOption.wordWrapColumn);2860const isDominatedByLongLines = env.isDominatedByLongLines;28612862const showGlyphMargin = options.get(EditorOption.glyphMargin);2863const showLineNumbers = (options.get(EditorOption.lineNumbers).renderType !== RenderLineNumbersType.Off);2864const lineNumbersMinChars = options.get(EditorOption.lineNumbersMinChars);2865const scrollBeyondLastLine = options.get(EditorOption.scrollBeyondLastLine);2866const padding = options.get(EditorOption.padding);2867const minimap = options.get(EditorOption.minimap);28682869const scrollbar = options.get(EditorOption.scrollbar);2870const verticalScrollbarWidth = scrollbar.verticalScrollbarSize;2871const verticalScrollbarHasArrows = scrollbar.verticalHasArrows;2872const scrollbarArrowSize = scrollbar.arrowSize;2873const horizontalScrollbarHeight = scrollbar.horizontalScrollbarSize;28742875const folding = options.get(EditorOption.folding);2876const showFoldingDecoration = options.get(EditorOption.showFoldingControls) !== 'never';28772878let lineDecorationsWidth = options.get(EditorOption.lineDecorationsWidth);2879if (folding && showFoldingDecoration) {2880lineDecorationsWidth += 16;2881}28822883let lineNumbersWidth = 0;2884if (showLineNumbers) {2885const digitCount = Math.max(lineNumbersDigitCount, lineNumbersMinChars);2886lineNumbersWidth = Math.round(digitCount * maxDigitWidth);2887}28882889let glyphMarginWidth = 0;2890if (showGlyphMargin) {2891glyphMarginWidth = lineHeight * env.glyphMarginDecorationLaneCount;2892}28932894let glyphMarginLeft = 0;2895let lineNumbersLeft = glyphMarginLeft + glyphMarginWidth;2896let decorationsLeft = lineNumbersLeft + lineNumbersWidth;2897let contentLeft = decorationsLeft + lineDecorationsWidth;28982899const remainingWidth = outerWidth - glyphMarginWidth - lineNumbersWidth - lineDecorationsWidth;29002901let isWordWrapMinified = false;2902let isViewportWrapping = false;2903let wrappingColumn = -1;29042905if (options.get(EditorOption.accessibilitySupport) === AccessibilitySupport.Enabled && wordWrapOverride1 === 'inherit' && isDominatedByLongLines) {2906// Force viewport width wrapping if model is dominated by long lines2907isWordWrapMinified = true;2908isViewportWrapping = true;2909} else if (wordWrap === 'on' || wordWrap === 'bounded') {2910isViewportWrapping = true;2911} else if (wordWrap === 'wordWrapColumn') {2912wrappingColumn = wordWrapColumn;2913}29142915const minimapLayout = EditorLayoutInfoComputer._computeMinimapLayout({2916outerWidth: outerWidth,2917outerHeight: outerHeight,2918lineHeight: lineHeight,2919typicalHalfwidthCharacterWidth: typicalHalfwidthCharacterWidth,2920pixelRatio: pixelRatio,2921scrollBeyondLastLine: scrollBeyondLastLine,2922paddingTop: padding.top,2923paddingBottom: padding.bottom,2924minimap: minimap,2925verticalScrollbarWidth: verticalScrollbarWidth,2926viewLineCount: viewLineCount,2927remainingWidth: remainingWidth,2928isViewportWrapping: isViewportWrapping,2929}, env.memory || new ComputeOptionsMemory());29302931if (minimapLayout.renderMinimap !== RenderMinimap.None && minimapLayout.minimapLeft === 0) {2932// the minimap is rendered to the left, so move everything to the right2933glyphMarginLeft += minimapLayout.minimapWidth;2934lineNumbersLeft += minimapLayout.minimapWidth;2935decorationsLeft += minimapLayout.minimapWidth;2936contentLeft += minimapLayout.minimapWidth;2937}2938const contentWidth = remainingWidth - minimapLayout.minimapWidth;29392940// (leaving 2px for the cursor to have space after the last character)2941const viewportColumn = Math.max(1, Math.floor((contentWidth - verticalScrollbarWidth - 2) / typicalHalfwidthCharacterWidth));29422943const verticalArrowSize = (verticalScrollbarHasArrows ? scrollbarArrowSize : 0);29442945if (isViewportWrapping) {2946// compute the actual wrappingColumn2947wrappingColumn = Math.max(1, viewportColumn);2948if (wordWrap === 'bounded') {2949wrappingColumn = Math.min(wrappingColumn, wordWrapColumn);2950}2951}29522953return {2954width: outerWidth,2955height: outerHeight,29562957glyphMarginLeft: glyphMarginLeft,2958glyphMarginWidth: glyphMarginWidth,2959glyphMarginDecorationLaneCount: env.glyphMarginDecorationLaneCount,29602961lineNumbersLeft: lineNumbersLeft,2962lineNumbersWidth: lineNumbersWidth,29632964decorationsLeft: decorationsLeft,2965decorationsWidth: lineDecorationsWidth,29662967contentLeft: contentLeft,2968contentWidth: contentWidth,29692970minimap: minimapLayout,29712972viewportColumn: viewportColumn,29732974isWordWrapMinified: isWordWrapMinified,2975isViewportWrapping: isViewportWrapping,2976wrappingColumn: wrappingColumn,29772978verticalScrollbarWidth: verticalScrollbarWidth,2979horizontalScrollbarHeight: horizontalScrollbarHeight,29802981overviewRuler: {2982top: verticalArrowSize,2983width: verticalScrollbarWidth,2984height: (outerHeight - 2 * verticalArrowSize),2985right: 02986}2987};2988}2989}29902991//#endregion29922993//#region WrappingStrategy2994class WrappingStrategy extends BaseEditorOption<EditorOption.wrappingStrategy, 'simple' | 'advanced', 'simple' | 'advanced'> {29952996constructor() {2997super(EditorOption.wrappingStrategy, 'wrappingStrategy', 'simple',2998{2999'editor.wrappingStrategy': {3000enumDescriptions: [3001nls.localize('wrappingStrategy.simple', "Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width."),3002nls.localize('wrappingStrategy.advanced', "Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.")3003],3004type: 'string',3005enum: ['simple', 'advanced'],3006default: 'simple',3007description: nls.localize('wrappingStrategy', "Controls the algorithm that computes wrapping points. Note that when in accessibility mode, advanced will be used for the best experience.")3008}3009}3010);3011}30123013public validate(input: unknown): 'simple' | 'advanced' {3014return stringSet<'simple' | 'advanced'>(input, 'simple', ['simple', 'advanced']);3015}30163017public override compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: 'simple' | 'advanced'): 'simple' | 'advanced' {3018const accessibilitySupport = options.get(EditorOption.accessibilitySupport);3019if (accessibilitySupport === AccessibilitySupport.Enabled) {3020// if we know for a fact that a screen reader is attached, we switch our strategy to advanced to3021// help that the editor's wrapping points match the textarea's wrapping points3022return 'advanced';3023}3024return value;3025}3026}3027//#endregion30283029//#region lightbulb30303031export enum ShowLightbulbIconMode {3032Off = 'off',3033OnCode = 'onCode',3034On = 'on'3035}30363037/**3038* Configuration options for editor lightbulb3039*/3040export interface IEditorLightbulbOptions {3041/**3042* Enable the lightbulb code action.3043* The three possible values are `off`, `on` and `onCode` and the default is `onCode`.3044* `off` disables the code action menu.3045* `on` shows the code action menu on code and on empty lines.3046* `onCode` shows the code action menu on code only.3047*/3048enabled?: ShowLightbulbIconMode;3049}30503051/**3052* @internal3053*/3054export type EditorLightbulbOptions = Readonly<Required<IEditorLightbulbOptions>>;30553056class EditorLightbulb extends BaseEditorOption<EditorOption.lightbulb, IEditorLightbulbOptions, EditorLightbulbOptions> {30573058constructor() {3059const defaults: EditorLightbulbOptions = { enabled: ShowLightbulbIconMode.OnCode };3060super(3061EditorOption.lightbulb, 'lightbulb', defaults,3062{3063'editor.lightbulb.enabled': {3064type: 'string',3065enum: [ShowLightbulbIconMode.Off, ShowLightbulbIconMode.OnCode, ShowLightbulbIconMode.On],3066default: defaults.enabled,3067enumDescriptions: [3068nls.localize('editor.lightbulb.enabled.off', 'Disable the code action menu.'),3069nls.localize('editor.lightbulb.enabled.onCode', 'Show the code action menu when the cursor is on lines with code.'),3070nls.localize('editor.lightbulb.enabled.on', 'Show the code action menu when the cursor is on lines with code or on empty lines.'),3071],3072description: nls.localize('enabled', "Enables the Code Action lightbulb in the editor.")3073}3074}3075);3076}30773078public validate(_input: unknown): EditorLightbulbOptions {3079if (!_input || typeof _input !== 'object') {3080return this.defaultValue;3081}3082const input = _input as Unknown<IEditorLightbulbOptions>;3083return {3084enabled: stringSet(input.enabled, this.defaultValue.enabled, [ShowLightbulbIconMode.Off, ShowLightbulbIconMode.OnCode, ShowLightbulbIconMode.On])3085};3086}3087}30883089//#endregion30903091//#region stickyScroll30923093export interface IEditorStickyScrollOptions {3094/**3095* Enable the sticky scroll3096*/3097enabled?: boolean;3098/**3099* Maximum number of sticky lines to show3100*/3101maxLineCount?: number;3102/**3103* Model to choose for sticky scroll by default3104*/3105defaultModel?: 'outlineModel' | 'foldingProviderModel' | 'indentationModel';3106/**3107* Define whether to scroll sticky scroll with editor horizontal scrollbae3108*/3109scrollWithEditor?: boolean;3110}31113112/**3113* @internal3114*/3115export type EditorStickyScrollOptions = Readonly<Required<IEditorStickyScrollOptions>>;31163117class EditorStickyScroll extends BaseEditorOption<EditorOption.stickyScroll, IEditorStickyScrollOptions, EditorStickyScrollOptions> {31183119constructor() {3120const defaults: EditorStickyScrollOptions = { enabled: true, maxLineCount: 5, defaultModel: 'outlineModel', scrollWithEditor: true };3121super(3122EditorOption.stickyScroll, 'stickyScroll', defaults,3123{3124'editor.stickyScroll.enabled': {3125type: 'boolean',3126default: defaults.enabled,3127description: nls.localize('editor.stickyScroll.enabled', "Shows the nested current scopes during the scroll at the top of the editor.")3128},3129'editor.stickyScroll.maxLineCount': {3130type: 'number',3131default: defaults.maxLineCount,3132minimum: 1,3133maximum: 20,3134description: nls.localize('editor.stickyScroll.maxLineCount', "Defines the maximum number of sticky lines to show.")3135},3136'editor.stickyScroll.defaultModel': {3137type: 'string',3138enum: ['outlineModel', 'foldingProviderModel', 'indentationModel'],3139default: defaults.defaultModel,3140description: nls.localize('editor.stickyScroll.defaultModel', "Defines the model to use for determining which lines to stick. If the outline model does not exist, it will fall back on the folding provider model which falls back on the indentation model. This order is respected in all three cases.")3141},3142'editor.stickyScroll.scrollWithEditor': {3143type: 'boolean',3144default: defaults.scrollWithEditor,3145description: nls.localize('editor.stickyScroll.scrollWithEditor', "Enable scrolling of Sticky Scroll with the editor's horizontal scrollbar.")3146},3147}3148);3149}31503151public validate(_input: unknown): EditorStickyScrollOptions {3152if (!_input || typeof _input !== 'object') {3153return this.defaultValue;3154}3155const input = _input as Unknown<IEditorStickyScrollOptions>;3156return {3157enabled: boolean(input.enabled, this.defaultValue.enabled),3158maxLineCount: EditorIntOption.clampedInt(input.maxLineCount, this.defaultValue.maxLineCount, 1, 20),3159defaultModel: stringSet<'outlineModel' | 'foldingProviderModel' | 'indentationModel'>(input.defaultModel, this.defaultValue.defaultModel, ['outlineModel', 'foldingProviderModel', 'indentationModel']),3160scrollWithEditor: boolean(input.scrollWithEditor, this.defaultValue.scrollWithEditor)3161};3162}3163}31643165//#endregion31663167//#region inlayHints31683169/**3170* Configuration options for editor inlayHints3171*/3172export interface IEditorInlayHintsOptions {3173/**3174* Enable the inline hints.3175* Defaults to true.3176*/3177enabled?: 'on' | 'off' | 'offUnlessPressed' | 'onUnlessPressed';31783179/**3180* Font size of inline hints.3181* Default to 90% of the editor font size.3182*/3183fontSize?: number;31843185/**3186* Font family of inline hints.3187* Defaults to editor font family.3188*/3189fontFamily?: string;31903191/**3192* Enables the padding around the inlay hint.3193* Defaults to false.3194*/3195padding?: boolean;31963197/**3198* Maximum length for inlay hints per line3199* Set to 0 to have an unlimited length.3200*/3201maximumLength?: number;3202}32033204/**3205* @internal3206*/3207export type EditorInlayHintsOptions = Readonly<Required<IEditorInlayHintsOptions>>;32083209class EditorInlayHints extends BaseEditorOption<EditorOption.inlayHints, IEditorInlayHintsOptions, EditorInlayHintsOptions> {32103211constructor() {3212const defaults: EditorInlayHintsOptions = { enabled: 'on', fontSize: 0, fontFamily: '', padding: false, maximumLength: 43 };3213super(3214EditorOption.inlayHints, 'inlayHints', defaults,3215{3216'editor.inlayHints.enabled': {3217type: 'string',3218default: defaults.enabled,3219description: nls.localize('inlayHints.enable', "Enables the inlay hints in the editor."),3220enum: ['on', 'onUnlessPressed', 'offUnlessPressed', 'off'],3221markdownEnumDescriptions: [3222nls.localize('editor.inlayHints.on', "Inlay hints are enabled"),3223nls.localize('editor.inlayHints.onUnlessPressed', "Inlay hints are showing by default and hide when holding {0}", platform.isMacintosh ? `Ctrl+Option` : `Ctrl+Alt`),3224nls.localize('editor.inlayHints.offUnlessPressed', "Inlay hints are hidden by default and show when holding {0}", platform.isMacintosh ? `Ctrl+Option` : `Ctrl+Alt`),3225nls.localize('editor.inlayHints.off', "Inlay hints are disabled"),3226],3227},3228'editor.inlayHints.fontSize': {3229type: 'number',3230default: defaults.fontSize,3231markdownDescription: nls.localize('inlayHints.fontSize', "Controls font size of inlay hints in the editor. As default the {0} is used when the configured value is less than {1} or greater than the editor font size.", '`#editor.fontSize#`', '`5`')3232},3233'editor.inlayHints.fontFamily': {3234type: 'string',3235default: defaults.fontFamily,3236markdownDescription: nls.localize('inlayHints.fontFamily', "Controls font family of inlay hints in the editor. When set to empty, the {0} is used.", '`#editor.fontFamily#`')3237},3238'editor.inlayHints.padding': {3239type: 'boolean',3240default: defaults.padding,3241description: nls.localize('inlayHints.padding', "Enables the padding around the inlay hints in the editor.")3242},3243'editor.inlayHints.maximumLength': {3244type: 'number',3245default: defaults.maximumLength,3246markdownDescription: nls.localize('inlayHints.maximumLength', "Maximum overall length of inlay hints, for a single line, before they get truncated by the editor. Set to `0` to never truncate")3247}3248}3249);3250}32513252public validate(_input: unknown): EditorInlayHintsOptions {3253if (!_input || typeof _input !== 'object') {3254return this.defaultValue;3255}3256const input = _input as Unknown<IEditorInlayHintsOptions>;3257if (typeof input.enabled === 'boolean') {3258input.enabled = input.enabled ? 'on' : 'off';3259}3260return {3261enabled: stringSet<'on' | 'off' | 'offUnlessPressed' | 'onUnlessPressed'>(input.enabled, this.defaultValue.enabled, ['on', 'off', 'offUnlessPressed', 'onUnlessPressed']),3262fontSize: EditorIntOption.clampedInt(input.fontSize, this.defaultValue.fontSize, 0, 100),3263fontFamily: EditorStringOption.string(input.fontFamily, this.defaultValue.fontFamily),3264padding: boolean(input.padding, this.defaultValue.padding),3265maximumLength: EditorIntOption.clampedInt(input.maximumLength, this.defaultValue.maximumLength, 0, Number.MAX_SAFE_INTEGER),3266};3267}3268}32693270//#endregion32713272//#region lineDecorationsWidth32733274class EditorLineDecorationsWidth extends BaseEditorOption<EditorOption.lineDecorationsWidth, number | string, number> {32753276constructor() {3277super(EditorOption.lineDecorationsWidth, 'lineDecorationsWidth', 10);3278}32793280public validate(input: unknown): number {3281if (typeof input === 'string' && /^\d+(\.\d+)?ch$/.test(input)) {3282const multiple = parseFloat(input.substring(0, input.length - 2));3283return -multiple; // negative numbers signal a multiple3284} else {3285return EditorIntOption.clampedInt(input, this.defaultValue, 0, 1000);3286}3287}32883289public override compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: number): number {3290if (value < 0) {3291// negative numbers signal a multiple3292return EditorIntOption.clampedInt(-value * env.fontInfo.typicalHalfwidthCharacterWidth, this.defaultValue, 0, 1000);3293} else {3294return value;3295}3296}3297}32983299//#endregion33003301//#region lineHeight33023303class EditorLineHeight extends EditorFloatOption<EditorOption.lineHeight> {33043305constructor() {3306super(3307EditorOption.lineHeight, 'lineHeight',3308EDITOR_FONT_DEFAULTS.lineHeight,3309x => EditorFloatOption.clamp(x, 0, 150),3310{ markdownDescription: nls.localize('lineHeight', "Controls the line height. \n - Use 0 to automatically compute the line height from the font size.\n - Values between 0 and 8 will be used as a multiplier with the font size.\n - Values greater than or equal to 8 will be used as effective values.") },33110,33121503313);3314}33153316public override compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: number): number {3317// The lineHeight is computed from the fontSize if it is 0.3318// Moreover, the final lineHeight respects the editor zoom level.3319// So take the result from env.fontInfo3320return env.fontInfo.lineHeight;3321}3322}33233324//#endregion33253326//#region minimap33273328/**3329* Configuration options for editor minimap3330*/3331export interface IEditorMinimapOptions {3332/**3333* Enable the rendering of the minimap.3334* Defaults to true.3335*/3336enabled?: boolean;3337/**3338* Control the rendering of minimap.3339*/3340autohide?: 'none' | 'mouseover' | 'scroll';3341/**3342* Control the side of the minimap in editor.3343* Defaults to 'right'.3344*/3345side?: 'right' | 'left';3346/**3347* Control the minimap rendering mode.3348* Defaults to 'actual'.3349*/3350size?: 'proportional' | 'fill' | 'fit';3351/**3352* Control the rendering of the minimap slider.3353* Defaults to 'mouseover'.3354*/3355showSlider?: 'always' | 'mouseover';3356/**3357* Render the actual text on a line (as opposed to color blocks).3358* Defaults to true.3359*/3360renderCharacters?: boolean;3361/**3362* Limit the width of the minimap to render at most a certain number of columns.3363* Defaults to 120.3364*/3365maxColumn?: number;3366/**3367* Relative size of the font in the minimap. Defaults to 1.3368*/3369scale?: number;3370/**3371* Whether to show named regions as section headers. Defaults to true.3372*/3373showRegionSectionHeaders?: boolean;3374/**3375* Whether to show MARK: comments as section headers. Defaults to true.3376*/3377showMarkSectionHeaders?: boolean;3378/**3379* When specified, is used to create a custom section header parser regexp.3380* Must contain a match group named 'label' (written as (?<label>.+)) that encapsulates the section header.3381* Optionally can include another match group named 'separator'.3382* To match multi-line headers like:3383* // ==========3384* // My Section3385* // ==========3386* Use a pattern like: ^={3,}\n^\/\/ *(?<label>[^\n]*?)\n^={3,}$3387*/3388markSectionHeaderRegex?: string;3389/**3390* Font size of section headers. Defaults to 9.3391*/3392sectionHeaderFontSize?: number;3393/**3394* Spacing between the section header characters (in CSS px). Defaults to 1.3395*/3396sectionHeaderLetterSpacing?: number;3397}33983399/**3400* @internal3401*/3402export type EditorMinimapOptions = Readonly<Required<IEditorMinimapOptions>>;34033404class EditorMinimap extends BaseEditorOption<EditorOption.minimap, IEditorMinimapOptions, EditorMinimapOptions> {34053406constructor() {3407const defaults: EditorMinimapOptions = {3408enabled: true,3409size: 'proportional',3410side: 'right',3411showSlider: 'mouseover',3412autohide: 'none',3413renderCharacters: true,3414maxColumn: 120,3415scale: 1,3416showRegionSectionHeaders: true,3417showMarkSectionHeaders: true,3418markSectionHeaderRegex: '\\bMARK:\\s*(?<separator>\-?)\\s*(?<label>.*)$',3419sectionHeaderFontSize: 9,3420sectionHeaderLetterSpacing: 1,3421};3422super(3423EditorOption.minimap, 'minimap', defaults,3424{3425'editor.minimap.enabled': {3426type: 'boolean',3427default: defaults.enabled,3428description: nls.localize('minimap.enabled', "Controls whether the minimap is shown.")3429},3430'editor.minimap.autohide': {3431type: 'string',3432enum: ['none', 'mouseover', 'scroll'],3433enumDescriptions: [3434nls.localize('minimap.autohide.none', "The minimap is always shown."),3435nls.localize('minimap.autohide.mouseover', "The minimap is hidden when mouse is not over the minimap and shown when mouse is over the minimap."),3436nls.localize('minimap.autohide.scroll', "The minimap is only shown when the editor is scrolled"),3437],3438default: defaults.autohide,3439description: nls.localize('minimap.autohide', "Controls whether the minimap is hidden automatically.")3440},3441'editor.minimap.size': {3442type: 'string',3443enum: ['proportional', 'fill', 'fit'],3444enumDescriptions: [3445nls.localize('minimap.size.proportional', "The minimap has the same size as the editor contents (and might scroll)."),3446nls.localize('minimap.size.fill', "The minimap will stretch or shrink as necessary to fill the height of the editor (no scrolling)."),3447nls.localize('minimap.size.fit', "The minimap will shrink as necessary to never be larger than the editor (no scrolling)."),3448],3449default: defaults.size,3450description: nls.localize('minimap.size', "Controls the size of the minimap.")3451},3452'editor.minimap.side': {3453type: 'string',3454enum: ['left', 'right'],3455default: defaults.side,3456description: nls.localize('minimap.side', "Controls the side where to render the minimap.")3457},3458'editor.minimap.showSlider': {3459type: 'string',3460enum: ['always', 'mouseover'],3461default: defaults.showSlider,3462description: nls.localize('minimap.showSlider', "Controls when the minimap slider is shown.")3463},3464'editor.minimap.scale': {3465type: 'number',3466default: defaults.scale,3467minimum: 1,3468maximum: 3,3469enum: [1, 2, 3],3470description: nls.localize('minimap.scale', "Scale of content drawn in the minimap: 1, 2 or 3.")3471},3472'editor.minimap.renderCharacters': {3473type: 'boolean',3474default: defaults.renderCharacters,3475description: nls.localize('minimap.renderCharacters', "Render the actual characters on a line as opposed to color blocks.")3476},3477'editor.minimap.maxColumn': {3478type: 'number',3479default: defaults.maxColumn,3480description: nls.localize('minimap.maxColumn', "Limit the width of the minimap to render at most a certain number of columns.")3481},3482'editor.minimap.showRegionSectionHeaders': {3483type: 'boolean',3484default: defaults.showRegionSectionHeaders,3485description: nls.localize('minimap.showRegionSectionHeaders', "Controls whether named regions are shown as section headers in the minimap.")3486},3487'editor.minimap.showMarkSectionHeaders': {3488type: 'boolean',3489default: defaults.showMarkSectionHeaders,3490description: nls.localize('minimap.showMarkSectionHeaders', "Controls whether MARK: comments are shown as section headers in the minimap.")3491},3492'editor.minimap.markSectionHeaderRegex': {3493type: 'string',3494default: defaults.markSectionHeaderRegex,3495description: nls.localize('minimap.markSectionHeaderRegex', "Defines the regular expression used to find section headers in comments. The regex must contain a named match group `label` (written as `(?<label>.+)`) that encapsulates the section header, otherwise it will not work. Optionally you can include another match group named `separator`. Use \\n in the pattern to match multi-line headers."),3496},3497'editor.minimap.sectionHeaderFontSize': {3498type: 'number',3499default: defaults.sectionHeaderFontSize,3500description: nls.localize('minimap.sectionHeaderFontSize', "Controls the font size of section headers in the minimap.")3501},3502'editor.minimap.sectionHeaderLetterSpacing': {3503type: 'number',3504default: defaults.sectionHeaderLetterSpacing,3505description: nls.localize('minimap.sectionHeaderLetterSpacing', "Controls the amount of space (in pixels) between characters of section header. This helps the readability of the header in small font sizes.")3506}3507}3508);3509}35103511public validate(_input: unknown): EditorMinimapOptions {3512if (!_input || typeof _input !== 'object') {3513return this.defaultValue;3514}3515const input = _input as Unknown<IEditorMinimapOptions>;35163517// Validate mark section header regex3518let markSectionHeaderRegex = this.defaultValue.markSectionHeaderRegex;3519const inputRegex = input.markSectionHeaderRegex;3520if (typeof inputRegex === 'string') {3521try {3522new RegExp(inputRegex, 'd');3523markSectionHeaderRegex = inputRegex;3524} catch { }3525}35263527return {3528enabled: boolean(input.enabled, this.defaultValue.enabled),3529autohide: stringSet<'none' | 'mouseover' | 'scroll'>(input.autohide, this.defaultValue.autohide, ['none', 'mouseover', 'scroll']),3530size: stringSet<'proportional' | 'fill' | 'fit'>(input.size, this.defaultValue.size, ['proportional', 'fill', 'fit']),3531side: stringSet<'right' | 'left'>(input.side, this.defaultValue.side, ['right', 'left']),3532showSlider: stringSet<'always' | 'mouseover'>(input.showSlider, this.defaultValue.showSlider, ['always', 'mouseover']),3533renderCharacters: boolean(input.renderCharacters, this.defaultValue.renderCharacters),3534scale: EditorIntOption.clampedInt(input.scale, 1, 1, 3),3535maxColumn: EditorIntOption.clampedInt(input.maxColumn, this.defaultValue.maxColumn, 1, 10000),3536showRegionSectionHeaders: boolean(input.showRegionSectionHeaders, this.defaultValue.showRegionSectionHeaders),3537showMarkSectionHeaders: boolean(input.showMarkSectionHeaders, this.defaultValue.showMarkSectionHeaders),3538markSectionHeaderRegex: markSectionHeaderRegex,3539sectionHeaderFontSize: EditorFloatOption.clamp(EditorFloatOption.float(input.sectionHeaderFontSize, this.defaultValue.sectionHeaderFontSize), 4, 32),3540sectionHeaderLetterSpacing: EditorFloatOption.clamp(EditorFloatOption.float(input.sectionHeaderLetterSpacing, this.defaultValue.sectionHeaderLetterSpacing), 0, 5),3541};3542}3543}35443545//#endregion35463547//#region multiCursorModifier35483549function _multiCursorModifierFromString(multiCursorModifier: 'ctrlCmd' | 'alt'): 'altKey' | 'metaKey' | 'ctrlKey' {3550if (multiCursorModifier === 'ctrlCmd') {3551return (platform.isMacintosh ? 'metaKey' : 'ctrlKey');3552}3553return 'altKey';3554}35553556//#endregion35573558//#region padding35593560/**3561* Configuration options for editor padding3562*/3563export interface IEditorPaddingOptions {3564/**3565* Spacing between top edge of editor and first line.3566*/3567top?: number;3568/**3569* Spacing between bottom edge of editor and last line.3570*/3571bottom?: number;3572}35733574/**3575* @internal3576*/3577export type InternalEditorPaddingOptions = Readonly<Required<IEditorPaddingOptions>>;35783579class EditorPadding extends BaseEditorOption<EditorOption.padding, IEditorPaddingOptions, InternalEditorPaddingOptions> {35803581constructor() {3582super(3583EditorOption.padding, 'padding', { top: 0, bottom: 0 },3584{3585'editor.padding.top': {3586type: 'number',3587default: 0,3588minimum: 0,3589maximum: 1000,3590description: nls.localize('padding.top', "Controls the amount of space between the top edge of the editor and the first line.")3591},3592'editor.padding.bottom': {3593type: 'number',3594default: 0,3595minimum: 0,3596maximum: 1000,3597description: nls.localize('padding.bottom', "Controls the amount of space between the bottom edge of the editor and the last line.")3598}3599}3600);3601}36023603public validate(_input: unknown): InternalEditorPaddingOptions {3604if (!_input || typeof _input !== 'object') {3605return this.defaultValue;3606}3607const input = _input as Unknown<IEditorPaddingOptions>;36083609return {3610top: EditorIntOption.clampedInt(input.top, 0, 0, 1000),3611bottom: EditorIntOption.clampedInt(input.bottom, 0, 0, 1000)3612};3613}3614}3615//#endregion36163617//#region parameterHints36183619/**3620* Configuration options for parameter hints3621*/3622export interface IEditorParameterHintOptions {3623/**3624* Enable parameter hints.3625* Defaults to true.3626*/3627enabled?: boolean;3628/**3629* Enable cycling of parameter hints.3630* Defaults to false.3631*/3632cycle?: boolean;3633}36343635/**3636* @internal3637*/3638export type InternalParameterHintOptions = Readonly<Required<IEditorParameterHintOptions>>;36393640class EditorParameterHints extends BaseEditorOption<EditorOption.parameterHints, IEditorParameterHintOptions, InternalParameterHintOptions> {36413642constructor() {3643const defaults: InternalParameterHintOptions = {3644enabled: true,3645cycle: true3646};3647super(3648EditorOption.parameterHints, 'parameterHints', defaults,3649{3650'editor.parameterHints.enabled': {3651type: 'boolean',3652default: defaults.enabled,3653description: nls.localize('parameterHints.enabled', "Enables a pop-up that shows parameter documentation and type information as you type.")3654},3655'editor.parameterHints.cycle': {3656type: 'boolean',3657default: defaults.cycle,3658description: nls.localize('parameterHints.cycle', "Controls whether the parameter hints menu cycles or closes when reaching the end of the list.")3659},3660}3661);3662}36633664public validate(_input: unknown): InternalParameterHintOptions {3665if (!_input || typeof _input !== 'object') {3666return this.defaultValue;3667}3668const input = _input as Unknown<IEditorParameterHintOptions>;3669return {3670enabled: boolean(input.enabled, this.defaultValue.enabled),3671cycle: boolean(input.cycle, this.defaultValue.cycle)3672};3673}3674}36753676//#endregion36773678//#region pixelRatio36793680class EditorPixelRatio extends ComputedEditorOption<EditorOption.pixelRatio, number> {36813682constructor() {3683super(EditorOption.pixelRatio, 1);3684}36853686public compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, _: number): number {3687return env.pixelRatio;3688}3689}36903691//#endregion36923693//#region36943695class PlaceholderOption extends BaseEditorOption<EditorOption.placeholder, string | undefined, string | undefined> {3696constructor() {3697super(EditorOption.placeholder, 'placeholder', undefined);3698}36993700public validate(input: unknown): string | undefined {3701if (typeof input === 'undefined') {3702return this.defaultValue;3703}3704if (typeof input === 'string') {3705return input;3706}3707return this.defaultValue;3708}3709}3710//#endregion37113712//#region quickSuggestions37133714export type QuickSuggestionsValue = 'on' | 'inline' | 'off';37153716/**3717* Configuration options for quick suggestions3718*/3719export interface IQuickSuggestionsOptions {3720other?: boolean | QuickSuggestionsValue;3721comments?: boolean | QuickSuggestionsValue;3722strings?: boolean | QuickSuggestionsValue;3723}37243725export interface InternalQuickSuggestionsOptions {3726readonly other: QuickSuggestionsValue;3727readonly comments: QuickSuggestionsValue;3728readonly strings: QuickSuggestionsValue;3729}37303731class EditorQuickSuggestions extends BaseEditorOption<EditorOption.quickSuggestions, boolean | IQuickSuggestionsOptions, InternalQuickSuggestionsOptions> {37323733public override readonly defaultValue: InternalQuickSuggestionsOptions;37343735constructor() {3736const defaults: InternalQuickSuggestionsOptions = {3737other: 'on',3738comments: 'off',3739strings: 'off'3740};3741const types: IJSONSchema[] = [3742{ type: 'boolean' },3743{3744type: 'string',3745enum: ['on', 'inline', 'off'],3746enumDescriptions: [nls.localize('on', "Quick suggestions show inside the suggest widget"), nls.localize('inline', "Quick suggestions show as ghost text"), nls.localize('off', "Quick suggestions are disabled")]3747}3748];3749super(EditorOption.quickSuggestions, 'quickSuggestions', defaults, {3750type: 'object',3751additionalProperties: false,3752properties: {3753strings: {3754anyOf: types,3755default: defaults.strings,3756description: nls.localize('quickSuggestions.strings', "Enable quick suggestions inside strings.")3757},3758comments: {3759anyOf: types,3760default: defaults.comments,3761description: nls.localize('quickSuggestions.comments', "Enable quick suggestions inside comments.")3762},3763other: {3764anyOf: types,3765default: defaults.other,3766description: nls.localize('quickSuggestions.other', "Enable quick suggestions outside of strings and comments.")3767},3768},3769default: defaults,3770markdownDescription: nls.localize('quickSuggestions', "Controls whether suggestions should automatically show up while typing. This can be controlled for typing in comments, strings, and other code. Quick suggestion can be configured to show as ghost text or with the suggest widget. Also be aware of the {0}-setting which controls if suggestions are triggered by special characters.", '`#editor.suggestOnTriggerCharacters#`')3771});3772this.defaultValue = defaults;3773}37743775public validate(input: unknown): InternalQuickSuggestionsOptions {3776if (typeof input === 'boolean') {3777// boolean -> all on/off3778const value = input ? 'on' : 'off';3779return { comments: value, strings: value, other: value };3780}3781if (!input || typeof input !== 'object') {3782// invalid object3783return this.defaultValue;3784}37853786const { other, comments, strings } = (<IQuickSuggestionsOptions>input);3787const allowedValues: QuickSuggestionsValue[] = ['on', 'inline', 'off'];3788let validatedOther: QuickSuggestionsValue;3789let validatedComments: QuickSuggestionsValue;3790let validatedStrings: QuickSuggestionsValue;37913792if (typeof other === 'boolean') {3793validatedOther = other ? 'on' : 'off';3794} else {3795validatedOther = stringSet(other, this.defaultValue.other, allowedValues);3796}3797if (typeof comments === 'boolean') {3798validatedComments = comments ? 'on' : 'off';3799} else {3800validatedComments = stringSet(comments, this.defaultValue.comments, allowedValues);3801}3802if (typeof strings === 'boolean') {3803validatedStrings = strings ? 'on' : 'off';3804} else {3805validatedStrings = stringSet(strings, this.defaultValue.strings, allowedValues);3806}3807return {3808other: validatedOther,3809comments: validatedComments,3810strings: validatedStrings3811};3812}3813}38143815//#endregion38163817//#region renderLineNumbers38183819export type LineNumbersType = 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string);38203821export const enum RenderLineNumbersType {3822Off = 0,3823On = 1,3824Relative = 2,3825Interval = 3,3826Custom = 43827}38283829export interface InternalEditorRenderLineNumbersOptions {3830readonly renderType: RenderLineNumbersType;3831readonly renderFn: ((lineNumber: number) => string) | null;3832}38333834class EditorRenderLineNumbersOption extends BaseEditorOption<EditorOption.lineNumbers, LineNumbersType, InternalEditorRenderLineNumbersOptions> {38353836constructor() {3837super(3838EditorOption.lineNumbers, 'lineNumbers', { renderType: RenderLineNumbersType.On, renderFn: null },3839{3840type: 'string',3841enum: ['off', 'on', 'relative', 'interval'],3842enumDescriptions: [3843nls.localize('lineNumbers.off', "Line numbers are not rendered."),3844nls.localize('lineNumbers.on', "Line numbers are rendered as absolute number."),3845nls.localize('lineNumbers.relative', "Line numbers are rendered as distance in lines to cursor position."),3846nls.localize('lineNumbers.interval', "Line numbers are rendered every 10 lines.")3847],3848default: 'on',3849description: nls.localize('lineNumbers', "Controls the display of line numbers.")3850}3851);3852}38533854public validate(lineNumbers: unknown): InternalEditorRenderLineNumbersOptions {3855let renderType: RenderLineNumbersType = this.defaultValue.renderType;3856let renderFn: ((lineNumber: number) => string) | null = this.defaultValue.renderFn;38573858if (typeof lineNumbers !== 'undefined') {3859if (typeof lineNumbers === 'function') {3860renderType = RenderLineNumbersType.Custom;3861renderFn = lineNumbers as ((lineNumber: number) => string);3862} else if (lineNumbers === 'interval') {3863renderType = RenderLineNumbersType.Interval;3864} else if (lineNumbers === 'relative') {3865renderType = RenderLineNumbersType.Relative;3866} else if (lineNumbers === 'on') {3867renderType = RenderLineNumbersType.On;3868} else {3869renderType = RenderLineNumbersType.Off;3870}3871}38723873return {3874renderType,3875renderFn3876};3877}3878}38793880//#endregion38813882//#region renderValidationDecorations38833884/**3885* @internal3886*/3887export function filterValidationDecorations(options: IComputedEditorOptions): boolean {3888const renderValidationDecorations = options.get(EditorOption.renderValidationDecorations);3889if (renderValidationDecorations === 'editable') {3890return options.get(EditorOption.readOnly);3891}3892return renderValidationDecorations === 'on' ? false : true;3893}38943895//#endregion38963897//#region filterFontDecorations38983899/**3900* @internal3901*/3902export function filterFontDecorations(options: IComputedEditorOptions): boolean {3903return !options.get(EditorOption.effectiveAllowVariableFonts);3904}39053906//#endregion39073908//#region rulers39093910export interface IRulerOption {3911readonly column: number;3912readonly color: string | null;3913}39143915class EditorRulers extends BaseEditorOption<EditorOption.rulers, (number | IRulerOption)[], IRulerOption[]> {39163917constructor() {3918const defaults: IRulerOption[] = [];3919const columnSchema: IJSONSchema = { type: 'number', description: nls.localize('rulers.size', "Number of monospace characters at which this editor ruler will render.") };3920super(3921EditorOption.rulers, 'rulers', defaults,3922{3923type: 'array',3924items: {3925anyOf: [3926columnSchema,3927{3928type: [3929'object'3930],3931properties: {3932column: columnSchema,3933color: {3934type: 'string',3935description: nls.localize('rulers.color', "Color of this editor ruler."),3936format: 'color-hex'3937}3938}3939}3940]3941},3942default: defaults,3943description: nls.localize('rulers', "Render vertical rulers after a certain number of monospace characters. Use multiple values for multiple rulers. No rulers are drawn if array is empty.")3944}3945);3946}39473948public validate(input: unknown): IRulerOption[] {3949if (Array.isArray(input)) {3950const rulers: IRulerOption[] = [];3951for (const _element of input) {3952if (typeof _element === 'number') {3953rulers.push({3954column: EditorIntOption.clampedInt(_element, 0, 0, 10000),3955color: null3956});3957} else if (_element && typeof _element === 'object') {3958const element = _element as IRulerOption;3959rulers.push({3960column: EditorIntOption.clampedInt(element.column, 0, 0, 10000),3961color: element.color3962});3963}3964}3965rulers.sort((a, b) => a.column - b.column);3966return rulers;3967}3968return this.defaultValue;3969}3970}39713972//#endregion39733974//#region readonly39753976/**3977* Configuration options for readonly message3978*/3979class ReadonlyMessage extends BaseEditorOption<EditorOption.readOnlyMessage, IMarkdownString | undefined, IMarkdownString | undefined> {3980constructor() {3981const defaults = undefined;39823983super(3984EditorOption.readOnlyMessage, 'readOnlyMessage', defaults3985);3986}39873988public validate(_input: unknown): IMarkdownString | undefined {3989if (!_input || typeof _input !== 'object') {3990return this.defaultValue;3991}3992return _input as IMarkdownString;3993}3994}39953996//#endregion39973998//#region scrollbar39994000/**4001* Configuration options for editor scrollbars4002*/4003export interface IEditorScrollbarOptions {4004/**4005* The size of arrows (if displayed).4006* Defaults to 11.4007* **NOTE**: This option cannot be updated using `updateOptions()`4008*/4009arrowSize?: number;4010/**4011* Render vertical scrollbar.4012* Defaults to 'auto'.4013*/4014vertical?: 'auto' | 'visible' | 'hidden';4015/**4016* Render horizontal scrollbar.4017* Defaults to 'auto'.4018*/4019horizontal?: 'auto' | 'visible' | 'hidden';4020/**4021* Cast horizontal and vertical shadows when the content is scrolled.4022* Defaults to true.4023* **NOTE**: This option cannot be updated using `updateOptions()`4024*/4025useShadows?: boolean;4026/**4027* Render arrows at the top and bottom of the vertical scrollbar.4028* Defaults to false.4029* **NOTE**: This option cannot be updated using `updateOptions()`4030*/4031verticalHasArrows?: boolean;4032/**4033* Render arrows at the left and right of the horizontal scrollbar.4034* Defaults to false.4035* **NOTE**: This option cannot be updated using `updateOptions()`4036*/4037horizontalHasArrows?: boolean;4038/**4039* Listen to mouse wheel events and react to them by scrolling.4040* Defaults to true.4041*/4042handleMouseWheel?: boolean;4043/**4044* Always consume mouse wheel events (always call preventDefault() and stopPropagation() on the browser events).4045* Defaults to true.4046* **NOTE**: This option cannot be updated using `updateOptions()`4047*/4048alwaysConsumeMouseWheel?: boolean;4049/**4050* Height in pixels for the horizontal scrollbar.4051* Defaults to 12 (px).4052*/4053horizontalScrollbarSize?: number;4054/**4055* Width in pixels for the vertical scrollbar.4056* Defaults to 14 (px).4057*/4058verticalScrollbarSize?: number;4059/**4060* Width in pixels for the vertical slider.4061* Defaults to `verticalScrollbarSize`.4062* **NOTE**: This option cannot be updated using `updateOptions()`4063*/4064verticalSliderSize?: number;4065/**4066* Height in pixels for the horizontal slider.4067* Defaults to `horizontalScrollbarSize`.4068* **NOTE**: This option cannot be updated using `updateOptions()`4069*/4070horizontalSliderSize?: number;4071/**4072* Scroll gutter clicks move by page vs jump to position.4073* Defaults to false.4074*/4075scrollByPage?: boolean;40764077/**4078* When set, the horizontal scrollbar will not increase content height.4079* Defaults to false.4080*/4081ignoreHorizontalScrollbarInContentHeight?: boolean;4082}40834084export interface InternalEditorScrollbarOptions {4085readonly arrowSize: number;4086readonly vertical: ScrollbarVisibility;4087readonly horizontal: ScrollbarVisibility;4088readonly useShadows: boolean;4089readonly verticalHasArrows: boolean;4090readonly horizontalHasArrows: boolean;4091readonly handleMouseWheel: boolean;4092readonly alwaysConsumeMouseWheel: boolean;4093readonly horizontalScrollbarSize: number;4094readonly horizontalSliderSize: number;4095readonly verticalScrollbarSize: number;4096readonly verticalSliderSize: number;4097readonly scrollByPage: boolean;4098readonly ignoreHorizontalScrollbarInContentHeight: boolean;4099}41004101function _scrollbarVisibilityFromString(visibility: unknown, defaultValue: ScrollbarVisibility): ScrollbarVisibility {4102if (typeof visibility !== 'string') {4103return defaultValue;4104}4105switch (visibility) {4106case 'hidden': return ScrollbarVisibility.Hidden;4107case 'visible': return ScrollbarVisibility.Visible;4108default: return ScrollbarVisibility.Auto;4109}4110}41114112class EditorScrollbar extends BaseEditorOption<EditorOption.scrollbar, IEditorScrollbarOptions, InternalEditorScrollbarOptions> {41134114constructor() {4115const defaults: InternalEditorScrollbarOptions = {4116vertical: ScrollbarVisibility.Auto,4117horizontal: ScrollbarVisibility.Auto,4118arrowSize: 11,4119useShadows: true,4120verticalHasArrows: false,4121horizontalHasArrows: false,4122horizontalScrollbarSize: 12,4123horizontalSliderSize: 12,4124verticalScrollbarSize: 14,4125verticalSliderSize: 14,4126handleMouseWheel: true,4127alwaysConsumeMouseWheel: true,4128scrollByPage: false,4129ignoreHorizontalScrollbarInContentHeight: false,4130};4131super(4132EditorOption.scrollbar, 'scrollbar', defaults,4133{4134'editor.scrollbar.vertical': {4135type: 'string',4136enum: ['auto', 'visible', 'hidden'],4137enumDescriptions: [4138nls.localize('scrollbar.vertical.auto', "The vertical scrollbar will be visible only when necessary."),4139nls.localize('scrollbar.vertical.visible', "The vertical scrollbar will always be visible."),4140nls.localize('scrollbar.vertical.fit', "The vertical scrollbar will always be hidden."),4141],4142default: 'auto',4143description: nls.localize('scrollbar.vertical', "Controls the visibility of the vertical scrollbar.")4144},4145'editor.scrollbar.horizontal': {4146type: 'string',4147enum: ['auto', 'visible', 'hidden'],4148enumDescriptions: [4149nls.localize('scrollbar.horizontal.auto', "The horizontal scrollbar will be visible only when necessary."),4150nls.localize('scrollbar.horizontal.visible', "The horizontal scrollbar will always be visible."),4151nls.localize('scrollbar.horizontal.fit', "The horizontal scrollbar will always be hidden."),4152],4153default: 'auto',4154description: nls.localize('scrollbar.horizontal', "Controls the visibility of the horizontal scrollbar.")4155},4156'editor.scrollbar.verticalScrollbarSize': {4157type: 'number',4158default: defaults.verticalScrollbarSize,4159description: nls.localize('scrollbar.verticalScrollbarSize', "The width of the vertical scrollbar.")4160},4161'editor.scrollbar.horizontalScrollbarSize': {4162type: 'number',4163default: defaults.horizontalScrollbarSize,4164description: nls.localize('scrollbar.horizontalScrollbarSize', "The height of the horizontal scrollbar.")4165},4166'editor.scrollbar.scrollByPage': {4167type: 'boolean',4168default: defaults.scrollByPage,4169description: nls.localize('scrollbar.scrollByPage', "Controls whether clicks scroll by page or jump to click position.")4170},4171'editor.scrollbar.ignoreHorizontalScrollbarInContentHeight': {4172type: 'boolean',4173default: defaults.ignoreHorizontalScrollbarInContentHeight,4174description: nls.localize('scrollbar.ignoreHorizontalScrollbarInContentHeight', "When set, the horizontal scrollbar will not increase the size of the editor's content.")4175}4176}4177);4178}41794180public validate(_input: unknown): InternalEditorScrollbarOptions {4181if (!_input || typeof _input !== 'object') {4182return this.defaultValue;4183}4184const input = _input as Unknown<IEditorScrollbarOptions>;4185const horizontalScrollbarSize = EditorIntOption.clampedInt(input.horizontalScrollbarSize, this.defaultValue.horizontalScrollbarSize, 0, 1000);4186const verticalScrollbarSize = EditorIntOption.clampedInt(input.verticalScrollbarSize, this.defaultValue.verticalScrollbarSize, 0, 1000);4187return {4188arrowSize: EditorIntOption.clampedInt(input.arrowSize, this.defaultValue.arrowSize, 0, 1000),4189vertical: _scrollbarVisibilityFromString(input.vertical, this.defaultValue.vertical),4190horizontal: _scrollbarVisibilityFromString(input.horizontal, this.defaultValue.horizontal),4191useShadows: boolean(input.useShadows, this.defaultValue.useShadows),4192verticalHasArrows: boolean(input.verticalHasArrows, this.defaultValue.verticalHasArrows),4193horizontalHasArrows: boolean(input.horizontalHasArrows, this.defaultValue.horizontalHasArrows),4194handleMouseWheel: boolean(input.handleMouseWheel, this.defaultValue.handleMouseWheel),4195alwaysConsumeMouseWheel: boolean(input.alwaysConsumeMouseWheel, this.defaultValue.alwaysConsumeMouseWheel),4196horizontalScrollbarSize: horizontalScrollbarSize,4197horizontalSliderSize: EditorIntOption.clampedInt(input.horizontalSliderSize, horizontalScrollbarSize, 0, 1000),4198verticalScrollbarSize: verticalScrollbarSize,4199verticalSliderSize: EditorIntOption.clampedInt(input.verticalSliderSize, verticalScrollbarSize, 0, 1000),4200scrollByPage: boolean(input.scrollByPage, this.defaultValue.scrollByPage),4201ignoreHorizontalScrollbarInContentHeight: boolean(input.ignoreHorizontalScrollbarInContentHeight, this.defaultValue.ignoreHorizontalScrollbarInContentHeight),4202};4203}4204}42054206//#endregion42074208//#region UnicodeHighlight42094210export type InUntrustedWorkspace = 'inUntrustedWorkspace';42114212/**4213* @internal4214*/4215export const inUntrustedWorkspace: InUntrustedWorkspace = 'inUntrustedWorkspace';42164217/**4218* Configuration options for unicode highlighting.4219*/4220export interface IUnicodeHighlightOptions {42214222/**4223* Controls whether all non-basic ASCII characters are highlighted. Only characters between U+0020 and U+007E, tab, line-feed and carriage-return are considered basic ASCII.4224*/4225nonBasicASCII?: boolean | InUntrustedWorkspace;42264227/**4228* Controls whether characters that just reserve space or have no width at all are highlighted.4229*/4230invisibleCharacters?: boolean;42314232/**4233* Controls whether characters are highlighted that can be confused with basic ASCII characters, except those that are common in the current user locale.4234*/4235ambiguousCharacters?: boolean;42364237/**4238* Controls whether characters in comments should also be subject to unicode highlighting.4239*/4240includeComments?: boolean | InUntrustedWorkspace;42414242/**4243* Controls whether characters in strings should also be subject to unicode highlighting.4244*/4245includeStrings?: boolean | InUntrustedWorkspace;42464247/**4248* Defines allowed characters that are not being highlighted.4249*/4250allowedCharacters?: Record<string, true>;42514252/**4253* Unicode characters that are common in allowed locales are not being highlighted.4254*/4255allowedLocales?: Record<string | '_os' | '_vscode', true>;4256}42574258/**4259* @internal4260*/4261export type InternalUnicodeHighlightOptions = Required<Readonly<IUnicodeHighlightOptions>>;42624263/**4264* @internal4265*/4266export const unicodeHighlightConfigKeys = {4267allowedCharacters: 'editor.unicodeHighlight.allowedCharacters',4268invisibleCharacters: 'editor.unicodeHighlight.invisibleCharacters',4269nonBasicASCII: 'editor.unicodeHighlight.nonBasicASCII',4270ambiguousCharacters: 'editor.unicodeHighlight.ambiguousCharacters',4271includeComments: 'editor.unicodeHighlight.includeComments',4272includeStrings: 'editor.unicodeHighlight.includeStrings',4273allowedLocales: 'editor.unicodeHighlight.allowedLocales',4274};42754276class UnicodeHighlight extends BaseEditorOption<EditorOption.unicodeHighlighting, IUnicodeHighlightOptions, InternalUnicodeHighlightOptions> {4277constructor() {4278const defaults: InternalUnicodeHighlightOptions = {4279nonBasicASCII: inUntrustedWorkspace,4280invisibleCharacters: true,4281ambiguousCharacters: true,4282includeComments: inUntrustedWorkspace,4283includeStrings: true,4284allowedCharacters: {},4285allowedLocales: { _os: true, _vscode: true },4286};42874288super(4289EditorOption.unicodeHighlighting, 'unicodeHighlight', defaults,4290{4291[unicodeHighlightConfigKeys.nonBasicASCII]: {4292restricted: true,4293type: ['boolean', 'string'],4294enum: [true, false, inUntrustedWorkspace],4295default: defaults.nonBasicASCII,4296description: nls.localize('unicodeHighlight.nonBasicASCII', "Controls whether all non-basic ASCII characters are highlighted. Only characters between U+0020 and U+007E, tab, line-feed and carriage-return are considered basic ASCII.")4297},4298[unicodeHighlightConfigKeys.invisibleCharacters]: {4299restricted: true,4300type: 'boolean',4301default: defaults.invisibleCharacters,4302description: nls.localize('unicodeHighlight.invisibleCharacters', "Controls whether characters that just reserve space or have no width at all are highlighted.")4303},4304[unicodeHighlightConfigKeys.ambiguousCharacters]: {4305restricted: true,4306type: 'boolean',4307default: defaults.ambiguousCharacters,4308description: nls.localize('unicodeHighlight.ambiguousCharacters', "Controls whether characters are highlighted that can be confused with basic ASCII characters, except those that are common in the current user locale.")4309},4310[unicodeHighlightConfigKeys.includeComments]: {4311restricted: true,4312type: ['boolean', 'string'],4313enum: [true, false, inUntrustedWorkspace],4314default: defaults.includeComments,4315description: nls.localize('unicodeHighlight.includeComments', "Controls whether characters in comments should also be subject to Unicode highlighting.")4316},4317[unicodeHighlightConfigKeys.includeStrings]: {4318restricted: true,4319type: ['boolean', 'string'],4320enum: [true, false, inUntrustedWorkspace],4321default: defaults.includeStrings,4322description: nls.localize('unicodeHighlight.includeStrings', "Controls whether characters in strings should also be subject to Unicode highlighting.")4323},4324[unicodeHighlightConfigKeys.allowedCharacters]: {4325restricted: true,4326type: 'object',4327default: defaults.allowedCharacters,4328description: nls.localize('unicodeHighlight.allowedCharacters', "Defines allowed characters that are not being highlighted."),4329additionalProperties: {4330type: 'boolean'4331}4332},4333[unicodeHighlightConfigKeys.allowedLocales]: {4334restricted: true,4335type: 'object',4336additionalProperties: {4337type: 'boolean'4338},4339default: defaults.allowedLocales,4340description: nls.localize('unicodeHighlight.allowedLocales', "Unicode characters that are common in allowed locales are not being highlighted.")4341},4342}4343);4344}43454346public override applyUpdate(value: Required<Readonly<IUnicodeHighlightOptions>> | undefined, update: Required<Readonly<IUnicodeHighlightOptions>>): ApplyUpdateResult<Required<Readonly<IUnicodeHighlightOptions>>> {4347let didChange = false;4348if (update.allowedCharacters && value) {4349// Treat allowedCharacters atomically4350if (!objects.equals(value.allowedCharacters, update.allowedCharacters)) {4351value = { ...value, allowedCharacters: update.allowedCharacters };4352didChange = true;4353}4354}4355if (update.allowedLocales && value) {4356// Treat allowedLocales atomically4357if (!objects.equals(value.allowedLocales, update.allowedLocales)) {4358value = { ...value, allowedLocales: update.allowedLocales };4359didChange = true;4360}4361}43624363const result = super.applyUpdate(value, update);4364if (didChange) {4365return new ApplyUpdateResult(result.newValue, true);4366}4367return result;4368}43694370public validate(_input: unknown): InternalUnicodeHighlightOptions {4371if (!_input || typeof _input !== 'object') {4372return this.defaultValue;4373}4374const input = _input as Unknown<IUnicodeHighlightOptions>;4375return {4376nonBasicASCII: primitiveSet<boolean | InUntrustedWorkspace>(input.nonBasicASCII, inUntrustedWorkspace, [true, false, inUntrustedWorkspace]),4377invisibleCharacters: boolean(input.invisibleCharacters, this.defaultValue.invisibleCharacters),4378ambiguousCharacters: boolean(input.ambiguousCharacters, this.defaultValue.ambiguousCharacters),4379includeComments: primitiveSet<boolean | InUntrustedWorkspace>(input.includeComments, inUntrustedWorkspace, [true, false, inUntrustedWorkspace]),4380includeStrings: primitiveSet<boolean | InUntrustedWorkspace>(input.includeStrings, inUntrustedWorkspace, [true, false, inUntrustedWorkspace]),4381allowedCharacters: this.validateBooleanMap(input.allowedCharacters, this.defaultValue.allowedCharacters),4382allowedLocales: this.validateBooleanMap(input.allowedLocales, this.defaultValue.allowedLocales),4383};4384}43854386private validateBooleanMap(map: unknown, defaultValue: Record<string, true>): Record<string, true> {4387if ((typeof map !== 'object') || !map) {4388return defaultValue;4389}4390const result: Record<string, true> = {};4391for (const [key, value] of Object.entries(map)) {4392if (value === true) {4393result[key] = true;4394}4395}4396return result;4397}4398}43994400//#endregion44014402//#region inlineSuggest44034404export interface IInlineSuggestOptions {4405/**4406* Enable or disable the rendering of automatic inline completions.4407*/4408enabled?: boolean;44094410/**4411* Configures the mode.4412* Use `prefix` to only show ghost text if the text to replace is a prefix of the suggestion text.4413* Use `subword` to only show ghost text if the replace text is a subword of the suggestion text.4414* Use `subwordSmart` to only show ghost text if the replace text is a subword of the suggestion text, but the subword must start after the cursor position.4415* Defaults to `prefix`.4416*/4417mode?: 'prefix' | 'subword' | 'subwordSmart';44184419showToolbar?: 'always' | 'onHover' | 'never';44204421syntaxHighlightingEnabled?: boolean;44224423suppressSuggestions?: boolean;44244425minShowDelay?: number;4426suppressInSnippetMode?: boolean;4427/**4428* Does not clear active inline suggestions when the editor loses focus.4429*/4430keepOnBlur?: boolean;44314432/**4433* Font family for inline suggestions.4434*/4435fontFamily?: string | 'default';44364437edits?: {4438allowCodeShifting?: 'always' | 'horizontal' | 'never';44394440renderSideBySide?: 'never' | 'auto';44414442showCollapsed?: boolean;44434444showLongDistanceHint?: boolean;44454446/**4447* @internal4448*/4449enabled?: boolean;4450};44514452/**4453* @internal4454*/4455triggerCommandOnProviderChange?: boolean;44564457/**4458* @internal4459*/4460experimental?: {4461/**4462* @internal4463*/4464suppressInlineSuggestions?: string;44654466/**4467* @internal4468*/4469emptyResponseInformation?: boolean;44704471showOnSuggestConflict?: 'always' | 'never' | 'whenSuggestListIsIncomplete';4472};4473}44744475type RequiredRecursive<T> = {4476[P in keyof T]-?: T[P] extends object | undefined ? RequiredRecursive<T[P]> : T[P];4477};44784479/**4480* @internal4481*/4482export type InternalInlineSuggestOptions = Readonly<RequiredRecursive<IInlineSuggestOptions>>;44834484/**4485* Configuration options for inline suggestions4486*/4487class InlineEditorSuggest extends BaseEditorOption<EditorOption.inlineSuggest, IInlineSuggestOptions, InternalInlineSuggestOptions> {4488constructor() {4489const defaults: InternalInlineSuggestOptions = {4490enabled: true,4491mode: 'subwordSmart',4492showToolbar: 'onHover',4493suppressSuggestions: false,4494keepOnBlur: false,4495fontFamily: 'default',4496syntaxHighlightingEnabled: true,4497minShowDelay: 0,4498suppressInSnippetMode: true,4499edits: {4500enabled: true,4501showCollapsed: false,4502renderSideBySide: 'auto',4503allowCodeShifting: 'always',4504showLongDistanceHint: true,4505},4506triggerCommandOnProviderChange: false,4507experimental: {4508suppressInlineSuggestions: '',4509showOnSuggestConflict: 'never',4510emptyResponseInformation: true,4511},4512};45134514super(4515EditorOption.inlineSuggest, 'inlineSuggest', defaults,4516{4517'editor.inlineSuggest.enabled': {4518type: 'boolean',4519default: defaults.enabled,4520description: nls.localize('inlineSuggest.enabled', "Controls whether to automatically show inline suggestions in the editor.")4521},4522'editor.inlineSuggest.showToolbar': {4523type: 'string',4524default: defaults.showToolbar,4525enum: ['always', 'onHover', 'never'],4526enumDescriptions: [4527nls.localize('inlineSuggest.showToolbar.always', "Show the inline suggestion toolbar whenever an inline suggestion is shown."),4528nls.localize('inlineSuggest.showToolbar.onHover', "Show the inline suggestion toolbar when hovering over an inline suggestion."),4529nls.localize('inlineSuggest.showToolbar.never', "Never show the inline suggestion toolbar."),4530],4531description: nls.localize('inlineSuggest.showToolbar', "Controls when to show the inline suggestion toolbar."),4532},4533'editor.inlineSuggest.syntaxHighlightingEnabled': {4534type: 'boolean',4535default: defaults.syntaxHighlightingEnabled,4536description: nls.localize('inlineSuggest.syntaxHighlightingEnabled', "Controls whether to show syntax highlighting for inline suggestions in the editor."),4537},4538'editor.inlineSuggest.suppressSuggestions': {4539type: 'boolean',4540default: defaults.suppressSuggestions,4541description: nls.localize('inlineSuggest.suppressSuggestions', "Controls how inline suggestions interact with the suggest widget. If enabled, the suggest widget is not shown automatically when inline suggestions are available.")4542},4543'editor.inlineSuggest.suppressInSnippetMode': {4544type: 'boolean',4545default: defaults.suppressInSnippetMode,4546description: nls.localize('inlineSuggest.suppressInSnippetMode', "Controls whether inline suggestions are suppressed when in snippet mode."),4547},4548'editor.inlineSuggest.minShowDelay': {4549type: 'number',4550default: 0,4551minimum: 0,4552maximum: 10000,4553description: nls.localize('inlineSuggest.minShowDelay', "Controls the minimal delay in milliseconds after which inline suggestions are shown after typing."),4554},4555'editor.inlineSuggest.experimental.suppressInlineSuggestions': {4556type: 'string',4557default: defaults.experimental.suppressInlineSuggestions,4558tags: ['experimental'],4559description: nls.localize('inlineSuggest.suppressInlineSuggestions', "Suppresses inline completions for specified extension IDs -- comma separated."),4560experiment: {4561mode: 'auto'4562}4563},4564'editor.inlineSuggest.experimental.emptyResponseInformation': {4565type: 'boolean',4566default: defaults.experimental.emptyResponseInformation,4567tags: ['experimental'],4568description: nls.localize('inlineSuggest.emptyResponseInformation', "Controls whether to send request information from the inline suggestion provider."),4569experiment: {4570mode: 'auto'4571}4572},4573'editor.inlineSuggest.triggerCommandOnProviderChange': {4574type: 'boolean',4575default: defaults.triggerCommandOnProviderChange,4576tags: ['experimental'],4577description: nls.localize('inlineSuggest.triggerCommandOnProviderChange', "Controls whether to trigger a command when the inline suggestion provider changes."),4578experiment: {4579mode: 'auto'4580}4581},4582'editor.inlineSuggest.experimental.showOnSuggestConflict': {4583type: 'string',4584default: defaults.experimental.showOnSuggestConflict,4585tags: ['experimental'],4586enum: ['always', 'never', 'whenSuggestListIsIncomplete'],4587description: nls.localize('inlineSuggest.showOnSuggestConflict', "Controls whether to show inline suggestions when there is a suggest conflict."),4588experiment: {4589mode: 'auto'4590}4591},4592'editor.inlineSuggest.fontFamily': {4593type: 'string',4594default: defaults.fontFamily,4595description: nls.localize('inlineSuggest.fontFamily', "Controls the font family of the inline suggestions.")4596},4597'editor.inlineSuggest.edits.allowCodeShifting': {4598type: 'string',4599default: defaults.edits.allowCodeShifting,4600description: nls.localize('inlineSuggest.edits.allowCodeShifting', "Controls whether showing a suggestion will shift the code to make space for the suggestion inline."),4601enum: ['always', 'horizontal', 'never'],4602tags: ['nextEditSuggestions']4603},4604'editor.inlineSuggest.edits.showLongDistanceHint': {4605type: 'boolean',4606default: defaults.edits.showLongDistanceHint,4607description: nls.localize('inlineSuggest.edits.showLongDistanceHint', "Controls whether long distance inline suggestions are shown."),4608tags: ['nextEditSuggestions', 'experimental']4609},4610'editor.inlineSuggest.edits.renderSideBySide': {4611type: 'string',4612default: defaults.edits.renderSideBySide,4613description: nls.localize('inlineSuggest.edits.renderSideBySide', "Controls whether larger suggestions can be shown side by side."),4614enum: ['auto', 'never'],4615enumDescriptions: [4616nls.localize('editor.inlineSuggest.edits.renderSideBySide.auto', "Larger suggestions will show side by side if there is enough space, otherwise they will be shown below."),4617nls.localize('editor.inlineSuggest.edits.renderSideBySide.never', "Larger suggestions are never shown side by side and will always be shown below."),4618],4619tags: ['nextEditSuggestions']4620},4621'editor.inlineSuggest.edits.showCollapsed': {4622type: 'boolean',4623default: defaults.edits.showCollapsed,4624description: nls.localize('inlineSuggest.edits.showCollapsed', "Controls whether the suggestion will show as collapsed until jumping to it."),4625tags: ['nextEditSuggestions']4626},4627}4628);4629}46304631public validate(_input: unknown): InternalInlineSuggestOptions {4632if (!_input || typeof _input !== 'object') {4633return this.defaultValue;4634}4635const input = _input as Unknown<IInlineSuggestOptions>;4636return {4637enabled: boolean(input.enabled, this.defaultValue.enabled),4638mode: stringSet(input.mode, this.defaultValue.mode, ['prefix', 'subword', 'subwordSmart']),4639showToolbar: stringSet(input.showToolbar, this.defaultValue.showToolbar, ['always', 'onHover', 'never']),4640suppressSuggestions: boolean(input.suppressSuggestions, this.defaultValue.suppressSuggestions),4641keepOnBlur: boolean(input.keepOnBlur, this.defaultValue.keepOnBlur),4642fontFamily: EditorStringOption.string(input.fontFamily, this.defaultValue.fontFamily),4643syntaxHighlightingEnabled: boolean(input.syntaxHighlightingEnabled, this.defaultValue.syntaxHighlightingEnabled),4644minShowDelay: EditorIntOption.clampedInt(input.minShowDelay, 0, 0, 10000),4645suppressInSnippetMode: boolean(input.suppressInSnippetMode, this.defaultValue.suppressInSnippetMode),4646edits: this._validateEdits(input.edits),4647triggerCommandOnProviderChange: boolean(input.triggerCommandOnProviderChange, this.defaultValue.triggerCommandOnProviderChange),4648experimental: this._validateExperimental(input.experimental),4649};4650}46514652private _validateEdits(_input: unknown): InternalInlineSuggestOptions['edits'] {4653if (!_input || typeof _input !== 'object') {4654return this.defaultValue.edits;4655}4656const input = _input as Unknown<InternalInlineSuggestOptions['edits']>;4657return {4658enabled: boolean(input.enabled, this.defaultValue.edits.enabled),4659showCollapsed: boolean(input.showCollapsed, this.defaultValue.edits.showCollapsed),4660allowCodeShifting: stringSet(input.allowCodeShifting, this.defaultValue.edits.allowCodeShifting, ['always', 'horizontal', 'never']),4661showLongDistanceHint: boolean(input.showLongDistanceHint, this.defaultValue.edits.showLongDistanceHint),4662renderSideBySide: stringSet(input.renderSideBySide, this.defaultValue.edits.renderSideBySide, ['never', 'auto']),4663};4664}46654666private _validateExperimental(_input: unknown): InternalInlineSuggestOptions['experimental'] {4667if (!_input || typeof _input !== 'object') {4668return this.defaultValue.experimental;4669}4670const input = _input as Unknown<InternalInlineSuggestOptions['experimental']>;4671return {4672suppressInlineSuggestions: EditorStringOption.string(input.suppressInlineSuggestions, this.defaultValue.experimental.suppressInlineSuggestions),4673showOnSuggestConflict: stringSet(input.showOnSuggestConflict, this.defaultValue.experimental.showOnSuggestConflict, ['always', 'never', 'whenSuggestListIsIncomplete']),4674emptyResponseInformation: boolean(input.emptyResponseInformation, this.defaultValue.experimental.emptyResponseInformation),4675};4676}4677}46784679//#endregion46804681//#region bracketPairColorization46824683export interface IBracketPairColorizationOptions {4684/**4685* Enable or disable bracket pair colorization.4686*/4687enabled?: boolean;46884689/**4690* Use independent color pool per bracket type.4691*/4692independentColorPoolPerBracketType?: boolean;4693}46944695/**4696* @internal4697*/4698export type InternalBracketPairColorizationOptions = Readonly<Required<IBracketPairColorizationOptions>>;46994700/**4701* Configuration options for inline suggestions4702*/4703class BracketPairColorization extends BaseEditorOption<EditorOption.bracketPairColorization, IBracketPairColorizationOptions, InternalBracketPairColorizationOptions> {4704constructor() {4705const defaults: InternalBracketPairColorizationOptions = {4706enabled: EDITOR_MODEL_DEFAULTS.bracketPairColorizationOptions.enabled,4707independentColorPoolPerBracketType: EDITOR_MODEL_DEFAULTS.bracketPairColorizationOptions.independentColorPoolPerBracketType,4708};47094710super(4711EditorOption.bracketPairColorization, 'bracketPairColorization', defaults,4712{4713'editor.bracketPairColorization.enabled': {4714type: 'boolean',4715default: defaults.enabled,4716markdownDescription: nls.localize('bracketPairColorization.enabled', "Controls whether bracket pair colorization is enabled or not. Use {0} to override the bracket highlight colors.", '`#workbench.colorCustomizations#`')4717},4718'editor.bracketPairColorization.independentColorPoolPerBracketType': {4719type: 'boolean',4720default: defaults.independentColorPoolPerBracketType,4721description: nls.localize('bracketPairColorization.independentColorPoolPerBracketType', "Controls whether each bracket type has its own independent color pool.")4722},4723}4724);4725}47264727public validate(_input: unknown): InternalBracketPairColorizationOptions {4728if (!_input || typeof _input !== 'object') {4729return this.defaultValue;4730}4731const input = _input as Unknown<IBracketPairColorizationOptions>;4732return {4733enabled: boolean(input.enabled, this.defaultValue.enabled),4734independentColorPoolPerBracketType: boolean(input.independentColorPoolPerBracketType, this.defaultValue.independentColorPoolPerBracketType),4735};4736}4737}47384739//#endregion47404741//#region guides47424743export interface IGuidesOptions {4744/**4745* Enable rendering of bracket pair guides.4746* Defaults to false.4747*/4748bracketPairs?: boolean | 'active';47494750/**4751* Enable rendering of vertical bracket pair guides.4752* Defaults to 'active'.4753*/4754bracketPairsHorizontal?: boolean | 'active';47554756/**4757* Enable highlighting of the active bracket pair.4758* Defaults to true.4759*/4760highlightActiveBracketPair?: boolean;47614762/**4763* Enable rendering of indent guides.4764* Defaults to true.4765*/4766indentation?: boolean;47674768/**4769* Enable highlighting of the active indent guide.4770* Defaults to true.4771*/4772highlightActiveIndentation?: boolean | 'always';4773}47744775/**4776* @internal4777*/4778export type InternalGuidesOptions = Readonly<Required<IGuidesOptions>>;47794780/**4781* Configuration options for inline suggestions4782*/4783class GuideOptions extends BaseEditorOption<EditorOption.guides, IGuidesOptions, InternalGuidesOptions> {4784constructor() {4785const defaults: InternalGuidesOptions = {4786bracketPairs: false,4787bracketPairsHorizontal: 'active',4788highlightActiveBracketPair: true,47894790indentation: true,4791highlightActiveIndentation: true4792};47934794super(4795EditorOption.guides, 'guides', defaults,4796{4797'editor.guides.bracketPairs': {4798type: ['boolean', 'string'],4799enum: [true, 'active', false],4800enumDescriptions: [4801nls.localize('editor.guides.bracketPairs.true', "Enables bracket pair guides."),4802nls.localize('editor.guides.bracketPairs.active', "Enables bracket pair guides only for the active bracket pair."),4803nls.localize('editor.guides.bracketPairs.false', "Disables bracket pair guides."),4804],4805default: defaults.bracketPairs,4806description: nls.localize('editor.guides.bracketPairs', "Controls whether bracket pair guides are enabled or not.")4807},4808'editor.guides.bracketPairsHorizontal': {4809type: ['boolean', 'string'],4810enum: [true, 'active', false],4811enumDescriptions: [4812nls.localize('editor.guides.bracketPairsHorizontal.true', "Enables horizontal guides as addition to vertical bracket pair guides."),4813nls.localize('editor.guides.bracketPairsHorizontal.active', "Enables horizontal guides only for the active bracket pair."),4814nls.localize('editor.guides.bracketPairsHorizontal.false', "Disables horizontal bracket pair guides."),4815],4816default: defaults.bracketPairsHorizontal,4817description: nls.localize('editor.guides.bracketPairsHorizontal', "Controls whether horizontal bracket pair guides are enabled or not.")4818},4819'editor.guides.highlightActiveBracketPair': {4820type: 'boolean',4821default: defaults.highlightActiveBracketPair,4822description: nls.localize('editor.guides.highlightActiveBracketPair', "Controls whether the editor should highlight the active bracket pair.")4823},4824'editor.guides.indentation': {4825type: 'boolean',4826default: defaults.indentation,4827description: nls.localize('editor.guides.indentation', "Controls whether the editor should render indent guides.")4828},4829'editor.guides.highlightActiveIndentation': {4830type: ['boolean', 'string'],4831enum: [true, 'always', false],4832enumDescriptions: [4833nls.localize('editor.guides.highlightActiveIndentation.true', "Highlights the active indent guide."),4834nls.localize('editor.guides.highlightActiveIndentation.always', "Highlights the active indent guide even if bracket guides are highlighted."),4835nls.localize('editor.guides.highlightActiveIndentation.false', "Do not highlight the active indent guide."),4836],4837default: defaults.highlightActiveIndentation,48384839description: nls.localize('editor.guides.highlightActiveIndentation', "Controls whether the editor should highlight the active indent guide.")4840}4841}4842);4843}48444845public validate(_input: unknown): InternalGuidesOptions {4846if (!_input || typeof _input !== 'object') {4847return this.defaultValue;4848}4849const input = _input as Unknown<IGuidesOptions>;4850return {4851bracketPairs: primitiveSet(input.bracketPairs, this.defaultValue.bracketPairs, [true, false, 'active']),4852bracketPairsHorizontal: primitiveSet(input.bracketPairsHorizontal, this.defaultValue.bracketPairsHorizontal, [true, false, 'active']),4853highlightActiveBracketPair: boolean(input.highlightActiveBracketPair, this.defaultValue.highlightActiveBracketPair),48544855indentation: boolean(input.indentation, this.defaultValue.indentation),4856highlightActiveIndentation: primitiveSet(input.highlightActiveIndentation, this.defaultValue.highlightActiveIndentation, [true, false, 'always']),4857};4858}4859}48604861function primitiveSet<T extends string | boolean>(value: unknown, defaultValue: T, allowedValues: T[]): T {4862const idx = allowedValues.indexOf(value as T);4863if (idx === -1) {4864return defaultValue;4865}4866return allowedValues[idx];4867}48684869//#endregion48704871//#region suggest48724873/**4874* Configuration options for editor suggest widget4875*/4876export interface ISuggestOptions {4877/**4878* Overwrite word ends on accept. Default to false.4879*/4880insertMode?: 'insert' | 'replace';4881/**4882* Enable graceful matching. Defaults to true.4883*/4884filterGraceful?: boolean;4885/**4886* Prevent quick suggestions when a snippet is active. Defaults to true.4887*/4888snippetsPreventQuickSuggestions?: boolean;4889/**4890* Favors words that appear close to the cursor.4891*/4892localityBonus?: boolean;4893/**4894* Enable using global storage for remembering suggestions.4895*/4896shareSuggestSelections?: boolean;4897/**4898* Select suggestions when triggered via quick suggest or trigger characters4899*/4900selectionMode?: 'always' | 'never' | 'whenTriggerCharacter' | 'whenQuickSuggestion';4901/**4902* Enable or disable icons in suggestions. Defaults to true.4903*/4904showIcons?: boolean;4905/**4906* Enable or disable the suggest status bar.4907*/4908showStatusBar?: boolean;4909/**4910* Enable or disable the rendering of the suggestion preview.4911*/4912preview?: boolean;4913/**4914* Configures the mode of the preview.4915*/4916previewMode?: 'prefix' | 'subword' | 'subwordSmart';4917/**4918* Show details inline with the label. Defaults to true.4919*/4920showInlineDetails?: boolean;4921/**4922* Show method-suggestions.4923*/4924showMethods?: boolean;4925/**4926* Show function-suggestions.4927*/4928showFunctions?: boolean;4929/**4930* Show constructor-suggestions.4931*/4932showConstructors?: boolean;4933/**4934* Show deprecated-suggestions.4935*/4936showDeprecated?: boolean;4937/**4938* Controls whether suggestions allow matches in the middle of the word instead of only at the beginning4939*/4940matchOnWordStartOnly?: boolean;4941/**4942* Show field-suggestions.4943*/4944showFields?: boolean;4945/**4946* Show variable-suggestions.4947*/4948showVariables?: boolean;4949/**4950* Show class-suggestions.4951*/4952showClasses?: boolean;4953/**4954* Show struct-suggestions.4955*/4956showStructs?: boolean;4957/**4958* Show interface-suggestions.4959*/4960showInterfaces?: boolean;4961/**4962* Show module-suggestions.4963*/4964showModules?: boolean;4965/**4966* Show property-suggestions.4967*/4968showProperties?: boolean;4969/**4970* Show event-suggestions.4971*/4972showEvents?: boolean;4973/**4974* Show operator-suggestions.4975*/4976showOperators?: boolean;4977/**4978* Show unit-suggestions.4979*/4980showUnits?: boolean;4981/**4982* Show value-suggestions.4983*/4984showValues?: boolean;4985/**4986* Show constant-suggestions.4987*/4988showConstants?: boolean;4989/**4990* Show enum-suggestions.4991*/4992showEnums?: boolean;4993/**4994* Show enumMember-suggestions.4995*/4996showEnumMembers?: boolean;4997/**4998* Show keyword-suggestions.4999*/5000showKeywords?: boolean;5001/**5002* Show text-suggestions.5003*/5004showWords?: boolean;5005/**5006* Show color-suggestions.5007*/5008showColors?: boolean;5009/**5010* Show file-suggestions.5011*/5012showFiles?: boolean;5013/**5014* Show reference-suggestions.5015*/5016showReferences?: boolean;5017/**5018* Show folder-suggestions.5019*/5020showFolders?: boolean;5021/**5022* Show typeParameter-suggestions.5023*/5024showTypeParameters?: boolean;5025/**5026* Show issue-suggestions.5027*/5028showIssues?: boolean;5029/**5030* Show user-suggestions.5031*/5032showUsers?: boolean;5033/**5034* Show snippet-suggestions.5035*/5036showSnippets?: boolean;5037}50385039/**5040* @internal5041*/5042export type InternalSuggestOptions = Readonly<Required<ISuggestOptions>>;50435044class EditorSuggest extends BaseEditorOption<EditorOption.suggest, ISuggestOptions, InternalSuggestOptions> {50455046constructor() {5047const defaults: InternalSuggestOptions = {5048insertMode: 'insert',5049filterGraceful: true,5050snippetsPreventQuickSuggestions: false,5051localityBonus: false,5052shareSuggestSelections: false,5053selectionMode: 'always',5054showIcons: true,5055showStatusBar: false,5056preview: false,5057previewMode: 'subwordSmart',5058showInlineDetails: true,5059showMethods: true,5060showFunctions: true,5061showConstructors: true,5062showDeprecated: true,5063matchOnWordStartOnly: true,5064showFields: true,5065showVariables: true,5066showClasses: true,5067showStructs: true,5068showInterfaces: true,5069showModules: true,5070showProperties: true,5071showEvents: true,5072showOperators: true,5073showUnits: true,5074showValues: true,5075showConstants: true,5076showEnums: true,5077showEnumMembers: true,5078showKeywords: true,5079showWords: true,5080showColors: true,5081showFiles: true,5082showReferences: true,5083showFolders: true,5084showTypeParameters: true,5085showSnippets: true,5086showUsers: true,5087showIssues: true,5088};5089super(5090EditorOption.suggest, 'suggest', defaults,5091{5092'editor.suggest.insertMode': {5093type: 'string',5094enum: ['insert', 'replace'],5095enumDescriptions: [5096nls.localize('suggest.insertMode.insert', "Insert suggestion without overwriting text right of the cursor."),5097nls.localize('suggest.insertMode.replace', "Insert suggestion and overwrite text right of the cursor."),5098],5099default: defaults.insertMode,5100description: nls.localize('suggest.insertMode', "Controls whether words are overwritten when accepting completions. Note that this depends on extensions opting into this feature.")5101},5102'editor.suggest.filterGraceful': {5103type: 'boolean',5104default: defaults.filterGraceful,5105description: nls.localize('suggest.filterGraceful', "Controls whether filtering and sorting suggestions accounts for small typos.")5106},5107'editor.suggest.localityBonus': {5108type: 'boolean',5109default: defaults.localityBonus,5110description: nls.localize('suggest.localityBonus', "Controls whether sorting favors words that appear close to the cursor.")5111},5112'editor.suggest.shareSuggestSelections': {5113type: 'boolean',5114default: defaults.shareSuggestSelections,5115markdownDescription: nls.localize('suggest.shareSuggestSelections', "Controls whether remembered suggestion selections are shared between multiple workspaces and windows (needs `#editor.suggestSelection#`).")5116},5117'editor.suggest.selectionMode': {5118type: 'string',5119enum: ['always', 'never', 'whenTriggerCharacter', 'whenQuickSuggestion'],5120enumDescriptions: [5121nls.localize('suggest.insertMode.always', "Always select a suggestion when automatically triggering IntelliSense."),5122nls.localize('suggest.insertMode.never', "Never select a suggestion when automatically triggering IntelliSense."),5123nls.localize('suggest.insertMode.whenTriggerCharacter', "Select a suggestion only when triggering IntelliSense from a trigger character."),5124nls.localize('suggest.insertMode.whenQuickSuggestion', "Select a suggestion only when triggering IntelliSense as you type."),5125],5126default: defaults.selectionMode,5127markdownDescription: nls.localize('suggest.selectionMode', "Controls whether a suggestion is selected when the widget shows. Note that this only applies to automatically triggered suggestions ({0} and {1}) and that a suggestion is always selected when explicitly invoked, e.g via `Ctrl+Space`.", '`#editor.quickSuggestions#`', '`#editor.suggestOnTriggerCharacters#`')5128},5129'editor.suggest.snippetsPreventQuickSuggestions': {5130type: 'boolean',5131default: defaults.snippetsPreventQuickSuggestions,5132description: nls.localize('suggest.snippetsPreventQuickSuggestions', "Controls whether an active snippet prevents quick suggestions.")5133},5134'editor.suggest.showIcons': {5135type: 'boolean',5136default: defaults.showIcons,5137description: nls.localize('suggest.showIcons', "Controls whether to show or hide icons in suggestions.")5138},5139'editor.suggest.showStatusBar': {5140type: 'boolean',5141default: defaults.showStatusBar,5142description: nls.localize('suggest.showStatusBar', "Controls the visibility of the status bar at the bottom of the suggest widget.")5143},5144'editor.suggest.preview': {5145type: 'boolean',5146default: defaults.preview,5147description: nls.localize('suggest.preview', "Controls whether to preview the suggestion outcome in the editor.")5148},5149'editor.suggest.showInlineDetails': {5150type: 'boolean',5151default: defaults.showInlineDetails,5152description: nls.localize('suggest.showInlineDetails', "Controls whether suggest details show inline with the label or only in the details widget.")5153},5154'editor.suggest.maxVisibleSuggestions': {5155type: 'number',5156deprecationMessage: nls.localize('suggest.maxVisibleSuggestions.dep', "This setting is deprecated. The suggest widget can now be resized."),5157},5158'editor.suggest.filteredTypes': {5159type: 'object',5160deprecationMessage: nls.localize('deprecated', "This setting is deprecated, please use separate settings like 'editor.suggest.showKeywords' or 'editor.suggest.showSnippets' instead.")5161},5162'editor.suggest.showMethods': {5163type: 'boolean',5164default: true,5165markdownDescription: nls.localize('editor.suggest.showMethods', "When enabled IntelliSense shows `method`-suggestions.")5166},5167'editor.suggest.showFunctions': {5168type: 'boolean',5169default: true,5170markdownDescription: nls.localize('editor.suggest.showFunctions', "When enabled IntelliSense shows `function`-suggestions.")5171},5172'editor.suggest.showConstructors': {5173type: 'boolean',5174default: true,5175markdownDescription: nls.localize('editor.suggest.showConstructors', "When enabled IntelliSense shows `constructor`-suggestions.")5176},5177'editor.suggest.showDeprecated': {5178type: 'boolean',5179default: true,5180markdownDescription: nls.localize('editor.suggest.showDeprecated', "When enabled IntelliSense shows `deprecated`-suggestions.")5181},5182'editor.suggest.matchOnWordStartOnly': {5183type: 'boolean',5184default: true,5185markdownDescription: nls.localize('editor.suggest.matchOnWordStartOnly', "When enabled IntelliSense filtering requires that the first character matches on a word start. For example, `c` on `Console` or `WebContext` but _not_ on `description`. When disabled IntelliSense will show more results but still sorts them by match quality.")5186},5187'editor.suggest.showFields': {5188type: 'boolean',5189default: true,5190markdownDescription: nls.localize('editor.suggest.showFields', "When enabled IntelliSense shows `field`-suggestions.")5191},5192'editor.suggest.showVariables': {5193type: 'boolean',5194default: true,5195markdownDescription: nls.localize('editor.suggest.showVariables', "When enabled IntelliSense shows `variable`-suggestions.")5196},5197'editor.suggest.showClasses': {5198type: 'boolean',5199default: true,5200markdownDescription: nls.localize('editor.suggest.showClasss', "When enabled IntelliSense shows `class`-suggestions.")5201},5202'editor.suggest.showStructs': {5203type: 'boolean',5204default: true,5205markdownDescription: nls.localize('editor.suggest.showStructs', "When enabled IntelliSense shows `struct`-suggestions.")5206},5207'editor.suggest.showInterfaces': {5208type: 'boolean',5209default: true,5210markdownDescription: nls.localize('editor.suggest.showInterfaces', "When enabled IntelliSense shows `interface`-suggestions.")5211},5212'editor.suggest.showModules': {5213type: 'boolean',5214default: true,5215markdownDescription: nls.localize('editor.suggest.showModules', "When enabled IntelliSense shows `module`-suggestions.")5216},5217'editor.suggest.showProperties': {5218type: 'boolean',5219default: true,5220markdownDescription: nls.localize('editor.suggest.showPropertys', "When enabled IntelliSense shows `property`-suggestions.")5221},5222'editor.suggest.showEvents': {5223type: 'boolean',5224default: true,5225markdownDescription: nls.localize('editor.suggest.showEvents', "When enabled IntelliSense shows `event`-suggestions.")5226},5227'editor.suggest.showOperators': {5228type: 'boolean',5229default: true,5230markdownDescription: nls.localize('editor.suggest.showOperators', "When enabled IntelliSense shows `operator`-suggestions.")5231},5232'editor.suggest.showUnits': {5233type: 'boolean',5234default: true,5235markdownDescription: nls.localize('editor.suggest.showUnits', "When enabled IntelliSense shows `unit`-suggestions.")5236},5237'editor.suggest.showValues': {5238type: 'boolean',5239default: true,5240markdownDescription: nls.localize('editor.suggest.showValues', "When enabled IntelliSense shows `value`-suggestions.")5241},5242'editor.suggest.showConstants': {5243type: 'boolean',5244default: true,5245markdownDescription: nls.localize('editor.suggest.showConstants', "When enabled IntelliSense shows `constant`-suggestions.")5246},5247'editor.suggest.showEnums': {5248type: 'boolean',5249default: true,5250markdownDescription: nls.localize('editor.suggest.showEnums', "When enabled IntelliSense shows `enum`-suggestions.")5251},5252'editor.suggest.showEnumMembers': {5253type: 'boolean',5254default: true,5255markdownDescription: nls.localize('editor.suggest.showEnumMembers', "When enabled IntelliSense shows `enumMember`-suggestions.")5256},5257'editor.suggest.showKeywords': {5258type: 'boolean',5259default: true,5260markdownDescription: nls.localize('editor.suggest.showKeywords', "When enabled IntelliSense shows `keyword`-suggestions.")5261},5262'editor.suggest.showWords': {5263type: 'boolean',5264default: true,5265markdownDescription: nls.localize('editor.suggest.showTexts', "When enabled IntelliSense shows `text`-suggestions.")5266},5267'editor.suggest.showColors': {5268type: 'boolean',5269default: true,5270markdownDescription: nls.localize('editor.suggest.showColors', "When enabled IntelliSense shows `color`-suggestions.")5271},5272'editor.suggest.showFiles': {5273type: 'boolean',5274default: true,5275markdownDescription: nls.localize('editor.suggest.showFiles', "When enabled IntelliSense shows `file`-suggestions.")5276},5277'editor.suggest.showReferences': {5278type: 'boolean',5279default: true,5280markdownDescription: nls.localize('editor.suggest.showReferences', "When enabled IntelliSense shows `reference`-suggestions.")5281},5282'editor.suggest.showCustomcolors': {5283type: 'boolean',5284default: true,5285markdownDescription: nls.localize('editor.suggest.showCustomcolors', "When enabled IntelliSense shows `customcolor`-suggestions.")5286},5287'editor.suggest.showFolders': {5288type: 'boolean',5289default: true,5290markdownDescription: nls.localize('editor.suggest.showFolders', "When enabled IntelliSense shows `folder`-suggestions.")5291},5292'editor.suggest.showTypeParameters': {5293type: 'boolean',5294default: true,5295markdownDescription: nls.localize('editor.suggest.showTypeParameters', "When enabled IntelliSense shows `typeParameter`-suggestions.")5296},5297'editor.suggest.showSnippets': {5298type: 'boolean',5299default: true,5300markdownDescription: nls.localize('editor.suggest.showSnippets', "When enabled IntelliSense shows `snippet`-suggestions.")5301},5302'editor.suggest.showUsers': {5303type: 'boolean',5304default: true,5305markdownDescription: nls.localize('editor.suggest.showUsers', "When enabled IntelliSense shows `user`-suggestions.")5306},5307'editor.suggest.showIssues': {5308type: 'boolean',5309default: true,5310markdownDescription: nls.localize('editor.suggest.showIssues', "When enabled IntelliSense shows `issues`-suggestions.")5311}5312}5313);5314}53155316public validate(_input: unknown): InternalSuggestOptions {5317if (!_input || typeof _input !== 'object') {5318return this.defaultValue;5319}5320const input = _input as Unknown<ISuggestOptions>;5321return {5322insertMode: stringSet(input.insertMode, this.defaultValue.insertMode, ['insert', 'replace']),5323filterGraceful: boolean(input.filterGraceful, this.defaultValue.filterGraceful),5324snippetsPreventQuickSuggestions: boolean(input.snippetsPreventQuickSuggestions, this.defaultValue.filterGraceful),5325localityBonus: boolean(input.localityBonus, this.defaultValue.localityBonus),5326shareSuggestSelections: boolean(input.shareSuggestSelections, this.defaultValue.shareSuggestSelections),5327selectionMode: stringSet(input.selectionMode, this.defaultValue.selectionMode, ['always', 'never', 'whenQuickSuggestion', 'whenTriggerCharacter']),5328showIcons: boolean(input.showIcons, this.defaultValue.showIcons),5329showStatusBar: boolean(input.showStatusBar, this.defaultValue.showStatusBar),5330preview: boolean(input.preview, this.defaultValue.preview),5331previewMode: stringSet(input.previewMode, this.defaultValue.previewMode, ['prefix', 'subword', 'subwordSmart']),5332showInlineDetails: boolean(input.showInlineDetails, this.defaultValue.showInlineDetails),5333showMethods: boolean(input.showMethods, this.defaultValue.showMethods),5334showFunctions: boolean(input.showFunctions, this.defaultValue.showFunctions),5335showConstructors: boolean(input.showConstructors, this.defaultValue.showConstructors),5336showDeprecated: boolean(input.showDeprecated, this.defaultValue.showDeprecated),5337matchOnWordStartOnly: boolean(input.matchOnWordStartOnly, this.defaultValue.matchOnWordStartOnly),5338showFields: boolean(input.showFields, this.defaultValue.showFields),5339showVariables: boolean(input.showVariables, this.defaultValue.showVariables),5340showClasses: boolean(input.showClasses, this.defaultValue.showClasses),5341showStructs: boolean(input.showStructs, this.defaultValue.showStructs),5342showInterfaces: boolean(input.showInterfaces, this.defaultValue.showInterfaces),5343showModules: boolean(input.showModules, this.defaultValue.showModules),5344showProperties: boolean(input.showProperties, this.defaultValue.showProperties),5345showEvents: boolean(input.showEvents, this.defaultValue.showEvents),5346showOperators: boolean(input.showOperators, this.defaultValue.showOperators),5347showUnits: boolean(input.showUnits, this.defaultValue.showUnits),5348showValues: boolean(input.showValues, this.defaultValue.showValues),5349showConstants: boolean(input.showConstants, this.defaultValue.showConstants),5350showEnums: boolean(input.showEnums, this.defaultValue.showEnums),5351showEnumMembers: boolean(input.showEnumMembers, this.defaultValue.showEnumMembers),5352showKeywords: boolean(input.showKeywords, this.defaultValue.showKeywords),5353showWords: boolean(input.showWords, this.defaultValue.showWords),5354showColors: boolean(input.showColors, this.defaultValue.showColors),5355showFiles: boolean(input.showFiles, this.defaultValue.showFiles),5356showReferences: boolean(input.showReferences, this.defaultValue.showReferences),5357showFolders: boolean(input.showFolders, this.defaultValue.showFolders),5358showTypeParameters: boolean(input.showTypeParameters, this.defaultValue.showTypeParameters),5359showSnippets: boolean(input.showSnippets, this.defaultValue.showSnippets),5360showUsers: boolean(input.showUsers, this.defaultValue.showUsers),5361showIssues: boolean(input.showIssues, this.defaultValue.showIssues),5362};5363}5364}53655366//#endregion53675368//#region smart select53695370export interface ISmartSelectOptions {5371selectLeadingAndTrailingWhitespace?: boolean;5372selectSubwords?: boolean;5373}53745375/**5376* @internal5377*/5378export type SmartSelectOptions = Readonly<Required<ISmartSelectOptions>>;53795380class SmartSelect extends BaseEditorOption<EditorOption.smartSelect, ISmartSelectOptions, SmartSelectOptions> {53815382constructor() {5383super(5384EditorOption.smartSelect, 'smartSelect',5385{5386selectLeadingAndTrailingWhitespace: true,5387selectSubwords: true,5388},5389{5390'editor.smartSelect.selectLeadingAndTrailingWhitespace': {5391description: nls.localize('selectLeadingAndTrailingWhitespace', "Whether leading and trailing whitespace should always be selected."),5392default: true,5393type: 'boolean'5394},5395'editor.smartSelect.selectSubwords': {5396description: nls.localize('selectSubwords', "Whether subwords (like 'foo' in 'fooBar' or 'foo_bar') should be selected."),5397default: true,5398type: 'boolean'5399}5400}5401);5402}54035404public validate(input: unknown): Readonly<Required<ISmartSelectOptions>> {5405if (!input || typeof input !== 'object') {5406return this.defaultValue;5407}5408return {5409selectLeadingAndTrailingWhitespace: boolean((input as ISmartSelectOptions).selectLeadingAndTrailingWhitespace, this.defaultValue.selectLeadingAndTrailingWhitespace),5410selectSubwords: boolean((input as ISmartSelectOptions).selectSubwords, this.defaultValue.selectSubwords),5411};5412}5413}54145415//#endregion54165417//#region wordSegmenterLocales54185419/**5420* Locales used for segmenting lines into words when doing word related navigations or operations.5421*5422* Specify the BCP 47 language tag of the word you wish to recognize (e.g., ja, zh-CN, zh-Hant-TW, etc.).5423*/5424class WordSegmenterLocales extends BaseEditorOption<EditorOption.wordSegmenterLocales, string | string[], string[]> {5425constructor() {5426const defaults: string[] = [];54275428super(5429EditorOption.wordSegmenterLocales, 'wordSegmenterLocales', defaults,5430{5431anyOf: [5432{5433type: 'string',5434}, {5435type: 'array',5436items: {5437type: 'string'5438}5439}5440],5441description: nls.localize('wordSegmenterLocales', "Locales to be used for word segmentation when doing word related navigations or operations. Specify the BCP 47 language tag of the word you wish to recognize (e.g., ja, zh-CN, zh-Hant-TW, etc.)."),5442type: 'array',5443items: {5444type: 'string',5445},5446default: defaults,5447},5448);5449}54505451public validate(input: unknown): string[] {5452if (typeof input === 'string') {5453input = [input];5454}5455if (Array.isArray(input)) {5456const validLocales: string[] = [];5457for (const locale of input) {5458if (typeof locale === 'string') {5459try {5460if (Intl.Segmenter.supportedLocalesOf(locale).length > 0) {5461validLocales.push(locale);5462}5463} catch {5464// ignore invalid locales5465}5466}5467}5468return validLocales;5469}54705471return this.defaultValue;5472}5473}547454755476//#endregion54775478//#region wrappingIndent54795480/**5481* Describes how to indent wrapped lines.5482*/5483export const enum WrappingIndent {5484/**5485* No indentation => wrapped lines begin at column 1.5486*/5487None = 0,5488/**5489* Same => wrapped lines get the same indentation as the parent.5490*/5491Same = 1,5492/**5493* Indent => wrapped lines get +1 indentation toward the parent.5494*/5495Indent = 2,5496/**5497* DeepIndent => wrapped lines get +2 indentation toward the parent.5498*/5499DeepIndent = 35500}55015502class WrappingIndentOption extends BaseEditorOption<EditorOption.wrappingIndent, 'none' | 'same' | 'indent' | 'deepIndent', WrappingIndent> {55035504constructor() {5505super(EditorOption.wrappingIndent, 'wrappingIndent', WrappingIndent.Same,5506{5507'editor.wrappingIndent': {5508type: 'string',5509enum: ['none', 'same', 'indent', 'deepIndent'],5510enumDescriptions: [5511nls.localize('wrappingIndent.none', "No indentation. Wrapped lines begin at column 1."),5512nls.localize('wrappingIndent.same', "Wrapped lines get the same indentation as the parent."),5513nls.localize('wrappingIndent.indent', "Wrapped lines get +1 indentation toward the parent."),5514nls.localize('wrappingIndent.deepIndent', "Wrapped lines get +2 indentation toward the parent."),5515],5516description: nls.localize('wrappingIndent', "Controls the indentation of wrapped lines."),5517default: 'same'5518}5519}5520);5521}55225523public validate(input: unknown): WrappingIndent {5524switch (input) {5525case 'none': return WrappingIndent.None;5526case 'same': return WrappingIndent.Same;5527case 'indent': return WrappingIndent.Indent;5528case 'deepIndent': return WrappingIndent.DeepIndent;5529}5530return WrappingIndent.Same;5531}55325533public override compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: WrappingIndent): WrappingIndent {5534const accessibilitySupport = options.get(EditorOption.accessibilitySupport);5535if (accessibilitySupport === AccessibilitySupport.Enabled) {5536// if we know for a fact that a screen reader is attached, we use no indent wrapping to5537// help that the editor's wrapping points match the textarea's wrapping points5538return WrappingIndent.None;5539}5540return value;5541}5542}55435544//#endregion55455546//#region wrappingInfo55475548export interface EditorWrappingInfo {5549readonly isDominatedByLongLines: boolean;5550readonly isWordWrapMinified: boolean;5551readonly isViewportWrapping: boolean;5552readonly wrappingColumn: number;5553}55545555class EditorWrappingInfoComputer extends ComputedEditorOption<EditorOption.wrappingInfo, EditorWrappingInfo> {55565557constructor() {5558super(EditorOption.wrappingInfo, {5559isDominatedByLongLines: false,5560isWordWrapMinified: false,5561isViewportWrapping: false,5562wrappingColumn: -15563});5564}55655566public compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, _: EditorWrappingInfo): EditorWrappingInfo {5567const layoutInfo = options.get(EditorOption.layoutInfo);55685569return {5570isDominatedByLongLines: env.isDominatedByLongLines,5571isWordWrapMinified: layoutInfo.isWordWrapMinified,5572isViewportWrapping: layoutInfo.isViewportWrapping,5573wrappingColumn: layoutInfo.wrappingColumn,5574};5575}5576}55775578//#endregion55795580//#region dropIntoEditor55815582/**5583* Configuration options for editor drop into behavior5584*/5585export interface IDropIntoEditorOptions {5586/**5587* Enable dropping into editor.5588* Defaults to true.5589*/5590enabled?: boolean;55915592/**5593* Controls if a widget is shown after a drop.5594* Defaults to 'afterDrop'.5595*/5596showDropSelector?: 'afterDrop' | 'never';5597}55985599/**5600* @internal5601*/5602export type EditorDropIntoEditorOptions = Readonly<Required<IDropIntoEditorOptions>>;56035604class EditorDropIntoEditor extends BaseEditorOption<EditorOption.dropIntoEditor, IDropIntoEditorOptions, EditorDropIntoEditorOptions> {56055606constructor() {5607const defaults: EditorDropIntoEditorOptions = { enabled: true, showDropSelector: 'afterDrop' };5608super(5609EditorOption.dropIntoEditor, 'dropIntoEditor', defaults,5610{5611'editor.dropIntoEditor.enabled': {5612type: 'boolean',5613default: defaults.enabled,5614markdownDescription: nls.localize('dropIntoEditor.enabled', "Controls whether you can drag and drop a file into a text editor by holding down the `Shift` key (instead of opening the file in an editor)."),5615},5616'editor.dropIntoEditor.showDropSelector': {5617type: 'string',5618markdownDescription: nls.localize('dropIntoEditor.showDropSelector', "Controls if a widget is shown when dropping files into the editor. This widget lets you control how the file is dropped."),5619enum: [5620'afterDrop',5621'never'5622],5623enumDescriptions: [5624nls.localize('dropIntoEditor.showDropSelector.afterDrop', "Show the drop selector widget after a file is dropped into the editor."),5625nls.localize('dropIntoEditor.showDropSelector.never', "Never show the drop selector widget. Instead the default drop provider is always used."),5626],5627default: 'afterDrop',5628},5629}5630);5631}56325633public validate(_input: unknown): EditorDropIntoEditorOptions {5634if (!_input || typeof _input !== 'object') {5635return this.defaultValue;5636}5637const input = _input as Unknown<IDropIntoEditorOptions>;5638return {5639enabled: boolean(input.enabled, this.defaultValue.enabled),5640showDropSelector: stringSet(input.showDropSelector, this.defaultValue.showDropSelector, ['afterDrop', 'never']),5641};5642}5643}56445645//#endregion56465647//#region pasteAs56485649/**5650* Configuration options for editor pasting as into behavior5651*/5652export interface IPasteAsOptions {5653/**5654* Enable paste as functionality in editors.5655* Defaults to true.5656*/5657enabled?: boolean;56585659/**5660* Controls if a widget is shown after a drop.5661* Defaults to 'afterPaste'.5662*/5663showPasteSelector?: 'afterPaste' | 'never';5664}56655666/**5667* @internal5668*/5669export type EditorPasteAsOptions = Readonly<Required<IPasteAsOptions>>;56705671class EditorPasteAs extends BaseEditorOption<EditorOption.pasteAs, IPasteAsOptions, EditorPasteAsOptions> {56725673constructor() {5674const defaults: EditorPasteAsOptions = { enabled: true, showPasteSelector: 'afterPaste' };5675super(5676EditorOption.pasteAs, 'pasteAs', defaults,5677{5678'editor.pasteAs.enabled': {5679type: 'boolean',5680default: defaults.enabled,5681markdownDescription: nls.localize('pasteAs.enabled', "Controls whether you can paste content in different ways."),5682},5683'editor.pasteAs.showPasteSelector': {5684type: 'string',5685markdownDescription: nls.localize('pasteAs.showPasteSelector', "Controls if a widget is shown when pasting content in to the editor. This widget lets you control how the file is pasted."),5686enum: [5687'afterPaste',5688'never'5689],5690enumDescriptions: [5691nls.localize('pasteAs.showPasteSelector.afterPaste', "Show the paste selector widget after content is pasted into the editor."),5692nls.localize('pasteAs.showPasteSelector.never', "Never show the paste selector widget. Instead the default pasting behavior is always used."),5693],5694default: 'afterPaste',5695},5696}5697);5698}56995700public validate(_input: unknown): EditorPasteAsOptions {5701if (!_input || typeof _input !== 'object') {5702return this.defaultValue;5703}5704const input = _input as Unknown<IPasteAsOptions>;5705return {5706enabled: boolean(input.enabled, this.defaultValue.enabled),5707showPasteSelector: stringSet(input.showPasteSelector, this.defaultValue.showPasteSelector, ['afterPaste', 'never']),5708};5709}5710}57115712//#endregion57135714/**5715* @internal5716*/5717export const editorOptionsRegistry: IEditorOption<EditorOption, unknown>[] = [];57185719function register<K extends EditorOption, V>(option: IEditorOption<K, V>): IEditorOption<K, V> {5720editorOptionsRegistry[option.id] = option;5721return option;5722}57235724export const enum EditorOption {5725acceptSuggestionOnCommitCharacter,5726acceptSuggestionOnEnter,5727accessibilitySupport,5728accessibilityPageSize,5729allowOverflow,5730allowVariableLineHeights,5731allowVariableFonts,5732allowVariableFontsInAccessibilityMode,5733ariaLabel,5734ariaRequired,5735autoClosingBrackets,5736autoClosingComments,5737screenReaderAnnounceInlineSuggestion,5738autoClosingDelete,5739autoClosingOvertype,5740autoClosingQuotes,5741autoIndent,5742autoIndentOnPaste,5743autoIndentOnPasteWithinString,5744automaticLayout,5745autoSurround,5746bracketPairColorization,5747guides,5748codeLens,5749codeLensFontFamily,5750codeLensFontSize,5751colorDecorators,5752colorDecoratorsLimit,5753columnSelection,5754comments,5755contextmenu,5756copyWithSyntaxHighlighting,5757cursorBlinking,5758cursorSmoothCaretAnimation,5759cursorStyle,5760cursorSurroundingLines,5761cursorSurroundingLinesStyle,5762cursorWidth,5763cursorHeight,5764disableLayerHinting,5765disableMonospaceOptimizations,5766domReadOnly,5767dragAndDrop,5768dropIntoEditor,5769editContext,5770emptySelectionClipboard,5771experimentalGpuAcceleration,5772experimentalWhitespaceRendering,5773extraEditorClassName,5774fastScrollSensitivity,5775find,5776fixedOverflowWidgets,5777folding,5778foldingStrategy,5779foldingHighlight,5780foldingImportsByDefault,5781foldingMaximumRegions,5782unfoldOnClickAfterEndOfLine,5783fontFamily,5784fontInfo,5785fontLigatures,5786fontSize,5787fontWeight,5788fontVariations,5789formatOnPaste,5790formatOnType,5791glyphMargin,5792gotoLocation,5793hideCursorInOverviewRuler,5794hover,5795inDiffEditor,5796inlineSuggest,5797letterSpacing,5798lightbulb,5799lineDecorationsWidth,5800lineHeight,5801lineNumbers,5802lineNumbersMinChars,5803linkedEditing,5804links,5805matchBrackets,5806minimap,5807mouseStyle,5808mouseWheelScrollSensitivity,5809mouseWheelZoom,5810multiCursorMergeOverlapping,5811multiCursorModifier,5812mouseMiddleClickAction,5813multiCursorPaste,5814multiCursorLimit,5815occurrencesHighlight,5816occurrencesHighlightDelay,5817overtypeCursorStyle,5818overtypeOnPaste,5819overviewRulerBorder,5820overviewRulerLanes,5821padding,5822pasteAs,5823parameterHints,5824peekWidgetDefaultFocus,5825placeholder,5826definitionLinkOpensInPeek,5827quickSuggestions,5828quickSuggestionsDelay,5829readOnly,5830readOnlyMessage,5831renameOnType,5832renderRichScreenReaderContent,5833renderControlCharacters,5834renderFinalNewline,5835renderLineHighlight,5836renderLineHighlightOnlyWhenFocus,5837renderValidationDecorations,5838renderWhitespace,5839revealHorizontalRightPadding,5840roundedSelection,5841rulers,5842scrollbar,5843scrollBeyondLastColumn,5844scrollBeyondLastLine,5845scrollPredominantAxis,5846selectionClipboard,5847selectionHighlight,5848selectionHighlightMaxLength,5849selectionHighlightMultiline,5850selectOnLineNumbers,5851showFoldingControls,5852showUnused,5853snippetSuggestions,5854smartSelect,5855smoothScrolling,5856stickyScroll,5857stickyTabStops,5858stopRenderingLineAfter,5859suggest,5860suggestFontSize,5861suggestLineHeight,5862suggestOnTriggerCharacters,5863suggestSelection,5864tabCompletion,5865tabIndex,5866trimWhitespaceOnDelete,5867unicodeHighlighting,5868unusualLineTerminators,5869useShadowDOM,5870useTabStops,5871wordBreak,5872wordSegmenterLocales,5873wordSeparators,5874wordWrap,5875wordWrapBreakAfterCharacters,5876wordWrapBreakBeforeCharacters,5877wordWrapColumn,5878wordWrapOverride1,5879wordWrapOverride2,5880wrappingIndent,5881wrappingStrategy,5882showDeprecated,5883inertialScroll,5884inlayHints,5885wrapOnEscapedLineFeeds,5886// Leave these at the end (because they have dependencies!)5887effectiveCursorStyle,5888editorClassName,5889pixelRatio,5890tabFocusMode,5891layoutInfo,5892wrappingInfo,5893defaultColorDecorators,5894colorDecoratorsActivatedOn,5895inlineCompletionsAccessibilityVerbose,5896effectiveEditContext,5897scrollOnMiddleClick,5898effectiveAllowVariableFonts5899}59005901export const EditorOptions = {5902acceptSuggestionOnCommitCharacter: register(new EditorBooleanOption(5903EditorOption.acceptSuggestionOnCommitCharacter, 'acceptSuggestionOnCommitCharacter', true,5904{ markdownDescription: nls.localize('acceptSuggestionOnCommitCharacter', "Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (`;`) can be a commit character that accepts a suggestion and types that character.") }5905)),5906acceptSuggestionOnEnter: register(new EditorStringEnumOption(5907EditorOption.acceptSuggestionOnEnter, 'acceptSuggestionOnEnter',5908'on' as 'on' | 'smart' | 'off',5909['on', 'smart', 'off'] as const,5910{5911markdownEnumDescriptions: [5912'',5913nls.localize('acceptSuggestionOnEnterSmart', "Only accept a suggestion with `Enter` when it makes a textual change."),5914''5915],5916markdownDescription: nls.localize('acceptSuggestionOnEnter', "Controls whether suggestions should be accepted on `Enter`, in addition to `Tab`. Helps to avoid ambiguity between inserting new lines or accepting suggestions.")5917}5918)),5919accessibilitySupport: register(new EditorAccessibilitySupport()),5920accessibilityPageSize: register(new EditorIntOption(EditorOption.accessibilityPageSize, 'accessibilityPageSize', 500, 1, Constants.MAX_SAFE_SMALL_INTEGER,5921{5922description: nls.localize('accessibilityPageSize', "Controls the number of lines in the editor that can be read out by a screen reader at once. When we detect a screen reader we automatically set the default to be 500. Warning: this has a performance implication for numbers larger than the default."),5923tags: ['accessibility']5924}5925)),5926allowOverflow: register(new EditorBooleanOption(5927EditorOption.allowOverflow, 'allowOverflow', true,5928)),5929allowVariableLineHeights: register(new EditorBooleanOption(5930EditorOption.allowVariableLineHeights, 'allowVariableLineHeights', true,5931{5932description: nls.localize('allowVariableLineHeights', "Controls whether to allow using variable line heights in the editor.")5933}5934)),5935allowVariableFonts: register(new EditorBooleanOption(5936EditorOption.allowVariableFonts, 'allowVariableFonts', true,5937{5938description: nls.localize('allowVariableFonts', "Controls whether to allow using variable fonts in the editor.")5939}5940)),5941allowVariableFontsInAccessibilityMode: register(new EditorBooleanOption(5942EditorOption.allowVariableFontsInAccessibilityMode, 'allowVariableFontsInAccessibilityMode', false,5943{5944description: nls.localize('allowVariableFontsInAccessibilityMode', "Controls whether to allow using variable fonts in the editor in the accessibility mode."),5945tags: ['accessibility']5946}5947)),5948ariaLabel: register(new EditorStringOption(5949EditorOption.ariaLabel, 'ariaLabel', nls.localize('editorViewAccessibleLabel', "Editor content")5950)),5951ariaRequired: register(new EditorBooleanOption(5952EditorOption.ariaRequired, 'ariaRequired', false, undefined5953)),5954screenReaderAnnounceInlineSuggestion: register(new EditorBooleanOption(5955EditorOption.screenReaderAnnounceInlineSuggestion, 'screenReaderAnnounceInlineSuggestion', true,5956{5957description: nls.localize('screenReaderAnnounceInlineSuggestion', "Control whether inline suggestions are announced by a screen reader."),5958tags: ['accessibility']5959}5960)),5961autoClosingBrackets: register(new EditorStringEnumOption(5962EditorOption.autoClosingBrackets, 'autoClosingBrackets',5963'languageDefined' as 'always' | 'languageDefined' | 'beforeWhitespace' | 'never',5964['always', 'languageDefined', 'beforeWhitespace', 'never'] as const,5965{5966enumDescriptions: [5967'',5968nls.localize('editor.autoClosingBrackets.languageDefined', "Use language configurations to determine when to autoclose brackets."),5969nls.localize('editor.autoClosingBrackets.beforeWhitespace', "Autoclose brackets only when the cursor is to the left of whitespace."),5970'',5971],5972description: nls.localize('autoClosingBrackets', "Controls whether the editor should automatically close brackets after the user adds an opening bracket.")5973}5974)),5975autoClosingComments: register(new EditorStringEnumOption(5976EditorOption.autoClosingComments, 'autoClosingComments',5977'languageDefined' as 'always' | 'languageDefined' | 'beforeWhitespace' | 'never',5978['always', 'languageDefined', 'beforeWhitespace', 'never'] as const,5979{5980enumDescriptions: [5981'',5982nls.localize('editor.autoClosingComments.languageDefined', "Use language configurations to determine when to autoclose comments."),5983nls.localize('editor.autoClosingComments.beforeWhitespace', "Autoclose comments only when the cursor is to the left of whitespace."),5984'',5985],5986description: nls.localize('autoClosingComments', "Controls whether the editor should automatically close comments after the user adds an opening comment.")5987}5988)),5989autoClosingDelete: register(new EditorStringEnumOption(5990EditorOption.autoClosingDelete, 'autoClosingDelete',5991'auto' as 'always' | 'auto' | 'never',5992['always', 'auto', 'never'] as const,5993{5994enumDescriptions: [5995'',5996nls.localize('editor.autoClosingDelete.auto', "Remove adjacent closing quotes or brackets only if they were automatically inserted."),5997'',5998],5999description: nls.localize('autoClosingDelete', "Controls whether the editor should remove adjacent closing quotes or brackets when deleting.")6000}6001)),6002autoClosingOvertype: register(new EditorStringEnumOption(6003EditorOption.autoClosingOvertype, 'autoClosingOvertype',6004'auto' as 'always' | 'auto' | 'never',6005['always', 'auto', 'never'] as const,6006{6007enumDescriptions: [6008'',6009nls.localize('editor.autoClosingOvertype.auto', "Type over closing quotes or brackets only if they were automatically inserted."),6010'',6011],6012description: nls.localize('autoClosingOvertype', "Controls whether the editor should type over closing quotes or brackets.")6013}6014)),6015autoClosingQuotes: register(new EditorStringEnumOption(6016EditorOption.autoClosingQuotes, 'autoClosingQuotes',6017'languageDefined' as 'always' | 'languageDefined' | 'beforeWhitespace' | 'never',6018['always', 'languageDefined', 'beforeWhitespace', 'never'] as const,6019{6020enumDescriptions: [6021'',6022nls.localize('editor.autoClosingQuotes.languageDefined', "Use language configurations to determine when to autoclose quotes."),6023nls.localize('editor.autoClosingQuotes.beforeWhitespace', "Autoclose quotes only when the cursor is to the left of whitespace."),6024'',6025],6026description: nls.localize('autoClosingQuotes', "Controls whether the editor should automatically close quotes after the user adds an opening quote.")6027}6028)),6029autoIndent: register(new EditorEnumOption(6030EditorOption.autoIndent, 'autoIndent',6031EditorAutoIndentStrategy.Full, 'full',6032['none', 'keep', 'brackets', 'advanced', 'full'],6033_autoIndentFromString,6034{6035enumDescriptions: [6036nls.localize('editor.autoIndent.none', "The editor will not insert indentation automatically."),6037nls.localize('editor.autoIndent.keep', "The editor will keep the current line's indentation."),6038nls.localize('editor.autoIndent.brackets', "The editor will keep the current line's indentation and honor language defined brackets."),6039nls.localize('editor.autoIndent.advanced', "The editor will keep the current line's indentation, honor language defined brackets and invoke special onEnterRules defined by languages."),6040nls.localize('editor.autoIndent.full', "The editor will keep the current line's indentation, honor language defined brackets, invoke special onEnterRules defined by languages, and honor indentationRules defined by languages."),6041],6042description: nls.localize('autoIndent', "Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.")6043}6044)),6045autoIndentOnPaste: register(new EditorBooleanOption(6046EditorOption.autoIndentOnPaste, 'autoIndentOnPaste', false,6047{ description: nls.localize('autoIndentOnPaste', "Controls whether the editor should automatically auto-indent the pasted content.") }6048)),6049autoIndentOnPasteWithinString: register(new EditorBooleanOption(6050EditorOption.autoIndentOnPasteWithinString, 'autoIndentOnPasteWithinString', true,6051{ description: nls.localize('autoIndentOnPasteWithinString', "Controls whether the editor should automatically auto-indent the pasted content when pasted within a string. This takes effect when autoIndentOnPaste is true.") }6052)),6053automaticLayout: register(new EditorBooleanOption(6054EditorOption.automaticLayout, 'automaticLayout', false,6055)),6056autoSurround: register(new EditorStringEnumOption(6057EditorOption.autoSurround, 'autoSurround',6058'languageDefined' as 'languageDefined' | 'quotes' | 'brackets' | 'never',6059['languageDefined', 'quotes', 'brackets', 'never'] as const,6060{6061enumDescriptions: [6062nls.localize('editor.autoSurround.languageDefined', "Use language configurations to determine when to automatically surround selections."),6063nls.localize('editor.autoSurround.quotes', "Surround with quotes but not brackets."),6064nls.localize('editor.autoSurround.brackets', "Surround with brackets but not quotes."),6065''6066],6067description: nls.localize('autoSurround', "Controls whether the editor should automatically surround selections when typing quotes or brackets.")6068}6069)),6070bracketPairColorization: register(new BracketPairColorization()),6071bracketPairGuides: register(new GuideOptions()),6072stickyTabStops: register(new EditorBooleanOption(6073EditorOption.stickyTabStops, 'stickyTabStops', false,6074{ description: nls.localize('stickyTabStops', "Emulate selection behavior of tab characters when using spaces for indentation. Selection will stick to tab stops.") }6075)),6076codeLens: register(new EditorBooleanOption(6077EditorOption.codeLens, 'codeLens', true,6078{ description: nls.localize('codeLens', "Controls whether the editor shows CodeLens.") }6079)),6080codeLensFontFamily: register(new EditorStringOption(6081EditorOption.codeLensFontFamily, 'codeLensFontFamily', '',6082{ description: nls.localize('codeLensFontFamily', "Controls the font family for CodeLens.") }6083)),6084codeLensFontSize: register(new EditorIntOption(EditorOption.codeLensFontSize, 'codeLensFontSize', 0, 0, 100, {6085type: 'number',6086default: 0,6087minimum: 0,6088maximum: 100,6089markdownDescription: nls.localize('codeLensFontSize', "Controls the font size in pixels for CodeLens. When set to 0, 90% of `#editor.fontSize#` is used.")6090})),6091colorDecorators: register(new EditorBooleanOption(6092EditorOption.colorDecorators, 'colorDecorators', true,6093{ description: nls.localize('colorDecorators', "Controls whether the editor should render the inline color decorators and color picker.") }6094)),6095colorDecoratorActivatedOn: register(new EditorStringEnumOption(EditorOption.colorDecoratorsActivatedOn, 'colorDecoratorsActivatedOn', 'clickAndHover' as 'clickAndHover' | 'hover' | 'click', ['clickAndHover', 'hover', 'click'] as const, {6096enumDescriptions: [6097nls.localize('editor.colorDecoratorActivatedOn.clickAndHover', "Make the color picker appear both on click and hover of the color decorator"),6098nls.localize('editor.colorDecoratorActivatedOn.hover', "Make the color picker appear on hover of the color decorator"),6099nls.localize('editor.colorDecoratorActivatedOn.click', "Make the color picker appear on click of the color decorator")6100],6101description: nls.localize('colorDecoratorActivatedOn', "Controls the condition to make a color picker appear from a color decorator.")6102})),6103colorDecoratorsLimit: register(new EditorIntOption(6104EditorOption.colorDecoratorsLimit, 'colorDecoratorsLimit', 500, 1, 1000000,6105{6106markdownDescription: nls.localize('colorDecoratorsLimit', "Controls the max number of color decorators that can be rendered in an editor at once.")6107}6108)),6109columnSelection: register(new EditorBooleanOption(6110EditorOption.columnSelection, 'columnSelection', false,6111{ description: nls.localize('columnSelection', "Enable that the selection with the mouse and keys is doing column selection.") }6112)),6113comments: register(new EditorComments()),6114contextmenu: register(new EditorBooleanOption(6115EditorOption.contextmenu, 'contextmenu', true,6116)),6117copyWithSyntaxHighlighting: register(new EditorBooleanOption(6118EditorOption.copyWithSyntaxHighlighting, 'copyWithSyntaxHighlighting', true,6119{ description: nls.localize('copyWithSyntaxHighlighting', "Controls whether syntax highlighting should be copied into the clipboard.") }6120)),6121cursorBlinking: register(new EditorEnumOption(6122EditorOption.cursorBlinking, 'cursorBlinking',6123TextEditorCursorBlinkingStyle.Blink, 'blink',6124['blink', 'smooth', 'phase', 'expand', 'solid'],6125cursorBlinkingStyleFromString,6126{ description: nls.localize('cursorBlinking', "Control the cursor animation style.") }6127)),6128cursorSmoothCaretAnimation: register(new EditorStringEnumOption(6129EditorOption.cursorSmoothCaretAnimation, 'cursorSmoothCaretAnimation',6130'off' as 'off' | 'explicit' | 'on',6131['off', 'explicit', 'on'] as const,6132{6133enumDescriptions: [6134nls.localize('cursorSmoothCaretAnimation.off', "Smooth caret animation is disabled."),6135nls.localize('cursorSmoothCaretAnimation.explicit', "Smooth caret animation is enabled only when the user moves the cursor with an explicit gesture."),6136nls.localize('cursorSmoothCaretAnimation.on', "Smooth caret animation is always enabled.")6137],6138description: nls.localize('cursorSmoothCaretAnimation', "Controls whether the smooth caret animation should be enabled.")6139}6140)),6141cursorStyle: register(new EditorEnumOption(6142EditorOption.cursorStyle, 'cursorStyle',6143TextEditorCursorStyle.Line, 'line',6144['line', 'block', 'underline', 'line-thin', 'block-outline', 'underline-thin'],6145cursorStyleFromString,6146{ description: nls.localize('cursorStyle', "Controls the cursor style in insert input mode.") }6147)),6148overtypeCursorStyle: register(new EditorEnumOption(6149EditorOption.overtypeCursorStyle, 'overtypeCursorStyle',6150TextEditorCursorStyle.Block, 'block',6151['line', 'block', 'underline', 'line-thin', 'block-outline', 'underline-thin'],6152cursorStyleFromString,6153{ description: nls.localize('overtypeCursorStyle', "Controls the cursor style in overtype input mode.") }6154)),6155cursorSurroundingLines: register(new EditorIntOption(6156EditorOption.cursorSurroundingLines, 'cursorSurroundingLines',61570, 0, Constants.MAX_SAFE_SMALL_INTEGER,6158{ description: nls.localize('cursorSurroundingLines', "Controls the minimal number of visible leading lines (minimum 0) and trailing lines (minimum 1) surrounding the cursor. Known as 'scrollOff' or 'scrollOffset' in some other editors.") }6159)),6160cursorSurroundingLinesStyle: register(new EditorStringEnumOption(6161EditorOption.cursorSurroundingLinesStyle, 'cursorSurroundingLinesStyle',6162'default' as 'default' | 'all',6163['default', 'all'] as const,6164{6165enumDescriptions: [6166nls.localize('cursorSurroundingLinesStyle.default', "`cursorSurroundingLines` is enforced only when triggered via the keyboard or API."),6167nls.localize('cursorSurroundingLinesStyle.all', "`cursorSurroundingLines` is enforced always.")6168],6169markdownDescription: nls.localize('cursorSurroundingLinesStyle', "Controls when `#editor.cursorSurroundingLines#` should be enforced.")6170}6171)),6172cursorWidth: register(new EditorIntOption(6173EditorOption.cursorWidth, 'cursorWidth',61740, 0, Constants.MAX_SAFE_SMALL_INTEGER,6175{ markdownDescription: nls.localize('cursorWidth', "Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.") }6176)),6177cursorHeight: register(new EditorIntOption(6178EditorOption.cursorHeight, 'cursorHeight',61790, 0, Constants.MAX_SAFE_SMALL_INTEGER,6180{ markdownDescription: nls.localize('cursorHeight', "Controls the height of the cursor when `#editor.cursorStyle#` is set to `line`. Cursor's max height depends on line height.") }6181)),6182disableLayerHinting: register(new EditorBooleanOption(6183EditorOption.disableLayerHinting, 'disableLayerHinting', false,6184)),6185disableMonospaceOptimizations: register(new EditorBooleanOption(6186EditorOption.disableMonospaceOptimizations, 'disableMonospaceOptimizations', false6187)),6188domReadOnly: register(new EditorBooleanOption(6189EditorOption.domReadOnly, 'domReadOnly', false,6190)),6191dragAndDrop: register(new EditorBooleanOption(6192EditorOption.dragAndDrop, 'dragAndDrop', true,6193{ description: nls.localize('dragAndDrop', "Controls whether the editor should allow moving selections via drag and drop.") }6194)),6195emptySelectionClipboard: register(new EditorEmptySelectionClipboard()),6196dropIntoEditor: register(new EditorDropIntoEditor()),6197editContext: register(new EditorBooleanOption(6198EditorOption.editContext, 'editContext', true,6199{6200description: nls.localize('editContext', "Sets whether the EditContext API should be used instead of the text area to power input in the editor."),6201included: platform.isChrome || platform.isEdge || platform.isNative6202}6203)),6204renderRichScreenReaderContent: register(new EditorBooleanOption(6205EditorOption.renderRichScreenReaderContent, 'renderRichScreenReaderContent', false,6206{6207markdownDescription: nls.localize('renderRichScreenReaderContent', "Whether to render rich screen reader content when the `#editor.editContext#` setting is enabled."),6208}6209)),6210stickyScroll: register(new EditorStickyScroll()),6211experimentalGpuAcceleration: register(new EditorStringEnumOption(6212EditorOption.experimentalGpuAcceleration, 'experimentalGpuAcceleration',6213'off' as 'off' | 'on',6214['off', 'on'] as const,6215{6216tags: ['experimental'],6217enumDescriptions: [6218nls.localize('experimentalGpuAcceleration.off', "Use regular DOM-based rendering."),6219nls.localize('experimentalGpuAcceleration.on', "Use GPU acceleration."),6220],6221description: nls.localize('experimentalGpuAcceleration', "Controls whether to use the experimental GPU acceleration to render the editor.")6222}6223)),6224experimentalWhitespaceRendering: register(new EditorStringEnumOption(6225EditorOption.experimentalWhitespaceRendering, 'experimentalWhitespaceRendering',6226'svg' as 'svg' | 'font' | 'off',6227['svg', 'font', 'off'] as const,6228{6229enumDescriptions: [6230nls.localize('experimentalWhitespaceRendering.svg', "Use a new rendering method with svgs."),6231nls.localize('experimentalWhitespaceRendering.font', "Use a new rendering method with font characters."),6232nls.localize('experimentalWhitespaceRendering.off', "Use the stable rendering method."),6233],6234description: nls.localize('experimentalWhitespaceRendering', "Controls whether whitespace is rendered with a new, experimental method.")6235}6236)),6237extraEditorClassName: register(new EditorStringOption(6238EditorOption.extraEditorClassName, 'extraEditorClassName', '',6239)),6240fastScrollSensitivity: register(new EditorFloatOption(6241EditorOption.fastScrollSensitivity, 'fastScrollSensitivity',62425, x => (x <= 0 ? 5 : x),6243{ markdownDescription: nls.localize('fastScrollSensitivity', "Scrolling speed multiplier when pressing `Alt`.") }6244)),6245find: register(new EditorFind()),6246fixedOverflowWidgets: register(new EditorBooleanOption(6247EditorOption.fixedOverflowWidgets, 'fixedOverflowWidgets', false,6248)),6249folding: register(new EditorBooleanOption(6250EditorOption.folding, 'folding', true,6251{ description: nls.localize('folding', "Controls whether the editor has code folding enabled.") }6252)),6253foldingStrategy: register(new EditorStringEnumOption(6254EditorOption.foldingStrategy, 'foldingStrategy',6255'auto' as 'auto' | 'indentation',6256['auto', 'indentation'] as const,6257{6258enumDescriptions: [6259nls.localize('foldingStrategy.auto', "Use a language-specific folding strategy if available, else the indentation-based one."),6260nls.localize('foldingStrategy.indentation', "Use the indentation-based folding strategy."),6261],6262description: nls.localize('foldingStrategy', "Controls the strategy for computing folding ranges.")6263}6264)),6265foldingHighlight: register(new EditorBooleanOption(6266EditorOption.foldingHighlight, 'foldingHighlight', true,6267{ description: nls.localize('foldingHighlight', "Controls whether the editor should highlight folded ranges.") }6268)),6269foldingImportsByDefault: register(new EditorBooleanOption(6270EditorOption.foldingImportsByDefault, 'foldingImportsByDefault', false,6271{ description: nls.localize('foldingImportsByDefault', "Controls whether the editor automatically collapses import ranges.") }6272)),6273foldingMaximumRegions: register(new EditorIntOption(6274EditorOption.foldingMaximumRegions, 'foldingMaximumRegions',62755000, 10, 65000, // limit must be less than foldingRanges MAX_FOLDING_REGIONS6276{ description: nls.localize('foldingMaximumRegions', "The maximum number of foldable regions. Increasing this value may result in the editor becoming less responsive when the current source has a large number of foldable regions.") }6277)),6278unfoldOnClickAfterEndOfLine: register(new EditorBooleanOption(6279EditorOption.unfoldOnClickAfterEndOfLine, 'unfoldOnClickAfterEndOfLine', false,6280{ description: nls.localize('unfoldOnClickAfterEndOfLine', "Controls whether clicking on the empty content after a folded line will unfold the line.") }6281)),6282fontFamily: register(new EditorStringOption(6283EditorOption.fontFamily, 'fontFamily', EDITOR_FONT_DEFAULTS.fontFamily,6284{ description: nls.localize('fontFamily', "Controls the font family.") }6285)),6286fontInfo: register(new EditorFontInfo()),6287fontLigatures2: register(new EditorFontLigatures()),6288fontSize: register(new EditorFontSize()),6289fontWeight: register(new EditorFontWeight()),6290fontVariations: register(new EditorFontVariations()),6291formatOnPaste: register(new EditorBooleanOption(6292EditorOption.formatOnPaste, 'formatOnPaste', false,6293{ description: nls.localize('formatOnPaste', "Controls whether the editor should automatically format the pasted content. A formatter must be available and the formatter should be able to format a range in a document.") }6294)),6295formatOnType: register(new EditorBooleanOption(6296EditorOption.formatOnType, 'formatOnType', false,6297{ description: nls.localize('formatOnType', "Controls whether the editor should automatically format the line after typing.") }6298)),6299glyphMargin: register(new EditorBooleanOption(6300EditorOption.glyphMargin, 'glyphMargin', true,6301{ description: nls.localize('glyphMargin', "Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.") }6302)),6303gotoLocation: register(new EditorGoToLocation()),6304hideCursorInOverviewRuler: register(new EditorBooleanOption(6305EditorOption.hideCursorInOverviewRuler, 'hideCursorInOverviewRuler', false,6306{ description: nls.localize('hideCursorInOverviewRuler', "Controls whether the cursor should be hidden in the overview ruler.") }6307)),6308hover: register(new EditorHover()),6309inDiffEditor: register(new EditorBooleanOption(6310EditorOption.inDiffEditor, 'inDiffEditor', false6311)),6312inertialScroll: register(new EditorBooleanOption(6313EditorOption.inertialScroll, 'inertialScroll', false,6314{ description: nls.localize('inertialScroll', "Make scrolling inertial - mostly useful with touchpad on linux.") }6315)),6316letterSpacing: register(new EditorFloatOption(6317EditorOption.letterSpacing, 'letterSpacing',6318EDITOR_FONT_DEFAULTS.letterSpacing, x => EditorFloatOption.clamp(x, -5, 20),6319{ description: nls.localize('letterSpacing', "Controls the letter spacing in pixels.") }6320)),6321lightbulb: register(new EditorLightbulb()),6322lineDecorationsWidth: register(new EditorLineDecorationsWidth()),6323lineHeight: register(new EditorLineHeight()),6324lineNumbers: register(new EditorRenderLineNumbersOption()),6325lineNumbersMinChars: register(new EditorIntOption(6326EditorOption.lineNumbersMinChars, 'lineNumbersMinChars',63275, 1, 3006328)),6329linkedEditing: register(new EditorBooleanOption(6330EditorOption.linkedEditing, 'linkedEditing', false,6331{ description: nls.localize('linkedEditing', "Controls whether the editor has linked editing enabled. Depending on the language, related symbols such as HTML tags, are updated while editing.") }6332)),6333links: register(new EditorBooleanOption(6334EditorOption.links, 'links', true,6335{ description: nls.localize('links', "Controls whether the editor should detect links and make them clickable.") }6336)),6337matchBrackets: register(new EditorStringEnumOption(6338EditorOption.matchBrackets, 'matchBrackets',6339'always' as 'never' | 'near' | 'always',6340['always', 'near', 'never'] as const,6341{ description: nls.localize('matchBrackets', "Highlight matching brackets.") }6342)),6343minimap: register(new EditorMinimap()),6344mouseStyle: register(new EditorStringEnumOption(6345EditorOption.mouseStyle, 'mouseStyle',6346'text' as 'text' | 'default' | 'copy',6347['text', 'default', 'copy'] as const,6348)),6349mouseWheelScrollSensitivity: register(new EditorFloatOption(6350EditorOption.mouseWheelScrollSensitivity, 'mouseWheelScrollSensitivity',63511, x => (x === 0 ? 1 : x),6352{ markdownDescription: nls.localize('mouseWheelScrollSensitivity', "A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.") }6353)),6354mouseWheelZoom: register(new EditorBooleanOption(6355EditorOption.mouseWheelZoom, 'mouseWheelZoom', false,6356{6357markdownDescription: platform.isMacintosh6358? nls.localize('mouseWheelZoom.mac', "Zoom the font of the editor when using mouse wheel and holding `Cmd`.")6359: nls.localize('mouseWheelZoom', "Zoom the font of the editor when using mouse wheel and holding `Ctrl`.")6360}6361)),6362multiCursorMergeOverlapping: register(new EditorBooleanOption(6363EditorOption.multiCursorMergeOverlapping, 'multiCursorMergeOverlapping', true,6364{ description: nls.localize('multiCursorMergeOverlapping', "Merge multiple cursors when they are overlapping.") }6365)),6366multiCursorModifier: register(new EditorEnumOption(6367EditorOption.multiCursorModifier, 'multiCursorModifier',6368'altKey', 'alt',6369['ctrlCmd', 'alt'],6370_multiCursorModifierFromString,6371{6372markdownEnumDescriptions: [6373nls.localize('multiCursorModifier.ctrlCmd', "Maps to `Control` on Windows and Linux and to `Command` on macOS."),6374nls.localize('multiCursorModifier.alt', "Maps to `Alt` on Windows and Linux and to `Option` on macOS.")6375],6376markdownDescription: nls.localize({6377key: 'multiCursorModifier',6378comment: [6379'- `ctrlCmd` refers to a value the setting can take and should not be localized.',6380'- `Control` and `Command` refer to the modifier keys Ctrl or Cmd on the keyboard and can be localized.'6381]6382}, "The modifier to be used to add multiple cursors with the mouse. The Go to Definition and Open Link mouse gestures will adapt such that they do not conflict with the [multicursor modifier](https://code.visualstudio.com/docs/editor/codebasics#_multicursor-modifier).")6383}6384)),6385mouseMiddleClickAction: register(new EditorStringEnumOption(6386EditorOption.mouseMiddleClickAction, 'mouseMiddleClickAction', 'default' as MouseMiddleClickAction,6387['default', 'openLink', 'ctrlLeftClick'] as MouseMiddleClickAction[],6388{ description: nls.localize('mouseMiddleClickAction', "Controls what happens when middle mouse button is clicked in the editor.") }6389)),6390multiCursorPaste: register(new EditorStringEnumOption(6391EditorOption.multiCursorPaste, 'multiCursorPaste',6392'spread' as 'spread' | 'full',6393['spread', 'full'] as const,6394{6395markdownEnumDescriptions: [6396nls.localize('multiCursorPaste.spread', "Each cursor pastes a single line of the text."),6397nls.localize('multiCursorPaste.full', "Each cursor pastes the full text.")6398],6399markdownDescription: nls.localize('multiCursorPaste', "Controls pasting when the line count of the pasted text matches the cursor count.")6400}6401)),6402multiCursorLimit: register(new EditorIntOption(6403EditorOption.multiCursorLimit, 'multiCursorLimit', 10000, 1, 100000,6404{6405markdownDescription: nls.localize('multiCursorLimit', "Controls the max number of cursors that can be in an active editor at once.")6406}6407)),6408occurrencesHighlight: register(new EditorStringEnumOption(6409EditorOption.occurrencesHighlight, 'occurrencesHighlight',6410'singleFile' as 'off' | 'singleFile' | 'multiFile',6411['off', 'singleFile', 'multiFile'] as const,6412{6413markdownEnumDescriptions: [6414nls.localize('occurrencesHighlight.off', "Does not highlight occurrences."),6415nls.localize('occurrencesHighlight.singleFile', "Highlights occurrences only in the current file."),6416nls.localize('occurrencesHighlight.multiFile', "Experimental: Highlights occurrences across all valid open files.")6417],6418markdownDescription: nls.localize('occurrencesHighlight', "Controls whether occurrences should be highlighted across open files.")6419}6420)),6421occurrencesHighlightDelay: register(new EditorIntOption(6422EditorOption.occurrencesHighlightDelay, 'occurrencesHighlightDelay',64230, 0, 2000,6424{6425description: nls.localize('occurrencesHighlightDelay', "Controls the delay in milliseconds after which occurrences are highlighted."),6426tags: ['preview']6427}6428)),6429overtypeOnPaste: register(new EditorBooleanOption(6430EditorOption.overtypeOnPaste, 'overtypeOnPaste', true,6431{ description: nls.localize('overtypeOnPaste', "Controls whether pasting should overtype.") }6432)),6433overviewRulerBorder: register(new EditorBooleanOption(6434EditorOption.overviewRulerBorder, 'overviewRulerBorder', true,6435{ description: nls.localize('overviewRulerBorder', "Controls whether a border should be drawn around the overview ruler.") }6436)),6437overviewRulerLanes: register(new EditorIntOption(6438EditorOption.overviewRulerLanes, 'overviewRulerLanes',64393, 0, 36440)),6441padding: register(new EditorPadding()),6442pasteAs: register(new EditorPasteAs()),6443parameterHints: register(new EditorParameterHints()),6444peekWidgetDefaultFocus: register(new EditorStringEnumOption(6445EditorOption.peekWidgetDefaultFocus, 'peekWidgetDefaultFocus',6446'tree' as 'tree' | 'editor',6447['tree', 'editor'] as const,6448{6449enumDescriptions: [6450nls.localize('peekWidgetDefaultFocus.tree', "Focus the tree when opening peek"),6451nls.localize('peekWidgetDefaultFocus.editor', "Focus the editor when opening peek")6452],6453description: nls.localize('peekWidgetDefaultFocus', "Controls whether to focus the inline editor or the tree in the peek widget.")6454}6455)),6456placeholder: register(new PlaceholderOption()),6457definitionLinkOpensInPeek: register(new EditorBooleanOption(6458EditorOption.definitionLinkOpensInPeek, 'definitionLinkOpensInPeek', false,6459{ description: nls.localize('definitionLinkOpensInPeek', "Controls whether the Go to Definition mouse gesture always opens the peek widget.") }6460)),6461quickSuggestions: register(new EditorQuickSuggestions()),6462quickSuggestionsDelay: register(new EditorIntOption(6463EditorOption.quickSuggestionsDelay, 'quickSuggestionsDelay',646410, 0, Constants.MAX_SAFE_SMALL_INTEGER,6465{6466description: nls.localize('quickSuggestionsDelay', "Controls the delay in milliseconds after which quick suggestions will show up."),6467experiment: {6468mode: 'auto'6469}6470}6471)),6472readOnly: register(new EditorBooleanOption(6473EditorOption.readOnly, 'readOnly', false,6474)),6475readOnlyMessage: register(new ReadonlyMessage()),6476renameOnType: register(new EditorBooleanOption(6477EditorOption.renameOnType, 'renameOnType', false,6478{ description: nls.localize('renameOnType', "Controls whether the editor auto renames on type."), markdownDeprecationMessage: nls.localize('renameOnTypeDeprecate', "Deprecated, use `#editor.linkedEditing#` instead.") }6479)),6480renderControlCharacters: register(new EditorBooleanOption(6481EditorOption.renderControlCharacters, 'renderControlCharacters', true,6482{ description: nls.localize('renderControlCharacters', "Controls whether the editor should render control characters."), restricted: true }6483)),6484renderFinalNewline: register(new EditorStringEnumOption(6485EditorOption.renderFinalNewline, 'renderFinalNewline',6486(platform.isLinux ? 'dimmed' : 'on') as 'off' | 'on' | 'dimmed',6487['off', 'on', 'dimmed'] as const,6488{ description: nls.localize('renderFinalNewline', "Render last line number when the file ends with a newline.") }6489)),6490renderLineHighlight: register(new EditorStringEnumOption(6491EditorOption.renderLineHighlight, 'renderLineHighlight',6492'line' as 'none' | 'gutter' | 'line' | 'all',6493['none', 'gutter', 'line', 'all'] as const,6494{6495enumDescriptions: [6496'',6497'',6498'',6499nls.localize('renderLineHighlight.all', "Highlights both the gutter and the current line."),6500],6501description: nls.localize('renderLineHighlight', "Controls how the editor should render the current line highlight.")6502}6503)),6504renderLineHighlightOnlyWhenFocus: register(new EditorBooleanOption(6505EditorOption.renderLineHighlightOnlyWhenFocus, 'renderLineHighlightOnlyWhenFocus', false,6506{ description: nls.localize('renderLineHighlightOnlyWhenFocus', "Controls if the editor should render the current line highlight only when the editor is focused.") }6507)),6508renderValidationDecorations: register(new EditorStringEnumOption(6509EditorOption.renderValidationDecorations, 'renderValidationDecorations',6510'editable' as 'editable' | 'on' | 'off',6511['editable', 'on', 'off'] as const6512)),6513renderWhitespace: register(new EditorStringEnumOption(6514EditorOption.renderWhitespace, 'renderWhitespace',6515'selection' as 'selection' | 'none' | 'boundary' | 'trailing' | 'all',6516['none', 'boundary', 'selection', 'trailing', 'all'] as const,6517{6518enumDescriptions: [6519'',6520nls.localize('renderWhitespace.boundary', "Render whitespace characters except for single spaces between words."),6521nls.localize('renderWhitespace.selection', "Render whitespace characters only on selected text."),6522nls.localize('renderWhitespace.trailing', "Render only trailing whitespace characters."),6523''6524],6525description: nls.localize('renderWhitespace', "Controls how the editor should render whitespace characters.")6526}6527)),6528revealHorizontalRightPadding: register(new EditorIntOption(6529EditorOption.revealHorizontalRightPadding, 'revealHorizontalRightPadding',653015, 0, 1000,6531)),6532roundedSelection: register(new EditorBooleanOption(6533EditorOption.roundedSelection, 'roundedSelection', true,6534{ description: nls.localize('roundedSelection', "Controls whether selections should have rounded corners.") }6535)),6536rulers: register(new EditorRulers()),6537scrollbar: register(new EditorScrollbar()),6538scrollBeyondLastColumn: register(new EditorIntOption(6539EditorOption.scrollBeyondLastColumn, 'scrollBeyondLastColumn',65404, 0, Constants.MAX_SAFE_SMALL_INTEGER,6541{ description: nls.localize('scrollBeyondLastColumn', "Controls the number of extra characters beyond which the editor will scroll horizontally.") }6542)),6543scrollBeyondLastLine: register(new EditorBooleanOption(6544EditorOption.scrollBeyondLastLine, 'scrollBeyondLastLine', true,6545{ description: nls.localize('scrollBeyondLastLine', "Controls whether the editor will scroll beyond the last line.") }6546)),6547scrollOnMiddleClick: register(new EditorBooleanOption(6548EditorOption.scrollOnMiddleClick, 'scrollOnMiddleClick', false,6549{ description: nls.localize('scrollOnMiddleClick', "Controls whether the editor will scroll when the middle button is pressed.") }6550)),6551scrollPredominantAxis: register(new EditorBooleanOption(6552EditorOption.scrollPredominantAxis, 'scrollPredominantAxis', true,6553{ description: nls.localize('scrollPredominantAxis', "Scroll only along the predominant axis when scrolling both vertically and horizontally at the same time. Prevents horizontal drift when scrolling vertically on a trackpad.") }6554)),6555selectionClipboard: register(new EditorBooleanOption(6556EditorOption.selectionClipboard, 'selectionClipboard', true,6557{6558description: nls.localize('selectionClipboard', "Controls whether the Linux primary clipboard should be supported."),6559included: platform.isLinux6560}6561)),6562selectionHighlight: register(new EditorBooleanOption(6563EditorOption.selectionHighlight, 'selectionHighlight', true,6564{ description: nls.localize('selectionHighlight', "Controls whether the editor should highlight matches similar to the selection.") }6565)),6566selectionHighlightMaxLength: register(new EditorIntOption(6567EditorOption.selectionHighlightMaxLength, 'selectionHighlightMaxLength',6568200, 0, Constants.MAX_SAFE_SMALL_INTEGER,6569{ description: nls.localize('selectionHighlightMaxLength', "Controls how many characters can be in the selection before similiar matches are not highlighted. Set to zero for unlimited.") }6570)),6571selectionHighlightMultiline: register(new EditorBooleanOption(6572EditorOption.selectionHighlightMultiline, 'selectionHighlightMultiline', false,6573{ description: nls.localize('selectionHighlightMultiline', "Controls whether the editor should highlight selection matches that span multiple lines.") }6574)),6575selectOnLineNumbers: register(new EditorBooleanOption(6576EditorOption.selectOnLineNumbers, 'selectOnLineNumbers', true,6577)),6578showFoldingControls: register(new EditorStringEnumOption(6579EditorOption.showFoldingControls, 'showFoldingControls',6580'mouseover' as 'always' | 'never' | 'mouseover',6581['always', 'never', 'mouseover'] as const,6582{6583enumDescriptions: [6584nls.localize('showFoldingControls.always', "Always show the folding controls."),6585nls.localize('showFoldingControls.never', "Never show the folding controls and reduce the gutter size."),6586nls.localize('showFoldingControls.mouseover', "Only show the folding controls when the mouse is over the gutter."),6587],6588description: nls.localize('showFoldingControls', "Controls when the folding controls on the gutter are shown.")6589}6590)),6591showUnused: register(new EditorBooleanOption(6592EditorOption.showUnused, 'showUnused', true,6593{ description: nls.localize('showUnused', "Controls fading out of unused code.") }6594)),6595showDeprecated: register(new EditorBooleanOption(6596EditorOption.showDeprecated, 'showDeprecated', true,6597{ description: nls.localize('showDeprecated', "Controls strikethrough deprecated variables.") }6598)),6599inlayHints: register(new EditorInlayHints()),6600snippetSuggestions: register(new EditorStringEnumOption(6601EditorOption.snippetSuggestions, 'snippetSuggestions',6602'inline' as 'top' | 'bottom' | 'inline' | 'none',6603['top', 'bottom', 'inline', 'none'] as const,6604{6605enumDescriptions: [6606nls.localize('snippetSuggestions.top', "Show snippet suggestions on top of other suggestions."),6607nls.localize('snippetSuggestions.bottom', "Show snippet suggestions below other suggestions."),6608nls.localize('snippetSuggestions.inline', "Show snippets suggestions with other suggestions."),6609nls.localize('snippetSuggestions.none', "Do not show snippet suggestions."),6610],6611description: nls.localize('snippetSuggestions', "Controls whether snippets are shown with other suggestions and how they are sorted.")6612}6613)),6614smartSelect: register(new SmartSelect()),6615smoothScrolling: register(new EditorBooleanOption(6616EditorOption.smoothScrolling, 'smoothScrolling', false,6617{ description: nls.localize('smoothScrolling', "Controls whether the editor will scroll using an animation.") }6618)),6619stopRenderingLineAfter: register(new EditorIntOption(6620EditorOption.stopRenderingLineAfter, 'stopRenderingLineAfter',662110000, -1, Constants.MAX_SAFE_SMALL_INTEGER,6622)),6623suggest: register(new EditorSuggest()),6624inlineSuggest: register(new InlineEditorSuggest()),6625inlineCompletionsAccessibilityVerbose: register(new EditorBooleanOption(EditorOption.inlineCompletionsAccessibilityVerbose, 'inlineCompletionsAccessibilityVerbose', false,6626{ description: nls.localize('inlineCompletionsAccessibilityVerbose', "Controls whether the accessibility hint should be provided to screen reader users when an inline completion is shown.") })),6627suggestFontSize: register(new EditorIntOption(6628EditorOption.suggestFontSize, 'suggestFontSize',66290, 0, 1000,6630{ markdownDescription: nls.localize('suggestFontSize', "Font size for the suggest widget. When set to {0}, the value of {1} is used.", '`0`', '`#editor.fontSize#`') }6631)),6632suggestLineHeight: register(new EditorIntOption(6633EditorOption.suggestLineHeight, 'suggestLineHeight',66340, 0, 1000,6635{ markdownDescription: nls.localize('suggestLineHeight', "Line height for the suggest widget. When set to {0}, the value of {1} is used. The minimum value is 8.", '`0`', '`#editor.lineHeight#`') }6636)),6637suggestOnTriggerCharacters: register(new EditorBooleanOption(6638EditorOption.suggestOnTriggerCharacters, 'suggestOnTriggerCharacters', true,6639{ description: nls.localize('suggestOnTriggerCharacters', "Controls whether suggestions should automatically show up when typing trigger characters.") }6640)),6641suggestSelection: register(new EditorStringEnumOption(6642EditorOption.suggestSelection, 'suggestSelection',6643'first' as 'first' | 'recentlyUsed' | 'recentlyUsedByPrefix',6644['first', 'recentlyUsed', 'recentlyUsedByPrefix'] as const,6645{6646markdownEnumDescriptions: [6647nls.localize('suggestSelection.first', "Always select the first suggestion."),6648nls.localize('suggestSelection.recentlyUsed', "Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently."),6649nls.localize('suggestSelection.recentlyUsedByPrefix', "Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`."),6650],6651description: nls.localize('suggestSelection', "Controls how suggestions are pre-selected when showing the suggest list.")6652}6653)),6654tabCompletion: register(new EditorStringEnumOption(6655EditorOption.tabCompletion, 'tabCompletion',6656'off' as 'on' | 'off' | 'onlySnippets',6657['on', 'off', 'onlySnippets'] as const,6658{6659enumDescriptions: [6660nls.localize('tabCompletion.on', "Tab complete will insert the best matching suggestion when pressing tab."),6661nls.localize('tabCompletion.off', "Disable tab completions."),6662nls.localize('tabCompletion.onlySnippets', "Tab complete snippets when their prefix match. Works best when 'quickSuggestions' aren't enabled."),6663],6664description: nls.localize('tabCompletion', "Enables tab completions.")6665}6666)),6667tabIndex: register(new EditorIntOption(6668EditorOption.tabIndex, 'tabIndex',66690, -1, Constants.MAX_SAFE_SMALL_INTEGER6670)),6671trimWhitespaceOnDelete: register(new EditorBooleanOption(6672EditorOption.trimWhitespaceOnDelete, 'trimWhitespaceOnDelete', false,6673{ description: nls.localize('trimWhitespaceOnDelete', "Controls whether the editor will also delete the next line's indentation whitespace when deleting a newline.") }6674)),6675unicodeHighlight: register(new UnicodeHighlight()),6676unusualLineTerminators: register(new EditorStringEnumOption(6677EditorOption.unusualLineTerminators, 'unusualLineTerminators',6678'prompt' as 'auto' | 'off' | 'prompt',6679['auto', 'off', 'prompt'] as const,6680{6681enumDescriptions: [6682nls.localize('unusualLineTerminators.auto', "Unusual line terminators are automatically removed."),6683nls.localize('unusualLineTerminators.off', "Unusual line terminators are ignored."),6684nls.localize('unusualLineTerminators.prompt', "Unusual line terminators prompt to be removed."),6685],6686description: nls.localize('unusualLineTerminators', "Remove unusual line terminators that might cause problems.")6687}6688)),6689useShadowDOM: register(new EditorBooleanOption(6690EditorOption.useShadowDOM, 'useShadowDOM', true6691)),6692useTabStops: register(new EditorBooleanOption(6693EditorOption.useTabStops, 'useTabStops', true,6694{ description: nls.localize('useTabStops', "Spaces and tabs are inserted and deleted in alignment with tab stops.") }6695)),6696wordBreak: register(new EditorStringEnumOption(6697EditorOption.wordBreak, 'wordBreak',6698'normal' as 'normal' | 'keepAll',6699['normal', 'keepAll'] as const,6700{6701markdownEnumDescriptions: [6702nls.localize('wordBreak.normal', "Use the default line break rule."),6703nls.localize('wordBreak.keepAll', "Word breaks should not be used for Chinese/Japanese/Korean (CJK) text. Non-CJK text behavior is the same as for normal."),6704],6705description: nls.localize('wordBreak', "Controls the word break rules used for Chinese/Japanese/Korean (CJK) text.")6706}6707)),6708wordSegmenterLocales: register(new WordSegmenterLocales()),6709wordSeparators: register(new EditorStringOption(6710EditorOption.wordSeparators, 'wordSeparators', USUAL_WORD_SEPARATORS,6711{ description: nls.localize('wordSeparators', "Characters that will be used as word separators when doing word related navigations or operations.") }6712)),6713wordWrap: register(new EditorStringEnumOption(6714EditorOption.wordWrap, 'wordWrap',6715'off' as 'off' | 'on' | 'wordWrapColumn' | 'bounded',6716['off', 'on', 'wordWrapColumn', 'bounded'] as const,6717{6718markdownEnumDescriptions: [6719nls.localize('wordWrap.off', "Lines will never wrap."),6720nls.localize('wordWrap.on', "Lines will wrap at the viewport width."),6721nls.localize({6722key: 'wordWrap.wordWrapColumn',6723comment: [6724'- `editor.wordWrapColumn` refers to a different setting and should not be localized.'6725]6726}, "Lines will wrap at `#editor.wordWrapColumn#`."),6727nls.localize({6728key: 'wordWrap.bounded',6729comment: [6730'- viewport means the edge of the visible window size.',6731'- `editor.wordWrapColumn` refers to a different setting and should not be localized.'6732]6733}, "Lines will wrap at the minimum of viewport and `#editor.wordWrapColumn#`."),6734],6735description: nls.localize({6736key: 'wordWrap',6737comment: [6738'- \'off\', \'on\', \'wordWrapColumn\' and \'bounded\' refer to values the setting can take and should not be localized.',6739'- `editor.wordWrapColumn` refers to a different setting and should not be localized.'6740]6741}, "Controls how lines should wrap.")6742}6743)),6744wordWrapBreakAfterCharacters: register(new EditorStringOption(6745EditorOption.wordWrapBreakAfterCharacters, 'wordWrapBreakAfterCharacters',6746// allow-any-unicode-next-line6747' \t})]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」',6748)),6749wordWrapBreakBeforeCharacters: register(new EditorStringOption(6750EditorOption.wordWrapBreakBeforeCharacters, 'wordWrapBreakBeforeCharacters',6751// allow-any-unicode-next-line6752'([{‘“〈《「『【〔([{「£¥$£¥++'6753)),6754wordWrapColumn: register(new EditorIntOption(6755EditorOption.wordWrapColumn, 'wordWrapColumn',675680, 1, Constants.MAX_SAFE_SMALL_INTEGER,6757{6758markdownDescription: nls.localize({6759key: 'wordWrapColumn',6760comment: [6761'- `editor.wordWrap` refers to a different setting and should not be localized.',6762'- \'wordWrapColumn\' and \'bounded\' refer to values the different setting can take and should not be localized.'6763]6764}, "Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.")6765}6766)),6767wordWrapOverride1: register(new EditorStringEnumOption(6768EditorOption.wordWrapOverride1, 'wordWrapOverride1',6769'inherit' as 'off' | 'on' | 'inherit',6770['off', 'on', 'inherit'] as const6771)),6772wordWrapOverride2: register(new EditorStringEnumOption(6773EditorOption.wordWrapOverride2, 'wordWrapOverride2',6774'inherit' as 'off' | 'on' | 'inherit',6775['off', 'on', 'inherit'] as const6776)),6777wrapOnEscapedLineFeeds: register(new EditorBooleanOption(6778EditorOption.wrapOnEscapedLineFeeds, 'wrapOnEscapedLineFeeds', false,6779{ markdownDescription: nls.localize('wrapOnEscapedLineFeeds', "Controls whether literal `\\n` shall trigger a wordWrap when `#editor.wordWrap#` is enabled.\n\nFor example:\n```c\nchar* str=\"hello\\nworld\"\n```\nwill be displayed as\n```c\nchar* str=\"hello\\n\n world\"\n```") }6780)),67816782// Leave these at the end (because they have dependencies!)6783effectiveCursorStyle: register(new EffectiveCursorStyle()),6784editorClassName: register(new EditorClassName()),6785defaultColorDecorators: register(new EditorStringEnumOption(6786EditorOption.defaultColorDecorators, 'defaultColorDecorators', 'auto' as 'auto' | 'always' | 'never',6787['auto', 'always', 'never'] as const,6788{6789enumDescriptions: [6790nls.localize('editor.defaultColorDecorators.auto', "Show default color decorators only when no extension provides colors decorators."),6791nls.localize('editor.defaultColorDecorators.always', "Always show default color decorators."),6792nls.localize('editor.defaultColorDecorators.never', "Never show default color decorators."),6793],6794description: nls.localize('defaultColorDecorators', "Controls whether inline color decorations should be shown using the default document color provider.")6795}6796)),6797pixelRatio: register(new EditorPixelRatio()),6798tabFocusMode: register(new EditorBooleanOption(EditorOption.tabFocusMode, 'tabFocusMode', false,6799{ markdownDescription: nls.localize('tabFocusMode', "Controls whether the editor receives tabs or defers them to the workbench for navigation.") }6800)),6801layoutInfo: register(new EditorLayoutInfoComputer()),6802wrappingInfo: register(new EditorWrappingInfoComputer()),6803wrappingIndent: register(new WrappingIndentOption()),6804wrappingStrategy: register(new WrappingStrategy()),6805effectiveEditContextEnabled: register(new EffectiveEditContextEnabled()),6806effectiveAllowVariableFonts: register(new EffectiveAllowVariableFonts())6807};68086809type EditorOptionsType = typeof EditorOptions;6810type FindEditorOptionsKeyById<T extends EditorOption> = { [K in keyof EditorOptionsType]: EditorOptionsType[K]['id'] extends T ? K : never }[keyof EditorOptionsType];6811// eslint-disable-next-line @typescript-eslint/no-explicit-any6812type ComputedEditorOptionValue<T extends IEditorOption<any, any>> = T extends IEditorOption<any, infer R> ? R : never;6813export type FindComputedEditorOptionValueById<T extends EditorOption> = NonNullable<ComputedEditorOptionValue<EditorOptionsType[FindEditorOptionsKeyById<T>]>>;68146815export type MouseMiddleClickAction = 'default' | 'openLink' | 'ctrlLeftClick';681668176818