[MonoDevelop] Some questions

Lluis Sanchez lluis at ximian.com
Fri Mar 3 09:03:59 EST 2006


The Resolve method takes the file content as parameter, so you can look
for the line-column position by scanning the content. 

Right now there isn't a simpler way to do it, but maybe you can help
improving this. The idea is to use the ITextFile iterface (which is
defined in MonoDevelop.Projects.Text) instead of the pair
fileName/fileContent as parameters for the IParser.Resolve method.

The advantage of using this interface is that it already provides
methods for getting text from line-column positions, and different text
file sources can provide specially optimized implementations of those
methods. For example, the text editor currently implements ITextFile,
and the GetPositionFromLineColumn method is implemented using the
SourceView methods.

Notice that IParserContext.ParseFile already has an overload that takes
an ITextFile as parameter. IParserContext.GetEnclosingLanguageItem is
also using ITextFile instead of fileName/fileContent. Changing
IParser.Reslove shouldn't be too difficult.

Lluis.

El vie, 03-03-2006 a las 14:14 +0100, Alejandro Serrano escribió:
> So then, what's the best way to take the text from one line-column to 
> another line-column? I already managed how to find the method, so that's 
> the only thing left.
> 
> Regards
> trupill
> 
> Kamil Skalski escribió:
> > 2006/3/2, Jacob Ilsø Christensen <jacobilsoe at gmail.com>:
> >   
> >> Hi.
> >>
> >> I am afraid I don't know exactly what you want to do. In this example:
> >>
> >> void M()
> >> {
> >> int a;
> >> int b;|
> >> int c;
> >> }
> >>
> >> The cursor is indicated by |. Is what you want to retrieve this piece of code:
> >>
> >> int a;
> >> int b;
> >>
> >> ?
> >>     
> >
> > Yes. In short it is the exact information needed for context-sensitive
> > code completion, like:
> >
> > void M() {
> >   string a;
> >   a = foo ();
> >   a. |
> > }
> >
> > In the caret | location we need the whole  "
> >   sting a;
> >   a = foo ();
> > "
> > piece of code in order to compute which are the possible completions for "a."
> >
> >   
> 
> 		
> ______________________________________________ 
> LLama Gratis a cualquier PC del Mundo. 
> Llamadas a fijos y móviles desde 1 céntimo por minuto. 
> http://es.voice.yahoo.com
> _______________________________________________
> 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