How to make "Resource String Intellisense" appear on custom attributes


[Required(ErrorMessageResourceName = "EmailRequiredErrorMsg", ErrorMessageResourceType = typeof(AccountLang))]
public string Email { get; set; }

When typing this attribute the resource string "EmailRequiredErrorMsg" pop ups with intellisense/auto-completion.

How can I achieve the same thing with custom attributes? Is there a JetBrains.Annotations attribute for it like PathReference?


1 comment
Comment actions Permalink

Unfortunately, this isn't handled by attributes. Instead, ReSharper creates a reference from the string literal to a resource item - a property on the type specified in ErrorMessageResourceType. The reference allows for ctrl+click navigation, renaming, find usages and code completion.

It's possible for you to write your own reference provider in a plugin. You can fire up dotPeek, point it at ReSharper or the SDK, and look for ValidationAttributePropertyNameReferenceFactory to see how it's done.


Please sign in to leave a comment.