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

chore(vscode): add useVSCodeProxy option to control whether to use Vscode Proxy #3440

Merged
merged 8 commits into from
Nov 22, 2024
13 changes: 11 additions & 2 deletions clients/vscode/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getLogger } from "./logger";
interface AdvancedSettings {
"inlineCompletion.triggerMode"?: "automatic" | "manual";
"chatEdit.history"?: number;
useVSCodeProxy?: boolean;
}

export interface PastServerConfig {
Expand Down Expand Up @@ -73,6 +74,11 @@ export class Config extends EventEmitter {
}
}

get useVSCodeProxy(): boolean {
const advancedSettings = this.workspace.get("settings.advanced", {}) as AdvancedSettings;
return advancedSettings["useVSCodeProxy"] ?? true;
}

get maxChatEditHistory(): number {
const advancedSettings = this.workspace.get("settings.advanced", {}) as AdvancedSettings;
const numHistory = advancedSettings["chatEdit.history"] === undefined ? 20 : advancedSettings["chatEdit.history"];
Expand Down Expand Up @@ -184,12 +190,15 @@ export class Config extends EventEmitter {
}

buildClientProvidedConfig(): ClientProvidedConfig {
const url = this.useVSCodeProxy ? this.url : "";
const authorization = this.useVSCodeProxy ? this.authorization : "";

return {
// Note: current we only support http.proxy | http.authorization
// More properties we will land later.
proxy: {
url: this.url,
authorization: this.authorization,
url,
authorization,
},
server: {
endpoint: this.serverEndpoint,
Expand Down