zardoy / vscode-better-snippets

Create most advanced snippets for VSCode in existence
https://marketplace.visualstudio.com/items?itemName=zardoy.better-snippets
MIT License
6 stars 0 forks source link

Postfixes integration #18

Closed zardoy closed 2 years ago

zardoy commented 2 years ago

Essential examples of real-world cases:

Draft:

{
    "name": "clear",
    "body": "clearTimeout({{expr}})",
    "when": {
        "locations": "postfix", //implies . trigger character like ts-postfix, adds {{expr}} placeholder to body
        "exprRegex": "Timeout$"
    }
}

Code examples:

checkInterval.clear /* -> */ clearInterval(checkInterval)
closeTimeout.clear /* -> */ clearTimeout(closeTimeout) 
zardoy commented 2 years ago

https://github.com/zardoy/vscode-better-snippets/commit/ffd7a4a1c6930efdf97fb1f3314ad2830a872962