private static SignatureHelpItem GetBestItem( SignatureHelpItem currentItem, IList <SignatureHelpItem> filteredItems, int selectedParameter, int argumentCount, string name, bool isCaseSensitive) { // If the current item is still applicable, then just keep it. if (filteredItems.Contains(currentItem) && IsApplicable(currentItem, argumentCount, name, isCaseSensitive)) { return(currentItem); } // Try to find the first applicable item. If there is none, then that means the // selected parameter was outside the bounds of all methods. i.e. all methods only // went up to 3 parameters, and selected parameter is 3 or higher. In that case, // just pick the very last item as it is closest in parameter count. var result = filteredItems.FirstOrDefault(i => IsApplicable(i, argumentCount, name, isCaseSensitive)); if (result != null) { return(result); } // if we couldn't find a best item, and they provided a name, then try again without // a name. if (name != null) { return(GetBestItem(currentItem, filteredItems, selectedParameter, argumentCount, null, isCaseSensitive)); } // If we don't have an item that can take that number of parameters, then just pick // the last item. Or stick with the current item if the last item isn't any better. var lastItem = filteredItems.Last(); if (currentItem.IsVariadic || currentItem.Parameters.Length == lastItem.Parameters.Length) { return(currentItem); } return(lastItem); }
public SignatureHelpResult(SignatureHelpItems items, SignatureHelpItem selectedItem, int?selectedParameter) { Items = items; SelectedItem = selectedItem; SelectedParameter = selectedParameter; }
public SignatureHelpSelection(SignatureHelpItem selectedItem, int?selectedParameter) : this() { _selectedItem = selectedItem; _selectedParameter = selectedParameter; }
private static bool DisplayPartsMatch(SignatureHelpItem i1, SignatureHelpItem i2) { return(i1.GetAllParts().SequenceEqual(i2.GetAllParts(), CompareParts)); }