本文整理汇总了C#中CompletionDataCollector.GetCompletionCategory方法的典型用法代码示例。如果您正苦于以下问题:C# CompletionDataCollector.GetCompletionCategory方法的具体用法?C# CompletionDataCollector.GetCompletionCategory怎么用?C# CompletionDataCollector.GetCompletionCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompletionDataCollector
的用法示例。
在下文中一共展示了CompletionDataCollector.GetCompletionCategory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddVirtuals
void AddVirtuals (CodeCompletionContext ctx, Dictionary<string, bool> alreadyInserted, CompletionDataList completionList, IType type, string modifiers, IReturnType curType)
{
if (curType == null)
return;
IType searchType = dom.SearchType (Document.CompilationUnit, (MonoDevelop.Projects.Dom.INode)type ?? Document.CompilationUnit, curType);
//System.Console.WriteLine("Add Virtuals for:" + searchType + " / " + curType);
if (searchType == null)
return;
bool isInterface = type.ClassType == ClassType.Interface;
bool includeOverriden = false;
int declarationBegin = ctx.TriggerOffset;
int j = declarationBegin;
for (int i = 0; i < 3; i++) {
switch (GetPreviousToken (ref j, true)) {
case "public":
case "protected":
case "private":
case "internal":
case "sealed":
case "override":
declarationBegin = j;
break;
case "static":
return; // don't add override completion for static members
}
}
CompletionDataCollector col = new CompletionDataCollector (dom, completionList, Document.CompilationUnit, searchType, DomLocation.Empty);
List<IType> inheritanceTree = new List<IType> (this.dom.GetInheritanceTree (searchType));
inheritanceTree.Sort ((l, r) => l.ClassType == r.ClassType ? 0 : (l.ClassType == ClassType.Interface ? 1 : (r.ClassType == ClassType.Interface ? -1 : 0)));
foreach (IType t in inheritanceTree) {
foreach (IMember m in t.Members) {
if (!m.IsAccessibleFrom (dom, type, type, true) || m.IsSpecialName)
continue;
//System.Console.WriteLine ("scan:" + m);
//if (m.IsSpecialName || (m.IsInternal && !m.IsProtectedOrInternal) || && searchType.SourceProject != Document.Project)
// continue;
if (t.ClassType == ClassType.Interface || (isInterface || m.IsVirtual || m.IsAbstract) && !m.IsSealed && (includeOverriden || !type.HasOverriden (m))) {
// filter out the "Finalize" methods, because finalizers should be done with destructors.
if (m is IMethod && m.Name == "Finalize")
continue;
//System.Console.WriteLine("add");
NewOverrideCompletionData data = new NewOverrideCompletionData (dom, textEditorData, declarationBegin, type, m);
string text = CompletionDataCollector.ambience.GetString (m, OutputFlags.ClassBrowserEntries);
// check if the member is already implemented
bool foundMember = false;
foreach (IMember member in type.Members) {
if (text == CompletionDataCollector.ambience.GetString (member, OutputFlags.ClassBrowserEntries)) {
foundMember = true;
break;
}
}
if (!foundMember && !alreadyInserted.ContainsKey (text)) {
alreadyInserted[text] = true;
data.CompletionCategory = col.GetCompletionCategory (t);
completionList.Add (data);
}
}
}
}
}