wasdk / WebAssemblyStudio

Learn, Teach, Work and Play in the WebAssembly Studio
http://webassembly.studio
MIT License
2.92k stars 273 forks source link

How to make the downloaded projects work similar in Visual Studio Code #414

Open jegijsje opened 5 years ago

jegijsje commented 5 years ago

Hi,

I've been playing around with Web Assembly Studio and I really like it. What I don't like is that I can't save my projects, when I reload my project is gone and I can start over.

Now since this project is based on Visual Studio code I figured I could get easy integration into Visual Studio Code running natively on my desktop. This did work pretty easily, I downloaded the project I made in Web Assembly Studio and used 'npm install' to install all the pre-requestities. Then I opened the project in Visual Studio Code and used it to succesfully build my .wasm file.

The problem that I have is that if I create invalid C code, the error messages are very vague. Web Assembly Studio reports errors nicely. I've been wondering what this difference is and I looked into the github project here and saw the .vscode folder, but when I look in those files there are no significant changes compared to mine.

Do any of you here know how to make the output from compiling C into Wasm a little more informational? This is the output I get when I make a really easy to make syntax error:

@wasm/empty_c@1.0.0 build f:\Projects\WebAssembly\test gulp --gulpfile ./build.ts

[22:45:29] Requiring external module ts-node/register [22:45:29] Using gulpfile f:\Projects\WebAssembly\test\build.ts [22:45:29] Starting 'build'... [22:45:31] 'build' errored after 1.36 s [22:45:31] Error: Error during build of file.c at Function. (f:\Projects\WebAssembly\test\node_modules\@wasm\studio-utils\src\service.ts:136:13) at Generator.next () at fulfilled (f:\Projects\WebAssembly\test\node_modules\@wasm\studio-utils\dist\service.js:24:58) at at process._tickCallback (internal/process/next_tick.js:188:7) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @wasm/empty_c@1.0.0 build: gulp --gulpfile ./build.ts npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @wasm/empty_c@1.0.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

This is the output I get when I make the same syntax error in Web Assembly Studio:

[info]: Task build is running... [error]: Task build failed: Error during build of file.c

And then the problem shows in the "Problems" tab.

main.c -> error: use of undeclared identifier 'syntaxerror' (7, 3)

Is there any way to make Visual Studio Code behave the same way Web Assembly Studio does? I really want the workflow I have in this application running on a native desktop application. It's just too convenient to have my files on my laptop, locally without remembering the Fork URL or anything. It would also allow me to work offline, which is important to me.

Does anybody have any suggestions?