Optimizes resx files after saving: Removes schema and comments (in particular the 3KB documentation that is included in every resx file) and sorts entries alphabetically so that they look like this:
<?xml version="1.0" encoding="utf-8"?>
<root>
<schema />
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="a" xml:space="preserve">
<value>LESS CLUTTER</value>
</data>
<data name="b" xml:space="preserve">
<value>SORTED BY KEYS</value>
</data>
</root>
Use only with a source control system and at your own risk. See the change log for changes and road map.
Download this extension from the Visual Studio Marketplace or get the CI build.
Formatting rules are configured in the EditorConfig file as follows:
[*.resx]
resx_formatter_sort_entries=true
resx_formatter_remove_xsd_schema=true
resx_formatter_remove_documentation_comment=true
resx_formatter_sort_comparer=OrdinalIgnoreCase
Comparer can be one of the following: InvariantCulture, InvariantCultureIgnoreCase, OrdinalIgnoreCase, Ordinal. The default value is Ordinal.
ℹ️ You can format all resx files in the current solution folder via Extensions > ResxFormatter menu. |
---|
A few things can be configured and probably you want to have this done as follows:
Use the experimental setting with caution since it may have undesired side effects. It is also worth to note, that the extension may insert schema or documentation comment in order to match the desired effect of your EditorConfig settings.
Please use the issue tracker for submitting bug reports or feature requests.
Library | License |
---|---|
EditorConfig .NET Core | MIT License |
xUnit | Apache License 2.0 / MIT License |
NFluent | Apache License 2.0 |
Community toolkit for Visual Studio extensions | Apache License 2.0 |