Author Topic: Delayed context tagging  (Read 5676 times)

dunkers

  • Senior Community Member
  • Posts: 774
  • Hero Points: 36
Re: Delayed context tagging
« Reply #15 on: April 23, 2020, 07:33:59 PM »
Gosh. I have to say I am mega-impressed, Dennis! Thanks  :D

dunkers

  • Senior Community Member
  • Posts: 774
  • Hero Points: 36
Re: Delayed context tagging
« Reply #16 on: May 09, 2020, 02:27:59 PM »
This (the original context tagging issue) is back and 100% reproducible on a project. Any new file isn't picked up, nor any change to an existing file (from any other file). The work space is a reasonably large project that I am doing the mods to, and a huge project I use as reference (the working project calls stuff in the reference project).

I am pretty sure that the problem is the tag file not being updated. I don't see any activity, but on restarting SE it is then up to date. I can delete the tag file and it gets rebuilt OK.

I am wondering if there could be something that fools SE into thinking the tag file is up to date, or that some source file hasn't been changed.

dunkers

  • Senior Community Member
  • Posts: 774
  • Hero Points: 36
Re: Delayed context tagging
« Reply #17 on: May 20, 2020, 08:09:41 PM »
I am convinced there is something wrong with SE on this. It got to the stage where a symbol lookup would show the wrong line in the preview window because the tag file was so out of touch.
So, yesterday, I went through all the options and set them as in the attached screeny. Seemed to work OK with my tests and updating a fail got the additions noticed in other files. I got the nice little popup when some background thing happened. Gotta be fixed.

Today I just added a function to a .c and it's associate .h. In another file, I reference the header, start typing the name... nothing. I even double-clicked the function name and copied it to make sure I hadn't made a typo. Then I changed to some other app and came back, and now the little green thing on the status bar went on so I clicked it, and that said the background task had re-tagged the file in 3 secs. It may have thought it did but my function name still didn't show up.

Next, I restarted SE and now the function name shows up. As a test, in the file with the near-invisible function I made and change a clicked save. Nothing. No background tagging. But the option to have that happen is set, according to the screeny.

What could cause this? I am using a neat tool that redirects B: to a hard drive folder (saves long paths) which might seem to be a network drive. But I've made a determined effort to only use the real hard drive path instead. I also run a util that copies changed files off to robust storage, but I tried with that turned off and would get hit with this problem too.

So, as a clear and simple problem to start with, why is it not tagging when a file is saved? It should do but doesn't. How do I track down the cause of that one?

Dennis

  • Senior Community Member
  • Posts: 3961
  • Hero Points: 517
Re: Delayed context tagging
« Reply #18 on: May 21, 2020, 07:52:55 PM »
I am putting this on my list of things to look into.

A step-by-step guide to reproduce the problem consistently with a sample workspace would be helpful.  I can kind of put that together from your comments, but I don't know when you are adding a file to the project, exactly how you are doing it, a lot of details missing that might make the difference between this being reproducible and not.

dunkers

  • Senior Community Member
  • Posts: 774
  • Hero Points: 36
Re: Delayed context tagging
« Reply #19 on: May 21, 2020, 08:03:36 PM »
Thanks, Dennis. Unfortunately I haven't figured out how to reproduce it on demand, and by the time I notice the project is quite large.

Most of the files I add via the 'New Item from template' on the file menu (attached). I'll try and get a minimal example (not)working, but typically it is fine at the start and takes some while to surface.

dunkers

  • Senior Community Member
  • Posts: 774
  • Hero Points: 36
Re: Delayed context tagging
« Reply #20 on: May 22, 2020, 01:54:32 AM »
OK, well the first problem: no tagging on save.

I created a new project (attached) with just main.c/.h. Added main(), click save, nothing.

Dennis

  • Senior Community Member
  • Posts: 3961
  • Hero Points: 517
Re: Delayed context tagging
« Reply #21 on: May 22, 2020, 02:08:55 PM »
Elaborate on nothing.  What are you expecting to happen immediately?  The tagging finishes, as you know, in the background.

dunkers

  • Senior Community Member
  • Posts: 774
  • Hero Points: 36
Re: Delayed context tagging
« Reply #22 on: May 22, 2020, 02:30:03 PM »
I would expect the status bar icon to go green to indicate background tagging is happening. On that particular project, there is not a lot to tag but it should still flicker. If I change focus to some other app then come back, it does quickly go green for a short period.

Dennis

  • Senior Community Member
  • Posts: 3961
  • Hero Points: 517
Re: Delayed context tagging
« Reply #23 on: May 22, 2020, 02:45:35 PM »
I'm pretty sure we only turn on the background tagging icon for larger background tagging updates (like what happens when application focus changes).  For a single file save, we don't bother with changing it (it would happen so fast, it wouldn't matter anyway).

dunkers

  • Senior Community Member
  • Posts: 774
  • Hero Points: 36
Re: Delayed context tagging
« Reply #24 on: May 22, 2020, 03:39:24 PM »
Ah, that would explain it! Pity, looked like a hard repeatable issue :)

Dennis

  • Senior Community Member
  • Posts: 3961
  • Hero Points: 517
Re: Delayed context tagging
« Reply #25 on: May 22, 2020, 03:42:58 PM »
I generally use the Symbols tool window to monitor whether background tagging tasks or tag-on-save are completing, because it feeds off of exactly what is in the tag files.  But there is, of course, a delay because the background task has to finish, and then the Symbols tool window has to wake up and decide it needs to update its contents.

dunkers

  • Senior Community Member
  • Posts: 774
  • Hero Points: 36
Re: Delayed context tagging
« Reply #26 on: May 22, 2020, 04:14:57 PM »
OK.

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Delayed context tagging
« Reply #27 on: May 23, 2020, 01:09:51 AM »
I notice you said a few times that restarting slick fixes the problem.  You might be able to determine whether the problem is in the tag file or not by checking the time/date on the tag file when the problem is happening, then check what it is after you restart slick  - or even make a copy of it then compare with a tag file that seems to work.  I'm not sure if the tag file is locked but if the problem is in the tag file, you ought to be able to run slick, then substitute in a bad tag file and see if the problem happens.  You would need to make a note of which symbol lookup was failing. 

Either way it's gonna be hard to find the cause of the problem.  You might be able to use the slick C debugger and single step the push-tag function to see at what point the code decides "not found" - or else add some "say" calls to the slick C code.

I think slick has a problem when a file has unsaved changes - tagging fails for the whole file - I don't remember the exact details at the moment and I can't test it right now.  Does switching to another project and back, or closing and re-opening the project make the problem go away?

dunkers

  • Senior Community Member
  • Posts: 774
  • Hero Points: 36
Re: Delayed context tagging
« Reply #28 on: May 23, 2020, 02:02:16 AM »
Good idea re the tag file timestamp. I thought I'd checked that but must've just thought it and not actually put it into practice.

Ditto for the switching project - a kind of halfway house to closing and reopening SE.

I would love to give you the results right now, but having just made some appropriate changes it's working perfectly at the moment :(. I think that implies it's something that accumulates, and explains why restarting SE fixes it.

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Delayed context tagging
« Reply #29 on: May 28, 2020, 04:35:20 AM »
Believe it or not I had this problem today.  Tagging didn't work for new symbols that were defined in another file - "context tagging" finds local ones.  I found that the time/date on the tag file was stuck on yesterday.  Restarting slick resulted in the tag file time/date changing to the current time.  Unfortunately I didn't think to look at whether the tag file got updated when slick closed or when it re-opened.  It might be a locking problem as I often run multiple instances of slick, sometimes with the same project open, briefly.