Tyriar / vscode-sort-lines

Visual Studio Code extension to sort lines of text
https://marketplace.visualstudio.com/items/Tyriar.sort-lines
MIT License
146 stars 42 forks source link

added function to sort lines by marked ranges #126

Closed quantenzitrone closed 11 months ago

quantenzitrone commented 11 months ago

completes #125

i didn't write a formatter (sorting on save) in the end, because most of the time you want to have an actual formatter as the formatter for your language and vscode can't have multiple formatters without another extension. For now, a function i can call every time i need it suffices.

I changed the lib compiler option to TS2017, because I needed the Object.entries() function. Without it, the code was horribly unsafe, indexing the transformerSequences with a string, or would have become more complicated.

Feel free to criticize my code, it is probably shitty, since it is the first JavaScript or TypeScript code I ever wrote.

If you don't want the random edits the JS formatter made at the other places in the file, i can revert that if you want.

If you don't want this in your extension at all, it's also fine, i can just use my own version and anyone else will probably be able to find my fork through this.

Also, this is not really tested enough, that's why i made it a draft for now.

Tyriar commented 11 months ago

Sorry I'd rather keep this extensions scope smaller. Please feel free to fork this and publish your own based on it though.

quantenzitrone commented 11 months ago

How can i build the .vsix file? I know I can test the extension locally with F5, and Microsoft has some command line program vsce I can use to publish it to the Microsoft store, but I can't find any information, on how to actually produce the .vsix file I can upload to open-vsx for example.

Tyriar commented 11 months ago

@Quantenzitrone vsce creates the vsix when you run vsce publish. Lots of useful info on https://code.visualstudio.com/api/working-with-extensions/publishing-extension around this