public static FinalizedResponse FuncName_AC(TokLinePlanB <PTok> orig_TL, TokLinePlanB <PTok> .CPosC CPos, MGRX.FuncNameNodeRX funcNameNodeRX, Responder RESP) { Func <PTokE, bool> ON = tokE => { var tok = CPos.insideof_tok; if (tok == null) { return(false); } return(tok.E == tokE); }; Func <PTokE, bool> LADJ = tokE => { var tok = CPos.immediateLAdj_tok; if (tok == null) { return(false); } return(tok.E == tokE); }; Func <TokLinePlanB <PTok>, PTokBase[]> SER = tokLine => tokLine.Serialize <PTokBase>(onTok: _ => _, onWS: i => new PTokWhitespace { len = i }).ToArray(); Type hosting_type; try { hosting_type = funcNameNodeRX.AC_FuncHostingType_Callback(); if (hosting_type == null) { throw new Exception("hosting type null"); } } catch (Exception e) { return(RESP.NoAC(e.Message)); } string name_fragment; if (LADJ(PTokE.CS_name)) { name_fragment = CPos.immediateLAdj_tok.pay; MethodInfo [] raw_suggs_MI = SGA.MethodAC(hosting_type, name_fragment, (funcNameNodeRX.parent as MG.FunCallNode).isStatic); if (raw_suggs_MI.Length == 0) { return(RESP.NoAC("no matching alternatives")); } string new_prefix = SGA.LongestCommonPrefix(raw_suggs_MI.Select(mi => mi.Name).ToArray()); if (new_prefix.Length > name_fragment.Length) { PTok new_token = new PTok { pay = new_prefix, E = PTokE.CS_name }; orig_TL.ReplaceTok(CPos.immediateLAdj_tok, new_token); var nu_Cpos = orig_TL.CPosAtEndOfTok(new_token); return(RESP.FuncACWithSubst(raw_suggs_MI, SER(orig_TL), nu_Cpos.StringPos())); } else { return(RESP.FuncACNoSubst(raw_suggs_MI)); } } else if (LADJ(PTokE.OP_backslash)) { // no check for whether the curser is under a CS_name token , like so // [>> [_] :Tyname\Funcname] // _ // in this case junk gets substituted left of `Funcname` // idc rn - there are bigger fish to fry MethodInfo [] raw_suggs_MI = SGA.MethodAC(hosting_type, "", (funcNameNodeRX.parent as MG.FunCallNode).isStatic); if (raw_suggs_MI.Length == 0) { return(RESP.NoAC("no matching alternatives")); } string new_prefix = SGA.LongestCommonPrefix(raw_suggs_MI.Select(mi => mi.Name).ToArray()); if (new_prefix.Length > 0) { var nu_tok = new PTok { E = PTokE.CS_name, pay = new_prefix }; orig_TL.InsertTokAfterNode(CPos.N, nu_tok); // this is the precise behaviour of IsertAfterCPos when its not over whitespace var nu_Cpos = orig_TL.CPosAtEndOfTok(nu_tok); var nu_offs = nu_Cpos.StringPos(); return(RESP.FuncACWithSubst(raw_suggs_MI, SER(orig_TL), nu_offs)); } else { return(RESP.FuncACNoSubst(raw_suggs_MI)); } } else { return(RESP.NoAC("useless position")); } // currrently only doing ON( CS_name ) }