Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Questions about indexing

Hi Thomas,

Two points:

1) We are essentially porting over the indexer from the JDT.  Bogdan is 
documenting how all this will work but if you know how the JDT indexer 
works, you're probably more than half way there.

2) Hoda is now working on the task of hooking up code assist to the 
parser.  This will enable us to do real code completion, especially on C++ 
type things and pick up things not covered in the index like local 
variables.  Our intention is to get this into 1.2.  Please coordinate 
through her (and myself) any suggestions, work items you think you may 
have.

Cheers,
Doug Schaefer, Senior Software Developer
IBM Rational Software, Ottawa, Ontario, Canada



"Thomas Fletcher" <thomasf@xxxxxxx> 
Sent by: cdt-dev-admin@xxxxxxxxxxx
07/06/2003 02:30 PM
Please respond to
cdt-dev@xxxxxxxxxxx


To
<cdt-dev@xxxxxxxxxxx>
cc

Subject
[cdt-dev] Questions about indexing






So with the recent flurry of activity on indexing I thought .. well now
might
be the time to start looking at improving the current content assist.  So 
I
started looking into the indexing ... and I got confused.

There is the original IndexModel defined in
index/org.eclipse.cdt.core.index.
Using this very simple indexing model I would do:

    IndexModel model = IndexModel.getDefault();
    ITagEntry [] tags = model.query(project, "*string-reg-exp*", false,
false);

Which was mega simple, but also very far from being complete (even though
the
tags theoretically included lots of additional information about variables
and types etc).

Looking into the search stuff under development I found the new indexing
stuff
    CModelManager modelManager = CModelManager.getDefault();
    IndexManager indexManager = modelManager.getIndexManager();

    indexManager.performConcurrentJob(new PatternSearchJob(),

ICSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
                                                              monitor);

I looked at PatternSearchJob() and it is pretty well an empty shell at the
moment since
it is under development, but even then I don't see what the interaction is
between this
class and the actual "searching for something" since there is also a
mysterious MatchLocator/
ICSearchPattern whose roles have to do with reporting the match back, but
seem to be
distantly located from the the indexManager and more related to the
parser/model.

My question is, can someone outline the basic flow of how I would be able 
to
use the
facilities of the new indexer to programmatically generate an array of
entries which might
match a given expression.  As a starter I'll provide my current guess (and
its problems?):

- Create a new search engine using SearchEngine()
- Create a search pattern using SearchEngine.createSearchPattern()
- Create a collector which will grab the results and stuff them somewhere
- Limit the scope appropriately and execute the search engine with the 
above
  pieces (incidentally can I limit the scope to variables local to a
function? Can
I limit the scope to global variables? ... didn't see this in the
definition).

My question on this, is that the results returned back by the collector 
are
mostly
file oriented, though there is an ICElement included.  Lets say that I
submit a
query and get back a function and a variable: foofunc and foovar.
- I can get the element name: Great!
- Can I get the return value/parameters for a function or the type
information
for a variable?  Is is possible to go back to the model easily given an
ICElement
to extract this information?

I'll wait until I hear back on this until I decided to go further and
replace/enhance the
editor code completion facility.

Thanks,
  Thomas

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/cdt-dev




Back to the top