Add expression functions with context boundaries
This commit is contained in:
parent
5085ae51aa
commit
773c34f3f4
18 changed files with 391 additions and 52 deletions
|
|
@ -82,7 +82,7 @@ for (const declaration of [
|
|||
|
||||
const prefixes = new Set(Object.values(snippets).map((snippet) => snippet.prefix));
|
||||
for (const prefix of [
|
||||
"dataclass", "genericfun", "genericclass", "tablerow", "embed", "coroutinescope", "launch", "async", "enum", "match", "matchvalue", "mapto", "safe", "nonnull", "resultfun", "resultmatch", "defer", "foreach", "sqlfetch",
|
||||
"dataclass", "exprfun", "withcontext", "genericfun", "genericclass", "tablerow", "embed", "coroutinescope", "launch", "async", "enum", "match", "matchvalue", "mapto", "safe", "nonnull", "resultfun", "resultmatch", "defer", "foreach", "sqlfetch",
|
||||
"sqlsingle", "sqliterator", "sqlinsertnothing", "sqlinsertupdate", "sqlupdatereturning"
|
||||
]) {
|
||||
assert(prefixes.has(prefix), `snippets are missing prefix ${prefix}`);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,16 @@
|
|||
],
|
||||
"description": "Gotlin function"
|
||||
},
|
||||
"Expression Function": {
|
||||
"prefix": "exprfun",
|
||||
"body": ["fun ${1:name}(${2}) = ${3:expression}"],
|
||||
"description": "Gotlin expression-bodied function"
|
||||
},
|
||||
"With Go Context": {
|
||||
"prefix": "withcontext",
|
||||
"body": ["withContext(${1:request}.context()) {", " $0", "}"],
|
||||
"description": "Establish an ambient coroutine context from a Go context"
|
||||
},
|
||||
"Main Function": {
|
||||
"prefix": "main",
|
||||
"body": [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue