mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-22 03:14:30 +00:00
Refactor proxy settings
This commit is contained in:
parent
2f5149886d
commit
7d815b862f
3 changed files with 32 additions and 30 deletions
|
@ -8,6 +8,11 @@ const NIGHTLY_TAG = "nightly";
|
|||
|
||||
export type RunnableEnvCfg = undefined | Record<string, string> | { mask?: string; env: Record<string, string> }[];
|
||||
|
||||
export class ProxySettings {
|
||||
proxy?: string = undefined;
|
||||
strictSSL: boolean = true;
|
||||
}
|
||||
|
||||
export class Config {
|
||||
readonly extensionId = "matklad.rust-analyzer";
|
||||
|
||||
|
@ -99,16 +104,17 @@ export class Config {
|
|||
get channel() { return this.get<UpdatesChannel>("updates.channel"); }
|
||||
get askBeforeDownload() { return this.get<boolean>("updates.askBeforeDownload"); }
|
||||
get traceExtension() { return this.get<boolean>("trace.extension"); }
|
||||
get httpProxy() {
|
||||
const httpProxy = vscode
|
||||
get proxySettings(): ProxySettings {
|
||||
const proxy = vscode
|
||||
.workspace
|
||||
.getConfiguration('http')
|
||||
.get<null | string>("proxy")!;
|
||||
.get<null | string>("proxy")! || process.env["https_proxy"] || process.env["HTTPS_PROXY"];
|
||||
const strictSSL = vscode.workspace.getConfiguration("http").get<boolean>("proxyStrictSSL") || true;
|
||||
|
||||
return httpProxy || process.env["https_proxy"] || process.env["HTTPS_PROXY"];
|
||||
}
|
||||
get proxyStrictSSL(): boolean {
|
||||
return vscode.workspace.getConfiguration("http").get("proxyStrictSSL") || true;
|
||||
return {
|
||||
proxy: proxy,
|
||||
strictSSL: strictSSL,
|
||||
};
|
||||
}
|
||||
|
||||
get inlayHints() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue