it-crowd / pom-sorter

Plugin for IntelliJ Idea to sort pom.xml
4 stars 9 forks source link

Unordered <TagSortingSetting> elements make "false changes" in IDEA misc.xml #15

Closed mikhailknyazev closed 11 years ago

mikhailknyazev commented 11 years ago

This great plugin from time to time changes order of elements in ".idea\misc.xml". Thus, unfortunately, we cannot use it in our office environment with IDEA-project-files-sharing enabled among IDEA instances - the plugin constantly creates "false changes".

blabno commented 11 years ago

What do you mean by false changes?

mikhailknyazev commented 11 years ago

We have the misc.xml under VCS control, so when "Pom sorter" (indirectly) changes order of elements IDEA shows that misc.xml has been changed. It has chnaged physically, but logically it is the same set of settings.

BorzdeG commented 11 years ago

1) Why do you sort ".Idea\misc.xml"? why bother catalog ".idea" to put VCS? 2), and yes, the problem is not with the PomSorter, but with the VCS in IDEA - try to manually swap the 2 tag and see.

mikhailknyazev commented 11 years ago

1) We do not sort this file. 2) As with any file under VCS control IDEA shows the physical changes.

Hence, a proposal for "Pom sorter": if nothing changes in the project then do NOT change order of elements.

blabno commented 11 years ago

I guess it's because State values are loaded from HashMap.values() which does not guarantee order. Mikhail, could you change HashMap to TreeMap and see if problem gets solved?

mikhailknyazev commented 11 years ago

What do you think about following?:

1) Make "pl.itcrowd.pom_sorter.PomSorter.TagSortingSetting" Comparable (using TagSortingSetting.name) 2) Sort the passed collection in "pl.itcrowd.pom_sorter.PomSorter.State.State" constructor (to return the appropriately via com.intellij.openapi.components.PersistentStateComponent#getState()) 3) Do you think this list should be sorted as well? : "pl.itcrowd.pom_sorter.PomSorter.TagSortingSetting.order"

Please make the above changes if correct and issue new plugin version.