emmetio / sublime-text-plugin

The essential toolkit for web-developers
https://emmet.io
MIT License
255 stars 29 forks source link

Feature request: Add "emmet_decrement_number" #108

Closed vfonic closed 4 years ago

vfonic commented 4 years ago
NOTE: I figured it out, read the explanation below. Related: Increment/Decrement Number Unexpected Behavior #68 I, as some other developers as well, was upgraded to the latest version of Emmet, which broke many things. One of the things it broke for me was increment/decrement of number values. I just went to fix it by adding Key Bindings manually. Here's what I added: ```json { "keys": ["ctrl+down"], "command": "emmet_decrement_number", "args": { "delta": -1 } }, { "keys": ["ctrl+up"], "command": "emmet_increment_number", "args": { "delta": 1 } }, { "keys": ["alt+down"], "command": "emmet_decrement_number", "args": { "delta": -0.1 } }, { "keys": ["alt+up"], "command": "emmet_increment_number", "args": { "delta": 0.1 } }, ``` This works for "ctrl+up" and "alt+up", but both decrement commands don't work.

Ok, I just figured that there's only one command "emmet_increment_number". I'd suggest adding both "emmet_increment_number" and "emmet_decrement_number" even if the other one is just incrementing negatively. Heck, you even had a bug because the delta was not negative for decrement (increment negatively). This is very popular approach in Ruby and Rails community, multiple methods doing the same thing, so you can choose your favorite.

vfonic commented 4 years ago

Hey @sergeche!

Thanks for addressing this!

I just noticed that it says 'Increment number' here: https://github.com/emmetio/sublime-text-plugin/commit/963e31506e44032433634f5cab0beaafeedc6da7#diff-5bc02cefb3ea9e27f1a6776eabd1935dR257

Not sure if that's what it's supposed to say because that's an action name or perhaps it remained from copying?

sergeche commented 4 years ago

It's just action tracker for stats, not relevant to actual behavior