davidgranstrom / scnvim

Neovim frontend for SuperCollider.
GNU General Public License v3.0
208 stars 28 forks source link

[BUG] error message when typing (Done.freeSelf, \gate.kr(1)) in a SynthDef #239

Closed jordanwhitede closed 6 months ago

jordanwhitede commented 7 months ago

Describe the bug When using the .ar method on an Env, adding "\gate.kr()" after the (Done.freeSelf) throws the following error:

ERROR: Message 'copySeries' not understood.
RECEIVER:                                  
   nil                                     
ARGS:                                      
   Integer 1                               
   nil                                     
   nil                                     
CALL STACK:                                
    DoesNotUnderstandError:reportError    
        arg this = <instance of DoesNotUnderstandError> 
    Nil:handleError                                     
        arg this = nil                                  
        arg error = <instance of DoesNotUnderstandError>
    Thread:handleError                                  
        arg this = <instance of Thread>                 
        arg error = <instance of DoesNotUnderstandError>
    Object:throw                                        
        arg this = <instance of DoesNotUnderstandError> 
    Object:doesNotUnderstand                            
        arg this = nil                                  
        arg selector = 'copySeries'                     
        arg args = [*3]                               
    < FunctionDef in Method Meta_Help:methodArgs >    
        arg m = Meta_Done:freeSelf                    
        arg c = class Meta_Done                       
    Meta_SCNvim:methodArgs                            
        arg this = <instance of Meta_SCNvim>          
        arg method = "Done.freeSelf"                  
        var args = nil                                
    Meta_SCNvim:eval                                  
        arg this = <instance of Meta_SCNvim>          
        arg expr = "SCNvim.methodArgs("Done.free..."  
        arg callback_id = "18"                        
        var result = nil                         
    Process:interpretCmdLine                     
        arg this = <instance of Main>            
^^ ERROR: Message 'copySeries' not understood.   
RECEIVER:  nil

I've had this on various versions of scnvim, nvim etc and never bothered to report it. It doesn't actually cause any problem, the code still runs, but the error comes every time.

Expected behavior No error message.

Steps to reproduce Within a SynthDef, type env = Env.asr(10, 1, 10).ar(Done.freeSelf, \gate.kr(1)); I haven't tested this much - it seems to only turn up in SynthDefs though.

Information

salkin-mada commented 7 months ago

Yes! I have been having this issue for a long long time. Have been super puzzled by it. Though I cant reproduce while typing the following:

(
SynthDef('huuuh', {
    env = Env.asr(10, 1, 10).ar(Done.freeSelf, \gate.kr(1));
})
)

I have def experienced this with other input in insertmode. Will try and find my notes.. hmm hope is that @davidgranstrom have an idea about whats going on here. I guess its a bug in the line parser?

davidgranstrom commented 6 months ago

@jordanwhitede Thanks for the report and the example! I'm aware of the issue and find it annoying as well :)

@salkin-mada Yes, its indeed an issue with the parsing and extraction of the object to get the signature for (the implementation is here)

In a previous version of scnvim the SCNvim.methodArgs function was using a try block to suppress the error, however this had strange side effects of (sometimes) handling other unrelated errors down the line, possibly some kind of stack corruption was happening inside the sclang VM, but I never found a good way to reproduce the issue so I left this at the state it is now.

I'll take a look and see if there is an easy fix for this on the lua side, but otherwise I would rather spend time trying to bring the supercollider LSP integration to nvim/scnvim which will solve this issue and provide a lot more and better features.