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

Diagnostic related fixes #4513

Conversation

keyboardDrummer
Copy link
Member

@keyboardDrummer keyboardDrummer commented Sep 5, 2023

Changes

  • Let rewriters that operate within the module caching context, use the correct ErrorReporter, so any diagnostics recorded by them are saved in the cache.
  • Use previous resolution diagnostics when processed parsed document and no parsing diagnostics were found, to prevent diagnostic flickering and reduce bandwidth used by diagnostics.
  • Added a bunch of missing release notes

Testing

  • Added two units tests for the above two issues

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

Copy link
Member

@MikaelMayer MikaelMayer left a comment

Choose a reason for hiding this comment

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

Happy to see the IDE getting more robust.

Comment on lines +99 to +101
// var parseDiagnostics = await diagnosticsReceiver.AwaitNextDiagnosticsAsync(CancellationToken);
// Assert.Single(parseDiagnostics);
// Assert.Contains(parseDiagnostics, d => d.Message.Contains("cycle of includes"));
Copy link
Member

Choose a reason for hiding this comment

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

Consider removing this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Relates to the skipped test. I was hoping that with the comment it would be OK to keep. Might help reduce confusion if we ever change the behavior and then this test breaks, but gets fixed with the commented code.

@@ -21,6 +21,70 @@ namespace Microsoft.Dafny.LanguageServer.IntegrationTest.Synchronization {
public class DiagnosticsTest : ClientBasedLanguageServerTest {
private readonly string testFilesDirectory = Path.Combine(Directory.GetCurrentDirectory(), "Synchronization/TestFiles");

[Fact(Skip = "Not implemented. Requires separating diagnostics from different sources")]
Copy link
Member

Choose a reason for hiding this comment

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

Is this a test you intend to fix later?

Copy link
Member Author

Choose a reason for hiding this comment

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

Allowing this test to pass would be an improvement, but I don't think it's something we need to do soon. Do you want me to remove it? To me it's a bit like a GH issue but then in the code, a reminder of something we can improve.

@keyboardDrummer keyboardDrummer enabled auto-merge (squash) September 6, 2023 14:29
Copy link
Member

@MikaelMayer MikaelMayer left a comment

Choose a reason for hiding this comment

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

One last request.

@@ -10,6 +10,7 @@ namespace XUnitExtensions.Lit {
/// because 'diff' does not exist on Windows.
/// </summary>
public class DiffCommand : ILitCommand {
private static readonly bool UpdateExpectFile = false;
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 please document how to use this in the README of the tests? I'm interested but will soon forget where I had to change something.

Copy link
Member

@MikaelMayer MikaelMayer left a comment

Choose a reason for hiding this comment

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

Thanks for updating the elements in doc/dev/news !

@keyboardDrummer keyboardDrummer merged commit 10be88d into dafny-lang:master Sep 7, 2023
18 checks passed
@keyboardDrummer keyboardDrummer deleted the migratedResolutionDiagnostics branch September 7, 2023 16:01
keyboardDrummer added a commit to keyboardDrummer/dafny that referenced this pull request Sep 15, 2023
### Changes
- Let rewriters that operate within the module caching context, use the
correct `ErrorReporter`, so any diagnostics recorded by them are saved
in the cache.
- Use previous resolution diagnostics when processed parsed document and
no parsing diagnostics were found, to prevent diagnostic flickering and
reduce bandwidth used by diagnostics.

### Testing
- Added two units tests for the above two issues

<small>By submitting this pull request, I confirm that my contribution
is made under the terms of the [MIT
license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
keyboardDrummer added a commit that referenced this pull request Sep 15, 2023
### Changes
- Let rewriters that operate within the module caching context, use the
correct `ErrorReporter`, so any diagnostics recorded by them are saved
in the cache.
- Use previous resolution diagnostics when processed parsed document and
no parsing diagnostics were found, to prevent diagnostic flickering and
reduce bandwidth used by diagnostics.

### Testing
- Added two units tests for the above two issues

<small>By submitting this pull request, I confirm that my contribution
is made under the terms of the [MIT
license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
keyboardDrummer added a commit that referenced this pull request Sep 19, 2023
### Changes
- Let rewriters that operate within the module caching context, use the
correct `ErrorReporter`, so any diagnostics recorded by them are saved
in the cache.
- Use previous resolution diagnostics when processed parsed document and
no parsing diagnostics were found, to prevent diagnostic flickering and
reduce bandwidth used by diagnostics.

### Testing
- Added two units tests for the above two issues

<small>By submitting this pull request, I confirm that my contribution
is made under the terms of the [MIT
license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
keyboardDrummer added a commit that referenced this pull request Sep 19, 2023
- Let rewriters that operate within the module caching context, use the
correct `ErrorReporter`, so any diagnostics recorded by them are saved
in the cache.
- Use previous resolution diagnostics when processed parsed document and
no parsing diagnostics were found, to prevent diagnostic flickering and
reduce bandwidth used by diagnostics.

- Added two units tests for the above two issues

<small>By submitting this pull request, I confirm that my contribution
is made under the terms of the [MIT
license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants