csstree / vscode-plugin

CSSTree validation plugin for VS Code
MIT License
17 stars 4 forks source link

Support for onDidClose event #1

Closed mrmlnc closed 8 years ago

mrmlnc commented 8 years ago

In VS Code version 1.3.0 was added onDidClose event (see https://code.visualstudio.com/updates/June_2016). Please, provide support for this feature.

With the introduction of the new Problems panel, we started to work on support for project wide builders and linters. As a first step, we eliminated the automatic clearing of problems when an document is closed. Otherwise opening and closing a document would change the problem set generated by a project wide builder. Due to this change, extensions like linters generating diagnostics are responsible for clearing them when a document is closed. All extension providers generating diagnostics need to adopt to this change.

In a linter that uses the vscode-language-server node module, this can be achieved as follows:

documents.onDidClose((event) => {
  connection.sendDiagnostics({ uri: event.document.uri, diagnostics: [] });
});