in jshint-server/src/server.ts [560:587]
private async validate(document: TextDocument): Promise<void> {
if (!this.settings.lintHTML && document.languageId === "html") {
// If the setting is toggled, errors need to be cleared
this.connection.sendDiagnostics({ uri: document.uri, diagnostics: [] });
return;
}
let fsPath = Files.uriToFilePath(document.uri);
if (!fsPath) {
fsPath = this.workspaceRoot;
}
let diagnostics: Diagnostic[] = [];
if (!this.fileMatcher.excludes(fsPath, this.workspaceRoot)) {
const content = document.languageId === "html" ? this.getEmbeddedJavascript(document.getText()) : document.getText();
let errors = await this.lintContent(content, fsPath);
if (errors) {
errors.forEach((error) => {
// For some reason the errors array contains null.
if (error) {
diagnostics.push(this.makeDiagnostic(error));
}
});
}
}
this.connection.sendDiagnostics({ uri: document.uri, diagnostics });
}