ipatalas / vscode-postfix-ts

Postfix notation for TypeScript/Javascript - extension for VS Code
MIT License
159 stars 43 forks source link

Add a way to invert `if`/`while` condition #81

Closed zardoy closed 1 year ago

zardoy commented 2 years ago

Example: if (a && a && b{not}) it would invert last identifier instead and it seems there is no way to invert whole condition in this case.

As a workaround I'm writing thing like a > 0.not at the end to invert an if condition.

WebStorm in example above would suggest multiple variants, however introducing this behavior would be too annoying for existing users, instead I think it can support this:

if (a && a && b).not {
    ...
}
ipatalas commented 2 years ago

This was a result of bugfix for #67. Apparently the fix wasn't perfect. I've redone the fix to apply it only where it makes sense instead of globally and now it's back to old behavior:

image

image

That's quite a big and potentially breaking change: https://github.com/ipatalas/vscode-postfix-ts/commit/a126e74e3f201507eef55108fd91cbb74b396a86 Feel free to test it, maybe you can figure out an edge case I did not find :)

ipatalas commented 1 year ago

Had a chance to test that? I guess this should no longer be a problem.

zardoy commented 1 year ago

That's quite a big and potentially breaking change: https://github.com/ipatalas/vscode-postfix-ts/commit/a126e74e3f201507eef55108fd91cbb74b396a86

I thought this commit closed it