redhat-developer / redhat-developer/vscode-xml

[Feature] Align sibling attributes

Open
#1,061 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

formatting
Dominant language
TypeScript
Stars
328
Forks
101
Avg merge
1d 17h
Merged PRs (30d)
7

Description

Thanks for the project! Super useful for some XML files I'm working with. Unfortunately, I cannot change the existing style of all the files, so I am looking for a way to auto-format new XML files to match the existing style. vscode-xml gets 99% of the way there, but I need to be able to align matching attributes of siblings. For example this:

<parent>
  <child  attribute1="some long value" attribute2="value2" attribute3="value3"/>
  <child attribute1="value1" attribute2="some other long value" attribute3="value3" />
</parent>

Should get formatted to this:

<parent>
  <child attribute1="some long value" attribute2="value2"                attribute3="value3"/>
  <child attribute1="value1"          attribute2="some other long value" attribute3="value3" />
</parent>

Note:

  • All attributes on the same line (I don't like it either, but I can't change the existing style)
  • attributes are aligned with spaces
  • One space between the final " and the start of the next attribute.
  • Just to stress this point, I cannot change the style. I cannot use the formatting style where each attribute is on a newline. Each attribute must be on the same line.

This feature would be a huge boon to have.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue provides before-and-after XML examples but names no source files or tests. Start by locating the XML formatter entry point and existing formatting tests, then determine how sibling attributes are represented. Done means matching attributes on sibling elements are aligned with spaces while remaining on the same line.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.