Format TypeScript expressions in Vue template attributes#14506
Format TypeScript expressions in Vue template attributes#14506fisker merged 23 commits intoprettier:nextfrom
Conversation
|
it's ready for review 🚀 |
|
It seems we still missing some places, This place seems using wrong parser? Maybe we need |
|
Can you change base to |
f14bf65 to
9bbb0d5
Compare
9bbb0d5 to
b8a2fbb
Compare
| <template> | ||
| <MyComponent :src="100000000000000000000000000000000000000000000000000000000000000000000000000"/> | ||
| </template> | ||
| <script lang="ts"></script> No newline at end of file |
There was a problem hiding this comment.
you can put all attributes in one component, and please add final_new_line.
There was a problem hiding this comment.
Ah, I see it's copied from tests/format/vue/vue/expression-binding.vue, can you put them together instead of move it to another dir. maybe tests/format/vue/vue/expression-binding-ts.vue?
…sts/format/vue/vue/expression-binding-ts.vue
|
|
|
Prettier pr-14506 --parser vueInput: <script lang="ts"></script>
<template>
<ul>
<li v-for="a:number
of x as number">{{a}}</li>
</ul>
</template>Output: <script lang="ts"></script>
<template>
<ul>
<li
v-for="a:number
of x as number"
>
{{ a }}
</li>
</ul>
</template>
|
|
Thanks, I'll also fix v-for. I think I need to fix following as you said before. I think it relates to v-slot. However, v-slot with TS seems to work mysteriously. Maybe I'm misunderstanding... 🤔 Edit: |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
| return printVueFor(getValue(), attributeTextToDoc); | ||
| return printVueFor(getValue(), attributeTextToDoc, { | ||
| ts: options.__should_parse_vue_template_with_ts, | ||
| }); |
There was a problem hiding this comment.
Let's pass options, we may need access other props in future.
| v-for="([longLongProp, longLongProp, [longLongProp, longLongProp='Hello, Prettier!', [longLongProp, longLongProp, anotherLongLongProp=[longLongProp, longLongProp, anotherLongLongProp, yetAnotherLongLongProp], yetAnotherLongLongProp], yetAnotherLongLongProp], yetAnotherLongLongProp], index) of longLongLongLongLongLongLongLongList" | ||
| > | ||
| </div> | ||
| </template> No newline at end of file |
There was a problem hiding this comment.
Thanks, I found that I had disabled editorconfig plugin mistakenly 😅
|
Looks great! Thank you for your hard work. I'll take another look tomorrow. |
# Conflicts: # src/language-js/parse/parsers.js
|
Nice work! Thanks. You may interest #14575 |
|
Thank so much for your friendly supports. |
) Co-authored-by: fisker <[email protected]>
Description
Fix #14432
Checklist
(If changing the API or CLI) I’ve documented the changes I’ve made (in thedocs/directory).changelog_unreleased/*/XXXX.mdfile followingchangelog_unreleased/TEMPLATE.md.✨Try the playground for this PR✨