microsoft / vscode-wasm

A WASI implementation that uses VS Code's extension host as the implementing API
MIT License
385 stars 29 forks source link

Reading `stderr` of the wasm process on vscode.dev #160

Closed alcarney closed 5 months ago

alcarney commented 7 months ago

Thanks for all the work on this!

Using some of the examples from this repo as a guide I was able to put together an extension that runs a Python language server on both local and web versions of VSCode!

It runs almost perfectly, expect the following code to read the process' stderr channel throws errors on vscode.dev

const decoder = new TextDecoder('utf-8')
process.stderr!.onData((data) => {
    this.outputChannel.append(decoder.decode(data))
})
ERR TextDecoder.decode: ArrayBufferView branch of (ArrayBufferView or ArrayBuffer) can't be a SharedArrayBuffer or an ArrayBufferView backed by a SharedArrayBuffer: createServerProcess/<@https://swyddfa.vscode-unpkg.net/swyddfa/pygls-wasi-playground/0.1.1/extension/dist/web/extension.js#vscode-extension:18098:34
y@https://v--0vj73716jlbh3qrnn5obfh00ui72g5uqcrs8jvonum2somnfjnek.vscode-cdn.net/stable/863d2581ecda6849923a2118d93a088b0745d9d6/out/vs/base/worker/workerMain.js?vscode-coi=2:32:1906
fire@https://v--0vj73716jlbh3qrnn5obfh00ui72g5uqcrs8jvonum2somnfjnek.vscode-cdn.net/stable/863d2581ecda6849923a2118d93a088b0745d9d6/out/vs/base/worker/workerMain.js?vscode-coi=2:32:2123
triggerData@https://ms-vscode.vscode-unpkg.net/ms-vscode/wasm-wasi-core/0.13.2/extension/dist/web/extension.js#vscode-extension:4700:18
signalData/this.timer<@https://ms-vscode.vscode-unpkg.net/ms-vscode/wasm-wasi-core/0.13.2/extension/dist/web/extension.js#vscode-extension:4676:64

Is this something you would expect to work? If not, is there an alternate method for doing this in the web version?

dbaeumer commented 5 months ago

@alcarney sorry for the delay. But I somehow overlooked that one.

This should be fixed in the meantime on version 0.13.3. Can you confirm that?

alcarney commented 5 months ago

This should be fixed in the meantime on version 0.13.3. Can you confirm that?

Indeed it is! Thanks very much :)