} // member function constructor /// <summary> /// Create a ParameterDataProvider for a constructor /// </summary> /// <param name="constructorOverload"> /// A <see cref="System.String"/>: The named of the pertinent constructor overload /// </param> public ParameterDataProvider(Document document, ProjectInformation info, string typename, string constructorOverload) { this.functionName = constructorOverload; this.editor = document.TextEditor; this.info = info; List <Symbol> myfunctions = info.GetConstructorsForType(typename, document.FileName, editor.CursorLine, editor.CursorColumn, null); // bottleneck if (1 < myfunctions.Count) { foreach (Symbol function in myfunctions) { if (functionName.Equals(function.Name, StringComparison.Ordinal)) { functions = new List <Symbol> () { function }; return; } } } functions = myfunctions; } // constructor constructor
/// <summary> /// Perform constructor-specific completion /// </summary> private ValaCompletionDataList CompleteConstructor(string lineText, int line, int column) { ProjectInformation parser = Parser; Match match = initializationRegex.Match(lineText); ValaCompletionDataList list = new ValaCompletionDataList(); ThreadPool.QueueUserWorkItem(delegate { if (match.Success) { // variable initialization if (match.Groups["typename"].Success || "var" != match.Groups["typename"].Value) { // simultaneous declaration and initialization parser.GetConstructorsForType(match.Groups["typename"].Value, Document.FileName, line, column, list); } else if (match.Groups["variable"].Success) { // initialization of previously declared variable parser.GetConstructorsForExpression(match.Groups["variable"].Value, Document.FileName, line, column, list); } if (0 == list.Count) { // Fallback to known types parser.GetTypesVisibleFrom(Document.FileName, line, column, list); } } }); return(list); } // CompleteConstructor