-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature request] Sort lines by selection #129
Comments
You want to sort lines by the length of the key? |
Not really. I'd like to sort by the length of what I selected PS thisdict = { # <----- oops, this is "invalid JSON" line
"brand": "Ford",
"year": 1964
} array( // And this does not look like JSON at all
"Peter"=>"35",
"Ben"=>37
); Whether it would be really convenient to use screencast.2023-09-26.10-46-27.mp4 |
@amok, does the following extension do exactly what you want? Sort Lines by Selection by earshinov. |
Unfortunately, nope. It applies natural sort to the selection. The issue primarily is about sorting by length, something like: const selected = ['aaa', 'aa', 'xx', 'fffff']
const sorted = selected.toSorted((a, b) => a.length - b.length)
// --> ['aa', 'xx', 'aaa', 'fffff'] |
Use case: sort lines by keys
Example
Execute "sort lines" extension command
output:
This would be similar to "JSON: sort by keys", but this functionality is also useful for TS', Python' and other kind of objects, dicts, and also
import
s etc.The text was updated successfully, but these errors were encountered: