Events triggering PsiParser.parse()

I see the psi language parser is being triggered several times for a psi file after one single edit action (most probably for building the temporary psi tree for code completion).
Is there a way to identify the event the parsing was triggered for? This would be useful for skipping certain operations during the parsing (like update builder error) that may affect overall performance during editing.

Comment actions Permalink

There is no fixed set of events that can trigger parsing. The parsing will occur every time someone has called PsiDocumentManager.commitDocument(). Parsing for autopopup code completion is performed in a background thread and should not affect editor responsiveness.

Have you seen a CPU snapshot that shows a specific problem with your parser, or do you just have a general feeling that things can be improved?

Comment actions Permalink

Hi Dmitry,
thanks for the clarification.
I am trying to improve the parser responsiveness for large files (up to 8000 lines). One performance issue I identified is my custom "update builder error" logic, which I could avoid if I would know that the parsing is temporary (triggered by formatting indent logic or code completion).
But I think this calls for the usage of IReparseableElementType rather than fine tuning here and there.


Please sign in to leave a comment.