Rebuild PSI in directory

Hello, I'm developing custom language plugin that extends bundled Properties plugin(and language).
Plugin replaces language for all files in certain directory. Also it replaces lexer and parser for this files, and introduces new token types.
The problem is that when user set up directory in which properties files must be treated as files from another language - files are not reparsed untill project will be reopened.

My question is: can I toggle IDEA reparse and rebuild PSI for files in certain directory?
I found com.intellij.psi.text.BlockSupport#reparseRange, but it accepts PsiFile - in my case PsiFile must be recreated upon parsing, because it must be my implementation.

Thanks in advance!

Comment actions Permalink

You can use the FileContentUtil.reparseFiles() method for this purpose.

Comment actions Permalink

Thanks again Dmitry! This is exactly what I need.


Please sign in to leave a comment.