File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,11 @@ function collectPipeOutput(readable: Readable) {
2727 return ( ) => ( result + decoder . decode ( ) ) . trimEnd ( )
2828}
2929
30+ function memfsHasBeenSetup ( memfs : MemoryFileSystem ) {
31+ const memfsPriv = memfs as unknown as { root : { entries : Map < string , unknown > } }
32+ return memfsPriv . root . entries . has ( 'lib' )
33+ }
34+
3035export async function activate ( context : ExtensionContext ) : Promise < ALSWasmLoaderExports > {
3136 const coreDir = 'vscode-wasm/wasm-wasi-core'
3237 const corePkgJSONRaw = await workspace . fs . readFile ( Uri . joinPath ( context . extensionUri , coreDir , 'package.json' ) )
@@ -123,8 +128,8 @@ export async function activate(context: ExtensionContext): Promise<ALSWasmLoader
123128 [ ...presetMountPoints , ...options . fileSystemOptions . mountpoints ] :
124129 presetMountPoints
125130
126- // TODO: cache the setup result to be reused
127- if ( options . runSetupFirst ) {
131+ // XXX: we assume that the setup can be skipped if it has been initialized by caller
132+ if ( options . runSetupFirst && ! memfsHasBeenSetup ( memfsAgdaDataDir ) ) {
128133 const setupProcess = await this . wasm . createProcess ( 'als' , this . module , {
129134 env,
130135 args : [ '--setup' ] ,
You can’t perform that action at this time.
0 commit comments