in src/extension.ts [246:295]
function startWebhint(context: vscode.ExtensionContext): void {
const args = [context.globalStoragePath, 'Microsoft Edge Tools'];
const module = context.asAbsolutePath('node_modules/vscode-webhint/dist/src/server.js');
const transport = TransportKind.ipc;
const serverOptions: ServerOptions = {
debug: {
args,
module,
options: { execArgv: ['--nolazy', '--inspect=6009'] },
transport,
},
run: {
args,
module,
transport,
},
};
const clientOptions: LanguageClientOptions = {
documentSelector: supportedDocuments,
synchronize: {
// Notify the server if a webhint-related configuration changes.
fileEvents: vscode.workspace.createFileSystemWatcher('**/.hintrc'),
},
};
// Create and start the client (also starts the server).
client = new LanguageClient('Microsoft Edge Tools', serverOptions, clientOptions);
void client.onReady().then(() => {
// Listen for notification that the webhint install failed.
const installFailedNotification: typeof installFailed = 'vscode-webhint/install-failed';
client.onNotification(installFailedNotification, () => {
const message = 'Ensure `node` and `npm` are installed to enable automatically reporting issues in source files pertaining to accessibility, compatibility, security, and more.';
void vscode.window.showInformationMessage(message, 'OK', 'Disable').then(button => {
if (button === 'Disable') {
void vscode.workspace.getConfiguration(SETTINGS_STORE_NAME).update('webhint', false, vscode.ConfigurationTarget.Global);
}
});
});
// Listen for requests to show the output panel for this extension.
const showOutputNotification: typeof showOutput = 'vscode-webhint/show-output';
client.onNotification(showOutputNotification, () => {
client.outputChannel.clear();
client.outputChannel.show(true);
});
});
client.start();
}