nmsmith22389 / vscode-incrementor

Advanced increment / decrement actions for (almost) anything.
13 stars 10 forks source link

More freedom for incrementor.enums.values regex #43

Open uberkael opened 22 hours ago

uberkael commented 22 hours ago

Thanks for this extension. I want to do something a bit more complex, like toggle between comparators or booleans operators, something like this

"incrementor.enums.values": [
    ...
    [ "==", "!=" ],
    [ "&&", "||" ].
    [ ">", "<", ">=", "<=" ],
    [ "+", "-", "*", "/", "%" ],
    [ "++", "--" ],
    [ "!", "~" ],
    [ "&", "|", "^", "<<", ">>" ],
    [ "&&=", "||=", "+=", "-=", "*=", "/=", "%=", "&=", "|=", "^=", "<<=", ">>="],
]

The problem is the regular expression for is too restrictive:

"incrementor.enums.values": {
    "type": "array",
    "items": {
        "type": "array",
        "items": {
            "type": "string",
            "pattern": "^\\w(?:\\-?\\w+)*$"
        }
    },
    ...

It is possible to change "^\\w(?:\\-?\\w+)*$" to "^\\S(?:\\-?\\S+)*$" ? Maybe is a breaking change. I can make a PR if is accepted.

nmsmith22389 commented 4 hours ago

Thanks for the feedback! I really want to get this extension back in working order so any help in the form of PRs you can offer would be greatly appreciated.

I'll have to double check the code to see if everything still functions without much regex restriction.

nmsmith22389 commented 4 hours ago

~Do you think adding some of the more popular ones as features (like togglable options) would be better?~

Actually I'm thinking it's probably best to just have a custom list with some defaults set. (Aside from the numbers)