mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Fixed tsfmt and eslint errors.
This commit is contained in:
parent
eb6f9c23e1
commit
10836543d6
2 changed files with 19 additions and 19 deletions
|
@ -21,24 +21,24 @@ export class Cargo {
|
|||
}
|
||||
|
||||
public async artifactsFromArgs(cargoArgs: string[]): Promise<CompilationArtifact[]> {
|
||||
let artifacts: CompilationArtifact[] = [];
|
||||
const artifacts: CompilationArtifact[] = [];
|
||||
|
||||
try {
|
||||
await this.runCargo(cargoArgs,
|
||||
message => {
|
||||
if (message.reason == 'compiler-artifact' && message.executable) {
|
||||
let isBinary = message.target.crate_types.includes('bin');
|
||||
let isBuildScript = message.target.kind.includes('custom-build');
|
||||
if (message.reason === 'compiler-artifact' && message.executable) {
|
||||
const isBinary = message.target.crate_types.includes('bin');
|
||||
const isBuildScript = message.target.kind.includes('custom-build');
|
||||
if ((isBinary && !isBuildScript) || message.profile.test) {
|
||||
artifacts.push({
|
||||
fileName: message.executable,
|
||||
name: message.target.name,
|
||||
kind: message.target.kind[0],
|
||||
isTest: message.profile.test
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
else if( message.reason == 'compiler-message') {
|
||||
else if (message.reason === 'compiler-message') {
|
||||
this.output.append(message.message.rendered);
|
||||
}
|
||||
},
|
||||
|
@ -62,9 +62,9 @@ export class Cargo {
|
|||
cargoArgs.push(...extraArgs);
|
||||
}
|
||||
|
||||
let artifacts = await this.artifactsFromArgs(cargoArgs);
|
||||
const artifacts = await this.artifactsFromArgs(cargoArgs);
|
||||
|
||||
if (artifacts.length == 0 ) {
|
||||
if (artifacts.length === 0) {
|
||||
throw new Error('No compilation artifacts');
|
||||
} else if (artifacts.length > 1) {
|
||||
throw new Error('Multiple compilation artifacts are not supported.');
|
||||
|
@ -79,7 +79,7 @@ export class Cargo {
|
|||
onStderrString: (data: string) => void
|
||||
): Promise<number> {
|
||||
return new Promise<number>((resolve, reject) => {
|
||||
let cargo = cp.spawn('cargo', cargoArgs, {
|
||||
const cargo = cp.spawn('cargo', cargoArgs, {
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
cwd: this.rootFolder,
|
||||
env: this.env,
|
||||
|
@ -92,14 +92,14 @@ export class Cargo {
|
|||
onStderrString(chunk.toString());
|
||||
});
|
||||
|
||||
let rl = readline.createInterface({ input: cargo.stdout });
|
||||
const rl = readline.createInterface({ input: cargo.stdout });
|
||||
rl.on('line', line => {
|
||||
let message = JSON.parse(line);
|
||||
const message = JSON.parse(line);
|
||||
onStdoutJson(message);
|
||||
});
|
||||
|
||||
cargo.on('exit', (exitCode, _) => {
|
||||
if (exitCode == 0)
|
||||
if (exitCode === 0)
|
||||
resolve(exitCode);
|
||||
else
|
||||
reject(new Error(`exit code: ${exitCode}.`));
|
||||
|
|
|
@ -83,8 +83,8 @@ const debugOutput = vscode.window.createOutputChannel("Debug");
|
|||
async function getCppvsDebugConfig(config: ra.Runnable, sourceFileMap: Record<string, string>): Promise<vscode.DebugConfiguration> {
|
||||
debugOutput.clear();
|
||||
|
||||
let cargo = new Cargo(config.cwd || '.', debugOutput);
|
||||
let executable = await cargo.executableFromArgs(config.args, config.extraArgs);
|
||||
const cargo = new Cargo(config.cwd || '.', debugOutput);
|
||||
const executable = await cargo.executableFromArgs(config.args, config.extraArgs);
|
||||
|
||||
// if we are here, there were no compilation errors.
|
||||
return {
|
||||
|
@ -106,7 +106,7 @@ export function debugSingle(ctx: Ctx): Cmd {
|
|||
const lldbId = "vadimcn.vscode-lldb";
|
||||
const cpptoolsId = "ms-vscode.cpptools";
|
||||
|
||||
let debugEngineId = ctx.config.debug.engine;
|
||||
const debugEngineId = ctx.config.debug.engine;
|
||||
let debugEngine = null;
|
||||
if (debugEngineId === "auto") {
|
||||
debugEngine = vscode.extensions.getExtension(lldbId);
|
||||
|
@ -124,7 +124,7 @@ export function debugSingle(ctx: Ctx): Cmd {
|
|||
return;
|
||||
}
|
||||
|
||||
const debugConfig = lldbId == debugEngine.id
|
||||
const debugConfig = lldbId === debugEngine.id
|
||||
? getLldbDebugConfig(config, ctx.config.debug.sourceFileMap)
|
||||
: await getCppvsDebugConfig(config, ctx.config.debug.sourceFileMap);
|
||||
|
||||
|
|
Loading…
Reference in a new issue