mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
editor/code: Enable noUncheckedIndexedAccess
ts option
https://www.typescriptlang.org/tsconfig#noUncheckedIndexedAccess
This commit is contained in:
parent
bb35d8fa8e
commit
72a3883a71
14 changed files with 124 additions and 52 deletions
|
@ -4,6 +4,8 @@ import * as path from "path";
|
|||
import * as readline from "readline";
|
||||
import * as vscode from "vscode";
|
||||
import { execute, log, memoizeAsync } from "./util";
|
||||
import { unwrapNullable } from "./nullable";
|
||||
import { unwrapUndefinable } from "./undefinable";
|
||||
|
||||
interface CompilationArtifact {
|
||||
fileName: string;
|
||||
|
@ -93,7 +95,8 @@ export class Cargo {
|
|||
throw new Error("Multiple compilation artifacts are not supported.");
|
||||
}
|
||||
|
||||
return artifacts[0].fileName;
|
||||
const artifact = unwrapUndefinable(artifacts[0]);
|
||||
return artifact.fileName;
|
||||
}
|
||||
|
||||
private async runCargo(
|
||||
|
@ -142,7 +145,9 @@ export async function getRustcId(dir: string): Promise<string> {
|
|||
const data = await execute(`${rustcPath} -V -v`, { cwd: dir });
|
||||
const rx = /commit-hash:\s(.*)$/m;
|
||||
|
||||
return rx.exec(data)![1];
|
||||
const result = unwrapNullable(rx.exec(data));
|
||||
const first = unwrapUndefinable(result[1]);
|
||||
return first;
|
||||
}
|
||||
|
||||
/** Mirrors `toolchain::cargo()` implementation */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue