Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: daniloz on May 04, 2010, 08:59:09 am

Title: Bug or Feature?
Post by: daniloz on May 04, 2010, 08:59:09 am
Hello all!

I have a question about CC. I'm not sure if this is a bug or feature, but if I have two projects in the workspace, I get suggestion from BOTH projects, regardless of the active project. After a quick look at nativeparser.cpp (and a little help from ollydbg), I found the following:

nativeparser.cpp line 606.

Code
// NOTE: it actually forces reparsing of workspace
void NativeParser::ForceReparseActiveProject()
{
    m_Parser.Clear();
    UpdateClassBrowser();

    ProjectsArray* projects = Manager::Get()->GetProjectManager()->GetProjects();
    for (size_t i = 0; i < projects->GetCount(); ++i)
    {
        AddParser(projects->Item(i), false);
    }
}

Note: the comment:
/ /NOTE: it actually forces reparsing of workspace

Should it just reparse the active project? As in:

Code
void NativeParser::ForceReparseActiveProject()
{
    m_Parser.Clear();
    UpdateClassBrowser();

    AddParser(Manager::Get()->GetProjectManager()->GetActiveProject(), false);
}


Thx,
daniloz
Title: Re: Bug or Feature?
Post by: MortenMacFly on May 04, 2010, 09:31:38 am
Note: the comment:
/ /NOTE: it actually forces reparsing of workspace
Should it just reparse the active project?
No. Consider a (very common) setup of a workspace that consists of 1.. n projects where 1..(n-1) are libraries used by the main (n'th) application. In the main application you surely want to have CC for the libraries. That's why we initially implemented it the way it is now. On request of users, btw.!
One possibility I see is to make it configurable. Patches in that direction are welcome.
Title: Re: Bug or Feature?
Post by: daniloz on May 04, 2010, 09:38:27 am
Note: the comment:
/ /NOTE: it actually forces reparsing of workspace
Should it just reparse the active project?
No. Consider a (very common) setup of a workspace that consists of 1.. n projects where 1..(n-1) are libraries used by the main (n'th) application. In the main application you surely want to have CC for the libraries. That's why we initially implemented it the way it is now. On request of users, btw.!
One possibility I see is to make it configurable. Patches in that direction are welcome.
I understand and see the utility of it. However, I was expecting that the setting in the symbols tab -> View: "Active project's symbols | All local symbols (workspace) | ..." should also apply to the CC itself. Meaning that if I set it to "Active project" then I get suggestions for the active project only, but if I set to "workspace" then I have all projects...
What do you think?
Title: Re: Bug or Feature?
Post by: ollydbg on May 04, 2010, 03:00:02 pm
@daniloz (http://forums.codeblocks.org/index.php?action=profile;u=11641)
Loaden has a patch to let the parser generate one TokensTree per project. I will asked him to publish to the CB forum soon. :D
Title: Re: Bug or Feature?
Post by: Loaden on May 04, 2010, 03:23:02 pm
@daniloz (http://forums.codeblocks.org/index.php?action=profile;u=11641)
Loaden has a patch to let the parser generate one TokensTree per project. I will asked him to publish to the CB forum soon. :D

That patch is not yet perfect, I will continue to focus on this issue, and try to find a better solution.
Title: Re: Bug or Feature?
Post by: ollydbg on May 13, 2010, 03:41:20 pm
Note: the comment:
/ /NOTE: it actually forces reparsing of workspace
Should it just reparse the active project?
No. Consider a (very common) setup of a workspace that consists of 1.. n projects where 1..(n-1) are libraries used by the main (n'th) application. In the main application you surely want to have CC for the libraries. That's why we initially implemented it the way it is now. On request of users, btw.!
One possibility I see is to make it configurable. Patches in that direction are welcome.
I understand and see the utility of it. However, I was expecting that the setting in the symbols tab -> View: "Active project's symbols | All local symbols (workspace) | ..." should also apply to the CC itself. Meaning that if I set it to "Active project" then I get suggestions for the active project only, but if I set to "workspace" then I have all projects...
What do you think?

Loaden has release a patch to solve your problem, see Let's project using standalone Parser (http://forums.codeblocks.org/index.php/topic,12544.msg85004.html#msg85004)