Merge from vscode de81ccf04849309f843db21130c806a5783678f7 (#4738)

This commit is contained in:
Anthony Dresser
2019-03-28 13:06:16 -07:00
committed by GitHub
parent cc2951265e
commit e6785ffe95
77 changed files with 562 additions and 835 deletions

View File

@@ -65,6 +65,7 @@ const hasOwnProperty = Object.hasOwnProperty;
export abstract class CommonEditorConfiguration extends Disposable implements editorCommon.IConfiguration {
public readonly isSimpleWidget: boolean;
protected _rawOptions: editorOptions.IEditorOptions;
protected _validatedOptions: editorOptions.IValidatedEditorOptions;
public editor: editorOptions.InternalEditorOptions;
@@ -74,9 +75,11 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
private _onDidChange = this._register(new Emitter<editorOptions.IConfigurationChangedEvent>());
public readonly onDidChange: Event<editorOptions.IConfigurationChangedEvent> = this._onDidChange.event;
constructor(options: editorOptions.IEditorOptions) {
constructor(isSimpleWidget: boolean, options: editorOptions.IEditorOptions) {
super();
this.isSimpleWidget = isSimpleWidget;
// Do a "deep clone of sorts" on the incoming options
this._rawOptions = objects.mixin({}, options || {});
this._rawOptions.scrollbar = objects.mixin({}, this._rawOptions.scrollbar || {});
@@ -122,7 +125,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
private _computeInternalOptions(): editorOptions.InternalEditorOptions {
const opts = this._validatedOptions;
const partialEnv = this._getEnvConfiguration();
const bareFontInfo = BareFontInfo.createFromRawSettings(this._rawOptions, partialEnv.zoomLevel);
const bareFontInfo = BareFontInfo.createFromRawSettings(this._rawOptions, partialEnv.zoomLevel, this.isSimpleWidget);
const env: editorOptions.IEnvironmentalOptions = {
outerWidth: partialEnv.outerWidth,
outerHeight: partialEnv.outerHeight,
@@ -688,8 +691,8 @@ const editorConfiguration: IConfigurationNode = {
type: 'number',
default: EDITOR_DEFAULTS.contribInfo.suggest.maxVisibleSuggestions,
minimum: 1,
maximum: 12,
description: nls.localize('suggest.maxVisibleSuggestions', "Controls how many suggestions IntelliSense will show before showing a scrollbar.")
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',
@@ -828,15 +831,15 @@ const editorConfiguration: IConfigurationNode = {
},
}
},
'editor.gotoLocation.many': {
description: nls.localize('editor.gotoLocation.many', "Controls the behaviour of 'go to'-commands, like go to definition, when multiple target locations exist."),
'editor.gotoLocation.multiple': {
description: nls.localize('editor.gotoLocation.multiple', "Controls the behavior of 'Go To' commands, like Go To Definition, when multiple target locations exist."),
type: 'string',
enum: ['peek', 'revealAndPeek', 'reveal'],
default: 'peek',
enum: ['peek', 'gotoAndPeek', 'goto'],
default: EDITOR_DEFAULTS.contribInfo.gotoLocation.multiple,
enumDescriptions: [
nls.localize('editor.gotoLocation.many.peek', 'Show peek view of the results at the request location'),
nls.localize('editor.gotoLocation.many.revealAndPeek', 'Reveal the first result and show peek view at its location'),
nls.localize('editor.gotoLocation.many.reveal', 'Reveal the first result and ignore others')
nls.localize('editor.gotoLocation.multiple.peek', 'Show peek view of the results (default)'),
nls.localize('editor.gotoLocation.multiple.gotoAndPeek', 'Go to the primary result and show a peek view'),
nls.localize('editor.gotoLocation.multiple.goto', 'Go to the primary result and ignore others')
]
},
'editor.selectionHighlight': {

View File

@@ -222,7 +222,7 @@ export interface IGotoLocationOptions {
/**
* Control how goto-command work when having multiple results.
*/
many?: 'peek' | 'revealAndPeek' | 'reveal';
multiple?: 'peek' | 'gotoAndPeek' | 'goto';
}
/**
@@ -270,7 +270,7 @@ export interface IEditorOptions {
lineNumbers?: 'on' | 'off' | 'relative' | 'interval' | ((lineNumber: number) => string);
/**
* Render last line number when the file ends with a newline.
* Defaults to true on Windows/Mac and to false on Linux.
* Defaults to true.
*/
renderFinalNewline?: boolean;
/**
@@ -936,7 +936,7 @@ export interface InternalEditorHoverOptions {
}
export interface InternalGoToLocationOptions {
readonly many: 'peek' | 'revealAndPeek' | 'reveal';
readonly multiple: 'peek' | 'gotoAndPeek' | 'goto';
}
export interface InternalSuggestOptions {
@@ -1401,7 +1401,8 @@ export class InternalEditorOptions {
&& a.localityBonus === b.localityBonus
&& a.shareSuggestSelections === b.shareSuggestSelections
&& a.showIcons === b.showIcons
&& a.maxVisibleSuggestions === b.maxVisibleSuggestions;
&& a.maxVisibleSuggestions === b.maxVisibleSuggestions
&& objects.equals(a.filteredTypes, b.filteredTypes);
}
}
@@ -1411,7 +1412,7 @@ export class InternalEditorOptions {
} else if (!a || !b) {
return false;
} else {
return a.many === b.many;
return a.multiple === b.multiple;
}
}
@@ -1946,7 +1947,7 @@ export class EditorOptionsValidator {
localityBonus: _boolean(suggestOpts.localityBonus, defaults.localityBonus),
shareSuggestSelections: _boolean(suggestOpts.shareSuggestSelections, defaults.shareSuggestSelections),
showIcons: _boolean(suggestOpts.showIcons, defaults.showIcons),
maxVisibleSuggestions: _clampedInt(suggestOpts.maxVisibleSuggestions, defaults.maxVisibleSuggestions, 1, 12),
maxVisibleSuggestions: _clampedInt(suggestOpts.maxVisibleSuggestions, defaults.maxVisibleSuggestions, 1, 15),
filteredTypes: isObject(suggestOpts.filteredTypes) ? suggestOpts.filteredTypes : Object.create(null)
};
}
@@ -1954,7 +1955,7 @@ export class EditorOptionsValidator {
private static _santizeGotoLocationOpts(opts: IEditorOptions, defaults: InternalGoToLocationOptions): InternalGoToLocationOptions {
const gotoOpts = opts.gotoLocation || {};
return {
many: _stringSet<'peek' | 'revealAndPeek' | 'reveal'>(gotoOpts.many, defaults.many, ['peek', 'revealAndPeek', 'reveal'])
multiple: _stringSet<'peek' | 'gotoAndPeek' | 'goto'>(gotoOpts.multiple, defaults.multiple, ['peek', 'gotoAndPeek', 'goto'])
};
}
@@ -2635,7 +2636,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
ariaLabel: nls.localize('editorViewAccessibleLabel', "Editor content"),
renderLineNumbers: RenderLineNumbersType.On,
renderCustomLineNumbers: null,
renderFinalNewline: (platform.isLinux ? false : true),
renderFinalNewline: true,
selectOnLineNumbers: true,
glyphMargin: true,
revealHorizontalRightPadding: 30,
@@ -2720,7 +2721,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
filteredTypes: Object.create(null)
},
gotoLocation: {
many: 'peek'
multiple: 'peek'
},
selectionHighlight: true,
occurrencesHighlight: true,

View File

@@ -80,7 +80,7 @@ export class BareFontInfo {
fontSize?: number | string;
lineHeight?: number | string;
letterSpacing?: number | string;
}, zoomLevel: number): BareFontInfo {
}, zoomLevel: number, ignoreEditorZoom: boolean = false): BareFontInfo {
let fontFamily = _string(opts.fontFamily, EDITOR_FONT_DEFAULTS.fontFamily);
let fontWeight = _string(opts.fontWeight, EDITOR_FONT_DEFAULTS.fontWeight);
@@ -105,7 +105,7 @@ export class BareFontInfo {
let letterSpacing = safeParseFloat(opts.letterSpacing, 0);
letterSpacing = clamp(letterSpacing, MINIMUM_LETTER_SPACING, MAXIMUM_LETTER_SPACING);
let editorZoomLevelMultiplier = 1 + (EditorZoom.getZoomLevel() * 0.1);
let editorZoomLevelMultiplier = 1 + (ignoreEditorZoom ? 0 : EditorZoom.getZoomLevel() * 0.1);
fontSize *= editorZoomLevelMultiplier;
lineHeight *= editorZoomLevelMultiplier;