diff --git a/scide_scnvim/Classes/SCNvimDoc/extSCNvim.sc b/scide_scnvim/Classes/SCNvimDoc/extSCNvim.sc index ad00ab91..9211021d 100644 --- a/scide_scnvim/Classes/SCNvimDoc/extSCNvim.sc +++ b/scide_scnvim/Classes/SCNvimDoc/extSCNvim.sc @@ -1,12 +1,47 @@ + SCNvim { - // This function will be replaced by LSP in the future - *methodArgs {|method| - var args = Help.methodArgs(method); - args = args.split(Char.nl); - if (args.size == 1) { - ^args[0] - } - ^""; + // copy of `Help.methodArgs` with an additional bugfix + // remove this later if merged upstream + *getMethodArgs {|string| + var class, meth, f, m; + f = string.findRegexp("(\\w*)\\.(\\w+)").flop[1]; + if(f.notNil) {#class, meth = f[1..]} { + if(string[0].isUpper) { + class = string; + meth = \new; + } { + meth = string; + } + }; + f = {|m,c| + class = (c ?? {m.ownerClass}).name; + class = if(class.isMetaClassName) {class.asString[5..]++" *"} {class.asString++" -"}; + if (m.argNames.notNil) { // argNames can be nil in rare cases such as `Done.freeSelf` + class++m.name++" ("++m.argNames[1..].collect {|n,i| + n.asString++":"+m.prototypeFrame[i+1]; + }.join(", ")++")"; + } { "" } + }; + class = class.asSymbol.asClass; + if(class.notNil) { + m = class.class.findRespondingMethodFor(meth.asSymbol); + ^if(m.notNil) {f.value(m,class.class)} {""}; + } { + ^Class.allClasses.reject{|c|c.isMetaClass}.collect {|c| + c.findMethod(meth.asSymbol); + }.reject{|m|m.isNil}.collect {|m| + f.value(m); + }.join($\n); + } + } + + // This function will be replaced by LSP in the future + *methodArgs {|method| + var args = this.getMethodArgs(method); + args = args.split(Char.nl); + if (args.size == 1) { + ^args[0] + } + ^""; } *prepareHelpFor {|text| @@ -17,7 +52,7 @@ SCDoc.renderer = SCNvimDocRenderer; urlString = SCNvimDoc.findHelpFile(text); - url = URI(urlString); + url = URI(urlString); brokenAction = { "Sorry no help for %".format(text).postln; ^nil;