ipatalas / vscode-postfix-ts

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

Template suggestion: truthy #10

Closed wmaurer closed 7 years ago

wmaurer commented 7 years ago

Thanks a lot for this extension!

I would find a 'truthy' template useful, i.e. so that expr becomes !!expr. What do you think?

ipatalas commented 7 years ago

Well, I'm not using this construction very often but still I will have something for you. I do have a plan to allow user defined templates. It should be relatively easy to implement given current implementation. I'll give it a try this weekend. Stay tuned.

ipatalas commented 7 years ago

Ok, basic custom templates are ready! Update the extension to 1.6.0 first.

For what you need just add the following to your workspace/user settings:

"postfix.customTemplates": [{
    "name": "truthy",
    "body": "!!{{expr}}",
    "description": "!!expr",
    "when": [
        "expression", "function-call", "identifier"
    ]
}]

Let me know if that helped.

wmaurer commented 7 years ago

Hey cheers, it works really well! Thanks a lot for putting the effort into this new feature.