eclipse-sourceediting / sourceediting

Code repository for the Eclipse Web Tools Platform's Source Editing project
Eclipse Public License 2.0
6 stars 6 forks source link

Feature request: Add option to keep element on same line if inside line width with splitMultiAttrs activated #14

Open jansohn opened 2 months ago

jansohn commented 2 months ago

We want to switch to enabling splitMultiAttrs in our projects when formatting our (X)HTML files for better readability. This is great for elements with a lot of attributes but not so great for 2-3 attributes which would easily still fit inside the same line width.

Example:

<h:outputStylesheet library="webjars" name="font-awesome/4.7.0/css/font-awesome.min-jsf.css" />

gets formatted to the following no matter the line width:

<h:outputStylesheet
  library="webjars"
  name="font-awesome/4.7.0/css/font-awesome.min-jsf.css" />

I would like to see an additional option to not split the attributes if they fit on the same line.

Change would probably need to be done somewhere here: https://github.com/eclipse-sourceediting/sourceediting/tree/master/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/format