You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Not sure who else wants that, but I often find myself writing a class implementation and then realise that I'd rather have it as a trait + implementation class.
This code action can be especially useful on an already existing class with a non trivial amount of public methods implemented.
Describe the solution you'd like
A code action that
Extracts all public methods into a trait named the same as the class
Explicitly annotates the methods with inferred return types
Renames class to NameImpl
Converts all methods into overrides
objectBEFORE:classClient(bla: String):deftest() =1defhello(x: String, b: Int) = bla + x
// Apply code action "Extract interface"objectAFTER:traitClient:deftest():Intdefhello(x: String, b: Int):StringclassClientImpl(bla: String) extendsClient:overridedeftest() =1overridedefhello(x: String, b: Int) = bla + x
There's complexity around type parameters of course, but it doesn't have to be part of MVP.
Describe alternatives you've considered
For my personal use an alternative would be to plan ahead and always create traits, but I don't have that level of control over my life.
Is your feature request related to a problem? Please describe.
Not sure who else wants that, but I often find myself writing a class implementation and then realise that I'd rather have it as a trait + implementation class.
This code action can be especially useful on an already existing class with a non trivial amount of public methods implemented.
Describe the solution you'd like
A code action that
NameImpl
There's complexity around type parameters of course, but it doesn't have to be part of MVP.
Describe alternatives you've considered
For my personal use an alternative would be to plan ahead and always create traits, but I don't have that level of control over my life.
Additional context
No response
Search terms
code action, extract, trait, implementation, interface
The text was updated successfully, but these errors were encountered: