Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copilot: Support HTTP/HTTPS proxy for Copilot language server #24364

Merged
merged 9 commits into from
Feb 24, 2025

Conversation

eli-kaplan
Copy link
Contributor

@eli-kaplan eli-kaplan commented Feb 6, 2025

Closes #6701 (one of the top ranking issues as of writing)

Adds the ability to specify an HTTP/HTTPS proxy to route Copilot code completion API requests through. This should fix copilot functionality in restricted network environments (where such a proxy is required) but also opens up the ability to point copilot code completion requests at your own local LLM, using e.g.:

External MITM-proxy tools permitting, this can serve as a stop-gap to allow local LLM code completion in Zed until a proper OpenAI-compatible local code completions provider is implemented. With this in mind, in this PR I've added separate settings.json variables to configure a proxy server specific to the code completions provider instead of using the global proxy setting, to allow for cases like this where we only want to proxy e.g. the Copilot requests, but not all outgoing traffic from the application.

Currently, two new settings are added:

  • inline_completions.copilot.proxy: Proxy server URL (HTTP and HTTPS schemes supported)
  • inline_completions.copilot.proxy_no_verify: Whether to disable certificate verification through the proxy

Example:

"features": {
  "inline_completion_provider": "copilot"
},
"show_completions_on_input": true,
// New:
"inline_completions": {
  "copilot": {
    "proxy": "http://example.com:15432",
    "proxy_no_verify": true
  }
}

Release Notes:

  • Added the ability to specify an HTTP/HTTPS proxy for Copilot.

This comment was marked as resolved.

@eli-kaplan eli-kaplan force-pushed the support-copilot-http-proxy branch from 12c5452 to 9fa24c4 Compare February 6, 2025 08:35
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 6, 2025
@maxdeviant maxdeviant changed the title Support HTTP(s) proxy for Copilot code completions language server Support HTTP(S) proxy for Copilot code completions language server Feb 6, 2025
@maxdeviant maxdeviant changed the title Support HTTP(S) proxy for Copilot code completions language server copilot: Support HTTP/S proxy for Copilot language server Feb 6, 2025
@maxdeviant maxdeviant changed the title copilot: Support HTTP/S proxy for Copilot language server copilot: Support HTTP/HTTPS proxy for Copilot language server Feb 6, 2025
@maxdeviant maxdeviant self-assigned this Feb 6, 2025
@eli-kaplan
Copy link
Contributor Author

Thanks for helping clean this up! Let me know if you've got further changes planned or if you'd like me to go in and fix up the merge conflicts

Copy link
Member

@maxdeviant maxdeviant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@maxdeviant maxdeviant merged commit a8d5687 into zed-industries:main Feb 24, 2025
12 checks passed
@sa1
Copy link

sa1 commented Feb 24, 2025

I would suggest falling back upon the global proxy setting if inline_completions.copilot.proxy is absent.
While some people would definitely want to run ollama, most other people in corporate environments would be perplexed to understand why their global proxy setting is not working, leading to a very bad user experience.
Most of this stuff is not documented anywhere except in commit messages.

@isav48
Copy link

isav48 commented Mar 12, 2025

the correct syntax:
"edit_predictions": { "copilot": { "proxy": "http://localhost:8081", "proxy_no_verify": true } },

@notpeter
Copy link
Member

@eli-kaplan: "...instead of using the global proxy setting"

@sa1: "I would suggest falling back upon the global proxy setting if inline_completions.copilot.proxy is absent."

I wholly agree this should be the default behavior. If proxy is defined settings or the appropriate environment variables are set (HTTP_PROXY, SOCKS_PROXY, etc) that should be used for copilot by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

copilot does not respect proxy
5 participants