Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esbenp.prettier-vscode formats more than needed by normal prettier #3631

Open
sebbi08 opened this issue Feb 19, 2025 · 0 comments
Open

esbenp.prettier-vscode formats more than needed by normal prettier #3631

sebbi08 opened this issue Feb 19, 2025 · 0 comments

Comments

@sebbi08
Copy link

sebbi08 commented Feb 19, 2025

Summary

esbenp.prettier-vscode reformats code that when running npx prettier --write filename

it will format this :

export class Test {
    private test(params: any) {
        console.log();
    }
    private test2() {
        this.test({
            parameter1: 1,
            parameter2: 2,
            parameter3: 3,
            parameter4: 4
        });
    }
}

to this

export class Test {
    private test(params: any) {
        console.log();
    }
    private test2() {
        this.test({ parameter1: 1, parameter2: 2, parameter3: 3, parameter4: 4 });
    }
}

we are using the following .prettierrc

{
    "endOfLine": "lf",
    "printWidth": 180,
    "tabWidth": 4,
    "trailingComma": "none",
    "semi": true,
    "arrowParens": "always",
    "overrides": [
        {
            "files": ["*.yaml", "*.yml"],
            "options": {
                "tabWidth": 2
            }
        }
    ]
}

Additional information

Here you can see that both are valid and VS Code save should not change anything

prettier.io-multiline

prettier.io-singleline

VS Code Version:

Version: 1.97.2 (system setup)
Commit: e54c774e0add60467559eb0d1e229c6452cf8447
Date: 2025-02-12T23:20:35.343Z
Electron: 32.2.7
ElectronBuildId: 10982180
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.26100

Prettier Extension Version: 11.0.0

OS and version: WSL: Ubuntu-22.04

Prettier Log Output

["INFO" - 1:09:09 PM] Formatting file://projectfolder/test.ts
["INFO" - 1:09:09 PM] Using config file at projectfolder/.prettierrc
["INFO" - 1:09:09 PM] PrettierInstance:
{
  "modulePath": "projectfolder/node_modules/prettier/index.cjs",
  "messageResolvers": {},
  "version": "3.4.2"
}
["INFO" - 1:09:09 PM] Using ignore file (if present) at projectfolder/.prettierignore
["INFO" - 1:09:09 PM] File Info:
{
  "ignored": false,
  "inferredParser": "typescript"
}
["INFO" - 1:09:09 PM] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
["INFO" - 1:09:09 PM] Prettier Options:
{
  "filepath": "projectfolder/test.ts",
  "parser": "typescript",
  "endOfLine": "lf",
  "printWidth": 180,
  "tabWidth": 4,
  "trailingComma": "none",
  "semi": true,
  "arrowParens": "always"
}
["INFO" - 1:09:09 PM] Formatting completed in 10ms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant