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

When an open file is changed, also update diagnostics and other IDE state for dependent files #2328

Closed
keyboardDrummer opened this issue Jun 30, 2022 · 4 comments
Labels
kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny part: language server Support for LSP in Dafny (server part; client is in ide-vscode repo) status: needs-approval Issue that needs approval from Dafny team members before moving to designed

Comments

@keyboardDrummer
Copy link
Member

keyboardDrummer commented Jun 30, 2022

Background

Currently the Dafny IDE considers each opened file separately, even when one open file depends on another one. The IDE keeps separate state and runs a separate compilation for each opened file.

Related issue: dafny-lang/ide-vscode#82

Change

When any file is changed in the IDE, any open files that depend on the changed file will be included in the compilation, so resolution and verification are updated not just for the changed file but also of those files.

Not in scope

  • A Dafny project file
  • Change mechanisms to prevent one error from cascading into many, which might occur when the error occurs in something that has dependencies.

Prerequisites

Implementation suggestions

  • For an implicit Dafny project, record which files are accessed through module imports. If any file is opened that was accessed in an existing implicit Dafny project, add that file to it.
  • A change in any file in an implicit Dafny project causes the entire project to be recompiled.
@keyboardDrummer keyboardDrummer added kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny part: language server Support for LSP in Dafny (server part; client is in ide-vscode repo) status: designed Issues that have a complete story on how to implement this feature and why we want it labels Jun 30, 2022
@keyboardDrummer keyboardDrummer added status: needs-approval Issue that needs approval from Dafny team members before moving to designed and removed status: designed Issues that have a complete story on how to implement this feature and why we want it labels Jun 30, 2022
@keyboardDrummer keyboardDrummer added this to the Project aware IDE milestone Jun 30, 2022
@keyboardDrummer keyboardDrummer changed the title When a file is changed, update diagnostics for dependent files When an open file is changed, also update diagnostics for dependent files Jun 30, 2022
@cpitclaudel
Copy link
Member

When any file is changed in the IDE, any open files that depend on the changed file will be included in the compilation, so resolution and verification are updated not just for the changed file but also of those files.

I wonder if there's a way for us to do this but reduce the noise from resolution errors in other files. I worry that any change to a file that that breaks its own resolution will cause a flurry of resolution errors in other files (which, if we're not careful, will also invalidate their caches).

Maybe it's possible to delay the checking of other files if the current one doesn't resolve, at least by a bit.

@keyboardDrummer
Copy link
Member Author

keyboardDrummer commented Jul 5, 2022

When any file is changed in the IDE, any open files that depend on the changed file will be included in the compilation, so resolution and verification are updated not just for the changed file but also of those files.

I wonder if there's a way for us to do this but reduce the noise from resolution errors in other files. I worry that any change to a file that that breaks its own resolution will cause a flurry of resolution errors in other files (which, if we're not careful, will also invalidate their caches).

Maybe it's possible to delay the checking of other files if the current one doesn't resolve, at least by a bit.

It can be as simple as not resolving a module until all its dependencies resolve without errors, although I think that might be too strict. Maybe we can distinguish between internal and external module errors, and stop resolution of dependents if there are external module errors.

I've marking this out of scope for this issue, since if this is an issue, it occurs on the CLI right now already so I think it's fine to also have it in the IDE.

@cpitclaudel
Copy link
Member

It can be as simple as not resolving a module until all its dependencies resolve without errors, although I think that might be too strict.

Indeed, for example if we rename a constructor it's nice to all files that use it

I've marking this out of scope for this issue

👍

@keyboardDrummer keyboardDrummer changed the title When an open file is changed, also update diagnostics for dependent files When an open file is changed, also update diagnostics and other IDE state for dependent files May 8, 2023
@keyboardDrummer
Copy link
Member Author

Closing this issue because we won't do this. If no project file is used, editing a file will not update the diagnostics of files that depend on the edited file, even if they are also open in the IDE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny part: language server Support for LSP in Dafny (server part; client is in ide-vscode repo) status: needs-approval Issue that needs approval from Dafny team members before moving to designed
Projects
None yet
Development

No branches or pull requests

2 participants