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
🐛 BUG: Couldn't load prettier
or prettier-plugin-astro
when using Yarn PnP
#655
Comments
Yarn PnP is very annoying and has caused so much issues over the years for this project. It's not possible to test correctly in CI for us and no one in the team uses it, so it's very possible there's a regression there. |
Thanks for the reply @Princesseuh! I am beginning to think that maybe Prettier in Yarn PnP was never implemented? Looking at this part of that old PR, perhaps this part: language-tools/packages/language-server/src/languageServerPlugin.ts Lines 73 to 75 in 4046fb8
should be something like this instead (?) not sure. const prettierRuntimeConfig = workspace.getConfiguration('prettier');
const workspacePrettierPath = runtimeConfig.get<string>('prettierPath');
const rootDir = workspacePrettierPath ?? ctx.env.uriToFileName(ctx.project.rootUri.toString());
const prettier = importPrettier(rootDir);
const prettierPluginPath = getPrettierPluginPath(rootDir); Because at the moment, it seems as if it will always try to use the Prettier from |
prettier
or prettier-plugin-astro
. Formatting will not work.prettier
or prettier-plugin-astro
when using Yarn PnP
Describe the Bug
I am using Yarn berry in my project, which I believe is already supported: #370 (and I could install the Astro language server nicely).
However, I'm getting this message/error when I'm opening an
.astro
file:I tried to replicate it in a repository (using Codespaces: https://github.com/imballinst/astro-yarn-berry-pnp), and it seems I am able to replicate the behavior. Do you might have an idea on what I should do, or could you point me out to a documentation that I could use? Thanks! 🙇♂️
Steps to Reproduce
With the sample repository:
git clone [email protected]:imballinst/astro-yarn-berry-pnp.git
src/layouts/Layout.astro
This is despite that
prettier
is already installed asdevDependencies
and I have the Prettier SDK already:In the extension output, I got this:
The text was updated successfully, but these errors were encountered: