plugins/copilot-vim: switch to settings option

This commit is contained in:
Gaetan Lepage 2024-03-02 23:35:41 +01:00 committed by Gaétan Lepage
parent 7e279e6e91
commit dd238fb80b
2 changed files with 62 additions and 20 deletions

View file

@ -12,35 +12,74 @@ with helpers.vim-plugin;
originalName = "copilot.vim"; originalName = "copilot.vim";
defaultPackage = pkgs.vimPlugins.copilot-vim; defaultPackage = pkgs.vimPlugins.copilot-vim;
globalPrefix = "copilot_"; globalPrefix = "copilot_";
deprecateExtraConfig = true;
maintainers = [maintainers.GaetanLepage]; maintainers = [maintainers.GaetanLepage];
options = { # TODO introduced 2024-03-02: remove 2024-05-02
nodeCommand = mkDefaultOpt { deprecateExtraConfig = true;
global = "node_command"; optionsRenamedToSettings = [
type = types.str; "nodeCommand"
"filetypes"
"proxy"
];
settingsOptions = {
node_command = mkOption {
type = with types; nullOr str;
default = "${pkgs.nodejs-18_x}/bin/node"; default = "${pkgs.nodejs-18_x}/bin/node";
description = "Tell Copilot what `node` binary to use."; description = "Tell Copilot what `node` binary to use.";
}; };
filetypes = mkDefaultOpt { filetypes = mkOption {
type = with types; attrsOf bool; type = with types; nullOr (attrsOf bool);
description = '' default = null;
A dictionary mapping file types to their enabled status description = "A dictionary mapping file types to their enabled status.";
Default: `{}`
'';
example = { example = {
"*" = false; "*" = false;
python = true; python = true;
}; };
}; };
proxy = mkDefaultOpt { proxy = mkOption {
type = types.str; type = with types; nullOr str;
description = "Tell Copilot what proxy server to use."; default = null;
description = ''
Tell Copilot what proxy server to use.
If this is not set, Copilot will use the value of environment variables like
`$HTTPS_PROXY`.
'';
example = "localhost:3128"; example = "localhost:3128";
}; };
proxy_strict_ssl = helpers.mkNullOrOption types.bool ''
Corporate proxies sometimes use a man-in-the-middle SSL certificate which is incompatible
with GitHub Copilot.
To work around this, SSL certificate verification can be disabled by setting this option to
`false`.
You can also tell `Node.js` to disable SSL verification by setting the
`$NODE_TLS_REJECT_UNAUTHORIZED` environment variable to `"0"`.
'';
workspace_folders = helpers.mkNullOrOption (with types; listOf str) ''
A list of "workspace folders" or project roots that Copilot may use to improve to improve
the quality of suggestions.
Example: ["~/Projects/myproject"]
You can also set `b:workspace_folder` for an individual buffer and newly seen values will be
added automatically.
'';
};
settingsExample = {
filetypes = {
"*" = false;
python = true;
};
proxy = "localhost:3128";
proxy_strict_ssl = false;
workspace_folders = ["~/Projects/myproject"];
}; };
} }

View file

@ -7,12 +7,15 @@
plugins.copilot-vim = { plugins.copilot-vim = {
enable = true; enable = true;
filetypes = { settings = {
"*" = false; filetypes = {
python = true; "*" = false;
python = true;
};
proxy = "localhost:3128";
proxy_strict_ssl = false;
workspace_folders = ["~/Projects/myproject"];
}; };
proxy = "localhost:3128";
}; };
}; };
} }