Refactoring in CodeMix

Use source code refactoring to improve the quality and maintainability of your project by restructuring code without modifying runtime behavior. Refactoring in Codemix is provided by a language service. CodeMix has built-in support for TypeScript and JavaScript refactoring through the TypeScript language service. Support for other languages is provided through the Code OSS extensions that contribute language services. 

The CodeMix plugin is compatible with Eclipse-based IDEs and tools—like MyEclipse, Spring Tools Suite and JBoss Tools—so you can continue working in the environment you are accustomed to.

Extract Method

Select the source code to extract, press Ctrl+Shift+P, and then select Refactor to see available refactorings. Source code fragments can be extracted into a new method, or into a new function at various different scopes.

Extract Variable

TypeScript language service provides Extract to const refactoring to create a new local variable for the currently selected expression. When working with classes, you can also extract a value to a new property.

Rename Symbol

Renaming is a common operation related to refactoring source code and CodeMix has a separate Rename Symbol command. To rename a symbol, press Alt+Shift+R, type the new  name, and then press Enter. Usages of the symbol are automatically updated in the current file. For languages with advanced support, like TypeScript, usages of the symbol are also updated across other files. The specific language extension determines the level of support received during renaming of symbols.

Preview of Rename Symbol

Documentation is licensed under the Creative Commons Attribution 3.0 United States License. Original work from vscode-docs GitHub repository has been modified.