use of com.jetbrains.lang.dart.psi.DartFile in project intellij-plugins by JetBrains.
the class DartCommandLineRuntimeConfigurationProducer method getRunnableDartFileFromContext.
@Nullable
public static VirtualFile getRunnableDartFileFromContext(@NotNull final ConfigurationContext context, final boolean checkBrowserSpecificImports) {
final PsiElement psiLocation = context.getPsiLocation();
final PsiFile psiFile = psiLocation == null ? null : psiLocation.getContainingFile();
final VirtualFile virtualFile = DartResolveUtil.getRealVirtualFile(psiFile);
if (psiFile instanceof DartFile && virtualFile != null && ProjectRootManager.getInstance(context.getProject()).getFileIndex().isInContent(virtualFile) && !DartWritingAccessProvider.isInDartSdkOrDartPackagesFolder(psiFile.getProject(), virtualFile) && DartResolveUtil.getMainFunction(psiFile) != null && (!checkBrowserSpecificImports || !hasImport((DartFile) psiFile, "dart:html", "dart:html_common", "dart:indexed_db", "dart:js", "dart:svg", "dart:web_audio", "dart:web_gl", "dart:web_sql"))) {
return virtualFile;
}
return null;
}
Aggregations