Skip to content

Commit

Permalink
Name polish for editor.showFoldingControls (#4812)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschli committed May 18, 2017
1 parent e637dd3 commit 3d1a0cc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
9 changes: 5 additions & 4 deletions src/vs/editor/common/config/commonEditorConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,11 @@ const editorConfiguration: IConfigurationNode = {
'default': EDITOR_DEFAULTS.contribInfo.folding,
'description': nls.localize('folding', "Controls whether the editor has code folding enabled")
},
'editor.hideFoldIcons': {
'type': 'boolean',
'default': EDITOR_DEFAULTS.contribInfo.hideFoldIcons,
'description': nls.localize('hideFoldIcons', "Controls whether the fold icons on the gutter are automatically hidden.")
'editor.showFoldingControls': {
'type': 'string',
'enum': ['always', 'mouseover'],
'default': EDITOR_DEFAULTS.contribInfo.showFoldingControls,
'description': nls.localize('showFoldingControls', "Controls whether the fold controls on the gutter are automatically hidden.")
},
'editor.matchBrackets': {
'type': 'boolean',
Expand Down
14 changes: 7 additions & 7 deletions src/vs/editor/common/config/editorOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,10 @@ export interface IEditorOptions {
*/
folding?: boolean;
/**
* Enable automatic hiding of non-collapsed fold icons in the gutter.
* Defaults to true.
* Controls whether the fold actions in the gutter stay always visible or hide unless the mouse is over the gutter.
* Defaults to 'mouseover'.
*/
hideFoldIcons?: boolean;
showFoldingControls?: 'always' | 'mouseover';
/**
* Enable highlighting of matching brackets.
* Defaults to true.
Expand Down Expand Up @@ -736,7 +736,7 @@ export interface EditorContribOptions {
readonly occurrencesHighlight: boolean;
readonly codeLens: boolean;
readonly folding: boolean;
readonly hideFoldIcons: boolean;
readonly showFoldingControls: 'always' | 'mouseover';
readonly matchBrackets: boolean;
}

Expand Down Expand Up @@ -1045,7 +1045,7 @@ export class InternalEditorOptions {
&& a.occurrencesHighlight === b.occurrencesHighlight
&& a.codeLens === b.codeLens
&& a.folding === b.folding
&& a.hideFoldIcons === b.hideFoldIcons
&& a.showFoldingControls === b.showFoldingControls
&& a.matchBrackets === b.matchBrackets
);
}
Expand Down Expand Up @@ -1542,7 +1542,7 @@ export class EditorOptionsValidator {
occurrencesHighlight: _boolean(opts.occurrencesHighlight, defaults.occurrencesHighlight),
codeLens: _boolean(opts.codeLens, defaults.codeLens) && _boolean(opts.referenceInfos, true),
folding: _boolean(opts.folding, defaults.folding),
hideFoldIcons: _boolean(opts.hideFoldIcons, defaults.hideFoldIcons),
showFoldingControls: _stringSet<'always' | 'mouseover'>(opts.showFoldingControls, defaults.showFoldingControls, ['always', 'mouseover']),
matchBrackets: _boolean(opts.matchBrackets, defaults.matchBrackets),
};
}
Expand Down Expand Up @@ -1949,7 +1949,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
occurrencesHighlight: true,
codeLens: true,
folding: true,
hideFoldIcons: true,
showFoldingControls: 'mouseover',
matchBrackets: true,
},
};
12 changes: 6 additions & 6 deletions src/vs/editor/contrib/folding/browser/folding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class FoldingController implements IFoldingController {

private editor: ICodeEditor;
private _isEnabled: boolean;
private _hideFoldIcons: boolean;
private _showFoldingControls: 'always' | 'mouseover';
private globalToDispose: IDisposable[];

private computeToken: number;
Expand All @@ -49,7 +49,7 @@ export class FoldingController implements IFoldingController {
constructor(editor: ICodeEditor) {
this.editor = editor;
this._isEnabled = this.editor.getConfiguration().contribInfo.folding;
this._hideFoldIcons = this.editor.getConfiguration().contribInfo.hideFoldIcons;
this._showFoldingControls = this.editor.getConfiguration().contribInfo.showFoldingControls;

this.globalToDispose = [];
this.localToDispose = [];
Expand All @@ -63,9 +63,9 @@ export class FoldingController implements IFoldingController {
if (oldIsEnabled !== this._isEnabled) {
this.onModelChanged();
}
let oldHideFoldIcons = this._hideFoldIcons;
this._hideFoldIcons = this.editor.getConfiguration().contribInfo.hideFoldIcons;
if (oldHideFoldIcons !== this._hideFoldIcons) {
let oldShowFoldingControls = this._showFoldingControls;
this._showFoldingControls = this.editor.getConfiguration().contribInfo.showFoldingControls;
if (oldShowFoldingControls !== this._showFoldingControls) {
this.updateHideFoldIconClass();
}
}));
Expand All @@ -85,7 +85,7 @@ export class FoldingController implements IFoldingController {
private updateHideFoldIconClass(): void {
let domNode = this.editor.getDomNode();
if (domNode) {
dom.toggleClass(domNode, 'alwaysShowFoldIcons', this._hideFoldIcons === false);
dom.toggleClass(domNode, 'alwaysShowFoldIcons', this._showFoldingControls === 'always');
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/vs/monaco.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2978,10 +2978,10 @@ declare module monaco.editor {
*/
folding?: boolean;
/**
* Enable automatic hiding of non-collapsed fold icons in the gutter.
* Defaults to true.
* Controls whether the fold actions in the gutter stay always visible or hide unless the mouse is over the gutter.
* Defaults to 'mouseover'.
*/
hideFoldIcons?: boolean;
showFoldingControls?: 'always' | 'mouseover';
/**
* Enable highlighting of matching brackets.
* Defaults to true.
Expand Down Expand Up @@ -3239,7 +3239,7 @@ declare module monaco.editor {
readonly occurrencesHighlight: boolean;
readonly codeLens: boolean;
readonly folding: boolean;
readonly hideFoldIcons: boolean;
readonly showFoldingControls: 'always' | 'mouseover';
readonly matchBrackets: boolean;
}

Expand Down

0 comments on commit 3d1a0cc

Please sign in to comment.