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

Updates Webhint install failure notification #1622

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@
"type": "boolean",
"default": true,
"description": "Enable feedback from webhint on source files to improve accessibility, compatibility, security and more."
},
"vscode-edge-devtools.webhintInstallNotification": {
"type": "boolean",
"default": false,
"description": "Turn off notification for webhint installation failures."
}
}
},
Expand Down
20 changes: 13 additions & 7 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,14 +346,20 @@ function startWebhint(context: vscode.ExtensionContext): void {
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);
}
const disableNotication = vscode.workspace.getConfiguration(SETTINGS_STORE_NAME).get('webhintInstallNotification');
ElormCoch marked this conversation as resolved.
Show resolved Hide resolved
if (!disableNotication) {
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.';
ElormCoch marked this conversation as resolved.
Show resolved Hide resolved
void vscode.window.showInformationMessage(message, 'Remind me Later', 'Disable Extension', 'Don\'t show again').then(button => {
if (button === 'Disable Extension') {
void vscode.workspace.getConfiguration(SETTINGS_STORE_NAME).update('webhint', false, vscode.ConfigurationTarget.Global);
}
if (button === 'Don\'t show again') {
ElormCoch marked this conversation as resolved.
Show resolved Hide resolved
void vscode.workspace.getConfiguration(SETTINGS_STORE_NAME).update('webhintInstallNotification', true, 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, () => {
Expand Down