How do I use DUChain::environmentFileForDocument ?

Milian Wolff mail at milianw.de
Sun Sep 20 21:30:55 UTC 2009


David Nolden, 20.09.2009:
> Am Sonntag 20 September 2009 22:06:26 schrieb Milian Wolff:
> > In the ctor of the PHP language support class I want to check the
> >  modification revision of the PHPInternalFunctions file and, if required,
> >  delete it from the duchain so it gets reparsed.
> >
> > My problem is, that I don't know what to pass as ParsingEnvironment* to
> > the above mentioned method...
> >
> > We don't have a PHP-specific ParsingEnvironment.
> 
> That simply means that you don't use parsing-environments, and then you
>  cannot use that function. It is a speedup function, that allows getting
>  just the ParsingEnvironmentFile of a TopDUContext, instead of having to
>  load the whole TopDUContext into memory.

Yes, and that's exactly why I want to use the above mentioned method. I wan't 
to only load the duchain when really required. How would I use a parsing 
environment? Do you have an example?

> You can just use documentForUrl() or however it's called. You can access
>  the ParsingEnvironmentFile directly from the TopDUContext.
> 
> If it is zero, then you need to create it while creating your
>  TopDUContexts. The standard-implementation contains all the standard
>  stuff, like tracking modification revisions (You just need to add them).
> 
> If you use that, the duchain may automatically delete the file if it
>  detects that it's not up to date.
> 
> Of course you can still do it manually in the constructor to enforce an
>  up-to- date version.
> 
> Greetings, David

The thing is that the "file" with the internal functions has it's url() set to 
IndexedString("PHPInternalFunctions"), i.e. the whole tracking won't work 
because the url is invalid.

We need that because we often need to know if a dec is internal, or we need to 
get the chain for the internal file etc. It is very convenient that way, only 
"bug" because of that is that tracking does not work anymore.

And imo it would make sense to check the global file revision only once in the 
life time of a running kdevelop app. If stuff gets updated, KDevelop should be 
restarted.
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20090920/793cc9a4/attachment.sig>


More information about the KDevelop-devel mailing list