aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorSahandevs <[email protected]>2021-02-07 18:36:16 +0000
committerSahandevs <[email protected]>2021-02-07 18:36:16 +0000
commit2f82a84d2a06e24296bdbc4e8f50131539d5a749 (patch)
tree302b1d5a48f84d1b41ff9d0296597fc701bd6558 /editors
parent3a0234d60f924cdec4a3fa2fccfe7ed85567f0bc (diff)
fix errors
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/client.ts2
-rw-r--r--editors/code/src/debug.ts10
-rw-r--r--editors/code/src/run.ts3
-rw-r--r--editors/code/src/snippets.ts2
4 files changed, 11 insertions, 6 deletions
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts
index 6f2d48d1d..aec5c70c0 100644
--- a/editors/code/src/client.ts
+++ b/editors/code/src/client.ts
@@ -138,7 +138,7 @@ export function createClient(serverPath: string, cwd: string, extraEnv: Env): lc
138 command: "rust-analyzer.applyActionGroup", 138 command: "rust-analyzer.applyActionGroup",
139 title: "", 139 title: "",
140 arguments: [items.map((item) => { 140 arguments: [items.map((item) => {
141 return { label: item.title, arguments: item.command.arguments[0] }; 141 return { label: item.title, arguments: item.command!.arguments![0] };
142 })], 142 })],
143 }; 143 };
144 144
diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts
index 3c113e46e..c72a7b278 100644
--- a/editors/code/src/debug.ts
+++ b/editors/code/src/debug.ts
@@ -87,12 +87,14 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise<v
87 if (ctx.config.debug.openDebugPane) { 87 if (ctx.config.debug.openDebugPane) {
88 debugOutput.show(true); 88 debugOutput.show(true);
89 } 89 }
90 90 // folder exists or RA is not active.
91 const isMultiFolderWorkspace = vscode.workspace.workspaceFolders.length > 1; 91 // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
92 const firstWorkspace = vscode.workspace.workspaceFolders[0]; // folder exists or RA is not active. 92 const workspaceFolders = vscode.workspace.workspaceFolders!;
93 const isMultiFolderWorkspace = workspaceFolders.length > 1;
94 const firstWorkspace = workspaceFolders[0];
93 const workspace = !isMultiFolderWorkspace || !runnable.args.workspaceRoot ? 95 const workspace = !isMultiFolderWorkspace || !runnable.args.workspaceRoot ?
94 firstWorkspace : 96 firstWorkspace :
95 vscode.workspace.workspaceFolders.find(w => runnable.args.workspaceRoot?.includes(w.uri.fsPath)) || firstWorkspace; 97 workspaceFolders.find(w => runnable.args.workspaceRoot?.includes(w.uri.fsPath)) || firstWorkspace;
96 98
97 const wsFolder = path.normalize(workspace.uri.fsPath); 99 const wsFolder = path.normalize(workspace.uri.fsPath);
98 const workspaceQualifier = isMultiFolderWorkspace ? `:${workspace.name}` : ''; 100 const workspaceQualifier = isMultiFolderWorkspace ? `:${workspace.name}` : '';
diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts
index 4f0d2884b..331f85cd3 100644
--- a/editors/code/src/run.ts
+++ b/editors/code/src/run.ts
@@ -146,7 +146,8 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise
146 overrideCargo: runnable.args.overrideCargo, 146 overrideCargo: runnable.args.overrideCargo,
147 }; 147 };
148 148
149 const target = vscode.workspace.workspaceFolders[0]; // safe, see main activate() 149 // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
150 const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate()
150 const cargoTask = await tasks.buildCargoTask(target, definition, runnable.label, args, config.cargoRunner, true); 151 const cargoTask = await tasks.buildCargoTask(target, definition, runnable.label, args, config.cargoRunner, true);
151 cargoTask.presentationOptions.clear = true; 152 cargoTask.presentationOptions.clear = true;
152 153
diff --git a/editors/code/src/snippets.ts b/editors/code/src/snippets.ts
index 7b7e528f6..dc53ebe2e 100644
--- a/editors/code/src/snippets.ts
+++ b/editors/code/src/snippets.ts
@@ -62,6 +62,8 @@ function parseSnippet(snip: string): [string, [number, number]] | undefined {
62 const m = snip.match(/\$(0|\{0:([^}]*)\})/); 62 const m = snip.match(/\$(0|\{0:([^}]*)\})/);
63 if (!m) return undefined; 63 if (!m) return undefined;
64 const placeholder = m[2] ?? ""; 64 const placeholder = m[2] ?? "";
65 if (m.index == null)
66 return undefined;
65 const range: [number, number] = [m.index, placeholder.length]; 67 const range: [number, number] = [m.index, placeholder.length];
66 const insert = snip.replace(m[0], placeholder); 68 const insert = snip.replace(m[0], placeholder);
67 return [insert, range]; 69 return [insert, range];