@@ -7,7 +7,7 @@ import type { CtxInit } from "./ctx";
7
7
import { makeDebugConfig } from "./debug" ;
8
8
import type { Config } from "./config" ;
9
9
import type { LanguageClient } from "vscode-languageclient/node" ;
10
- import { unwrapUndefinable , type RustEditor } from "./util" ;
10
+ import { log , unwrapUndefinable , type RustEditor } from "./util" ;
11
11
12
12
const quickPickButtons = [
13
13
{ iconPath : new vscode . ThemeIcon ( "save" ) , tooltip : "Save as a launch.json configuration." } ,
@@ -19,7 +19,7 @@ export async function selectRunnable(
19
19
debuggeeOnly = false ,
20
20
showButtons : boolean = true ,
21
21
) : Promise < RunnableQuickPick | undefined > {
22
- const editor = ctx . activeRustEditor ;
22
+ const editor = ctx . activeRustEditor ?? ctx . activeCargoTomlEditor ;
23
23
if ( ! editor ) return ;
24
24
25
25
// show a placeholder while we get the runnables from the server
@@ -175,10 +175,17 @@ async function getRunnables(
175
175
uri : editor . document . uri . toString ( ) ,
176
176
} ;
177
177
178
- const runnables = await client . sendRequest ( ra . runnables , {
179
- textDocument,
180
- position : client . code2ProtocolConverter . asPosition ( editor . selection . active ) ,
181
- } ) ;
178
+ const runnables = await client
179
+ . sendRequest ( ra . runnables , {
180
+ textDocument,
181
+ position : client . code2ProtocolConverter . asPosition ( editor . selection . active ) ,
182
+ } )
183
+ . catch ( ( err ) => {
184
+ // If this command is run for a virtual manifest at the workspace root, then this request
185
+ // will fail as we do not watch this file.
186
+ log . error ( `${ err } ` ) ;
187
+ return [ ] ;
188
+ } ) ;
182
189
const items : RunnableQuickPick [ ] = [ ] ;
183
190
if ( prevRunnable ) {
184
191
items . push ( prevRunnable ) ;
0 commit comments