DafnyLS is a language server for Dafny. It is implemented in C# on .NET 5.0 with OmniSharp's C# Language Server Protocol.
DafnyLS is now part of the official Dafny repository and is part of the official compiler releases. Therefore, this repository has been archived, and updates will be provided as a part of Dafny releases.
Clone the DafnyLS repo and its submodules.
git clone https://github.com/dafny-lang/language-server-csharp
git submodule update --init
When building DafnyLS from its source, the necessary build dependencies will be automatically downloaded from NuGet or built as a project reference.
dotnet build -c Release Source/
Place the Z3 executable in the language server's root directory or within the z3/bin
subdirectory (already present in the release packages). If not on windows, ensure that the executable has execution permissions:
chmod u+x ./z3/bin/z3
The language server can be started either by the executable itself (e.g., DafnyLS.exe
on windows) or with the following command.
dotnet DafnyLS.dll
It is possible to change the moment when a document is verified by providing the --documents:verify
command-line argument. The options are:
- never - Never verifies the document.
- onchange (default) - Verifies the document with each change.
- onsave - Verifies the document each time it is saved.
For example, to launch DafnyLS to only verify upon saving the document, use the following command:
dotnet DafnyLS.dll --documents:verify=onsave