Skip to content

Commit

Permalink
Show Error Message if TypeScript Settings Update Fails (microsoft#18130)
Browse files Browse the repository at this point in the history
Fixes microsoft#18127

Show error messages if the workspace or user settings update fails
  • Loading branch information
mjbvz authored Jan 5, 2017
1 parent 5cf85c7 commit 9eb91d2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions extensions/typescript/src/typescriptServiceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9eb91d2

Please sign in to comment.