Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 (#7880)

* Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998

* fix pipelines

* fix strict-null-checks

* add missing files
This commit is contained in:
Anthony Dresser
2019-10-21 22:12:22 -07:00
committed by GitHub
parent 7c9be74970
commit 1e22f47304
913 changed files with 18898 additions and 16536 deletions

View File

@@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
import * as platform from 'vs/base/common/platform';
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
import { FontInfo } from 'vs/editor/common/config/fontInfo';
import { Constants } from 'vs/editor/common/core/uint';
import { Constants } from 'vs/base/common/uint';
import { USUAL_WORD_SEPARATORS } from 'vs/editor/common/model/wordHelper';
import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
import { isObject } from 'vs/base/common/types';
@@ -178,7 +178,7 @@ export interface IEditorOptions {
* Enable font ligatures.
* Defaults to false.
*/
fontLigatures?: boolean;
fontLigatures?: boolean | string;
/**
* Disable the use of `will-change` for the editor margin and lines layers.
* The usage of `will-change` acts as a hint for browsers to create an extra layer.
@@ -538,6 +538,11 @@ export interface IDiffEditorOptions extends IEditorOptions {
* Defaults to true.
*/
renderSideBySide?: boolean;
/**
* Timeout in milliseconds after which diff computation is cancelled.
* Defaults to 5000.
*/
maxComputationTime?: number;
/**
* Compute the diff by ignoring leading/trailing whitespace
* Defaults to true.
@@ -647,6 +652,9 @@ export interface IEditorOption<K1 extends EditorOption, V> {
type PossibleKeyName0<V> = { [K in keyof IEditorOptions]: IEditorOptions[K] extends V | undefined ? K : never }[keyof IEditorOptions];
type PossibleKeyName<V> = NonNullable<PossibleKeyName0<V>>;
/**
* @internal
*/
abstract class BaseEditorOption<K1 extends EditorOption, V> implements IEditorOption<K1, V> {
public readonly id: K1;
@@ -1050,7 +1058,7 @@ function _cursorStyleFromString(cursorStyle: 'line' | 'block' | 'underline' | 'l
class EditorClassName extends ComputedEditorOption<EditorOption.editorClassName, string> {
constructor() {
super(EditorOption.editorClassName, [EditorOption.mouseStyle, EditorOption.fontLigatures, EditorOption.extraEditorClassName]);
super(EditorOption.editorClassName, [EditorOption.mouseStyle, EditorOption.extraEditorClassName]);
}
public compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, _: string): string {
@@ -1061,9 +1069,6 @@ class EditorClassName extends ComputedEditorOption<EditorOption.editorClassName,
if (env.extraEditorClassName) {
className += ' ' + env.extraEditorClassName;
}
if (options.get(EditorOption.fontLigatures)) {
className += ' enable-ligatures';
}
if (options.get(EditorOption.mouseStyle) === 'default') {
className += ' mouse-default';
} else if (options.get(EditorOption.mouseStyle) === 'copy') {
@@ -1173,6 +1178,57 @@ class EditorFind extends BaseEditorOption<EditorOption.find, EditorFindOptions>
//#endregion
//#region fontLigatures
/**
* @internal
*/
export class EditorFontLigatures extends BaseEditorOption<EditorOption.fontLigatures, string> {
public static OFF = '"liga" off, "calt" off';
public static ON = '"liga" on, "calt" on';
constructor() {
super(
EditorOption.fontLigatures, 'fontLigatures', EditorFontLigatures.OFF,
{
anyOf: [
{
type: 'boolean',
description: nls.localize('fontLigatures', "Enables/Disables font ligatures."),
},
{
type: 'string',
description: nls.localize('fontFeatureSettings', "Explicit font-feature-settings.")
}
],
default: false
}
);
}
public validate(input: any): string {
if (typeof input === 'undefined') {
return this.defaultValue;
}
if (typeof input === 'string') {
if (input === 'false') {
return EditorFontLigatures.OFF;
}
if (input === 'true') {
return EditorFontLigatures.ON;
}
return input;
}
if (Boolean(input)) {
return EditorFontLigatures.ON;
}
return EditorFontLigatures.OFF;
}
}
//#endregion
//#region fontInfo
class EditorFontInfo extends ComputedEditorOption<EditorOption.fontInfo, FontInfo> {
@@ -1364,10 +1420,8 @@ export interface OverviewRulerPosition {
export const enum RenderMinimap {
None = 0,
Small = 1,
Large = 2,
SmallBlocks = 3,
LargeBlocks = 4,
Text = 1,
Blocks = 2,
}
/**
@@ -1523,6 +1577,7 @@ export class EditorLayoutInfoComputer extends ComputedEditorOption<EditorOption.
const minimapEnabled = minimap.enabled;
const minimapSide = minimap.side;
const minimapRenderCharacters = minimap.renderCharacters;
const minimapScale = (pixelRatio >= 2 ? Math.round(minimap.scale * 2) : minimap.scale);
const minimapMaxColumn = minimap.maxColumn | 0;
const scrollbar = options.get(EditorOption.scrollbar);
@@ -1573,14 +1628,10 @@ export class EditorLayoutInfoComputer extends ComputedEditorOption<EditorOption.
renderMinimap = RenderMinimap.None;
contentWidth = remainingWidth;
} else {
let minimapCharWidth: number;
if (pixelRatio >= 2) {
renderMinimap = minimapRenderCharacters ? RenderMinimap.Large : RenderMinimap.LargeBlocks;
minimapCharWidth = 2 / pixelRatio;
} else {
renderMinimap = minimapRenderCharacters ? RenderMinimap.Small : RenderMinimap.SmallBlocks;
minimapCharWidth = 1 / pixelRatio;
}
// The minimapScale is also the pixel width of each character. Adjust
// for the pixel ratio of the screen.
const minimapCharWidth = minimapScale / pixelRatio;
renderMinimap = minimapRenderCharacters ? RenderMinimap.Text : RenderMinimap.Blocks;
// Given:
// (leaving 2px for the cursor to have space after the last character)
@@ -1756,6 +1807,11 @@ export interface IEditorMinimapOptions {
* Defaults to 120.
*/
maxColumn?: number;
/**
* Relative size of the font in the minimap. Defaults to 1.
*/
scale?: number;
}
export type EditorMinimapOptions = Readonly<Required<IEditorMinimapOptions>>;
@@ -1769,6 +1825,7 @@ class EditorMinimap extends BaseEditorOption<EditorOption.minimap, EditorMinimap
showSlider: 'mouseover',
renderCharacters: true,
maxColumn: 120,
scale: 1,
};
super(
EditorOption.minimap, 'minimap', defaults,
@@ -1788,7 +1845,14 @@ class EditorMinimap extends BaseEditorOption<EditorOption.minimap, EditorMinimap
type: 'string',
enum: ['always', 'mouseover'],
default: defaults.showSlider,
description: nls.localize('minimap.showSlider', "Controls whether the minimap slider is automatically hidden.")
description: nls.localize('minimap.showSlider', "Controls when the minimap slider is shown.")
},
'editor.minimap.scale': {
type: 'number',
default: defaults.scale,
minimum: 1,
maximum: 3,
description: nls.localize('minimap.scale', "Scale of content drawn in the minimap.")
},
'editor.minimap.renderCharacters': {
type: 'boolean',
@@ -1814,6 +1878,7 @@ class EditorMinimap extends BaseEditorOption<EditorOption.minimap, EditorMinimap
side: EditorStringEnumOption.stringSet<'right' | 'left'>(input.side, this.defaultValue.side, ['right', 'left']),
showSlider: EditorStringEnumOption.stringSet<'always' | 'mouseover'>(input.showSlider, this.defaultValue.showSlider, ['always', 'mouseover']),
renderCharacters: EditorBooleanOption.boolean(input.renderCharacters, this.defaultValue.renderCharacters),
scale: EditorIntOption.clampedInt(input.scale, 1, 1, 3),
maxColumn: EditorIntOption.clampedInt(input.maxColumn, this.defaultValue.maxColumn, 1, 10000),
};
}
@@ -1960,6 +2025,7 @@ class EditorQuickSuggestions extends BaseEditorOption<EditorOption.quickSuggesti
description: nls.localize('quickSuggestions', "Controls whether suggestions should automatically show up while typing.")
}
);
this.defaultValue = defaults;
}
public validate(_input: any): ValidQuickSuggestionsOptions {
@@ -2226,6 +2292,10 @@ class EditorScrollbar extends BaseEditorOption<EditorOption.scrollbar, InternalE
* Configuration options for editor suggest widget
*/
export interface ISuggestOptions {
/**
* Overwrite word ends on accept. Default to false.
*/
overwriteOnAccept?: boolean;
/**
* Enable graceful matching. Defaults to true.
*/
@@ -2262,6 +2332,7 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
constructor() {
const defaults: InternalSuggestOptions = {
overwriteOnAccept: false,
filterGraceful: true,
snippetsPreventQuickSuggestions: true,
localityBonus: false,
@@ -2273,6 +2344,11 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
super(
EditorOption.suggest, 'suggest', defaults,
{
'editor.suggest.overwriteOnAccept': {
type: 'boolean',
default: defaults.overwriteOnAccept,
description: nls.localize('suggest.overwriteOnAccept', "Controls whether words are overwritten when accepting completions.")
},
'editor.suggest.filterGraceful': {
type: 'boolean',
default: defaults.filterGraceful,
@@ -2305,142 +2381,135 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
maximum: 15,
description: nls.localize('suggest.maxVisibleSuggestions', "Controls how many suggestions IntelliSense will show before showing a scrollbar (maximum 15).")
},
'editor.suggest.filteredTypes': {
type: 'object',
default: { keyword: true, snippet: true },
markdownDescription: nls.localize('suggest.filtered', "Controls whether some suggestion types should be filtered from IntelliSense. A list of suggestion types can be found here: https://code.visualstudio.com/docs/editor/intellisense#_types-of-completions."),
properties: {
method: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.method', "When set to `false` IntelliSense never shows `method` suggestions.")
},
function: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.function', "When set to `false` IntelliSense never shows `function` suggestions.")
},
constructor: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.constructor', "When set to `false` IntelliSense never shows `constructor` suggestions.")
},
field: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.field', "When set to `false` IntelliSense never shows `field` suggestions.")
},
variable: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.variable', "When set to `false` IntelliSense never shows `variable` suggestions.")
},
class: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.class', "When set to `false` IntelliSense never shows `class` suggestions.")
},
struct: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.struct', "When set to `false` IntelliSense never shows `struct` suggestions.")
},
interface: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.interface', "When set to `false` IntelliSense never shows `interface` suggestions.")
},
module: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.module', "When set to `false` IntelliSense never shows `module` suggestions.")
},
property: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.property', "When set to `false` IntelliSense never shows `property` suggestions.")
},
event: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.event', "When set to `false` IntelliSense never shows `event` suggestions.")
},
operator: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.operator', "When set to `false` IntelliSense never shows `operator` suggestions.")
},
unit: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.unit', "When set to `false` IntelliSense never shows `unit` suggestions.")
},
value: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.value', "When set to `false` IntelliSense never shows `value` suggestions.")
},
constant: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.constant', "When set to `false` IntelliSense never shows `constant` suggestions.")
},
enum: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.enum', "When set to `false` IntelliSense never shows `enum` suggestions.")
},
enumMember: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.enumMember', "When set to `false` IntelliSense never shows `enumMember` suggestions.")
},
keyword: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.keyword', "When set to `false` IntelliSense never shows `keyword` suggestions.")
},
text: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.text', "When set to `false` IntelliSense never shows `text` suggestions.")
},
color: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.color', "When set to `false` IntelliSense never shows `color` suggestions.")
},
file: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.file', "When set to `false` IntelliSense never shows `file` suggestions.")
},
reference: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.reference', "When set to `false` IntelliSense never shows `reference` suggestions.")
},
customcolor: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.customcolor', "When set to `false` IntelliSense never shows `customcolor` suggestions.")
},
folder: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.folder', "When set to `false` IntelliSense never shows `folder` suggestions.")
},
typeParameter: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.typeParameter', "When set to `false` IntelliSense never shows `typeParameter` suggestions.")
},
snippet: {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.snippet', "When set to `false` IntelliSense never shows `snippet` suggestions.")
},
}
'editor.suggest.filteredTypes.method': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.method', "When set to `false` IntelliSense never shows `method` suggestions.")
},
'editor.suggest.filteredTypes.function': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.function', "When set to `false` IntelliSense never shows `function` suggestions.")
},
'editor.suggest.filteredTypes.constructor': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.constructor', "When set to `false` IntelliSense never shows `constructor` suggestions.")
},
'editor.suggest.filteredTypes.field': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.field', "When set to `false` IntelliSense never shows `field` suggestions.")
},
'editor.suggest.filteredTypes.variable': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.variable', "When set to `false` IntelliSense never shows `variable` suggestions.")
},
'editor.suggest.filteredTypes.class': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.class', "When set to `false` IntelliSense never shows `class` suggestions.")
},
'editor.suggest.filteredTypes.struct': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.struct', "When set to `false` IntelliSense never shows `struct` suggestions.")
},
'editor.suggest.filteredTypes.interface': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.interface', "When set to `false` IntelliSense never shows `interface` suggestions.")
},
'editor.suggest.filteredTypes.module': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.module', "When set to `false` IntelliSense never shows `module` suggestions.")
},
'editor.suggest.filteredTypes.property': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.property', "When set to `false` IntelliSense never shows `property` suggestions.")
},
'editor.suggest.filteredTypes.event': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.event', "When set to `false` IntelliSense never shows `event` suggestions.")
},
'editor.suggest.filteredTypes.operator': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.operator', "When set to `false` IntelliSense never shows `operator` suggestions.")
},
'editor.suggest.filteredTypes.unit': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.unit', "When set to `false` IntelliSense never shows `unit` suggestions.")
},
'editor.suggest.filteredTypes.value': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.value', "When set to `false` IntelliSense never shows `value` suggestions.")
},
'editor.suggest.filteredTypes.constant': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.constant', "When set to `false` IntelliSense never shows `constant` suggestions.")
},
'editor.suggest.filteredTypes.enum': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.enum', "When set to `false` IntelliSense never shows `enum` suggestions.")
},
'editor.suggest.filteredTypes.enumMember': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.enumMember', "When set to `false` IntelliSense never shows `enumMember` suggestions.")
},
'editor.suggest.filteredTypes.keyword': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.keyword', "When set to `false` IntelliSense never shows `keyword` suggestions.")
},
'editor.suggest.filteredTypes.text': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.text', "When set to `false` IntelliSense never shows `text` suggestions.")
},
'editor.suggest.filteredTypes.color': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.color', "When set to `false` IntelliSense never shows `color` suggestions.")
},
'editor.suggest.filteredTypes.file': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.file', "When set to `false` IntelliSense never shows `file` suggestions.")
},
'editor.suggest.filteredTypes.reference': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.reference', "When set to `false` IntelliSense never shows `reference` suggestions.")
},
'editor.suggest.filteredTypes.customcolor': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.customcolor', "When set to `false` IntelliSense never shows `customcolor` suggestions.")
},
'editor.suggest.filteredTypes.folder': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.folder', "When set to `false` IntelliSense never shows `folder` suggestions.")
},
'editor.suggest.filteredTypes.typeParameter': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.typeParameter', "When set to `false` IntelliSense never shows `typeParameter` suggestions.")
},
'editor.suggest.filteredTypes.snippet': {
type: 'boolean',
default: true,
markdownDescription: nls.localize('suggest.filtered.snippet', "When set to `false` IntelliSense never shows `snippet` suggestions.")
},
}
);
@@ -2452,6 +2521,7 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
}
const input = _input as ISuggestOptions;
return {
overwriteOnAccept: EditorBooleanOption.boolean(input.overwriteOnAccept, this.defaultValue.overwriteOnAccept),
filterGraceful: EditorBooleanOption.boolean(input.filterGraceful, this.defaultValue.filterGraceful),
snippetsPreventQuickSuggestions: EditorBooleanOption.boolean(input.snippetsPreventQuickSuggestions, this.defaultValue.filterGraceful),
localityBonus: EditorBooleanOption.boolean(input.localityBonus, this.defaultValue.localityBonus),
@@ -2917,10 +2987,7 @@ export const EditorOptions = {
{ description: nls.localize('fontFamily', "Controls the font family.") }
)),
fontInfo: register(new EditorFontInfo()),
fontLigatures: register(new EditorBooleanOption(
EditorOption.fontLigatures, 'fontLigatures', false,
{ description: nls.localize('fontLigatures', "Enables/Disables font ligatures.") }
)),
fontLigatures2: register(new EditorFontLigatures()),
fontSize: register(new EditorFontSize()),
fontWeight: register(new EditorStringOption(
EditorOption.fontWeight, 'fontWeight', EDITOR_FONT_DEFAULTS.fontWeight,