LanguageLevel () { if (myOriginalFile != null) { PsiFile originalPythonFile = myOriginalFile; // myOriginalFile could be an instance of base language // see PostfixLiveTemplate#copyFile if (myOriginalFile.getViewProvider() instanceof TemplateLanguageFileViewProvider) { originalPythonFile = myOriginalFile.getViewProvider().getPsi(PythonLanguage.getInstance()); } if (originalPythonFile instanceof PyFile) { return ((PyFile)originalPythonFile).getLanguageLevel(); } } VirtualFile virtualFile = getVirtualFile(); if (virtualFile == null) { virtualFile = getViewProvider().getVirtualFile(); } return PythonLanguageLevelPusher.getLanguageLevelForVirtualFile(getProject(), virtualFile); }