From 06c02021a3d4a4d27d7c58bf54757588a28653cc Mon Sep 17 00:00:00 2001 From: Sahandevs Date: Sun, 7 Feb 2021 21:15:13 +0330 Subject: remove unnecessary --- editors/code/src/client.ts | 2 +- editors/code/src/debug.ts | 6 +++--- editors/code/src/run.ts | 2 +- editors/code/src/snippets.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'editors/code') diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index 539e487ec..e436eefb9 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts @@ -11,7 +11,7 @@ export interface Env { } function renderCommand(cmd: ra.CommandLink) { - return `[${cmd.title}](command:${cmd.command}?${encodeURIComponent(JSON.stringify(cmd.arguments))} '${cmd.tooltip!}')`; + return `[${cmd.title}](command:${cmd.command}?${encodeURIComponent(JSON.stringify(cmd.arguments))} '${cmd.tooltip}')`; } function renderHoverActions(actions: ra.CommandLinkGroup[]): vscode.MarkdownString { diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts index 925126a16..874b858d9 100644 --- a/editors/code/src/debug.ts +++ b/editors/code/src/debug.ts @@ -87,11 +87,11 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise 1; - const firstWorkspace = vscode.workspace.workspaceFolders![0]; // folder exists or RA is not active. + const isMultiFolderWorkspace = vscode.workspace.workspaceFolders.length > 1; + const firstWorkspace = vscode.workspace.workspaceFolders[0]; // folder exists or RA is not active. const workspace = !isMultiFolderWorkspace || !runnable.args.workspaceRoot ? firstWorkspace : - vscode.workspace.workspaceFolders!.find(w => runnable.args.workspaceRoot?.includes(w.uri.fsPath)) || firstWorkspace; + vscode.workspace.workspaceFolders.find(w => runnable.args.workspaceRoot?.includes(w.uri.fsPath)) || firstWorkspace; const wsFolder = path.normalize(workspace.uri.fsPath); const workspaceQualifier = isMultiFolderWorkspace ? `:${workspace.name}` : ''; diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts index 17573cd82..77f9a0991 100644 --- a/editors/code/src/run.ts +++ b/editors/code/src/run.ts @@ -145,7 +145,7 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise overrideCargo: runnable.args.overrideCargo, }; - const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate() + 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; diff --git a/editors/code/src/snippets.ts b/editors/code/src/snippets.ts index fee736e7d..7b7e528f6 100644 --- a/editors/code/src/snippets.ts +++ b/editors/code/src/snippets.ts @@ -62,7 +62,7 @@ function parseSnippet(snip: string): [string, [number, number]] | undefined { const m = snip.match(/\$(0|\{0:([^}]*)\})/); if (!m) return undefined; const placeholder = m[2] ?? ""; - const range: [number, number] = [m.index!!, placeholder.length]; + const range: [number, number] = [m.index, placeholder.length]; const insert = snip.replace(m[0], placeholder); return [insert, range]; } -- cgit v1.2.3