DevToys icon indicating copy to clipboard operation
DevToys copied to clipboard

Sort Text Lines Alphabetically

Open csim opened this issue 2 years ago • 2 comments

What's the Problem?

No response

Solution/Idea

Love this tool, Thank You!

I think it would be a good idea to add a feature to sort text lines alphabetically. This is useful when you want to easily sort text ini file lines or xml elements from a configuration file.

Alternatives

Visual Studio has this feature, buried under deep menus. There are also web based tools to sort lines alphabetically.

Priorities

Capability Priority
This proposal will allow developers to accomplish W Must
This proposal will allow end users to accomplish X Should
This proposal will allow developers to accomplish Y Could
This proposal will allow end users to accomplish Z Won't

DevToys Version

Version 1.0.9.0 | X64 | RELEASE | 8bcfa60 | 8bcfa60

Comments

No response

csim avatar Aug 17 '22 17:08 csim

You mention Ini & Xml files. A strict alphabetic sorting of either of those files would destroy them. How are you envisioning this working?

  • The tool recognizes the file, and does a file-specific sort?
  • The user selects a set of lines and only those are sorted?

The former would be quite useful, but QUITE involved if we want to cover a reasonable number of file types.
The latter would be much simpler to implement, but still probably better handled by a text editor.

jamescurran avatar Aug 17 '22 18:08 jamescurran

I would only want the tool to sort lines alphabetically with no detection of file type.

For example, often times developers will add dependencies to a project file (csproj) out of alphabetical order. If the project has many many dependencies it can be difficult to scan the file for a specific dep, so I like to sort the lines alphabetically. Assuming (of course) that each xml element has the same order of attributes, sorting the lines alphabetically is useful to keep the file organized. I just want to copy out the element lines from the csproj, order them in devtoys, then paste them back.

This same thing happens with app.config key/value pairs.

csim avatar Aug 17 '22 22:08 csim

Duplicate with #232

veler avatar Mar 18 '23 05:03 veler