-
Notifications
You must be signed in to change notification settings - Fork 37
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
Support for prettier plugins #342
Comments
Haa... yeah it seems like we hardcode ours here. There's probably a clever way to use something from prettier's API to load plugins that are discovered from resolveConfig? IIRC there's also an issue w.r.t. .prettierignore being ignored, so might lump both those things together. Unfortunately, we have higher priority stuff to deal with right now. Would accept PRs :) |
Hi @charlespwd, Thanks for answering. If I understand (and see) it correctly, you actually already get the Not sure, but it could be that this line is maybe overwriting all other prettier plugins that has been added. When I have time, I'll check it out. |
Hi @charlespwd, I'm trying to clone the project, but I'm running into some issues.
I followed the contributing.md Forking is also not possible. |
Ah. We have a git submodule for the syntax highlighting that lives in the
(I came to this conclusion from this error message in the logs: Try editing
This should unblock you. That or go through the SSH auth steps on GitHub |
Hi @charlespwd, That worked! Put a couple of hours in it now and figured out that the plugins will indeed be overwritten by the hardcoded plugins provided by this extension. I tried to spread the I also tried to use the async function toTextEdit(textDocument: TextDocument): Promise<TextEdit> {
prettier.clearConfigCache();
const options = await prettier.resolveConfig(textDocument.uri.fsPath);
const text = textDocument.getText();
const workspaceFolder = workspace.getWorkspaceFolder(textDocument.uri)?.uri.fsPath || '';
const formatted = prettier.format(text, {
...options,
parser: 'liquid-html',
pluginSearchDirs: [`${workspaceFolder}\\node_modules`],
plugins: [...(options?.plugins || []), LiquidPrettierPlugin as any],
});
const start = textDocument.positionAt(0);
const end = textDocument.positionAt(text.length);
return TextEdit.replace(new Range(start, end), formatted);
} |
Hi @charlespwd So are you guys aware / working on this already, or should I open a dedicated bug? Thanks |
We are aware, but not currently working on the |
Is your feature request related to a problem? Please describe.
Previously we had to format our liquid files with prettier, but with the v2 of the Shopify Liquid extension, we use theme-check to format our liquid files. This will make it impossible to use prettier-plugin-tailwindcss to automatically order our tailwind classes.
Describe the solution you'd like
Make sure we can use prettier plugins, so we can easily extend the theme-check formatter.
Describe alternatives you've considered
Give the option to either use a prettier plugin or the extension (with plugins).
Checklist
I also opened an issue on the repo of the Shopify Liquid extension.
The text was updated successfully, but these errors were encountered: