aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorvsrs <[email protected]>2021-02-27 18:07:23 +0000
committervsrs <[email protected]>2021-02-27 18:07:23 +0000
commit45d4e6b639b627ef9926ecfbc150cdfe8c292ae1 (patch)
treed5db8b6f6dec33186d40d9f70316a7b3cba3f0b4 /editors
parent669e11764430be3a098d6c8fe875d8efbb3547a3 (diff)
Add progress reporting
Diffstat (limited to 'editors')
-rw-r--r--editors/code/package.json9
-rw-r--r--editors/code/src/commands.ts33
2 files changed, 25 insertions, 17 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index 43ea1225a..7ee5d82ad 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -1164,7 +1164,14 @@
1164 "command": "rust-analyzer.openCargoToml", 1164 "command": "rust-analyzer.openCargoToml",
1165 "when": "inRustProject" 1165 "when": "inRustProject"
1166 } 1166 }
1167 ],
1168 "editor/context": [
1169 {
1170 "command": "rust-analyzer.peekTests",
1171 "when": "inRustProject",
1172 "group": "navigation@1000"
1173 }
1167 ] 1174 ]
1168 } 1175 }
1169 } 1176 }
1170} 1177} \ No newline at end of file
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts
index 3512fefdf..d43db7307 100644
--- a/editors/code/src/commands.ts
+++ b/editors/code/src/commands.ts
@@ -566,24 +566,25 @@ export function peekTests(ctx: Ctx): Cmd {
566 const editor = ctx.activeRustEditor; 566 const editor = ctx.activeRustEditor;
567 if (!editor || !client) return; 567 if (!editor || !client) return;
568 568
569 const uri = editor.document.uri.toString(); 569 await vscode.window.withProgress({
570 const position = client.code2ProtocolConverter.asPosition( 570 location: vscode.ProgressLocation.Notification,
571 editor.selection.active, 571 title: "Looking for tests...",
572 ); 572 cancellable: false,
573 573 }, async (_progress, _token) => {
574 const tests = await client.sendRequest(ra.relatedTests, { 574 const uri = editor.document.uri.toString();
575 textDocument: { uri: uri }, 575 const position = client.code2ProtocolConverter.asPosition(
576 position: position, 576 editor.selection.active,
577 }); 577 );
578 578
579 const locations: lc.Location[] = tests.map( it => { 579 const tests = await client.sendRequest(ra.relatedTests, {
580 return { 580 textDocument: { uri: uri },
581 uri: it.runnable.location!.targetUri, 581 position: position,
582 range: it.runnable.location!.targetSelectionRange 582 });
583 }; 583 const locations: lc.Location[] = tests.map(it =>
584 }); 584 lc.Location.create(it.runnable.location!.targetUri, it.runnable.location!.targetSelectionRange));
585 585
586 await showReferencesImpl(client, uri, position, locations); 586 await showReferencesImpl(client, uri, position, locations);
587 });
587 }; 588 };
588} 589}
589 590