smartparens icon indicating copy to clipboard operation
smartparens copied to clipboard

Make splicing "control structures" better

Open Fuco1 opened this issue 7 years ago • 0 comments

When splicing code like

if (....) {
 <code>
}

it should remove the {} along with the condition. Same goes for for loops, while, do, foreach and similar constructs.

A simple rule would be to kill the line up to the first { and then raise the interior.

It should also work with [] and ().

We should use hybrid sexps for resolution, so that code such as

const rows = addressList.map(function (address) {  |
    return [
        generateRow('A', address.number),
        generateRow('B', address.number),
    ]
}).reduce((acc, item) => acc.concat(item))

wont break (I either need to remove the map along with function prefix or just rise the body... this might be language specific).

Fuco1 avatar Oct 12 '17 15:10 Fuco1