mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-18 06:12:46 -06:00
developing indexer/navigator
This commit is contained in:
parent
43276ce7d1
commit
ba681dbc3b
28 changed files with 466 additions and 535 deletions
|
|
@ -10,43 +10,8 @@ void AssistEditor::SyncHeaders()
|
|||
hdepend.SetDirs(theide->GetCurrentIncludePath() + ";" + GetClangInternalIncludes());
|
||||
master_source.Clear();
|
||||
String editfile = NormalizePath(theide->editfile);
|
||||
if(editfile.GetCount() && IsCHeaderFile(editfile)) {
|
||||
DLOG("============= " << editfile);
|
||||
for(int pass = 0; pass < 2; pass++) { // all packages in second pass
|
||||
const Workspace& wspc = GetIdeWorkspace();
|
||||
for(int i = 0; i < wspc.GetCount(); i++) { // find package of included file
|
||||
const Package& pk = wspc.GetPackage(i);
|
||||
String pk_name = wspc[i];
|
||||
|
||||
auto Chk = [&] {
|
||||
for(int i = 0; i < pk.file.GetCount(); i++) {
|
||||
String path = SourcePath(pk_name, pk.file[i]);
|
||||
if(!PathIsEqual(editfile, path) && IsSourceFile(path)) {
|
||||
if(FindIndex(hdepend.GetDependencies(path), editfile) >= 0 && GetFileLength(path) < 200000) {
|
||||
master_source = path;
|
||||
DDUMP(master_source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
if(pass) {
|
||||
if(Chk())
|
||||
return;
|
||||
}
|
||||
else
|
||||
for(int i = 0; i < pk.file.GetCount(); i++) {
|
||||
if(PathIsEqual(editfile, SourcePath(pk_name, pk.file[i]))) {
|
||||
if(Chk())
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(editfile.GetCount() && IsCHeaderFile(editfile))
|
||||
master_source = FindMasterSource(hdepend, GetIdeWorkspace(), editfile);
|
||||
}
|
||||
|
||||
bool AssistEditor::DoIncludeTrick(Index<String>& visited, int level, StringBuffer& out, String path, const String& target_path, int& line_delta)
|
||||
|
|
@ -57,16 +22,12 @@ bool AssistEditor::DoIncludeTrick(Index<String>& visited, int level, StringBuffe
|
|||
return false;
|
||||
visited.Add(path);
|
||||
FileIn in(path);
|
||||
DDUMP(target_path);
|
||||
while(!in.IsEof()) {
|
||||
String l = in.GetLine();
|
||||
String tl = TrimLeft(l);
|
||||
if(!comment && tl.TrimStart("#include") && (*tl == ' ' || *tl == '\t')) {
|
||||
DDUMP(tl);
|
||||
String ipath = hdepend.FindIncludeFile(tl, filedir);
|
||||
DDUMP(ipath);
|
||||
if(ipath.GetCount()) {
|
||||
DDUMP(HdependGetDependencies(ipath));
|
||||
if(NormalizePath(ipath) == NormalizePath(target_path))
|
||||
return true;
|
||||
int q = out.GetCount();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue