Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add code action to extract local functions #39745
This PR allows users to extract local functions from methods in C#. It works similarly to the existing extract method code action and much of the code builds off the existing implementation.
The code action respects the user's IDE0062 preference, csharp_prefer_static_local_function. However, even if a user prefers static local functions, a static modifier will only be generated if it is possible in the current context.
If extracting code from an existing local function, a new local function will be generated within the existing local function.