Browse Source

More CC bugfixes.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@128 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 21 years ago
parent
commit
bed8c237cd
  1. 1
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  2. 2
      src/Main/Base/Project/Src/Dom/Implementations/AbstractDecoration.cs
  3. 3
      src/Main/Base/Project/Src/Dom/Implementations/AbstractReturnType.cs
  4. 6
      src/Main/Base/Project/Src/Dom/Implementations/ArrayReturnType.cs
  5. 13
      src/Main/Base/Project/Src/Dom/Implementations/DefaultReturnType.cs
  6. 3
      src/Main/Base/Project/Src/Dom/Implementations/LazyReturnType.cs
  7. 3
      src/Main/Base/Project/Src/Dom/Implementations/ProxyReturnType.cs
  8. 5
      src/Main/Base/Project/Src/Dom/Implementations/SpecificReturnType.cs
  9. 2
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs
  10. 69
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs
  11. 31
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/TypeVisitor.cs
  12. 28
      src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionClass.cs
  13. 32
      src/Main/Base/Project/Src/Dom/ResolveResult.cs
  14. 793
      src/Main/Base/Project/Src/Services/ParserService/CaseInsentitiveProjectContent.cs
  15. 69
      src/Main/Base/Project/Src/Services/ParserService/CaseSensitiveProjectContent.cs
  16. 1
      src/Main/Base/Project/Src/Services/ParserService/IProjectContent.cs
  17. 3
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs

1
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -427,7 +427,6 @@ @@ -427,7 +427,6 @@
<Compile Include="Src\Gui\Pads\ErrorList\ErrorListToolbarCommands.cs" />
<Compile Include="Src\Gui\Pads\CompilerMessageView\CompulerMessageViewToolbarCommands.cs" />
<Compile Include="Src\Services\ParserService\CaseSensitiveProjectContent.cs" />
<Compile Include="Src\Services\ParserService\CaseInsentitiveProjectContent.cs" />
<Compile Include="Src\Services\ParserService\IProjectContent.cs" />
<Compile Include="Src\Gui\Pads\ClassBrowser\ClassBrowser.cs" />
<Compile Include="Src\Gui\Pads\ClassBrowser\ClassBrowserToolbarCommands.cs" />

2
src/Main/Base/Project/Src/Dom/Implementations/AbstractDecoration.cs

@ -71,7 +71,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -71,7 +71,7 @@ namespace ICSharpCode.SharpDevelop.Dom
public bool IsStatic {
get {
return (modifiers & ModifierEnum.Static) == ModifierEnum.Static;
return ((modifiers & ModifierEnum.Static) == ModifierEnum.Static) || IsConst;
}
}

3
src/Main/Base/Project/Src/Dom/Implementations/AbstractReturnType.cs

@ -10,6 +10,9 @@ using System.Collections.Generic; @@ -10,6 +10,9 @@ using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Dom
{
/// <summary>
/// Abstract return type for return types that are not a <see cref="ProxyReturnType"/>.
/// </summary>
[Serializable]
public abstract class AbstractReturnType : IReturnType
{

6
src/Main/Base/Project/Src/Dom/Implementations/ArrayReturnType.cs

@ -12,6 +12,12 @@ using ICSharpCode.Core; @@ -12,6 +12,12 @@ using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Dom
{
/// <summary>
/// The ArrayReturnType wraps around another type, converting it into an array
/// with the specified number of dimensions.
/// The element type is only used as return type for the indexer; all methods and fields
/// are retrieved from System.Array.
/// </summary>
public sealed class ArrayReturnType : ProxyReturnType
{
IReturnType elementType;

13
src/Main/Base/Project/Src/Dom/Implementations/DefaultReturnType.cs

@ -10,6 +10,11 @@ using System.Collections.Generic; @@ -10,6 +10,11 @@ using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Dom
{
/// <summary>
/// DefaultReturnType is a reference to a normal class or a reference to a generic class where
/// the type parameters are NOT specified.
/// E.g. "System.Int32", "System.Void", "System.String", "System.Collections.Generic.List"
/// </summary>
[Serializable]
public class DefaultReturnType : AbstractReturnType
{
@ -26,7 +31,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -26,7 +31,7 @@ namespace ICSharpCode.SharpDevelop.Dom
{
List<IMethod> l = new List<IMethod>();
foreach (IClass bc in c.ClassInheritanceTree) {
if (bc.ClassType != c.ClassType)
if (bc.ClassType == ClassType.Interface && c.ClassType != ClassType.Interface)
continue; // ignore explicit interface implementations
// do not add methods that were overridden
@ -53,7 +58,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -53,7 +58,7 @@ namespace ICSharpCode.SharpDevelop.Dom
{
List<IProperty> l = new List<IProperty>();
foreach (IClass bc in c.ClassInheritanceTree) {
if (bc.ClassType != c.ClassType)
if (bc.ClassType == ClassType.Interface && c.ClassType != ClassType.Interface)
continue; // ignore explicit interface implementations
l.AddRange(bc.Properties);
}
@ -64,7 +69,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -64,7 +69,7 @@ namespace ICSharpCode.SharpDevelop.Dom
{
List<IField> l = new List<IField>();
foreach (IClass bc in c.ClassInheritanceTree) {
if (bc.ClassType != c.ClassType)
if (bc.ClassType == ClassType.Interface && c.ClassType != ClassType.Interface)
continue; // ignore explicit interface implementations
l.AddRange(bc.Fields);
}
@ -75,7 +80,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -75,7 +80,7 @@ namespace ICSharpCode.SharpDevelop.Dom
{
List<IEvent> l = new List<IEvent>();
foreach (IClass bc in c.ClassInheritanceTree) {
if (bc.ClassType != c.ClassType)
if (bc.ClassType == ClassType.Interface && c.ClassType != ClassType.Interface)
continue; // ignore explicit interface implementations
l.AddRange(bc.Events);
}

3
src/Main/Base/Project/Src/Dom/Implementations/LazyReturnType.cs

@ -21,7 +21,8 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -21,7 +21,8 @@ namespace ICSharpCode.SharpDevelop.Dom
/// <summary>
/// The LazyReturnType is the most used return type:
/// It is not bound to a class, but only resolved when necessary.
/// It is not bound to a class, but only resolved on demand.
/// The LazyReturnType is nearly always used to point at a <see cref="DefaultReturnType"/>.
/// </summary>
public sealed class LazyReturnType : ProxyReturnType
{

3
src/Main/Base/Project/Src/Dom/Implementations/ProxyReturnType.cs

@ -10,6 +10,9 @@ using System.Collections.Generic; @@ -10,6 +10,9 @@ using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Dom
{
/// <summary>
/// Base class for return types that wrap around other return types.
/// </summary>
[Serializable]
public abstract class ProxyReturnType : IReturnType
{

5
src/Main/Base/Project/Src/Dom/Implementations/SpecificReturnType.cs

@ -13,7 +13,10 @@ using ICSharpCode.Core; @@ -13,7 +13,10 @@ using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Dom
{
/// <summary>
/// SpecificReturnType is a reference to class where the type parameters are specified.
/// SpecificReturnType is a reference to generic class that specifies the type parameters.
/// When getting the Members, this return type modifies the lists in such a way that the
/// <see cref="GenericReturnType"/>s are replaced with the return types in the type parameters
/// collection.
/// Example: List&lt;string&gt;
/// </summary>
public sealed class SpecificReturnType : ProxyReturnType

2
src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs

@ -74,7 +74,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -74,7 +74,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
Debug.Assert(data is DefaultUsing);
DefaultUsing us = (DefaultUsing)data;
if (u.IsAlias) {
us.Aliases[u.Alias] = u.Name;
us.Aliases[u.Name] = u.Alias;
} else {
us.Usings.Add(u.Name);
}

69
src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs

@ -159,12 +159,12 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -159,12 +159,12 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
IReturnType returnType;
if (fieldReferenceExpression.FieldName == null || fieldReferenceExpression.FieldName == "") {
if (fieldReferenceExpression.TargetObject is TypeReferenceExpression) {
// TODO: !!!
/*returnType = new ReturnType(((TypeReferenceExpression)fieldReferenceExpression.TargetObject).TypeReference);
IClass c = projectContent.GetClass(returnType.FullyQualifiedName);
if (c != null)
return new TypeResolveResult(callingClass, callingMember, returnType, c);
*/
returnType = TypeVisitor.CreateReturnType(((TypeReferenceExpression)fieldReferenceExpression.TargetObject).TypeReference, this);
if (returnType != null) {
IClass c = projectContent.GetClass(returnType.FullyQualifiedName);
if (c != null)
return new TypeResolveResult(callingClass, callingMember, returnType, c);
}
}
}
returnType = fieldReferenceExpression.TargetObject.AcceptVisitor(typeVisitor, null) as IReturnType;
@ -361,21 +361,6 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -361,21 +361,6 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
/// </remarks>
public string SearchNamespace(string name, ICompilationUnit unit)
{
/*if (projectContent.NamespaceExists(name)) {
return name;
}
if (CallingClass != null) {
string callspace = this.CallingClass.Namespace;
for (int split = callspace.Length; split > 0; split = callspace.LastIndexOf('.', split - 1)) {
string fullname = callspace.Substring(0, split) + "." + name;
if (projectContent.NamespaceExists(fullname)) {
return fullname;
}
}
}
*/
// TODO: look if all the stuff before is nessessary
return projectContent.SearchNamespace(name, unit, caretLine, caretColumn);
}
@ -582,41 +567,6 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -582,41 +567,6 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
#endregion
#endregion
/*
public ArrayList NewCompletion(int caretLine, int caretColumn, string fileName)
{
if (!IsCaseSensitive(language)) {
caseSensitive = false;
}
ArrayList result = new ArrayList();
ParseInformation parseInfo = ParserService.GetParseInformation(fileName);
ICSharpCode.NRefactory.Parser.AST.CompilationUnit fileCompilationUnit = parseInfo.MostRecentCompilationUnit.Tag as ICSharpCode.NRefactory.Parser.AST.CompilationUnit;
if (fileCompilationUnit == null) {
return null;
}
NRefactoryASTConvertVisitor cSharpVisitor = new NRefactoryASTConvertVisitor(parseInfo.MostRecentCompilationUnit != null ? parseInfo.MostRecentCompilationUnit.ProjectContent : null);
cu = (ICompilationUnit)cSharpVisitor.Visit(fileCompilationUnit, null);
if (cu != null) {
callingClass = cu.GetInnermostClass(caretLine, caretColumn);
if (callingClass != null) {
result.AddRange(projectContent.GetNamespaceContents(callingClass.Namespace));
}
}
result.AddRange(projectContent.GetNamespaceContents(""));
foreach (IUsing u in cu.Usings) {
if (u != null && (u.Region == null || u.Region.IsInside(caretLine, caretColumn))) {
foreach (string name in u.Usings) {
result.AddRange(projectContent.GetNamespaceContents(name));
}
foreach (string alias in u.Aliases.Keys) {
result.Add(alias);
}
}
}
return result;
}*/
public ArrayList CtrlSpace(int caretLine, int caretColumn, string fileName)
{
if (!IsCaseSensitive(language)) {
@ -659,7 +609,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -659,7 +609,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
if (IsInside(new Point(caretColumn, caretLine), v.StartPos, v.EndPos)) {
// LocalLookupVariable in no known Type in DisplayBindings.TextEditor
// so add Field for the Variables
//result.Add(new DefaultField(new ReturnType(v.TypeRef), name, ModifierEnum.None, new DefaultRegion(v.StartPos, v.EndPos), callingClass));
result.Add(new DefaultField(TypeVisitor.CreateReturnType(v.TypeRef, this), name, ModifierEnum.None, new DefaultRegion(v.StartPos, v.EndPos), callingClass));
break;
}
}
@ -669,7 +619,10 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -669,7 +619,10 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
foreach (IUsing u in cu.Usings) {
if (u != null) {
foreach (string name in u.Usings) {
result.AddRange(projectContent.GetNamespaceContents(name));
foreach (object o in projectContent.GetNamespaceContents(name)) {
if (!(o is string))
result.Add(o);
}
}
foreach (string alias in u.Aliases.Keys) {
result.Add(alias);

31
src/Main/Base/Project/Src/Dom/NRefactoryResolver/TypeVisitor.cs

@ -142,7 +142,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -142,7 +142,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
if (name != null) {
string n = resolver.SearchNamespace(name + "." + fieldReferenceExpression.FieldName, null);
if (n != null) {
return CreateNamespaceReturnType(n);
return new NamespaceReturnType(n);
}
IClass c = resolver.SearchType(name + "." + fieldReferenceExpression.FieldName, resolver.CallingClass, resolver.CompilationUnit);
if (c != null) {
@ -179,7 +179,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -179,7 +179,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
}
string name = resolver.SearchNamespace(identifierExpression.Identifier, resolver.CompilationUnit);
if (name != null && name != "") {
return CreateNamespaceReturnType(name);
return new NamespaceReturnType(name);
}
IClass c = resolver.SearchType(identifierExpression.Identifier, resolver.CallingClass, resolver.CompilationUnit);
if (c != null) {
@ -384,9 +384,32 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -384,9 +384,32 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
return t;
}
IReturnType CreateNamespaceReturnType(string namespaceName)
class NamespaceReturnType : AbstractReturnType
{
return null;
public NamespaceReturnType(string fullName)
{
this.FullyQualifiedName = fullName;
}
public override List<IMethod> GetMethods() {
return new List<IMethod>();
}
public override List<IProperty> GetProperties() {
return new List<IProperty>();
}
public override List<IField> GetFields() {
return new List<IField>();
}
public override List<IEvent> GetEvents() {
return new List<IEvent>();
}
public override List<IIndexer> GetIndexers() {
return new List<IIndexer>();
}
}
IReturnType CreateReturnType(Type type)

28
src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionClass.cs

@ -20,7 +20,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -20,7 +20,7 @@ namespace ICSharpCode.SharpDevelop.Dom
BindingFlags flags = BindingFlags.Instance |
BindingFlags.Static |
//BindingFlags.NonPublic |
BindingFlags.NonPublic |
BindingFlags.DeclaredOnly |
BindingFlags.Public;
@ -38,9 +38,9 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -38,9 +38,9 @@ namespace ICSharpCode.SharpDevelop.Dom
get {
List<IField> fields = new List<IField>();
foreach (FieldInfo field in type.GetFields(flags)) {
IField newField = new ReflectionField(field, this);
if (!newField.IsInternal) {
fields.Add(newField);
if (!field.IsPublic && !field.IsFamily) continue;
if (!field.IsSpecialName) {
fields.Add(new ReflectionField(field, this));
}
}
return fields;
@ -58,7 +58,9 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -58,7 +58,9 @@ namespace ICSharpCode.SharpDevelop.Dom
p = propertyInfo.GetIndexParameters();
} catch (Exception) {}
if (p == null || p.Length == 0) {
properties.Add(new ReflectionProperty(propertyInfo, this));
ReflectionProperty prop = new ReflectionProperty(propertyInfo, this);
if (prop.IsPublic || prop.IsProtected)
properties.Add(prop);
}
}
@ -90,18 +92,16 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -90,18 +92,16 @@ namespace ICSharpCode.SharpDevelop.Dom
List<IMethod> methods = new List<IMethod>();
foreach (ConstructorInfo constructorInfo in type.GetConstructors(flags)) {
if (!constructorInfo.IsPublic && !constructorInfo.IsFamily) continue;
IMethod newMethod = new ReflectionMethod(constructorInfo, this);
if (!newMethod.IsInternal) {
methods.Add(newMethod);
}
methods.Add(newMethod);
}
foreach (MethodInfo methodInfo in type.GetMethods(flags)) {
if (!methodInfo.IsPublic && !methodInfo.IsFamily) continue;
if (!methodInfo.IsSpecialName) {
IMethod newMethod = new ReflectionMethod(methodInfo, this);
if (!newMethod.IsInternal) {
methods.Add(newMethod);
}
methods.Add(newMethod);
}
}
return methods;
@ -113,11 +113,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -113,11 +113,7 @@ namespace ICSharpCode.SharpDevelop.Dom
List<IEvent> events = new List<IEvent>();
foreach (EventInfo eventInfo in type.GetEvents(flags)) {
IEvent newEvent = new ReflectionEvent(eventInfo, this);
if (!newEvent.IsInternal) {
events.Add(newEvent);
}
events.Add(new ReflectionEvent(eventInfo, this));
}
return events;
}

32
src/Main/Base/Project/Src/Dom/ResolveResult.cs

@ -71,32 +71,30 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -71,32 +71,30 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
/*
public virtual IClass GetResolvedClass(IProjectContent projectContent)
public virtual ArrayList GetCompletionData(IProjectContent projectContent)
{
if (resolvedType == null)
return null;
if (resolvedType.ArrayCount > 0)
return ProjectContentRegistry.GetMscorlibContent().GetClass("System.Array");
return projectContent.GetClass(resolvedType.FullyQualifiedName);
return GetCompletionData(false);
}
*/
public virtual ArrayList GetCompletionData(IProjectContent projectContent)
protected ArrayList GetCompletionData(bool showStatic)
{
if (resolvedType == null) return null;
ArrayList res = new ArrayList();
foreach (IMethod m in resolvedType.GetMethods()) {
res.Add(m);
if (m.IsStatic == showStatic)
res.Add(m);
}
foreach (IEvent e in resolvedType.GetEvents()) {
res.Add(e);
if (e.IsStatic == showStatic)
res.Add(e);
}
foreach (IField f in resolvedType.GetFields()) {
res.Add(f);
if (f.IsStatic == showStatic)
res.Add(f);
}
foreach (IProperty p in resolvedType.GetProperties()) {
res.Add(p);
if (p.IsStatic == showStatic)
res.Add(p);
}
return res;
}
@ -241,12 +239,12 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -241,12 +239,12 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
/*
public override IClass GetResolvedClass(IProjectContent projectContent)
public override ArrayList GetCompletionData(IProjectContent projectContent)
{
return resolvedClass;
ArrayList ar = GetCompletionData(true);
ar.AddRange(resolvedClass.InnerClasses);
return ar;
}
*/
public override FilePosition GetDefinitionPosition()
{

793
src/Main/Base/Project/Src/Services/ParserService/CaseInsentitiveProjectContent.cs

@ -1,793 +0,0 @@ @@ -1,793 +0,0 @@
//using System;
//using System.IO;
//using System.Threading;
//using System.Collections;
//using System.Collections.Utility;
//using System.Collections.Generic;
//using System.Diagnostics;
//using System.Reflection;
//using System.Runtime.InteropServices;
//using System.Runtime.Serialization;
//using System.Runtime.Serialization.Formatters;
//using System.Runtime.Serialization.Formatters.Binary;
//using System.Security;
//using System.Security.Permissions;
//using System.Security.Policy;
//using System.Xml;
//using System.Text;
//
//using ICSharpCode.Core;
//using ICSharpCode.SharpDevelop.Project;
//using ICSharpCode.SharpDevelop.Gui;
//using ICSharpCode.SharpDevelop.Dom;
//
//namespace ICSharpCode.Core
//{
// public class CaseInsensitiveProjectContent : IProjectContent
// {
// const string CaseInsensitiveKey = "__CASE_INSENSITIVE_HASH";
//
// List<Assembly> references = new List<Assembly>();
//
// Dictionary<string, IClass> classes = new Dictionary<string, IClass>();
// Dictionary<string, IClass> caseInsensitiveClasses = new Dictionary<string, IClass>();
//
// Hashtable namespaces = new Hashtable();
// Hashtable caseInsensitiveNamespaces = new Hashtable();
//
// public static ProjectContent Create(IProject project)
// {
// ProjectContent newProjectContent = new ProjectContent();
// newProjectContent.references.Add(typeof(object).Assembly);
// foreach (ProjectItem item in project.Items) {
// switch (item.ItemType) {
// case ItemType.Reference:
// newProjectContent.references.Add(Assembly.ReflectionOnlyLoadFrom(item.FileName));
// break;
// case ItemType.Compile:
// ParserService.ParseFile(item.FileName);
// break;
// }
// }
// return newProjectContent;
// }
//
// public Hashtable AddClassToNamespaceList(IClass addClass)
// {
// string nSpace = addClass.Namespace;
// if (nSpace == null) {
// nSpace = String.Empty;
// }
//
// string[] path = nSpace.Split('.');
//
// lock (namespaces) {
// Hashtable cur = namespaces;
// Hashtable caseInsensitiveCur = caseInsensitiveNamespaces;
//
// for (int i = 0; i < path.Length; ++i) {
// object curPath = cur[path[i]];
// string lowerPath = path[i].ToLower();
// if (curPath == null) {
// Hashtable hashTable = new Hashtable();
// Hashtable caseInsensitivehashTable = new Hashtable();
// cur[path[i]] = curPath = hashTable;
// caseInsensitiveCur[lowerPath] = caseInsensitivehashTable;
// caseInsensitivehashTable[CaseInsensitiveKey] = hashTable;
// } else {
// if (!(curPath is Hashtable)) {
// return null;
// }
// }
// cur = (Hashtable)curPath;
//
// if (!caseInsensitiveCur.ContainsKey(lowerPath)) {
// caseInsensitiveCur[lowerPath] = new Hashtable();
// }
// caseInsensitiveCur = (Hashtable)caseInsensitiveCur[lowerPath];
// }
//
// string name = addClass.Name == null ? "" : addClass.Name;
//
// caseInsensitiveCur[name.ToLower()] = cur[name] = addClass;
// return cur;
// }
// }
//
// public void UpdateCompilationUnit(ICompilationUnit parserOutput, string fileName, bool updateCommentTags)
// {
// if (updateCommentTags) {
// TaskService.RemoveCommentTasks(fileName);
// if (parserOutput.TagComments.Count > 0) {
// foreach (Tag tag in parserOutput.TagComments) {
// TaskService.CommentTasks.Add(new Task(fileName, tag.Key + tag.CommentString, tag.Region.BeginColumn, tag.Region.BeginLine, TaskType.Comment));
// }
// TaskService.NotifyTaskChange();
// }
// }
//
// ICompilationUnit cu = (ICompilationUnit)parserOutput;
// foreach (IClass c in cu.Classes) {
// AddClassToNamespaceList(c);
// }
// }
//
// void RemoveClasses(ICompilationUnit cu)
// {
// if (cu != null) {
// lock (classes) {
// foreach (IClass c in cu.Classes) {
// classes.Remove(c.FullyQualifiedName);
// caseInsensitiveClasses.Remove(c.FullyQualifiedName.ToLower());
// }
// }
// }
// }
//
// #region Default Parser Layer dependent functions
// public IClass GetClass(string typeName)
// {
// return GetClass(typeName, true);
// }
// public IClass GetClass(string typeName, bool caseSensitive)
// {
// if (!caseSensitive) {
// typeName = typeName.ToLower();
// if (caseInsensitiveClasses.ContainsKey(typeName)) {
// return caseInsensitiveClasses[typeName];
// }
// } else {
// if (classes.ContainsKey(typeName)) {
// return classes[typeName];
// }
// }
//
// // not found -> maybe nested type -> trying to find class that contains this one.
// int lastIndex = typeName.LastIndexOf('.');
// if (lastIndex > 0) {
// string innerName = typeName.Substring(lastIndex + 1);
// string outerName = typeName.Substring(0, lastIndex);
// IClass upperClass = GetClass(outerName, caseSensitive);
// if (upperClass != null && upperClass.InnerClasses != null) {
// foreach (IClass c in upperClass.InnerClasses) {
// if (c.Name == innerName) {
// return c;
// }
// }
// }
// }
// return null;
// }
//
// public string[] GetNamespaceList(string subNameSpace)
// {
// return GetNamespaceList(subNameSpace, true);
// }
// public string[] GetNamespaceList(string subNameSpace, bool caseSensitive)
// {
// Console.WriteLine("GET NS LIST : " + subNameSpace);
// System.Diagnostics.Debug.Assert(subNameSpace != null);
// if (!caseSensitive) {
// subNameSpace = subNameSpace.ToLower();
// }
//
// string[] path = subNameSpace.Split('.');
// Hashtable cur = caseSensitive ? namespaces : caseInsensitiveNamespaces;
//
// if (subNameSpace.Length > 0) {
// for (int i = 0; i < path.Length; ++i) {
// if (!(cur[path[i]] is Hashtable)) {
// return null;
// }
// cur = (Hashtable)cur[path[i]];
// }
// }
//
// if (!caseSensitive) {
// cur = (Hashtable)cur[CaseInsensitiveKey];
// }
//
// ArrayList namespaceList = new ArrayList();
// foreach (DictionaryEntry entry in cur) {
// if (entry.Value is Hashtable && entry.Key.ToString().Length > 0) {
// namespaceList.Add(entry.Key);
// }
// }
//
// return (string[])namespaceList.ToArray(typeof(string));
// }
//
// public ArrayList GetNamespaceContents(string subNameSpace)
// {
// return GetNamespaceContents(subNameSpace, true);
// }
//
// public ArrayList GetNamespaceContents(string subNameSpace, bool caseSensitive)
// {
// Console.WriteLine("GET NS CONTENTS : " + subNameSpace);
// ArrayList namespaceList = new ArrayList();
// if (subNameSpace == null) {
// return namespaceList;
// }
// if (!caseSensitive) {
// subNameSpace = subNameSpace.ToLower();
// }
//
// string[] path = subNameSpace.Split('.');
// Hashtable cur = caseSensitive ? namespaces : caseInsensitiveNamespaces;
//
// for (int i = 0; i < path.Length; ++i) {
// if (!(cur[path[i]] is Hashtable)) {
// foreach (DictionaryEntry entry in cur) {
// if (entry.Value is Hashtable) {
// namespaceList.Add(entry.Key);
// }
// }
//
// return namespaceList;
// }
// cur = (Hashtable)cur[path[i]];
// }
//
// if (!caseSensitive) {
// cur = (Hashtable)cur[CaseInsensitiveKey];
// }
//
// foreach (DictionaryEntry entry in cur) {
// if (entry.Value is Hashtable) {
// namespaceList.Add(entry.Key);
// } else {
// namespaceList.Add(entry.Value);
// }
// }
// return namespaceList;
// }
//
// public bool NamespaceExists(string name)
// {
// return NamespaceExists(name, true);
// }
//
// public bool NamespaceExists(string name, bool caseSensitive)
// {
// Console.WriteLine("GET NamespaceExists : " + name);
// if (name == null) {
// return false;
// }
// if (!caseSensitive) {
// name = name.ToLower();
// }
// string[] path = name.Split('.');
// Hashtable cur = caseSensitive ? namespaces : caseInsensitiveNamespaces;
//
// for (int i = 0; i < path.Length; ++i) {
// if (!(cur[path[i]] is Hashtable)) {
// return false;
// }
// cur = (Hashtable)cur[path[i]];
// }
// return true;
// }
//
// /// <remarks>
// /// Returns the innerst class in which the carret currently is, returns null
// /// if the carret is outside any class boundaries.
// /// </remarks>
// public IClass GetInnermostClass(ICompilationUnit cu, int caretLine, int caretColumn)
// {
// if (cu != null) {
// foreach (IClass c in cu.Classes) {
// if (c != null && c.Region != null && c.Region.IsInside(caretLine, caretColumn)) {
// return GetInnermostClass(c, caretLine, caretColumn);
// }
// }
// }
// return null;
// }
// IClass GetInnermostClass(IClass curClass, int caretLine, int caretColumn)
// {
// if (curClass == null) {
// return null;
// }
// if (curClass.InnerClasses == null) {
// return curClass;
// }
// foreach (IClass c in curClass.InnerClasses) {
// if (c != null && c.Region != null && c.Region.IsInside(caretLine, caretColumn)) {
// return GetInnermostClass(c, caretLine, caretColumn);
// }
// }
// return curClass;
// }
//
// /// <remarks>
// /// Returns all (nestet) classes in which the carret currently is exept
// /// the innermost class, returns an empty collection if the carret is in
// /// no class or only in the innermost class.
// /// the most outer class is the last in the collection.
// /// </remarks>
// public List<IClass> GetOuterClasses(ICompilationUnit cu, int caretLine, int caretColumn)
// {
// List<IClass> classes = new List<IClass>();
// if (cu != null) {
// foreach (IClass c in cu.Classes) {
// if (c != null && c.Region != null && c.Region.IsInside(caretLine, caretColumn)) {
// if (c != GetInnermostClass(cu, caretLine, caretColumn)) {
// GetOuterClasses(classes, c, cu, caretLine, caretColumn);
// if (!classes.Contains(c)) {
// classes.Add(c);
// }
// }
// break;
// }
// }
// }
//
// return classes;
// }
// void GetOuterClasses(List<IClass> classes, IClass curClass, ICompilationUnit cu, int caretLine, int caretColumn)
// {
// if (curClass != null) {
// foreach (IClass c in curClass.InnerClasses) {
// if (c != null && c.Region != null && c.Region.IsInside(caretLine, caretColumn)) {
// if (c != GetInnermostClass(cu, caretLine, caretColumn)) {
// GetOuterClasses(classes, c, cu, caretLine, caretColumn);
// if (!classes.Contains(c)) {
// classes.Add(c);
// }
// }
// break;
// }
// }
// }
// }
// public string SearchNamespace(string name, ICompilationUnit unit, int caretLine, int caretColumn)
// {
// return SearchNamespace(name, unit, caretLine, caretColumn, true);
// }
//
// /// <remarks>
// /// use the usings to find the correct name of a namespace
// /// </remarks>
// public string SearchNamespace(string name, ICompilationUnit unit, int caretLine, int caretColumn, bool caseSensitive)
// {
// if (NamespaceExists(name, caseSensitive)) {
// return name;
// }
// if (unit == null) {
// return null;
// }
//
// foreach (IUsing u in unit.Usings) {
// if (u != null && (u.Region == null || u.Region.IsInside(caretLine, caretColumn))) {
// string nameSpace = u.SearchNamespace(name, caseSensitive);
// if (nameSpace != null) {
// return nameSpace;
// }
// }
// }
// return null;
// }
//
// /// <remarks>
// /// use the usings and the name of the namespace to find a class
// /// </remarks>
// public IClass SearchType(string name, IClass curType, int caretLine, int caretColumn)
// {
// return SearchType(name, curType, caretLine, caretColumn, true);
// }
// public IClass SearchType(string name, IClass curType, int caretLine, int caretColumn, bool caseSensitive)
// {
// if (curType == null) {
// return SearchType(name, null, null, caretLine, caretColumn, caseSensitive);
// }
// return SearchType(name, curType, curType.CompilationUnit, caretLine, caretColumn, caseSensitive);
// }
//
// public IClass SearchType(string name, IClass curType, ICompilationUnit unit, int caretLine, int caretColumn)
// {
// return SearchType(name, curType, unit, caretLine, caretColumn, true);
// }
//
// /// <remarks>
// /// use the usings and the name of the namespace to find a class
// /// </remarks>
// public IClass SearchType(string name, IClass curType, ICompilationUnit unit, int caretLine, int caretColumn, bool caseSensitive)
// {
// if (name == null || name == String.Empty) {
// return null;
// }
// IClass c = GetClass(name, caseSensitive);
// if (c != null) {
// return c;
// }
// if (unit != null) {
// foreach (IUsing u in unit.Usings) {
// if (u != null && (u.Region == null || u.Region.IsInside(caretLine, caretColumn))) {
// c = u.SearchType(name, caseSensitive);
// if (c != null) {
// return c;
// }
// }
// }
// }
// if (curType == null) {
// return null;
// }
// string fullname = curType.FullyQualifiedName;
// string[] namespaces = fullname.Split('.');
// StringBuilder curnamespace = new StringBuilder();
// for (int i = 0; i < namespaces.Length; ++i) {
// curnamespace.Append(namespaces[i]);
// curnamespace.Append('.');
// StringBuilder nms=new StringBuilder(curnamespace.ToString());
// nms.Append(name);
// c = GetClass(nms.ToString(), caseSensitive);
// if (c != null) {
// return c;
// }
// }
////// Alex: try to find in namespaces referenced excluding system ones which were checked already
// string[] innamespaces=GetNamespaceList("");
// foreach (string ns in innamespaces) {
//// if (Array.IndexOf(ParserService.assemblyList,ns)>=0) continue;
// ArrayList objs=GetNamespaceContents(ns);
// if (objs==null) continue;
// foreach (object o in objs) {
// if (o is IClass) {
// IClass oc=(IClass)o;
// // || oc.Name==name
// if (oc.FullyQualifiedName == name) {
// //Debug.WriteLine(((IClass)o).Name);
// /// now we can set completion data
// objs.Clear();
// objs = null;
// return oc;
// }
// }
// }
// if (objs == null) {
// break;
// }
// }
// innamespaces=null;
////// Alex: end of mod
// return null;
// }
//
// /// <remarks>
// /// Returns true, if class possibleBaseClass is in the inheritance tree from c
// /// </remarks>
// public bool IsClassInInheritanceTree(IClass possibleBaseClass, IClass c)
// {
// return IsClassInInheritanceTree(possibleBaseClass, c, true);
// }
//
// public bool IsClassInInheritanceTree(IClass possibleBaseClass, IClass c, bool caseSensitive)
// {
// if (possibleBaseClass == null || c == null) {
// return false;
// }
// if (caseSensitive && possibleBaseClass.FullyQualifiedName == c.FullyQualifiedName ||
// !caseSensitive && possibleBaseClass.FullyQualifiedName.ToLower() == c.FullyQualifiedName.ToLower()) {
// return true;
// }
// foreach (string baseClass in c.BaseTypes) {
// if (IsClassInInheritanceTree(possibleBaseClass, SearchType(baseClass, c, c.CompilationUnit, c.Region != null ? c.Region.BeginLine : -1, c.Region != null ? c.Region.BeginColumn : -1))) {
// return true;
// }
// }
// return false;
// }
//
// public IClass BaseClass(IClass curClass)
// {
// return BaseClass(curClass, true);
// }
//
// public IClass BaseClass(IClass curClass, bool caseSensitive)
// {
// foreach (string s in curClass.BaseTypes) {
// IClass baseClass = SearchType(s, curClass, curClass.Region != null ? curClass.Region.BeginLine : 0, curClass.Region != null ? curClass.Region.BeginColumn : 0, caseSensitive);
// if (baseClass != null && baseClass.ClassType != ClassType.Interface) {
// return baseClass;
// }
// }
// // no baseType found
// if (curClass.ClassType == ClassType.Enum) {
// return GetClass("System.Enum", true);
// } else if (curClass.ClassType == ClassType.Class) {
// if (curClass.FullyQualifiedName != "System.Object") {
// return GetClass("System.Object", true);
// }
// } else if (curClass.ClassType == ClassType.Delegate) {
// return GetClass("System.Delegate", true);
// } else if (curClass.ClassType == ClassType.Struct) {
// return GetClass("System.ValueType", true);
// }
// return null;
// }
//
// bool IsInnerClass(IClass c, IClass possibleInnerClass)
// {
// foreach (IClass inner in c.InnerClasses) {
// if (inner.FullyQualifiedName == possibleInnerClass.FullyQualifiedName) {
// return true;
// }
// if (IsInnerClass(inner, possibleInnerClass)) {
// return true;
// }
// }
// return false;
// }
//
// // TODO: check inner classes for protected members too
// // TODO: look for FullyQualifiedName == FullyQualifiedName. Must be replaced by a function wich pays attention to the case.
// // Look at NRefactoryResolver.IsSameName. Also pay attention if you can put this Function in IClass, and if you have to
// // compare the names instead of the FullyQualifiedNames
// public bool IsAccessible(IClass c, IDecoration member, IClass callingClass, bool isClassInInheritanceTree)
// {
// if ((member.Modifiers & ModifierEnum.Internal) == ModifierEnum.Internal) {
// return true;
// }
// if ((member.Modifiers & ModifierEnum.Public) == ModifierEnum.Public) {
// return true;
// }
// if ((member.Modifiers & ModifierEnum.Protected) == ModifierEnum.Protected && (isClassInInheritanceTree)) {
// return true;
// }
// return c != null && callingClass != null && (c.FullyQualifiedName == callingClass.FullyQualifiedName || IsInnerClass(c, callingClass));
// }
//
// public bool MustBeShown(IClass c, IDecoration member, IClass callingClass, bool showStatic, bool isClassInInheritanceTree)
// {
// if (c != null && c.ClassType == ClassType.Enum) {
// return true;
// }
// if ((!showStatic && ((member.Modifiers & ModifierEnum.Static) == ModifierEnum.Static)) ||
// ( showStatic && !(((member.Modifiers & ModifierEnum.Static) == ModifierEnum.Static) ||
// ((member.Modifiers & ModifierEnum.Const) == ModifierEnum.Const)))) { // const is automatically static
// return false;
// }
// return IsAccessible(c, member, callingClass, isClassInInheritanceTree);
// }
//
// public ArrayList ListTypes(ArrayList types, IClass curType, IClass callingClass)
// {
// bool isClassInInheritanceTree = IsClassInInheritanceTree(curType, callingClass);
// foreach (IClass c in curType.InnerClasses) {
// if (((c.ClassType == ClassType.Class) || (c.ClassType == ClassType.Struct)) &&
// IsAccessible(curType, c, callingClass, isClassInInheritanceTree)) {
// types.Add(c);
// }
// }
// IClass baseClass = BaseClass(curType);
// if (baseClass != null) {
// ListTypes(types, baseClass, callingClass);
// }
// return types;
// }
//
// public ArrayList ListMembers(ArrayList members, IClass curType, IClass callingClass, bool showStatic)
// {
// DateTime now = DateTime.Now;
//
// // enums must be handled specially, because there are several things defined we don't want to show
// // and enum members have neither the modifier nor the modifier public
// if (curType.ClassType == ClassType.Enum) {
// foreach (IField f in curType.Fields) {
// if (f.IsLiteral) {
// members.Add(f);
// }
// }
// ListMembers(members, GetClass("System.Enum", true), callingClass, showStatic);
// return members;
// }
//
// bool isClassInInheritanceTree = IsClassInInheritanceTree(curType, callingClass);
//
// if (showStatic) {
// foreach (IClass c in curType.InnerClasses) {
// if (IsAccessible(curType, c, callingClass, isClassInInheritanceTree)) {
// members.Add(c);
// }
// }
// }
//
// foreach (IProperty p in curType.Properties) {
// if (MustBeShown(curType, p, callingClass, showStatic, isClassInInheritanceTree)) {
// members.Add(p);
// }
// }
//
// foreach (IMethod m in curType.Methods) {
// if (MustBeShown(curType, m, callingClass, showStatic, isClassInInheritanceTree)) {
// members.Add(m);
// }
// }
//
// foreach (IEvent e in curType.Events) {
// if (MustBeShown(curType, e, callingClass, showStatic, isClassInInheritanceTree)) {
// members.Add(e);
// }
// }
//
// foreach (IField f in curType.Fields) {
// if (MustBeShown(curType, f, callingClass, showStatic, isClassInInheritanceTree)) {
// members.Add(f);
// }
// }
//
// if (curType.ClassType == ClassType.Interface && !showStatic) {
// foreach (string s in curType.BaseTypes) {
// IClass baseClass = SearchType(s, curType, curType.Region != null ? curType.Region.BeginLine : -1, curType.Region != null ? curType.Region.BeginColumn : -1);
// if (baseClass != null && baseClass.ClassType == ClassType.Interface) {
// ListMembers(members, baseClass, callingClass, showStatic);
// }
// }
// } else {
// IClass baseClass = BaseClass(curType);
// if (baseClass != null) {
// ListMembers(members, baseClass, callingClass, showStatic);
// }
// }
//
// return members;
// }
//
// public IMember SearchMember(IClass declaringType, string memberName)
// {
// if (declaringType == null || memberName == null || memberName.Length == 0) {
// return null;
// }
// foreach (IField f in declaringType.Fields) {
// if (f.Name == memberName) {
// return f;
// }
// }
// foreach (IProperty p in declaringType.Properties) {
// if (p.Name == memberName) {
// return p;
// }
// }
// foreach (IIndexer i in declaringType.Indexer) {
// if (i.Name == memberName) {
// return i;
// }
// }
// foreach (IEvent e in declaringType.Events) {
// if (e.Name == memberName) {
// return e;
// }
// }
// foreach (IMethod m in declaringType.Methods) {
// if (m.Name == memberName) {
// return m;
// }
// }
// if (declaringType.ClassType == ClassType.Interface) {
// foreach (string baseType in declaringType.BaseTypes) {
// int line = -1;
// int col = -1;
// if (declaringType.Region != null) {
// line = declaringType.Region.BeginLine;
// col = declaringType.Region.BeginColumn;
// }
// IClass c = SearchType(baseType, declaringType, line, col);
// if (c != null) {
// return SearchMember(c, memberName);
// }
// }
// } else {
// IClass c = BaseClass(declaringType);
// return SearchMember(c, memberName);
// }
// return null;
// }
//
// public Position GetPosition(string fullMemberName)
// {
// string[] name = fullMemberName.Split(new char[] {'.'});
// string curName = name[0];
// int i = 1;
// while (i < name.Length && NamespaceExists(curName)) {
// curName += '.' + name[i];
// ++i;
// }
// Debug.Assert(i <= name.Length);
// IClass curClass = GetClass(curName);
// if (curClass == null) {
// return new Position(null, -1, -1);
// }
// ICompilationUnit cu = curClass.CompilationUnit;
// while (i < name.Length) {
// List<IClass> innerClasses = curClass.InnerClasses;
// foreach (IClass c in innerClasses) {
// if (c.Name == name[i]) {
// curClass = c;
// break;
// }
// }
// if (curClass.Name != name[i]) {
// break;
// }
// ++i;
// }
// if (i >= name.Length) {
// return new Position(cu, curClass.Region != null ? curClass.Region.BeginLine : -1, curClass.Region != null ? curClass.Region.BeginColumn : -1);
// }
// IMember member = SearchMember(curClass, name[i]);
// if (member == null || member.Region == null) {
// return new Position(cu, -1, -1);
// }
// return new Position(cu, member.Region.BeginLine, member.Region.BeginColumn);
// }
// #endregion
//
// int GetAddedItems(ICompilationUnit original, ICompilationUnit changed, ICompilationUnit result)
// {
// int count = 0;
// result.Classes.Clear();
// count += DiffUtility.GetAddedItems(original.Classes, changed.Classes, result.Classes);
// return count;
// }
//
// int GetRemovedItems(ICompilationUnit original, ICompilationUnit changed, ICompilationUnit result)
// {
// return GetAddedItems(changed, original, result);
// }
//
//
// void OnParseInformationAdded(ParseInformationEventArgs e)
// {
// if (ParseInformationAdded != null) {
// ParseInformationAdded(null, e);
// }
// }
//
// void OnParseInformationRemoved(ParseInformationEventArgs e)
// {
// if (ParseInformationRemoved != null) {
// ParseInformationRemoved(null, e);
// }
// }
//
// void OnParseInformationChanged(ParseInformationEventArgs e)
// {
// if (ParseInformationChanged != null) {
// ParseInformationChanged(null, e);
// }
// }
//
// public event ParseInformationEventHandler ParseInformationAdded;
// public event ParseInformationEventHandler ParseInformationRemoved;
// public event ParseInformationEventHandler ParseInformationChanged;
// }
//}
//
//
////readonly static string[] assemblyList = {
//// "Microsoft.VisualBasic",
//// "Microsoft.JScript",
//// "mscorlib",
//// "System.Data",
//// "System.Design",
//// "System.DirectoryServices",
//// "System.Drawing.Design",
//// "System.Drawing",
//// "System.EnterpriseServices",
//// "System.Management",
//// "System.Messaging",
//// "System.Runtime.Remoting",
//// "System.Runtime.Serialization.Formatters.Soap",
////
//// "System.Security",
//// "System.ServiceProcess",
//// "System.Web.Services",
//// "System.Web",
//// "System.Windows.Forms",
//// "System",
//// "System.XML"
//// };
////
////

69
src/Main/Base/Project/Src/Services/ParserService/CaseSensitiveProjectContent.cs

@ -150,8 +150,8 @@ namespace ICSharpCode.Core @@ -150,8 +150,8 @@ namespace ICSharpCode.Core
return cur;
}
}
public void UpdateCompilationUnit(ICompilationUnit oldUnit, ICompilationUnit parserOutput, string fileName, bool updateCommentTags)
public void UpdateCompilationUnit(ICompilationUnit oldUnit, ICompilationUnit parserOutput, string fileName, bool updateCommentTags)
{
if (updateCommentTags) {
@ -212,39 +212,6 @@ namespace ICSharpCode.Core @@ -212,39 +212,6 @@ namespace ICSharpCode.Core
return null;
}
public string[] GetNamespaceList(string subNameSpace)
{
// Console.WriteLine("GetNamespaceList({0})", subNameSpace);
System.Diagnostics.Debug.Assert(subNameSpace != null);
List<string> namespaceList = new List<string>();
foreach (IProjectContent content in referencedContents) {
string[] referencedNamespaces = content.GetNamespaceList(subNameSpace);
if (referencedNamespaces != null) {
namespaceList.AddRange(referencedNamespaces);
}
}
string[] path = subNameSpace.Split('.');
Hashtable cur = namespaces;
if (subNameSpace.Length > 0) {
for (int i = 0; i < path.Length; ++i) {
if (!(cur[path[i]] is Hashtable)) {
return namespaceList.ToArray();
}
cur = (Hashtable)cur[path[i]];
}
}
foreach (DictionaryEntry entry in cur) {
if (entry.Value is Hashtable && entry.Key.ToString().Length > 0) {
namespaceList.Add(entry.Key.ToString());
}
}
return namespaceList.ToArray();
}
public ArrayList GetNamespaceContents(string subNameSpace)
{
ArrayList namespaceList = new ArrayList();
@ -253,32 +220,38 @@ namespace ICSharpCode.Core @@ -253,32 +220,38 @@ namespace ICSharpCode.Core
}
foreach (IProjectContent content in referencedContents) {
ArrayList referencedNamespaceContents = content.GetNamespaceContents(subNameSpace);
namespaceList.AddRange(referencedNamespaceContents.ToArray());
foreach (object o in content.GetNamespaceContents(subNameSpace)) {
if (o is string) {
if (!namespaceList.Contains(o))
namespaceList.Add(o);
} else {
namespaceList.Add(o);
}
}
}
string[] path = subNameSpace.Split('.');
Hashtable cur = namespaces;
for (int i = 0; i < path.Length; ++i) {
if (!(cur[path[i]] is Hashtable)) {
foreach (DictionaryEntry entry in cur) {
if (entry.Value is Hashtable) {
namespaceList.Add(entry.Key);
}
if (subNameSpace.Length > 0) {
string[] path = subNameSpace.Split('.');
for (int i = 0; i < path.Length; ++i) {
if (!(cur[path[i]] is Hashtable)) {
// namespace does not exist in this project content
return namespaceList;
}
return namespaceList;
cur = (Hashtable)cur[path[i]];
}
cur = (Hashtable)cur[path[i]];
}
foreach (DictionaryEntry entry in cur) {
if (entry.Value is Hashtable) {
namespaceList.Add(entry.Key);
if (!namespaceList.Contains(entry.Key))
namespaceList.Add(entry.Key);
} else {
namespaceList.Add(entry.Value);
}
}
return namespaceList;
}
@ -448,7 +421,7 @@ namespace ICSharpCode.Core @@ -448,7 +421,7 @@ namespace ICSharpCode.Core
return members;
}
*/
*/
public Position GetPosition(string fullMemberName)
{

1
src/Main/Base/Project/Src/Services/ParserService/IProjectContent.cs

@ -39,7 +39,6 @@ namespace ICSharpCode.Core @@ -39,7 +39,6 @@ namespace ICSharpCode.Core
IClass GetClass(string typeName);
bool NamespaceExists(string name);
string[] GetNamespaceList(string subNameSpace);
ArrayList GetNamespaceContents(string subNameSpace);
string SearchNamespace(string name, ICompilationUnit unit, int caretLine, int caretColumn);

3
src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs

@ -115,8 +115,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -115,8 +115,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
if (charTyped == ' ' && (expression.LastIndexOf("using")>=0 || expression.ToUpper().LastIndexOf("IMPORTS")>=0)) {
if (expression == "using" || expression.EndsWith(" using") || expression.EndsWith("\tusing")|| expression.EndsWith("\nusing")|| expression.EndsWith("\rusing") ||
expression.ToUpper() == "IMPORTS" || expression.ToUpper().EndsWith(" IMPORTS") || expression.ToUpper().EndsWith("\tIMPORTS")|| expression.ToUpper().EndsWith("\nIMPORTS")|| expression.ToUpper().EndsWith("\rIMPORTS")) {
string[] namespaces = ParserService.CurrentProjectContent.GetNamespaceList("");
AddResolveResults(namespaces);
AddResolveResults(ParserService.CurrentProjectContent.GetNamespaceContents(""));
}
} else {
// we don't need to run parser on blank char here

Loading…
Cancel
Save