Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2 (#8911)

* Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2

* update distro

* fix layering

* update distro

* fix tests
This commit is contained in:
Anthony Dresser
2020-01-22 13:42:37 -08:00
committed by GitHub
parent 977111eb21
commit bd7aac8ee0
895 changed files with 24651 additions and 14520 deletions

View File

@@ -33,7 +33,6 @@ export type EditorAutoClosingOvertypeStrategy = 'always' | 'auto' | 'never';
/**
* Configuration options for auto indentation in the editor
* @internal
*/
export const enum EditorAutoIndentStrategy {
None = 0,
@@ -262,21 +261,21 @@ export interface IEditorOptions {
* Defaults to 'same' in vscode and to 'none' in monaco-editor.
*/
wrappingIndent?: 'none' | 'same' | 'indent' | 'deepIndent';
/**
* Controls the wrapping algorithm to use.
* Defaults to 'monospace'.
*/
wrappingAlgorithm?: 'monospace' | 'dom';
/**
* Configure word wrapping characters. A break will be introduced before these characters.
* Defaults to '{([+'.
* Defaults to '([{‘“〈《「『【〔([{「£¥$£¥+'.
*/
wordWrapBreakBeforeCharacters?: string;
/**
* Configure word wrapping characters. A break will be introduced after these characters.
* Defaults to ' \t})]?|&,;'.
* Defaults to ' \t})]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」'.
*/
wordWrapBreakAfterCharacters?: string;
/**
* Configure word wrapping characters. A break will be introduced after these characters only if no `wordWrapBreakBeforeCharacters` or `wordWrapBreakAfterCharacters` were found.
* Defaults to '.'.
*/
wordWrapBreakObtrusiveCharacters?: string;
/**
* Performance guard: Stop rendering a line after x characters.
* Defaults to 10000.
@@ -465,7 +464,7 @@ export interface IEditorOptions {
*/
codeActionsOnSaveTimeout?: number;
/**
* Enable code folding
* Enable code folding.
* Defaults to true.
*/
folding?: boolean;
@@ -474,6 +473,11 @@ export interface IEditorOptions {
* Defaults to 'auto'.
*/
foldingStrategy?: 'auto' | 'indentation';
/**
* Enable highlight for folded regions.
* Defaults to true.
*/
foldingHighlight?: boolean;
/**
* Controls whether the fold actions in the gutter stay always visible or hide unless the mouse is over the gutter.
* Defaults to 'mouseover'.
@@ -537,6 +541,11 @@ export interface IEditorOptions {
* Controls fading out of unused variables.
*/
showUnused?: boolean;
/**
* Controls whether to focus the inline editor in the peek widget by default.
* Defaults to false.
*/
peekWidgetFocusInlineEditor?: boolean;
}
export interface IEditorConstructionOptions extends IEditorOptions {
@@ -632,7 +641,7 @@ export class ValidatedEditorOptions {
}
/**
* @internal
* All computed editor options.
*/
export interface IComputedEditorOptions {
get<T extends EditorOption>(id: T): FindComputedEditorOptionValueById<T>;
@@ -656,13 +665,10 @@ export interface IEnvironmentalOptions {
readonly accessibilitySupport: AccessibilitySupport;
}
/**
* @internal
*/
export interface IEditorOption<K1 extends EditorOption, V> {
readonly id: K1;
readonly name: string;
readonly defaultValue: V;
defaultValue: V;
/**
* @internal
*/
@@ -996,7 +1002,6 @@ class EditorAccessibilitySupport extends BaseEditorOption<EditorOption.accessibi
/**
* The kind of animation in which the editor's cursor should be rendered.
* @internal
*/
export const enum TextEditorCursorBlinkingStyle {
/**
@@ -1041,7 +1046,6 @@ function _cursorBlinkingStyleFromString(cursorBlinkingStyle: 'blink' | 'smooth'
/**
* The style in which the editor's cursor should be rendered.
* @internal
*/
export enum TextEditorCursorStyle {
/**
@@ -1170,9 +1174,6 @@ export interface IEditorFindOptions {
globalFindClipboard?: boolean;
}
/**
* @internal
*/
export type EditorFindOptions = Readonly<Required<IEditorFindOptions>>;
class EditorFind extends BaseEditorOption<EditorOption.find, EditorFindOptions> {
@@ -1360,9 +1361,6 @@ export interface IGotoLocationOptions {
alternativeReferenceCommand?: string;
}
/**
* @internal
*/
export type GoToLocationOptions = Readonly<Required<IGotoLocationOptions>>;
class EditorGoToLocation extends BaseEditorOption<EditorOption.gotoLocation, GoToLocationOptions> {
@@ -1492,9 +1490,6 @@ export interface IEditorHoverOptions {
sticky?: boolean;
}
/**
* @internal
*/
export type EditorHoverOptions = Readonly<Required<IEditorHoverOptions>>;
class EditorHover extends BaseEditorOption<EditorOption.hover, EditorHoverOptions> {
@@ -1542,6 +1537,55 @@ class EditorHover extends BaseEditorOption<EditorOption.hover, EditorHoverOption
//#endregion
//#region semantic highlighting
/**
* Configuration options for semantic highlighting
*/
export interface IEditorSemanticHighlightingOptions {
/**
* Enable semantic highlighting.
* Defaults to true.
*/
enabled?: boolean;
}
/**
* @internal
*/
export type EditorSemanticHighlightingOptions = Readonly<Required<IEditorSemanticHighlightingOptions>>;
class EditorSemanticHighlighting extends BaseEditorOption<EditorOption.semanticHighlighting, EditorSemanticHighlightingOptions> {
constructor() {
const defaults: EditorSemanticHighlightingOptions = {
enabled: true
};
super(
EditorOption.semanticHighlighting, 'semanticHighlighting', defaults,
{
'editor.semanticHighlighting.enabled': {
type: 'boolean',
default: defaults.enabled,
description: nls.localize('semanticHighlighting.enabled', "Controls whether the semanticHighlighting is shown for the languages that support it.")
}
}
);
}
public validate(_input: any): EditorSemanticHighlightingOptions {
if (typeof _input !== 'object') {
return this.defaultValue;
}
const input = _input as IEditorSemanticHighlightingOptions;
return {
enabled: EditorBooleanOption.boolean(input.enabled, this.defaultValue.enabled)
};
}
}
//#endregion
//#region layoutInfo
/**
@@ -1594,10 +1638,6 @@ export interface EditorLayoutInfo {
* The width of the glyph margin.
*/
readonly glyphMarginWidth: number;
/**
* The height of the glyph margin.
*/
readonly glyphMarginHeight: number;
/**
* Left position for the line numbers.
@@ -1607,10 +1647,6 @@ export interface EditorLayoutInfo {
* The width of the line numbers.
*/
readonly lineNumbersWidth: number;
/**
* The height of the line numbers.
*/
readonly lineNumbersHeight: number;
/**
* Left position for the line decorations.
@@ -1620,10 +1656,6 @@ export interface EditorLayoutInfo {
* The width of the line decorations.
*/
readonly decorationsWidth: number;
/**
* The height of the line decorations.
*/
readonly decorationsHeight: number;
/**
* Left position for the content (actual text)
@@ -1633,10 +1665,6 @@ export interface EditorLayoutInfo {
* The width of the content (actual text)
*/
readonly contentWidth: number;
/**
* The height of the content (actual height)
*/
readonly contentHeight: number;
/**
* The position for the minimap
@@ -1823,19 +1851,15 @@ export class EditorLayoutInfoComputer extends ComputedEditorOption<EditorOption.
glyphMarginLeft: glyphMarginLeft,
glyphMarginWidth: glyphMarginWidth,
glyphMarginHeight: outerHeight,
lineNumbersLeft: lineNumbersLeft,
lineNumbersWidth: lineNumbersWidth,
lineNumbersHeight: outerHeight,
decorationsLeft: decorationsLeft,
decorationsWidth: lineDecorationsWidth,
decorationsHeight: outerHeight,
contentLeft: contentLeft,
contentWidth: contentWidth,
contentHeight: outerHeight,
renderMinimap: renderMinimap,
minimapLeft: minimapLeft,
@@ -1871,9 +1895,6 @@ export interface IEditorLightbulbOptions {
enabled?: boolean;
}
/**
* @internal
*/
export type EditorLightbulbOptions = Readonly<Required<IEditorLightbulbOptions>>;
class EditorLightbulb extends BaseEditorOption<EditorOption.lightbulb, EditorLightbulbOptions> {
@@ -1965,9 +1986,6 @@ export interface IEditorMinimapOptions {
scale?: number;
}
/**
* @internal
*/
export type EditorMinimapOptions = Readonly<Required<IEditorMinimapOptions>>;
class EditorMinimap extends BaseEditorOption<EditorOption.minimap, EditorMinimapOptions> {
@@ -2069,9 +2087,6 @@ export interface IEditorParameterHintOptions {
cycle?: boolean;
}
/**
* @internal
*/
export type InternalParameterHintOptions = Readonly<Required<IEditorParameterHintOptions>>;
class EditorParameterHints extends BaseEditorOption<EditorOption.parameterHints, InternalParameterHintOptions> {
@@ -2138,9 +2153,6 @@ export interface IQuickSuggestionsOptions {
strings: boolean;
}
/**
* @internal
*/
export type ValidQuickSuggestionsOptions = boolean | Readonly<Required<IQuickSuggestionsOptions>>;
class EditorQuickSuggestions extends BaseEditorOption<EditorOption.quickSuggestions, ValidQuickSuggestionsOptions> {
@@ -2217,9 +2229,6 @@ class EditorQuickSuggestions extends BaseEditorOption<EditorOption.quickSuggesti
export type LineNumbersType = 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string);
/**
* @internal
*/
export const enum RenderLineNumbersType {
Off = 0,
On = 1,
@@ -2228,9 +2237,6 @@ export const enum RenderLineNumbersType {
Custom = 4
}
/**
* @internal
*/
export interface InternalEditorRenderLineNumbersOptions {
readonly renderType: RenderLineNumbersType;
readonly renderFn: ((lineNumber: number) => string) | null;
@@ -2386,9 +2392,6 @@ export interface IEditorScrollbarOptions {
horizontalSliderSize?: number;
}
/**
* @internal
*/
export interface InternalEditorScrollbarOptions {
readonly arrowSize: number;
readonly vertical: ScrollbarVisibility;
@@ -2603,9 +2606,6 @@ export interface ISuggestOptions {
showSnippets?: boolean;
}
/**
* @internal
*/
export type InternalSuggestOptions = Readonly<Required<ISuggestOptions>>;
class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSuggestOptions> {
@@ -2829,7 +2829,7 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
type: 'boolean',
default: true,
markdownDescription: nls.localize('editor.suggest.showSnippets', "When enabled IntelliSense shows `snippet`-suggestions.")
},
}
}
);
}
@@ -2899,7 +2899,6 @@ class EditorTabFocusMode extends ComputedEditorOption<EditorOption.tabFocusMode,
/**
* Describes how to indent wrapped lines.
* @internal
*/
export const enum WrappingIndent {
/**
@@ -2933,9 +2932,6 @@ function _wrappingIndentFromString(wrappingIndent: 'none' | 'same' | 'indent' |
//#region wrappingInfo
/**
* @internal
*/
export interface EditorWrappingInfo {
readonly isDominatedByLongLines: boolean;
readonly isWordWrapMinified: boolean;
@@ -3056,9 +3052,6 @@ function register<K1 extends EditorOption, V>(option: IEditorOption<K1, V>): IEd
return option;
}
/**
* @internal
*/
export const enum EditorOption {
acceptSuggestionOnCommitCharacter,
acceptSuggestionOnEnter,
@@ -3091,6 +3084,7 @@ export const enum EditorOption {
fixedOverflowWidgets,
folding,
foldingStrategy,
foldingHighlight,
fontFamily,
fontInfo,
fontLigatures,
@@ -3123,6 +3117,7 @@ export const enum EditorOption {
overviewRulerBorder,
overviewRulerLanes,
parameterHints,
peekWidgetFocusInlineEditor,
quickSuggestions,
quickSuggestionsDelay,
readOnly,
@@ -3140,6 +3135,7 @@ export const enum EditorOption {
selectionClipboard,
selectionHighlight,
selectOnLineNumbers,
semanticHighlighting,
showFoldingControls,
showUnused,
snippetSuggestions,
@@ -3156,10 +3152,10 @@ export const enum EditorOption {
wordWrap,
wordWrapBreakAfterCharacters,
wordWrapBreakBeforeCharacters,
wordWrapBreakObtrusiveCharacters,
wordWrapColumn,
wordWrapMinified,
wrappingIndent,
wrappingAlgorithm,
// Leave these at the end (because they have dependencies!)
editorClassName,
@@ -3170,7 +3166,18 @@ export const enum EditorOption {
}
/**
* @internal
* WORKAROUND: TS emits "any" for complex editor options values (anything except string, bool, enum, etc. ends up being "any")
* @monacodtsreplace
* /accessibilitySupport, any/accessibilitySupport, AccessibilitySupport/
* /find, any/find, EditorFindOptions/
* /fontInfo, any/fontInfo, FontInfo/
* /gotoLocation, any/gotoLocation, GoToLocationOptions/
* /hover, any/hover, EditorHoverOptions/
* /lightbulb, any/lightbulb, EditorLightbulbOptions/
* /minimap, any/minimap, EditorMinimapOptions/
* /parameterHints, any/parameterHints, InternalParameterHintOptions/
* /quickSuggestions, any/quickSuggestions, ValidQuickSuggestionsOptions/
* /suggest, any/suggest, InternalSuggestOptions/
*/
export const EditorOptions = {
acceptSuggestionOnCommitCharacter: register(new EditorBooleanOption(
@@ -3358,6 +3365,10 @@ export const EditorOptions = {
['auto', 'indentation'] as const,
{ markdownDescription: nls.localize('foldingStrategy', "Controls the strategy for computing folding ranges. `auto` uses a language specific folding strategy, if available. `indentation` uses the indentation based folding strategy.") }
)),
foldingHighlight: register(new EditorBooleanOption(
EditorOption.foldingHighlight, 'foldingHighlight', true,
{ description: nls.localize('foldingHighlight', "Controls whether the editor should highlight folded ranges.") }
)),
fontFamily: register(new EditorStringOption(
EditorOption.fontFamily, 'fontFamily', EDITOR_FONT_DEFAULTS.fontFamily,
{ description: nls.localize('fontFamily', "Controls the font family.") }
@@ -3483,6 +3494,10 @@ export const EditorOptions = {
3, 0, 3
)),
parameterHints: register(new EditorParameterHints()),
peekWidgetFocusInlineEditor: register(new EditorBooleanOption(
EditorOption.peekWidgetFocusInlineEditor, 'peekWidgetFocusInlineEditor', false,
{ description: nls.localize('peekWidgetFocusInlineEditor', "Controls whether to focus the inline editor in the peek widget by default.") }
)),
quickSuggestions: register(new EditorQuickSuggestions()),
quickSuggestionsDelay: register(new EditorIntOption(
EditorOption.quickSuggestionsDelay, 'quickSuggestionsDelay',
@@ -3565,6 +3580,7 @@ export const EditorOptions = {
selectOnLineNumbers: register(new EditorBooleanOption(
EditorOption.selectOnLineNumbers, 'selectOnLineNumbers', true,
)),
semanticHighlighting: register(new EditorSemanticHighlighting()),
showFoldingControls: register(new EditorStringEnumOption(
EditorOption.showFoldingControls, 'showFoldingControls',
'mouseover' as 'always' | 'mouseover',
@@ -3679,16 +3695,12 @@ export const EditorOptions = {
)),
wordWrapBreakAfterCharacters: register(new EditorStringOption(
EditorOption.wordWrapBreakAfterCharacters, 'wordWrapBreakAfterCharacters',
' \t})]?|/&,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」',
' \t})]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」',
)),
wordWrapBreakBeforeCharacters: register(new EditorStringOption(
EditorOption.wordWrapBreakBeforeCharacters, 'wordWrapBreakBeforeCharacters',
'([{‘“〈《「『【〔([{「£¥$£¥+'
)),
wordWrapBreakObtrusiveCharacters: register(new EditorStringOption(
EditorOption.wordWrapBreakObtrusiveCharacters, 'wordWrapBreakObtrusiveCharacters',
'.'
)),
wordWrapColumn: register(new EditorIntOption(
EditorOption.wordWrapColumn, 'wordWrapColumn',
80, 1, Constants.MAX_SAFE_SMALL_INTEGER,
@@ -3720,28 +3732,28 @@ export const EditorOptions = {
description: nls.localize('wrappingIndent', "Controls the indentation of wrapped lines."),
}
)),
wrappingAlgorithm: register(new EditorStringEnumOption(
EditorOption.wrappingAlgorithm, 'wrappingAlgorithm',
'monospace' as 'monospace' | 'dom',
['monospace', 'dom'] as const,
{
enumDescriptions: [
nls.localize('wrappingAlgorithm.monospace', "Assumes that all characters are of the same width. This is a fast algorithm."),
nls.localize('wrappingAlgorithm.dom', "Delegates wrapping points computation to the DOM. This is a slow algorithm, that might cause freezes for large files.")
],
description: nls.localize('wrappingAlgorithm', "Controls the algorithm that computes wrapping points.")
}
)),
// Leave these at the end (because they have dependencies!)
editorClassName: register(new EditorClassName()),
pixelRatio: register(new EditorPixelRatio()),
tabFocusMode: register(new EditorTabFocusMode()),
layoutInfo: register(new EditorLayoutInfoComputer()),
wrappingInfo: register(new EditorWrappingInfoComputer()),
wrappingInfo: register(new EditorWrappingInfoComputer())
};
/**
* @internal
*/
type EditorOptionsType = typeof EditorOptions;
/**
* @internal
*/
type FindEditorOptionsKeyById<T extends EditorOption> = { [K in keyof EditorOptionsType]: EditorOptionsType[K]['id'] extends T ? K : never }[keyof EditorOptionsType];
/**
* @internal
*/
type ComputedEditorOptionValue<T extends IEditorOption<any, any>> = T extends IEditorOption<any, infer R> ? R : never;
/**
* @internal
*/
export type FindComputedEditorOptionValueById<T extends EditorOption> = NonNullable<ComputedEditorOptionValue<EditorOptionsType[FindEditorOptionsKeyById<T>]>>;