File tree Expand file tree Collapse file tree 4 files changed +10
-8
lines changed
Expand file tree Collapse file tree 4 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 99M .buf_attach_copilot = function ()
1010 if vim .tbl_contains (M .params .ft_disable , vim .bo .filetype ) then return end
1111 if not vim .bo .buflisted or not vim .bo .buftype == " " then return end
12- local name = M .params .server_opts_overrides .name or " copilot"
13-
1412 -- The filter param to get_active_clients() can be used on Neovim 0.8 and later.
1513 for _ , client in pairs (vim .lsp .get_active_clients ()) do
16- if client .name == name and not vim .lsp .buf_is_attached (0 , client .id ) then
14+ if client .name == " copilot " and not vim .lsp .buf_is_attached (0 , client .id ) then
1715 vim .lsp .buf_attach_client (0 , client .id )
1816 client .completion_function = M .params .extensions
1917 end
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ local panel = {
1010
1111panel .send_request = function (opts )
1212 opts = opts or {}
13- local client = opts .client or not vim .tbl_isempty (panel .client ) and panel .client or vim . lsp . get_active_clients ({ name = " copilot " })[ 1 ]
13+ local client = opts .client or not vim .tbl_isempty (panel .client ) and panel .client or util . get_copilot_client ()
1414 if not panel .client then return end
1515 local completion_params = util .get_completion_params ()
1616 completion_params .panelId = opts .uri or panel .uri
@@ -19,7 +19,7 @@ panel.send_request = function (opts)
1919end
2020
2121function panel .create (client , max_results )
22- panel .client = client or vim . lsp . get_active_clients ({ name = " copilot " })[ 1 ]
22+ panel .client = client or util . get_copilot_client ()
2323 if not panel .client then print (" Error, copilot not running" ) end
2424 panel .max_results = max_results or 10
2525 panel .buf = type (panel .uri ) == " number" or vim .api .nvim_create_buf (false , true )
Original file line number Diff line number Diff line change 11local a = vim .api
2+ local cmd = vim .cmd
23local wo = vim .wo
34local handler = require (" copilot.handlers" )
45local format = require (" copilot_cmp.format" )
@@ -91,7 +92,7 @@ print_panel.select = function (id)
9192 if not id then id = print_panel .current or 1 end
9293 local selection = print_panel .entries [id ]
9394 a .nvim_win_set_cursor (print_panel .win , {selection .linenr , 0 })
94- vim . cmd (" normal zt" )
95+ cmd (" normal zt" )
9596 print_panel .current = id
9697 print_panel .linenr = selection .linenr
9798end
Original file line number Diff line number Diff line change @@ -10,8 +10,11 @@ local get_relfile = function()
1010 return file
1111end
1212
13- M .find_copilot_client = function ()
14- vim .lsp .get_active_clients ({name = " copilot" })
13+ M .get_copilot_client = function ()
14+ -- vim.lsp.get_active_clients({name="copilot"}) -- not in 0.7
15+ for _ , client in pairs (vim .lsp .get_active_clients ()) do
16+ if client .name == " copilot" then return client end
17+ end
1518end
1619
1720M .get_completion_params = function ()
You can’t perform that action at this time.
0 commit comments