Merge from vscode 718331d6f3ebd1b571530ab499edb266ddd493d5

This commit is contained in:
ADS Merger
2020-02-08 04:50:58 +00:00
parent 8c61538a27
commit 2af13c18d2
752 changed files with 16458 additions and 10063 deletions

View File

@@ -58,7 +58,7 @@ export interface IEditorOptions {
* Render vertical lines at the specified columns.
* Defaults to empty array.
*/
rulers?: number[];
rulers?: (number | IRulerOption)[];
/**
* A string containing the word separators used when doing word navigation.
* Defaults to `~!@#$%^&*()-=+[{]}\\|;:\'",.<>/?
@@ -74,7 +74,7 @@ export interface IEditorOptions {
* If it is a function, it will be invoked when rendering a line number and the return value will be rendered.
* Otherwise, if it is a truey, line numbers will be rendered normally (equivalent of using an identity function).
* Otherwise, line numbers will not be rendered.
* Defaults to true.
* Defaults to `on`.
*/
lineNumbers?: LineNumbersType;
/**
@@ -267,10 +267,10 @@ export interface IEditorOptions {
*/
wrappingIndent?: 'none' | 'same' | 'indent' | 'deepIndent';
/**
* Controls the wrapping algorithm to use.
* Defaults to 'monospace'.
* Controls the wrapping strategy to use.
* Defaults to 'simple'.
*/
wrappingAlgorithm?: 'monospace' | 'dom';
wrappingStrategy?: 'simple' | 'advanced';
/**
* Configure word wrapping characters. A break will be introduced before these characters.
* Defaults to '([{‘“〈《「『【〔([{「£¥$£¥+'.
@@ -319,6 +319,11 @@ export interface IEditorOptions {
* Defaults to 5.
*/
fastScrollSensitivity?: number;
/**
* Enable that the editor scrolls only the predominant axis. Prevents horizontal drift when scrolling vertically on a trackpad.
* Defaults to true.
*/
scrollPredominantAxis?: boolean;
/**
* The modifier to be used to add multiple cursors with the mouse.
* Defaults to 'alt'
@@ -385,8 +390,8 @@ export interface IEditorOptions {
*/
autoSurround?: EditorAutoSurroundStrategy;
/**
* Enable auto indentation adjustment.
* Defaults to false.
* Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.
* Defaults to advanced.
*/
autoIndent?: 'none' | 'keep' | 'brackets' | 'advanced' | 'full';
/**
@@ -555,6 +560,11 @@ export interface IEditorOptions {
* Defaults to false.
*/
peekWidgetDefaultFocus?: 'tree' | 'editor';
/**
* Controls whether the definition link opens element in the peek widget.
* Defaults to false.
*/
definitionLinkOpensInPeek?: boolean;
}
export interface IEditorConstructionOptions extends IEditorOptions {
@@ -625,9 +635,6 @@ export class ConfigurationChangedEvent {
constructor(values: boolean[]) {
this._values = values;
}
/**
* @internal
*/
public hasChanged(id: EditorOption): boolean {
return this._values[id];
}
@@ -1592,55 +1599,6 @@ 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
/**
@@ -2362,16 +2320,37 @@ export function filterValidationDecorations(options: IComputedEditorOptions): bo
//#region rulers
class EditorRulers extends SimpleEditorOption<EditorOption.rulers, number[]> {
export interface IRulerOption {
readonly column: number;
readonly color: string | null;
}
class EditorRulers extends BaseEditorOption<EditorOption.rulers, IRulerOption[]> {
constructor() {
const defaults: number[] = [];
const defaults: IRulerOption[] = [];
const columnSchema: IJSONSchema = { type: 'number', description: nls.localize('rulers.size', "Number of monospace characters at which this editor ruler will render.") };
super(
EditorOption.rulers, 'rulers', defaults,
{
type: 'array',
items: {
type: 'number'
anyOf: [
columnSchema,
{
type: [
'object'
],
properties: {
column: columnSchema,
color: {
type: 'string',
description: nls.localize('rulers.color', "Color of this editor ruler."),
format: 'color-hex'
}
}
}
]
},
default: defaults,
description: 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.")
@@ -2379,13 +2358,24 @@ class EditorRulers extends SimpleEditorOption<EditorOption.rulers, number[]> {
);
}
public validate(input: any): number[] {
public validate(input: any): IRulerOption[] {
if (Array.isArray(input)) {
let rulers: number[] = [];
for (let value of input) {
rulers.push(EditorIntOption.clampedInt(value, 0, 0, 10000));
let rulers: IRulerOption[] = [];
for (let _element of input) {
if (typeof _element === 'number') {
rulers.push({
column: EditorIntOption.clampedInt(_element, 0, 0, 10000),
color: null
});
} else if (typeof _element === 'object') {
const element = _element as IRulerOption;
rulers.push({
column: EditorIntOption.clampedInt(element.column, 0, 0, 10000),
color: element.color
});
}
}
rulers.sort((a, b) => a - b);
rulers.sort((a, b) => a.column - b.column);
return rulers;
}
return this.defaultValue;
@@ -2674,6 +2664,10 @@ export interface ISuggestOptions {
* Show snippet-suggestions.
*/
showSnippets?: boolean;
/**
* Controls the visibility of the status bar at the bottom of the suggest widget.
*/
hideStatusBar?: boolean;
}
export type InternalSuggestOptions = Readonly<Required<ISuggestOptions>>;
@@ -2683,7 +2677,7 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
constructor() {
const defaults: InternalSuggestOptions = {
insertMode: 'insert',
insertHighlight: false,
insertHighlight: true,
filterGraceful: true,
snippetsPreventQuickSuggestions: true,
localityBonus: false,
@@ -2715,6 +2709,7 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
showFolders: true,
showTypeParameters: true,
showSnippets: true,
hideStatusBar: true
};
super(
EditorOption.suggest, 'suggest', defaults,
@@ -2752,7 +2747,7 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
'editor.suggest.snippetsPreventQuickSuggestions': {
type: 'boolean',
default: defaults.snippetsPreventQuickSuggestions,
description: nls.localize('suggest.snippetsPreventQuickSuggestions', "Control whether an active snippet prevents quick suggestions.")
description: nls.localize('suggest.snippetsPreventQuickSuggestions', "Controls whether an active snippet prevents quick suggestions.")
},
'editor.suggest.showIcons': {
type: 'boolean',
@@ -2899,6 +2894,11 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
type: 'boolean',
default: true,
markdownDescription: nls.localize('editor.suggest.showSnippets', "When enabled IntelliSense shows `snippet`-suggestions.")
},
'editor.suggest.hideStatusBar': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('editor.suggest.hideStatusBar', "Controls the visibility of the status bar at the bottom of the suggest widget.")
}
}
);
@@ -2943,6 +2943,7 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
showFolders: EditorBooleanOption.boolean(input.showFolders, this.defaultValue.showFolders),
showTypeParameters: EditorBooleanOption.boolean(input.showTypeParameters, this.defaultValue.showTypeParameters),
showSnippets: EditorBooleanOption.boolean(input.showSnippets, this.defaultValue.showSnippets),
hideStatusBar: EditorBooleanOption.boolean(input.hideStatusBar, this.defaultValue.hideStatusBar),
};
}
}
@@ -3189,6 +3190,7 @@ export const enum EditorOption {
overviewRulerLanes,
parameterHints,
peekWidgetDefaultFocus,
definitionLinkOpensInPeek,
quickSuggestions,
quickSuggestionsDelay,
readOnly,
@@ -3204,10 +3206,10 @@ export const enum EditorOption {
scrollbar,
scrollBeyondLastColumn,
scrollBeyondLastLine,
scrollPredominantAxis,
selectionClipboard,
selectionHighlight,
selectOnLineNumbers,
semanticHighlighting,
showFoldingControls,
showUnused,
snippetSuggestions,
@@ -3227,7 +3229,7 @@ export const enum EditorOption {
wordWrapColumn,
wordWrapMinified,
wrappingIndent,
wrappingAlgorithm,
wrappingStrategy,
// Leave these at the end (because they have dependencies!)
editorClassName,
@@ -3437,7 +3439,13 @@ export const EditorOptions = {
EditorOption.foldingStrategy, 'foldingStrategy',
'auto' as 'auto' | 'indentation',
['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.") }
{
enumDescriptions: [
nls.localize('foldingStrategy.auto', "Use a language-specific folding strategy if available, else the indentation-based one."),
nls.localize('foldingStrategy.indentation', "Use the indentation-based folding strategy."),
],
description: nls.localize('foldingStrategy', "Controls the strategy for computing folding ranges.")
}
)),
foldingHighlight: register(new EditorBooleanOption(
EditorOption.foldingHighlight, 'foldingHighlight', true,
@@ -3574,12 +3582,16 @@ export const EditorOptions = {
['tree', 'editor'] as const,
{
enumDescriptions: [
nls.localize('peekWidgetDefaultFocus.tree', "Focus the tree when openeing peek"),
nls.localize('peekWidgetDefaultFocus.tree', "Focus the tree when opening 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.")
}
)),
definitionLinkOpensInPeek: register(new EditorBooleanOption(
EditorOption.definitionLinkOpensInPeek, 'definitionLinkOpensInPeek', false,
{ description: nls.localize('definitionLinkOpensInPeek', "Controls whether the definition link opens element in the peek widget.") }
)),
quickSuggestions: register(new EditorQuickSuggestions()),
quickSuggestionsDelay: register(new EditorIntOption(
EditorOption.quickSuggestionsDelay, 'quickSuggestionsDelay',
@@ -3653,6 +3665,10 @@ export const EditorOptions = {
EditorOption.scrollBeyondLastLine, 'scrollBeyondLastLine', true,
{ description: nls.localize('scrollBeyondLastLine', "Controls whether the editor will scroll beyond the last line.") }
)),
scrollPredominantAxis: register(new EditorBooleanOption(
EditorOption.scrollPredominantAxis, 'scrollPredominantAxis', true,
{ 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.") }
)),
selectionClipboard: register(new EditorBooleanOption(
EditorOption.selectionClipboard, 'selectionClipboard', true,
{
@@ -3667,12 +3683,17 @@ 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',
['always', 'mouseover'] as const,
{ description: nls.localize('showFoldingControls', "Controls whether the fold controls on the gutter are automatically hidden.") }
{
enumDescriptions: [
nls.localize('showFoldingControls.always', "Always show the folding controls."),
nls.localize('showFoldingControls.mouseover', "Only show the folding controls when the mouse is over the gutter."),
],
description: nls.localize('showFoldingControls', "Controls when the folding controls on the gutter are shown.")
}
)),
showUnused: register(new EditorBooleanOption(
EditorOption.showUnused, 'showUnused', true,
@@ -3819,16 +3840,16 @@ 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,
wrappingStrategy: register(new EditorStringEnumOption(
EditorOption.wrappingStrategy, 'wrappingStrategy',
'simple' as 'simple' | 'advanced',
['simple', 'advanced'] 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.")
nls.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."),
nls.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.")
],
description: nls.localize('wrappingAlgorithm', "Controls the algorithm that computes wrapping points.")
description: nls.localize('wrappingStrategy', "Controls the algorithm that computes wrapping points.")
}
)),