-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathConfig.ts
More file actions
135 lines (102 loc) · 3.77 KB
/
Copy pathConfig.ts
File metadata and controls
135 lines (102 loc) · 3.77 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
'use strict';
import { workspace } from 'vscode';
export interface IProxy {
enable: boolean;
baseUri: string;
proxyUri: string;
}
export interface IHttps {
enable: boolean;
cert: string;
key: string;
passphrase: string;
}
export class Config {
public static get configuration() {
return workspace.getConfiguration('liveServer.settings');
}
private static getSettings<T>(val: string): T {
return Config.configuration.get(val) as T;
}
private static setSettings(key: string, val: number, isGlobal: boolean = false): Thenable<void> {
return Config.configuration.update(key, val, isGlobal);
}
public static get getHost(): string {
return Config.getSettings<string>('host');
}
public static get getLocalIp(): boolean {
return Config.getSettings<boolean>('useLocalIp');
}
public static get getPort(): number {
return Config.getSettings<number>('port');
}
public static setPort(port: number): Thenable<void> {
return Config.setSettings('port', port);
}
public static get getRoot(): string {
return Config.getSettings<string>('root');
}
public static get getNoBrowser(): boolean {
return Config.getSettings<boolean>('NoBrowser');
}
public static get getAdvancedBrowserCmdline(): string {
return Config.getSettings<string>('AdvanceCustomBrowserCmdLine');
}
public static get getChromeDebuggingAttachment(): boolean {
return Config.getSettings<boolean>('ChromeDebuggingAttachment');
}
public static get getCustomBrowser(): string {
return Config.getSettings<string>('CustomBrowser');
}
public static get getIgnoreFiles(): string[] {
return Config.getSettings<string[]>('ignoreFiles');
}
public static get getDonotShowInfoMsg(): boolean {
return Config.getSettings<boolean>('donotShowInfoMsg');
}
public static setDonotShowInfoMsg(val: boolean, isGlobal: boolean = false) {
Config.configuration.update('donotShowInfoMsg', val, isGlobal);
}
public static get getDonotVerifyTags(): boolean {
return Config.getSettings<boolean>('donotVerifyTags');
}
public static setDonotVerifyTags(val: boolean, isGlobal: boolean = false) {
Config.configuration.update('donotVerifyTags', val, isGlobal);
}
public static get getUseWebExt(): boolean {
return Config.getSettings<boolean>('useWebExt') || false;
}
public static get getProxy(): IProxy {
return Config.getSettings<IProxy>('proxy');
}
public static get getHttps(): IHttps {
return Config.getSettings<IHttps>('https') || {} as IHttps;
}
public static get getWait(): number {
return Config.getSettings<number>('wait');
}
public static get getfullReload(): boolean {
return Config.getSettings<boolean>('fullReload');
}
public static get getMount(): Array<Array<string>> {
return Config.getSettings<Array<Array<string>>>('mount');
}
public static get getShowOnStatusbar(): boolean {
return Config.getSettings<boolean>('showOnStatusbar') || false;
}
public static get getFile(): string {
return Config.getSettings<string>('file');
}
public static get getMultiRootWorkspaceName(): string {
return Config.getSettings<string>('multiRootWorkspaceName');
}
public static setMultiRootWorkspaceName(val: string) {
return Config.configuration.update('multiRootWorkspaceName', val, false);
}
public static get getHeaders(): Record<string, string> | undefined {
return Config.getSettings<Record<string, string> | undefined>('headers');
}
public static get getCors(): boolean {
return Config.getSettings<boolean>('cors');
}
}