HiDeoo/toggler

No selection: look for full word

Closed this issue · 3 comments

There are some issues due to the order the words are run through that I think could be solved by looking for a full-word match around the cursor.

Like stop being toggled to sbottom and yes to xes.

This is actually a design choice I made in both version (VSC & Atom) based on my own usage, so you could toggle things like top in marginTop and tons of other similar cases where the only way to avoid this would be a proper ordering.

I don't have the time right now and I'm not even using the Atom version anymore but I would be open to consider a PR adding this full-word matching as an option (disabled by default).

Ok, thanks for the response!

One question though: it means that in order to toggle marginTop to marginBottom, you can't select the word and the cursor needs to be near the end of the word, right? Isn't it a bit weird?

Maybe the full-word detection could take the letter case into account but this might start to become a bit too complex.

I don't remember if the code of the Atom one match the VSC one exactly, but yeah at least in VSC having the cursor at the end is enough.

Casing could be an idea, altho you would want to support a - too I guess.