Skip to content

Conversation

@SanjulaGanepola
Copy link
Member

Changes

Fixes #465

Whenever include files are changed now, we clear the cache for any files that reference that include.

Before

image

after making some changes to the ILE Docs in empdet.rpgleinc, the hover is not updated in empdet.sqlrpgle:

image

After

image

Signed-off-by: Sanjula Ganepola <Sanjula.Ganepola@ibm.com>
@SanjulaGanepola
Copy link
Member Author

@worksofliam At a quick glance, is there any issues with clearing the cache in this scenario?

@chrjorgensen
Copy link
Contributor

@SanjulaGanepola Have I understood your change correctly in that you only invalidate the cache for the changed include file and not for all includes? If you can confirm, I will test and review.

I don't see any reason for not clearing the cache for changed includes - on the contrary! Cache programming is one of the hardest programming disciplines, and I think you're absolutely right here.

@SanjulaGanepola
Copy link
Member Author

@chrjorgensen Caching can indeed be tricky.

Just so its clear, here is the updated flow:

  1. When a file changes, it triggers onDidChangeContent
  2. We call getDocs with ignoreCache: true on this changed file so the cache is updated for this changed file
  3. The linter diagnostics are also then refreshed for this changed file
  4. We iterate on every file in the parser's cache and check if any of those files include this changed file. If it does find a file, it will remove that file from the cache.

The only part that is new with this PR is step 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hover context from comment lines

3 participants