Get file within IFileElementType.parseContents()?


I'm developing a language plugin and am transforming our parse tree to ASTNode tree during our impl of IFileElementType.parseContents( ASTNode ).  I need a way to get at the file name corresponding with the ASTNode passed in to this method.  Sometimes it's there via chameleon.getPsi().getVirtualFIle(), sometimes it's not; it's null sometimes.  Is there a consistent way to get the file?  Essentially, I need the path to the file relative to the src directory.

Another question, assuming I can get the file, I'd also like to get the module of the file.  Is there a standard way to do that in the context of the parseConents() method?



Please sign in to leave a comment.