@@ -182,6 +182,46 @@ it.effect.skipIf(windowsHost)(
182182 } ) . pipe ( Effect . scoped , Effect . provide ( NodeServices . layer ) ) ,
183183) ;
184184
185+ // A project opened from T3 must not replace the editor's last active window.
186+ it . effect . skipIf ( windowsHost ) (
187+ "opens a project folder in a new VS Code window and a file in the existing one" ,
188+ ( ) =>
189+ Effect . gen ( function * ( ) {
190+ const fileSystem = yield * FileSystem . FileSystem ;
191+ const path = yield * Path . Path ;
192+ const binDir = yield * fileSystem . makeTempDirectoryScoped ( { prefix : "t3-editors-" } ) ;
193+ const project = yield * fileSystem . makeTempDirectoryScoped ( { prefix : "t3-project-" } ) ;
194+ const codePath = path . join ( binDir , "code" ) ;
195+ yield * fileSystem . writeFileString ( codePath , "#!/bin/sh\n" ) ;
196+ yield * fileSystem . chmod ( codePath , 0o755 ) ;
197+ const file = `${ path . join ( project , "file.ts" ) } :3:7` ;
198+
199+ const spawned : ChildProcess . StandardCommand [ ] = [ ] ;
200+ yield * Effect . gen ( function * ( ) {
201+ const launcher = yield * ExternalLauncher . ExternalLauncher ;
202+ yield * launcher . launchEditor ( { editor : "vscode" , cwd : project } ) ;
203+ yield * launcher . launchEditor ( { editor : "vscode" , cwd : file } ) ;
204+ } ) . pipe (
205+ Effect . provide (
206+ layerTest ( {
207+ platform : "linux" ,
208+ env : { PATH : binDir , DISPLAY : ":0" } ,
209+ onSpawn : ( command ) => spawned . push ( command ) ,
210+ } ) ,
211+ ) ,
212+ Effect . provideService ( HostProcess . Environment , { PATH : binDir , DISPLAY : ":0" } ) ,
213+ ) ;
214+
215+ assert . deepEqual (
216+ spawned . map ( ( command ) => command . args ) ,
217+ [
218+ [ "--new-window" , project ] ,
219+ [ "--goto" , file ] ,
220+ ] ,
221+ ) ;
222+ } ) . pipe ( Effect . scoped , Effect . provide ( NodeServices . layer ) ) ,
223+ ) ;
224+
185225// Windows drive letters cannot resolve the POSIX editor stub.
186226it . effect . skipIf ( windowsHost ) (
187227 "a Linux editor launch without a display takes the desktop session's display from the systemd user manager" ,
0 commit comments