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 disable builtin postfixes completely #101

Closed zardoy closed 1 year ago

zardoy commented 1 year ago

Hi! As I understand, with https://github.com/ipatalas/vscode-postfix-ts/issues/40 there is an option to override, but not disable postfix as having an empty when makes postfix show anywhere.

I propose following:

"postfix.configureBuiltin": {
    // overriding postfix or not, just drop it
    "ifnot": false,
    // and probably add more configuration in future?
    "if": {
        "mode": "typeof"
    }
}
ipatalas commented 1 year ago

This should be fairly easy as all templates already have their name assigned. I'd start with something simple like:

"postfix.disabledTemplates": ["forof", "var", "etc."]
ipatalas commented 1 year ago

https://github.com/ipatalas/vscode-postfix-ts/commit/36650a2864737cb04502e6d59ee4369d31f417f5

That was easy :) I need to add some tests for that too before releasing.

zardoy commented 1 year ago

@ipatalas WDYT of renaming it postfix.disabledBuiltinTemplates since it actually disables builtin templates only

zardoy commented 1 year ago

Also change setting schema so it can be configured via settings UI:

{
  "type": "array",
  "markdownDescription": "Name all built-in templates that you want to disable, eg. `forof`",
  "items": {
    "type": "string"
  },
  "uniqueItems": true,
  "default": []
}
ipatalas commented 1 year ago

Makes sense, changed: https://github.com/ipatalas/vscode-postfix-ts/commit/7e504412a9ea73a2e0f12512895ace5e16630314

ipatalas commented 1 year ago

All right, new version released along with this feature.

TBH I used that too, for instance to disable rather useless var template.

Out of curiosity - which templates did you disable any why? This might bring some more ideas to the table.

zardoy commented 1 year ago

Out of curiosity - which templates did you disable any why

Disabled:

Legacy:

Just not needed:

Overriden:

Also I think arg with simple body $1({{expr}})$2 should be included out of the box and super useful and general purpose.