Merge pull request #440 from declension/bugfix/improve-english-messages

Fix / improve English in various user / log messages.
This commit is contained in:
Rik 2019-06-18 21:50:17 +02:00 committed by GitHub
commit f8e9c7fe57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 54 deletions

View File

@ -19,7 +19,7 @@ class LoadModuleAction extends AnAction {
} yield {
HaskellFileUtil.getAbsolutePath(actionContext.psiFile) match {
case Some(filePath) => consoleView.executeCommand(s":load $filePath", addToHistory = false)
case None => HaskellNotificationGroup.logWarningBalloonEvent(actionContext.project, s"Can not load file in REPL because could not determine path for file `${actionContext.psiFile.getName}`. File exists only in memory")
case None => HaskellNotificationGroup.logWarningBalloonEvent(actionContext.project, s"Can't load file in REPL because `${actionContext.psiFile.getName}` only exists in memory")
}
}
}

View File

@ -63,7 +63,7 @@ object HoogleComponent {
val psiFile = qualifiedNameElement.getContainingFile.getOriginalFile
DefinitionLocationComponent.findDefinitionLocation(psiFile, qualifiedNameElement, None) match {
case Left(noInfo) =>
HaskellNotificationGroup.logWarningEvent(project, s"No documentation because no location info could be found for identifier `$name` because ${noInfo.message}")
HaskellNotificationGroup.logWarningEvent(project, s"No documentation available as no location info could be found for identifier `$name` due to: ${noInfo.message}")
None
case Right(info) =>
val locationName = info match {
@ -74,7 +74,7 @@ object HoogleComponent {
HoogleComponent.createDocumentation(project, name, locationName)
}
} else {
Some("No documentation because Hoogle (database) is not available")
Some("No documentation available as Hoogle (database) isn't available")
}
}
@ -112,7 +112,7 @@ object HoogleComponent {
private def isHoogleFeatureAvailable(project: Project): Boolean = {
if (!StackProjectManager.isHoogleAvailable(project)) {
HaskellNotificationGroup.logInfoEvent(project, s"$HoogleName is not (yet) available")
HaskellNotificationGroup.logInfoEvent(project, s"$HoogleName isn't (yet) available")
false
} else {
doesHoogleDatabaseExist(project)
@ -130,7 +130,7 @@ object HoogleComponent {
if (buildHaddockOutput.contains(true)) {
GlobalProjectInfoComponent.findGlobalProjectInfo(project).map(_.localDocRoot) match {
case Some(localDocRoot) => StackCommandLine.executeInMessageView(project, HooglePath, Seq("generate", s"--local=$localDocRoot", s"--database=${hoogleDbPath(project)}"))
case None => HaskellNotificationGroup.logErrorBalloonEvent(project, "Can not generate Hoogle db because path to local doc root is unknown")
case None => HaskellNotificationGroup.logErrorBalloonEvent(project, "Couldn't generate Hoogle DB because path to local doc root is unknown")
}
}
}
@ -140,7 +140,7 @@ object HoogleComponent {
}
def showHoogleDatabaseDoesNotExistNotification(project: Project): Unit = {
HaskellNotificationGroup.logInfoBalloonEvent(project, "Hoogle database does not exist. Hoogle features can be optionally enabled by menu option `Haskell`/`(Re)Build Hoogle database`")
HaskellNotificationGroup.logInfoBalloonEvent(project, "Hoogle database doesn't exist. Hoogle features can be enabled by menu option `Haskell`/`(Re)Build Hoogle database`")
}
def versionInfo(project: Project): String = {

View File

@ -143,7 +143,7 @@ object StackProjectManager {
private def init(project: Project, restart: Boolean = false): Unit = {
if (HaskellProjectUtil.isValidHaskellProject(project, notifyNoSdk = true)) {
if (isInitializing(project)) {
HaskellNotificationGroup.logWarningBalloonEvent(project, "Action is not possible because project is initializing")
HaskellNotificationGroup.logWarningBalloonEvent(project, "Action not possible whilst project is initializing")
} else {
getStackProjectManager(project).foreach(_.initializing = true)
if (restart) {
@ -159,34 +159,34 @@ object StackProjectManager {
ProgressManager.getInstance().run(new Task.Backgroundable(project, "Building project, starting REPL(s) and preloading cache", false, PerformInBackgroundOption.ALWAYS_BACKGROUND) {
def run(progressIndicator: ProgressIndicator) {
HaskellNotificationGroup.logInfoEvent(project, "Starting initializing Haskell project")
HaskellNotificationGroup.logInfoEvent(project, "Initializing Haskell project")
try {
progressIndicator.setText("Busy with building project's dependencies")
progressIndicator.setText("Busy building project's dependencies")
val dependenciesBuildResult = StackCommandLine.buildProjectDependenciesInMessageView(project)
if (dependenciesBuildResult.contains(true)) {
progressIndicator.setText("Busy with building project")
progressIndicator.setText("Busy building project")
val projectLibTargets = HaskellComponentsManager.findStackComponentInfos(project).filter(_.stanzaType == LibType).map(_.target)
StackCommandLine.buildInMessageView(project, projectLibTargets)
} else {
HaskellNotificationGroup.logErrorBalloonEvent(project, "Project will not be built because building it's dependencies failed")
HaskellNotificationGroup.logErrorBalloonEvent(project, "Project won't be built because building its dependencies failed")
}
if (restart) {
val projectRepsl = StackReplsManager.getRunningProjectRepls(project)
progressIndicator.setText("Busy with stopping Stack REPLs")
progressIndicator.setText("Busy stopping Stack REPLs")
StackReplsManager.getGlobalRepl(project).foreach(_.exit())
projectRepsl.foreach(_.exit())
progressIndicator.setText("Busy with cleaning up cache")
progressIndicator.setText("Busy cleaning cache")
HaskellComponentsManager.invalidateGlobalCaches(project)
ApplicationManager.getApplication.runReadAction(ScalaUtil.runnable {
getStackProjectManager(project).foreach(_.initStackReplsManager())
})
progressIndicator.setText("Busy with updating project and module settings")
progressIndicator.setText("Busy updating project and module settings")
val projectPath = project.getBasePath
val projectModules = HaskellProjectUtil.findProjectHaskellModules(project)
val packagePaths = StackProjectImportBuilder.getPackagePaths(project)
@ -200,7 +200,7 @@ object StackProjectManager {
if (packagePath.exists()) {
StackProjectImportBuilder.addHaskellModule(project, p, projectPath)
} else {
HaskellNotificationGroup.warningEvent(project, s"Can not add package $p as module because it's absolute file path ${packagePath.getAbsolutePath} does not exist.")
HaskellNotificationGroup.warningEvent(project, s"Couldn't add package $p as module, because its absolute path ${packagePath.getAbsolutePath} doesn't exist.")
}
})
@ -218,10 +218,10 @@ object StackProjectManager {
val replsLoad = ApplicationManager.getApplication.executeOnPooledThread(ScalaUtil.runnable {
StackReplsManager.getReplsManager(project).foreach(_.stackComponentInfos.filter(_.stanzaType == LibType).foreach { info =>
progressIndicator.setText("Busy with starting project REPL " + info.packageName)
progressIndicator.setText("Busy starting project REPL " + info.packageName)
StackReplsManager.getProjectRepl(project, info) match {
case Some(r) if r.available => HaskellNotificationGroup.logInfoEvent(project, s"REPL ${info.packageName} is started")
case _ => HaskellNotificationGroup.logWarningEvent(project, s"REPL ${info.packageName} is not started")
case _ => HaskellNotificationGroup.logWarningEvent(project, s"REPL ${info.packageName} isn't started")
}
Thread.sleep(1000) // Have to wait between starting the REPLs otherwise timeouts while starting
})
@ -236,7 +236,7 @@ object StackProjectManager {
val projectFilesWithImportedModuleNames = projectFiles match {
case Right(files) => Some(files.map(pf => (pf, ApplicationUtil.runReadAction(HaskellPsiUtil.findImportDeclarations(pf)).flatMap(id => ApplicationUtil.runReadAction(id.getModuleName)))))
case Left(_) =>
HaskellNotificationGroup.logInfoEvent(project, "Could not retrieve project files")
HaskellNotificationGroup.logInfoEvent(project, "Couldn't retrieve project files")
None
}
@ -247,41 +247,41 @@ object StackProjectManager {
HaskellNotificationGroup.logInfoEvent(project, "Loading module identifiers " + moduleNames.mkString(", "))
moduleNames.foreach(m => BrowseModuleComponent.findModuleIdentifiersSync(project, m))
}
case None => HaskellNotificationGroup.logInfoEvent(project, "Could not loaded module identifiers because of timeout ")
case None => HaskellNotificationGroup.logInfoEvent(project, "Couldn't load module identifiers due to timeout")
}
})
progressIndicator.setText("Busy with starting global Stack REPL")
progressIndicator.setText("Busy starting global Stack REPL")
StackReplsManager.getGlobalRepl(project)
progressIndicator.setText("Busy with preloading global project info")
progressIndicator.setText("Busy preloading global project info")
GlobalProjectInfoComponent.findGlobalProjectInfo(project)
progressIndicator.setText("Busy with preloading library packages info")
progressIndicator.setText("Busy preloading library packages info")
LibraryPackageInfoComponent.preloadLibraryPackageInfos(project)
progressIndicator.setText("Busy with preloading stack component info cache")
progressIndicator.setText("Busy preloading Stack component info cache")
val preloadStackComponentInfoCache = ApplicationManager.getApplication.executeOnPooledThread(ScalaUtil.callable {
HaskellComponentsManager.preloadStackComponentInfoCache(project)
})
val preloadLibraryFilesCacheFuture = ApplicationManager.getApplication.executeOnPooledThread(ScalaUtil.runnable {
if (!project.isDisposed) {
progressIndicator.setText("Busy with downloading library sources")
progressIndicator.setText("Busy downloading library sources")
HaskellModuleBuilder.addLibrarySources(project, update = restart)
HaskellComponentsManager.preloadLibraryFilesCache(project)
}
})
progressIndicator.setText("Busy with preloading library identifiers")
progressIndicator.setText("Busy preloading library identifiers")
val preloadLibraryIdentifiersCacheFuture = ApplicationManager.getApplication.executeOnPooledThread(ScalaUtil.runnable {
if (!project.isDisposed) {
HaskellComponentsManager.preloadLibraryIdentifiersCaches(project)
}
})
progressIndicator.setText("Busy with preloading all library identifiers")
progressIndicator.setText("Busy preloading all library identifiers")
ApplicationManager.getApplication.executeOnPooledThread(ScalaUtil.runnable {
if (!project.isDisposed) {
getStackProjectManager(project).foreach(_.preloadingAllLibraryIdentifiers = true)
@ -304,7 +304,7 @@ object StackProjectManager {
}
}
progressIndicator.setText("Busy with preloading caches")
progressIndicator.setText("Busy preloading caches")
if (!preloadLibraryFilesCacheFuture.isDone || !preloadStackComponentInfoCache.isDone || !preloadLibraryIdentifiersCacheFuture.isDone || !replsLoad.isDone) {
FutureUtil.waitForValue(project, preloadStackComponentInfoCache, "preloading project cache", 600)
FutureUtil.waitForValue(project, preloadLibraryFilesCacheFuture, "preloading library files caches", 600)
@ -315,10 +315,10 @@ object StackProjectManager {
getStackProjectManager(project).foreach(_.initializing = false)
}
// Force to load the module in REPL when REPL can be started. It could have happen that IntelliJ wanted to load file (via HaskellAnnotator)
// but REPL could not yet be started.
// Force-load the module in REPL when REPL can be started. IntelliJ could have wanted to load file (via HaskellAnnotator)
// but the REPL couldn't be started yet.
HaskellAnnotator.NotLoadedFile.remove(project) foreach { psiFile =>
HaskellNotificationGroup.logInfoEvent(project, s"${psiFile.getName} will be forced loaded")
HaskellNotificationGroup.logInfoEvent(project, s"${psiFile.getName} will be force-loaded")
HaskellAnnotator.restartDaemonCodeAnalyzerForFile(psiFile)
}
@ -331,11 +331,11 @@ object StackProjectManager {
if (intersection.nonEmpty) {
intersection.foreach(p => {
val moduleName = module.getName
HaskellNotificationGroup.logWarningBalloonEvent(project, s"Source folder `$p` of module `$moduleName` is defined as Source and as Test Source")
HaskellNotificationGroup.logWarningBalloonEvent(project, s"Source folder `$p` of module `$moduleName` is defined both as Source and Test Source")
})
}
})
HaskellNotificationGroup.logInfoEvent(project, "Initializing Haskell project is finished")
HaskellNotificationGroup.logInfoEvent(project, "Finished initializing Haskell project")
}
})
}
@ -404,7 +404,7 @@ class StackProjectManager(project: Project) extends ProjectComponent {
initStackReplsManager()
if (replsManager.exists(_.stackComponentInfos.isEmpty)) {
Messages.showErrorDialog(project, s"Can not start project because no Cabal file was found or could not be read", "Can not start project")
Messages.showErrorDialog(project, s"Can't start project as no Cabal file was found (or could not be read)", "Can't start project")
} else {
StackProjectManager.start(project)
}
@ -429,4 +429,4 @@ class StackProjectManager(project: Project) extends ProjectComponent {
sdkModificator.commitChanges()
}
}
}
}

View File

@ -7,7 +7,7 @@ package object component {
}
case object ReplNotAvailable extends NoInfo {
def message: String = "No info because REPL is not (yet) available"
def message: String = "No info because REPL isn't (yet) available"
}
case class NoInfoAvailable(name: String, locationName: String) extends NoInfo {
@ -15,15 +15,15 @@ package object component {
}
case object IndexNotReady extends NoInfo {
override def message: String = "No info because index is not ready"
override def message: String = "No info because index isn't ready"
}
case class ModuleNotAvailable(name: String) extends NoInfo {
override def message: String = s"No info because $name is not loaded or found"
override def message: String = s"No info because $name isn't loaded or found"
}
case class ReadActionTimeout(readActionDescription: String) extends NoInfo {
def message = s"No info because read action timeout while $readActionDescription"
def message = s"No info because read action timed out while $readActionDescription"
}
}

View File

@ -193,7 +193,7 @@ case class ProjectStackRepl(project: Project, stackComponentInfo: StackComponent
if (psiFile.isEmpty || isBrowseModuleLoaded(moduleName) || psiFile.exists(pf => load(pf, fileChanged = false, mustBeByteCode = false).exists(_._2 == false))) {
execute(s":browse! $moduleName")
} else {
HaskellNotificationGroup.logInfoEvent(project, s"Could not get module identifiers for module $moduleName because file ${psiFile.map(_.getName).getOrElse("-")} is not loaded")
HaskellNotificationGroup.logInfoEvent(project, s"Couldn't get module identifiers for module $moduleName because file ${psiFile.map(_.getName).getOrElse("-")} isn't loaded")
None
}
}
@ -239,7 +239,7 @@ case class ProjectStackRepl(project: Project, stackComponentInfo: StackComponent
} else {
filePath
}
case None => throw new IllegalStateException(s"Can not load file `${psiFile.getName}` in REPL because it exists only in memory")
case None => throw new IllegalStateException(s"Can't load file `${psiFile.getName}` in REPL because it only exists in memory")
}
}
}

View File

@ -95,10 +95,10 @@ abstract class StackRepl(project: Project, componentInfo: Option[StackComponentI
protected def execute(command: String, forceExecute: Boolean = false): Option[StackReplOutput] = {
if ((!available || starting) && !forceExecute) {
HaskellEditorUtil.showStatusBarMessage(project, s"[$getComponentName] Haskell support is not available when Stack REPL is not (yet) running")
HaskellEditorUtil.showStatusBarMessage(project, s"[$getComponentName] Haskell support is only available when Stack REPL is running")
None
} else if (!outputStreamSyncVar.isSet) {
logError("Can not write to Stack REPL. Check if your Stack project environment is working okay")
logError("Can't write to Stack REPL. Check if your Stack project environment is working okay")
None
} else {
@ -216,7 +216,7 @@ abstract class StackRepl(project: Project, componentInfo: Option[StackComponentI
}
if (available || starting) {
logInfo("Stack REPL can not be started because it's already starting or running")
logInfo("Stack REPL can't be started because it's already starting / running")
} else {
starting = true
clearLoadedModules()
@ -281,19 +281,19 @@ abstract class StackRepl(project: Project, componentInfo: Option[StackComponentI
} else if (hasDependencyError) {
val target = componentInfo.map(_.target).getOrElse("-")
val error = stderrQueue.asScala.find(_.startsWith(CanNotSatisfyErrorMessageIndicator)).map(_.replace("<command line>:", "").trim).getOrElse("a dependency failed to build")
val message = s"Stack REPL could not be started for target `$target` because $error"
val message = s"Stack REPL couldn't be started for target `$target` due to: $error"
logInfo(message)
HaskellNotificationGroup.logWarningBalloonEvent(project, message)
closeResources()
} else {
logError(s"Stack REPL could not be started within $DefaultTimeout")
logError(s"Stack REPL couldn't be started within $DefaultTimeout")
writeOutputToLog()
closeResources()
}
}
catch {
case e: Exception =>
logError("Could not start Stack REPL. Make sure you have set right path to Stack in Settings")
logError("Couldn't start Stack REPL. Make sure you've set the right path to Stack in Settings")
logError(s"Error message while trying to start Stack REPL: ${e.getMessage}")
writeOutputToLog()
exit(forceExit = true)
@ -307,7 +307,7 @@ abstract class StackRepl(project: Project, componentInfo: Option[StackComponentI
def exit(forceExit: Boolean = false): Unit = synchronized {
if (!available && !forceExit) {
logInfo("Stack REPL can not be stopped because it's already stopped")
logInfo("Stack REPL couldn't be stopped because it's already stopped")
} else {
try {
available = false
@ -403,4 +403,4 @@ object StackRepl {
case object BenchmarkType extends StanzaType
}
}

View File

@ -79,7 +79,7 @@ class HaskellModuleBuilder extends TemplateModuleBuilder(null, HaskellModuleType
packageRelativePath.flatMap(pp => HaskellModuleBuilder.createCabalInfo(rootModel.getProject, project.getBasePath, pp)) match {
case Some(ci) => cabalInfo = ci
case None =>
Messages.showErrorDialog(s"Could not create Haskell module because could not retrieve or parse Cabal file for package path `$packageRelativePath`", "No Cabal file info")
Messages.showErrorDialog(s"Couldn't create Haskell module due to failure retrieving or parsing Cabal file for package path `$packageRelativePath`", "No Cabal file info")
}
}
@ -110,10 +110,10 @@ class HaskellModuleBuilder extends TemplateModuleBuilder(null, HaskellModuleType
val processOutput = StackCommandLine.run(project, Seq("new", project.getName, "--bare", "new-template", "-p", "author-email:Author email here", "-p", "author-name:Author name here", "-p", "category:App category here", "-p", "copyright:2019 Author name here", "-p", "github-username:Github username here"), timeoutInMillis = 60.seconds.toMillis, enableExtraArguments = false)
processOutput match {
case None =>
throw new RuntimeException("Could not create new Stack project because could not execute Stack command for creating new project on file system")
throw new RuntimeException("Couldn't create new Stack project due to failure executing Stack command for creating new project on file system")
case Some(output) =>
if (output.getExitCode != 0) {
throw new RuntimeException(s"Could not create new Stack project: ${output.getStdout} ${output.getStderr}")
throw new RuntimeException(s"Couldn't create new Stack project: ${output.getStdout} ${output.getStderr}")
}
}
}
@ -150,7 +150,7 @@ class HaskellModuleWizardStep(wizardContext: WizardContext, haskellModuleBuilder
override def validate(): Boolean = {
if (getJdk == null) {
Messages.showErrorDialog("You can not create Haskell project without Stack configured as SDK", "No Haskell Tool Stack specified")
Messages.showErrorDialog("You can't create a Haskell project without Stack configured as SDK", "No Haskell Tool Stack specified")
false
} else {
true
@ -223,7 +223,7 @@ object HaskellModuleBuilder {
HaskellProjectUtil.findCabalFile(moduleDirectory) match {
case Some(f) => Option(f)
case None =>
Messages.showErrorDialog(s"Could not create Haskell module because Cabal file can not be found in `$moduleDirectory`", "Haskell module can not be created")
Messages.showErrorDialog(s"Couldn't create Haskell module because Cabal file can't be found in `$moduleDirectory`", "Haskell module can't be created")
None
}
}
@ -232,7 +232,7 @@ object HaskellModuleBuilder {
CabalInfo.create(project, cabalFile) match {
case Some(f) => Option(f)
case None =>
Messages.showErrorDialog(project, s"Could not create Haskell module because Cabal file `$cabalFile` can not be parsed", "Haskell module can not be created")
Messages.showErrorDialog(project, s"Couldn't create Haskell module because Cabal file `$cabalFile` can't be parsed", "Haskell module can't be created")
None
}
}