Commit 83ef690
authored
fix: JSON parsing with trailing commas enabled (#37)
* fix: JSON parsing with trailing commas enabled in `readJsonFile`.
Fixes #36.
During parsing of JSON files, the parser will throw an `ValueExpected` error when it reaches a comma and unexpectedly encounters a closing bracket straight after. Trailing commas are disabled in the parser by default as it's not standard in JSON or JSONC. So it expects some kind of value after all commas. Luckily, we can enable trailing commas...
- Fixed `ValueExpected` JSON parse error for trailing commas by enabling the `allowTrailingComma` parse option in `readJsonFile` util function. This is especially useful when parsing language config files, when the contributing extension has auto-formatting enabled for trailing commas.
* refactor: JSON parse error message formatting.
- Refactored the JSON parse error messages in `constructJsonParseErrorMsg` util function to include the original error name, as well as the formatted name, just to ensure the errors have a proper error code for debugging.1 parent 569d03b commit 83ef690
1 file changed
Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
82 | 85 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
0 commit comments