Gathering the set of files-to-watch
Esben Mose Hansen
kde at mosehansen.dk
Sun Jun 13 08:47:35 UTC 2010
On Saturday 12 June 2010 21:39:34 David Nolden wrote:
> My next item on the list is getting and watching the includes of a file.
> The cleanup, and finally I'll submit it to the mercy of the core
> developers :)
I am working on getting the included/imported files watched as well. I have
worked out this little snippet for getting imports:
TopDUContext* context = DUChainUtils::standardContextForUrl(url);
if (context) {
QVector<DUContext::Import> imports = context-
>importedParentContexts();
Q_FOREACH(DUContext::Import import, imports) {
qDebug() << "indexed url for import: " <<
import.indexedContext().indexedTopContext().url().str();
}
} else {
qDebug() << "No context for url";
}
Is that the right way to do it? Of course, I would need to update the list
every time the file is parsed, and I think I would need to reparse any new
files in that list (otherwise, I cannot see how to avoid a race where the file
is changed after passing but before the import is reported to the watching
mechanism).
The above needs to be done recursively: is there a smarter way to go about
this?
--
Kind regards, Esben
More information about the KDevelop-devel
mailing list