mblode / mblode/vscode-twig-language
Tracking: PrettyDiff formatter bugs (whitespace, indentation, JS-in-Twig)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 45
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
This is a tracking issue for the family of formatting bugs in v1 that all stem from the underlying PrettyDiff 3 engine, which is no longer actively maintained.
These bugs share a root cause and are hard to fix at the extension level because the formatting logic lives in PrettyDiff. Grouping them here so they're easy to find.
Known formatter issues:
- #17 Auto indent not working
- #31 Twig block shorthand syntax indentation
- #39 Whitespace-control tags (
{%-/-%}) not handled by formatter - #41 Indented block comments pushed out to infinity
- #44 JavaScript in Twig mangled
- #47 Spacing in variables / tags not normalised (
{{foo}}->{{ foo }}) - #48 Block inside an HTML tag formatted incorrectly
- #49 Infinite space added before a variable inside JS
- #52 JavaScript inside
<script>de-indented - #57
hrefattribute sticks to the previous word inside list items - #61 Closing brackets not auto-inserted inside inline HTML tags
- #64 Nested control structures lose indentation
Workarounds reported by users:
- Disable the formatter and format manually.
- Use
prettier-plugin-twig-melodywith a Twig-specific Prettier config for serious formatting needs.
If you're hitting a formatting bug, please add a comment here with a minimal before/after snippet rather than opening a new issue. Contributions toward replacing or patching the formatter are very welcome.
Thanks for your patience and for using the extension.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked PrettyDiff 3 project and the referenced formatting issues. Reproduce one listed case with a minimal before/after snippet, then assess whether the contribution should patch PrettyDiff or replace the formatter; done means the selected formatter problems are addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100