about summary refs log tree commit diff stats
path: root/js/baba-yaga/dev/vscode/snippets/baba-yaga.json
diff options
context:
space:
mode:
Diffstat (limited to 'js/baba-yaga/dev/vscode/snippets/baba-yaga.json')
-rw-r--r--js/baba-yaga/dev/vscode/snippets/baba-yaga.json133
1 files changed, 133 insertions, 0 deletions
diff --git a/js/baba-yaga/dev/vscode/snippets/baba-yaga.json b/js/baba-yaga/dev/vscode/snippets/baba-yaga.json
new file mode 100644
index 0000000..c791ede
--- /dev/null
+++ b/js/baba-yaga/dev/vscode/snippets/baba-yaga.json
@@ -0,0 +1,133 @@
+{
+  "Function Definition": {
+    "prefix": "func",
+    "body": [
+      "${1:functionName} : ${2:parameters} -> ${3:body};"
+    ],
+    "description": "Define a function"
+  },
+  "Typed Function": {
+    "prefix": "tfunc",
+    "body": [
+      "${1:functionName} : (${2:param1}: ${3:Type1}, ${4:param2}: ${5:Type2}) -> ${6:ReturnType} -> ${7:body};"
+    ],
+    "description": "Define a typed function"
+  },
+  "When Expression": {
+    "prefix": "when",
+    "body": [
+      "when ${1:expression} is",
+      "  ${2:pattern1} then ${3:result1}",
+      "  ${4:pattern2} then ${5:result2}",
+      "  _ then ${6:default};"
+    ],
+    "description": "Pattern matching with when expression"
+  },
+  "Result Type": {
+    "prefix": "result",
+    "body": [
+      "when ${1:expression} is",
+      "  Ok ${2:value} then ${3:success}",
+      "  Err ${4:error} then ${5:failure};"
+    ],
+    "description": "Handle Result type with pattern matching"
+  },
+  "List": {
+    "prefix": "list",
+    "body": [
+      "[${1:item1}, ${2:item2}, ${3:item3}]"
+    ],
+    "description": "Create a list"
+  },
+  "Table": {
+    "prefix": "table",
+    "body": [
+      "{${1:key1}: ${2:value1}, ${3:key2}: ${4:value2}}"
+    ],
+    "description": "Create a table"
+  },
+  "Map": {
+    "prefix": "map",
+    "body": [
+      "map (${1:x} -> ${2:expression}) ${3:list}"
+    ],
+    "description": "Apply function to list elements"
+  },
+  "Filter": {
+    "prefix": "filter",
+    "body": [
+      "filter (${1:x} -> ${2:predicate}) ${3:list}"
+    ],
+    "description": "Filter list by predicate"
+  },
+  "Reduce": {
+    "prefix": "reduce",
+    "body": [
+      "reduce (${1:acc} ${2:item} -> ${3:expression}) ${4:initial} ${5:list}"
+    ],
+    "description": "Fold list to single value"
+  },
+  "IO Output": {
+    "prefix": "io.out",
+    "body": [
+      "io.out ${1:value};"
+    ],
+    "description": "Print to console"
+  },
+  "IO Input": {
+    "prefix": "io.in",
+    "body": [
+      "io.in"
+    ],
+    "description": "Read from console"
+  },
+  "String Function": {
+    "prefix": "str",
+    "body": [
+      "str.${1:concat|split|join|length|substring|replace|trim|upper|lower} ${2:arguments}"
+    ],
+    "description": "String operation"
+  },
+  "Math Function": {
+    "prefix": "math",
+    "body": [
+      "math.${1:abs|sign|floor|ceil|round|trunc|min|max|clamp|pow|sqrt|exp|log|sin|cos|tan|asin|acos|atan|atan2|deg|rad|random|randomInt} ${2:arguments}"
+    ],
+    "description": "Math operation"
+  },
+  "Type Declaration": {
+    "prefix": "type",
+    "body": [
+      "${1:variableName} ${2:Type};"
+    ],
+    "description": "Declare a typed variable"
+  },
+  "Variable Assignment": {
+    "prefix": "var",
+    "body": [
+      "${1:variableName} : ${2:value};"
+    ],
+    "description": "Assign a value to a variable"
+  },
+  "Comment": {
+    "prefix": "//",
+    "body": [
+      "// ${1:comment}"
+    ],
+    "description": "Single line comment"
+  },
+  "Arrow Function": {
+    "prefix": "arrow",
+    "body": [
+      "${1:parameters} -> ${2:body}"
+    ],
+    "description": "Anonymous function"
+  },
+  "Curried Function": {
+    "prefix": "curry",
+    "body": [
+      "${1:param1} -> ${2:param2} -> ${3:body}"
+    ],
+    "description": "Curried function"
+  }
+}