Plugin for automatic property file sorting

Answered

We are developing a plugin to sort property files by keys. Currently we can invoke the sorting manually, but the resource bundle editor will be used by non-tech guys as well.

Is there a way to get notified when a file was modified in order to perform the sorting?

Very happy to get a poke in the right direction :-)

8 comments
Comment actions Permalink
Official comment

Hi, Andreas,

you can use simply use PsiTreeChangeListener (sure if a modification was made inside properties files editor).

BTW we already have an inspection AlphaUnsortedPropertiesFileInspection to detect such cases + Resource Bundle Editor preserves sorting order if it's possible while editing.

 

Comment actions Permalink

Hi Dmitry,

wow that was fast. Thanks for pointing us in the right direction.

I tried the inspection and it looks like this is exactly what we are after :-)

Thanks!

0
Comment actions Permalink

BTW is your plugin available for download? It sounds like something I could use!

0
Comment actions Permalink

Hubert, it's already available in IntelliJ IDEA installation when properties support plugin is enabled. 

0
Comment actions Permalink

I use Properties Support plugin already but it doesn't allow me to sort properties.

0
Comment actions Permalink

Hubert, search for "Properties File or Resource Bundle is Alphabetically Unsorted" inspection in inspection settings. It should be disabled by default.

1
Comment actions Permalink

Can you sort all resource files in a project in one go, instead of doing the sort per resource bundle?

0
Comment actions Permalink

We use lokalise.com as a service for translation of property files and integration with Github.

The problem with the this inspection is that is not possible to change the sort order (alphabetically, ascii)

In the following sample, the last line would be placed first by the inspection...

GenerateMissingDescriptionsSetting.LONGTEXT_DIMENSIONTEST = Aus Kombination von Langtext und Dimensionstext
GenerateMissingDescriptionsSetting.LONGTEXT_DIMENSIONTEST.started = Fehlende Artikelbeschreibungen werden aus der Kombination von Langtext und Dimensionstext der Artikel generiert.
GenerateMissingDescriptionsSetting.LONGTEXT.started = Fehlende Artikelbeschreibungen werden aus dem Langtext der Artikel generiert.
0

Please sign in to leave a comment.