/// <summary> /// if downkey is pressed and intellisence is being displayed: enters intelliselect /// otherwise executes if Return is pressed. /// </summary> public static void Update_Typing() { if (IsKeyDown(KeyCode.DownArrow) && IntelliSenceHelp.Any()) { Enter_IntelliSelect(); } else if (IsKeyDown(KeyCode.Tab) && IntelliSenceHelp.Count > 0) { SelectedHelp = 0; UseIntelliSelection(); return; } else if (IsKeyDown(KeyCode.Return) || IsKeyDown(KeyCode.KeypadEnter)) { // Replace code with selected history element. Exit_Typing(); Execute(); return; } else if (IsKeyDown(KeyCode.Escape)) { DisplayHelp = false; } var parseResult = Parser.ParseAssignment(Code); if (IntelliSenceLastCode != parseResult.ExpressionString) { DisplayHelp = true; IntelliSenceLastCode = parseResult.ExpressionString; IntelliSenceHelp = IntellisenseProvider.Intellisense(Code).ToList(); SelectedHelp = -1; Repaint(); } }
public static string ReplacementString() { if (SelectedHelp < 0 || SelectedHelp >= IntelliSenceHelp.Count(i => !i.IsMethodOverload)) { return(Code); } var completion = IntelliSenceHelp[SelectedHelp]; if (IntelliSenceHelp.Any(i => i.IsMethodOverload)) { completion = IntelliSenceHelp.Where(i => !i.IsMethodOverload).ToArray()[SelectedHelp]; } return(Code.Substring(0, completion.Start) + completion.ReplaceString + Code.Substring(completion.End + 1)); }