@@ -58,6 +58,7 @@ import {
5858 RustRoverIcon ,
5959 WebStormIcon ,
6060} from "../JetBrainsIcons" ;
61+ import { announce } from "~/lib/announce" ;
6162import { cn , isMacPlatform , isWindowsPlatform } from "~/lib/utils" ;
6263import { shellEnvironment } from "~/state/shell" ;
6364import { useAtomCommand } from "~/state/use-atom-command" ;
@@ -240,29 +241,28 @@ export const OpenInPicker = memo(function OpenInPicker({
240241 const effectiveEditors = remote . mode === "local-exec" ? availableEditors : remoteCapableEditors ;
241242 const [ preferredEditor , setPreferredEditor ] = usePreferredEditor ( effectiveEditors ) ;
242243
243- const openInEditor = ( editorId : EditorId | null ) => {
244- if ( ! openInCwd ) return ;
244+ const openInEditor = async ( editorId : EditorId | null ) : Promise < boolean > => {
245+ if ( ! openInCwd ) return false ;
245246 const editor = editorId ?? preferredEditor ;
246- if ( ! editor ) return ;
247- if ( remote . mode === "remote-unavailable" ) return ;
247+ if ( ! editor ) return false ;
248+ if ( remote . mode === "remote-unavailable" ) return false ;
248249 if ( remote . mode === "remote-links" ) {
249250 const url = buildRemoteOpenUrl ( {
250251 editor,
251252 ...remote . host ,
252253 absolutePath : openInCwd ,
253254 isFile : openInCwdIsFile ,
254255 } ) ;
255- if ( url === undefined ) return ;
256+ if ( url === undefined ) return false ;
256257 // Only record hint-seen/preferred when the shell actually accepted
257258 // the URL (an older desktop build can refuse the editor scheme).
258- void openRemoteEditorUrl ( url ) . then ( ( opened ) => {
259- if ( ! opened ) return ;
260- markRemoteHintSeen ( ) ;
261- setPreferredEditor ( editor ) ;
262- } ) ;
263- return ;
259+ const opened = await openRemoteEditorUrl ( url ) ;
260+ if ( ! opened ) return false ;
261+ markRemoteHintSeen ( ) ;
262+ setPreferredEditor ( editor ) ;
263+ return true ;
264264 }
265- if ( ! readEnvironmentScope ( environmentId , AuthOrchestrationOperateScope ) ) return ;
265+ if ( ! readEnvironmentScope ( environmentId , AuthOrchestrationOperateScope ) ) return false ;
266266 const result = openInEditorMutation ( {
267267 environmentId,
268268 input : {
@@ -272,7 +272,7 @@ export const OpenInPicker = memo(function OpenInPicker({
272272 } ,
273273 } ) ;
274274 setPreferredEditor ( editor ) ;
275- return result ;
275+ return ( await result ) . _tag === "Success" ;
276276 } ;
277277
278278 const openFavoriteEditorShortcutLabel = shortcutLabelForCommand (
@@ -293,7 +293,10 @@ export const OpenInPicker = memo(function OpenInPicker({
293293 return ;
294294
295295 e . preventDefault ( ) ;
296- void openInEditor ( preferredEditor ) ;
296+ const label = editorLabelForPlatform ( preferredEditor , navigator . platform ) ;
297+ void openInEditor ( preferredEditor ) . then ( ( opened ) => {
298+ if ( opened ) announce ( `Opened in ${ label } ` ) ;
299+ } ) ;
297300 } ;
298301 window . addEventListener ( "keydown" , handler , true ) ;
299302 return ( ) => window . removeEventListener ( "keydown" , handler , true ) ;
0 commit comments