@@ -504,19 +504,32 @@ private static void WriteAllTextFromJObject(string file, JSONNode node)
504504
505505 public override bool Open ( string path , int line , int column , string solution )
506506 {
507+ var application = Path ;
508+
507509 line = Math . Max ( 1 , line ) ;
508510 column = Math . Max ( 0 , column ) ;
509511
510512 var directory = IOPath . GetDirectoryName ( solution ) ;
511- var application = Path ;
513+ var workspace = TryFindWorkspace ( directory ) ;
512514
513- ProcessRunner . Start ( string . IsNullOrEmpty ( path ) ?
514- ProcessStartInfoFor ( application , $ "\" { directory } \" ") :
515- ProcessStartInfoFor ( application , $ "\" { directory } \" -g \" { path } \" :{ line } :{ column } ") ) ;
515+ var target = workspace ?? directory ;
516+
517+ ProcessRunner . Start ( string . IsNullOrEmpty ( path )
518+ ? ProcessStartInfoFor ( application , $ "\" { target } \" ")
519+ : ProcessStartInfoFor ( application , $ "\" { target } \" -g \" { path } \" :{ line } :{ column } ") ) ;
516520
517521 return true ;
518522 }
519523
524+ private static string TryFindWorkspace ( string directory )
525+ {
526+ var files = Directory . GetFiles ( directory , "*.code-workspace" , SearchOption . TopDirectoryOnly ) ;
527+ if ( files . Length == 0 || files . Length > 1 )
528+ return null ;
529+
530+ return files [ 0 ] ;
531+ }
532+
520533 private static ProcessStartInfo ProcessStartInfoFor ( string application , string arguments )
521534 {
522535#if UNITY_EDITOR_OSX
0 commit comments