Skip to content
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

Feat: Support for --bprint in language server. #4206

Merged
merged 13 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give the introduced variables fuller names?


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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put this in a separate traversal outside of the SelectMany.

if (engine.Options.PrintFile) {
  var nmodules = Translator.VerifiableModules(program).Count();
  foreach(var boogieProgram in translated) {
    ..
  }
}


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