crucialfelix / atom-supercollider

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

Method help file look up fails #97

Open madskjeldgaard opened 6 years ago

madskjeldgaard commented 6 years ago

When moving the cursor to a method name and calling the atom-supercollider open help file command, I get the following error (as opposed to when I move to the cursor to a class name, the help file opens fine). In the folliwing I tried it on the play method in {SinOsc.ar(110)!2 * 0.1}.play.

I'm on MacOS 10.14 using SC 3.9.3 and the latest version of Atom and the atom-supercollider package.

ERROR: Message 'openHelpFile' not understood.7:58:00.919
Receiver    String "{SinOsc.ar(110)!2 * 0.1}.play"
Selector    openHelpFile
Object:doesNotUnderstand
Args
this    String "{SinOsc.ar(110)!2 * 0.1}.play"
selector    Symbol 'openHelpFile'
args    nil
a Function defined in undefined:undefined
Function:prTry
Args
this    
▶ a Function
Vars
result  nil
thread  
▶ a Thread
next    nil
wasInProtectedFunc  false
Function:try
Args
this    
▶ a Function
handler 
▶ a Function
Vars
result  nil
Meta_SuperColliderJS:*interpret
Args
this    SuperColliderJS
guid    String "cjnm19ans0001lbnraz7z1cpc"
escapedCode String "\"{SinOsc.ar(110)!2 * 0.1}.play\".openHelpFile"
executingPath   nil
returnResultAsString    true
reportError false
getBacktrace    true
Vars
code    String "\"{SinOsc.ar(110)!2 * 0.1}.play\".openHelpFile"
compiled    
▶ a Function
result  nil
error   nil
saveExecutingPath   nil
Interpreter:interpretPrintCmdLine
Args
this    
▶ an Interpreter
Vars
res nil
func    
▶ a Function
code    String "SuperColliderJS.interpret(\"cjnm19ans0001lbnraz7z1cpc\",\"\\\"{SinOsc.ar(110)!2 * 0.1}.play\\\".openHelpFile\",nil,true,false,true);"
doc nil
ideClass    nil
Process:interpretPrintCmdLine
Args
this    a Main
woolgathering commented 6 years ago

As far as I know, SC helpfiles are for classes only, not methods. However, it also seems that the entire string {SinOsc.ar(110)!2 * 0.1}.play was passed to .openHelpfile (instead of just the .play method) which is why the error was generated.

Makes me also think (somewhat unrelated) that the openHelpfile() method in lib/controller.coffee will need to be updated as Object.openHelpfile is deprecated in recent versions of SC: WARNING: Called from Interpreter:interpretPrintCmdLine, method Object:openHelpFile is deprecated and will be removed.

madskjeldgaard commented 6 years ago

No, help file lookup is also for methods. Method lookup works in the SuperCollider IDE (even though it's often ineffective lol)

woolgathering commented 6 years ago

What happens in the IDE is that the method is searched in the helpfiles but there are no helpfiles for methods as such in the same way that there are helpfiles for classes. A list of helpfiles for classes that use that method is provided.

But I think the problem is that something with the Regex is messed up where it passed the entire line to .openHelpfile instead of just play. I would check it on my end but I just compiled the bleeding edge of SC 3.10 and the help is messed up for reasons not related to Atom... I'll try to get around to testing it on the stable version of 3.9.3.

crucialfelix commented 6 years ago

I'm not sure if SuperCollider changed, but previously it was a method on String.

I guess you figured it out: the bleeding edge is bleeding. They shouldn't break APIs like that, there's really no point. There are tons of ancient methods and 18 year old obsolete garbage, but they don't remove those. Instead it's things like this that are core functionality. They should just redirect the call to the new api.

Anyway...

In this case the string is a bunch of source code String "{SinOsc.ar(110)!2 * 0.1}.play", but that shouldn't result in Object:doesNotUnderstand.

Help should work for method names, class names and some general subjects that have help files. It just looks for matching names.