Skip to content

Feature request: [ResourceName] attribute #41

Description

I have a custom attribute that takes resource names as parameters, and it would be nice if I could annotate these parameters as resource names so Rider could report unknown resource names, show the resource value on hover, etc. like it does with calls to ResourceManager.GetString:

hovering over a string parameter to ResourceManager.GetString shows the resource value

I think this is the same as Aspire.Hosting.ApplicationModel.ResourceNameAttribute, but that's only for Aspire projects, and I'm not sure if Rider supports it anyway.

I know this would require changes to ReSharper/Rider/etc., so please let me know if there's a more appropriate place to post this, or if there's already another way to do this.

Example usages

internal sealed class MyAttribute : Attribute
{
    [ResourceName]
    public required string TitleKey { get; init; }
}

[MyAttribute(TitleKey = "resource.path.here")] // could autocomplete, verify it exists, etc.
class MyClass { ... }
class MyClass {
    public static void MyMethod([ResourceName] string key) { ... }
}

class Program {
    public static void Main() {
       MyClass.MyMethod("resource.path.here"); // could autocomplete, verify it exists, etc.
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions