about summary refs log tree commit diff
path: root/editors/code/src/toolchain.ts
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2022-07-17 17:38:56 +0200
committerBruno Ortiz <brunortiz11@gmail.com>2023-05-02 10:56:13 -0300
commitaf999f152bcec9a0fb9c792bbb14eba093ddeec8 (patch)
tree8ddbc1d9f350b28d01af0bc09650e173bbe799ab /editors/code/src/toolchain.ts
parentd1721b11e923df58489578b48fbc15105e960aa4 (diff)
downloadrust-af999f152bcec9a0fb9c792bbb14eba093ddeec8.tar.gz
rust-af999f152bcec9a0fb9c792bbb14eba093ddeec8.zip
Reformat VSCode client code
Diffstat (limited to 'editors/code/src/toolchain.ts')
-rw-r--r--editors/code/src/toolchain.ts36
1 files changed, 15 insertions, 21 deletions
diff --git a/editors/code/src/toolchain.ts b/editors/code/src/toolchain.ts
index 5fc5d0ddbdf..2d23e8c35ed 100644
--- a/editors/code/src/toolchain.ts
+++ b/editors/code/src/toolchain.ts
@@ -103,12 +103,12 @@ export class Cargo {
         return await new Promise((resolve, reject) => {
             const crates: Crate[] = [];
 
-            const cargo = cp.spawn(pathToCargo, ['tree', '--prefix', 'none'], {
-                stdio: ['ignore', 'pipe', 'pipe'],
-                cwd: this.rootFolder
+            const cargo = cp.spawn(pathToCargo, ["tree", "--prefix", "none"], {
+                stdio: ["ignore", "pipe", "pipe"],
+                cwd: this.rootFolder,
             });
             const rl = readline.createInterface({ input: cargo.stdout });
-            rl.on('line', line => {
+            rl.on("line", (line) => {
                 const match = line.match(TREE_LINE_PATTERN);
                 if (match) {
                     const name = match[1];
@@ -121,18 +121,15 @@ export class Cargo {
                     crates.push({ name, version });
                 }
             });
-            cargo.on('exit', (exitCode, _) => {
-                if (exitCode === 0)
-                    resolve(crates);
-                else
-                    reject(new Error(`exit code: ${exitCode}.`));
+            cargo.on("exit", (exitCode, _) => {
+                if (exitCode === 0) resolve(crates);
+                else reject(new Error(`exit code: ${exitCode}.`));
             });
-
         });
     }
 
     private shouldIgnore(extraInfo: string): boolean {
-        return extraInfo !== undefined && (extraInfo === '*' || path.isAbsolute(extraInfo));
+        return extraInfo !== undefined && (extraInfo === "*" || path.isAbsolute(extraInfo));
     }
 
     private async runCargo(
@@ -169,26 +166,23 @@ export class Cargo {
 export async function activeToolchain(): Promise<string> {
     const pathToRustup = await rustupPath();
     return await new Promise((resolve, reject) => {
-        const execution = cp.spawn(pathToRustup, ['show', 'active-toolchain'], {
-            stdio: ['ignore', 'pipe', 'pipe'],
-            cwd: os.homedir()
+        const execution = cp.spawn(pathToRustup, ["show", "active-toolchain"], {
+            stdio: ["ignore", "pipe", "pipe"],
+            cwd: os.homedir(),
         });
         const rl = readline.createInterface({ input: execution.stdout });
 
         let currToolchain: string | undefined = undefined;
-        rl.on('line', line => {
+        rl.on("line", (line) => {
             const match = line.match(TOOLCHAIN_PATTERN);
             if (match) {
                 currToolchain = match[1];
             }
         });
-        execution.on('exit', (exitCode, _) => {
-            if (exitCode === 0 && currToolchain)
-                resolve(currToolchain);
-            else
-                reject(new Error(`exit code: ${exitCode}.`));
+        execution.on("exit", (exitCode, _) => {
+            if (exitCode === 0 && currToolchain) resolve(currToolchain);
+            else reject(new Error(`exit code: ${exitCode}.`));
         });
-
     });
 }