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

Neovim Formating with pretier doesn't work in .astro files #8534

Closed
f-amine opened this issue Jun 15, 2024 · 4 comments
Closed

Neovim Formating with pretier doesn't work in .astro files #8534

f-amine opened this issue Jun 15, 2024 · 4 comments
Labels
good first issue Good for newcomers help wanted Issues looking for someone to run with them! improve documentation Enhance existing documentation (e.g. add an example, improve description)

Comments

@f-amine
Copy link

f-amine commented Jun 15, 2024

📚 Subject area/topic

Neovim Formater Integration with Astro

📋 Page(s) affected (or suggested, for new content)

https://docs.astro.build/en/editor-setup/#other-code-editors

📋 Description of content that is out-of-date or incorrect

The current documentation for setting up Prettier and LSP with Neovim does not include necessary configuration details in the package.json for formatting .astro files.

Description

After setting up Prettier and the LSP for Neovim, formatting doesn't work correctly. It took a day to resolve this issue, and it was eventually fixed with help from the Astro Discord community member @grahf. To save others from similar frustration, please add the following configuration to the documentation:

"prettier": {
  "astroAllowShorthand": true,
  "overrides": [
    {
      "files": "*.astro",
      "options": {
        "parser": "astro"
      }
    }
  ],
  "pluginSearchDirs": [
    "."
  ],
  "plugins": [
    "prettier-plugin-astro"
  ]
}

🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)

No response

@f-amine f-amine added the improve documentation Enhance existing documentation (e.g. add an example, improve description) label Jun 15, 2024
@sarah11918
Copy link
Member

sarah11918 commented Jun 15, 2024

Hi @f-amine ! I'm glad you eventually got this working!

Would you like to make a PR to add this information yourself to the docs page? I could see adding it to the bottom of the page, in the Prettier section, maybe like:

#### Prettier for Neovim

To configure Prettier for Astro in Neovim, use the following configuration:

"prettier": {
  "astroAllowShorthand": true,
  "overrides": [
    {
      "files": "*.astro",
      "options": {
        "parser": "astro"
      }
    }
  ],
  "pluginSearchDirs": [
    "."
  ],
  "plugins": [
    "prettier-plugin-astro"
  ]
}

Do you think this would be a helpful addition? If so, I'd be happy to receive a PR to the docs page!

@sarah11918 sarah11918 added good first issue Good for newcomers help wanted Issues looking for someone to run with them! labels Jun 15, 2024
@f-amine
Copy link
Author

f-amine commented Jun 15, 2024

Okey I can do that, I'm gonna look for the specific file for that and make a PR right now

@sarah11918
Copy link
Member

Amazing @f-amine - Quick tip - you can just go to that page in docs and click "edit this page" and you'll be taken right there! 🙌

@f-amine
Copy link
Author

f-amine commented Jun 15, 2024

sent a pr, thanks for the fast reply !!

@f-amine f-amine closed this as completed Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Issues looking for someone to run with them! improve documentation Enhance existing documentation (e.g. add an example, improve description)
Projects
None yet
Development

No branches or pull requests

2 participants