The latest nightly build can edit the files of the project normally, but the code completion function can not work, it's always show "too many result"
even if I have set the "maximum allowed code-completion matches" to 64, and only select level 1 and level 2 of the "Keyword sets to additionally include".
The simply work in my wxFormBuilder project is:
wxSize sz = m_rightSplitter->GetClientSize();
sz. //it will shows too many result
There is a mistake I should to fill, I'm so sorry.
the wxFormBuilder project should contains all the files in the 3.x/src directory. not the 3.x/src/rad.
1, create a empty project use C::B.
2, use "Add files recursively" and choose the directory 3.x/src
then open anyone of the files in the project.
if the the problem can't replay, who can give me a email address(use inner message from this furum), and I'll send all my project file in a zip file.
And a little suggestion about the code completion
wxSize* szPtr = this.GetSize();
I think the code completion thread is know the "this" is a pointer, and when I typing the ".", it should be better to change the "." to "->", is it?
@Morten:
Index: trunk/src/plugins/codecompletion/codecompletion.cpp
===================================================================
--- trunk/src/plugins/codecompletion/codecompletion.cpp (revision 9667)
+++ trunk/src/plugins/codecompletion/codecompletion.cpp (revision 9668)
@@ -1004,8 +1004,10 @@
if (token->m_TokenKind & tkAnyFunction)
{
- //tmp << token->GetFormattedArgs();
- tmp << _T("(): ") << token->m_FullType;
+ if (m_DocHelper.GetOptions().m_Enabled)
+ tmp << _T("(): ") << token->m_FullType;
+ else
+ tmp << token->GetFormattedArgs() << _T(": ") << token->m_FullType;
}
else if (token->m_TokenKind == tkVariable)
tmp << _T(": ") << token->m_FullType;
Is it m_DocHelper.GetOptions().m_ShowAlways instead of m_DocHelper.GetOptions().m_Enabled? or both of them?
I mean in my post: Re: C::B 13.12 Can't work with big project which have more than 100 files. (http://forums.codeblocks.org/index.php/topic,18991.msg130116.html#msg130116)
I need to check on Show token's details even it hasn't documentation. to let the documentation tip window shown in the case there is no Doxygen styled document associated with the token.
@morten, rev 9669.
src/plugins/codecompletion/cctest/cctest_frame.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/plugins/codecompletion/cctest/cctest_frame.cpp b/src/plugins/codecompletion/cctest/cctest_frame.cpp
index f0c008e..d2aa4bc 100644
--- a/src/plugins/codecompletion/cctest/cctest_frame.cpp
+++ b/src/plugins/codecompletion/cctest/cctest_frame.cpp
@@ -242,6 +242,7 @@ CCTestFrame::CCTestFrame(const wxString& main_file) :
gcc_base + mingwver + _T("\\include") + _T("\n"));
m_HeadersCtrl->SetValue(_T("<_mingw.h>,<cstddef>,<w32api.h>,<winbase.h>,<wx/defs.h>,<wx/dlimpexp.h>,<wx/toplevel.h>,<boost/config.hpp>,<boost/filesystem/config.hpp>,\"pch.h\",\"sdk.h\",\"stdafx.h\""));
+// m_HeadersCtrl->SetValue(_T(" <cstddef>,<w32api.h>, <wx/defs.h>,<wx/dlimpexp.h>,<wx/toplevel.h>,<boost/config.hpp>,<boost/filesystem/config.hpp>,\"pch.h\",\"sdk.h\",\"stdafx.h\""));
CCLogger::Get()->Init(this, idCCLogger, idCCLogger, idCCAddToken);
m_StatuBar->SetStatusText(_("Ready!"));
@@ -364,7 +365,7 @@ void CCTestFrame::Start()
m_StatuBar->SetStatusText(m_CurrentFile);
// This is the core parse stage for files
- // m_NativeParser.Parse(m_CurrentFile);
+ m_NativeParser.Parse(m_CurrentFile);
// Here we are going to test the expression solving algorithm
m_NativeParser.BatchTest(m_CurrentFile);
m_NativeParser.BatchTest(m_CurrentFile) will internally parse the file, so I think m_NativeParser.Parse(m_CurrentFile) is not necessary.
What m_NativeParser.BatchTest(m_CurrentFile) do is:
1, parse the file
2, run the test (suggestion list test)
(I'm going to bed now :)..)
Well actually not. If you comment the line cctest does simply nothing. At least not on my pc...
I will check it later.
BTW, current trunk build failed:
-------------- Build: Code-completion in Code::Blocks wx2.8.x (compiler: GNU GCC Compiler)---------------
[ 5.0%] g++.exe -Wall -g -pipe -mthreads -fmessage-length=0 -fexceptions -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -DBUILDING_PLUGIN -iquote.objs\include -I.objs\include -I. -IE:\code\wx-mingw-build-481-dw2\wxWidgets-2.8.12\include -IE:\code\wx-mingw-build-481-dw2\wxWidgets-2.8.12\lib\gcc_dll\mswu -Isdk\wxscintilla\include -Isdk\wxpropgrid\include -Iinclude\tinyxml -Iinclude -Iinclude\mozilla_chardet -Iinclude\mozilla_chardet\mfbt -Iinclude\mozilla_chardet\nsprpub\pr\include -Iinclude\mozilla_chardet\xpcom -Iinclude\mozilla_chardet\xpcom\base -Iinclude\mozilla_chardet\xpcom\glue -c plugins\codecompletion\ccoptionsdlg.cpp -o .objs\plugins\codecompletion\ccoptionsdlg.o
plugins\codecompletion\ccoptionsdlg.cpp: In constructor 'CCOptionsDlg::CCOptionsDlg(wxWindow*, NativeParser*, CodeCompletion*, DocumentationHelper*)':
plugins\codecompletion\ccoptionsdlg.cpp:180:84: error: 'class DocumentationHelper' has no member named 'GetOptions'
plugins\codecompletion\ccoptionsdlg.cpp:181:84: error: 'class DocumentationHelper' has no member named 'GetOptions'
plugins\codecompletion\ccoptionsdlg.cpp: In member function 'virtual void CCOptionsDlg::OnApply()':
plugins\codecompletion\ccoptionsdlg.cpp:287:22: error: 'class DocumentationHelper' has no member named 'GetOptions'
plugins\codecompletion\ccoptionsdlg.cpp:288:22: error: 'class DocumentationHelper' has no member named 'GetOptions'
Process terminated with status 1 (0 minute(s), 55 second(s))
4 error(s), 0 warning(s) (0 minute(s), 55 second(s))
Do you forget to commit the change of GetOptions?
Well actually not. If you comment the line cctest does simply nothing. At least not on my pc...
That was strange, I just comment the line
m_NativeParser.Parse(m_CurrentFile);
But if you look at the code:
bool NativeParserTest::TestParseAndCodeCompletion(wxString filename)
{
Clear();//clear the tree
bool parseResult = false;
parseResult = Parse(filename);
if(!parseResult)
return false;
int passCount = 0;
int failCount = 0;
wxString testResult;
wxString message = wxString::Format(_T("********************************************************\n Testing in file: %s\n********************************************************"),filename.wx_str());
wxLogMessage(message);
testResult<<message<<wxT("\n");
// read the test cases of CodeCompletion test
wxTextFile source;
source.Open(filename);
wxString str;
for ( str = source.GetLastLine();
source.GetCurrentLine() > 0;
str = source.GetPrevLine() )
{
// a test case should be put in a line, and start with the double slash
if (str.StartsWith(_T("//")))
{
// do tests here, example of line is below
// tc.St //StaticVoid
// remove the beginning "//"
str.Remove(0,2);
// find the second "//", the string after the second double slash are the
// the result should be listed
wxString expression;
wxString match;
int pos = str.Find(_T("//"));
if (pos == wxNOT_FOUND)
break;
expression = str.Mid(0,pos);
match = str.Mid(pos+2);// the remaining string
expression.Trim();
expression.Trim(true);
match.Trim();
match.Trim(true);
wxArrayString suggestList;
// the match can have many items, like: AAA,BBBB
wxStringTokenizer tkz(match, wxT(","));
while ( tkz.HasMoreTokens() )
{
wxString token = tkz.GetNextToken();
suggestList.Add(token);
}
TokenIdxSet searchScope;
searchScope.insert(-1);
TokenIdxSet result;
TestExpression(expression,searchScope,result);
// loop the suggestList to see it is in the result Tokens
for (size_t i=0;i<suggestList.GetCount();i++)
{
wxString element = suggestList[i];
bool pass = false; // pass the test?
for (TokenIdxSet::const_iterator it = result.begin();
it != result.end();
++it)
{
const Token* token = m_Parser.GetTokenTree()->at(*it);
if (!token || token->m_Name.IsEmpty())
continue;
if (element.IsSameAs(token->m_Name))
{
message = wxString::Format(_T("-PASS: %s %s"),expression.wx_str(),element.wx_str());
testResult<<message<<wxT("\n");
wxLogMessage(message);
pass = true;
passCount++;
}
}
if (pass == false)
{
message = wxString::Format(_T("*FAIL: %s %s"),expression.wx_str(),element.wx_str());
testResult<<message<<wxT("\n");
wxLogMessage(message);
failCount++;
}
}
// wxLogMessage(_T("Result have %lu matches"), static_cast<unsigned long>(result.size()));
}
else
break; // if the line is not started with //, then we just stop testing
}
// report the test result here again in the last stage, further more, we can show this in another text control
wxLogMessage(wxT("--------------------------------------------------------\nTotal %d tests, %d PASS, %d FAIL\n--------------------------------------------------------"), passCount+failCount, passCount, failCount);
return true;
}
You see, the steps of NativeParserTest::TestParseAndCodeCompletion is:
1, clear the TokenTree
2, parse the file
3, run tests
4, report fail and pass results.
BTW: Here is the log message I see:
000001. --------------M-a-i-n--L-o-g--------------
000002. -----------I-n-t-e-r-i-m--L-o-g-----------
********************************************************
Testing in file: C:\DOCUME~1\zyh23\LOCALS~2\Temp\cc125.h
********************************************************
*FAIL: vt[1]. GetInt
-PASS: g_S. i
-PASS: g_ g_S
-PASS: tc.Vo Void
-PASS: tc.St StaticVoid
-PASS: tc.GetC GetClass
-PASS: tc.GetI GetInt
-PASS: str. size
-PASS: str. length
--------------------------------------------------------
Total 9 tests, 8 PASS, 1 FAIL
--------------------------------------------------------
Note that I remove CC_PARSER_TEST macro definition in rev9644 (see the bold text below), since it run our test much faster, in the future, we can run many tests in a single run(we can have many cc_xxxxx files which contains many kinds of tests, then our cctest project test them one by one)
SHA-1: 40c5a4c8323e26aad488c536d426d1ab34cc66a5
* * cctest: add a framework of codecompletion test, the details are listed in C::B forum topic (batch codecompletion test framework - http://forums.codeblocks.org/index.php/topic,17538.msg120196.html#msg120196)
1, remove the file cctest.h and cctest.cpp, because those standalone classes/functions were moved to NativeParserTest class (derived from NativeParserBase), so a lot of functions can be reused from NativeParserBase.
2, remove CC_PARSER_TEST definition to reduce parser log messages, only show codecompletion test result and the show fail and pass testing counts. If the user need to see the full parser log messages, they should define them, which will plot a log of log messages.
3, redirect the wxLogMessage to the text ctrl of the frame.
4, fix typo in comments, and add some comments.
5, project target setting change, make it a gui app instead of console app, and redirect the wxLogMessage to the wxTextCtrl.
6, set the default parsing file to testing/cc_function_decls.cpp, not the default test.h
7, add the wxsmith file to cbp, so it can be opened quickly from the project manager.
8, by default, Token tree structure is not logged, but it can be logged by click the "Print Tree" button.
9, add some string variable to the wx and gcc search path, avoid the hard-coded path.
git-svn-id: https://svn.code.sf.net/p/codeblocks/code/trunk@9644 2a5c6006-c6dd-42ca-98ab-0921f2732cef