Adding new files to background parser

Andreas Pakulat apaku at gmx.de
Mon Jul 26 20:35:29 UTC 2010


On 26.07.10 21:12:42, Milian Wolff wrote:
> On Monday, 26. July 2010 20:50:53 Andreas Pakulat wrote:
> > On 14.07.10 18:45:01, Milian Wolff wrote:
> > > 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' :)
> 
> Not a ParseProjectJob of course, "only" a normal parsejob for each added / 
> removed file. I thought by using the signals I could prevent doubled code in 
> all the project managers.

Hmm, thats true. Dunno which way I'd choose personally (locality of code
that adds new files vs. reducing code-duplication). Hmm, what about
doing it inside the items themselves? That is, if an item is added to a
parent it could schedule its file for re-parsing.

Also reparsing removed files is not really necessary right? Rather the
files using it would need re-parsing?

> > 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 :)
> 
> If you answer the above question,

Not sure which question you mean.

> I'm ok with adding it to the manager. But you surely mean "scheduling
> them for reparsing" right? :P

Well of course, but unless I'm mistaken "scheduling a new parse-job for
file X" is the same as "scheduling X for re-parsing" right on the
technical level?

Andreas

-- 
You will be awarded some great honor.




More information about the KDevelop-devel mailing list