Skip to content

ReactiveCommand support for private naming convention #9

@zacfromaustinpowder

Description

@zacfromaustinpowder

Is your feature request related to a problem? Please describe.

My private method named with an underscore generates a public property with an underscore as well. For example, the method below would generate _refreshCommand instead of RefreshCommand.

[ReactiveCommand]
async Task _refresh() {}

Describe the solution you'd like

Add a check to see if the method name starts with an underscore + lowercase, then replace with not underscore + uppercase.

Describe suggestions on how to achieve the feature

In ReactiveCommandGenerator.Execute.cs modify line 192 to apply a transformation to the method name string. e.g.

var methodName = methodSymbol.Name;
if (methodName.Length > 1 && methodName[0] == '_' && char.IsLower(methodName[1]))
    methodName = char.ToUpper(methodName[1]) + methodName.Substring(2);

commandExtensionInfos.Add(new(
    methodName,
    /*...*/));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions