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

Drop diagnostics on closing the file #1395

Merged

Conversation

chioni16
Copy link
Contributor

When closing a file in VS code, all the warnings and errors remain in the list of problems. This removes all diagnostics pertaining to the close file.

@chioni16 chioni16 force-pushed the drop-diagnostics-on-close branch 2 times, most recently from a581181 to b41065c Compare June 26, 2023 08:59
@@ -1179,6 +1179,8 @@ impl LanguageServer for SolangServer {
if let Ok(path) = uri.to_file_path() {
self.files.lock().await.remove(&path);
}

self.client.publish_diagnostics(uri, vec![], None).await;
Copy link
Contributor

Choose a reason for hiding this comment

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

Wonderful!

Again, this could do with a test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried writing a test using the vscode typescript API to open and close files.
I am using vscode.commands.executeCommand('workbench.action.closeActiveEditor') to close the open tab. But this doesn't seem to emit the didClose event which is what the language server listens for.
I tried registering a listener for this event in javascript as well. But, this listener did not run either.
But manually closing the files works every time and the old diagnostics disappear when this happens.

@LucasSte
Copy link
Contributor

Please, run cargo fmt --all to format your file.

Signed-off-by: Govardhan G D <[email protected]>
@seanyoung seanyoung merged commit f9230fc into hyperledger-solang:main Jul 3, 2023
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.

4 participants