aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands.ts
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/code/src/commands.ts
parent669e11764430be3a098d6c8fe875d8efbb3547a3 (diff)
Add progress reporting
Diffstat (limited to 'editors/code/src/commands.ts')
-rw-r--r--editors/code/src/commands.ts33
1 files changed, 17 insertions, 16 deletions
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