Browse Source

Fixed comparison of completion categories.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
01233b42bc
  1. 20
      ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs

20
ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs

@ -27,6 +27,7 @@ using System; @@ -27,6 +27,7 @@ using System;
using System.Collections.Generic;
using ICSharpCode.NRefactory.Completion;
using ICSharpCode.NRefactory.TypeSystem;
using System.Linq;
namespace ICSharpCode.NRefactory.CSharp.Completion
{
@ -203,7 +204,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion @@ -203,7 +204,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
{
this.Type = type;
}
public override int CompareTo (CompletionCategory other)
{
var compareCategory = other as TypeCompletionCategory;
@ -213,22 +214,9 @@ namespace ICSharpCode.NRefactory.CSharp.Completion @@ -213,22 +214,9 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
if (Type.ReflectionName == compareCategory.Type.ReflectionName)
return 0;
// System.Object is always the smallest
if (Type.ReflectionName == "System.Object")
return -1;
if (compareCategory.Type.ReflectionName == "System.Object")
if (Type.GetAllBaseTypes ().Any (t => t.ReflectionName == compareCategory.Type.ReflectionName))
return 1;
/* if (Type.GetProjectContent () != null) {
if (Type.GetProjectContent ().GetInheritanceTree (Type).Any (t => t != null && t.DecoratedFullName == compareCategory.Type.DecoratedFullName))
return 1;
return -1;
}
// source project dom == null - try to make the opposite comparison
if (compareCategory.Type.GetProjectContent () != null && compareCategory.Type.GetProjectContent ().GetInheritanceTree (Type).Any (t => t != null && t.DecoratedFullName == Type.DecoratedFullName))
return -1;*/
return 1;
return -1;
}
}
}

Loading…
Cancel
Save