User forums > Nightly builds

The 25 september 2010 build (6634) CODECOMPLETION BRANCH version is out.

<< < (19/24) > >>

polygon7:

--- Quote from: Loaden on October 12, 2010, 08:55:28 am ---
--- Quote from: killerbot on October 11, 2010, 05:07:23 pm ---yes, this delay is already present for so time now, I can confirm ;-)

--- End quote ---
Hi, killerbot, Could you have a trying r6707.
And post the debug log in here?
Thanks!

--- End quote ---
Revision 6707 works really fast with #include's :D

// Edit:
include with "

--- Code: ---Get include file count is 2, use time is 1

--- End code ---
include with <

--- Code: ---Get include file count is 31006, use time is 57

--- End code ---

Loaden:

--- Quote from: polygon7 on October 12, 2010, 11:14:19 am ---
--- Quote from: Loaden on October 12, 2010, 08:55:28 am ---
--- Quote from: killerbot on October 11, 2010, 05:07:23 pm ---yes, this delay is already present for so time now, I can confirm ;-)

--- End quote ---
Hi, killerbot, Could you have a trying r6707.
And post the debug log in here?
Thanks!

--- End quote ---
Revision 6707 works really fast with #include's :D

// Edit:
include with "

--- Code: ---Get include file count is 2, use time is 1

--- End code ---
include with <

--- Code: ---Get include file count is 31006, use time is 57

--- End code ---

--- End quote ---

About the 2~6 sec delay: I think it is wxScintilla issue, not CC. :(

killerbot:
#include " --> worked very fast, but several includes missing
#include <  --> still rather slow [and at the start I always have a lot of entries like this : /32/32/32/32/32/32/32....]

Loaden:

--- Quote from: killerbot on October 12, 2010, 02:34:48 pm ---#include " --> worked very fast, but several includes missing
#include <  --> still rather slow [and at the start I always have a lot of entries like this : /32/32/32/32/32/32/32....]

--- End quote ---
All code in here:

--- Quote ---// Do the code completion when we enter:
// #include "| or #include <|
void CodeCompletion::CodeCompleteIncludes()
{
    wxStopWatch sw;

    if (!IsAttached() || !m_InitDone)
        return;

    cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
    if (!ed)
        return;

    const wxString curFile(ed->GetFilename());
    const wxString curPath(wxFileName(curFile).GetPath());
    wxArrayString buildTargets;

    cbProject* project = m_NativeParser.GetProjectByParser(&m_NativeParser.GetParser());
    ProjectFile* pf = project ? project->GetFileByFilename(curFile, false) : 0;
    if (pf)
        buildTargets = pf->buildTargets;

    FileType ft = FileTypeOf(ed->GetShortName());
    if ( ft != ftHeader && ft != ftSource) // only parse source/header files
        return;

    int pos = ed->GetControl()->GetCurrentPos();
    int lineStartPos = ed->GetControl()->PositionFromLine(ed->GetControl()->GetCurrentLine());
    wxString line = ed->GetControl()->GetLine(ed->GetControl()->GetCurrentLine());
    line.Trim();
    if (line.IsEmpty() || !TestIncludeLine(line))
        return;

    bool useSystemHeaders = false;
    int keyPos = line.Find(_T('"'));
    if (keyPos == wxNOT_FOUND)
    {
        useSystemHeaders = true;
        keyPos = line.Find(_T('<'));
    }
    if (keyPos == wxNOT_FOUND || keyPos > pos - lineStartPos)
        return;
    ++keyPos;

    // now, we are after the quote prompt
    wxString filename = line.SubString(keyPos, pos - lineStartPos - keyPos);
    filename.Replace(_T("\\"), _T("/"), true);

    // fill a list of matching files
    StringSet files;

    // #include <|
    if (m_CCSystemHeaderFiles && useSystemHeaders)
    {
        wxCriticalSectionLocker locker(s_HeadersCriticalSection);
        wxArrayString& incDirs = GetSystemIncludeDirs(&m_NativeParser.GetParser(),
                                                      project ? project->GetModified() : true);
        for (size_t i = 0; i < incDirs.GetCount(); ++i)
        {
            SystemHeadersMap::iterator it = m_SystemHeadersMap.find(incDirs);
            if (it != m_SystemHeadersMap.end())
            {
                const StringSet& headers = it->second;
                for (StringSet::iterator it = headers.begin(); it != headers.end(); ++it)
                    files.insert(*it);
            }
        }
    }

    // #include "|
    if (!useSystemHeaders && project)
    {
        const wxArrayString localIncludeDirs = GetLocalIncludeDirs(project, buildTargets);
        for (int i = 0; i < project->GetFilesCount(); ++i)
        {
            ProjectFile* pf = project->GetFile(i);
            if (pf && FileTypeOf(pf->relativeFilename) == ftHeader)
            {
                wxString file = pf->file.GetFullPath();
                if (file.Find(filename) != wxNOT_FOUND)
                {
                    wxString header;
                    for (size_t j = 0; j < localIncludeDirs.GetCount(); ++j)
                    {
                        const wxString& dir = localIncludeDirs[j];
                        if (file.StartsWith(dir))
                        {
                            header = file.Mid(dir.Len());
                            break;
                        }
                    }

                    if (header.IsEmpty())
                    {
                        if (pf->buildTargets != buildTargets)
                            continue;

                        wxFileName fn(file);
                        fn.MakeRelativeTo(curPath);
                        header = fn.GetFullPath();
                    }

                    header.Replace(_T("\\"), _T("/"), true);
                    files.insert(header);
                }
            }
        }
    }

    // popup the auto completion window
    if (!files.empty())
    {
        ed->GetControl()->ClearRegisteredImages();
        ed->GetControl()->AutoCompSetIgnoreCase(false);
        ed->GetControl()->AutoCompSetCancelAtStart(true);
        ed->GetControl()->AutoCompSetFillUps(m_CCFillupChars);
        ed->GetControl()->AutoCompSetChooseSingle(false);
        ed->GetControl()->AutoCompSetAutoHide(true);
        ed->GetControl()->AutoCompSetDropRestOfWord(m_IsAutoPopup ? false : true);
        wxString final;
        GetStringFromSet(final, files, _T(" "));
        final.RemoveLast(); // remove last space
        Manager::Get()->GetLogManager()->DebugLog(F(_T("Get include file count is %d, use time is %d"),
                                                    files.size(), sw.Time()));
        ed->GetControl()->AutoCompShow(pos - lineStartPos - keyPos, final);
    }
}
--- End quote ---
Almost all of the time is spent in the AutoCompShow call.
This is not a CC problem, but wxScintilla.

polygon7:

--- Quote from: Loaden on October 12, 2010, 04:00:57 pm ---
--- Quote from: killerbot on October 12, 2010, 02:34:48 pm ---#include " --> worked very fast, but several includes missing
#include <  --> still rather slow [and at the start I always have a lot of entries like this : /32/32/32/32/32/32/32....]

--- End quote ---
All code in here:
(...)
Almost all of the time is spent in the AutoCompShow call.
This is not a CC problem, but wxScintilla.

--- End quote ---

Maybe that includes popup should be visible only when user write similar number of letters like
in CC (Editor->CC->Automatically launch when typed # letters) after " or < character and
popup should contain only that items which have the same letters on start as written by user?

Eg.
Editor->CC->Automatically launch when typed # letters is set to 4
and with:

--- Code: ---#include <cst|

--- End code ---
no popup visible


--- Code: ---#include <cstd

--- End code ---
popup visible and should contain: "cstdio" (or if there is another file with cstd prefix then it should be in popup too).

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version