@@ -7,7 +7,7 @@ import type { CtxInit } from "./ctx";
77import { makeDebugConfig } from "./debug" ;
88import type { Config } from "./config" ;
99import type { LanguageClient } from "vscode-languageclient/node" ;
10- import { unwrapUndefinable , type RustEditor } from "./util" ;
10+ import { log , unwrapUndefinable , type RustEditor } from "./util" ;
1111
1212const quickPickButtons = [
1313 { iconPath : new vscode . ThemeIcon ( "save" ) , tooltip : "Save as a launch.json configuration." } ,
@@ -19,7 +19,7 @@ export async function selectRunnable(
1919 debuggeeOnly = false ,
2020 showButtons : boolean = true ,
2121) : Promise < RunnableQuickPick | undefined > {
22- const editor = ctx . activeRustEditor ;
22+ const editor = ctx . activeRustEditor ?? ctx . activeCargoTomlEditor ;
2323 if ( ! editor ) return ;
2424
2525 // show a placeholder while we get the runnables from the server
@@ -175,10 +175,17 @@ async function getRunnables(
175175 uri : editor . document . uri . toString ( ) ,
176176 } ;
177177
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+ } ) ;
182189 const items : RunnableQuickPick [ ] = [ ] ;
183190 if ( prevRunnable ) {
184191 items . push ( prevRunnable ) ;
0 commit comments