StringManipulation icon indicating copy to clipboard operation
StringManipulation copied to clipboard

Wrap each line into template, "Surround With" analog

Open PsychodelEKS opened this issue 4 years ago • 5 comments

Add an option to wrap each line into some construction (also could prepend and append), as IDEA does not have built in feature to treat selection for "Surround With" as separate lines.

That`s useful when creating SQL requests from CSV lists for example: from

site1.com
site2.com
site3.com
...
site10000.com

into

('site1.com', 0, 1),
('site2.com, 0, 1),
('site3.com, 0, 1),
...
('site10000.com, 0, 1),

Now I have to use multi-caret mode editing, but it's painfully slow to work with 10k+ lists (though I've manually set max caret count to 5k).

PsychodelEKS avatar Oct 27 '21 19:10 PsychodelEKS

seems like you need this https://www.jetbrains.com/help/idea/tutorial-finding-and-replacing-text-using-regular-expressions.html#capture_groups_and_backreference

krasa avatar Oct 27 '21 19:10 krasa

image

krasa avatar Oct 27 '21 19:10 krasa

seems like you need this https://www.jetbrains.com/help/idea/tutorial-finding-and-replacing-text-using-regular-expressions.html#capture_groups_and_backreference

ye, that`s a way out, but needs regexp knowledge and plugin-builtin feature would've been handy imo =) Though thanks for an additional idea, seems to do the trick with additional "In selection" option in this case.

PsychodelEKS avatar Oct 27 '21 19:10 PsychodelEKS

Good, at least you learn regexp :-)

I would like that feature, but somehow smarter - with a scripting engine so that it can also increment and transform. But then it might be too user-unfriendly so that using something like Excel would be better.

krasa avatar Oct 27 '21 19:10 krasa

I would like that feature, but somehow smarter - with a scripting engine so that it can also increment and transform

ye, may utilize line number/counter additionally and total number, i.e: ('[2/123] site1.com', 0, 1)

PsychodelEKS avatar Oct 27 '21 21:10 PsychodelEKS