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

Move compilation status updates to notification publisher #4454

Conversation

keyboardDrummer
Copy link
Member

@keyboardDrummer keyboardDrummer commented Aug 23, 2023

Fixes #4451

Changes

  • symbolStatus notifications are resent after any document change is made.
  • "Parsing" is no longer sent when opening a file because it's the default state for a file. This requires an update on the client to return to the old behavior, but in the meantime it's OK for the client to have this tiny regression.
  • "Preparing Verification" no longer exists as a notification. Because one verifiable can be preparing verification while another is verifying, there is no longer a global "Preparing verification" state so this notification lost its meaning. We can bring something like this back but on a more granular level.
  • "Resolution Succeeded (not verified)" (UI name) / CompilationSucceeded (server name) no longer exists as a notification. This sat between ResolutionStarted and symbolStatus notifications that indicated which symbols could be verified, but in practice was never shown because immediately after it symbolStatus notifications would be sent that trigger a status like "Verified X declarations, skipped Y"
  • CompilationManager no longer sends any status updates to the IDE client, bringing it closer to being able to be moved to DafnyCore and used by the CLI.

Testing

  • Did a little manual testing with the VSCode IDE and this change
  • Updated automating tests

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.

Two non blocking comments. and I agree with the simplification. Well done.

@@ -21,7 +21,7 @@ public class CompilationStatusNotificationTest : ClientBasedLanguageServerTest {
[Fact]
public async Task MultipleDocuments() {
var source = @"
method Foo() returns (x: int) ensures x / 2 == 1; {
method Foo() returns (x: int) {
Copy link
Member

Choose a reason for hiding this comment

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

Why did you remove the ensures clause?

Copy link
Member Author

Choose a reason for hiding this comment

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

Part of debugging, but it's not needed

var program = parser.Parse(compilation, errorReporter, cancellationToken);
var compilationAfterParsing = new CompilationAfterParsing(compilation, program, errorReporter.AllDiagnosticsCopy,
compilation.RootUris.ToDictionary(uri => uri,
uri => migratedVerificationTrees.GetValueOrDefault(uri) ?? new DocumentVerificationTree(program, uri)));
if (errorReporter.HasErrors) {
_ = statusPublisher.SendStatusNotification(compilation, CompilationStatus.ParsingFailed);
Copy link
Member

Choose a reason for hiding this comment

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

Did you ensure that parsing failures are still sent? Normally there should be a test for that but I have not checked.

Copy link
Member Author

Choose a reason for hiding this comment

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

There are tests for it yes

@keyboardDrummer keyboardDrummer merged commit fb8b5f2 into dafny-lang:master Aug 23, 2023
17 of 18 checks passed
@keyboardDrummer keyboardDrummer deleted the moveCompilationStatusUpdatesToNotificationPublisher branch August 23, 2023 15:25
keyboardDrummer added a commit to keyboardDrummer/dafny that referenced this pull request Sep 15, 2023
…#4454)

Fixes dafny-lang#4451

### Changes
- symbolStatus notifications are resent after any document change is
made.
- "Parsing" is no longer sent when opening a file because it's the
default state for a file. This requires an update on the client to
return to the old behavior, but in the meantime it's OK for the client
to have this tiny regression.
- "Preparing Verification" no longer exists as a notification. Because
one verifiable can be preparing verification while another is verifying,
there is no longer a global "Preparing verification" state so this
notification lost its meaning. We can bring something like this back but
on a more granular level.
- "Resolution Succeeded (not verified)" (UI name) / CompilationSucceeded
(server name) no longer exists as a notification. This sat between
ResolutionStarted and symbolStatus notifications that indicated which
symbols could be verified, but in practice was never shown because
immediately after it symbolStatus notifications would be sent that
trigger a status like "Verified X declarations, skipped Y"
- `CompilationManager` no longer sends any status updates to the IDE
client, bringing it closer to being able to be moved to `DafnyCore` and
used by the CLI.

### Testing
- Updated automating tests

<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
Fixes #4451

### Changes
- symbolStatus notifications are resent after any document change is
made.
- "Parsing" is no longer sent when opening a file because it's the
default state for a file. This requires an update on the client to
return to the old behavior, but in the meantime it's OK for the client
to have this tiny regression.
- "Preparing Verification" no longer exists as a notification. Because
one verifiable can be preparing verification while another is verifying,
there is no longer a global "Preparing verification" state so this
notification lost its meaning. We can bring something like this back but
on a more granular level.
- "Resolution Succeeded (not verified)" (UI name) / CompilationSucceeded
(server name) no longer exists as a notification. This sat between
ResolutionStarted and symbolStatus notifications that indicated which
symbols could be verified, but in practice was never shown because
immediately after it symbolStatus notifications would be sent that
trigger a status like "Verified X declarations, skipped Y"
- `CompilationManager` no longer sends any status updates to the IDE
client, bringing it closer to being able to be moved to `DafnyCore` and
used by the CLI.

### Testing
- Updated automating tests

<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.

Verification succeeded sent only once
2 participants