import { EditorAction2 } from '../../../browser/editorExtensions.js';
import { localize2WithPath, localizeWithPath } from '../../../../nls.js';
import { Categories } from '../../../../platform/action/common/actionCommonCategories.js';
import { Action2, MenuId } from '../../../../platform/actions/common/actions.js';
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.service.js';
import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
import { EditorContextKeys } from '../../../common/editorContextKeys.js';
import { StickyScrollController } from './stickyScrollController.js';
const _moduleId = "vs/editor/contrib/stickyScroll/browser/stickyScrollActions";
class ToggleStickyScroll extends Action2 {
    constructor() {
        super({
            id: 'editor.action.toggleStickyScroll',
            title: {
                ...( localize2WithPath(_moduleId, 0, "Toggle Editor Sticky Scroll")),
                mnemonicTitle: ( localizeWithPath(_moduleId, 1, "&&Toggle Editor Sticky Scroll")),
            },
            category: Categories.View,
            toggled: {
                condition: ( (ContextKeyExpr.equals('config.editor.stickyScroll.enabled', true))),
                title: ( localizeWithPath(_moduleId, 2, "Sticky Scroll")),
                mnemonicTitle: ( localizeWithPath(_moduleId, 3, "&&Sticky Scroll")),
            },
            menu: [
                { id: MenuId.CommandPalette },
                { id: MenuId.MenubarAppearanceMenu, group: '4_editor', order: 3 },
                { id: MenuId.StickyScrollContext }
            ]
        });
    }
    async run(accessor) {
        const configurationService = accessor.get(IConfigurationService);
        const newValue = !configurationService.getValue('editor.stickyScroll.enabled');
        return configurationService.updateValue('editor.stickyScroll.enabled', newValue);
    }
}
const weight = 100 ;
class FocusStickyScroll extends EditorAction2 {
    constructor() {
        super({
            id: 'editor.action.focusStickyScroll',
            title: {
                ...( localize2WithPath(_moduleId, 4, "Focus Sticky Scroll")),
                mnemonicTitle: ( localizeWithPath(_moduleId, 5, "&&Focus Sticky Scroll")),
            },
            precondition: ( (ContextKeyExpr.and(
                 (ContextKeyExpr.has('config.editor.stickyScroll.enabled')),
                EditorContextKeys.stickyScrollVisible
            ))),
            menu: [
                { id: MenuId.CommandPalette },
            ]
        });
    }
    runEditorCommand(_accessor, editor) {
        StickyScrollController.get(editor)?.focus();
    }
}
class SelectNextStickyScrollLine extends EditorAction2 {
    constructor() {
        super({
            id: 'editor.action.selectNextStickyScrollLine',
            title: ( localize2WithPath(_moduleId, 6, "Select next sticky scroll line")),
            precondition: ( (EditorContextKeys.stickyScrollFocused.isEqualTo(true))),
            keybinding: {
                weight,
                primary: 18
            }
        });
    }
    runEditorCommand(_accessor, editor) {
        StickyScrollController.get(editor)?.focusNext();
    }
}
class SelectPreviousStickyScrollLine extends EditorAction2 {
    constructor() {
        super({
            id: 'editor.action.selectPreviousStickyScrollLine',
            title: ( localize2WithPath(_moduleId, 7, "Select previous sticky scroll line")),
            precondition: ( (EditorContextKeys.stickyScrollFocused.isEqualTo(true))),
            keybinding: {
                weight,
                primary: 16
            }
        });
    }
    runEditorCommand(_accessor, editor) {
        StickyScrollController.get(editor)?.focusPrevious();
    }
}
class GoToStickyScrollLine extends EditorAction2 {
    constructor() {
        super({
            id: 'editor.action.goToFocusedStickyScrollLine',
            title: ( localize2WithPath(_moduleId, 8, "Go to focused sticky scroll line")),
            precondition: ( (EditorContextKeys.stickyScrollFocused.isEqualTo(true))),
            keybinding: {
                weight,
                primary: 3
            }
        });
    }
    runEditorCommand(_accessor, editor) {
        StickyScrollController.get(editor)?.goToFocused();
    }
}
class SelectEditor extends EditorAction2 {
    constructor() {
        super({
            id: 'editor.action.selectEditor',
            title: ( localize2WithPath(_moduleId, 9, "Select Editor")),
            precondition: ( (EditorContextKeys.stickyScrollFocused.isEqualTo(true))),
            keybinding: {
                weight,
                primary: 9
            }
        });
    }
    runEditorCommand(_accessor, editor) {
        StickyScrollController.get(editor)?.selectEditor();
    }
}
export { FocusStickyScroll, GoToStickyScrollLine, SelectEditor, SelectNextStickyScrollLine, SelectPreviousStickyScrollLine, ToggleStickyScroll };
