2015.02.24 10:39 tools/CLion

CLion 리팩토링

Code refactorings are used to restructure your existing code without changing its external behaviour. The most popular is probably the Rename refactoring, which changes the name of a variable, method, class, etc. Refactoring is an essential technique to maintain the quality of your code, make it more readable and easier to maintain and reuse.

CLion offers you a set of code refactorings, which track down and correct the affected code references automatically. This means you can always be sure that your project will work correctly, even after large-scale changes. The list of refactorings available in CLion includes:

  • Rename (Shift+F6) renames symbols, automatically correcting all references in the code for you.
  • Change Signature (Ctrl+F6 on Windows/Linux, Cmd+F6 on OS X) helps you add/remove/reorder function parameters, change the result type or update the name of the function, all usages will be fixed as well.
  • Move (F6) moves files or directories, as well as methods, variables or constants.
  • Copy (F5) allows you to create a copy of file or directory.
  • Safe Delete (Alt+Delete on Windows/Linux, Cmd+Delete Forward on OS X) safely removes files and symbols from your code.
  • Inline (Ctrl+Alt+N on Windows/Linux, Alt+Cmd+N on OS X) replaces redundant variable usage/method calls with its initializer/declaration.
  • Extract refactoring – CLion analyses the block of code where the refactoring was invoked, detects input and output variables, together with the usages of the selected expression to replace them with the newly created:
    • Variable (Ctrl+Alt+V on Windows/Linux, Alt+Cmd+V on OS X)
    • Constant (Ctrl+Alt+C on Windows/Linux, Alt+Cmd+C on OS X)
    • Parameter (Ctrl+Alt+P on Windows/Linux, Alt+Cmd+P on OS X)
    • Typedef (Ctrl+Alt+K on Windows/Linux, Alt+Cmd+K on OS X)
    • Define (Ctrl+Alt+D on Windows/Linux, Alt+Cmd+D on OS X)
    • Method (Ctrl+Alt+M on Windows/Linux, Alt+Cmd+M on OS X)
  • Pull Members Up safely moves class members to a superclass.
  • Push Members Down safely moves class members to a subclass.

You can use Refactor This (Ctrl+Alt+Shift+T on Windows/Linux, Ctrl+T on OS X) to get the list of the refactorings available in the current scope.

Watch CLion’s refactorings in action:

'tools > CLion' 카테고리의 다른 글

CLion 리팩토링  (0) 2015.02.24
Posted by IT아지크
이전버튼 1 2 3 4 5 6 7 ··· 23 이전버튼

블로그 이미지




 « |  » 2018.03
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

최근에 받은 트랙백

글 보관함