Skip to content

Commit 9d71f97

Browse files
committed
Update README.md and remove default settings opts
1 parent 490c730 commit 9d71f97

File tree

3 files changed

+40
-21
lines changed

3 files changed

+40
-21
lines changed

README.md

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,24 +66,42 @@ use {
6666
The following is the default configuration:
6767

6868
```lua
69-
{
70-
cmp_method = "getCompletionsCycling",
71-
ft_disable = {},
72-
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
73-
server_opts_overrides = {},
74-
}
69+
cmp = {
70+
enabled = true,
71+
method = "getPanelCompletions",
72+
},
73+
panel = { -- no config options yet
74+
enabled = true,
75+
},
76+
ft_disable = {},
77+
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
78+
server_opts_overrides = {},
7579
```
7680

77-
##### cmp_method
81+
##### cmp
7882

79-
Set this to `"getPanelCompletions"` to try out the new features. Most notably, completions in the cmp menu are no longer limited to 3 recommendations. There will be a way to limit this soon, but currently about 5 to 10 typically show. This will also enable a new command `:CopilotPanel` in which you can preview a ton of completion options as in copilot.vim. This feature is very new, and you can expect bugs as I am still ironing out some aspects of it, such as ranking completions by their provided scores, so expect even more functionality soon. Once this is made stable, it will very likely be the new default.
83+
Set the enabled field to false if you do not wish to see copilot recommendations in nvim-cmp. Set the `method` field to `getCompletionsCycling` if you are having issues. getPanelCompletions seems to work just as quickly, and does not limit completions in the cmp menu to 3 recommendations. getPanelCompletions also allows for the comparator provided in copilot-cmp to not just place all copilot completions on top, but also sort them by the `score` copilot assigns them, which is not provided by getCompletionsCycling. Example:
8084

81-
Example:
85+
```lua
86+
require("copilot").setup {
87+
cmp = {
88+
enabled = true,
89+
method = "getCompletionsCycling",
90+
}
91+
},
92+
```
93+
94+
##### panel
95+
96+
Enabling panel creates the `CopilotPanel` command, which allows you to preview completions in a split window. Navigating to the split window allows you to jump between them and see each one. (<CR> to accept completion not yet implemented, coming soon)
8297

8398
```lua
8499
require("copilot").setup {
85-
cmp_method = "getPanelCompletions",
86-
}
100+
panel = {
101+
enabled = false,
102+
}
103+
},
104+
87105
```
88106

89107
##### ft_disable
@@ -112,12 +130,20 @@ require("copilot").setup {
112130

113131
##### server_opts_overrides
114132

115-
Override copilot lsp client settings. See `:h vim.lsp.start_client` for list of options.
133+
Override copilot lsp client settings. The `settings` field is where you can set the values of the options defined in SettingsOpts.md. These options are specific to the copilot lsp and can be used to customize its behavior. Ensure that the name field is not overriden as is is used for efficiency reasons in numerous checks to verify copilot is actually running. See `:h vim.lsp.start_client` for list of options.
116134

117135
Example:
118136

119137
```lua
120138
require("copilot").setup {
121-
server_opts_overrides = { trace = "verbose", name = "AI" },
122-
}
139+
server_opts_overrides = {
140+
trace = "verbose",
141+
settings = {
142+
advanced = {
143+
listCount = 10, -- #completions for panel
144+
inlineSuggestCount = 3, -- #completions for getCompletions
145+
}
146+
},
147+
}
148+
},
123149
```

lua/copilot/client.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ M.merge_server_opts = function (params)
2727
vim.schedule(M.buf_attach_copilot)
2828
vim.schedule(register_autocmd)
2929
end,
30-
settings = params.settings,
3130
}, params.server_opts_overrides or {})
3231
end
3332

lua/copilot/init.lua

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ local defaults = {
1212
ft_disable = {},
1313
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
1414
server_opts_overrides = {},
15-
settings = {
16-
advanced = {
17-
listCount = 10, -- #completions for panel
18-
inlineSuggestCount = 3, -- #completions for getCompletions
19-
}
20-
}
2115
}
2216

2317
local create_cmds = function (_)

0 commit comments

Comments
 (0)