本文整理汇总了C#中NRefactoryResolver.AddAccessibleCodeCompletionData方法的典型用法代码示例。如果您正苦于以下问题:C# NRefactoryResolver.AddAccessibleCodeCompletionData方法的具体用法?C# NRefactoryResolver.AddAccessibleCodeCompletionData怎么用?C# NRefactoryResolver.AddAccessibleCodeCompletionData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NRefactoryResolver
的用法示例。
在下文中一共展示了NRefactoryResolver.AddAccessibleCodeCompletionData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateParameterCompletion
public CompletionDataList CreateParameterCompletion (NRefactoryResolver resolver, DomLocation location, ExpressionContext context, IEnumerable<IMethod> possibleMethods, int parameter)
{
CompletionDataList completionList = new ProjectDomCompletionDataList ();
var addedEnums = new HashSet<string> ();
var addedDelegates = new HashSet<string> ();
IType resolvedType = null;
foreach (var method in possibleMethods) {
if (method.Parameters.Count <= parameter)
continue;
resolvedType = dom.GetType (method.Parameters [parameter].ReturnType);
if (resolvedType == null)
continue;
switch (resolvedType.ClassType) {
case MonoDevelop.Projects.Dom.ClassType.Enum:
if (addedEnums.Contains (resolvedType.DecoratedFullName))
continue;
addedEnums.Add (resolvedType.DecoratedFullName);
AddEnumMembers (completionList, resolvedType);
break;
case MonoDevelop.Projects.Dom.ClassType.Delegate:
if (addedDelegates.Contains (resolvedType.DecoratedFullName))
continue;
addedDelegates.Add (resolvedType.DecoratedFullName);
string parameterDefinition = AddDelegateHandlers (completionList, resolvedType, false, addedDelegates.Count == 1);
string varName = "Handle" + method.Parameters [parameter].ReturnType.Name + method.Parameters [parameter].Name;
completionList.Add (new EventCreationCompletionData (textEditorData, varName, resolvedType, null, parameterDefinition, resolver.Unit.GetMemberAt (location), resolvedType) { AddSemicolon = false });
break;
}
}
if (addedEnums.Count + addedDelegates.Count == 0)
return null;
CompletionDataCollector cdc = new CompletionDataCollector (this, dom, completionList, Document.CompilationUnit, resolver.CallingType, location);
completionList.AutoCompleteEmptyMatch = false;
completionList.AutoSelect = false;
resolver.AddAccessibleCodeCompletionData (ExpressionContext.MethodBody, cdc);
if (addedDelegates.Count > 0) {
foreach (var data in completionList) {
if (data is MemberCompletionData)
((MemberCompletionData)data).IsDelegateExpected = true;
}
}
return completionList;
}
示例2: CreatePossibleEnumCompletion
public CompletionDataList CreatePossibleEnumCompletion (NRefactoryResolver resolver, DomLocation location, ExpressionContext context, IEnumerable<IMethod> possibleMethods, int parameter)
{
CompletionDataList completionList = new ProjectDomCompletionDataList ();
var addedEnums = new HashSet<string> ();
IType resolvedType = null;
foreach (var method in possibleMethods) {
if (method.Parameters.Count <= parameter)
continue;
resolvedType = dom.GetType (method.Parameters [parameter].ReturnType);
if (resolvedType == null || resolvedType.ClassType != ClassType.Enum)
continue;
if (addedEnums.Contains (resolvedType.DecoratedFullName))
continue;
addedEnums.Add (resolvedType.DecoratedFullName);
AddEnumMembers (completionList, resolvedType);
}
if (addedEnums.Count == 0)
return null;
CompletionDataCollector cdc = new CompletionDataCollector (dom, completionList, Document.CompilationUnit, resolver.CallingType, location);
completionList.AutoCompleteEmptyMatch = false;
//completionList.AutoSelect = false;
resolver.AddAccessibleCodeCompletionData (context, cdc);
return completionList;
}