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 closing a file, "Problems" should be removed #348

Closed
bersbersbers opened this issue Oct 13, 2020 · 6 comments · Fixed by #349
Closed

When closing a file, "Problems" should be removed #348

bersbersbers opened this issue Oct 13, 2020 · 6 comments · Fixed by #349

Comments

@bersbersbers
Copy link

I constantly see linting messages from files which I have already closed. Since there is no way to delete them, I feel it would be sensible to remove them when the file is closed.

See also REditorSupport/vscode-R#376 (comment), #292, microsoft/vscode-python#12630, microsoft/vscode#101885, microsoft/vscode#100646

@bersbersbers
Copy link
Author

(This get even worse when you delete a file. You will never get rid of this file's "Problems" until you reload VS Code.

@renkun-ken
Copy link
Member

Currently, the diagnostics is only removed when an external file (outside the workspace root) is closed.

The languageserver will load all R files in ./R if the workspace is a package. Does it make sense to you that if the workspace is not a package, then closing a file should remove its diagnostics while if the workspace is a package then closing a file does not remove its diagnostics?

@bersbersbers
Copy link
Author

bersbersbers commented Oct 14, 2020

Does it make sense to you that if the workspace is not a package, then closing a file should remove its diagnostics

Yes, for the reasons outlined above: it is how most other extensions operate, and once you delete a file, you are stuck with its "Problems" forever otherwise.

while if the workspace is a package then closing a file does not remove its diagnostics

I am not working on packages, so I can give useful comments only on the non-packages situation. Having said that: I can see how one should have a more holistic view of one's code in this situation: for example, because packages are often shared publicly or even published in repos which have stricter linting requirements than the average coder's collection of scripts. So I would consider this reasonable. But again, my exposure to this situation is pretty much null.

@renkun-ken
Copy link
Member

renkun-ken commented Oct 14, 2020

OK, then #349 should work for you. For non-package workspace, when you close a file, it will remove its diagnostics. When you delete the file, the text editor is not necessarily closed. When you close its editor, then its diagnostics will be removed too. Does this sound reasonable to you?

@bersbersbers
Copy link
Author

When you delete the file, the text editor is not necessarily closed.

Good point.

When you close its editor, then its diagnostics will be removed too. Does this sound reasonable to you?

Yes, it does.

@renkun-ken
Copy link
Member

You could install the latest development version and see if it works for you.

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 a pull request may close this issue.

2 participants