DillanCMills / tab-stop

Utility extension for VS Code to insert spaces on the current line to a user-configured column number
MIT License
1 stars 1 forks source link

Doesn't go to tab stops less than 10 #1

Closed jkyeung closed 3 months ago

jkyeung commented 3 months ago

Let's say I have column numbers 7, 9, 11, 80 as my defined tab stops.

When I put the cursor on the left edge (column 1) and invoke the command, it adds 11 spaces (so cursor ends up at column 12). I haven't been able to get it to add fewer than 10 spaces for that initial tab from the left edge.

DillanCMills commented 3 months ago

Thanks for the report. I just pushed a fix to the sort method to handle this case. It should be working in 1.0.1.

jkyeung commented 3 months ago

Wow, thanks! I was not expecting a response, let alone a same-day fix.

I notice that the one fork of your project had exactly the fix that you just put in. And that was their only commit. They should have made a PR!

DillanCMills commented 3 months ago

Oh yeah that would have been handy! It was a head-smack bug, but, of course, you have to remember that JavaScript doesn't sort a list of numbers by there value by default, but by their string representation (obviously?). Well it worked fine when the numbers have the same number of characters, and obviously I didn't test anything with 1 or 3 digits when I wrote the extension.

I'm just happy to find out there are more users of this extension than myself!