[MonoDevelop] Goto class patch

Jacob Ilsø Christensen jacobilsoe at gmail.com
Wed May 18 13:32:37 EDT 2005


On 5/18/05, Lluis Sanchez <lluis at ximian.com> wrote:
> On dc, 2005-05-18 at 18:46 +0200, Jacob Ilsø Christensen wrote:
> > Hi.
> >
> > I agree that the name might not be the best, but the patch is still
> > under development so I have not decided yet.
> >
> > I am not sure it should be: "get me what's at that position". I think
> > it should be something like: "give me the position where the element
> > at the current position is declared". At least that was the intended
> > functionality when the patch is completed.
> 
> Yeah, that's the intended functionality for the "Go to definition"
> command. But to implement this command a "give me the element at that
> position" method in IParserService (and in IParser) should be enough.
> You can get the position where the element is declared from the element
> itself (e.g. IClass.Region).
> 

Hmm, I think I will give an example of what I mean. Suppose you have this code:

1: int i;
2: int j;
3:
4: i = 7;

If you position your cursor on i on line 4, I want a method which
gives me the element at line 1. From this element I could then extract
the position via the Region property. So I need a method which should
do something like: "give me the declaring element". This method would
get the string i as argument and return the IField (or whatever it is
called) object for line 1. Is this not what we need?

> >
> > We could then add some code to get the type as well. But if I am not
> > wrong, the MonodocResolver does this job. So maybe we should use this
> > (and possibly rename it) for the tool tip functionality?
> 
> I'm not sure to understand. The GotoDefinitionResolver method in your
> patch returns an IClass, that is, a type. If MonodocResolver does the
> same, there is no need for a new one (after renaming MonodocResolver of
> course).

It is true that the GotoDefinitionResolver method returns an IClass,
but the patch was only intended as a demonstration to see if people
agreed that such functionality was needed in MD. It should not return
an IClass but something more general.

/Jacob

> 
> Lluis.
> 
> >
> > /Jacob
> >
> > On 5/18/05, Lluis Sanchez <lluis at ximian.com> wrote:
> > > Please, don't use GotoDefinitionResolver for the method name. Think
> > > about a more generic name since the same method may be used for purposes
> > > other than "Goto definition" (for example, for showing class info in a
> > > tooltip).
> > >
> > > I think that the method should also be more generic and should return
> > > whatever is present at the given file position (it could be a type, but
> > > also a variable reference, or a method call).
> > >
> > > it sould be a "get me what's at that position"
> > >
> > > On dj, 2005-05-12 at 21:21 +0200, Jacob Ilsø Christensen wrote:
> > > > Hi.
> > > >
> > > > I have attached a patch which lets you jump to a class definition. If
> > > > you position the cursor on a class name, and hit Ctrl+. (hardcoded for
> > > > now) the editor will jump to the definition of that class.
> > > >
> > > > The code is very proof-of-concept-like :-) It definately needs some
> > > > refactoring and cleaning up. I just wanted someone to try it out and
> > > > firstly see if it works and secondly let me know if this is desired
> > > > functionality.
> > > >
> > > > So let me know, if I should add more functionality like methods,
> > > > fields, etc. or maybe do thing another way?
> > > >
> > > > /Jacob
> > >
> > > _______________________________________________
> > > 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