Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the IsMigrationApplied element in Resharper team settings file?

I just upgraded to ReSharper 8.1.23.546 and it added a new key to our team settings file:

    <s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>

What is this, and why did it add it to the team settings file? Will it cause issues with other developers when this is stored in version control and they haven't upgraded to this version yet?

like image 676
DMac the Destroyer Avatar asked Dec 18 '13 19:12

DMac the Destroyer


1 Answers

This is an indicator that ReSharper has migrated some settings that have changed from one version to the next, and is used to not run the migration again.

In this case, ReSharper 8.0 introduced some new formatting options - number of blank lines around property/auto-property, and number of blank lines around single-line property/auto-property. I don't know for sure, but looking at things, it's reasonable to assume that ReSharper 7 used the number of lines around a field when formatting properties.

If you've got a fresh install, introducing these new options is no big deal - everything will be default, and nothing will get written to the settings file. But, if you've previously customised the number of blank lines around a field, then introducing these new options will change the existing behaviour, because the formatter would use the new default options, rather than the old, customised value. So, the migrator runs and checks to see if the number of lines around a field is anything other than the default. If it is, it checks to see if you've already edited the number of lines around properties. As long as they're still set to the default, it overwrites the (default) value to be the same as the number of lines around a field - it migrates the previously used field values to overwrite the default values for properties. It then adds the migration indicator to make sure the migrator doesn't run again, else you'd never be able to have default formatting for properties and non-default formatting for fields.

As for why it's in the team settings, I presume that's because the customised field value is also in the team settings file. Since this file is shared, it makes sense to only migrate the values once, so the indicator should also be in the shared file. There will be no danger in sharing this with the team.

like image 170
citizenmatt Avatar answered Oct 05 '22 02:10

citizenmatt