crucialfelix / atom-supercollider

SuperCollider development environment for Atom.io
MIT License
84 stars 12 forks source link

Failing to capture output of initial .postln in Routines and tasks #70

Closed tatecarson closed 8 years ago

tatecarson commented 8 years ago

{"hi".postln; 1.wait; "hello".postln}.fork

This code, only in atom, returns hello, instead of hi and then hello. Any idea why? I'm trying to schedule other processes and not sure why it isn't working.

Tdef does work as expected but not task or routine.

Thanks.

tatecarson commented 8 years ago

Also, class and method lookup isn't working for anything from the default library. Not sure if that's related. This has changed since the atom-sc update.

crucialfelix commented 8 years ago

Confirmed. If you turn on debug in the settings then it posts the stdin/stdout traffic:

debug   
SUPERCOLLIDERJS:f8c96e50-433f-11e6-8f4d-5d1519826968:CAPTURE:START

SUPERCOLLIDERJS:f8c96e50-433f-11e6-8f4d-5d1519826968:CAPTURE:END

SUPERCOLLIDERJS:f8c96e50-433f-11e6-8f4d-5d1519826968:START:Result
SUPERCOLLIDERJS:f8c96e50-433f-11e6-8f4d-5d1519826968:CHUNK:"a Routine"
SUPERCOLLIDERJS:f8c96e50-433f-11e6-8f4d-5d1519826968:END:Result
SUPERCOLLIDERJS.interpreted
-> 
hi

/Users/crucial/supercolliderjs/lib/utils/logger.js:105 debug   hello

So capture is somehow not enabled for that first hi.

crucialfelix commented 8 years ago

Is class/method lookup working for non-default library items ?

Does your project have SCClassLibrary added like this:

screen shot 2016-07-06 at 08 11 53

and do you have a .tags and/or .tags1 file in your project root ? It needs to stick it somewhere so you do need to have a project not just open atom and work with an unsaved file.

tatecarson commented 8 years ago

Class method lookup works for Extensions and quarks. My tree looks like that..project folder SCClassLibrary Extensions then Quarks. There's a .tags and .tags1 in my project folder. When I turn on debug nothing seems to happen. Is that in the post window or somewhere else?

crucialfelix commented 8 years ago

debug posts to the console: option-command-i

screen shot 2016-07-06 at 09 35 51

crucialfelix commented 8 years ago

try Rebuild Tags and look in the console to see if atom-ctags is posting any errors.

crucialfelix commented 8 years ago

fixed.

I understand now what happens. The state parser (sclang-io) is capturing the output of the evaluation. The result is "a Routine" - but in the same STDOUT blurp sclang forks and posts "hi" before it returns "a Routine"

Thanks very much for the clear and reproducible report !

I do unit tests with these to make sure the state parser is solid:

https://github.com/crucialfelix/supercolliderjs/blob/develop/src/lang/internals/__tests__/fixtures/routine-postln.txt