Skip to content

Commit 8758dc9

Browse files
committed
Fixes microsoft#91405: Improve minimap settings
1 parent 15bdd26 commit 8758dc9

4 files changed

Lines changed: 23 additions & 23 deletions

File tree

src/vs/editor/browser/viewParts/minimap/minimap.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class MinimapOptions {
4646

4747
public readonly renderMinimap: RenderMinimap;
4848

49-
public readonly mode: 'actual' | 'cover' | 'contain';
49+
public readonly size: 'proportional' | 'fill' | 'fit';
5050

5151
public readonly minimapHeightIsEditorHeight: boolean;
5252

@@ -108,7 +108,7 @@ class MinimapOptions {
108108
const minimapOpts = options.get(EditorOption.minimap);
109109

110110
this.renderMinimap = layoutInfo.renderMinimap | 0;
111-
this.mode = minimapOpts.mode;
111+
this.size = minimapOpts.size;
112112
this.minimapHeightIsEditorHeight = layoutInfo.minimapHeightIsEditorHeight;
113113
this.scrollBeyondLastLine = options.get(EditorOption.scrollBeyondLastLine);
114114
this.showSlider = minimapOpts.showSlider;
@@ -144,7 +144,7 @@ class MinimapOptions {
144144

145145
public equals(other: MinimapOptions): boolean {
146146
return (this.renderMinimap === other.renderMinimap
147-
&& this.mode === other.mode
147+
&& this.size === other.size
148148
&& this.minimapHeightIsEditorHeight === other.minimapHeightIsEditorHeight
149149
&& this.scrollBeyondLastLine === other.scrollBeyondLastLine
150150
&& this.showSlider === other.showSlider

src/vs/editor/common/config/editorOptions.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,7 +1802,7 @@ export class EditorLayoutInfoComputer extends ComputedEditorOption<EditorOption.
18021802
const minimapRenderCharacters = minimap.renderCharacters;
18031803
let minimapScale = (pixelRatio >= 2 ? Math.round(minimap.scale * 2) : minimap.scale);
18041804
const minimapMaxColumn = minimap.maxColumn | 0;
1805-
const minimapMode = minimap.mode;
1805+
const minimapSize = minimap.size;
18061806

18071807
const scrollbar = options.get(EditorOption.scrollbar);
18081808
const verticalScrollbarWidth = scrollbar.verticalScrollbarSize | 0;
@@ -1866,7 +1866,7 @@ export class EditorLayoutInfoComputer extends ComputedEditorOption<EditorOption.
18661866
let minimapCharWidth = minimapScale / pixelRatio;
18671867
let minimapWidthMultiplier: number = 1;
18681868

1869-
if (minimapMode === 'cover' || minimapMode === 'contain') {
1869+
if (minimapSize === 'fill' || minimapSize === 'fit') {
18701870
const viewLineCount = env.viewLineCount;
18711871
const { typicalViewportLineCount, extraLinesBeyondLastLine, desiredRatio, minimapLineCount } = EditorLayoutInfoComputer.computeContainedMinimapLineCount({
18721872
viewLineCount: viewLineCount,
@@ -1887,7 +1887,7 @@ export class EditorLayoutInfoComputer extends ComputedEditorOption<EditorOption.
18871887
minimapCharWidth = minimapScale / pixelRatio;
18881888
} else {
18891889
const effectiveMinimapHeight = Math.ceil((viewLineCount + extraLinesBeyondLastLine) * minimapLineHeight);
1890-
if (minimapMode === 'cover' || effectiveMinimapHeight > minimapCanvasInnerHeight) {
1890+
if (minimapSize === 'fill' || effectiveMinimapHeight > minimapCanvasInnerHeight) {
18911891
minimapHeightIsEditorHeight = true;
18921892
const configuredFontScale = minimapScale;
18931893
minimapLineHeight = Math.min(lineHeight * pixelRatio, Math.max(1, Math.floor(1 / desiredRatio)));
@@ -2074,7 +2074,7 @@ export interface IEditorMinimapOptions {
20742074
* Control the minimap rendering mode.
20752075
* Defaults to 'actual'.
20762076
*/
2077-
mode?: 'actual' | 'cover' | 'contain';
2077+
size?: 'proportional' | 'fill' | 'fit';
20782078
/**
20792079
* Control the rendering of the minimap slider.
20802080
* Defaults to 'mouseover'.
@@ -2103,7 +2103,7 @@ class EditorMinimap extends BaseEditorOption<EditorOption.minimap, EditorMinimap
21032103
constructor() {
21042104
const defaults: EditorMinimapOptions = {
21052105
enabled: true,
2106-
mode: 'actual',
2106+
size: 'proportional',
21072107
side: 'right',
21082108
showSlider: 'mouseover',
21092109
renderCharacters: true,
@@ -2118,16 +2118,16 @@ class EditorMinimap extends BaseEditorOption<EditorOption.minimap, EditorMinimap
21182118
default: defaults.enabled,
21192119
description: nls.localize('minimap.enabled', "Controls whether the minimap is shown.")
21202120
},
2121-
'editor.minimap.mode': {
2121+
'editor.minimap.size': {
21222122
type: 'string',
2123-
enum: ['actual', 'cover', 'contain'],
2123+
enum: ['proportional', 'fill', 'fit'],
21242124
enumDescriptions: [
2125-
nls.localize('minimap.mode.actual', "The minimap will be displayed in its original size, so it might be higher than the editor."),
2126-
nls.localize('minimap.mode.cover', "The minimap will always have the height of the editor and will stretch or shrink as necessary."),
2127-
nls.localize('minimap.mode.contain', "The minimap will shrink as necessary to never be higher than the editor."),
2125+
nls.localize('minimap.size.proportional', "The minimap has the same size as the editor contents (and might scroll)."),
2126+
nls.localize('minimap.size.fill', "The minimap will stretch or shrink as necessary to fill the height of the editor (no scrolling)."),
2127+
nls.localize('minimap.size.fit', "The minimap will shrink as necessary to never be larger than the editor (no scrolling)."),
21282128
],
2129-
default: defaults.mode,
2130-
description: nls.localize('minimap.mode', "Controls the rendering mode of the minimap.")
2129+
default: defaults.size,
2130+
description: nls.localize('minimap.size', "Controls the size of the minimap.")
21312131
},
21322132
'editor.minimap.side': {
21332133
type: 'string',
@@ -2169,7 +2169,7 @@ class EditorMinimap extends BaseEditorOption<EditorOption.minimap, EditorMinimap
21692169
const input = _input as IEditorMinimapOptions;
21702170
return {
21712171
enabled: EditorBooleanOption.boolean(input.enabled, this.defaultValue.enabled),
2172-
mode: EditorStringEnumOption.stringSet<'actual' | 'cover' | 'contain'>(input.mode, this.defaultValue.mode, ['actual', 'cover', 'contain']),
2172+
size: EditorStringEnumOption.stringSet<'proportional' | 'fill' | 'fit'>(input.size, this.defaultValue.size, ['proportional', 'fill', 'fit']),
21732173
side: EditorStringEnumOption.stringSet<'right' | 'left'>(input.side, this.defaultValue.side, ['right', 'left']),
21742174
showSlider: EditorStringEnumOption.stringSet<'always' | 'mouseover'>(input.showSlider, this.defaultValue.showSlider, ['always', 'mouseover']),
21752175
renderCharacters: EditorBooleanOption.boolean(input.renderCharacters, this.defaultValue.renderCharacters),

src/vs/editor/test/common/viewLayout/editorLayoutProvider.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ interface IEditorLayoutProviderOpts {
3333
readonly minimapSide: 'left' | 'right';
3434
readonly minimapRenderCharacters: boolean;
3535
readonly minimapMaxColumn: number;
36-
minimapMode?: 'actual' | 'cover' | 'contain';
36+
minimapSize?: 'proportional' | 'fill' | 'fit';
3737
readonly pixelRatio: number;
3838
}
3939

@@ -47,7 +47,7 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => {
4747
options._write(EditorOption.folding, false);
4848
const minimapOptions: EditorMinimapOptions = {
4949
enabled: input.minimap,
50-
mode: input.minimapMode || 'actual',
50+
size: input.minimapSize || 'proportional',
5151
side: input.minimapSide,
5252
renderCharacters: input.minimapRenderCharacters,
5353
maxColumn: input.minimapMaxColumn,
@@ -978,7 +978,7 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => {
978978
minimapSide: 'right',
979979
minimapRenderCharacters: true,
980980
minimapMaxColumn: 150,
981-
minimapMode: 'cover',
981+
minimapSize: 'fill',
982982
pixelRatio: 2,
983983
}, {
984984
width: 1000,
@@ -1042,7 +1042,7 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => {
10421042
minimapSide: 'right',
10431043
minimapRenderCharacters: true,
10441044
minimapMaxColumn: 150,
1045-
minimapMode: 'cover',
1045+
minimapSize: 'fill',
10461046
pixelRatio: 2,
10471047
}, {
10481048
width: 1000,
@@ -1106,7 +1106,7 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => {
11061106
minimapSide: 'right',
11071107
minimapRenderCharacters: true,
11081108
minimapMaxColumn: 150,
1109-
minimapMode: 'contain',
1109+
minimapSize: 'fit',
11101110
pixelRatio: 2,
11111111
}, {
11121112
width: 1000,
@@ -1170,7 +1170,7 @@ suite('Editor ViewLayout - EditorLayoutProvider', () => {
11701170
minimapSide: 'right',
11711171
minimapRenderCharacters: true,
11721172
minimapMaxColumn: 150,
1173-
minimapMode: 'contain',
1173+
minimapSize: 'fit',
11741174
pixelRatio: 2,
11751175
}, {
11761176
width: 1000,

src/vs/monaco.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3444,7 +3444,7 @@ declare namespace monaco.editor {
34443444
* Control the minimap rendering mode.
34453445
* Defaults to 'actual'.
34463446
*/
3447-
mode?: 'actual' | 'cover' | 'contain';
3447+
size?: 'proportional' | 'fill' | 'fit';
34483448
/**
34493449
* Control the rendering of the minimap slider.
34503450
* Defaults to 'mouseover'.

0 commit comments

Comments
 (0)