Seems to run fine under windows :)Good to hear. :)
I can report news regarding the issues I posted here (http://forums.codeblocks.org/index.php/topic,20548.0.html):
- As you can see in image 1, the error when using initializers has been corrected
- I have verified (see image 2) that CC parsers actually ARE recognising all members of my classes right!
However, for classes not belonging to the current project, it fails to show any suggestions. In the image, when I typed "V55.", code completion did not show its members...[/li]How can I reproduce your bug, are there any sample code snippet?
[/list]
How can I reproduce your bug, are there any sample code snippet?Sure, I have attached here a ZIP file of a very simple project where this happens (see the image). The error seems to come from namespaces: code completion triggers as expected if I simply define the following class and use it in Main.cpp
namespace Math
{
class Vector2D{ ... };
}
OK, I can confirm it, this is a bug in CC, since CC doesn't handle the namespace export command. (CC just skip that statement).QuoteHow can I reproduce your bug, are there any sample code snippet?Sure, I have attached here a ZIP file of a very simple project where this happens (see the image). The error seems to come from namespaces: code completion triggers as expected if I simply define the following class and use it in Main.cppCodenamespace Math
{
class Vector2D{ ... };
}
However when the class is exported into another namespace, and a source file uses this second namespace, code completion will not trigger.
Glad you can reproduce it Olly. I created the ticket, it's number #208.Really? But I think CC has never handle this case before, which revision did you see works OK?
About the way to fix it, I have no idea of how CC works. But since the old one had always handled this case correctly, maybe you can see how it was done back then.
Also, I seem to have messed the formatting badly in the ticket description, and there doesn't seem to be any way to edit it. If you are an admin there, feel free to correct it ;)Done. Thanks.
Really? But I think CC has never handle this case before, which revision did you see works OK?Wow, you are actually right! :o I have tested it in version 8242, which I used for a long time, and the bug is there too!! My guess is that I wasn't using this pattern in my headers at that time, and that I must have started using it just after switching to some newer version (that's why I believed the new CC to be the culprit).
Hi to all.Hi, thanks for the report, I can confirm this, it is caused by my CC patch serials to enable the macro expansion. I will look into it.
I probably found a small bug in this release.
The "Insert" => "All class methods without implementation" functionality of the editor removes the spaces between the parameters names and their types.
Step to reproduce :The declaration of the function is void OnClose(wxCloseEvent& event); (note the space between wxCloseEvent& and event).
- Create a new wxWidgets project (frame based) : let's name it wxCBTest
- Open the frame's cpp file in the editor, and remove one of the events handlers (for example, remove all the implementation of wxCBTestFrame::OnClose) but don't touch the declaration.
- Press [ Ctrl ] + [ Alt ] + [ S ] to save all the files (or press the "Save all files" toolbar button)
- Right click in an empty line in the editor (witch should always be open on the frame's cpp file)
- Select Insert => All class methods without implementation
- The removed function should be present in the list : select it (and unselect others things if any)
In the cpp file, the inserted method is now void OnClose(wxCloseEvent&event); (the space has been removed).
I've made some test with the previous nightly (r10376) but the bug wasn't present.
I also noticed that an old bug is still present : if in a class you have a method witch returns a pointer or a reference (for example wxString& GetAppPath()), the automatically inserted function with the Insert => All class methods without implementation doesn't have the correct type (the * or & sign is removed and the inserted text will be wxString wxCBTestFrame::GetAppPath()).It is another bug as I can see, I will look into it also.
Regards
Xav'.
Hi, thanks for the report, I can confirm this, it is caused by my CC patch serials to enable the macro expansion. I will look into it.The issue is caused by reading the parentheses, I just look at the token, I see that:
$4 = {m_FullType = L"void", m_BaseType = L"void", m_Name = L"OnAbout", m_Args = L"(wxCommandEvent&event)", m_BaseArgs = L"(wxCommandEvent&)", m_AncestorsString = <g_strEmpty+12> L"", m_FileIdx = 293, m_Line = 31, m_ImplFileIdx = 0, m_ImplLine = 0, m_ImplLineStart = 100, m_ImplLineEnd = 102, m_Scope = tsPrivate, m_TokenKind = tkFunction, m_IsOperator = false, m_IsLocal = true, m_IsTemp = false, m_IsConst = false, m_IsNoExcept = false, m_IsAnonymous = false, m_Index = 68154, m_ParentIndex = 68149, m_Children = std::set with 0 elements, m_Ancestors = std::set with 0 elements, m_DirectAncestors = std::set with 0 elements, m_Descendants = std::set with 0 elements, m_Aliases = wxArray<T>, m_TemplateArgument = <g_strEmpty+12> L"", m_TemplateType = wxArray<T>, m_TemplateMap = std::map with 0 elements, m_TemplateAlias = <g_strEmpty+12> L"", m_UserData = 0x3c54f80, m_TokenTree = 0x1234cc08, m_Ticket = 68489}
$3 = {m_FullType = L"wxString", m_BaseType = L"wxString", m_Name = L"fff", m_Args = L"()"
, m_BaseArgs = L"()", m_AncestorsString = <g_strEmpty+12> L"", m_FileIdx = 5, m_Line = 43, m_ImplFileIdx = 0, m_ImplLine = 0, m_ImplLineStart = 104, m_ImplLineEnd = 106, m_Scope = tsPrivate, m_TokenKind = tkFunction, m_IsOperator = false, m_IsLocal = true, m_IsTemp = false, m_IsConst = false, m_IsNoExcept = false, m_IsAnonymous = false, m_Index = 20415, m_ParentIndex = 20409
, m_Children = std::set with 0 elements, m_Ancestors = std::set with 0 elements, m_DirectAncestors = std::set with 0 elements, m_Descendants = std::set with 0 elements, m_Aliases = wxArray<T>, m_TemplateArgument = <g_strEmpty+12> L"", m_TemplateType = wxArray<T>, m_TemplateMap = std::map with 0 elements, m_TemplateAlias = <g_strEmpty+12> L"", m_UserData = 0x0, m_TokenTree = 0x12340458, m_Ticket = 68900}
The second issue is that it looks like the "*“ is lost in the Token.Tested again, I see that "*" is only exists in "m_FullType", not in "m_BaseType", then with the following patch, you issue can be solved.
...
src/plugins/codecompletion/codecompletion.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/plugins/codecompletion/codecompletion.cpp b/src/plugins/codecompletion/codecompletion.cpp
index 4814840..8434566 100644
--- a/src/plugins/codecompletion/codecompletion.cpp
+++ b/src/plugins/codecompletion/codecompletion.cpp
@@ -2742,7 +2742,8 @@ int CodeCompletion::DoAllMethodsImpl()
str << ed->GetLineIndentString(line - 1);
if (addDoxgenComment)
str << _T("/** @brief ") << token->m_Name << _T("\n *\n * @todo: document this function\n */\n");
- wxString type = token->m_BaseType;
+ wxString type = token->m_FullType;
+ // "int *" or "int &" -> "int*" or "int&"
if ((type.Last() == _T('&') || type.Last() == _T('*')) && type[type.Len() - 2] == _T(' '))
{
type[type.Len() - 2] = type.Last();
@XaviouThank you for your reactivity.
The first issue is fixed in trunk now.
The second issue is that it looks like the "*“ is lost in the Token.I don't know if it can help, but I've just saw that the dialog box witch allows to check/uncheck the missing methods we want to add has the correct definition.
...I fix this issue in rev10484.
Only the inserted code is wrong.
...