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

Diagnostics linger even after the Dockerfile has been deleted #214

Closed
rcjsuen opened this issue Mar 16, 2018 · 1 comment
Closed

Diagnostics linger even after the Dockerfile has been deleted #214

rcjsuen opened this issue Mar 16, 2018 · 1 comment
Assignees
Labels

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented Mar 16, 2018

If a Dockerfile gets deleted, the language server does not push an empty [] of Diagnostics back to the client. This means that the client will continue to display warnings and errors to the user for a file that no longer exists.

There are two ways to solve this.

  1. When a Dockerfile is closed in the client's editor, its diagnostics would just get wiped. When a file gets deleted, clients presumably also close the file so that would cause its diagnostics to get cleared. This would match the behaviour of other existing language servers that are maintained by Microsoft. According to the specification...

Diagnostics are “owned” by the server so it is the server’s responsibility to clear them if necessary. The following rule is used for VS Code servers that generate diagnostics:

  • if a language is single file only (for example HTML) then diagnostics are cleared by the server when the file is closed.
  • if a language has a project system (for example C#) diagnostics are not cleared when a file closes. When a project is opened all diagnostics for all files are recomputed (or read from a cache).
  1. Ask the client to notify the language server when Dockerfiles are deleted by registering for the workspace/didChangeWatchedFiles notification. We have to use a glob pattern here though. Theoretically, if you opened a file named test.txt in a client's Dockerfile editor then validation errors and warnings would get created for it as the editor would talk to the language server. However, when it gets deleted the server wouldn't be notified of this as test.txt would not match any sane glob pattern that we think up of for Dockerfiles.
@rcjsuen
Copy link
Owner Author

rcjsuen commented Mar 17, 2018

I think option 2 is not possible because of microsoft/vscode-languageserver-node#320.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant