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

Compatibility with Prettier #7

Open
zachthedev opened this issue Apr 2, 2024 · 3 comments
Open

Compatibility with Prettier #7

zachthedev opened this issue Apr 2, 2024 · 3 comments

Comments

@zachthedev
Copy link

I Downloaded this with the hopes that this would work in conjunction with Prettier to remove the final newlines that it adds. There is no configuration for Prettier to disable the newlines, so I figured this may be an easy route through an extension.

Are you aware of any ability to specify the priority for the order of extensions during a save? Right now, Remove Final Newlines runs followed by Prettier.

@DoCode
Copy link
Owner

DoCode commented Apr 3, 2024

Ok, i understand.
I'll look into this and make some tests with Prettier ASAP!

@DoCode
Copy link
Owner

DoCode commented Apr 3, 2024

With this config on reformat code and/or file save, the Prettier runs, and then the final new line is removed:

{
. . .
  "files.insertFinalNewline": false,
  "files.removeFinalNewlines": true,
  "files.trimFinalNewlines": false,
  "files.trimTrailingWhitespace": true,
. . .
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.tabSize": 2
  },
  "[json]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.tabSize": 2
  },
  "[markdown]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.tabSize": 4,
    "editor.wordWrap": "off",
    "files.insertFinalNewline": true,
    "files.removeFinalNewlines": false,
    "files.trimFinalNewlines": true,
    "files.trimTrailingWhitespace": false
  },
. . .
}

@zachthedev
Copy link
Author

@DoCode Thanks for looking into it! I just gave that a go and it did not work for me. I added the file-specific config that you listed but that didn't change anything for me since prettier was already set as the global editor default.
Here is some relevant things from my settings.json

  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnPaste": false,
  "editor.formatOnSave": true,
  "editor.formatOnType": false,
  "files.insertFinalNewline": false,
  "files.removeFinalNewlines": true,
  "files.trimFinalNewlines": false,
  "files.trimTrailingWhitespace": true,

Prettier Info:
Name: Prettier - Code formatter
Id: esbenp.prettier-vscode
Description: Code formatter using prettier
Version: 10.4.0
Publisher: Prettier
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode

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

2 participants