vscode: prefer beautifier config not working

I can’t seem to get PHP-CS-Fixer or CSScomb to work with unibeautify in vscode windows 10. When I try to format a php or css file nothing happens.

My config file is:

{
	"PHP": {
		"beautifiers": [
			"PHP-CS-Fixer"
		],
		"PHP-CS-Fixer": {
			"prefer_beautifier_config": true
		}
	},
	"CSS": {
		"beautifiers": [
			"CSScomb"
		],
		"CSScomb": {
			"prefer_beautifier_config": true
		},
		"indent_style": "tab",
		"indent_size": "1",
		"end_with_newline": true
	},
	"JavaScript": {
		"beautifiers": [
			"JS-Beautify",
			"ESLint"
		],
		"indent_style": "tab",
		"indent_size": "1",
		"end_with_newline": true,
		"max_preserve_newlines": "2",
		"preserve_newlines": true,
		"jslint_happy": true,
		"quotes": "single",
		"multiline_ternary": "never",
		"brace_style": "collapse-preserve-inline",
		"object_curly_spacing": false
	}
}

I did try with the formatters available in PATH. Also tried to provide the absolute path in the path property.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (12 by maintainers)

Most upvoted comments

Placing the file .php_cs in project1 folder worked.

I tried adding the config parameter to the executable but it fails to start. "path": "C:\\Users\\Chip\\AppData\\Roaming\\Composer\\vendor\\bin\\php-cs-fixer.bat fix --config=\"D:\\web\\.php_cs\""

Is there any config option for a global file outside the project folder?