vscode-tlaplus icon indicating copy to clipboard operation
vscode-tlaplus copied to clipboard

Enable check model command from model checking panel

Open klinvill opened this issue 4 years ago • 4 comments

Addresses #215, replaces #216.

This PR extends the tlaplus.model.check.run command to be enabled whenever tlaplus.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:

  1. If given a file URI , read the spec from the file.
  2. If the active file is a TLA+ file, read the spec from that file.
  3. If lastCheckFiles is populated, use that spec.
  4. Error, no spec to check

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() and doEvaluateExpression()).

klinvill avatar Jun 04 '21 01:06 klinvill

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

sonarqubecloud[bot] avatar Jun 04 '21 01:06 sonarqubecloud[bot]

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

sonarqubecloud[bot] avatar Nov 14 '21 21:11 sonarqubecloud[bot]

@lemmy I rebased this onto the latest changes and think it didn't break anything, but I'd love some extra assurance I didn't break #233

klinvill avatar Nov 14 '21 21:11 klinvill

The work as part of https://github.com/alygin/vscode-tlaplus/issues/242 identified/created the problem that the code can check another specification than what the HTML page shows.

lemmy avatar Nov 15 '21 17:11 lemmy