diff options
author | vsrs <[email protected]> | 2020-04-30 16:41:48 +0100 |
---|---|---|
committer | vsrs <[email protected]> | 2020-04-30 16:41:48 +0100 |
commit | 10836543d693675a9a2fd90130b1a816ede90fea (patch) | |
tree | eeec3b5ab836bd65082c09ab0d38c94dfa1c1fb4 /editors/code/src | |
parent | eb6f9c23e19eae9015bd859941c5e8cbf4622cba (diff) |
Fixed tsfmt and eslint errors.
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/cargo.ts | 24 | ||||
-rw-r--r-- | editors/code/src/commands/runnables.ts | 14 |
2 files changed, 19 insertions, 19 deletions
diff --git a/editors/code/src/cargo.ts b/editors/code/src/cargo.ts index 857b84d59..50f93856d 100644 --- a/editors/code/src/cargo.ts +++ b/editors/code/src/cargo.ts | |||
@@ -21,24 +21,24 @@ export class Cargo { | |||
21 | } | 21 | } |
22 | 22 | ||
23 | public async artifactsFromArgs(cargoArgs: string[]): Promise<CompilationArtifact[]> { | 23 | public async artifactsFromArgs(cargoArgs: string[]): Promise<CompilationArtifact[]> { |
24 | let artifacts: CompilationArtifact[] = []; | 24 | const artifacts: CompilationArtifact[] = []; |
25 | 25 | ||
26 | try { | 26 | try { |
27 | await this.runCargo(cargoArgs, | 27 | await this.runCargo(cargoArgs, |
28 | message => { | 28 | message => { |
29 | if (message.reason == 'compiler-artifact' && message.executable) { | 29 | if (message.reason === 'compiler-artifact' && message.executable) { |
30 | let isBinary = message.target.crate_types.includes('bin'); | 30 | const isBinary = message.target.crate_types.includes('bin'); |
31 | let isBuildScript = message.target.kind.includes('custom-build'); | 31 | const isBuildScript = message.target.kind.includes('custom-build'); |
32 | if ((isBinary && !isBuildScript) || message.profile.test) { | 32 | if ((isBinary && !isBuildScript) || message.profile.test) { |
33 | artifacts.push({ | 33 | artifacts.push({ |
34 | fileName: message.executable, | 34 | fileName: message.executable, |
35 | name: message.target.name, | 35 | name: message.target.name, |
36 | kind: message.target.kind[0], | 36 | kind: message.target.kind[0], |
37 | isTest: message.profile.test | 37 | isTest: message.profile.test |
38 | }) | 38 | }); |
39 | } | 39 | } |
40 | } | 40 | } |
41 | else if( message.reason == 'compiler-message') { | 41 | else if (message.reason === 'compiler-message') { |
42 | this.output.append(message.message.rendered); | 42 | this.output.append(message.message.rendered); |
43 | } | 43 | } |
44 | }, | 44 | }, |
@@ -62,9 +62,9 @@ export class Cargo { | |||
62 | cargoArgs.push(...extraArgs); | 62 | cargoArgs.push(...extraArgs); |
63 | } | 63 | } |
64 | 64 | ||
65 | let artifacts = await this.artifactsFromArgs(cargoArgs); | 65 | const artifacts = await this.artifactsFromArgs(cargoArgs); |
66 | 66 | ||
67 | if (artifacts.length == 0 ) { | 67 | if (artifacts.length === 0) { |
68 | throw new Error('No compilation artifacts'); | 68 | throw new Error('No compilation artifacts'); |
69 | } else if (artifacts.length > 1) { | 69 | } else if (artifacts.length > 1) { |
70 | throw new Error('Multiple compilation artifacts are not supported.'); | 70 | throw new Error('Multiple compilation artifacts are not supported.'); |
@@ -79,7 +79,7 @@ export class Cargo { | |||
79 | onStderrString: (data: string) => void | 79 | onStderrString: (data: string) => void |
80 | ): Promise<number> { | 80 | ): Promise<number> { |
81 | return new Promise<number>((resolve, reject) => { | 81 | return new Promise<number>((resolve, reject) => { |
82 | let cargo = cp.spawn('cargo', cargoArgs, { | 82 | const cargo = cp.spawn('cargo', cargoArgs, { |
83 | stdio: ['ignore', 'pipe', 'pipe'], | 83 | stdio: ['ignore', 'pipe', 'pipe'], |
84 | cwd: this.rootFolder, | 84 | cwd: this.rootFolder, |
85 | env: this.env, | 85 | env: this.env, |
@@ -92,14 +92,14 @@ export class Cargo { | |||
92 | onStderrString(chunk.toString()); | 92 | onStderrString(chunk.toString()); |
93 | }); | 93 | }); |
94 | 94 | ||
95 | let rl = readline.createInterface({ input: cargo.stdout }); | 95 | const rl = readline.createInterface({ input: cargo.stdout }); |
96 | rl.on('line', line => { | 96 | rl.on('line', line => { |
97 | let message = JSON.parse(line); | 97 | const message = JSON.parse(line); |
98 | onStdoutJson(message); | 98 | onStdoutJson(message); |
99 | }); | 99 | }); |
100 | 100 | ||
101 | cargo.on('exit', (exitCode, _) => { | 101 | cargo.on('exit', (exitCode, _) => { |
102 | if (exitCode == 0) | 102 | if (exitCode === 0) |
103 | resolve(exitCode); | 103 | resolve(exitCode); |
104 | else | 104 | else |
105 | reject(new Error(`exit code: ${exitCode}.`)); | 105 | reject(new Error(`exit code: ${exitCode}.`)); |
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts index e8035c7d2..36d309334 100644 --- a/editors/code/src/commands/runnables.ts +++ b/editors/code/src/commands/runnables.ts | |||
@@ -82,9 +82,9 @@ const debugOutput = vscode.window.createOutputChannel("Debug"); | |||
82 | 82 | ||
83 | async function getCppvsDebugConfig(config: ra.Runnable, sourceFileMap: Record<string, string>): Promise<vscode.DebugConfiguration> { | 83 | async function getCppvsDebugConfig(config: ra.Runnable, sourceFileMap: Record<string, string>): Promise<vscode.DebugConfiguration> { |
84 | debugOutput.clear(); | 84 | debugOutput.clear(); |
85 | 85 | ||
86 | let cargo = new Cargo(config.cwd || '.', debugOutput); | 86 | const cargo = new Cargo(config.cwd || '.', debugOutput); |
87 | let executable = await cargo.executableFromArgs(config.args, config.extraArgs); | 87 | const executable = await cargo.executableFromArgs(config.args, config.extraArgs); |
88 | 88 | ||
89 | // if we are here, there were no compilation errors. | 89 | // if we are here, there were no compilation errors. |
90 | return { | 90 | return { |
@@ -106,9 +106,9 @@ export function debugSingle(ctx: Ctx): Cmd { | |||
106 | const lldbId = "vadimcn.vscode-lldb"; | 106 | const lldbId = "vadimcn.vscode-lldb"; |
107 | const cpptoolsId = "ms-vscode.cpptools"; | 107 | const cpptoolsId = "ms-vscode.cpptools"; |
108 | 108 | ||
109 | let debugEngineId = ctx.config.debug.engine; | 109 | const debugEngineId = ctx.config.debug.engine; |
110 | let debugEngine = null; | 110 | let debugEngine = null; |
111 | if ( debugEngineId === "auto" ) { | 111 | if (debugEngineId === "auto") { |
112 | debugEngine = vscode.extensions.getExtension(lldbId); | 112 | debugEngine = vscode.extensions.getExtension(lldbId); |
113 | if (!debugEngine) { | 113 | if (!debugEngine) { |
114 | debugEngine = vscode.extensions.getExtension(cpptoolsId); | 114 | debugEngine = vscode.extensions.getExtension(cpptoolsId); |
@@ -120,11 +120,11 @@ export function debugSingle(ctx: Ctx): Cmd { | |||
120 | 120 | ||
121 | if (!debugEngine) { | 121 | if (!debugEngine) { |
122 | vscode.window.showErrorMessage(`Install [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=${lldbId})` | 122 | vscode.window.showErrorMessage(`Install [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=${lldbId})` |
123 | + ` or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=${cpptoolsId}) extension for debugging.`); | 123 | + ` or [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=${cpptoolsId}) extension for debugging.`); |
124 | return; | 124 | return; |
125 | } | 125 | } |
126 | 126 | ||
127 | const debugConfig = lldbId == debugEngine.id | 127 | const debugConfig = lldbId === debugEngine.id |
128 | ? getLldbDebugConfig(config, ctx.config.debug.sourceFileMap) | 128 | ? getLldbDebugConfig(config, ctx.config.debug.sourceFileMap) |
129 | : await getCppvsDebugConfig(config, ctx.config.debug.sourceFileMap); | 129 | : await getCppvsDebugConfig(config, ctx.config.debug.sourceFileMap); |
130 | 130 | ||