import { registerEditorContribution, registerEditorCommand, EditorCommand } from '../../../browser/editorExtensions.js';
import { editorConfigurationBaseNode } from '../../../common/config/editorConfigurationSchema.js';
import { registerEditorFeature } from '../../../common/editorFeatures.js';
import { DefaultDropProvidersFeature } from './defaultProviders.js';
import { localizeWithPath } from '../../../../nls.js';
import { Extensions } from '../../../../platform/configuration/common/configurationRegistry.js';
import { Registry } from '../../../../platform/registry/common/platform.js';
import { changeDropTypeCommandId, dropWidgetVisibleCtx, DropIntoEditorController, defaultProviderConfig } from './dropIntoEditorController.js';
registerEditorContribution(DropIntoEditorController.ID, DropIntoEditorController, 2 );
registerEditorFeature(DefaultDropProvidersFeature);
registerEditorCommand(new (class extends EditorCommand {
    constructor() {
        super({
            id: changeDropTypeCommandId,
            precondition: dropWidgetVisibleCtx,
            kbOpts: {
                weight: 100 ,
                primary: 2048  | 89 ,
            }
        });
    }
    runEditorCommand(_accessor, editor, _args) {
        DropIntoEditorController.get(editor)?.changeDropType();
    }
}));
registerEditorCommand(new (class extends EditorCommand {
    constructor() {
        super({
            id: 'editor.hideDropWidget',
            precondition: dropWidgetVisibleCtx,
            kbOpts: {
                weight: 100 ,
                primary: 9 ,
            }
        });
    }
    runEditorCommand(_accessor, editor, _args) {
        DropIntoEditorController.get(editor)?.clearWidgets();
    }
}));
( Registry.as(Extensions.Configuration)).registerConfiguration({
    ...editorConfigurationBaseNode,
    properties: {
        [defaultProviderConfig]: {
            type: 'object',
            scope: 5 ,
            description: ( localizeWithPath(
                'vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorContribution',
                'defaultProviderDescription',
                "Configures the default drop provider to use for content of a given mime type."
            )),
            default: {},
            additionalProperties: {
                type: 'string',
            },
        },
    }
});
