/// <summary> /// Presents the parameter info prompt to the user /// </summary> /// <param name="syntaxEditor"></param> /// <returns></returns> private bool ShowIntelliPromptParameterInfoImmediate(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor) { // Initialize the parameter info syntaxEditor.IntelliPrompt.ParameterInfo.Hide(); syntaxEditor.IntelliPrompt.ParameterInfo.Info.Clear(); syntaxEditor.IntelliPrompt.ParameterInfo.SelectedIndex = 0; // Get the compilation unit var cu = syntaxEditor.Document.SemanticParseData as CompilationUnit; if (cu == null) { return(false); } // Move back to the last open bracket int caret = syntaxEditor.Caret.Offset; TextStream stream = syntaxEditor.Document.GetTextStream(caret); stream.GoToPreviousTokenWithID(LuatTokenId.OpenParenthesis); // Find the argument list the caret is within var arguments = cu.FindNodeRecursive <ArgumentList>(stream.Offset); ArgumentList next = arguments; while (null != next && false == arguments.InsideBrackets(caret)) { arguments = next; next = next.FindAncestor <ArgumentList>(); } if (arguments == null) { return(false); } var call = arguments.ParentNode as FunctionCall; if (call == null) { throw new Exception("ArgumentList does not have FunctionCall as parent"); } // Configure the parameter info var textRange = new TextRange(arguments.ListTextRange.StartOffset, arguments.ListTextRange.EndOffset + 1); IntelliPromptParameterInfo pi = syntaxEditor.IntelliPrompt.ParameterInfo; pi.ValidTextRange = textRange; pi.CloseDelimiterCharacter = ')'; pi.UpdateParameterIndex(); pi.HideOnParentFormDeactivate = true; var functions = new List <LuatValue>(); foreach (var value in call.ResolvedFunctions) { if (false == value.Type is LuatTypeFunction) { continue; } functions.Merge(value); pi.Info.Add(GetQuickInfoForFunctionCall(value, pi.ParameterIndex)); } // Store the function types in the context pi.Context = functions.ToArray(); // Show the parameter info pi.Show(caret); return(false); }