Skip to content

Commit be50459

Browse files
authored
refactor(ui): remove unused win_id and accepted_cursor (#16)
Remove redundant win_id retrieval and accepted_cursor check in the suggestion display function to simplify the code. Fix #15
1 parent 3e288cd commit be50459

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

lua/copilot-lsp/nes/ui.lua

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ function M._display_next_suggestion(edits, ns_id)
9393
return
9494
end
9595
local bufnr = vim.uri_to_bufnr(edits[1].textDocument.uri)
96-
local win_id = vim.fn.win_findbuf(bufnr)[1]
9796
local suggestion = edits[1]
9897

9998
local lines = M._calculate_lines(suggestion)
@@ -123,14 +122,6 @@ function M._display_next_suggestion(edits, ns_id)
123122
return true
124123
end
125124

126-
local accepted_cursor = vim.b.nes_state.accepted_cursor
127-
if accepted_cursor then
128-
local cursor = vim.api.nvim_win_get_cursor(win_id)
129-
if cursor[1] == accepted_cursor[1] and cursor[2] == accepted_cursor[2] then
130-
return
131-
end
132-
end
133-
134125
M.clear_suggestion(bufnr, ns_id)
135126
return true
136127
end,

0 commit comments

Comments
 (0)