-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Any chance to get it work with vue single components? #5
Comments
Currently you can use the workaround But to leave this here, I think a good start for a PR could be: https://github.com/prettier/prettier/blob/master/src/language-html/syntax-vue.js |
@xorik Is it okay for you to use the workaround? Or does it have a high priority? @j-f1 I created a test (locally) and tried to inspect if anything was called in my plugin. But it doesn't call anything 🤔 My test: <template lang="pug">
div(class="abc")
| {{ msg }}
</template>
<script>
export default {
data() {
msg: 'test';
}
};
</script> import { format } from 'prettier';
import { plugin } from './../../../src/index';
// ...
const actual: string = format(code, { parser: 'vue', plugins: [plugin], singleQuote: true });
// ... Result should be that |
@Shinigami92 it would be super nice if I could use prettier with your plugin without dividing each vue file to template + script. Maybe I could try to make an issue to the prettier repo? |
@xorik Yes, maybe you should do that and refer to this issue. At the moment, I don't really know if it's on the plugin side or on the prettier core side. I'm surprised that Markdown's formatting works, and that I did nothing to support it. |
👋, I may have found a hint for us wanting to use prettier/prettier#5371 references a time where there were troubles with Vue templates written with Pug, Prettier formatting Pug templates as HTML templates. It got fixed by ignoring Now that we have awesome plugins in beta, could the plugin somehow extend the list of usable lang attributes? Or should a modification be done directly to I would be happy to help for this issue, but I don't know where to start (yet)! 💯 |
Please present this to @prettier/core in the related issue prettier/prettier#6298 I think this is the right way 👍 In my opinion I would suggest to create something like |
I get it! 😄 Thanks, 🎩 |
Native single vue file integration would be nice! Any news on this? |
An update for everyone who is waiting for this functionality: plugin-pug/test/embed/vue/embed.test.ts Lines 7 to 8 in 5da540b
You can also see in the same file that So the problem is that my plugin is not notified that |
@fisker Is there an ETA when users can profit from your merge? I think we are waiting on a new prettier |
Yes, we still need wait for Good news is Prettier support install from the repo, so this should work. yarn add prettier/prettier @prettier/plugin-pug
npx prettier test.vue --write Update: Sorry, due to this issue prettier/prettier#8474 , the format command above won't work. yarn add prettier/prettier @prettier/plugin-pug
npx prettier test.vue --write --plugin-search-dir=. OR yarn add prettier/prettier @prettier/plugin-pug
npx prettier pug.vue --plugin=@prettier/plugin-pug |
@fisker Yes, I know that this is working. |
We'll have to wait. |
With prettier v2.1 pug within template can now be formatted |
Prettier works perfectly for the
<script>
tag of vue single-file compontens (.vue files), but it seems like this plugin doesn't work with vue's<template lang="pug">
.Do you know if it's possible to make it work?
The text was updated successfully, but these errors were encountered: