Skip to content

Commit

Permalink
Feat: Support for --bprint in language server.
Browse files Browse the repository at this point in the history
I add this as a way to simplify boogie debugging, especially in cases when VSCode is not consistent with the command-line like in #4205

I did not add any test for that as it's meant for Dafny development only, but I tested it manually. I borrowed the code from the driver.
  • Loading branch information
MikaelMayer committed Jun 22, 2023
1 parent bd7a1ef commit db0d497
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Source/DafnyLanguageServer/Language/DafnyProgramVerifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public async Task<IReadOnlyList<IImplementationTask>> GetVerificationTasksAsync(
CancellationToken cancellationToken) {
var program = document.Program;
var errorReporter = (DiagnosticErrorReporter)program.Reporter;
var nmodules = Translator.VerifiableModules(program).Count();

cancellationToken.ThrowIfCancellationRequested();

Expand All @@ -55,6 +56,12 @@ public async Task<IReadOnlyList<IImplementationTask>> GetVerificationTasksAsync(
return translated.SelectMany(t => {
var (_, boogieProgram) = t;
var results = engine.GetImplementationTasks(boogieProgram);
if (engine.Options.PrintFile != null) {
var nm = nmodules > 1 ? DafnyMain.BoogieProgramSuffix(engine.Options.PrintFile, t.Item1) : engine.Options.PrintFile;
ExecutionEngine.PrintBplFile(engine.Options, nm, t.Item2, false, false, engine.Options.PrettyPrint);
}
return results;
}).ToList();
}
Expand Down
1 change: 1 addition & 0 deletions Source/DafnyLanguageServer/ServerCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ related locations
GhostIndicators,
LineVerificationStatus,
VerifySnapshots,
DeveloperOptionBag.BoogiePrint,
CommonOptionBag.EnforceDeterminism,
CommonOptionBag.UseJavadocLikeDocstringRewriterOption
}.Concat(ICommandSpec.VerificationOptions).
Expand Down
1 change: 1 addition & 0 deletions docs/dev/news/bprint-option-in language-server.feat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for the `--bprint` option for language server arguments

0 comments on commit db0d497

Please sign in to comment.