@@ -14,9 +14,6 @@ Additional options for this extra can be configured in your [lua/config/options.
14
14
``` lua title="lua/config/options.lua"
15
15
-- Native inline completions don't support being shown as regular completions
16
16
vim .g .ai_cmp = false
17
-
18
- -- Set to `true` in your `options.lua` to enable experimental support for Next Edit Suggestions
19
- vim .g .copilot_nes = false
20
17
```
21
18
22
19
Below you can find a list of included plugins and their default settings.
@@ -74,36 +71,8 @@ opts = {
74
71
copilot = function ()
75
72
vim .lsp .inline_completion .enable ()
76
73
77
- -- Only trigger NES updates:
78
- -- * when leaving insert mode
79
- -- * when text is changed (in normal mode)
80
- -- * when accepting a next edit suggestion
81
- local nes_update = Snacks .util .debounce (function ()
82
- return vim .g .copilot_nes and require (" copilot-lsp.nes" ).request_nes (" copilot" )
83
- end , { ms = 100 })
84
-
85
- vim .api .nvim_create_autocmd ({ " InsertLeave" , " TextChanged" }, {
86
- group = vim .api .nvim_create_augroup (" lazyvim.copilot-native.complete" , { clear = true }),
87
- callback = nes_update ,
88
- })
89
-
90
74
-- Accept inline suggestions or next edits
91
75
LazyVim .cmp .actions .ai_accept = function ()
92
- if vim .b .nes_state then
93
- local nes = require (" copilot-lsp.nes" )
94
-
95
- -- Try to jump to the start of the suggestion edit.
96
- if nes .walk_cursor_start_edit () then
97
- return true
98
- end
99
-
100
- -- apply the pending suggestion and jump to the end of the edit.
101
- if nes .apply_pending_nes () then
102
- nes .walk_cursor_end_edit ()
103
- nes_update () -- trigger new nes update after accept
104
- return true
105
- end
106
- end
107
76
if vim .lsp .inline_completion .get () then
108
77
-- nes_update() -- ensure nes update is triggered after inline completion
109
78
return true
@@ -157,36 +126,8 @@ opts = {
157
126
copilot = function ()
158
127
vim .lsp .inline_completion .enable ()
159
128
160
- -- Only trigger NES updates:
161
- -- * when leaving insert mode
162
- -- * when text is changed (in normal mode)
163
- -- * when accepting a next edit suggestion
164
- local nes_update = Snacks .util .debounce (function ()
165
- return vim .g .copilot_nes and require (" copilot-lsp.nes" ).request_nes (" copilot" )
166
- end , { ms = 100 })
167
-
168
- vim .api .nvim_create_autocmd ({ " InsertLeave" , " TextChanged" }, {
169
- group = vim .api .nvim_create_augroup (" lazyvim.copilot-native.complete" , { clear = true }),
170
- callback = nes_update ,
171
- })
172
-
173
129
-- Accept inline suggestions or next edits
174
130
LazyVim .cmp .actions .ai_accept = function ()
175
- if vim .b .nes_state then
176
- local nes = require (" copilot-lsp.nes" )
177
-
178
- -- Try to jump to the start of the suggestion edit.
179
- if nes .walk_cursor_start_edit () then
180
- return true
181
- end
182
-
183
- -- apply the pending suggestion and jump to the end of the edit.
184
- if nes .apply_pending_nes () then
185
- nes .walk_cursor_end_edit ()
186
- nes_update () -- trigger new nes update after accept
187
- return true
188
- end
189
- end
190
131
if vim .lsp .inline_completion .get () then
191
132
-- nes_update() -- ensure nes update is triggered after inline completion
192
133
return true
0 commit comments