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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 BUG: Prettier hangs when importing from 'astro/components' #232

Closed
karlschwaier opened this issue Jul 13, 2022 · 5 comments 路 Fixed by #237
Closed

馃悰 BUG: Prettier hangs when importing from 'astro/components' #232

karlschwaier opened this issue Jul 13, 2022 · 5 comments 路 Fixed by #237

Comments

@karlschwaier
Copy link

Describe the Bug

The formatting process hangs without any error message if I import Code or Debug from 'astro/components'.

code.astro:

---
import { Code } from 'astro/components';
---
<h1>Test
</h1>

But it works if I import Markdown.

markdown.astro:

---
import { Markdown } from 'astro/components';
---
<h1>Test
</h1>

Steps to Reproduce

  1. npx prettier code.astro
  2. Terminal hangs
  3. npx prettier markdown.astro
  4. Terminal shows you correctly formatted code

I am using

  • astro 1.0.0-beta.69
  • prettier 2.7.1
  • prettier-plugin-astro 0.1.1
  • node 16.15.1
  • npm 8.11.0
@JulianCataldo
Copy link

Same here.

---
import { Code } from 'astro/components';  
---

'astro' string is what's make prettier break

@Princesseuh
Copy link
Member

Interesting that it hangs! I think this might be related to the code that try to parse the Markdown component's import statement

@karlschwaier
Copy link
Author

karlschwaier commented Aug 5, 2022

Thanks @Princesseuh, but it still hangs with prettier-plugin-astro 0.3.0.

Actually importing Markdown was not an issue. It just happens when importing Code oder Debug.

@Princesseuh
Copy link
Member

I cannot reproduce with that version (and there's no code left related to those components)

If you're formatting in VS Code, make sure you restarted the editor after upgrading as it caches the plugin on first use!

@karlschwaier
Copy link
Author

All good. Restart helped. It's fixed. 馃檪 Thank you!

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

Successfully merging a pull request may close this issue.

3 participants