mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +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
|
@ -6,6 +6,7 @@ import * as ra from "./lsp_ext";
|
|||
import { Cargo, getRustcId, getSysroot } from "./toolchain";
|
||||
import { Ctx } from "./ctx";
|
||||
import { prepareEnv } from "./run";
|
||||
import { unwrapUndefinable } from "./undefinable";
|
||||
|
||||
const debugOutput = vscode.window.createOutputChannel("Debug");
|
||||
type DebugConfigProvider = (
|
||||
|
@ -105,12 +106,13 @@ async function getDebugConfiguration(
|
|||
const workspaceFolders = vscode.workspace.workspaceFolders!;
|
||||
const isMultiFolderWorkspace = workspaceFolders.length > 1;
|
||||
const firstWorkspace = workspaceFolders[0];
|
||||
const workspace =
|
||||
const maybeWorkspace =
|
||||
!isMultiFolderWorkspace || !runnable.args.workspaceRoot
|
||||
? firstWorkspace
|
||||
: workspaceFolders.find((w) => runnable.args.workspaceRoot?.includes(w.uri.fsPath)) ||
|
||||
firstWorkspace;
|
||||
|
||||
const workspace = unwrapUndefinable(maybeWorkspace);
|
||||
const wsFolder = path.normalize(workspace.uri.fsPath);
|
||||
const workspaceQualifier = isMultiFolderWorkspace ? `:${workspace.name}` : "";
|
||||
function simplifyPath(p: string): string {
|
||||
|
@ -130,12 +132,8 @@ async function getDebugConfiguration(
|
|||
sourceFileMap[`/rustc/${commitHash}/`] = rustlib;
|
||||
}
|
||||
|
||||
const debugConfig = knownEngines[debugEngine.id](
|
||||
runnable,
|
||||
simplifyPath(executable),
|
||||
env,
|
||||
sourceFileMap
|
||||
);
|
||||
const provider = unwrapUndefinable(knownEngines[debugEngine.id]);
|
||||
const debugConfig = provider(runnable, simplifyPath(executable), env, sourceFileMap);
|
||||
if (debugConfig.type in debugOptions.engineSettings) {
|
||||
const settingsMap = (debugOptions.engineSettings as any)[debugConfig.type];
|
||||
for (var key in settingsMap) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue