I want to track file modifications in form of code e.g field declarations, methods and so on in a project. Also I want to get both old and new versions of the java files when a modification is detected.
For this purpose I know that I should use the PsiTreeChangeListener however I should avoid processing the PsiTreeChangeEvent and instead use CachedValue and PsiModificationTracker.MODIFICATION_COUNT.
I already made a similar post:
My questions are:
How do I use CachedValue and PsiModificationTracker in the Listener (initialization)?
How to check whether files were modificated?
Any code examples/snippets are welcome