Skip to content

Commit d8e75ff

Browse files
committed
Update README.md with new features
1 parent c3eee61 commit d8e75ff

File tree

2 files changed

+26
-29
lines changed

2 files changed

+26
-29
lines changed

README.md

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ This plugin is the pure lua replacement for https://github.com/github/copilot.vi
44

55
While using copilot.vim, for the first time since I started using neovim my laptop began to overheat. Additionally, I found the large chunks of ghost text moving around my code, and interfering with my existing cmp ghost text disturbing. As lua is far more efficient and makes things easier to integrate with modern plugins, this repository was created.
66

7-
### Quick Annoucement (If you are a first time user just scroll to the next header, you can ignore this):
8-
There is a dev branch called new_req with a metric ton of new features, as well as even more that I am working on but are still half implemented.
9-
Virtually everything is extremely buggy at the moment, but it is deceptively close to being ready, as the issues are mostly connected. There is some really cool stuff like configurable numbers of entries from copilot, settings for controlling the types and accuracy of completions copilot will retrieve, as well as a module for printing panel suggestions to buffers. If anyone wants to help me out with stabilizing it before merging to master over the next few days it would probably be a super easy way to get in a few PR's, and would be a great help!
10-
117
## (IMPORTANT) Usage:
128

139
Note that this plugin will only start up the copilot server. The current usage of this is via https://github.com/zbirenbaum/copilot-cmp, which turns copilot suggestions into menu entries for cmp, and displays the full text body in a float, similar to how documentation would appear, off to the side.
@@ -71,44 +67,57 @@ The following is the default configuration:
7167

7268
```lua
7369
{
74-
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
70+
cmp_method = "getCompletionsCycling",
71+
ft_disable = {},
72+
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
7573
server_opts_overrides = {},
76-
ft_disable = {}
7774
}
7875
```
7976

80-
##### plugin_manager_path
77+
##### cmp_method
8178

82-
This is installation path of Packer, change this to the plugin manager installation path of your choice
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.
8380

8481
Example:
8582

8683
```lua
8784
require("copilot").setup {
88-
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
85+
cmp_method = "getPanelCompletions",
8986
}
9087
```
9188

92-
##### server_opts_overrides
89+
##### ft_disable
9390

94-
Override copilot lsp client settings. See `:h vim.lsp.start_client` for list of options.
91+
Prevents copilot from attaching to buffers with specific filetypes.
9592

9693
Example:
9794

9895
```lua
9996
require("copilot").setup {
100-
server_opts_overrides = { trace = "verbose", name = "AI" },
97+
ft_disable = { "markdown", "terraform" },
10198
}
10299
```
103100

104-
##### ft_disable
101+
##### plugin_manager_path
105102

106-
Prevents copilot from attaching to buffers with specific filetypes.
103+
This is installation path of Packer, change this to the plugin manager installation path of your choice
107104

108105
Example:
109106

110107
```lua
111108
require("copilot").setup {
112-
ft_disable = { "markdown", "terraform" },
109+
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
110+
}
111+
```
112+
113+
##### server_opts_overrides
114+
115+
Override copilot lsp client settings. See `:h vim.lsp.start_client` for list of options.
116+
117+
Example:
118+
119+
```lua
120+
require("copilot").setup {
121+
server_opts_overrides = { trace = "verbose", name = "AI" },
113122
}
114123
```

lua/copilot/init.lua

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,18 @@
11
local M = { client_info = nil }
22
local client = require("copilot.client")
3-
local lsp = vim.lsp
43

54
local defaults = {
5+
cmp_method = "getCompletionsCycling",
6+
ft_disable = {},
67
plugin_manager_path = vim.fn.stdpath("data") .. "/site/pack/packer",
78
server_opts_overrides = {},
8-
ft_disable = {},
9-
cmp_method = "getCompletionsCycling"
109
}
1110

1211
local config_handler = function(opts)
1312
local user_config = opts and vim.tbl_deep_extend("force", defaults, opts) or defaults
1413
return user_config
1514
end
1615

17-
local set_client_info = function(client_id)
18-
M.client_info = {
19-
client_id = client_id,
20-
client = lsp.get_client_by_id(client_id)
21-
}
22-
end
23-
24-
local get_client_info = function ()
25-
return M.client_info
26-
end
27-
2816
M.setup = function(opts)
2917
local user_config = config_handler(opts)
3018
vim.schedule(function () client.start(user_config) end)

0 commit comments

Comments
 (0)