TextContent (String fileName, String fileText, int offset, Project project) { FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(fileName); PsiFile file = PsiFileFactory.getInstance(project).createFileFromText(fileName, fileType, fileText); return TextExtractor.findTextAt(file, offset, TextContent.TextDomain.ALL); }