Skip to content

Trailing comma in default settings.json when using split JSON editor causes warning that can't be removed. #80419

Closed
microsoft/azuredatastudio
#7356

Description

@TheWyo
  • VSCode Version: 1.38.0
  • OS Version: Windows 10 1803

Steps to Reproduce:

  1. Change your user settings to have workbench.settings.editor = "json" & workbench.settings.useSplitJSON = true
  2. Re-launch VSCode with extensions disabled
  3. Open settings editor
  4. Problems pane will show a trailing comma warning.
  5. (optional) click on the warning to open the file ("/0/settings.json")
  6. Close the editor (and file if done step 5), warning remains in problems pane.

Does this issue occur when all extensions are disabled?: Yes

Only noticed this appear as of 1.38.0.
Copied problem data:

{
	"resource": "/0/settings.json",
	"owner": "_generated_diagnostic_collection_name_#0",
	"code": "519",
	"severity": 4,
	"message": "Trailing comma",
	"source": "jsonc",
	"startLineNumber": 2436,
	"startColumn": 1,
	"endLineNumber": 2436,
	"endColumn": 2
}

On an additional note, it says the source is jsonc language, but I thought jsonc allowed trailing commas?

Activity

  1. ladyrick commented on Sep 6, 2019

    @ladyrick

    I have the same problem.

  2. danplisetsky commented on Sep 7, 2019

    @danplisetsky

    Same here on Mac. I also have prettier as the default formatter:

    "[jsonc]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
      },
    

    Turning it off doesn't help though.

  3. MicahZoltu commented on Sep 8, 2019

    @MicahZoltu

    My tsconfig.json files recently started showing errors when there is a trailing comma in them. TSC allows trailing commas and I would rather not remove them as it makes editing easier. What changed that is causing jsonc checker to start erroring on trailing comma? How can I go back to the old behavior?

  4. wlchn commented on Sep 11, 2019

    @wlchn

    Same issue here. Happened after I updated to 1.38, and edited user setting.

    I'm also using split json config:

      "workbench.settings.editor": "json",
      "workbench.settings.useSplitJSON": true,
    

    and using prettier as the default formatter

  5. robjac commented on Sep 11, 2019

    @robjac

    this is happening to me -- every time i open or close the settings.json split viewer, a new problem is created.

  6. inliquid commented on Sep 15, 2019

    @inliquid

    Same here.

  7. sandy081 commented on Sep 20, 2019

    @sandy081
    Member

    Martin Aeschlimann (@aeschli) Is this new with jsonc that showing a warning with trailing comma?

    ["a",]
    
  8. added
    bug
    config
    on Sep 20, 2019
  9. aeschli commented on Sep 20, 2019

    @aeschli
    Contributor

    There are several file formats out there that allow comments in JSON but not trailing commas.
    (e.g. tslint.json, eslint.json)
    So I made a change so that by default jsonc no longer accepts trailing commas.
    Trailing commas are only ignored for jsonc files if they have a schema associated that specifies that trailing commas are allowed.

    That's done with a property in the schema root: allowTrailingCommas: true

    (note that I just changed from allowsTrailingCommas to allowTrailingCommas, please only use allowTrailingCommas)

    I added that to the schemas of our settings files. Note that the schemas of our settings files are dynamically generated, so it's all in code

    It looks like the error is coming from the default settings 'editor', which has no schema associated.
    Sandeep Somavarapu (@sandy081) Can you associate a schema there, or just generate code without trailing comma?

    I'll make a fix for tsconfig.json

  10. sandy081 commented on Sep 24, 2019

    @sandy081
    Member

    Thanks Martin Aeschlimann (@aeschli), I can see if I can avoid trailing comma.

  11. added
    verified
    on Oct 3, 2019
  12. SHxKM commented on Oct 4, 2019

    @SHxKM

    So this is closed as in fixed? I just got referred here after opening #81920. Is the fix in the nightly build?

  13. aeschli commented on Oct 4, 2019

    @aeschli
    Contributor

    Yes, in the insiders ('nightly') build.

  14. locked and limited conversation to collaborators on Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugconfigverified

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions