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

Add a clearer panic message if settings.json is malformed #1939

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cristian-paris
Copy link

This commit aims to provide a clearer error message when attempting to install the available tools using the sc-meta install all command, in the rare case when a user has a malformed VSCode settings.json file.

For example, let's consider these two settings.json file examples:

  1. Correct
{
  "workbench.iconTheme": "vscode-icons",
  "[typescript]": {
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "vscode.typescript-language-features"
  }
}
  1. Wrong
{
  "workbench.iconTheme": "vscode-icons",
  "[typescript]": {
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "vscode.typescript-language-features",
  }
}

In the second case we have a trailling comma, after the end of the editor.defaultFormatter row. While this additional comma won't be a problem for VSCode to parse the settings file, this is inherently a malformed json, if we verify it with any online linter. This, in turn, will cause problems for serde. The fix is to just instruct the user to perform a lint check of its settings file, and then proceed with the installation.

@cristian-paris cristian-paris marked this pull request as draft January 25, 2025 12:18
@cristian-paris cristian-paris marked this pull request as ready for review January 25, 2025 17:00
BiancaIalangi
BiancaIalangi previously approved these changes Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants