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

Hi,

[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?

Thanks

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.

0

Please sign in to leave a comment.