2023-02-27 14:05:43 +00:00
|
|
|
{
|
|
|
|
config,
|
2024-02-26 05:05:23 +00:00
|
|
|
pkgs,
|
2023-02-27 14:05:43 +00:00
|
|
|
lib,
|
|
|
|
...
|
2023-11-07 00:50:27 +00:00
|
|
|
}: let
|
2024-02-17 12:51:05 +00:00
|
|
|
inherit (lib) mkRenamedOptionModule;
|
2024-02-26 05:05:23 +00:00
|
|
|
inherit (lib.options) mkEnableOption mkOption;
|
2024-02-17 12:51:05 +00:00
|
|
|
inherit (lib.types) nullOr str enum float;
|
|
|
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
2023-11-07 00:50:27 +00:00
|
|
|
|
2023-05-10 09:11:33 +00:00
|
|
|
cfg = config.vim.assistant.copilot;
|
|
|
|
in {
|
2024-02-17 12:51:05 +00:00
|
|
|
imports = [
|
|
|
|
(mkRenamedOptionModule ["vim" "assistant" "copilot" "panel"] ["vim" "assistant" "copilot" "setupOpts" "panel"])
|
|
|
|
(mkRenamedOptionModule ["vim" "assistant" "copilot" "copilotNodeCommand"] ["vim" "assistant" "copilot" "setupOpts" "copilot_node_command"])
|
|
|
|
(mkRenamedOptionModule ["vim" "assistant" "copilot" "copilotNodePackage"] ["vim" "assistant" "copilot" "setupOpts" "copilot_node_command"])
|
|
|
|
];
|
|
|
|
|
2023-02-27 14:05:43 +00:00
|
|
|
options.vim.assistant.copilot = {
|
2023-06-05 20:10:25 +00:00
|
|
|
enable = mkEnableOption "GitHub Copilot AI assistant";
|
2023-07-24 13:51:24 +00:00
|
|
|
cmp.enable = mkEnableOption "nvim-cmp integration for GitHub Copilot";
|
2023-02-27 14:05:43 +00:00
|
|
|
|
2024-02-17 12:51:05 +00:00
|
|
|
setupOpts = mkPluginSetupOption "Copilot" {
|
|
|
|
copilot_node_command = mkOption {
|
|
|
|
type = str;
|
|
|
|
default = "${lib.getExe pkgs.nodejs-slim}";
|
|
|
|
description = ''
|
|
|
|
The command that will be executed to initiate nodejs for GitHub Copilot.
|
|
|
|
Recommended to leave as default.
|
|
|
|
'';
|
2023-04-11 12:38:27 +00:00
|
|
|
};
|
2024-02-17 12:51:05 +00:00
|
|
|
panel = {
|
|
|
|
enabled = mkEnableOption "Completion Panel" // {default = !cfg.cmp.enable;};
|
|
|
|
layout = {
|
|
|
|
position = mkOption {
|
|
|
|
type = enum [
|
|
|
|
"bottom"
|
|
|
|
"top"
|
|
|
|
"left"
|
|
|
|
"right"
|
|
|
|
];
|
|
|
|
default = "bottom";
|
|
|
|
description = "Panel position";
|
|
|
|
};
|
|
|
|
ratio = mkOption {
|
|
|
|
type = float;
|
|
|
|
default = 0.4;
|
|
|
|
description = "Panel size";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
suggestion = {
|
|
|
|
enabled = mkEnableOption "Suggestions" // {default = !cfg.cmp.enable;};
|
|
|
|
# keymap = { };
|
2023-04-11 12:38:27 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
mappings = {
|
|
|
|
panel = {
|
|
|
|
jumpPrev = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "[[";
|
|
|
|
description = "Jump to previous suggestion";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
jumpNext = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "]]";
|
|
|
|
description = "Jump to next suggestion";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
accept = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "<CR>";
|
|
|
|
description = "Accept suggestion";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
refresh = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "gr";
|
|
|
|
description = "Refresh suggestions";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
open = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "<M-CR>";
|
|
|
|
description = "Open suggestions";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
suggestion = {
|
|
|
|
accept = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "<M-l>";
|
|
|
|
description = "Accept suggetion";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
acceptWord = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = null;
|
|
|
|
description = "Accept next word";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
acceptLine = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = null;
|
|
|
|
description = "Accept next line";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
prev = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "<M-[>";
|
|
|
|
description = "Previous suggestion";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
next = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "<M-]>";
|
|
|
|
description = "Next suggestion";
|
|
|
|
};
|
2024-02-26 05:05:23 +00:00
|
|
|
|
2023-04-04 22:53:21 +00:00
|
|
|
dismiss = mkOption {
|
2024-02-26 05:05:23 +00:00
|
|
|
type = nullOr str;
|
2023-04-04 22:53:21 +00:00
|
|
|
default = "<C-]>";
|
|
|
|
description = "Dismiss suggestion";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-02-27 14:05:43 +00:00
|
|
|
};
|
|
|
|
}
|