Page Comparison - 1.10 Migration from ReSharper 7.x (R8) (v.9 vs v.10)

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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:

Code Block
languagecsharp
public IEnumerable<IntentionAction> CreateBulbItems()
{
  return items.ToContextAction();
}

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:

Code Block
languagecsharp
public void DoSomething()
{
  using(PsiTransactionCookie.CreateAutoCommitCookieWithCachesUpdate(psiServices, "command name"))
  {
    // ...
  }
}

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.

...

Code Block
languagecsharp
[MacroImplementation(Definition=typeof(MethodResultTypeMacroDef))]
  public class MethodResultTypeMacro : SimpleMacroImplementation
{
}

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.