Open kmgallahan opened 1 year ago
Thanks for the suggestion. Do you have an example function which has multiple local functions inside of it? I haven't normally seen functions that are that complex.
I love local functions! Although my coding style probably isn't broadly used, I find local functions great for two main cases:
I find this style helps with readability, keeps code close to where it is actually used, and like how local functions get indented by tools like Spade to show the hierarchy well.
An example of some pseudo-code that uses both would be rendering visuals using Win2D:
public void RenderSceneZed(){
// asserts
...
CheckLayoutMeasurements();
RenderBackgroundLayer();
RenderForegroundLayer();
RenderUpdateLayer();
RenderForemostLayer();
void CheckLayoutMeasurements(){
...
CheckLayout(a);
CheckLayout(b);
CheckLayout(c);
bool CheckLayout(object asdf){
...
return check;
}
}
void RenderBackgroundLayer(){
...
ds.FillGeometry(CreateSomeShape(someSize), x, y, Colors.Green);
ds.FillGeometry(CreateSomeShape(someSizez), x, y, Colors.Green);
ds.FillGeometry(CreateSomeShape(someSizea), x, y, Colors.Green);
}
void RenderForegroundLayer(){
ds.FillGeometry(CreateAnotherShape(someSize), x, y, Colors.Green);
ds.FillGeometry(CreateAThirdShape(someSizez), x, y, Colors.Green);
ds.FillGeometry(CreateSomeShape(someSizea), x, y, Colors.Green);
}
void RenderUpdateLayer(){
...
}
void RenderForemostLayer(){
...
}
CanvasGeometry CreateSomeShape(Size size){
...
return new CanvasGeometry(...);
}
CanvasGeometry CreateAnotherShape(Size size){
...
return new CanvasGeometry(...);
}
CanvasGeometry CreateAThirdShape(Size size){
...
return new CanvasGeometry(...);
}
}
Description
As per the title, it would be nice if CodeMaid had an option to sort local functions while reorganizing a file.