microsoft / vscode-typescript-tslint-plugin

VS Code extension that provides TSLint support using the typescript-tslint-plugin
https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-tslint-plugin
MIT License
189 stars 34 forks source link

Forces editor to open tslint.json file as "JSON with Comments" instead of "JSON" regardless of editor file association settings #68

Closed jolexxa closed 5 years ago

jolexxa commented 5 years ago

The linter plugin forces VSCode to open the tslint.json file with the language set to "JSON with Comments" regardless of the user's VSCode file associations settings.

Steps to Reproduce:

  1. Open a tslint.json file with vscode-typescript-tslint-plugin enabled.
  2. Notice that vscode-typescript-tslint-plugin has incorrectly sets the language to "JSON with Comments"

I can verify that it is the plugin causing the language change. Running code --disable-extensions produces the correct behavior where the file is opened only as "JSON." I manually disabled extensions one-by-one until I confirmed that vscode-typescript-tslint-plugin is causing the issue.

This would not be a problem except that vscode-typescript-tslint-plugin overrides my settings as mentioned in https://github.com/Microsoft/vscode-typescript-tslint-plugin/issues/45#issuecomment-468136545

"files.associations": {
  "tsconfig.json": "json"
}

I understand that comments are allowed in tslint.json files, but trailing commas cost me far more in productivity and I never utilize comments in those files. I would guess that many other developers feel the same way as evidenced by #45.

I would much rather be warned about a trailing comma and lose my ability to use comments until the tslint JSON parser becomes more forgiving.

mjbvz commented 5 years ago

Fixed by 4748ba7f26d265dbbbce8f623b47101e80d27172