interesting, something to try out :-)
Another interesting thing : show the doxygen documentation (but then this needs to be parsed too : could start with a simple heuristic for functions : either the comment after the declaration, or the comment just in front of the declaration [when starting on a dedicated line])
void foo() //!< do foo stuff
/*!
Some information on bar
@param[in] in1 : first argument
\param[out] in2 : second argument
@return returns true on success, false otherwise
*/
bool bar(int in1, float& in2);
I've found a bug in the patch and I've fixed it.
The fix:
old: result = token.m_ActualType + wxT(" ") + result + token.m_Name + token.m_Args;
new: result = token.m_Type + wxT(" ") + result + token.m_Name + token.m_Args;
And the bug was:
1. if the return type is Class& the & was missing
2. if the return type is Class const & - only const was displayed
Please download the patch again...
applying your patch to trunk and build the whole C::B.
Than I do the following steps:
1, open the project
F:\cb\codeblocks_trunk\src\plugins\codecompletion\parser\parsertest.cbp
2, edit the file "test.h"
to below:
aaa & f();
aaa const & g();
3, run the project, here is the log:
...
--------------L-i-s-t--L-o-g--------------
000055. function aaa & f() [9,0]
000056. function aaa const & g() [11,0]
it seems the log is correctly.
Note that the List log comes from: parsertest.cpp
void ParserTest::PrintList()
{
TokenList& tokens = m_tokensTree->m_Tokens;
for (TokenList::iterator it = tokens.begin(); it != tokens.end(); it++)
{
wxString log;
log << (*it)->GetTokenKindString() << _T(" ") << (*it)->DisplayName() << _T("\t[") << (*it)->m_Line;
log << _T(",") << (*it)->m_ImplLine << _T("]");
ParserTrace(log);
}
}
then, DisplayName() will internally call the function:
wxString Token::DisplayName() const
{
wxString result;
if (m_TokenKind == tkClass)
return result << _T("class ") << m_Name << m_BaseArgs << _T(" {...}");
else if (m_TokenKind == tkNamespace)
return result << _T("namespace ") << m_Name << _T(" {...}");
else if (m_TokenKind == tkEnum)
return result << _T("enum ") << m_Name << _T(" {...}");
else if (m_TokenKind == tkTypedef)
{
result << _T("typedef");
if (!m_Type.IsEmpty())
result << _T(" ") << m_Type;
if (result.Find('*', true) != wxNOT_FOUND)
{
result.RemoveLast();
return result << m_Name << _T(")") << GetFormattedArgs();
}
if (!m_TemplateArgument.IsEmpty())
result << m_TemplateArgument;
return result << _T(" ") << m_Name;
}
else if (m_TokenKind == tkPreprocessor)
{
result << _T("#define ") << m_Name << GetFormattedArgs();
if (!m_Type.IsEmpty())
return result << _T(" ") << m_Type;
}
// else
if (!m_Type.IsEmpty())
result << m_Type << m_TemplateArgument << _T(" ");
if (m_TokenKind == tkEnumerator)
return result << GetNamespace() << m_Name << _T("=") << GetFormattedArgs();
return result << GetNamespace() << m_Name << GetStrippedArgs();
}
Then, I check the m_Type here, it is correct too.
not sure why your problem happens....
just make a new console app through the wizard : and make this the contents of the main.cpp
#include <iostream>
int main()
{
int foo = 0;
foo = foo + 20;
std::cout << foo << std::endl;
return 0;
}
tooltip over foo --> int main::foo
PS : I noticed the tooltip not always shows up.