Giter Site home page Giter Site logo

tlaplus / vscode-tlaplus Goto Github PK

View Code? Open in Web Editor NEW
330.0 12.0 29.0 25.5 MB

TLA+ language support for Visual Studio Code

License: MIT License

TypeScript 97.39% CSS 0.78% JavaScript 0.70% TLA 1.00% Dockerfile 0.13%
tla tlc pluscal model-checking specification verification formal-methods vscode-extension

vscode-tlaplus's Introduction

TLA+ for Visual Studio Code

Build Status VS Code extension version VS Code extension version nightly

This extension adds support for the TLA+ formal specification language to VS Code. It also supports running the TLC model checker on TLA+ specifications.

Features

  • TLA+ and PlusCal syntax highlighting and code snippets.
  • Running the PlusCal-to-TLA+ translator and module parser.
  • Running TLC model checker on TLA+ specifications.
  • Model checking process and result visualization.
  • Evaluating constant expressions.
  • Converting TLA+ specifications to LaTeX and PDF documents.
  • Code completion.
  • Code on-type formatting.
  • Powered by the official TLA+ tools.

Documentation

The project's Wiki provides information on how to install, configure and use the extension.

Contributing

All forms of contribution are highly welcome! Feel free to file bugs, propose improvements, ask questions, send other feedback.

If you decide to pitch in and write some code, this document will provide you with useful information: CONTRIBUTING.md.

TLA+ Resources

If you're not familiar with TLA+, but want to get a grasp on it, the following list of resources is a good starting point:

License

MIT

vscode-tlaplus's People

Contributors

afonsonf avatar alygin avatar dependabot[bot] avatar edaena avatar eddyashton avatar joshuarowephantom avatar kape1395 avatar klinvill avatar kubukoz avatar lemmy avatar pfeodrippe avatar will62794 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-tlaplus's Issues

TLC output not parsed correctly when there's no new line between messages

When running TLC on Windows, there're lines that contain both a message end marker and the next message start marker:

@!@!@STARTMSG 2193:0 @!@!@
Model checking completed. No error has been found.
  Estimates of the probability that TLC did not check all reachable states
  because two distinct states had the same fingerprint:
  calculated (optimistic):  val = 1.1E-19
@!@!@ENDMSG 2193 @!@!@@!@!@STARTMSG 2201:0 @!@!@
The coverage statistics at 2019-08-17 00:11:08
@!@!@ENDMSG 2201 @!@!@

It must be handled correctly.

SANY output parser doesn't capture errors with no location

This error is not captured:

Parsing file /Users/tla/foo.tla
Parsing file /private/var/folders/7p/g0v7k97x1t3b06j8274rhh0h0000gn/T/TLC.tla

Fatal errors while parsing TLA+ spec in file operators

tla2sany.semantic.AbortException
*** Abort messages: 1

Unknown location

Cannot find source file for module Sequence imported in module foo.

Handle tla2tools result codes

If tla2tools exits with a code 1-9 or 255, it means that there's a problem with tooling (probably with Java options). We must handle it properly, warn the user and guide him through the process of fixing the problem.

Support constant operators detection

The TlaDocumentSymbolsProvider stumbles on operators while parsing constants and doesn't report them as model symbols. As a result, const operator names don't appear in the outline panel and in completion suggestions. Such operators also prevent parsing of the following constants.

A simple case:

CONSTANT Foo(_), Bar

Neither Foo nor Bar makes it to the model symbols list now.

Display TLC warnings

We now collect TLC warnings from its output but never display them. It would be cool to display them the same way we display errors -- to have the "Warnings" block in the output visualization panel.

Unexpected end of message

The following output causes the Unexpected end of message error:

@!@!@STARTMSG 2262:0 @!@!@
TLC2 Version 2.14 of 10 July 2019 (rev: 0cae24f)
@!@!@ENDMSG 2262 @!@!@
@!@!@STARTMSG 2187:0 @!@!@
Running breadth-first search Model-Checking with fp 95 and seed -5827499341661814189 with 1 worker on 4 cores with 1820MB heap and 64MB offheap memory [pid: 47842] (Mac OS X 10.14.5 x86_64, Amazon.com Inc. 11.0.3 x86_64, MSBDiskFPSet, DiskStateQueue).
@!@!@ENDMSG 2187 @!@!@
@!@!@STARTMSG 1000:1 @!@!@
TLC threw an unexpected exception.
This was probably caused by an error in the spec or model.
See the User Output or TLC Console for clues to what happened.
The exception was a tlc2.tool.ConfigFileException
: @!@!@STARTMSG 5006:0 @!@!@
TLC found an error in the configuration file at line 6
It was expecting = or <-, but did not find it.
@!@!@ENDMSG 5006 @!@!@
@!@!@ENDMSG 1000 @!@!@
@!@!@STARTMSG 2186:0 @!@!@
Finished in 262ms at (2019-08-18 21:16:19)
@!@!@ENDMSG 2186 @!@!@

Parse and display PlusCal transpiler warnings

PlusCal transpiler output parser only captures errors, but the transpiler itself also generates warnings that would be cool to capture too. Those warning messages are one-liners of format Warning: {text} with no location information. For instance:

Warning: symbols were renamed.

Change default indentation to 2 spaces

At the moment, the default setting for the code formatter is 4 spaces. I'd like to change it to 2 spaces for TLA+, PlusCal and .cfg-files, but not sure yet.

4 spaces:

  • the default setting in the Toolbox
  • the default setting in most of the text editors

2 spaces:

  • used in pretty all the TLA+ examples / books / tutorials
  • feels more suitable to me, since
    • TLA+ code is usually indented in accordance with /\'s, \/'s and other operators or syntax constructions, so pure tabs are rare
    • PlusCal code is usually not very convoluted, and 2 spaces indentation seems enough to easily navigate its structure
    • .cfg files are even simpler
  • IDEs and text editors now provide many tools for dealing with code structure (indentation guide lines, folding, current block highlighting etc.) that doing all this with long spaces seems redundant.

Any input on the issue is welcomed.

Support constant expression evaluation

Being able to quickly evaluate constant expressions is very useful, especially when learning TLA+.

The Toolbox provides such functionality via the "No Behavior Spec" field. In VS Code I see two options:

  • Use a prompt dialog to allow the user to enter a constant expression.
  • Treat the currently selected chunk of code as an expression and allow the user to evaluate it.

The expression along with its value or an error message should be send to a separate output channel.

"Not properly indented" SANY error is not parsed correctly

The error from the following SANY output is not parsed correctly:

TLC2 Version 2.14 of 10 July 2019 (rev: 0cae24f)
Running breadth-first ...
Starting SANY...
Parsing file /Users/bob/foo/foo.tla
***Parse Error***
Item at line 14, col 9 to line 14, col 9 of module foo is not properly indented inside conjunction or  disjunction list item at line 11, col 9 to line 14, col 9 of module foo
Residual stack trace follows:
AND-OR Junction starting at line 9, column 9.
ExtendableExpr starting at line 9, column 9.
Expression starting at line 9, column 9.
Definition starting at line 8, column 1.
Module body starting at line 5, column 1.
Fatal errors while parsing TLA+ spec in file foo
tla2sany.semantic.AbortException
*** Abort messages: 1
In module foo
Could not parse module foo from file foo.tla
SANY finished.
Starting... (2019-09-21 18:53:51)
Parsing or semantic analysis failed.
Finished in 620ms at (2019-09-21 18:53:51)

Display TLC output in an output panel

The extension now sends TLC output to a .out file. It would be better to send it to an output panel and let the user opt out .out-files creation.

Display results of the last executed model checking, not for the last shown

  1. Start model checking
  2. While it's not finished, open some previously generated .out file
  3. Close Model checking result view
  4. Click on the button in the status bar to reveal the Model checking result view

It'll display either the currently running model checking process (if there was some output during our actions), or the previously opened .out file. It must always be the last checking process.

So, opening a .out file must not meddle in the ongoing checking process.

Check Java version

Check Java version when the user changes configuration and when there're problems with running tla2tools.

Support custom Java options

Allow the user to provide custom Java options for the TLA tools.
Be careful with options that change GC, since we manually provide ParallelGC now.

This is awesome

No real issue, just wanted to say how much I appreciate you making this :D

Add code blocks formatting

The extension now supports on-type formatting, i.e. automatic code indentation while the user is typing.

It would be great to also support formatting of the selected code blocks (including the whole document), though there's a great deal of questions about the proper way of TLA+ code formatting that should be answered before the implementation.

Add progress indicator to the status bar

Now, the only way to see the model checking progress is on the panel that is opened when check process is launched. If the user closes this panel, it's impossible to get it back and see what's going on.

There must be an indicator in the status bar that would show the current checking status and allow to reopen the Model Checking view page.

A command to generate PDF

TLA toolbox can generate PDF from a specification. It would be nice to able to generate PDF in VS Code too.

Handle PlusCal transpiler error when there's no PlusCal code

If PlusCal transpiler is running on a file with no PlusCal code, it returns a single error:

Unrecoverable error:
 -- Beginning of algorithm string --algorithm not found.

In this case, the error should be ignored.

It also makes sense to not not run the transpiler on such files at all.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.