Show Error Message if TypeScript Settings Update Fails (#18130)

Fixes #18127

Show error messages if the workspace or user settings update fails
This commit is contained in:
Matt Bierner
2017-01-05 12:33:29 -08:00
committed by GitHub
parent 5cf85c73d5
commit 9eb91d2de4

View File

@@ -346,17 +346,20 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
switch (selected.id) {
case MessageAction.useLocal:
let pathValue = './node_modules/typescript/lib';
tsConfig.update('tsdk', pathValue, false);
window.showInformationMessage(localize('updatedtsdk', 'Updated workspace setting \'typescript.tsdk\' to {0}', pathValue));
tsConfig.update('tsdk', pathValue, false).then(
() => window.showInformationMessage(localize('updatedtsdk', 'Updated workspace setting \'typescript.tsdk\' to {0}', pathValue)),
() => window.showErrorMessage(localize('updateTsdkFailed', 'Could not update the \'typescript.tsdk\' workspace setting. Please check that the workspace settings file is valid')));
showVersionStatusItem = true;
return localModulePath;
case MessageAction.useBundled:
tsConfig.update(checkWorkspaceVersionKey, false, false);
window.showInformationMessage(localize('updateLocalWorkspaceCheck', 'Updated workspace setting \'typescript.check.workspaceVersion\' to false'));
tsConfig.update(checkWorkspaceVersionKey, false, false).then(
() => window.showInformationMessage(localize('updateLocalWorkspaceCheck', 'Updated workspace setting \'typescript.check.workspaceVersion\' to false')),
() => window.showErrorMessage(localize('updateLocalWorkspaceCheckFailed', 'Could not update the \'typescript.check.workspaceVersion\' workspace setting. Please check that the workspace settings file is valid')));
return modulePath;
case MessageAction.neverCheckLocalVersion:
window.showInformationMessage(localize('updateGlobalWorkspaceCheck', 'Updated user setting \'typescript.check.workspaceVersion\' to false'));
tsConfig.update(checkWorkspaceVersionKey, false, true);
tsConfig.update(checkWorkspaceVersionKey, false, true).then(
() => window.showInformationMessage(localize('updateGlobalWorkspaceCheck', 'Updated user setting \'typescript.check.workspaceVersion\' to false')),
() => window.showErrorMessage(localize('updateGlobalWorkspaceCheckFailed', 'Could not update \'typescript.check.workspaceVersion\' user setting. Please check that your user settings file is valid')));
return modulePath;
default:
return modulePath;