From 45d4e6b639b627ef9926ecfbc150cdfe8c292ae1 Mon Sep 17 00:00:00 2001 From: vsrs Date: Sat, 27 Feb 2021 21:07:23 +0300 Subject: Add progress reporting --- editors/code/src/commands.ts | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'editors/code/src') 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 { const editor = ctx.activeRustEditor; if (!editor || !client) return; - const uri = editor.document.uri.toString(); - const position = client.code2ProtocolConverter.asPosition( - editor.selection.active, - ); - - const tests = await client.sendRequest(ra.relatedTests, { - textDocument: { uri: uri }, - position: position, - }); + await vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: "Looking for tests...", + cancellable: false, + }, async (_progress, _token) => { + const uri = editor.document.uri.toString(); + const position = client.code2ProtocolConverter.asPosition( + editor.selection.active, + ); - const locations: lc.Location[] = tests.map( it => { - return { - uri: it.runnable.location!.targetUri, - range: it.runnable.location!.targetSelectionRange - }; - }); + const tests = await client.sendRequest(ra.relatedTests, { + textDocument: { uri: uri }, + position: position, + }); + const locations: lc.Location[] = tests.map(it => + lc.Location.create(it.runnable.location!.targetUri, it.runnable.location!.targetSelectionRange)); - await showReferencesImpl(client, uri, position, locations); + await showReferencesImpl(client, uri, position, locations); + }); }; } -- cgit v1.2.3