Stillat / vscode-antlers-language-server

Provides rich language features for Statamic's Antlers templating language, including code completions, syntax highlighting, and more.
https://antlers.dev
MIT License
36 stars 3 forks source link

Support Prettier 3.0.0 (Antlers Prettier Plugin) #73

Closed jimblue closed 8 months ago

jimblue commented 1 year ago

Which Antlers Toolbox products are you requesting a feature for?

Antlers Prettier Plugin

Is your feature request related to a problem? Please describe.

As you probably know, Prettier 3.0.0 has been release yesterday ! 🎉 Sadly prettier-plugin-antlers isn't compatible.

Describe the solution you'd like

To make prettier-plugin-antlers compatible with this new release it need to support ESM.

Another Prettier plugin very similar to prettier-plugin-antlers as already done that : the prettier-plugin-blade in their v1.9.0.

You can check what to do by looking at this commit.

JohnathonKoster commented 1 year ago

Just to set some expectations on this one - this may take some time as I need to do some internal refactoring since this plugin interacts with the prettier APIs.

There are some dependencies I need to wait to be updated before I can publish a new release for prettier 3. For now, please use prettier 2.8.8.

Other remaining items:

[ ] Prettier VS Code extension fails on Windows [ ] Prettier v3 issues running on Windows CLI

jimblue commented 1 year ago

Ok thank you for the update @JohnathonKoster 👍🏼

jimblue commented 1 year ago

@JohnathonKoster could you please add links to the issues you're mentioning in your previous message:

  • Please use prettier 2.8.8
  • Prettier VS Code extension fails on Windows
  • Prettier v3 issues running on Windows CLI
JohnathonKoster commented 1 year ago

@JohnathonKoster could you please add links to the issues you're mentioning in your previous message:

  • Please use prettier 2.8.8
  • Prettier VS Code extension fails on Windows
  • Prettier v3 issues running on Windows CLI

👋

The main issue I keep running into is this one: https://github.com/prettier/prettier-vscode/issues/3062 (with or without the VS Code extension, I hit that same issue)

Beyond that, the large rewrite is largely complete to handle all of the new async stuff, just don't feel comfortable doing any releases until I can reliably run it on my main machines as well 🙂

jimblue commented 1 year ago

Oh okay thank you for the update and good job referencing this issue in prettier-vscode repo... Hopefully this will help. On my side I'm sorry but I'm running on OSX sadly...

JohnathonKoster commented 1 year ago

I'll release v3 support once I am able to verify things work on my end as well (things will still work with prettier 2, however, until support arrives) 👍

jimblue commented 1 year ago

Hey @JohnathonKoster, this is just a friendly ping to get some news ? 🙂

JohnathonKoster commented 1 year ago

Hey there!

Mostly still just waiting for things to work in my environment outside of the test suit (still getting hit with that previously linked issue)🙂

jimblue commented 1 year ago

Oh okay, so you cannot load the config file with latest prettier on Windows. I hope prettier team will look at it soon enough. 🤞🏼 Thank you for answering so fast ! 😉 🙏🏼

jimblue commented 1 year ago

Hey @JohnathonKoster, As the issue you're mentioning concern Prettier VScode extension and not Prettier CLI I'm wondering if we could start testing your code with Prettier CLI directly. I'll be happy to help if you share what you already start to code in a new PR. 🙂 Cheers 🍻

JohnathonKoster commented 10 months ago

Unlikely at this time:

with or without the VS Code extension, I hit that same issue

I'm happy with the prettier v2 version at the moment, and will re-assess the situation at a later date 🙂

jimblue commented 9 months ago

@JohnathonKoster how are you doing ? 🙂

The blocking issue as just been closed : https://github.com/prettier/prettier-vscode/issues/3062

Is this working on your side ?

JohnathonKoster commented 9 months ago

@jimblue Not doing too bad, hope you are doing well.

I haven't had time to test, but will add it to my list. This is still on my list (but pretty far down on it in priority after day-job stuff, and other commitments) 🙂

jimblue commented 9 months ago

Hi @JohnathonKoster !

All right, I hope your todo list is not too long 😅

stefankempf commented 8 months ago

+1 on this one. I'm starting to get more and more tailwind utilities not getting formated since the tailwind prettier plugin requires prettier v3. Especially now with tailwind's 3.4 size-*, subgrid and :has support its kinda getting outta hand without formatting. I know this Plugin is more a sideproject but still, would be great to get v3 support in 2024 ❤️

JohnathonKoster commented 8 months ago

@stefankempf Currently in progress - working through making sure that the current non-prettier version continues to work non-async, while also adding support for async versions of a number of internal methods to support prettier v3 🙂

JohnathonKoster commented 8 months ago

@jimblue @stefankempf

The Prettier 3 plugin is now generally available. You will need to use version 2 of the prettier-plugin-antlers:

npm install prettier-plugin-antlers@^2 --save-dev

The format of the .prettierrc file has also changed. You should use a setup similar to the following (note the lack of specifying node_modules within the Prettier plugin paths):

{
    "plugins": [
        "prettier-plugin-antlers",
        "prettier-plugin-tailwindcss"
    ],
    "overrides": [
        {
            "files": [
                "*.antlers.html"
            ],
            "options": {
                "parser": "antlers"
            }
        }
    ]
}

Finally, if you are using Visual Studio Code and receive errors stating that no formatter for Antlers could be found after making these changes (upgrading to Prettier 3, the new Prettier extension [version >= v10.1.0], and the updated Antlers plugin), you can update your VS Code settings JSON file to have changes similar to the following:

{
  "[antlers]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "prettier.documentSelectors": [
    "**/*.antlers.html"
  ]
}
stefankempf commented 8 months ago

Now I have bad conscience motivating you to work on it on new years eve. 🙈 nevertheless, those are some great news. I'll go and test it out asap. Thanks a lot and happy new year!

JohnathonKoster commented 8 months ago

No worries - I was already working to wrap things up yesterday :)