'VSCode - Rubocop - Settings.json - End of file expected

I am using VisualStudioCode with Ruby and Rubocop. After installation of Rubocop i found out i must change some of the settings in settings.json for Rubocop. How do i fix this error => End of file expected (5,1).

{
"workbench.colorTheme": "Visual Studio Dark"
}

{
"ruby.rubocop.executePath": "C:\\Games\\Ruby24-x64\\bin\\",
"ruby.rubocop.onSave": true
}

VSCode says: End of file expected (5,1). But to me it seems everything OK.



Solution 1:[1]

I don't know VSCode, but your settings file is not valid JSON because it has multiple root elements. Try combining them, i.e.:

{
"workbench.colorTheme": "Visual Studio Dark",
"ruby.rubocop.executePath": "C:\\Games\\Ruby24-x64\\bin\\",
"ruby.rubocop.onSave": true
}

You can validate the syntax using https://jsonformatter.curiousconcept.com/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Andy Waite