aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/config.ts
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-02-14 21:04:50 +0000
committerVeetaha <[email protected]>2020-02-14 21:04:50 +0000
commit4fb427743c27c63a4aa3ccd54c488b22d4308bc2 (patch)
tree45dfb0fca0912d45e83fd33b1eb065898febec2a /editors/code/src/config.ts
parentfd37151ade9948398e863c38418fb4f0d0acdfa7 (diff)
vscode: moved to getters as per matklad
Diffstat (limited to 'editors/code/src/config.ts')
-rw-r--r--editors/code/src/config.ts40
1 files changed, 17 insertions, 23 deletions
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index 349f80278..3ce669330 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -68,17 +68,14 @@ export class Config {
68 * `platform` on GitHub releases. (It is also stored under the same name when 68 * `platform` on GitHub releases. (It is also stored under the same name when
69 * downloaded by the extension). 69 * downloaded by the extension).
70 */ 70 */
71 private static prebuiltLangServerFileName( 71 get prebuiltLangServerFileName(): null | string {
72 platform: NodeJS.Platform,
73 arch: string
74 ): null | string {
75 // See possible `arch` values here: 72 // See possible `arch` values here:
76 // https://nodejs.org/api/process.html#process_process_arch 73 // https://nodejs.org/api/process.html#process_process_arch
77 74
78 switch (platform) { 75 switch (process.platform) {
79 76
80 case "linux": { 77 case "linux": {
81 switch (arch) { 78 switch (process.arch) {
82 case "arm": 79 case "arm":
83 case "arm64": return null; 80 case "arm64": return null;
84 81
@@ -101,7 +98,7 @@ export class Config {
101 } 98 }
102 } 99 }
103 100
104 langServerBinarySource(): null | BinarySource { 101 get langServerBinarySource(): null | BinarySource {
105 const langServerPath = RA_LSP_DEBUG ?? this.cfg.get<null | string>("raLspServerPath"); 102 const langServerPath = RA_LSP_DEBUG ?? this.cfg.get<null | string>("raLspServerPath");
106 103
107 if (langServerPath) { 104 if (langServerPath) {
@@ -111,9 +108,7 @@ export class Config {
111 }; 108 };
112 } 109 }
113 110
114 const prebuiltBinaryName = Config.prebuiltLangServerFileName( 111 const prebuiltBinaryName = this.prebuiltLangServerFileName;
115 process.platform, process.arch
116 );
117 112
118 if (!prebuiltBinaryName) return null; 113 if (!prebuiltBinaryName) return null;
119 114
@@ -131,17 +126,16 @@ export class Config {
131 // We don't do runtime config validation here for simplicity. More on stackoverflow: 126 // We don't do runtime config validation here for simplicity. More on stackoverflow:
132 // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension 127 // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension
133 128
134 // FIXME: add codegen for primitive configurations 129 get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; }
135 highlightingOn() { return this.cfg.get("highlightingOn") as boolean; } 130 get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; }
136 rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; } 131 get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; }
137 lruCapacity() { return this.cfg.get("lruCapacity") as null | number; } 132 get displayInlayHints() { return this.cfg.get("displayInlayHints") as boolean; }
138 displayInlayHints() { return this.cfg.get("displayInlayHints") as boolean; } 133 get maxInlayHintLength() { return this.cfg.get("maxInlayHintLength") as number; }
139 maxInlayHintLength() { return this.cfg.get("maxInlayHintLength") as number; } 134 get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; }
140 excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; } 135 get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; }
141 useClientWatching() { return this.cfg.get("useClientWatching") as boolean; } 136 get featureFlags() { return this.cfg.get("featureFlags") as Record<string, boolean>; }
142 featureFlags() { return this.cfg.get("featureFlags") as Record<string, boolean>; } 137
143 138 get cargoWatchOptions(): CargoWatchOptions {
144 cargoWatchOptions(): CargoWatchOptions {
145 return { 139 return {
146 enable: this.cfg.get("cargo-watch.enable") as boolean, 140 enable: this.cfg.get("cargo-watch.enable") as boolean,
147 arguments: this.cfg.get("cargo-watch.arguments") as string[], 141 arguments: this.cfg.get("cargo-watch.arguments") as string[],
@@ -150,7 +144,7 @@ export class Config {
150 }; 144 };
151 } 145 }
152 146
153 cargoFeatures(): CargoFeatures { 147 get cargoFeatures(): CargoFeatures {
154 return { 148 return {
155 noDefaultFeatures: this.cfg.get("cargoFeatures.noDefaultFeatures") as boolean, 149 noDefaultFeatures: this.cfg.get("cargoFeatures.noDefaultFeatures") as boolean,
156 allFeatures: this.cfg.get("cargoFeatures.allFeatures") as boolean, 150 allFeatures: this.cfg.get("cargoFeatures.allFeatures") as boolean,
@@ -159,5 +153,5 @@ export class Config {
159 } 153 }
160 154
161 // for internal use 155 // for internal use
162 withSysroot() { return this.cfg.get("withSysroot", false); } 156 get withSysroot() { return this.cfg.get("withSysroot", false); }
163} 157}