idea-kotlin-react
idea-kotlin-react copied to clipboard
Kotlin React Idea plugin
Kotlin React Tools
Can I use it?
Not yet.
Installation & Usage
Currently the plugin is compatible only with latest dev builds of IntelliJ IDEA and Kotlin.
So, at at the moment you should build it yourself: clone this repo and call ./gradlew runIde.
See CONTRIBUTING.md for more details.
Features
Click at
to see the GIF.
Generating React Components boilerplate (generating `RProps interface`, builder function and render function)

Updating DSL builder function on editing `RProps` declarations
Plugin gracefully updates DSL builder function regardless of changes: adding, renaming and changing type. Properties order are preserved. Even arbitrary builder function code supported.

All `RBuilder.child(C::class) { ... }` calls are analyzed for missed `RProps` assignments:

Creating and inspecting `RState` initialization:

Removing/creating `RProps`/`RState`:

Insepctions
RBuilder.child(C::class) { /* lambda */ } calls:
- [x] Component builder function should be named as "..."
- [x] Children is not initialized in component builder function
- [x] Builder function has outdated parameter type
- [x] Children is used in component, but not initialized
- [x] All RProps vars should be initialized
- [x] Builder function contains outdated assignments
RComponent class declaration:
- [x] Props not passed to constructor
- [x] Missed builder function
- [x] Outdated builder function
- [x] Both "State.init" and "State.init(props)" is overridden
- [x] Component has state that should be initialized
- [x] All RState vars should be initialized
- [x]
override fun State.init(props): RProps is not passed to component constructor - [x] on
children()call: Children is not initialized in component builder function
RProps/RState interface declaration:
- [x] Only var properties are allowed in RProps/RState interfaces
- [x] There are no props in RProps/RState interface
- [x] Value is not initialized in component builder function
- [x] Builder function contains outdated assignments
- [x] Builder function contains outdated parameter type
- [x] Value is not initialized in component state init function
Intentions and Quick fixes
RComponent class declaration:
- [x] Generate Component builder function
- [x] Actualize React Component builder function
- [x] Add props constructor parameter
- [ ] Initialize RState from RProps
- [ ] Create RProps for uninitialized RState
RProps/RState interface declaration:
- [x] Delete empty
RProps/RStateinterface - [x] Create
RProps/RState - [x] Delete
RProps/RStateproperty - [x] Change
valtovar
Code completion
- [x] On typing
RComponentsuper class name: createRComponentboilerplateRPropsinterface- Builder function
- override
renderfunction
- [ ] On typing
class MyComponent(props: ...: suggest ...: MyComponentProps): RComponent<MyComponentProps, RState> { ... }
Creating from usages
- [ ] RProp property
- [ ] RState property
- [ ] RComponent
Refactorings
- [ ] Change RComponent signature (RProps)
- [ ] Extract RComponent
- [ ] Inline RComponent
Actions
- [ ] Project wizard
- [ ]
HTMLtoKotlin Reactcode - [ ]
RComponentbrowser preview - [ ]
Surround with/Unwrap/removeRComponent
Other
- [ ] RComponent/RProps/RState/builder function gutter icons and navigation
- [ ] Builder function folding
- [ ] Emmet
File & Live templates
- [ ]
rcomponent:RComponentfile & live template - [ ]
render: function withRBuilderreceiver
Known bugs
- [ ] Exception on generating
RComponentboilerplate - [ ]
RComponentboilerplate formatting - [ ]
RStateproperties warnings not updated when typing in state init function - [ ]
RPropstype is not updated onRPropscreating/removing - [ ] Multiple warnings on each
RPropproperties in case of multiple builder functions
Limitions
- [ ] Detect leaking
attrs - [ ] Detect leaking
thisin state init functions - [ ] Analyze receiver data flow
- [ ] Support
this.attrs.xxx - [ ] Support
this.xxxin state init functions - [ ] Support assignment to an arbitrary variable
- [ ] Support
- [ ] Detect missing
body()call - [ ] Support inherited components
- [ ] Support multiple builder functions
- [ ] Detect
children()calls in component render functions