rjsx-mode
rjsx-mode copied to clipboard
Vanish tag
Especially with React 16, it would be nice to have a single command to unwrap the children of a tag and splice them into the surroundings:
let c = <Parent><Child/><Parent>; // point on Parent
after vanishing parent should give:
let c = <Child/>; // point right before Child
- [X] Initial implementation
- [ ] Clean up whitespace outside the removed tag (e.g., extra newlines)
- [ ] Clean up whitespace when first/last child are text nodes
- [ ] Fix indentation for children
- [ ] If only child is text, wrap it in quotes
- [ ] Set point and mark to the start/end of the child region (or reversed if point was on the closer)
- [ ] Add tests