1.10 Migration from ReSharper 7.x (R8)

Skip to end of metadata
Go to start of metadata

Context Action Changes

The type BulbItem, previously used to denote individual items, is no longer used in ReSharper. Due to changes in the context action mechanism, you will need to alter the CreateBulbItems() method. This method no longer takes a parameter, but rather uses the return type of IEnumerable<IntentionAction> to yield the separate items. The simplest way to change things is to reimplement the method and, if you have a collection of bulb items, simply return it as follows:

Declarations Cache Changes

The declaration cache has migrated into IPsiServices.Symbols so that, for example, if you need to get all the short names of the library symbols in scope, you would need to change the code to something like the following:

Similarly, most of the functionality exposed by the CacheManager class has moved to IPsiServices.Caches.

PSI Changes

To get a PSI file from a source file, we now use

Some APIs now require a ModuleReferenceResolveContext. You can acquire it from existing context via, e.g., the GetContextFromModule() extension method applied to a PsiModule.

PSI Transaction Changes

The PsiManager abstract class, which provided PSI transaction support, has been replaced by the IPsiTransactions interface, which can be accessed via IPsiServices.Transactions. The PsiManager.DoTransaction method has been renamed to IPsiTransactions.Execute. However, it may be more convenient to create a transaction using the PsiTransactionCookie class:

Live Template Macro Changes

The configuration of live template macros has changed. In the past, it was sufficient to declare a class decorated with the [ReSharper:Macro] attribute and implementing the IMacro interface. Now, the definition and implementation of the live template macros can be kept in separate classes.

The definition class must implement the IMacroDefinition interface or, alternatively, it can inherit from SimpleMacroDefinition. This class must also be decorated with the MacroDefinition attribute containing parameters similar to those previously found in [ReSharper:Macro]:

Similarly, the implementation of the macro must be decorated with the [ReSharper:MacroImplementation] attribute, and must either implement the IMacroImplementation interface or, alternatively, inherit from IMacroImplementation. The attribute declaration simply refers to the type of the MacroDefinition, i.e.

IAttributeInstance

The IAttributeInstance.AttributeType property has been replaced with IAttributeInstance.GetAtributeType(), since it was doing more work than expected in a property, and would always return a new instance.

AOptionsPage

The AOptionsPage base class now takes in an instance of IUIApplication to provide easy access to services such as threading, theming and window branding. Since options pages are created by the container, simply declare a new IUIApplication parameter on your constructor and pass it to the base class.