blob: 8508d6e5920c43221c1a201358b631ee3badea96 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
import * as vscode from 'vscode';
import { log } from "./util";
//modified from https://github.com/rust-analyzer/rust-analyzer/blob/master/editors/code/src/config.ts - 03.05.2021
export class Config {
readonly extensionId = "danielgavin.ols";
readonly rootSection = "ols";
readonly globalStorageUri: vscode.Uri;
readonly package: {
version: string;
releaseTag: string | null;
enableProposedApi: boolean | undefined;
} = vscode.extensions.getExtension(this.extensionId)!.packageJSON;
constructor(ctx: vscode.ExtensionContext) {
this.globalStorageUri = ctx.globalStorageUri;
}
private get cfg(): vscode.WorkspaceConfiguration {
return vscode.workspace.getConfiguration(this.rootSection);
}
get serverPath() {
return this.get<null | string>("server.path") ?? this.get<null | string>("serverPath");
}
get httpProxy() {
const httpProxy = vscode
.workspace
.getConfiguration('http')
.get<null | string>("proxy")!;
return httpProxy || process.env["https_proxy"] || process.env["HTTPS_PROXY"];
}
private get<T>(path: string): T {
return this.cfg.get<T>(path)!;
}
get askBeforeDownload() { return this.get<boolean>("updates.askBeforeDownload"); }
get debugEngine() { return this.get<string>("debug.engine"); }
collections: any [] = [];
}
|