-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable check model command from model checking panel #222
base: master
Are you sure you want to change the base?
Enable check model command from model checking panel #222
Conversation
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
0cf55d7
to
193c979
Compare
When the model pane is active, the last checked model is used as the model to check. This is needed since the spec to check is otherwise retrieved using the active file. Since there is no active file if the model pane is active, we need to supply another file to check. This commit also refactors several checkModel helper functions to return Result types. This allows for errors to be propagated back and potentially ignored rather than immediately resulting in an error message.
Instead the canRunTlc check is now performed just before TLC is executed. This avoids code duplication while only sacrificing a bit of early warning.
The match statement works well, but makes the code a little hard to read. Refactoring in favor of longer conditional statements makes the code more readable
f3b3541
to
6582c3e
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
The work as part of #242 identified/created the problem that the code can check another specification than what the HTML page shows. |
2e22ed0
to
46ef234
Compare
2866e79
to
069d5c4
Compare
Addresses #215, replaces #216.
This PR extends the
tlaplus.model.check.run
command to be enabled whenevertlaplus.tlc.canRunAgain
is true. This has the effect of showing the check model command when the model checking pane is active. When no TLA+ file is active, the command falls back on using the last checked spec. The flow of the checkModel function roughly follows:This PR also refactors the helper functions called by checkModel to return
Result
types. Returning a Result allows the error messages to be ignored in the case where a TLA+ file is not active but the last checked spec is known and can be used.As part of the refactoring, I also extracted the
canRunTlc()
checks from functions that get the editor and moved them to the functions that run the TLC tool (doCheckModel()
anddoEvaluateExpression()
).