Some DUChain related questions
zwabel at googlemail.com
Tue Nov 9 22:02:52 UTC 2010
2010/11/9 Sven Brauch <svenbrauch at googlemail.com>:
> I'm still working on the python plugin, but currently I'm a bit stuck as
> there's a few problems I just cannot find the reason for.
> The yellow highlighting does not work if the declaration is inside any
> context. http://imgur.com/NlhvM.png -> this works;
> http://imgur.com/R0okn.png (i hovered the "password") this does not. The
You should take a look at
line 525, to see what's going wrong. I guess that findDeclaration
doesn't find the declaration under the cursor.
Also see DUChainUtils::itemUnderCursor.
One possible reason could be that the python plugin creates multiple
overlapping contexts, and findContextAt(position) in itemUnderCursor
picks the wrong context, so it cannot find the declaration.
> usebuilder source code:
> As can be seen in the second image, declarations from the class context are
> imported into the function. This is not correct for python. I already
> removed the statement of which I thought would do that, but nothing changed.
> What to do here? The contextbuilder code:
> My UseBuilder.buildUses() calls functions from the contextbuilder. Is that
> correct? Looks very strange to me, as this is a seperate build pass. See:
Unfortunately, all the builders inherit each other (at least in C++),
which creates a slightly hard to overview code-flow. It should be fine
for the use-builder to call context-builder functions, as the
use-builder is run in a second pass, and is 'driven' by the
context-builder which traverses the AST and duchain hierarchy
More information about the KDevelop-devel