Skip to content

Commit 56bd1c3

Browse files
committed
fix json decode error with curl
1 parent a6dc357 commit 56bd1c3

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

lua/copilot/copilot_handler.lua

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@ M.start = function(params)
1111
cmd_env = {
1212
["GITHUB_USER"] = user_data.user,
1313
["GITHUB_TOKEN"] = user_data.token,
14-
["COPILOT_AGENT_VERBOSE"] = 1,
15-
},
16-
handlers = {
17-
["getCompletions"] = function()
18-
print("get completions")
19-
end,
20-
["textDocumentSync"] = function()
21-
print("handle")
22-
end,
2314
},
2415
name = "copilot",
2516
trace = "messages",
@@ -46,18 +37,4 @@ M.start = function(params)
4637
})
4738
end
4839

49-
-- this doesn't seem to do anything so remove for now
50-
-- local send_editor_info = function()
51-
-- vim.lsp.buf_request_sync(0, "setEditorInfo", {
52-
-- editorPluginInfo = {
53-
-- name = "copilot.vim",
54-
-- version = "1.1.0",
55-
-- },
56-
-- editorInfo = {
57-
-- version = "0.7.0-dev+1343-g4d3acd6be-dirty",
58-
-- name = "Neovim",
59-
-- },
60-
-- }, 600)
61-
-- end
62-
6340
return M

lua/copilot/setup.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ local function json_body(response)
2626
end
2727

2828
local function oauth_user(token)
29-
return vim.json.decode(
30-
vim.fn.system('curl -s --header "Authorization: Bearer ' .. token .. '" https://api.github.com/user')
31-
)
29+
return vim.fn.system('curl -s --header "Authorization: Bearer ' .. token .. '" https://api.github.com/user')
3230
end
3331

3432
local function oauth_save(oauth_token)
@@ -37,6 +35,7 @@ local function oauth_save(oauth_token)
3735
return github
3836
end
3937

38+
4039
M.get_cred = function()
4140
local userdata = vim.json.decode(
4241
vim.api.nvim_eval("readfile('" .. find_config_path() .. "/github-copilot/hosts.json')")[1]

0 commit comments

Comments
 (0)