[HOW-TO] how can i trigger parsing of a document programatically

Typicaly parsing is done for every untouched document and when this is being edited. Still, i need to be able to reparse a file if for example the diallect of the language was changed by the user.
Is there a way to do this programatically? Currently i am "touching" the document without actually doing any change, but this has the side effect that the file appears as changed in the versioning system.

3 comments
Comment actions Permalink

FileContentUtilCore.reparseFiles()

0
Comment actions Permalink

Thank you Dmitry. Works fine. The issue now is rebuilding the folding regions. I tried CodeFoldingManager.buildInitialFoldings(doc). This is accessing my FoldingBuilder so obviously building the folding structure. but the folding regions do not appear in the editor. I am also refreshing the annotations using DaemonCodeAnalyzer.restart(psiFile). Doesn't help

0
Comment actions Permalink

Did you try buildInitialFoldings(Editor)? I think that should help.


0

Please sign in to leave a comment.