[MonoDevelop] DefaultParserService: deep class search in SearchType()

Peter Johanson latexer at gentoo.org
Wed Jun 15 09:16:33 EDT 2005


Hey all,

Currently, if you have a project with a reference to gtk-sharp.dll, and
you instantiate a Gtk.Window, w, then trying to complete the members of
"w.GdkWindow" doesn't work (in either C# or Boo bindings, haven't
checked others). The culprit is SearchType() in
DefaultParserServices.cs. The attached patch makes SearchType do deep
searches of assemblies referenced by project references.

I've not found any side effects caused by this, but since we've got no
unit tests, I can't be sure. Would people prefer I overload SearchType
instead, with a bool for whether to do deep searches ,and modify the
various language bindings?

-pete

-- 
Peter Johanson
<latexer at gentoo.org>
-------------- next part --------------
Index: Core/src/MonoDevelop.Base/Services/ParserService/DefaultParserService.cs
===================================================================
--- Core/src/MonoDevelop.Base/Services/ParserService/DefaultParserService.cs	(revision 2597)
+++ Core/src/MonoDevelop.Base/Services/ParserService/DefaultParserService.cs	(working copy)
@@ -367,6 +367,8 @@
 					GetDatabase (re.Uri);
 
 				project.NameChanged += new CombineEntryRenamedEventHandler (OnProjectRenamed);
+				project.ReferenceAddedToProject += new ProjectReferenceEventHandler (OnProjectReferencesChanged);
+				project.ReferenceRemovedFromProject += new ProjectReferenceEventHandler (OnProjectReferencesChanged);
 			}
 		}
 		
@@ -987,7 +989,7 @@
 		public IClass SearchType(Project project, IUsing iusing, string partitialTypeName, bool caseSensitive)
 		{
 //			Runtime.LoggingService.Info("Search type : >{0}<", partitialTypeName);
-			IClass c = GetClass(project, partitialTypeName, caseSensitive);
+			IClass c = GetClass(project, partitialTypeName, true, caseSensitive);
 			if (c != null) {
 				return c;
 			}
@@ -995,7 +997,7 @@
 			foreach (string str in iusing.Usings) {
 				string possibleType = String.Concat(str, ".", partitialTypeName);
 //				Runtime.LoggingService.Info("looking for " + possibleType);
-				c = GetClass(project, possibleType, caseSensitive);
+				c = GetClass(project, possibleType, true, caseSensitive);
 				if (c != null) {
 //					Runtime.LoggingService.Info("Found!");
 					return c;
@@ -1008,7 +1010,7 @@
 				while (declaringNamespace.Length > 0) {
 					string className = String.Concat(declaringNamespace, ".", partitialTypeName);
 //					Runtime.LoggingService.Info("looking for " + className);
-					c = GetClass(project, className, caseSensitive);
+					c = GetClass(project, className, true, caseSensitive);
 					if (c != null) {
 //						Runtime.LoggingService.Info("Found!");
 						return c;
@@ -1029,7 +1031,7 @@
 					if (aliasString.Length > 0) {
 						className = String.Concat(entry.Value.ToString(), partitialTypeName.Remove(0, aliasString.Length));
 //						Runtime.LoggingService.Info("looking for " + className);
-						c = GetClass(project, className, caseSensitive);
+						c = GetClass(project, className, true, caseSensitive);
 						if (c != null) {
 //							Runtime.LoggingService.Info("Found!");
 							return c;
Index: Core/src/MonoDevelop.Base/ChangeLog
===================================================================
--- Core/src/MonoDevelop.Base/ChangeLog	(revision 2597)
+++ Core/src/MonoDevelop.Base/ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2005-06-15  Peter Johanson  <latexer at gentoo.org>
+
+	* Services/ParserService/DefaultParserService.cs: Do a deep search
+	of classes in SearchType, so types from assemblies referenced by
+	project references are resolved.
+
 2005-06-10  Jacob Ils? Christensen  <jacobilsoe at gmail.com>
 
 	* Gui/Dialogs/ReferenceDialog/SelectReferenceDialog.cs: Make sure


More information about the Monodevelop-list mailing list