mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-39532 Implement RestFileViewProvider.getContentElementType mimicking its createFile
It was forgotten during implementation of IDEA-106449. Without this method we tried to parse the whole injected reStructuredText content as a valid Python file not surprisingly containing tons of syntax errors and then run all the normal Python inspection over it. GitOrigin-RevId: ed12c9c6ead90ebb0b5a083126410b2c8cbff233
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9886724473
commit
1f57e524db
@@ -10,6 +10,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.impl.source.PsiFileImpl;
|
||||
import com.intellij.psi.templateLanguages.TemplateLanguageFileViewProvider;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.jetbrains.python.PythonLanguage;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -81,4 +82,15 @@ public class RestFileViewProvider extends MultiplePsiFilesPerDocumentFileViewPro
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IElementType getContentElementType(@NotNull Language language) {
|
||||
if (language == getTemplateDataLanguage()) {
|
||||
return RestPythonElementTypes.PYTHON_BLOCK_DATA;
|
||||
}
|
||||
else if (language.getID().equals("DjangoTemplate")) {
|
||||
return RestPythonElementTypes.DJANGO_BLOCK_DATA;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user