Here is my User/settings.json:
{
"workbench.colorTheme": "Dracula",
"workbench.iconTheme": "material-icon-theme",
"editor.fontFamily": "D2Coding",
"editor.detectIndentation": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"prettier.tabWidth": 4
"remote.SSH.remotePlatform": {
"xxx.xxx.xxx.xxx": "linux"
},
"tabnine.experimentalAutoImports": true,
"prettier.printWidth": 250
}
The default formatter is set to use prettier and I do have ruby gem, nvm package and vscode extension for prettier installed properly.
I have tested with a local configuration (.prettierrc) which only has tabWidth:
{
"tabWidth": 4
}
and it is working fine for the JavaScript as you can see the below.
Before formatting JavaScript:
After formatting JavaScript:
Before formatting Ruby:
After formatting Ruby:
The following is the output of Prettier which has nothing special.
["INFO" - 9:37:22 PM] Formatting file:///home/user/test_project/main.js
["INFO" - 9:37:22 PM] Using config file at '/home/user/test_project/.prettierrc'
["INFO" - 9:37:22 PM] Using ignore file (if present) at /home/user/test_project/.prettierignore
["INFO" - 9:37:22 PM] File Info:
{
"ignored": false,
"inferredParser": "babel"
}
["INFO" - 9:37:22 PM] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
["INFO" - 9:37:22 PM] Prettier Options:
{
"filepath": "/home/user/test_project/main.js",
"parser": "babel",
"tabWidth": 4
}
["INFO" - 9:37:22 PM] Formatting completed in 0.012ms.
["INFO" - 9:39:02 PM] Formatting file:///home/user/test_project/main.rb
["INFO" - 9:39:02 PM] Using config file at '/home/user/test_project/.prettierrc'
["INFO" - 9:39:02 PM] Using ignore file (if present) at /home/user/test_project/.prettierignore
["INFO" - 9:39:02 PM] File Info:
{
"ignored": false,
"inferredParser": "ruby"
}
["INFO" - 9:39:02 PM] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
["INFO" - 9:39:02 PM] Prettier Options:
{
"filepath": "/home/user/test_project/main.rb",
"parser": "ruby",
"tabWidth": 4
}
["INFO" - 9:39:03 PM] Formatting completed in 0.036ms.
Am I missing something at some point?
I literally tried every solutions suggested here, but no luck :/