Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

Include completion improved

<< < (2/4) > >>

oBFusCATed:
Here is a little update:

1. Used NormalizePath when obtaining the include dirs
2. Replace '\' with '/' everywhere, because I'm not sure what character is used on windows for the paths and also that is the standard (portable) way to write include paths.

[attachment deleted by admin]

killerbot:
ok, I have done a very quick look at the (original/official) code. And there are a few things that could be improved.

Step 1 : get rid of unused stuff :

--- Code: ---    // find opening quote (" or <)
    int idx = pos - lineStartPos;
    int found = -1;
    wxString filename;
    while (idx > 0)
    {
        wxChar c = line.GetChar(idx);
        if (c == _T('>'))
            return; // the quote is closed already...
        else if (c == _T('"') || c == _T('<'))
        {
            if (found != -1)
                return; // the already found quote was the closing one...
            found = idx + 1;
        }
        else if (c != _T(' ') && c != _T('\t') && !found)
            filename << c;
        --idx;
    }

--- End code ---
The filename is NOT used, so in my private copy I will first make things simpler, and remove it.


Secondly :

--- Code: ---    // fill a list of matching project files
    wxArrayString files;
    for (int i = 0; i < pPrj->GetFilesCount(); ++i)

--- End code ---
So only file of the current project seems to be added. So no files in that nice include directory that I added to my project ;-)

And then we see :

--- Code: ---            wxFileName fname(pf->relativeFilename);
            if (files.Index(pf->relativeFilename) == wxNOT_FOUND)
                files.Add(pf->relativeFilename);
            if (files.Index(fname.GetFullName()) == wxNOT_FOUND)
                files.Add(fname.GetFullName());

--- End code ---
So that means it should be twice in the list : full path and relative.
EDIT : well actually something like this; Say I have a header in my project whose relative path to the cbp file is ../../inc/MyHeader.h, then there will be 2 entries in the list :
1)../../inc/MyHeader.h
2)MyHeader.h

Note : this is from looking at the code, not from testing.


Ideas :
* Also add all headers that can be found in the include dirs.
* add all headers of all projects in the workspace
* ...

off course the more files being added the slower things will get.

But as it is now, I agree, most of the time the completion for include files just fails.

killerbot:
I can confirm :


--- Code: ---        ed->GetControl()->AutoCompSetIgnoreCase(caseSens);

--- End code ---
should be

--- Code: ---        ed->GetControl()->AutoCompSetIgnoreCase(!caseSens);

--- End code ---

Will already fix this in svn.

oBFusCATed:
Hi, great review for the official code, can you do the same with my patch?  8)

My patch is concerned with making the completion usable and adding files outside of the project is out of its scope.  :lol:

But you are right, it would be nice to have the compiler includes completed, also on linux /usr/include/ is a good candidate.
But this requires some kind of caching, there is no need to traverse the filesystem every time the user wants to complete an include!

There should be some discussion and if there is an agreement how the thing should be implemented I can do it  :lol:

danselmi:
Hi

Are you sure you tested the last patch from http://developer.berlios.de/patch/?func=detailpatch&patch_id=2746&group_id=5358?

Because one of the first tests in BraceCompletion patch is

--- Code: --- if ( IsComment(style) || IsPreprocessor(style) ) return;
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version