skip to Main Content

When I try to right-click on a block of code that I’ve selected, the only option shown is "surround with". I’m trying to do "extract method" on the code but I can’t seem to find the option.

I’m following a Unity tutorial. According to the tutorial, when I select this line of code, it’s supposed to show an "extract method" option but the only option that shows up for me is "surround with". I’m really new to this so any help will be very much appreciated.

this is how it looks like

2

Answers


  1. In Visual Studio Code (note that Visual Studio is a completely different software) you have to have according plug-in for according language(s).

    From https://code.visualstudio.com/docs/editor/refactoring

    Refactorings are provided by a language service. VS Code has built-in support for TypeScript and JavaScript refactoring through the TypeScript language service.

    Refactoring support for other programming languages is enabled through VS Code extensions that contribute language services.

    => If you don’t have such option but someone else does (assuming they are indeed using VS Code) then they have an extension installed that you haven’t.

    Here are a ton to chose from not sure of course exactly which one provides the Extract Method functionality

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search