in jshint-server/src/server.ts [362:408]
constructor() {
this.connection = createConnection(new IPCMessageReader(process), new IPCMessageWriter(process));
this.options = new OptionsResolver(this.connection);
this.fileMatcher = new FileMatcher();
this.documents = new TextDocuments();
this.documents.onDidChangeContent(event => this.validateSingle(event.document));
this.documents.onDidClose((event) => {
this.connection.sendDiagnostics({ uri: event.document.uri, diagnostics: [] });
});
this.documents.listen(this.connection);
this.connection.onInitialize(params => this.onInitialize(params));
this.connection.onDidChangeConfiguration(params => {
this.settings = _.assign<Object, JSHintSettings>({ options: {}, exclude: {} }, (<Settings>params.settings).jshint);
const { config, options, excludePath, exclude } = this.settings;
this.options.configure(config, options);
this.fileMatcher.configure(excludePath, exclude);
this.validateAll();
});
this.connection.onDidChangeWatchedFiles(params => {
var needsValidating = false;
if (params.changes) {
params.changes.forEach(change => {
switch (this.lastSegment(change.uri)) {
case JSHINTRC:
this.options.clear();
needsValidating = true;
break;
case JSHINTIGNORE:
this.fileMatcher.clear();
needsValidating = true;
break;
case 'package.json':
this.options.clear();
needsValidating = true;
break;
}
});
}
if (needsValidating) {
this.validateAll();
}
});
this.connection.onRequest('jshint/resetLibrary', () => {
this.lib = undefined;
});
}