This should be 100% feasible with source generators. These should also:
Check return type to determine whether to use a RelayCommand or an AsyncCommand
Check the method parameter list and restrict its usage to methods with either 0 or 1 parameters
Adopt some naming convention (e.g. remove Execute / Async from the method name and append Command), overrideable with an attribute parameter
Deal with generics well, e.g. RelayCommand<SomeType<SomeNestedType>>>
Pick the docstring from the method, or provide an attribute property to specify your own
Report diagnostics for any issue that might occur so that anything going on doesn't become too obscure
They will ignore the CanExecute callbacks for now, since this tool does not make use of them. However, at some point they could also be specified in another attribute property, via nameof(TheCanExecuteMethod)
Instead of having to type the boilerplate of;
use an attribute for the method that does this for you:
This should be 100% feasible with source generators. These should also:
RelayCommand
or anAsyncCommand
Execute
/Async
from the method name and appendCommand
), overrideable with an attribute parameterRelayCommand<SomeType<SomeNestedType>>>
nameof(TheCanExecuteMethod)