This is an elaboration on the first item in #21901 for discussion of design and implementation of this language server feature.
Feature behavior overview
@code blocks as well as top-level members within said blocks that enable extraction of the relevant content into codebehind.<name>.razor has an existing adjacent <name>.razor.cs file to insert the extracted code into (rather than searching for all partial classes in the namespace) to avoid ambiguity and skip extra work.Some thoughts
CodeActions through OmniSharp will generally share a lot of computed data, so the detection mechanism for sets of related code actions can be condensed to reduce calls to parse the document, etc.CodeExtractionService to check whether this particular case is valid for code extraction as well as what workspace edits to make after.One piece which will make everything feel more complete is on extraction have the resultant code be indented correctly.
Most helpful comment
Feature behavior overview
@codeblocks as well as top-level members within said blocks that enable extraction of the relevant content into codebehind.<name>.razorhas an existing adjacent<name>.razor.csfile to insert the extracted code into (rather than searching for all partial classes in the namespace) to avoid ambiguity and skip extra work.