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

Fix: Ghost diagnostics correctly updated when becoming empty #4748

Merged
merged 2 commits into from
Nov 8, 2023

Conversation

MikaelMayer
Copy link
Member

Fixes #4693
I added a test that was previously failing.

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

@@ -259,6 +259,17 @@ public class NotificationPublisher : INotificationPublisher {
}).ToArray(),
});
}

// If we don't have ghost state anymore, publish empty ghost diagnostics
Copy link
Member

Choose a reason for hiding this comment

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

Could you merge the two loops?

var uris == previousParams.Keys.Concat(params.Keys);
      foreach (var uri in uris) {
var previous = previousParams.GetValueOrDefault(uri) ?? Enumerable<Range>.Empty();
var current = currentParams.GetValueOrDefault(uri) ?? Enumerable<Range>.Empty();
          if (previous.SequenceEqual(current)) {
            continue;
          }
        languageServer.TextDocument.SendNotification(new GhostDiagnosticsParams {
          Uri = uri,
          Version = state.Version,
          Diagnostics = current.Select(r => new Diagnostic {
            Range = r
          }).ToArray(),
        });
      }

@keyboardDrummer keyboardDrummer merged commit 374e6f2 into master Nov 8, 2023
20 checks passed
@keyboardDrummer keyboardDrummer deleted the fix-4693-ghost-diagnostics-update branch November 8, 2023 18:53
@keyboardDrummer
Copy link
Member

Nice! Thanks

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.

Ghost diagnostics not correctly updated
2 participants