
import { alert } from '../../../../base/browser/ui/aria/aria.js';
import { KeyMod as KeyMod$1, KeyCode } from '../../../../base/common/keyCodes.js';
import { TabFocus } from '../../../browser/config/tabFocus.js';
import { localize2, localize } from '../../../../nls.js';
import { Action2, registerAction2 } from '../../../../platform/actions/common/actions.js';
import { KeybindingWeight } from '../../../../platform/keybinding/common/keybindingsRegistry.js';

class ToggleTabFocusModeAction extends Action2 {
    static { this.ID = 'editor.action.toggleTabFocusMode'; }
    constructor() {
        super({
            id: ToggleTabFocusModeAction.ID,
            title: ( localize2(1575, 'Toggle Tab Key Moves Focus')),
            precondition: undefined,
            keybinding: {
                primary: KeyMod$1.CtrlCmd | KeyCode.KeyM,
                mac: { primary: KeyMod$1.WinCtrl | KeyMod$1.Shift | KeyCode.KeyM },
                weight: KeybindingWeight.EditorContrib
            },
            metadata: {
                description: ( localize2(
                    1576,
                    "Determines whether the tab key moves focus around the workbench or inserts the tab character in the current editor. This is also called tab trapping, tab navigation, or tab focus mode."
                )),
            },
            f1: true
        });
    }
    run() {
        const oldValue = TabFocus.getTabFocusMode();
        const newValue = !oldValue;
        TabFocus.setTabFocusMode(newValue);
        if (newValue) {
            alert(( localize(1577, "Pressing Tab will now move focus to the next focusable element")));
        }
        else {
            alert(( localize(1578, "Pressing Tab will now insert the tab character")));
        }
    }
}
registerAction2(ToggleTabFocusModeAction);

export { ToggleTabFocusModeAction };
