mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
fix errors
This commit is contained in:
parent
3a0234d60f
commit
2f82a84d2a
@ -138,7 +138,7 @@ export function createClient(serverPath: string, cwd: string, extraEnv: Env): lc
|
||||
command: "rust-analyzer.applyActionGroup",
|
||||
title: "",
|
||||
arguments: [items.map((item) => {
|
||||
return { label: item.title, arguments: item.command.arguments[0] };
|
||||
return { label: item.title, arguments: item.command!.arguments![0] };
|
||||
})],
|
||||
};
|
||||
|
||||
|
@ -87,12 +87,14 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise<v
|
||||
if (ctx.config.debug.openDebugPane) {
|
||||
debugOutput.show(true);
|
||||
}
|
||||
|
||||
const isMultiFolderWorkspace = vscode.workspace.workspaceFolders.length > 1;
|
||||
const firstWorkspace = vscode.workspace.workspaceFolders[0]; // folder exists or RA is not active.
|
||||
// folder exists or RA is not active.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
const workspaceFolders = vscode.workspace.workspaceFolders!;
|
||||
const isMultiFolderWorkspace = workspaceFolders.length > 1;
|
||||
const firstWorkspace = workspaceFolders[0];
|
||||
const workspace = !isMultiFolderWorkspace || !runnable.args.workspaceRoot ?
|
||||
firstWorkspace :
|
||||
vscode.workspace.workspaceFolders.find(w => runnable.args.workspaceRoot?.includes(w.uri.fsPath)) || firstWorkspace;
|
||||
workspaceFolders.find(w => runnable.args.workspaceRoot?.includes(w.uri.fsPath)) || firstWorkspace;
|
||||
|
||||
const wsFolder = path.normalize(workspace.uri.fsPath);
|
||||
const workspaceQualifier = isMultiFolderWorkspace ? `:${workspace.name}` : '';
|
||||
|
@ -146,7 +146,8 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise
|
||||
overrideCargo: runnable.args.overrideCargo,
|
||||
};
|
||||
|
||||
const target = vscode.workspace.workspaceFolders[0]; // safe, see main activate()
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||
const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate()
|
||||
const cargoTask = await tasks.buildCargoTask(target, definition, runnable.label, args, config.cargoRunner, true);
|
||||
cargoTask.presentationOptions.clear = true;
|
||||
|
||||
|
@ -62,6 +62,8 @@ function parseSnippet(snip: string): [string, [number, number]] | undefined {
|
||||
const m = snip.match(/\$(0|\{0:([^}]*)\})/);
|
||||
if (!m) return undefined;
|
||||
const placeholder = m[2] ?? "";
|
||||
if (m.index == null)
|
||||
return undefined;
|
||||
const range: [number, number] = [m.index, placeholder.length];
|
||||
const insert = snip.replace(m[0], placeholder);
|
||||
return [insert, range];
|
||||
|
Loading…
Reference in New Issue
Block a user