-
-
Notifications
You must be signed in to change notification settings - Fork 213
/
copilot-cmp.nix
65 lines (60 loc) · 1.88 KB
/
copilot-cmp.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
lib,
helpers,
config,
...
}:
with lib;
let
copilot-lua-cfg = config.plugins.copilot-lua;
cfg = config.plugins.copilot-cmp;
in
{
options.plugins.copilot-cmp = helpers.neovim-plugin.extraOptionsOptions // {
event =
helpers.defaultNullOpts.mkListOf types.str
[
"InsertEnter"
"LspAttach"
]
''
Configures when the source is registered.
Unless you have a unique problem for your particular configuration you probably don't want
to touch this.
'';
fixPairs = helpers.defaultNullOpts.mkBool true ''
Suppose you have the following code: `print('h')`.
Copilot might try to account for the `'` and `)` and complete it with this: `print('hello`.
This is not good behavior for consistency reasons and will just end up deleting the two ending
characters.
This option fixes that.
Don't turn this off unless you are having problems with pairs and believe this might be
causing them.
'';
};
config = mkIf cfg.enable {
warnings =
optional ((!isBool copilot-lua-cfg.suggestion.enabled) || copilot-lua-cfg.suggestion.enabled) ''
It is recommended to disable copilot's `suggestion` module, as it can interfere with
completions properly appearing in copilot-cmp.
''
++ optional ((!isBool copilot-lua-cfg.panel.enabled) || copilot-lua-cfg.panel.enabled) ''
It is recommended to disable copilot's `panel` module, as it can interfere with completions
properly appearing in copilot-cmp.
'';
plugins.copilot-lua.enable = true;
extraConfigLua =
let
setupOptions =
with cfg;
{
inherit event;
fix_pairs = fixPairs;
}
// cfg.extraOptions;
in
''
require('copilot_cmp').setup(${helpers.toLuaObject setupOptions})
'';
};
}