Open wibotwi opened 1 month ago
cross posted to linessorter as well, I am not sure you guys share code or not
oh I found https://github.com/syllant/idea-plugin-linessorter/issues/16 which led me to https://github.com/krasa/StringManipulation which turned out can do that !
Hi, can you give me an example how it looks before sorting and how it should look like after sorting? Best, Benny
Sure.
Original (easy mode - no comments and no empty lines):
, bbb as CCC
, ccc as AAA
, aaa as BBB
Sorted by column 4:
, ccc as AAA
, aaa as BBB
, bbb as CCC
Turned out StringManipulation plugin can do this. However, in real world we also have comments and empty lines. And we also have first line, which does not start with comma.
Original (real life mode):
SELECT
ddd as DDD
, bbb as CCC
-- comment about column AAA
, ccc as AAA
-- comment about column BBB
, aaa as BBB
Sorted:
SELECT
-- comment about column AAA
ccc as AAA
-- comment about column BBB
, aaa as BBB
, bbb as CCC
, ddd as DDD
this is especially useful in SQL for code like
If I select two rows, I want it to be sorted as A,B, but default is B,A as is sorts aaa,bbb
Apparently vscode can do this, and my friends laugh at me that IntelliJ cannot do that :(