Skip to content

EditContext: migrate to non-experimental setting name #251211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/vs/editor/browser/config/migrateOptions.ts
Original file line number Diff line number Diff line change
@@ -196,6 +196,17 @@ registerEditorSettingMigration('experimental.stickyScroll.maxLineCount', (value,
}
});

// Edit Context

registerEditorSettingMigration('editor.experimentalEditContextEnabled', (value, read, write) => {
if (typeof value === 'boolean') {
write('editor.experimentalEditContextEnabled', undefined);
if (typeof read('editor.editContext') === 'undefined') {
write('editor.editContext', value);
}
}
});

// Code Actions on Save
registerEditorSettingMigration('codeActionsOnSave', (value, read, write) => {
if (value && typeof value === 'object') {
12 changes: 6 additions & 6 deletions src/vs/editor/browser/view.ts
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@ export class View extends ViewEventHandler {
private readonly _viewParts: ViewPart[];
private readonly _viewController: ViewController;

private _experimentalEditContextEnabled: boolean;
private _editContextEnabled: boolean;
private _accessibilitySupport: AccessibilitySupport;
private _editContext: AbstractEditContext;
private readonly _pointerHandler: PointerHandler;
@@ -157,7 +157,7 @@ export class View extends ViewEventHandler {
this._viewParts = [];

// Keyboard handler
this._experimentalEditContextEnabled = this._context.configuration.options.get(EditorOption.effectiveExperimentalEditContextEnabled);
this._editContextEnabled = this._context.configuration.options.get(EditorOption.effectiveEditContext);
this._accessibilitySupport = this._context.configuration.options.get(EditorOption.accessibilitySupport);
this._editContext = this._instantiateEditContext();

@@ -289,7 +289,7 @@ export class View extends ViewEventHandler {
}

private _instantiateEditContext(): AbstractEditContext {
const usingExperimentalEditContext = this._context.configuration.options.get(EditorOption.effectiveExperimentalEditContextEnabled);
const usingExperimentalEditContext = this._context.configuration.options.get(EditorOption.effectiveEditContext);
if (usingExperimentalEditContext) {
return this._instantiationService.createInstance(NativeEditContext, this._ownerID, this._context, this._overflowGuardContainer, this._viewController, this._createTextAreaHandlerHelper());
} else {
@@ -298,12 +298,12 @@ export class View extends ViewEventHandler {
}

private _updateEditContext(): void {
const experimentalEditContextEnabled = this._context.configuration.options.get(EditorOption.effectiveExperimentalEditContextEnabled);
const editContextEnabled = this._context.configuration.options.get(EditorOption.effectiveEditContext);
const accessibilitySupport = this._context.configuration.options.get(EditorOption.accessibilitySupport);
if (this._experimentalEditContextEnabled === experimentalEditContextEnabled && this._accessibilitySupport === accessibilitySupport) {
if (this._editContextEnabled === editContextEnabled && this._accessibilitySupport === accessibilitySupport) {
return;
}
this._experimentalEditContextEnabled = experimentalEditContextEnabled;
this._editContextEnabled = editContextEnabled;
this._accessibilitySupport = accessibilitySupport;
const isEditContextFocused = this._editContext.isFocused();
const indexOfEditContext = this._viewParts.indexOf(this._editContext);
8 changes: 4 additions & 4 deletions src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ export class ViewCursors extends ViewPart {
private _cursorBlinking: TextEditorCursorBlinkingStyle;
private _cursorStyle: TextEditorCursorStyle;
private _cursorSmoothCaretAnimation: 'off' | 'explicit' | 'on';
private _experimentalEditContextEnabled: boolean;
private _editContextEnabled: boolean;
private _selectionIsEmpty: boolean;
private _isComposingInput: boolean;

@@ -61,7 +61,7 @@ export class ViewCursors extends ViewPart {
this._cursorBlinking = options.get(EditorOption.cursorBlinking);
this._cursorStyle = options.get(EditorOption.effectiveCursorStyle);
this._cursorSmoothCaretAnimation = options.get(EditorOption.cursorSmoothCaretAnimation);
this._experimentalEditContextEnabled = options.get(EditorOption.effectiveExperimentalEditContextEnabled);
this._editContextEnabled = options.get(EditorOption.effectiveEditContext);
this._selectionIsEmpty = true;
this._isComposingInput = false;

@@ -116,7 +116,7 @@ export class ViewCursors extends ViewPart {
this._cursorBlinking = options.get(EditorOption.cursorBlinking);
this._cursorStyle = options.get(EditorOption.effectiveCursorStyle);
this._cursorSmoothCaretAnimation = options.get(EditorOption.cursorSmoothCaretAnimation);
this._experimentalEditContextEnabled = options.get(EditorOption.effectiveExperimentalEditContextEnabled);
this._editContextEnabled = options.get(EditorOption.effectiveEditContext);

this._updateBlinking();
this._updateDomClassName();
@@ -226,7 +226,7 @@ export class ViewCursors extends ViewPart {

private _getCursorBlinking(): TextEditorCursorBlinkingStyle {
// TODO: Remove the following if statement when experimental edit context is made default sole implementation
if (this._isComposingInput && !this._experimentalEditContextEnabled) {
if (this._isComposingInput && !this._editContextEnabled) {
// avoid double cursors
return TextEditorCursorBlinkingStyle.Hidden;
}
20 changes: 10 additions & 10 deletions src/vs/editor/common/config/editorOptions.ts
Original file line number Diff line number Diff line change
@@ -778,7 +778,7 @@ export interface IEditorOptions {
/**
* Sets whether the new experimental edit context should be used instead of the text area.
*/
experimentalEditContextEnabled?: boolean;
editContext?: boolean;

/**
* Controls support for changing how content is pasted into the editor.
@@ -1966,14 +1966,14 @@ class EffectiveCursorStyle extends ComputedEditorOption<EditorOption.effectiveCu

//#region effectiveExperimentalEditContext

class EffectiveExperimentalEditContextEnabled extends ComputedEditorOption<EditorOption.effectiveExperimentalEditContextEnabled, boolean> {
class EffectiveEditContextEnabled extends ComputedEditorOption<EditorOption.effectiveEditContext, boolean> {

constructor() {
super(EditorOption.effectiveExperimentalEditContextEnabled);
super(EditorOption.effectiveEditContext);
}

public compute(env: IEnvironmentalOptions, options: IComputedEditorOptions): boolean {
return env.editContextSupported && options.get(EditorOption.experimentalEditContextEnabled);
return env.editContextSupported && options.get(EditorOption.editContext);
}
}

@@ -5537,7 +5537,7 @@ export const enum EditorOption {
domReadOnly,
dragAndDrop,
dropIntoEditor,
experimentalEditContextEnabled,
editContext,
emptySelectionClipboard,
experimentalGpuAcceleration,
experimentalWhitespaceRendering,
@@ -5657,7 +5657,7 @@ export const enum EditorOption {
defaultColorDecorators,
colorDecoratorsActivatedOn,
inlineCompletionsAccessibilityVerbose,
effectiveExperimentalEditContextEnabled
effectiveEditContext
}

export const EditorOptions = {
@@ -5931,10 +5931,10 @@ export const EditorOptions = {
)),
emptySelectionClipboard: register(new EditorEmptySelectionClipboard()),
dropIntoEditor: register(new EditorDropIntoEditor()),
experimentalEditContextEnabled: register(new EditorBooleanOption(
EditorOption.experimentalEditContextEnabled, 'experimentalEditContextEnabled', true,
editContext: register(new EditorBooleanOption(
EditorOption.editContext, 'editContext', true,
{
description: nls.localize('experimentalEditContextEnabled', "Sets whether the new experimental edit context should be used instead of the text area."),
description: nls.localize('editContext', "Sets whether the EditContext API should be used instead of the text area to power input in the editor."),
included: platform.isChrome || platform.isEdge || platform.isNative
}
)),
@@ -6498,7 +6498,7 @@ export const EditorOptions = {
wrappingInfo: register(new EditorWrappingInfoComputer()),
wrappingIndent: register(new WrappingIndentOption()),
wrappingStrategy: register(new WrappingStrategy()),
effectiveExperimentalEditContextEnabled: register(new EffectiveExperimentalEditContextEnabled())
effectiveEditContextEnabled: register(new EffectiveEditContextEnabled())
};

type EditorOptionsType = typeof EditorOptions;
4 changes: 2 additions & 2 deletions src/vs/editor/common/standalone/standaloneEnums.ts
Original file line number Diff line number Diff line change
@@ -214,7 +214,7 @@ export enum EditorOption {
domReadOnly = 37,
dragAndDrop = 38,
dropIntoEditor = 39,
experimentalEditContextEnabled = 40,
editContext = 40,
emptySelectionClipboard = 41,
experimentalGpuAcceleration = 42,
experimentalWhitespaceRendering = 43,
@@ -333,7 +333,7 @@ export enum EditorOption {
defaultColorDecorators = 156,
colorDecoratorsActivatedOn = 157,
inlineCompletionsAccessibilityVerbose = 158,
effectiveExperimentalEditContextEnabled = 159
effectiveEditContext = 159
}

/**
6 changes: 3 additions & 3 deletions src/vs/editor/contrib/clipboard/browser/clipboard.ts
Original file line number Diff line number Diff line change
@@ -205,7 +205,7 @@ function registerExecCommandImpl(target: MultiCommand | undefined, browserComman
return true;
}
// TODO this is very ugly. The entire copy/paste/cut system needs a complete refactoring.
if (focusedEditor.getOption(EditorOption.effectiveExperimentalEditContextEnabled) && browserCommand === 'cut') {
if (focusedEditor.getOption(EditorOption.effectiveEditContext) && browserCommand === 'cut') {
// execCommand(copy) works for edit context, but not execCommand(cut).
focusedEditor.getContainerDomNode().ownerDocument.execCommand('copy');
focusedEditor.trigger(undefined, Handler.Cut, undefined);
@@ -239,8 +239,8 @@ if (PasteAction) {
const focusedEditor = codeEditorService.getFocusedCodeEditor();
if (focusedEditor && focusedEditor.hasModel() && focusedEditor.hasTextFocus()) {
// execCommand(paste) does not work with edit context
const experimentalEditContextEnabled = focusedEditor.getOption(EditorOption.effectiveExperimentalEditContextEnabled);
if (experimentalEditContextEnabled) {
const editContextEnabled = focusedEditor.getOption(EditorOption.effectiveEditContext);
if (editContextEnabled) {
const nativeEditContext = NativeEditContextRegistry.get(focusedEditor.getId());
if (nativeEditContext) {
nativeEditContext.onWillPaste();
10 changes: 5 additions & 5 deletions src/vs/monaco.d.ts
Original file line number Diff line number Diff line change
@@ -3833,7 +3833,7 @@ declare namespace monaco.editor {
/**
* Sets whether the new experimental edit context should be used instead of the text area.
*/
experimentalEditContextEnabled?: boolean;
editContext?: boolean;
/**
* Controls support for changing how content is pasted into the editor.
*/
@@ -4959,7 +4959,7 @@ declare namespace monaco.editor {
domReadOnly = 37,
dragAndDrop = 38,
dropIntoEditor = 39,
experimentalEditContextEnabled = 40,
editContext = 40,
emptySelectionClipboard = 41,
experimentalGpuAcceleration = 42,
experimentalWhitespaceRendering = 43,
@@ -5078,7 +5078,7 @@ declare namespace monaco.editor {
defaultColorDecorators = 156,
colorDecoratorsActivatedOn = 157,
inlineCompletionsAccessibilityVerbose = 158,
effectiveExperimentalEditContextEnabled = 159
effectiveEditContext = 159
}

export const EditorOptions: {
@@ -5126,7 +5126,7 @@ declare namespace monaco.editor {
dragAndDrop: IEditorOption<EditorOption.dragAndDrop, boolean>;
emptySelectionClipboard: IEditorOption<EditorOption.emptySelectionClipboard, boolean>;
dropIntoEditor: IEditorOption<EditorOption.dropIntoEditor, Readonly<Required<IDropIntoEditorOptions>>>;
experimentalEditContextEnabled: IEditorOption<EditorOption.experimentalEditContextEnabled, boolean>;
editContext: IEditorOption<EditorOption.editContext, boolean>;
stickyScroll: IEditorOption<EditorOption.stickyScroll, Readonly<Required<IEditorStickyScrollOptions>>>;
experimentalGpuAcceleration: IEditorOption<EditorOption.experimentalGpuAcceleration, 'on' | 'off'>;
experimentalWhitespaceRendering: IEditorOption<EditorOption.experimentalWhitespaceRendering, 'off' | 'svg' | 'font'>;
@@ -5241,7 +5241,7 @@ declare namespace monaco.editor {
wrappingInfo: IEditorOption<EditorOption.wrappingInfo, EditorWrappingInfo>;
wrappingIndent: IEditorOption<EditorOption.wrappingIndent, WrappingIndent>;
wrappingStrategy: IEditorOption<EditorOption.wrappingStrategy, 'simple' | 'advanced'>;
effectiveExperimentalEditContextEnabled: IEditorOption<EditorOption.effectiveExperimentalEditContextEnabled, boolean>;
effectiveEditContextEnabled: IEditorOption<EditorOption.effectiveEditContext, boolean>;
};

type EditorOptionsType = typeof EditorOptions;
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ export function getSimpleEditorOptions(configurationService: IConfigurationServi
},
accessibilitySupport: configurationService.getValue<'auto' | 'off' | 'on'>('editor.accessibilitySupport'),
cursorBlinking: configurationService.getValue<'blink' | 'smooth' | 'phase' | 'expand' | 'solid'>('editor.cursorBlinking'),
experimentalEditContextEnabled: configurationService.getValue<boolean>('editor.experimentalEditContextEnabled'),
editContext: configurationService.getValue<boolean>('editor.editContext'),
defaultColorDecorators: 'never',
};
}
Loading
Oops, something went wrong.