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: Declarations with {:only} ensure that other declarations aren't displayed as verified in the gutter icons #4433

Merged
merged 14 commits into from
Sep 19, 2023

Conversation

MikaelMayer
Copy link
Member

This PR fixes #4432
I added the corresponding test.

Because the Skipped gutter icon is not supported yet in VSCode, it's just rendered as no icon, which is suitable for now at least to indicate that a method is not verified.

Before, without this PR With this PR
image image
-------------------------- --------------
image image
-------------------------- --------------

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

Copy link
Member

@keyboardDrummer keyboardDrummer left a comment

Choose a reason for hiding this comment

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

I'm doubtful that it's a good idea to keep the current gutter icon notification API. If possible, and it seems so, I think we should compute gutter icons on the client, since computing on the client prevents equivalent pieces of information that are out-of-sync from reaching the client, and reduces bandwidth usage.

The API change in this PR makes it so that the client no longer has enough information to recompute the same icons without the gutter notifications.

If we want to compute the icons on the client, we should use a different API to tell the client which locations have been skipped from verification. One that comes to my mind is the diagnostics one, since it has a range field. You could emit a warning with a specific code, and the client could either:

  • display this as a regular warning
  • recognize the specific error code, remove the diagnostic from its list and instead display it as different icons in the gutter.

Also, are there other APIs that need to take {:only} into account? What about dafny/textDocument/symbolStatus ? What does the status bar display if you verify a method that's excluded from verification because of {:only} on another method?

@MikaelMayer
Copy link
Member Author

MikaelMayer commented Aug 17, 2023

I'm doubtful that it's a good idea to keep the current gutter icon notification API. If possible, and it seems so, I think we should compute gutter icons on the client, since computing on the client prevents equivalent pieces of information that are out-of-sync from reaching the client, and reduces bandwidth usage.

Thanks for sharing your concern.
That's ok and that's another discussion to have, this PR is about fixing current things with the current API, which is faster than designing, reviewing and implementing a new way to compute gutter icons, even if it's better. So please separate the concern of the need of reducing bandwidth and the confusion the gutter icons currently provide in the case of {:only}

The API change in this PR makes it so that the client no longer has enough information to recompute the same icons without the gutter notifications.

Fixing that is a no-brainer. Just add the same information in the tree that you have.

If we want to compute the icons on the client, we should use a different API to tell the client which locations have been skipped from verification. One that comes to my mind is the diagnostics one, since it has a range field. You could emit a warning with a specific code, and the client could either:

  • display this as a regular warning
  • recognize the specific error code, remove the diagnostic from its list and instead display it as different icons in the gutter.

Also, are there other APIs that need to take {:only} into account? What about dafny/textDocument/symbolStatus ? What does the status bar display if you verify a method that's excluded from verification because of {:only} on another method?

Symbol status says "verified". You could also file an issue for that and I'd be happy to look at it if time permits..

@keyboardDrummer
Copy link
Member

That's ok and that's another discussion to have, this PR is about fixing current things with the current API, which is faster than designing, reviewing and implementing a new way to compute gutter icons, even if it's better.

That's true.

But this PR is also a feature enhancement that makes it harder to replace this feature with a more performant one.

Fixing that is a no-brainer. Just add the same information in the tree that you have.

I don't think it's a no-brainer to make API changes. I'm inclined to use warning diagnostics for it since they don't require API changes.

@MikaelMayer
Copy link
Member Author

MikaelMayer commented Aug 18, 2023

That's ok and that's another discussion to have, this PR is about fixing current things with the current API, which is faster than designing, reviewing and implementing a new way to compute gutter icons, even if it's better.

That's true.

But this PR is also a feature enhancement that makes it harder to replace this feature with a more performant one.

Removing the green gutter icon on non-verified functions was part of the design of the {:only} feature, it's just I postponed it to a separate PR until recently.

What you suggest does make sense, adding a warning range on non-verified code can makes things easier to spot and to compute on the client side.

Fixing that is a no-brainer. Just add the same information in the tree that you have.

I don't think it's a no-brainer to make API changes. I'm inclined to use warning diagnostics for it since they don't require API changes.

What you call an API change was an actual expected backward-compatible and forward-compatible API change. Gutter icons had "holes" in their numbering, allowing to create other icons as needed.

Copy link
Member

@keyboardDrummer keyboardDrummer left a comment

Choose a reason for hiding this comment

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

Can you add a test that verifies the symbolStatus API returns Stale as a status for methods/functions that are skipped because of {:only} ? I would like to keep the symbolStatus API and the gutter icon API in sync (I'm always done with a PR that switches away from using the gutter icons, so we'll need the updated symbolStatus API)

@MikaelMayer
Copy link
Member Author

Since @keyboardDrummer requests more nontrivial work to ensure the verification symbols are also not displayed as verified, but I can't do that right now, I'll go back to this PR on October 10th or before.

@MikaelMayer MikaelMayer enabled auto-merge (squash) September 13, 2023 14:22
@MikaelMayer
Copy link
Member Author

I created another issue for your issue @keyboardDrummer
#4544
so that we can merge this fix while I find the time to work on the other one.

@MikaelMayer MikaelMayer merged commit 2165acf into master Sep 19, 2023
@MikaelMayer MikaelMayer deleted the fix-4432-gutter-icons-only branch September 19, 2023 18:21
TaBo2410 added a commit that referenced this pull request Sep 20, 2023
…iment-trsplitexpr

* commit '86840e6b14386c1e88480854dd8ce64ad17cb2ff':
  Map eq range (#4567)
  Fix: Declarations with {:only} ensure that other declarations aren't displayed as verified in the gutter icons (#4433)
  Fix caching of export declarations (#4556)
  Do not return exceptions when doing hover in a program with parse errors (#4557)
  Proof dependency warnings (#4542)
  [Test Generation] Reduce memory footprint by reusing the same Boogie program for multiple test generation queries (#4530)
  Fix a variety of bugs in Rust backend based on ESDK testing (#4538)
  Checker for .Values and .Items on maps (#4551)
  feat: Allow more assumptions in library backend (#4545)
  feat: Attributes on reads clauses (#4554)
  Fix gutter icons fields (#4549)
  Report errors that occur in the project file, in the IDE as well (#4539)
  Switch to ubuntu-20.04 for the refman build (#4555)
keyboardDrummer pushed a commit that referenced this pull request Sep 26, 2023
…displayed as verified in the gutter icons (#4433)

This PR fixes #4432
I added the corresponding test.

Because the Skipped gutter icon is not supported yet in VSCode, it's
just rendered as no icon, which is suitable for now at least to indicate
that a method is not verified.

| Before, without this PR | With this PR |
|--------------------------|---------------|
|
![image](https://github.com/dafny-lang/dafny/assets/3601079/9b8e98c2-00a7-4e44-b31a-ba8c5c668a2c)
|
![image](https://github.com/dafny-lang/dafny/assets/3601079/5e44226e-5897-4f1e-8223-c7d37b64ab68)
|
|--------------------------|--------------|
|
![image](https://github.com/dafny-lang/dafny/assets/3601079/bbbb2658-ac9d-441d-9edb-fcc3c489f44c)
|
![image](https://github.com/dafny-lang/dafny/assets/3601079/a6abf19b-d2c8-41d7-939c-fb846d7d4681)
|
|--------------------------|--------------|

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

Using {:only} to focus verification
2 participants