Hi,
The Code Completion fails if a function (and probably variables as well, but I haven't checked) is declared with the extern keyword.
The reason is IMHO the check for 'extern "C"' in src/plugins/codecompletion/parser/parserthread.cpp at line 479 (Rev. 5874) where the Token is read, but don't given back if it's not ParserConsts::kw_C.
I have patched the code, so that the Token will be "unget" in case the extern "C" - check fails.
}
else if (token==ParserConsts::kw_extern)
{
// check for "C"
m_Str = m_Tokenizer.GetToken();
if (m_Str==ParserConsts::kw_C)
{
m_Tokenizer.GetToken(); // "eat" {
DoParse(); // time for recursion ;)
}
else
{
// do nothing, just skip keyword "extern", otherwise uncomment:
//SkipToOneOfChars(ParserConsts::semicolon); // skip externs
m_Tokenizer.UngetToken();
}
m_Str.Clear();
}
can anyone confirm this?
Sorry, I think I was not very clear about this :oops:. The Code Completion doesn't work if you have only the declaration. I use a library which has all functions defined as extern in it's header file.
As long as the implementation is part of the project, the codecompletion works (but not the "Find declaration of: ..." from the Right Mouse Button menue).
You can repoduce it if you open an empty project and add these lines:
int foobar_test(void);
extern int foobar_blah(void);
int main (void)
{
}
If you now type foobar within main, you will only get codecompletion for foobar_test. foobar_blah has not been recognized (as you can see as well in the Symbol Browser).
BTW: I use Code::Blocks SVN Rev. 5895