[MonoDevelop] [PATCH] Fix Improper MemberNodeCommandHandling inClassPad

Lluis Sanchez lluis at ximian.com
Fri May 25 07:25:39 EDT 2007


El dv 25 de 05 del 2007 a les 06:38 -0400, en/na Jeffrey Stedfast va
escriure:
> On Fri, 2007-05-25 at 12:22 +0200, Lluis Sanchez wrote:
> > Hi,
> > 
> > > When a member in a ClassPad was clicked, the correct source file was
> > > not being opened. This patch fixes it by including filename
> > > information in all Region objects.
> > 
> > I'm concerned about memory use. If every member of the class has the
> > name of the file, that's a lot of duplicated strings in memory, and will
> > be noticeable in big projects such as MonoDevelop which has thousands of
> > members. I know that the file name string instance is shared at parse
> > time, but this info is saved to disk (to pidb files) and later reloaded,
> > and when reloaded an instance will be created for each string. That's
> > something to take into account.
> 
> One possibility is to have the pidb loading code keep a table of unique
> FileName strings as they are loaded from disk, and set the instance to
> the unique string rather than the one loaded.

Yes, that's one possible solution.

> 
> > 
> > > This is my first patch. So please point out any mistakes and omissions.
> > 
> > Always provide patches as an attachment to the mail, since mail readers
> > are likely to mess up the formatting.
> > 
> > Thanks!
> > Lluis.
> > 
> > > 
> > > --- monodevelop-0.13.1/Extras/CSharpBinding/Parser/Parser.cs	2007-03-08
> > > 04:32:26.000000000 +0530
> > > +++ monodevelop-0.13.1.patch/Extras/CSharpBinding/Parser/Parser.cs	2007-05-23
> > > 13:53:40.000000000 +0530
> > > @@ -95,8 +95,17 @@
> > >  			// FIXME: track api changes
> > >  			//visitor.Cu.ErrorInformation = p.Errors.ErrorInformation;
> > >  			RetrieveRegions (visitor.Cu, p.Lexer.SpecialTracker);
> > > -			foreach (IClass c in visitor.Cu.Classes)
> > > +			foreach (IClass c in visitor.Cu.Classes) {
> > >  				c.Region.FileName = fileName;
> > > +				foreach (IField f in c.Fields)
> > > +					f.Region.FileName = fileName;
> > > +				foreach (IMethod m in c.Methods)
> > > +					m.Region.FileName = fileName;
> > > +				foreach (IProperty pr in c.Properties)
> > > +					pr.Region.FileName = fileName;
> > > +				foreach (IEvent ev in c.Events)
> > > +					ev.Region.FileName = fileName;				
> > > +			}
> > >  			AddCommentTags (visitor.Cu, p.Lexer.TagComments);
> > >              return visitor.Cu;
> > >        	}
> > > 
> > > 
> > > --- md/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/MemberNodeCommandHandler.cs	2007-03-08
> > > 04:31:51.000000000 +0530
> > > +++ monodevelop-0.13.1.patch/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/MemberNodeCommandHandler.cs	2007-05-23
> > > 13:52:22.000000000 +0530
> > > @@ -39,21 +39,10 @@
> > >  	{
> > >  		public override void ActivateItem ()
> > >  		{
> > > -			string file = GetFileName ();
> > >  			IMember member = CurrentNode.DataItem as IMember;
> > > +			string file = member.Region.FileName;
> > >  			int line = member.Region.BeginLine;
> > >  			IdeApp.Workbench.OpenDocument (file, Math.Max (1, line), 1, true);
> > >  		}
> > > -		
> > > -		string GetFileName ()
> > > -		{
> > > -			IMember member = (IMember) CurrentNode.GetParentDataItem
> > > (typeof(IMember), true);
> > > -			if (member != null && member.Region.FileName != null) return
> > > member.Region.FileName;
> > > -			
> > > -			ClassData cls = (ClassData) CurrentNode.GetParentDataItem
> > > (typeof(ClassData), true);
> > > -			if (cls != null && cls.Class.Region.FileName != null) return
> > > cls.Class.Region.FileName;
> > > -			
> > > -			return null;
> > > -		}
> > >  	}
> > >  }
> > > 
> > > --- md/Core/src/MonoDevelop.Ide/ChangeLog	2007-03-08 04:31:53.000000000 +0530
> > > +++ monodevelop-0.13.1.patch/Core/src/MonoDevelop.Ide/ChangeLog	2007-05-23
> > > 14:08:51.000000000 +0530
> > > @@ -1,3 +1,7 @@
> > > +2007-05-23  Balaji Rao R <balajirrao at gmail.com>
> > > +	* MonoDevelop.Ide.Gui.Pads.ClassPad/MemberNodeCommandHandler.cs : Made
> > > +	to obtain FileName information directly from the respective regions.
> > > +
> > >  2007-02-24  Lluis Sanchez Gual <lluis at novell.com>
> > > 
> > >  	* MonoDevelop.Ide.addin.xml: Fix compatible version number.
> > > 
> > > 
> > > --- monodevelop-0.13.1/Extras/CSharpBinding/ChangeLog	2007-03-08
> > > 04:32:26.000000000 +0530
> > > +++ monodevelop-0.13.1.patch/Extras/CSharpBinding/ChangeLog	2007-05-23
> > > 14:04:10.000000000 +0530
> > > @@ -1,3 +1,7 @@
> > > +2007-05-23 Balaji Rao R <balajirrao at gmail.com>
> > > +	* Parser/Parser.cs : Include FileName information in all regions
> > > +	belonging to a class.
> > > +
> > >  2007-02-16  Lluis Sanchez Gual <lluis at novell.com>
> > > 
> > >  	* Gui/CSharpTextEditorExtension.cs: Don't show completion windo for
> > > 
> > > 
> > 
> > _______________________________________________
> > Monodevelop-list mailing list
> > Monodevelop-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/monodevelop-list
> 



More information about the Monodevelop-list mailing list