'use strict' ; import * as vscode from 'vscode' ; export function activate ( context ) { console . log ( "Terminals: " + ( < any > vscode . window ) . terminals . length ) ; context . subscriptions . push ( vscode . window . registerTerminalProfileProvider ( 'nushell_default' , { provideTerminalProfile ( token ) { const path = require ( 'path' ) ; const fs = require ( 'fs' ) ; const glob = require ( 'glob' ) ; const os = require ( 'os' ) ; const pathsToCheck = [ '~/.cargo/bin/nu' , '~/.cargo/bin/nu.exe' , 'c:\\program files\\nu\\bin\\nu.exe' , 'd:\\program files\\nu\\bin\\nu.exe' , 'e:\\program files\\nu\\bin\\nu.exe' , 'f:\\program files\\nu\\bin\\nu.exe' , '~/scoop/apps/nu/*/nu.exe' , '/usr/local/bin/nu' , 'c:\\apps\\nushell\\nu_latest\\nu.exe' , ] ; var found_nushell_path = "" ; const home = os . homedir ( ) ; for ( var cur_val of pathsToCheck ) { var constructed_file = "" ; if ( cur_val . startsWith ( '~/scoop' ) ) { var p = path . join ( home , cur_val . slice ( 1 ) ) ; var file = glob . sync ( p , "debug" ) . toString ( ) ; if ( file ) { constructed_file = file . replace ( /\//g , '\\' ) ; } } else if ( cur_val . startsWith ( '~' ) ) { constructed_file = path . join ( home , cur_val . slice ( 1 ) ) ; } else { constructed_file = cur_val ; } if ( fs . existsSync ( constructed_file ) ) { found_nushell_path = constructed_file ; break ; } else { } } if ( found_nushell_path . length > 0 ) { return { options : { name : 'Nushell' , shellPath : found_nushell_path } } ; } else { console . log ( "Nushell not found, returning undefined" ) ; return undefined ; } } } ) ) ; }