Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
vector<int> is OK, but string or wstring no-work.
MortenMacFly:
--- Quote from: blueshake on January 14, 2010, 03:59:41 am ---the reason is simple.
the variable needParse's scope is function scope.when it (needParse) leave the functioin body.it will be destroyed.so it will be false again when the carect is in different line.
--- End quote ---
I don't get it. m_NeedReparse was used just there. So what's wrong with this piece of code:
--- Code: --- Parser* parser = m_NativeParser.GetParserPtr();
bool needReparse = false;
if ( parser && parser->Options().whileTyping
&& ( (event.GetModificationType() & wxSCI_MOD_INSERTTEXT)
|| (event.GetModificationType() & wxSCI_MOD_DELETETEXT) ) )
{
needReparse = true;
}
if (control->GetCurrentLine() != m_CurrentLine)
{
if (parser && needReparse)
parser->Reparse(editor->GetFilename());
else
FindFunctionAndUpdate(control->GetCurrentLine());
}
--- End code ---
It will trigger the re-parse correctly in the case a parser is present, the option is enabled and a char was inserted/deleted.
So...?! (I am a bit sick, so probably you should explain slowly... ;-)).
MortenMacFly:
--- Quote from: ollydbg on January 14, 2010, 06:46:52 am ---@morten
This is a big bug, should be fixed soon.
Re: The 12 January 2010 build (6080) is out.
--- End quote ---
Done in my local copy. Will commit in a while... probably after blueshake answered the other question which may require some modifications, too.
blueshake:
--- Quote ---I don't get it. m_NeedReparse was used just there. So what's wrong with this piece of code:
--- End quote ---
see the codes below,in the new codes,it declare a new variable needReparse ,not m_NeedReparse.
Parser* parser = m_NativeParser.GetParserPtr();
bool needReparse = false;
if ( parser && parser->Options().whileTyping
&& ( (event.GetModificationType() & wxSCI_MOD_INSERTTEXT)
|| (event.GetModificationType() & wxSCI_MOD_DELETETEXT) ) )
{
needReparse = true;
}
if (control->GetCurrentLine() != m_CurrentLine)
{
if (parser && needReparse)
parser->Reparse(editor->GetFilename());
else
FindFunctionAndUpdate(control->GetCurrentLine());
}
blueshake:
maybe this will help a little.
--- Code: ---Index: src/plugins/codecompletion/codecompletion.cpp
===================================================================
--- src/plugins/codecompletion/codecompletion.cpp (revision 6083)
+++ src/plugins/codecompletion/codecompletion.cpp (working copy)
@@ -2085,17 +2085,24 @@
}
Parser* parser = m_NativeParser.GetParserPtr();
- bool needReparse = false;
+ //bool needReparse = false;
if ( parser && parser->Options().whileTyping
&& ( (event.GetModificationType() & wxSCI_MOD_INSERTTEXT)
|| (event.GetModificationType() & wxSCI_MOD_DELETETEXT) ) )
{
- needReparse = true;
+ //needReparse = true;
+ m_NeedReparse = true;
}
if (control->GetCurrentLine() != m_CurrentLine)
{
- if (parser && needReparse)
- parser->Reparse(editor->GetFilename());
+
+ if (parser && m_NeedReparse)
+ {
+ m_NeedReparse = false;
+ parser->Reparse(editor->GetFilename());
+ }
else
FindFunctionAndUpdate(control->GetCurrentLine());
}
Index: src/plugins/codecompletion/codecompletion.h
===================================================================
--- src/plugins/codecompletion/codecompletion.h (revision 6083)
+++ src/plugins/codecompletion/codecompletion.h (working copy)
@@ -135,7 +135,7 @@
int m_ActiveCalltipsNest;
bool m_IsAutoPopup;
-
+ bool m_NeedReparse;
wxChoice* m_Function;
wxChoice* m_Scope;
FunctionsScopeVec m_FunctionsScope;
--- End code ---
NOTE:
the patch is used to show what changed(or explain what I try to say.please do not apply it) :wink:
Jenna:
To make it clear, why the current code does not work:
needReparse is set to true whenever text is inserted or deleted, but the reparsing is only triggered if we leave the current line.
This does normally (never ?) happen inside the same event, so we have to remember whether a reparse is needed, either with a member-variable or a static local variable.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version