All Projects → wix → Vscode Glean

wix / Vscode Glean

Licence: mit
The extension provides refactoring tools for your React codebase

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Vscode Glean

Vscode Stylelint
A Visual Studio Code extension to lint CSS/SCSS/Less with stylelint
Stars: ✭ 260 (-78.22%)
Mutual labels:  vscode, vscode-extension, jsx
vscode-ecsstractor
Extracting selectors from HTML / JSX / TSX and generate CSS file.
Stars: ✭ 45 (-96.23%)
Mutual labels:  jsx, vscode, vscode-extension
Cform Vscode
CloudFormation extension for Visual Studio Code
Stars: ✭ 73 (-93.89%)
Mutual labels:  vscode, vscode-extension
Vue Theme Vscode
+200.000 installs ⬇️ Theme for Visual Studio Code inspired by Vue.js, with support for more popular languages, trying to maintain a perfect harmony of colors.
Stars: ✭ 54 (-95.48%)
Mutual labels:  vscode, vscode-extension
Azure Iot Developer Kit
A curated list of awesome Azure IoT Developer Kit projects and resources.
Stars: ✭ 73 (-93.89%)
Mutual labels:  vscode, vscode-extension
Tailwindcss Intellisense
Intelligent Tailwind CSS tooling for Visual Studio Code
Stars: ✭ 1,066 (-10.72%)
Mutual labels:  vscode, vscode-extension
Vscode Smoothtype
VS Code extension to add cursor transitions while typing, similar to MS Office and the Windows 10 Mail app.
Stars: ✭ 54 (-95.48%)
Mutual labels:  vscode, vscode-extension
Vscode Map Preview
VSCode map preview extension
Stars: ✭ 70 (-94.14%)
Mutual labels:  vscode, vscode-extension
Vscode Project Manager
Project Manager Extension for Visual Studio Code
Stars: ✭ 1,022 (-14.41%)
Mutual labels:  vscode, vscode-extension
Vscode Sftp
Super fast sftp/ftp extension for VS Code
Stars: ✭ 1,121 (-6.11%)
Mutual labels:  vscode, vscode-extension
Vscode Svgviewer
SVG Viewer for Visual Studio Code
Stars: ✭ 60 (-94.97%)
Mutual labels:  vscode, vscode-extension
Vscode Csscomb
🔌 VS Code plugin for CSScomb — CSS coding style formatter.
Stars: ✭ 63 (-94.72%)
Mutual labels:  vscode, vscode-extension
Vscode Openshift Tools
Microsoft Visual Studio Code extension for OpenShift
Stars: ✭ 51 (-95.73%)
Mutual labels:  vscode, vscode-extension
Vscode Ruby Test Adapter
A Ruby test adapter extension for the VS Code Test Explorer
Stars: ✭ 50 (-95.81%)
Mutual labels:  vscode, vscode-extension
Ngrok For Vscode
A VSCode extension to control ngrok
Stars: ✭ 75 (-93.72%)
Mutual labels:  vscode, vscode-extension
Vscode Hack
Hack language & HHVM debugger support for Visual Studio Code
Stars: ✭ 45 (-96.23%)
Mutual labels:  vscode, vscode-extension
Vue Vscode Snippets
These snippets were built to supercharge my workflow in the most seamless manner possible.
Stars: ✭ 1,083 (-9.3%)
Mutual labels:  vscode, vscode-extension
Vscode Rsync
rsync extension for visual studio code
Stars: ✭ 68 (-94.3%)
Mutual labels:  vscode, vscode-extension
Vs Code For Node Js Development Pack
🏃 A VS Code Extension Pack to get up and running with Node.js Development
Stars: ✭ 41 (-96.57%)
Mutual labels:  vscode, vscode-extension
Vscode Stylefmt
🔌 VS Code plugin for stylefmt— Format your CSS using stylefmt.
Stars: ✭ 42 (-96.48%)
Mutual labels:  vscode, vscode-extension

VSCode Glean

The extension provides refactoring tools for your React codebase

Build Status

The extension provides refactoring tools for your React codebase: extract JSX into a new component, convert Class Components to Functional Components, wrapping with Hooks and more!

Highlights

  • Allows extracting JSX into new component
  • Allows converting Class Components to Functional Components and vice-verse
  • Allows wrapping JSX with conditional
  • Allows renaming state variables and their setters simultaneously.
  • Allows wrapping code with useMemo, useCallback or useEffect
  • Moving code between files
  • Typescript support
  • ES2015 modules support
  • CommonJS modules support

Installation

Go to the link below and click Install.

Visual Studio Code Market Place: Glean

Features

Extracting JSX into a new Component

Glean allows easy extraction of JSX into new React components (in the same or other file). Just select the JSX to extract, and Glean will handle all the rest:

  • Generate Class or Functional 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.

Example of JSX extraction

Converting Class Component to Functional Component

Glean seamlesly automates convertion of class components to functional component, while take care of all the complexity:

  • Converts setState calls to useState
  • Converts componentDidMount and componentWillUnmount to useEffect
  • Converts class properties to useRef
  • Wraps call non-Lifecycle methods with useCallback

WARNING!!! If You are using React version older than 16.8.0, This refactoring will delete all Lifecycle methods and setState calls!

Example of Hooks Support

Converting Functional Component to Class Component

Example of Stateless to Stateful Component Conversion

Rename State Variable

Rename any state variable and let Glean rename its setter accordingly for You!

Example of Rename State

Wrap with Hook (useMemo, useCallback or useEffect)

Example of Rename State

Render Conditionally

Example of Render Conditionally

Extract to file

Select text and either VSCode's code suggestion (aka "Lightbulb") or Command Pallet ('Extract to File' command) to extract the text.

Example of Javascript Extraction

Configuration Options

glean.jsModuleSystem (Default: 'esm')

Determines how the selected code will be exported/imported. Valid options are 'esm' and 'commonjs'.

glean.jsFilesExtensions (Default: [ "js", "jsx", "ts", "tsx" ])

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.

glean.switchToTarget (Default: false)

Determines whether VSCode should switch to target file after extracting.

glean.experiments (Default: [])

A list of enabled experimental features. Available experimental features:

glean.showConversionWarning (Default: true)

Determines whether VSCode should show conversion warning when converting Class Component to Functional Component.

Contribute

Feel free to open issues or PRs!

Getting started

In order to start working all you need to do is:

$ git clone [email protected]:wix/vscode-glean.git
$ cd vscode-glean
$ npm install
$ code .

Running Extension

  • Go to VSCode debug sidebar
  • Select Extension from the dropdown
  • Hit F5

Running Tests

  • Go to VSCode debug sidebar
  • Select Extension Tests from the dropdown
  • Hit F5

Commit messages

Please refer to to the following guide.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].