Skip to content

Commit bc659cf

Browse files
committed
move editor.codeInsets setting to its contribution because it isn't a monaco editor thing
1 parent d02c801 commit bc659cf

3 files changed

Lines changed: 26 additions & 22 deletions

File tree

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -600,11 +600,6 @@ export interface IEditorOptions {
600600
* Defaults to true.
601601
*/
602602
codeLens?: boolean;
603-
/**
604-
* Show code insets
605-
* Defaults to true.
606-
*/
607-
codeInsets?: boolean;
608603
/**
609604
* Control the behavior and rendering of the code action lightbulb.
610605
*/
@@ -1001,7 +996,6 @@ export interface EditorContribOptions {
1001996
readonly selectionHighlight: boolean;
1002997
readonly occurrencesHighlight: boolean;
1003998
readonly codeLens: boolean;
1004-
readonly codeInsets: boolean;
1005999
readonly folding: boolean;
10061000
readonly foldingStrategy: 'auto' | 'indentation';
10071001
readonly showFoldingControls: 'always' | 'mouseover';
@@ -2057,7 +2051,6 @@ export class EditorOptionsValidator {
20572051
selectionHighlight: _boolean(opts.selectionHighlight, defaults.selectionHighlight),
20582052
occurrencesHighlight: _boolean(opts.occurrencesHighlight, defaults.occurrencesHighlight),
20592053
codeLens: _boolean(opts.codeLens, defaults.codeLens),
2060-
codeInsets: _boolean(opts.codeInsets, defaults.codeInsets),
20612054
folding: _boolean(opts.folding, defaults.folding),
20622055
foldingStrategy: _stringSet<'auto' | 'indentation'>(opts.foldingStrategy, defaults.foldingStrategy, ['auto', 'indentation']),
20632056
showFoldingControls: _stringSet<'always' | 'mouseover'>(opts.showFoldingControls, defaults.showFoldingControls, ['always', 'mouseover']),
@@ -2171,7 +2164,6 @@ export class InternalEditorOptionsFactory {
21712164
selectionHighlight: (accessibilityIsOn ? false : opts.contribInfo.selectionHighlight), // DISABLED WHEN SCREEN READER IS ATTACHED
21722165
occurrencesHighlight: (accessibilityIsOn ? false : opts.contribInfo.occurrencesHighlight), // DISABLED WHEN SCREEN READER IS ATTACHED
21732166
codeLens: (accessibilityIsOn ? false : opts.contribInfo.codeLens), // DISABLED WHEN SCREEN READER IS ATTACHED
2174-
codeInsets: (accessibilityIsOn ? false : opts.contribInfo.codeInsets),
21752167
folding: (accessibilityIsOn ? false : opts.contribInfo.folding), // DISABLED WHEN SCREEN READER IS ATTACHED
21762168
foldingStrategy: opts.contribInfo.foldingStrategy,
21772169
showFoldingControls: opts.contribInfo.showFoldingControls,
@@ -2661,7 +2653,6 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
26612653
selectionHighlight: true,
26622654
occurrencesHighlight: true,
26632655
codeLens: true,
2664-
codeInsets: true,
26652656
folding: true,
26662657
foldingStrategy: 'auto',
26672658
showFoldingControls: 'mouseover',

src/vs/monaco.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2934,11 +2934,6 @@ declare namespace monaco.editor {
29342934
* Defaults to true.
29352935
*/
29362936
codeLens?: boolean;
2937-
/**
2938-
* Show code insets
2939-
* Defaults to true.
2940-
*/
2941-
codeInsets?: boolean;
29422937
/**
29432938
* Control the behavior and rendering of the code action lightbulb.
29442939
*/
@@ -3276,7 +3271,6 @@ declare namespace monaco.editor {
32763271
readonly selectionHighlight: boolean;
32773272
readonly occurrencesHighlight: boolean;
32783273
readonly codeLens: boolean;
3279-
readonly codeInsets: boolean;
32803274
readonly folding: boolean;
32813275
readonly foldingStrategy: 'auto' | 'indentation';
32823276
readonly showFoldingControls: 'always' | 'mouseover';

src/vs/workbench/parts/codeinset/codeInset.contribution.ts

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ import { getCodeInsetData, ICodeInsetData } from './codeinset';
2121
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
2222
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
2323
import { MainThreadWebviews } from 'vs/workbench/api/electron-browser/mainThreadWebview';
24+
import { Registry } from 'vs/platform/registry/common/platform';
25+
import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry';
26+
import { localize } from 'vs/nls.mock';
27+
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
2428

2529
export class CodeInsetController implements editorCommon.IEditorContribution {
2630

@@ -41,9 +45,10 @@ export class CodeInsetController implements editorCommon.IEditorContribution {
4145
private _editor: editorBrowser.ICodeEditor,
4246
@ICommandService private readonly _commandService: ICommandService,
4347
@INotificationService private readonly _notificationService: INotificationService,
44-
@IExtensionService private readonly _extensionService: IExtensionService
48+
@IExtensionService private readonly _extensionService: IExtensionService,
49+
@IConfigurationService private readonly _configService: IConfigurationService,
4550
) {
46-
this._isEnabled = this._editor.getConfiguration().contribInfo.codeInsets;
51+
this._isEnabled = this._configService.getValue<boolean>('editor.codeInsets');
4752

4853
this._globalToDispose = [];
4954
this._localToDispose = [];
@@ -53,11 +58,13 @@ export class CodeInsetController implements editorCommon.IEditorContribution {
5358

5459
this._globalToDispose.push(this._editor.onDidChangeModel(() => this._onModelChange()));
5560
this._globalToDispose.push(this._editor.onDidChangeModelLanguage(() => this._onModelChange()));
56-
this._globalToDispose.push(this._editor.onDidChangeConfiguration(() => {
57-
let prevIsEnabled = this._isEnabled;
58-
this._isEnabled = this._editor.getConfiguration().contribInfo.codeInsets;
59-
if (prevIsEnabled !== this._isEnabled) {
60-
this._onModelChange();
61+
this._globalToDispose.push(this._configService.onDidChangeConfiguration(e => {
62+
if (e.affectsConfiguration('editor.codeInsets')) {
63+
let prevIsEnabled = this._isEnabled;
64+
this._isEnabled = this._configService.getValue<boolean>('editor.codeInsets');
65+
if (prevIsEnabled !== this._isEnabled) {
66+
this._onModelChange();
67+
}
6168
}
6269
}));
6370
this._globalToDispose.push(CodeInsetProviderRegistry.onDidChange(this._onModelChange, this));
@@ -333,3 +340,15 @@ export class CodeInsetController implements editorCommon.IEditorContribution {
333340
}
334341

335342
registerEditorContribution(CodeInsetController);
343+
344+
345+
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).registerConfiguration({
346+
id: 'editor',
347+
properties: {
348+
['editor.codeInsets']: {
349+
description: localize('editor.codeInsets', "Enable/disable editor code insets"),
350+
type: 'boolean',
351+
default: false
352+
}
353+
}
354+
});

0 commit comments

Comments
 (0)