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

Provide feedback on malformed JSON of argv.json #151659

Merged
merged 6 commits into from Jun 14, 2022

Conversation

TylerLeonhardt
Copy link
Member

@TylerLeonhardt TylerLeonhardt commented Jun 9, 2022

This PR fixes #151200

image

@TylerLeonhardt TylerLeonhardt self-assigned this Jun 9, 2022
@VSCodeTriageBot VSCodeTriageBot added this to the June 2022 milestone Jun 9, 2022
joyceerhl
joyceerhl previously approved these changes Jun 9, 2022
private async writeLocaleValue(locale: string | undefined): Promise<boolean> {
try {

const content = await this.textFileService.read(this.environmentService.argvResource, { encoding: 'utf8' });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more 💄 , but reading this method writeLocalValue I might be confused at first as to why we read the file. How about moving this new block of code into a private method validateLocaleFile (or similar) so that the logic becomes clearer as to why we read the file before writing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed this.

} catch (error) {
this.notificationService.notify({
severity: Severity.Error,
message: localize('argvInvalid', 'Your argv.json file is not valid. Please open it and fix any parse errors so that your display language can be set properly.'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can make this more user friendly: the fact that we store the locale in a file argv.json is not so important imho. In the end I would just indicate that the settings file where we store the locale is malformed and needs manual fixing.

I think settings editor has a similar error notification, maybe we can borrow the wording.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

riffed off

return nls.localize('errorInvalidConfiguration', "Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again.");

ubaisa
ubaisa previously approved these changes Jun 13, 2022
@TylerLeonhardt TylerLeonhardt force-pushed the tyler/more-feedback-on-malformed-argv branch from 4ef61e8 to 8d4d2a7 Compare June 13, 2022 17:20
@bpasero bpasero enabled auto-merge (squash) June 14, 2022 04:25
@bpasero bpasero merged commit 4dc7468 into main Jun 14, 2022
@bpasero bpasero deleted the tyler/more-feedback-on-malformed-argv branch June 14, 2022 04:34
@github-actions github-actions bot locked and limited conversation to collaborators Jul 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show an error when changing display language results in broken argv.json
5 participants