import { AbstractGotoLineQuickAccessProvider } from "../../../contrib/quickAccess/browser/gotoLineQuickAccess.mjs";
import { Registry } from "../../../../platform/registry/common/platform.mjs";
import { Extensions } from "../../../../platform/quickinput/common/quickAccess.mjs";
import { ICodeEditorService } from "../../../browser/services/codeEditorService.mjs";
import { withNullAsUndefined } from "../../../../base/common/types.mjs";
import { GoToLineNLS } from "../../../common/standaloneStrings.mjs";
import { Event } from "../../../../base/common/event.mjs";
import { registerEditorAction, EditorAction } from "../../../browser/editorExtensions.mjs";
import { EditorContextKeys } from "../../../common/editorContextKeys.mjs";
import { IQuickInputService } from "../../../../platform/quickinput/common/quickInput.mjs";
var __decorate = globalThis && globalThis.__decorate || function(decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
    r = Reflect.decorate(decorators, target, key, desc);
  else
    for (var i = decorators.length - 1; i >= 0; i--)
      if (d = decorators[i])
        r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = globalThis && globalThis.__param || function(paramIndex, decorator) {
  return function(target, key) {
    decorator(target, key, paramIndex);
  };
};
let StandaloneGotoLineQuickAccessProvider = class StandaloneGotoLineQuickAccessProvider2 extends AbstractGotoLineQuickAccessProvider {
  constructor(editorService) {
    super();
    this.editorService = editorService;
    this.onDidActiveTextEditorControlChange = Event.None;
  }
  get activeTextEditorControl() {
    return withNullAsUndefined(this.editorService.getFocusedCodeEditor());
  }
};
StandaloneGotoLineQuickAccessProvider = __decorate([
  __param(0, ICodeEditorService)
], StandaloneGotoLineQuickAccessProvider);
Registry.as(Extensions.Quickaccess).registerQuickAccessProvider({
  ctor: StandaloneGotoLineQuickAccessProvider,
  prefix: StandaloneGotoLineQuickAccessProvider.PREFIX,
  helpEntries: [{ description: GoToLineNLS.gotoLineActionLabel, needsEditor: true }]
});
class GotoLineAction extends EditorAction {
  constructor() {
    super({
      id: "editor.action.gotoLine",
      label: GoToLineNLS.gotoLineActionLabel,
      alias: "Go to Line/Column...",
      precondition: void 0,
      kbOpts: {
        kbExpr: EditorContextKeys.focus,
        primary: 2048 | 37,
        mac: {
          primary: 256 | 37
          /* KeyG */
        },
        weight: 100
        /* EditorContrib */
      }
    });
  }
  run(accessor) {
    accessor.get(IQuickInputService).quickAccess.show(StandaloneGotoLineQuickAccessProvider.PREFIX);
  }
}
registerEditorAction(GotoLineAction);
export {
  GotoLineAction,
  StandaloneGotoLineQuickAccessProvider
};
