alexanderweiss / nova-prettier

Prettier extension for Nova
MIT License
35 stars 6 forks source link

My .prettierrc is not being used, even when Nova is restarted. #28

Closed greggh closed 4 years ago

greggh commented 4 years ago

I am using Nova to build a site with 11ty and its using the Nunjucks templating language. Prettier actually handles .njk files fine with withe html parser. So I created a .prettierrc file in the root of my project:

  "overrides": [
    {
      "files": "*.njk",
      "options": { "parser": "html" }
    }
  ]
}

The formatting for that is a copy and paste directly from the website, with an edit for njk and html strings.

https://prettier.io/docs/en/configuration.html

After looking through the Issues that were already submitted and closed I saw one that said the prettier config was cached, so I restarted Nova. But that didn't help me.

Thanks for the awesome extension, I am just hoping we can figure this one out!

alexanderweiss commented 4 years ago

It ignores any parser overrides indeed. It'll be fixed in the next release.

alexanderweiss commented 4 years ago

Out now 😊

greggh commented 4 years ago

Thanks for the quick update @alexanderweiss, I really appreciate it! But unlucky for me, I am still having the same problem.

I updated to the latest version of your extension (1.7.0) and my .prettierrc is the same one from above. I have the option turned on to format after saving, but I have also tried to just hit the menu item.

When I do that, nothing happens.

At the command line in that directory with the .prettierrc if I run "npx prettier file.njk" it prettifies the file.

Any thoughts?

alexanderweiss commented 4 years ago

Did you manage to get it working?

greggh commented 4 years ago

Did you manage to get it working?

Nope. At the command line prettier works fine with the njk files, in Nova the extension still seems to be ignoring them. No idea whats happening.

alexanderweiss commented 4 years ago

Ah. Since you closed it. Is it picking up on other configuration from your .prettierrc file? And is the compatibility mode option in the extension's preferences enabled by any chance?

greggh commented 4 years ago

Compatibility mode is off, and right now I don't have anything else in the .prettierrc file. I haven't needed any other config yet. Got anything that would be a good test in there?

alexanderweiss commented 4 years ago

Okay. Never mind. Seems like I actually broke immediately after adding support for it 😇. I'll release a fix right away.

alexanderweiss commented 4 years ago

There should be a new update now that does fix it!

greggh commented 4 years ago

That fixed it! Thank you.

alexanderweiss commented 4 years ago

Good to hear! Enjoy!

vichudson1 commented 4 years ago

I'm trying to get my own prettierrc config working as well without much success. I have the following in a .prettierrc file in my project's root folder, but it never seems to be used. I've tried relaunching Nova several times without any luck. I'm fully willing to admit I'm new to Nova and Prettier so if I've missed anything feel free to point that out.

Using the prettier included with the extension.

.prettierrc content { "tabWidth": 4, "useTabs": true }

alexanderweiss commented 4 years ago

@vichudson1 Are you editing local or remote files? It doesn't currently work with remote files. If you're editing local files, can you share the logs from the extension console (first enable extension development in Nova preferences), where your .prettierrc is located, and whether Comptability mode is enabled in the extension's preferences (in the extension library)? Also, maybe create a separate issue so we don't annoy Gregg 😃.