Skip packages with subdirs which are referring to git(hub). Fix issue #379.

This commit is contained in:
Rik van der Kleij 2019-02-14 14:35:03 +01:00
parent d199174683
commit 7e30c1e2f0
3 changed files with 11 additions and 4 deletions

View File

@ -195,7 +195,7 @@ object StackProjectManager {
if (packagePath.exists()) {
StackProjectImportBuilder.addHaskellModule(project, p, projectPath)
} else {
HaskellNotificationGroup.logErrorBalloonEvent(project, s"Can not add package $p as module because it's absolute file path ${packagePath.getAbsolutePath} does not exist.")
HaskellNotificationGroup.warningEvent(project, s"Can not add package $p as module because it's absolute file path ${packagePath.getAbsolutePath} does not exist.")
}
})

View File

@ -30,6 +30,7 @@ import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.packaging.artifacts.ModifiableArtifactModel
import com.intellij.projectImport.ProjectImportBuilder
import icons.HaskellIcons
import intellij.haskell.HaskellNotificationGroup
import intellij.haskell.stackyaml.StackYamlComponent
import intellij.haskell.util.{ApplicationUtil, HaskellFileUtil, HaskellProjectUtil, ScalaUtil}
import javax.swing.Icon
@ -91,10 +92,11 @@ object StackProjectImportBuilder {
moduleBuilder.addModuleConfigurationUpdater((_: Module, rootModel: ModifiableRootModel) => {
moduleBuilder.setupRootModel(rootModel)
})
case None => ()
case None =>
Messages.showInfoMessage(project, s"Can not add package $packageRelativePath as module because ${moduleDirectory.getAbsolutePath} does not contain Cabal file or Cabal file can not be parsed", "Adding module failed")
}
} else {
Messages.showErrorDialog(s"Can not add package $packageRelativePath as module because it's absolute file path ${moduleDirectory.getAbsolutePath} does not exist.", "Module can not be created")
Messages.showInfoMessage(project, s"Can not add package $packageRelativePath as module because it's absolute file path ${moduleDirectory.getAbsolutePath} does not exist.", "Adding module failed")
}
}

View File

@ -41,7 +41,12 @@ object StackYamlComponent {
case s: String if isNotURL(s) => Seq(s)
case m: util.Map[_, _] =>
val map = m.asInstanceOf[util.Map[String, Any]].asScala.toMap
getSubdirs(project, map).getOrElse(Seq()) ++ getLocation(project, map).toSeq
val location = getLocation(project, map)
if (location.isDefined) {
getSubdirs(project, map).getOrElse(location.toSeq)
} else {
Seq()
}
case _ => Seq()
}
case _ => Seq()