Skip to content
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

Ignore trailing line terminator like VSCode does #104

Closed
NotWearingPants opened this issue Sep 30, 2021 · 1 comment
Closed

Ignore trailing line terminator like VSCode does #104

NotWearingPants opened this issue Sep 30, 2021 · 1 comment

Comments

@NotWearingPants
Copy link

NotWearingPants commented Sep 30, 2021

Given a file such as this:

const hello = 5;

const foo = 1;
const bar = 2;

console.log(foo + bar);

when the cursor is at the start of the third line (foo), I select the 2 lines using either Shift+Down twice or Ctrl+L twice, then sort using this extension, the empty line after the 2 lines is also sorted.

The final result is

const hello = 5;


const bar = 2;
const foo = 1;
console.log(foo + bar);

while I expected only the middle 2 lines to swap places.

A \n is usually considered a line terminator rather than separator, and VSCode knows this so it sees my selection as 2 lines and not 3. The current solution seems to be only to finish off the selection with Left to unselect the newline at the end before running the sort commands.

I suggest adding a boolean setting for it assuming the current behavior is to be preserved.

@Tyriar
Copy link
Owner

Tyriar commented Oct 21, 2021

duplicate of #78

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants