redhat-developer / redhat-developer/vscode-xml
[Feature] Conditional splitAttributes
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 328
- Forks
- 101
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 7
Description
Proposals:
"xml.format.splitAttributesLongLines": boolean- Only split attributes when the line is longer thanxml.format.maxLineWidth. Probably easier to implement than..."xml.format.groupAttributesNamespaces": string[][]- An array of string arrays. Each string array is a set of attribute namespaces to group.
Another addition for folks editing XAML and derived languages. This would allow vscode-xml to format more similarly to Visual Studio's XAML formatting. That is...
- The first attribute stays on the same line as its XML tag.
- Subsequent attributes are split onto separate lines and then aligned to the first attribute.
- Certain attributes are grouped on one line e.g.
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450".- A. Split when line would otherwise be longer than
xml.format.maxLineWidth. This "dumb" solution is easier to implement than... - B. Try grouping attributes if they come from specified namespaces. For example, if the user configured grouping attributes from namespaces
http://schemas.microsoft.com/expression/blend/2008(usually xmlns:d) andhttp://schemas.openxmlformats.org/markup-compatibility/2006(usually xmlns:mc), the formatter should not split attributes from those namespaces unless the line would be too long.
- A. Split when line would otherwise be longer than
I'm unsure if the logic behind apparent "attribute grouping" in Visual Studio is specific to XAML grammar or if it's a simple max-line-length rule.
Example configuration for xml.format.groupAttributesNamespaces
[
[
"http://schemas.microsoft.com/expression/blend/2008",
"http://schemas.openxmlformats.org/markup-compatibility/2006"
],
[
"namepsaceA",
"namespaceB",
"namespaceC"
]
Contributor guide
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
No implementation files, tests, or entry points are named. First resolve whether the feature should use max-line-width logic, namespace-based grouping, or both; done means the chosen configuration formats XAML-style attributes as specified without exceeding the configured line width.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100