ide: PDB improved tips

git-svn-id: svn://ultimatepp.org/upp/trunk@7612 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-08-27 13:26:35 +00:00
parent c1070d4377
commit 915bb7a6ed
3 changed files with 39 additions and 4 deletions

View file

@ -127,17 +127,23 @@ bool isincludefnchar(int c)
c != ' ' && c != '\"' && c != '/' && c != '\\' && c >= 32 && c < 65536;
}
String AssistEditor::ReadIdBack(int q, bool include)
String AssistEditor::ReadIdBackPos(int& pos, bool include)
{
String id;
bool (*test)(int c) = include ? isincludefnchar : iscid;
while(q > 0 && (*test)(GetChar(q - 1)))
q--;
while(pos > 0 && (*test)(GetChar(pos - 1)))
pos--;
int q = pos;
while(q < GetLength() && (*test)(GetChar(q)))
id << (char)GetChar(q++);
return id;
}
String AssistEditor::ReadIdBack(int q, bool include)
{
return ReadIdBackPos(q, include );
}
void AssistEditor::DirtyFrom(int line)
{
if(line >= cachedln) {

View file

@ -323,5 +323,33 @@ void Ide::OpenLog()
bool Ide::EditorTip(CodeEditor::MouseTip& mt)
{
return debugger && debugger->Tip(editor.ReadIdBack(mt.pos), mt);
if(!debugger)
return false;
int pos = mt.pos;
String e;
String sep;
while(pos >= 0) {
String b = editor.ReadIdBackPos(pos, false);
if(b.GetCount() == 0)
break;
e = b + sep + e;
sep = ".";
while(pos > 0 && editor.GetChar(pos - 1) == ' ')
pos++;
if(pos > 0 && editor.GetChar(pos - 1) == '.')
--pos;
else
if(pos >= 2 && editor.GetChar(pos - 1) == ':' && editor.GetChar(pos - 2) == ':') {
pos -= 2;
sep = "::";
}
else
if(pos >= 2 && editor.GetChar(pos - 1) == '>' && editor.GetChar(pos - 2) == '-')
pos -= 2;
else
break;
while(pos > 0 && editor.GetChar(pos - 1) == ' ')
pos++;
}
return debugger->Tip(e, mt);
}

View file

@ -424,6 +424,7 @@ struct AssistEditor : CodeEditor {
void CloseAssist();
void Assist();
bool IncludeAssist();
String ReadIdBackPos(int& pos, bool include);
String ReadIdBack(int q, bool include = false);
void SyncAssist();
void AssistInsert();