copilot.lua icon indicating copy to clipboard operation
copilot.lua copied to clipboard

Proxy support

Open mattephi opened this issue 1 year ago • 2 comments

Can't find in documentation the parameters regarding the traffic forwarding through the specified proxy server. Is it possible in current implementation?

mattephi avatar May 08 '24 18:05 mattephi

It re-uses the variable from copilot.vim.

https://github.com/zbirenbaum/copilot.lua/blob/f7612f5af4a7d7615babf43ab1e67a2d790c13a6/lua/copilot/util.lua#L227

Here is an example config:

{
	"zbirenbaum/copilot.lua",
	cmd = "Copilot",
	event = "InsertEnter",
	config = function()
		vim.g.copilot_proxy = "http://127.0.0.1:3128"
		require("copilot").setup({})
	end,
},

Note: you have to put protocol, i.e. http into the variable. It will not work if you put 127.0.0.1:3128.

biozz avatar May 14 '24 08:05 biozz

The solution above didn't work for me for some reason. But I found in the copilot documentation that it respects

  • HTTPS_PROXY
  • https_proxy
  • HTTP_PROXY
  • http_proxy

So I added this alias to my .zshrc and now everything works

alias nvim='HTTP_PROXY=http://127.0.0.1:2080 nvim'

anton-fomin avatar Sep 19 '24 16:09 anton-fomin