/
settings.ts
48 lines (43 loc) · 1.08 KB
/
settings.ts
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
import { LANGUAGES, SupportedLanguages } from './languages';
import { newId } from './object';
class LanguageSettings {
path: string;
constructor(path?: string) {
this.path = path || '';
}
}
export class Settings {
id: string;
lastProject?: string;
languages: Record<SupportedLanguages, LanguageSettings>;
file: string;
stdoutMaxSize: number;
autocompleteDisabled: boolean;
theme: 'light' | 'dark';
caCerts: Array<{ file: string; id: string }>;
surveyAug2022: boolean;
constructor(
file: string,
id?: string,
lastProject?: string,
languages?: Record<SupportedLanguages, LanguageSettings>,
stdoutMaxSize?: number
) {
this.id = id || newId();
this.autocompleteDisabled = false;
this.lastProject = lastProject || '';
this.languages =
languages ||
Object.keys(LANGUAGES).reduce(
(agg, lang) => ({
...agg,
[lang]: new LanguageSettings(),
}),
{}
);
this.stdoutMaxSize = stdoutMaxSize || 5000;
this.file = file;
this.caCerts = [];
this.surveyAug2022 = true;
}
}