Adding new files to background parser
Andreas Pakulat
apaku at gmx.de
Mon Jul 26 18:50:53 UTC 2010
On 14.07.10 18:45:01, Milian Wolff wrote:
> Hey there,
>
> currently new files added to a project (cp, git checkout, ...) are not added to
> the background parser, even when the user wants the whole project to get
> parsed.
>
> The setting would be:
>
>
> KDevelop::ICore::self()->activeSession()->config()->group( "Project
> Manager" );
> return group.readEntry( "Parse All Project Sources"
>
> But that is currently only used privately in ProjectController (note: _not_
> IProjectController). Is there another way to get that setting, or should I
> make that setting public from the ProjectController?
What do you mean with "make it public"? If its just about a
boolean-getter that reads from kconfig, sure makes complete sense.
> Then I could add it to the GenericManager, not sure about CmakeManager.
You mean you could schedule a parse-job from the manager when a file is
added?
> Actually listening to the ProjectModels signals inside the background parser
> directly and honoring the setting would of course be even better, but I wonder
> when the sig/slot connection should be setup. Right now there is this
>
> KJob* parseProjectJob = new KDevelop::ParseProjectJob(project);
>
> setup in the ProjectController, which would of course lead to doubled adds (I
> know the background parser can cope with that, but it's just unneeded
> overhead, isn't it?).
I don't see how that would work as the job is not persistent. What
happens if I do a git pull 4 hours after opening the project... Or do
you mean make the projectcontroller create a new such job every time the
filesAdded signal is emitted? That seems like a lot of waste as even
just iterating the files (from the parser) to check wether parsing is
necessary takes 'ages' :)
IMHO scheduling a new parse-job from the manager when a file is
added is totally fine. Bonus points if (in case of removal) it
first fetches all files using the removed file (i.e. #include'ing it)
and scheduling them for removal too :)
Andreas
--
You will be misunderstood by everyone.
More information about the KDevelop-devel
mailing list