IntelliJ Platform Plugin SDK
 
IntelliJ Platform Explorer

PSI Files

Edit pageLast modified: 24 August 2023

A PSI (Program Structure Interface) file is the root of a structure representing a file's contents as a hierarchy of elements in a particular programming language.

The PsiFile class is the common base class for all PSI files, while files in a specific language are usually represented by its subclasses. For example, the PsiJavaFile class represents a Java file, and the XmlFile class represents an XML file.

Unlike Virtual Files and Documents, which have application scope (even if multiple projects are open, each file is represented by the same VirtualFile instance), PSI has Project scope: the same file is represented by multiple PsiFile instances if the file belongs to multiple projects open at the same time.