Skip to content

Conversation

angelozerr
Copy link
Contributor

[XML] Formatting preference page

Fixes #859

Signed-off-by: azerr [email protected]

@angelozerr
Copy link
Contributor Author

This PR provides the format settings that XML language server:

image

Please note that some format settings doesn't appear in the preferences (like https://github.com/redhat-developer/vscode-xml/blob/main/docs/Formatting.md#xmlformatpreservednewlines) because we have the intention to move our current formatter to a new experimental formatter https://github.com/redhat-developer/vscode-xml/blob/main/docs/Formatting.md#xmlformatexperimental when it will supports all existing settings).

As https://github.com/redhat-developer/vscode-xml/blob/main/docs/Formatting.md#xmlformatpreservednewlines is not supported by experimental formatter I have not add it.

Please note too that the UI preferences is very basic and it should be improved by disable some preferences according to an another.

For instance Levels to indent the attributes preference is used only when Split multiple attributes each onto a new line is enabled. I'm not sure (but perhaps I'm wrong) that FieldEditorPreferencePage can support this usecase.

Once experimental formatter will replace the current formatter, we should add another preference that the experimental formatter support like https://github.com/redhat-developer/vscode-xml/blob/main/docs/Formatting.md#xmlformatpreservespace

If you wish to know more detail about the LemMinX settings for formatting, please read https://github.com/redhat-developer/vscode-xml/blob/main/docs/Formatting.md

Copy link
Contributor

@mickaelistria mickaelistria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some wording suggestions

@@ -23,6 +23,16 @@ XMLCatalogPreferencePage_OpenInEditorApplyAndEdit=Apply and Edit
# XML CodeLens preference page
XMLCodelensPreferencePage_codelens_enabled=Enable XML &CodeLens

# XML Formatting preference page
XMLFormattingPreferencePage_format_emptyElements=Expand/collapse empty elements
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest Default visibility for empty elements

Suggested change
XMLFormattingPreferencePage_format_emptyElements=Expand/collapse empty elements
XMLFormattingPreferencePage_format_emptyElements=Default visibility for empty elements

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to keep this label since we use it too in vscode-xml.

# XML Formatting preference page
XMLFormattingPreferencePage_format_emptyElements=Expand/collapse empty elements
XMLFormattingPreferencePage_format_spaceBeforeEmptyCloseTag=Insert space before end of self closing tag
XMLFormattingPreferencePage_format_splitAttributes=&Split multiple attributes each onto a new line
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split is probably not the right term. I suggest Place attributes on separate lines

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
XMLFormattingPreferencePage_format_splitAttributes=&Split multiple attributes each onto a new line
XMLFormattingPreferencePage_format_splitAttributes=&Place attributes on separate lines

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to keep this label since we use it too in vscode-xml and WTP uses too this label:

image

XMLFormattingPreferencePage_format_spaceBeforeEmptyCloseTag=Insert space before end of self closing tag
XMLFormattingPreferencePage_format_splitAttributes=&Split multiple attributes each onto a new line
XMLFormattingPreferencePage_format_splitAttributesIndentSize=&Levels to indent the attributes
XMLFormattingPreferencePage_format_closingBracketNewLine=Put a closing bracket on a newline
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
XMLFormattingPreferencePage_format_closingBracketNewLine=Put a closing bracket on a newline
XMLFormattingPreferencePage_format_closingBracketNewLine=Place closing brackets on new lines

XMLFormattingPreferencePage_format_splitAttributesIndentSize=&Levels to indent the attributes
XMLFormattingPreferencePage_format_closingBracketNewLine=Put a closing bracket on a newline
XMLFormattingPreferencePage_format_preserveAttributeLineBreaks=&Preserve line breaks that appear before and after attributes
XMLFormattingPreferencePage_format_xsiSchemaLocationSplit=Split `xsi:schemaLocation` content
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what it means?

Suggested change
XMLFormattingPreferencePage_format_xsiSchemaLocationSplit=Split `xsi:schemaLocation` content
XMLFormattingPreferencePage_format_xsiSchemaLocationSplit=Place URLs in `xsi:schemaLocation` attribute on separate lines

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to keep this label since we use it too in vscode-xml.

@angelozerr angelozerr force-pushed the formatting-preference-page branch from b815fb8 to a10bcdd Compare September 5, 2022 13:42
@angelozerr
Copy link
Contributor Author

@mickaelistria is there something that you want I fix?

@mickaelistria mickaelistria merged commit b316d5c into eclipse-wildwebdeveloper:master Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[XML] Formatting preference page
2 participants