From 6ff55545353fa333505564753ab5dd6ba74ba3fe Mon Sep 17 00:00:00 2001
From: SeeBasTStick <sebastian.stock@hhu.de>
Date: Sun, 16 Aug 2020 17:40:32 +0200
Subject: [PATCH] added probcli version

---
 .../probCli/ProBCommandLineAccess.kt          | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/main/kotlin/b/language/server/proBMangement/probCli/ProBCommandLineAccess.kt b/src/main/kotlin/b/language/server/proBMangement/probCli/ProBCommandLineAccess.kt
index 69e1d60..3e15dc3 100644
--- a/src/main/kotlin/b/language/server/proBMangement/probCli/ProBCommandLineAccess.kt
+++ b/src/main/kotlin/b/language/server/proBMangement/probCli/ProBCommandLineAccess.kt
@@ -131,6 +131,8 @@ class ProBCommandLineAccess(val communicator : CommunicatorInterface) : ProBInte
         communicator.sendDebugMessage("creating errorDict $errorDict and errorFile $errorPath", MessageType.Info)
         errorDict.mkdirs()
         FileWriter(errorPath, false).close()
+        errorPath.deleteOnExit()
+        errorDict.deleteOnExit()
         return errorDict.exists() && errorPath.exists()
     }
 
@@ -218,13 +220,13 @@ class ProBCommandLineAccess(val communicator : CommunicatorInterface) : ProBInte
                 problem
             }
         }
-                .map { problem -> Diagnostic(
-                        Range(
+                .map { problem ->
+                        val range = Range(
                                 Position(problem.start.line, problem.start.col),
-                                Position(problem.end.line, problem.end.col)),
-
+                                Position(problem.end.line, problem.end.col))
+                        val diagnostic = Diagnostic(
+                        range,
                         problem.message,
-
                         when (problem.type) {
                             "error" -> {
                                 DiagnosticSeverity.Error
@@ -239,9 +241,12 @@ class ProBCommandLineAccess(val communicator : CommunicatorInterface) : ProBInte
                                 DiagnosticSeverity.Hint
                             }
                         },
-                        problem.file,
-                        " probcli v.${problem.version}"
+                        problem.file
                         )
+                    diagnostic.relatedInformation =
+                            listOf(DiagnosticRelatedInformation(Location(problem.file, range), "probcli v.${problem.version}"))
+                    diagnostic
+
                 }
     }
 }
\ No newline at end of file
-- 
GitLab