Merge from vscode 3c6f6af7347d38e87bc6406024e8dcf9e9bce229 (#8962)

* Merge from vscode 3c6f6af7347d38e87bc6406024e8dcf9e9bce229

* skip failing tests

* update mac build image
This commit is contained in:
Anthony Dresser
2020-01-27 15:28:17 -08:00
committed by Karl Burtram
parent 0eaee18dc4
commit fefe1454de
481 changed files with 12764 additions and 7836 deletions

View File

@@ -135,6 +135,11 @@ export interface IEditorOptions {
* Defaults to false.
*/
readOnly?: boolean;
/**
* Should the editor render validation decorations.
* Defaults to editable.
*/
renderValidationDecorations?: 'editable' | 'on' | 'off';
/**
* Control the behavior and rendering of the scrollbars.
*/
@@ -295,6 +300,10 @@ export interface IEditorOptions {
* Enable inline color decorators and color picker rendering.
*/
colorDecorators?: boolean;
/**
* Control the behaviour of comments in the editor.
*/
comments?: IEditorCommentsOptions;
/**
* Enable custom contextmenu.
* Defaults to true.
@@ -545,7 +554,7 @@ export interface IEditorOptions {
* Controls whether to focus the inline editor in the peek widget by default.
* Defaults to false.
*/
peekWidgetFocusInlineEditor?: boolean;
peekWidgetDefaultFocus?: 'tree' | 'editor';
}
export interface IEditorConstructionOptions extends IEditorOptions {
@@ -998,6 +1007,52 @@ class EditorAccessibilitySupport extends BaseEditorOption<EditorOption.accessibi
//#endregion
//#region comments
/**
* Configuration options for editor comments
*/
export interface IEditorCommentsOptions {
/**
* Insert a space after the line comment token and inside the block comments tokens.
* Defaults to true.
*/
insertSpace?: boolean;
}
export type EditorCommentsOptions = Readonly<Required<IEditorCommentsOptions>>;
class EditorComments extends BaseEditorOption<EditorOption.comments, EditorCommentsOptions> {
constructor() {
const defaults: EditorCommentsOptions = {
insertSpace: true,
};
super(
EditorOption.comments, 'comments', defaults,
{
'editor.comments.insertSpace': {
type: 'boolean',
default: defaults.insertSpace,
description: nls.localize('comments.insertSpace', "Controls whether a space character is inserted when commenting.")
},
}
);
}
public validate(_input: any): EditorCommentsOptions {
if (typeof _input !== 'object') {
return this.defaultValue;
}
const input = _input as IEditorCommentsOptions;
return {
insertSpace: EditorBooleanOption.boolean(input.insertSpace, this.defaultValue.insertSpace),
};
}
}
//#endregion
//#region cursorBlinking
/**
@@ -2290,6 +2345,21 @@ class EditorRenderLineNumbersOption extends BaseEditorOption<EditorOption.lineNu
//#endregion
//#region renderValidationDecorations
/**
* @internal
*/
export function filterValidationDecorations(options: IComputedEditorOptions): boolean {
const renderValidationDecorations = options.get(EditorOption.renderValidationDecorations);
if (renderValidationDecorations === 'editable') {
return options.get(EditorOption.readOnly);
}
return renderValidationDecorations === 'on' ? false : true;
}
//#endregion
//#region rulers
class EditorRulers extends SimpleEditorOption<EditorOption.rulers, number[]> {
@@ -3066,6 +3136,7 @@ export const enum EditorOption {
autoSurround,
codeLens,
colorDecorators,
comments,
contextmenu,
copyWithSyntaxHighlighting,
cursorBlinking,
@@ -3117,7 +3188,7 @@ export const enum EditorOption {
overviewRulerBorder,
overviewRulerLanes,
parameterHints,
peekWidgetFocusInlineEditor,
peekWidgetDefaultFocus,
quickSuggestions,
quickSuggestionsDelay,
readOnly,
@@ -3125,6 +3196,7 @@ export const enum EditorOption {
renderIndentGuides,
renderFinalNewline,
renderLineHighlight,
renderValidationDecorations,
renderWhitespace,
revealHorizontalRightPadding,
roundedSelection,
@@ -3169,6 +3241,7 @@ export const enum EditorOption {
* WORKAROUND: TS emits "any" for complex editor options values (anything except string, bool, enum, etc. ends up being "any")
* @monacodtsreplace
* /accessibilitySupport, any/accessibilitySupport, AccessibilitySupport/
* /comments, any/comments, EditorCommentsOptions/
* /find, any/find, EditorFindOptions/
* /fontInfo, any/fontInfo, FontInfo/
* /gotoLocation, any/gotoLocation, GoToLocationOptions/
@@ -3285,6 +3358,7 @@ export const EditorOptions = {
EditorOption.colorDecorators, 'colorDecorators', true,
{ description: nls.localize('colorDecorators', "Controls whether the editor should render the inline color decorators and color picker.") }
)),
comments: register(new EditorComments()),
contextmenu: register(new EditorBooleanOption(
EditorOption.contextmenu, 'contextmenu', true,
)),
@@ -3494,9 +3568,17 @@ 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.") }
peekWidgetDefaultFocus: register(new EditorStringEnumOption(
EditorOption.peekWidgetDefaultFocus, 'peekWidgetDefaultFocus',
'tree' as 'tree' | 'editor',
['tree', 'editor'] as const,
{
enumDescriptions: [
nls.localize('peekWidgetDefaultFocus.tree', "Focus the tree when openeing peek"),
nls.localize('peekWidgetDefaultFocus.editor', "Focus the editor when opening peek")
],
description: nls.localize('peekWidgetDefaultFocus', "Controls whether to focus the inline editor or the tree in the peek widget.")
}
)),
quickSuggestions: register(new EditorQuickSuggestions()),
quickSuggestionsDelay: register(new EditorIntOption(
@@ -3533,6 +3615,11 @@ export const EditorOptions = {
description: nls.localize('renderLineHighlight', "Controls how the editor should render the current line highlight.")
}
)),
renderValidationDecorations: register(new EditorStringEnumOption(
EditorOption.renderValidationDecorations, 'renderValidationDecorations',
'editable' as 'editable' | 'on' | 'off',
['editable', 'on', 'off'] as const
)),
renderWhitespace: register(new EditorStringEnumOption(
EditorOption.renderWhitespace, 'renderWhitespace',
'none' as 'none' | 'boundary' | 'selection' | 'all',