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

Configure which file extensions should be processed #32

Closed
iambrandonn opened this issue Jan 27, 2017 · 9 comments
Closed

Configure which file extensions should be processed #32

iambrandonn opened this issue Jan 27, 2017 · 9 comments
Labels
locked Please open a new issue and fill out the template instead of commenting.

Comments

@iambrandonn
Copy link

I've noticed that with formatOnSave as true all files are run through prettier, whether they are js, html, svg, etc...
I would like to be able to configure which extensions are and are not processed.

@vasa-chi
Copy link
Contributor

I've made a PR #31 to make prettier to run only on javascript files. Waiting for response from author :)

@CiGit
Copy link
Member

CiGit commented Feb 15, 2017

#31 was closed in favor of #18. It runs only on javascript, javascriptreact files (.js, .jsx)

@esbenp esbenp closed this as completed Feb 21, 2017
@ghost
Copy link

ghost commented May 4, 2017

I am using the lastest version of Prettier and it is still formating *.hbs file on save. It turns my code to something like below,

    {{#if hasQueryCache}} {{table-selectable selected=(mut selected) fullRowScroll=true height=260 }} {{else}}
    <p>
      No Query Data Available
    </p>
    {{/if}}

Is there a way to exclude certain file types? I have look through the setting options and did find any related setting available there.

Update

I think it is caused by VS Code using the default formating rule to format *hbs file and it is probably not prettier-vscode's faults.

@CiGit
Copy link
Member

CiGit commented May 4, 2017

It certainly is some other formater.
trying to format your code with prettier will throw: Unexpected character '#'

@ghost
Copy link

ghost commented May 4, 2017

I'm posting here becase prettier-vscode is the only formater I installed on my machine. Not sure where the default famator come from

@CiGit
Copy link
Member

CiGit commented May 4, 2017

From vscode I think. You can run code --disable-extensions to be sure.

@seangwright
Copy link

I think the issue people are experiencing is they want prettier to run on save for their .js/.jsx/.ts/.tsx but they don't want format on save for their .html files.

As can be seen in this comment for the vscode issue about language specific settings microsoft/vscode#1587 (comment) you can do something like

"[typescript]": {
      "editor.formatOnSave": true
}

which will allow for saving typescript files to format with prettier but html files won't be formatted on save. :)

@halvard-cognite
Copy link

For an easy copy paste for others:

If you want to just disable formatting for .hjs

  "[handlebars]": {
    "editor.formatOnSave": false
  }

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the locked Please open a new issue and fill out the template instead of commenting. label Apr 13, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

No branches or pull requests

6 participants