rf
rf copied to clipboard
rf: ex and replace one statement with a couple of statements
hi,
I've tried to use rf ex to replace one statement with a pair of statements.
I tried the following:
ex {
import "gioui.org/op";
import "gioui.org/op/clip";
var o *op.Ops;
var p clip.Path;
var sty clip.StrokeStyle;
var width float32;
p.Stroke(width, sty).Add(o) -> \
p.Op().Add(o) \
clip.StrokeOp{ \
Width: width, \
Cap: sty.Cap, \
Join: sty.Join, \
}.Add(o);
}
ie: replacing:
p.Stroke(width, sty).Add(o)
with:
p.Op().Add(o)
clip.StrokeOp{
Width: width,
Cap: sty.Cap,
Join: sty.Join,
}
trying to run the above ex script, I get:
$> rf ex ...
ex: missing substitution in example: p.Stroke(width, sty).Add(o) ->
is this something that should be possible to achieve with rf ex (or with rf at all) ?
ex currently only supports replacement with a single statement.
I suppose we could make it so that if you do -> { ... } then maybe we could drop the { } during the insert, although then if you want braces you'd have to double them I guess. Worth keeping mind for the next iteration but for now unlikely to happen.