hi,all
after a week's work,I finally finish this patch.it is the most complicated patch I had made.
as we know,the current cc use FindAIMatch function to get the matched tokens.people complain its low efficiency.
that is true because it use recursive calls.and I found it is hard to understand ,not mention to maintain it.at least for me,it is so.
so I rewrite FindAIMatch function.of course ,I abandon recursive calls.
I am not going to explain the whole search process, just started from what I changed.
1.first I use GenerateResultSet to get the tokens from search scope set.it is the same story as before.but a little different here.
I directly get the matched search text from the tree and then eliminate those which are not under the search scope set.
2.ResolveAutualType
this function is used to resolve the function/variable's actual type.
3.ResolveExpression
just the name said,it is used to resolve the expression. it is used to replace the FindAIMatch function.
if you want to ask what is the biggest different?
here is the answer.try the complained thing.you can see how fast it is. :lol:
string::append.append.append.append.append.append.
patch for it.
BTW:The following messages are not relatived to current topic.but I put it here.just for reminder.
in this thread.http://forums.codeblocks.org/index.php/topic,11227.0.html (http://forums.codeblocks.org/index.php/topic,11227.0.html)
if you want to the function mentioned in the above thread,you need to use the following patch.
Index: src/plugins/codecompletion/codecompletion.cpp
===================================================================
--- src/plugins/codecompletion/codecompletion.cpp (revision 6185)
+++ src/plugins/codecompletion/codecompletion.cpp (working copy)
@@ -562,9 +562,9 @@
wxArrayInt already_registered;
std::set< wxString, std::less<wxString> > unique_strings; // check against this before inserting a new string in the list
TokensTree* tokens = parser->GetTokens();
+ m_SearchItem.clear();
for (TokenIdxSet::iterator it = result.begin(); it != result.end(); ++it)
{
- m_SearchItem.clear();
Token* token = tokens->at(*it);
if (!token || token->m_Name.IsEmpty())
continue;
BTW:The following messages are not relatived to current topic.but I put it here.just for reminder.
in this thread.http://forums.codeblocks.org/index.php/topic,11227.0.html (http://forums.codeblocks.org/index.php/topic,11227.0.html)
Ok, tested and works quite well.
Let me give a simple explanation.
For such code:
with autocompletion, you will get here, caret moved behind "append":
Now, this this patch, you will get additional parenthesis added, so, you get caret in the "()".
string aaaa;
aaaa.append(|)
Ok,here comes another patch.
for better function args tip.
when we type "," this patch can show the tip now.quite simple here.
:D
Index: src/plugins/codecompletion/codecompletion.cpp
===================================================================
--- src/plugins/codecompletion/codecompletion.cpp (revision 6185)
+++ src/plugins/codecompletion/codecompletion.cpp (working copy)
@@ -2049,7 +2049,8 @@
++m_ActiveCalltipsNest;
ShowCallTip();
}
-
+ else if (ch == _T(','))
+ ShowCallTip();
// end calltip
else if (ch == _T(')'))
{