@@ -166,17 +166,17 @@ public void TryAdd(string name, string icon, Func<string> finder, Func<string, L
166166
167167 public void VSCode ( Func < string > platformFinder )
168168 {
169- TryAdd ( "Visual Studio Code" , "vscode" , platformFinder ) ;
169+ TryAdd ( "Visual Studio Code" , "vscode" , platformFinder , GenerateVSCodeLaunchOptions ) ;
170170 }
171171
172172 public void VSCodeInsiders ( Func < string > platformFinder )
173173 {
174- TryAdd ( "Visual Studio Code - Insiders" , "vscode_insiders" , platformFinder ) ;
174+ TryAdd ( "Visual Studio Code - Insiders" , "vscode_insiders" , platformFinder , GenerateVSCodeLaunchOptions ) ;
175175 }
176176
177177 public void VSCodium ( Func < string > platformFinder )
178178 {
179- TryAdd ( "VSCodium" , "codium" , platformFinder ) ;
179+ TryAdd ( "VSCodium" , "codium" , platformFinder , GenerateVSCodeLaunchOptions ) ;
180180 }
181181
182182 public void SublimeText ( Func < string > platformFinder )
@@ -223,6 +223,32 @@ public void FindJetBrainsFromToolbox(Func<string> platformFinder)
223223 }
224224 }
225225
226+ private List < ExternalTool . LaunchOption > GenerateVSCodeLaunchOptions ( string path )
227+ {
228+ if ( ! Directory . Exists ( path ) )
229+ return null ;
230+
231+ void Search ( List < ExternalTool . LaunchOption > opts , DirectoryInfo dir , string root , int depth )
232+ {
233+ if ( depth < 0 )
234+ return ;
235+
236+ foreach ( var file in dir . GetFiles ( ) )
237+ {
238+ if ( file . Name . EndsWith ( ".code-workspace" , StringComparison . OrdinalIgnoreCase ) )
239+ opts . Add ( new ( Path . GetRelativePath ( root , file . FullName ) , file . FullName . Quoted ( ) ) ) ;
240+ }
241+
242+ foreach ( var subDir in dir . GetDirectories ( ) )
243+ Search ( opts , subDir , root , depth - 1 ) ;
244+ }
245+
246+ var rootDir = new DirectoryInfo ( path ) ;
247+ var options = new List < ExternalTool . LaunchOption > ( ) ;
248+ Search ( options , rootDir , rootDir . FullName , 4 ) ;
249+ return options ;
250+ }
251+
226252 private ExternalToolCustomization _customization = null ;
227253 }
228254}
0 commit comments