-
Notifications
You must be signed in to change notification settings - Fork 261
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
Fix: Prevent diagnostics to "pass through" #2142
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
366f00c
clone options so that options are not shared across execution engines.
MikaelMayer 48e3482
Added concurrent tests
MikaelMayer 8676b3e
Merge branch 'master' into fix-display-obsolete-diagnostics
MikaelMayer 8957b5c
Fixed the merge
MikaelMayer 92e9125
Merge branch 'master' into fix-display-obsolete-diagnostics
keyboardDrummer f26fb04
Renaming refactoring + removed comment
MikaelMayer a4a6a14
No more diagnostics
MikaelMayer 75253eb
Merge branch 'master' into fix-display-obsolete-diagnostics
MikaelMayer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...e/DafnyLanguageServer.Test/GutterStatus/ConcurrentLinearVerificationGutterStatusTester.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text.RegularExpressions; | ||
using System.Threading.Tasks; | ||
using Microsoft.Dafny.LanguageServer.IntegrationTest.Extensions; | ||
using Microsoft.Dafny.LanguageServer.IntegrationTest.Util; | ||
using Microsoft.Dafny.LanguageServer.Workspace.Notifications; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using OmniSharp.Extensions.JsonRpc; | ||
using OmniSharp.Extensions.LanguageServer.Protocol.Document; | ||
using OmniSharp.Extensions.LanguageServer.Protocol.Models; | ||
using Range = OmniSharp.Extensions.LanguageServer.Protocol.Models.Range; | ||
|
||
namespace Microsoft.Dafny.LanguageServer.IntegrationTest.Diagnostics; | ||
|
||
[TestClass] | ||
public class ConcurrentLinearVerificationGutterStatusTester : LinearVerificationGutterStatusTester { | ||
private const int MaxSimultaneousVerificationTasks = 3; | ||
|
||
protected TestNotificationReceiver<VerificationStatusGutter>[] verificationStatusGutterReceivers = | ||
new TestNotificationReceiver<VerificationStatusGutter>[MaxSimultaneousVerificationTasks]; | ||
|
||
private void NotifyAllVerificationGutterStatusReceivers(VerificationStatusGutter request) { | ||
foreach (var receiver in verificationStatusGutterReceivers) { | ||
receiver.NotificationReceived(request); | ||
} | ||
} | ||
|
||
[TestInitialize] | ||
public override async Task SetUp() { | ||
for (var i = 0; i < verificationStatusGutterReceivers.Length; i++) { | ||
verificationStatusGutterReceivers[i] = new(); | ||
} | ||
verificationStatusGutterReceiver = new(); | ||
client = await InitializeClient(options => | ||
options | ||
.AddHandler(DafnyRequestNames.VerificationStatusGutter, | ||
NotificationHandler.For<VerificationStatusGutter>(NotifyAllVerificationGutterStatusReceivers)) | ||
); | ||
} | ||
|
||
[TestMethod] | ||
public async Task EnsuresManyDocumentsCanBeVerifiedAtOnce() { | ||
var result = new List<Task>(); | ||
for (var i = 0; i < MaxSimultaneousVerificationTasks; i++) { | ||
result.Add(VerifyTrace(@" | ||
. | | | I | | :predicate F(i: int) { | ||
. | | | I | | : false // Should not be highlighted in gutter. | ||
. | | | I | | :} | ||
| | | I | | : | ||
. S [S][ ][I][S][ ]:method H() | ||
. S [=][=][-][~][O]: ensures F(1) | ||
. S [=][=][-][~][=]:{//Next: { assert false; | ||
. S [S][ ][I][S][ ]:}", $"testfile{i}.dfy", true, verificationStatusGutterReceivers[i])); | ||
} | ||
|
||
for (var i = 0; i < MaxSimultaneousVerificationTasks; i++) { | ||
await result[i]; | ||
} | ||
|
||
//await Task.WhenAll(result.ToArray()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it can. I'll remove it in another PR. |
||
} | ||
|
||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused by this. All verificationStatusGutterReceivers receive the same notifications, which would be the notifications for all the tasks. How does
VerifyTrace
that getsverificationStatusGutterReceivers[i]
not get confused by the bogus notifications?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It checks that the filename matches and filters out notifications that do not match.
That way, it can rebuild the trace for every file independently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain that in a comment in the testing code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a commit in #1946 to add a comment regarding this.