about summary refs log tree commit diff
path: root/editors/code/src
diff options
context:
space:
mode:
authorvsrs <vit@conrlab.com>2021-02-27 21:07:23 +0300
committervsrs <vit@conrlab.com>2021-02-27 21:07:23 +0300
commit45d4e6b639b627ef9926ecfbc150cdfe8c292ae1 (patch)
treed5db8b6f6dec33186d40d9f70316a7b3cba3f0b4 /editors/code/src
parent669e11764430be3a098d6c8fe875d8efbb3547a3 (diff)
downloadrust-45d4e6b639b627ef9926ecfbc150cdfe8c292ae1.tar.gz
rust-45d4e6b639b627ef9926ecfbc150cdfe8c292ae1.zip
Add progress reporting
Diffstat (limited to 'editors/code/src')
-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 3512fefdf55..d43db73072f 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);
+        });
     };
 }