@@ -3,6 +3,33 @@ local utils = require("copilot-lsp.util")
3
3
4
4
local M = {}
5
5
6
+ local nes_ext
7
+ local nes_ns = vim .api .nvim_create_namespace (" copilot-nes" )
8
+
9
+ --- @param edit copilotInlineEdit
10
+ local function display_nes (edit )
11
+ dd (" trying to display" )
12
+ local bufnr = vim .uri_to_bufnr (edit .textDocument .uri )
13
+ if edit .text :match (" \n " ) then
14
+ assert (false , " multi line edits not supported yet" )
15
+ end
16
+
17
+ nes_ext = vim .api .nvim_buf_set_extmark (bufnr , nes_ns , edit .range .start .line , edit .range .start .character , {
18
+ id = nes_ext ,
19
+ virt_lines = { { { edit .text , " Comment" } } },
20
+ })
21
+
22
+ -- create accept and decline keymaps
23
+ vim .keymap .set (" n" , " <leader>xa" , function ()
24
+ utils .apply_inline_edit (edit )
25
+ vim .api .nvim_buf_del_extmark (bufnr , nes_ns , nes_ext )
26
+ end , { buffer = bufnr })
27
+
28
+ vim .keymap .set (" n" , " <leader>xd" , function ()
29
+ vim .api .nvim_buf_del_extmark (bufnr , nes_ns , nes_ext )
30
+ end , { buffer = bufnr })
31
+ end
32
+
6
33
--- @param err lsp.ResponseError ?
7
34
--- @param result copilotInlineEditResponse
8
35
local function handle_nes_response (err , result )
@@ -21,7 +48,8 @@ local function handle_nes_response(err, result)
21
48
end
22
49
23
50
local edit = result .edits [1 ]
24
- utils .apply_inline_edit (edit )
51
+ display_nes (edit )
52
+ -- utils.apply_inline_edit(edit)
25
53
end
26
54
27
55
--- @param copilot_lss vim.lsp.Client ?
0 commit comments