提交 bc659cf3 编写于 作者: J Johannes Rieken

move editor.codeInsets setting to its contribution because it isn't a monaco editor thing

上级 d02c8011
...@@ -600,11 +600,6 @@ export interface IEditorOptions { ...@@ -600,11 +600,6 @@ export interface IEditorOptions {
* Defaults to true. * Defaults to true.
*/ */
codeLens?: boolean; codeLens?: boolean;
/**
* Show code insets
* Defaults to true.
*/
codeInsets?: boolean;
/** /**
* Control the behavior and rendering of the code action lightbulb. * Control the behavior and rendering of the code action lightbulb.
*/ */
...@@ -1001,7 +996,6 @@ export interface EditorContribOptions { ...@@ -1001,7 +996,6 @@ export interface EditorContribOptions {
readonly selectionHighlight: boolean; readonly selectionHighlight: boolean;
readonly occurrencesHighlight: boolean; readonly occurrencesHighlight: boolean;
readonly codeLens: boolean; readonly codeLens: boolean;
readonly codeInsets: boolean;
readonly folding: boolean; readonly folding: boolean;
readonly foldingStrategy: 'auto' | 'indentation'; readonly foldingStrategy: 'auto' | 'indentation';
readonly showFoldingControls: 'always' | 'mouseover'; readonly showFoldingControls: 'always' | 'mouseover';
...@@ -2057,7 +2051,6 @@ export class EditorOptionsValidator { ...@@ -2057,7 +2051,6 @@ export class EditorOptionsValidator {
selectionHighlight: _boolean(opts.selectionHighlight, defaults.selectionHighlight), selectionHighlight: _boolean(opts.selectionHighlight, defaults.selectionHighlight),
occurrencesHighlight: _boolean(opts.occurrencesHighlight, defaults.occurrencesHighlight), occurrencesHighlight: _boolean(opts.occurrencesHighlight, defaults.occurrencesHighlight),
codeLens: _boolean(opts.codeLens, defaults.codeLens), codeLens: _boolean(opts.codeLens, defaults.codeLens),
codeInsets: _boolean(opts.codeInsets, defaults.codeInsets),
folding: _boolean(opts.folding, defaults.folding), folding: _boolean(opts.folding, defaults.folding),
foldingStrategy: _stringSet<'auto' | 'indentation'>(opts.foldingStrategy, defaults.foldingStrategy, ['auto', 'indentation']), foldingStrategy: _stringSet<'auto' | 'indentation'>(opts.foldingStrategy, defaults.foldingStrategy, ['auto', 'indentation']),
showFoldingControls: _stringSet<'always' | 'mouseover'>(opts.showFoldingControls, defaults.showFoldingControls, ['always', 'mouseover']), showFoldingControls: _stringSet<'always' | 'mouseover'>(opts.showFoldingControls, defaults.showFoldingControls, ['always', 'mouseover']),
...@@ -2171,7 +2164,6 @@ export class InternalEditorOptionsFactory { ...@@ -2171,7 +2164,6 @@ export class InternalEditorOptionsFactory {
selectionHighlight: (accessibilityIsOn ? false : opts.contribInfo.selectionHighlight), // DISABLED WHEN SCREEN READER IS ATTACHED selectionHighlight: (accessibilityIsOn ? false : opts.contribInfo.selectionHighlight), // DISABLED WHEN SCREEN READER IS ATTACHED
occurrencesHighlight: (accessibilityIsOn ? false : opts.contribInfo.occurrencesHighlight), // DISABLED WHEN SCREEN READER IS ATTACHED occurrencesHighlight: (accessibilityIsOn ? false : opts.contribInfo.occurrencesHighlight), // DISABLED WHEN SCREEN READER IS ATTACHED
codeLens: (accessibilityIsOn ? false : opts.contribInfo.codeLens), // DISABLED WHEN SCREEN READER IS ATTACHED codeLens: (accessibilityIsOn ? false : opts.contribInfo.codeLens), // DISABLED WHEN SCREEN READER IS ATTACHED
codeInsets: (accessibilityIsOn ? false : opts.contribInfo.codeInsets),
folding: (accessibilityIsOn ? false : opts.contribInfo.folding), // DISABLED WHEN SCREEN READER IS ATTACHED folding: (accessibilityIsOn ? false : opts.contribInfo.folding), // DISABLED WHEN SCREEN READER IS ATTACHED
foldingStrategy: opts.contribInfo.foldingStrategy, foldingStrategy: opts.contribInfo.foldingStrategy,
showFoldingControls: opts.contribInfo.showFoldingControls, showFoldingControls: opts.contribInfo.showFoldingControls,
...@@ -2661,7 +2653,6 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = { ...@@ -2661,7 +2653,6 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = {
selectionHighlight: true, selectionHighlight: true,
occurrencesHighlight: true, occurrencesHighlight: true,
codeLens: true, codeLens: true,
codeInsets: true,
folding: true, folding: true,
foldingStrategy: 'auto', foldingStrategy: 'auto',
showFoldingControls: 'mouseover', showFoldingControls: 'mouseover',
......
...@@ -2934,11 +2934,6 @@ declare namespace monaco.editor { ...@@ -2934,11 +2934,6 @@ declare namespace monaco.editor {
* Defaults to true. * Defaults to true.
*/ */
codeLens?: boolean; codeLens?: boolean;
/**
* Show code insets
* Defaults to true.
*/
codeInsets?: boolean;
/** /**
* Control the behavior and rendering of the code action lightbulb. * Control the behavior and rendering of the code action lightbulb.
*/ */
...@@ -3276,7 +3271,6 @@ declare namespace monaco.editor { ...@@ -3276,7 +3271,6 @@ declare namespace monaco.editor {
readonly selectionHighlight: boolean; readonly selectionHighlight: boolean;
readonly occurrencesHighlight: boolean; readonly occurrencesHighlight: boolean;
readonly codeLens: boolean; readonly codeLens: boolean;
readonly codeInsets: boolean;
readonly folding: boolean; readonly folding: boolean;
readonly foldingStrategy: 'auto' | 'indentation'; readonly foldingStrategy: 'auto' | 'indentation';
readonly showFoldingControls: 'always' | 'mouseover'; readonly showFoldingControls: 'always' | 'mouseover';
......
...@@ -21,6 +21,10 @@ import { getCodeInsetData, ICodeInsetData } from './codeinset'; ...@@ -21,6 +21,10 @@ import { getCodeInsetData, ICodeInsetData } from './codeinset';
import { registerEditorContribution } from 'vs/editor/browser/editorExtensions'; import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { MainThreadWebviews } from 'vs/workbench/api/electron-browser/mainThreadWebview'; import { MainThreadWebviews } from 'vs/workbench/api/electron-browser/mainThreadWebview';
import { Registry } from 'vs/platform/registry/common/platform';
import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry';
import { localize } from 'vs/nls.mock';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export class CodeInsetController implements editorCommon.IEditorContribution { export class CodeInsetController implements editorCommon.IEditorContribution {
...@@ -41,9 +45,10 @@ export class CodeInsetController implements editorCommon.IEditorContribution { ...@@ -41,9 +45,10 @@ export class CodeInsetController implements editorCommon.IEditorContribution {
private _editor: editorBrowser.ICodeEditor, private _editor: editorBrowser.ICodeEditor,
@ICommandService private readonly _commandService: ICommandService, @ICommandService private readonly _commandService: ICommandService,
@INotificationService private readonly _notificationService: INotificationService, @INotificationService private readonly _notificationService: INotificationService,
@IExtensionService private readonly _extensionService: IExtensionService @IExtensionService private readonly _extensionService: IExtensionService,
@IConfigurationService private readonly _configService: IConfigurationService,
) { ) {
this._isEnabled = this._editor.getConfiguration().contribInfo.codeInsets; this._isEnabled = this._configService.getValue<boolean>('editor.codeInsets');
this._globalToDispose = []; this._globalToDispose = [];
this._localToDispose = []; this._localToDispose = [];
...@@ -53,12 +58,14 @@ export class CodeInsetController implements editorCommon.IEditorContribution { ...@@ -53,12 +58,14 @@ export class CodeInsetController implements editorCommon.IEditorContribution {
this._globalToDispose.push(this._editor.onDidChangeModel(() => this._onModelChange())); this._globalToDispose.push(this._editor.onDidChangeModel(() => this._onModelChange()));
this._globalToDispose.push(this._editor.onDidChangeModelLanguage(() => this._onModelChange())); this._globalToDispose.push(this._editor.onDidChangeModelLanguage(() => this._onModelChange()));
this._globalToDispose.push(this._editor.onDidChangeConfiguration(() => { this._globalToDispose.push(this._configService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('editor.codeInsets')) {
let prevIsEnabled = this._isEnabled; let prevIsEnabled = this._isEnabled;
this._isEnabled = this._editor.getConfiguration().contribInfo.codeInsets; this._isEnabled = this._configService.getValue<boolean>('editor.codeInsets');
if (prevIsEnabled !== this._isEnabled) { if (prevIsEnabled !== this._isEnabled) {
this._onModelChange(); this._onModelChange();
} }
}
})); }));
this._globalToDispose.push(CodeInsetProviderRegistry.onDidChange(this._onModelChange, this)); this._globalToDispose.push(CodeInsetProviderRegistry.onDidChange(this._onModelChange, this));
this._onModelChange(); this._onModelChange();
...@@ -333,3 +340,15 @@ export class CodeInsetController implements editorCommon.IEditorContribution { ...@@ -333,3 +340,15 @@ export class CodeInsetController implements editorCommon.IEditorContribution {
} }
registerEditorContribution(CodeInsetController); registerEditorContribution(CodeInsetController);
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).registerConfiguration({
id: 'editor',
properties: {
['editor.codeInsets']: {
description: localize('editor.codeInsets', "Enable/disable editor code insets"),
type: 'boolean',
default: false
}
}
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册