Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
B Language Server
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
B Language Server
Commits
659ece85
Commit
659ece85
authored
4 years ago
by
SeeBasTStick
Browse files
Options
Downloads
Patches
Plain Diff
fixed bug where error from failing probcli (due to wrong path) was not shown
parent
8b1af340
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/kotlin/b/language/server/BDocumentService.kt
+6
-0
6 additions, 0 deletions
src/main/kotlin/b/language/server/BDocumentService.kt
src/main/kotlin/b/language/server/proBMangement/ProBCommandLineAccess.kt
+9
-5
9 additions, 5 deletions
.../b/language/server/proBMangement/ProBCommandLineAccess.kt
with
15 additions
and
5 deletions
src/main/kotlin/b/language/server/BDocumentService.kt
+
6
−
0
View file @
659ece85
...
...
@@ -7,6 +7,7 @@ import b.language.server.proBMangement.ProBCommandLineAccess
import
b.language.server.proBMangement.ProBInterface
import
org.eclipse.lsp4j.*
import
org.eclipse.lsp4j.services.TextDocumentService
import
java.io.IOException
import
java.util.concurrent.ConcurrentHashMap
class
BDocumentService
(
private
val
server
:
Server
,
private
val
communicator
:
CommunicatorInterface
)
:
TextDocumentService
{
...
...
@@ -64,8 +65,13 @@ class BDocumentService(private val server: Server, private val communicator: Com
communicator
.
sendDebugMessage
(
"invalidating old files $invalidFiles"
,
MessageType
.
Info
)
issueTracker
[
currentUri
]
=
filesWithProblems
.
toSet
()
}
catch
(
e
:
PathCouldNotBeCreatedException
){
communicator
.
sendDebugMessage
(
"error path could not be created"
,
MessageType
.
Info
)
communicator
.
showMessage
(
e
.
message
!!
,
MessageType
.
Error
)
}
catch
(
e
:
CommandCouldNotBeExecutedException
){
communicator
.
sendDebugMessage
(
"command could not be executed"
,
MessageType
.
Info
)
communicator
.
showMessage
(
e
.
message
!!
,
MessageType
.
Error
)
}
catch
(
e
:
IOException
){
communicator
.
sendDebugMessage
(
"command could not be executed"
,
MessageType
.
Info
)
communicator
.
showMessage
(
e
.
message
!!
,
MessageType
.
Error
)
}
}
...
...
This diff is collapsed.
Click to expand it.
src/main/kotlin/b/language/server/proBMangement/ProBCommandLineAccess.kt
+
9
−
5
View file @
659ece85
package
b.language.server.proBMangement
import
b.language.server.communication.Communicator
import
b.language.server.communication.CommunicatorInterface
import
b.language.server.dataStorage.Problem
import
b.language.server.dataStorage.Settings
...
...
@@ -90,7 +89,7 @@ class ProBCommandLineAccess(val communicator : CommunicatorInterface) : ProBInte
* @return success of the action
*/
fun
createFolder
(
errorDict
:
File
,
errorPath
:
File
)
:
Boolean
{
communicator
.
sendDebugMessage
(
"creating errorDict $errorDict and errorFile $errorPath"
,
MessageType
.
Info
)
communicator
.
sendDebugMessage
(
"creating
-----huhu-----
errorDict $errorDict and errorFile $errorPath"
,
MessageType
.
Info
)
errorDict
.
mkdirs
()
FileWriter
(
errorPath
,
false
).
close
()
return
errorDict
.
exists
()
&&
errorPath
.
exists
()
...
...
@@ -99,15 +98,20 @@ class ProBCommandLineAccess(val communicator : CommunicatorInterface) : ProBInte
/**
* Executes the given command
* @param command to execute
* @throws CommandCouldNotBeExecutedException the command failed to reach probcli
* @throws CommandCouldNotBeExecutedException probcli failed to execute the given command
* @throws IOException failed to reach probcli
*/
fun
performActionOnDocument
(
command
:
String
)
{
val
process
:
Process
=
Runtime
.
getRuntime
().
exec
(
command
)
val
output
:
InputStream
=
process
.
inputStream
process
.
waitFor
()
//we must wait here to ensure correct behavior when reading an error
// process.waitFor() //we must wait here to ensure correct behavior when reading an error
val
exitStatus
=
process
.
onExit
()
val
outputAsString
=
String
(
output
.
readAllBytes
())
communicator
.
sendDebugMessage
(
"output of execution + ${exitStatus.isCompletedExceptionally}"
,
MessageType
.
Info
)
if
(!
outputAsString
.
contains
(
"ProB Command Line Interface"
)){
throw
CommandCouldNotBeExecutedException
(
"Error when trying to call probcli with command $command"
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment