mirror of
https://github.com/ilyakooo0/intellij-haskell.git
synced 2024-09-11 14:56:19 +03:00
Improved finding usages.
This commit is contained in:
parent
f9cc57e1e8
commit
503dbcd5dd
@ -44,7 +44,7 @@ private[component] object BrowseModuleComponent {
|
||||
private def matchResult(key: Key, result: Future[BrowseModuleInternalResult])(implicit ec: ExecutionContext): Future[Option[Iterable[ModuleIdentifier]]] = {
|
||||
concurrent.blocking(result.map {
|
||||
case Right(ids) => Some(ids)
|
||||
case Left(NoInfoAvailable(_, _)) =>
|
||||
case Left(NoInfoAvailable(_, _)) | Left(NoMatchingExport) =>
|
||||
None
|
||||
case Left(ReplNotAvailable) | Left(IndexNotReady) | Left(ModuleNotAvailable(_)) | Left(ReadActionTimeout(_)) =>
|
||||
Cache.synchronous().invalidate(key)
|
||||
|
@ -219,6 +219,7 @@ private[component] object DefinitionLocationComponent {
|
||||
} else {
|
||||
f(repl) match {
|
||||
case Some(o) if o.stderrLines.isEmpty && o.stdoutLines.nonEmpty => Right(o.stdoutLines)
|
||||
case Some(o) if o.stderrLines.mkString.contains("No matching export in any local modules.") => Left(NoMatchingExport)
|
||||
case Some(o) if o.stdoutLines.isEmpty && o.stderrLines.nonEmpty => Right(o.stderrLines) // For some unknown reason REPL write sometimes correct output to stderr
|
||||
case None => Left(ReplNotAvailable)
|
||||
case _ => Left(NoInfoAvailable(name, psiFile.getName))
|
||||
@ -233,6 +234,10 @@ private[component] object DefinitionLocationComponent {
|
||||
case Some(r) => r
|
||||
case None => Left(NoInfoAvailable(name, key.psiFile.getName))
|
||||
}
|
||||
case Left(NoMatchingExport) => HaskellReference.findIdentifierInFileByName(psiFile, name) match {
|
||||
case Some(ne) => Right(LocalModuleLocation(psiFile, ne, name))
|
||||
case None => Left(NoInfoAvailable(name, psiFile.getName))
|
||||
}
|
||||
case Left(noInfo) => Left(noInfo)
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ private[component] object TypeInfoComponent {
|
||||
Cache.getIfPresent(key) match {
|
||||
case Some(result) => result match {
|
||||
case Right(_) => result
|
||||
case Left(NoInfoAvailable(_, _)) =>
|
||||
case Left(NoInfoAvailable(_, _)) | Left(NoMatchingExport) =>
|
||||
result
|
||||
case Left(ReplNotAvailable) | Left(IndexNotReady) | Left(ModuleNotAvailable(_)) | Left(ReadActionTimeout(_)) =>
|
||||
Cache.invalidate(key)
|
||||
@ -130,7 +130,7 @@ private[component] object TypeInfoComponent {
|
||||
result match {
|
||||
case Right(_) =>
|
||||
result
|
||||
case Left(NoInfoAvailable(_, _)) =>
|
||||
case Left(NoInfoAvailable(_, _)) | Left(NoMatchingExport) =>
|
||||
result
|
||||
case Left(ReplNotAvailable) | Left(IndexNotReady) | Left(ModuleNotAvailable(_)) | Left(ReadActionTimeout(_)) =>
|
||||
Cache.invalidate(key)
|
||||
|
@ -26,4 +26,8 @@ package object component {
|
||||
def message = s"No info because read action timed out while $readActionDescription"
|
||||
}
|
||||
|
||||
// GHCi output: No matching export in any local modules.
|
||||
case object NoMatchingExport extends NoInfo {
|
||||
def message: String = "No matching export in any local modules"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user