Extract Type Refactoring

Extract a type into its own definition and improve the reusability in your code.

If you have an anonymous type defined, you can extract it into a standalone type and reuse it across your code.

Invoke Refactor this with ^T (macOS) / Ctrl+Alt+Shift+T (Windows/Linux), on the anonymous type, then select the Extract type from the list of available refactorings.

Give it a name and start reusing the newly created type in your code.


Related Resources

Create a Function in Another Package
Create a Function in Another Package
Type a non-existing function name and generate its implementation in a package of your choice.
Empower your `Printf`-like functions with coding assistance
Empower your `Printf`-like functions with coding assistance
Provide hints and highlights for message formats in custom `Printf`-like functions.
Introduce Parameters from Unresolved References in your Code
Introduce Parameters from Unresolved References in your Code
Change a function or method signature by introducing parameters directly from unresolved references