The extension provides refactoring tools for your React/Javascript/Typescript codebase
The extension provides refactoring tools for your React codebase: extract JSX into a new component, convert Functions to Stateful React Components and more! In addition, you can extract regular Javascript/Typescript code between files, while handling exporting the selected code from the old location and importing in the new one!
- Allows extracting JSX into new components as well as other React code refactoring options
- Moving code between files
- Typescript support
- ES2015 modules support
- CommonJS modules support
- Plain Text support
Go to the link below and click Install
.
Visual Studio Code Market Place: Glean
Select text and use either VSCode's code suggestion (aka "Lightbulb") or Command Pallet ('Extract to File' command) to extract the text.
Glean allows easy extraction of JSX into new React components. Just select the JSX to extract, and Glean will handle all the rest:
- Generate Stateful or Stateless Component, such that the extracted JSX will continue to function.
- It will identify all inputs to the newly created component.
- Replace extracted JSX with newly created component, while providing it with all the props.
WARNING!!! This refactoring will delete all Lifecycle methods and setState calls!
Determines how the selected code will be exported/imported. Valid options are 'esm' and 'commonjs'.
List of extensions of files that should be treated as javascript files. This determines whether or not the snippet will be exported and imported. The snippet will be treated as javascript only if the extension of both origin and target files appears in this list.
Determines whether VSCode should switch to target file after extracting.
Feel free to open issues or PRs!
In order to start working all you need to do is:
$ git clone git@github.com:wix/vscode-glean.git
$ cd vscode-glean
$ npm install
$ code .
- Go to VSCode debug sidebar
- Select
Extension
from the dropdown - Hit
F5
- Go to VSCode debug sidebar
- Select
Extension Tests
from the dropdown - Hit
F5