File size: 4,440 Bytes
40c7241 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | {
"var template": {
"prefix": ["var"],
"body": ["var ${1:varName}: ${2:type} = ${3:value}"],
"description": "variable declaration"
},
"let template": {
"prefix": ["let"],
"body": ["let ${1:constantName}: ${2:type} = ${3:value}"],
"description": "constant declaration"
},
"import symbol": {
"prefix": ["import"],
"body": [
"import ${1:symbol} as ${2:newName} from ${3:packageName}"
],
"description": "import symbol with nickname"
},
"import ALL": {
"prefix": ["import", "all"],
"body": [
"import * from ${1:packageName}"
],
"description": "import ALL symbols from package"
},
"func declaration": {
"prefix": ["func"],
"body": [
"func ${1:functionName}(${2:argName: ${3:argType}}) -> ${4:returnedType} {",
"\t${5}",
"\t return ${6:returnedValue}",
"}"
],
"description": "function declaration"
},
"lambda": {
"prefix": ["$(", "lambda", "closure"],
"body": [
"$(${1:argName}) {",
"\t${2}",
"\t return ${3:value}",
"}"
],
"description": "template of lambda"
},
"type of function": {
"prefix": ["->", "func", "$->", "type"],
"body": [
["func {(${1:argType}) -> ${2:returnedType}}"]
],
"description": "type of function"
},
"foreach": {
"prefix": ["for", "foreach"],
"body": ["for ${1:i}, ${2:v} in ${3:array} {", "\n\t$4", "\n}"],
"description": "foreach loop for arrays"
},
"for": {
"prefix": ["for", "range"],
"body": ["for ${1:i} in ${2:0} .. ${3:N} {", "\n\t$4", "\n}"],
"description": "foreach loop for arrays"
},
"for with step": {
"prefix": ["for", "range", "step"],
"body": ["for ${1:i} in ${2:0}, ${3:1} .. ${4:N} {", "\n\t$5", "\n}"],
"description": "foreach loop for arrays"
},
"UI_READ_DI": {
"prefix": ["UI", "READ", "UI_READ_DI", "DI"],
"body": ["UI_READ_DI(UI_${1:1})"],
"description": "Read discrete input signal"
},
"UI_READ_AI": {
"prefix": ["UI", "READ", "UI_READ_AI", "AI"],
"body": ["UI_READ_AI(UI_${1:1})"],
"description": "Read Analog input signal"
},
"UI_CFG": {
"prefix": ["UI", "CFG", "UI_CFG", "mode"],
"body": ["UI_CFG(UI_${1:1}, UI_MODE_${2:DI/AI/TEMP})"],
"description": "Set UI mode"
},
"UI_CFG_SET_RANGE": {
"prefix": ["UI", "CFG", "UI_CFG_SET_RANGE", "RANGE"],
"body": ["UI_CFG_SET_RANGE(UI_${1:1}, ${2:minValue}, ${3:maxValue}, ${4:offset})"],
"description": "Set range for AI"
},
"UI_CFG_SET_B": {
"prefix": ["UI", "CFG", "UI_CFG_SET_B", "coef"],
"body": ["UI_CFG_SET_B(UI_${1:1}, ${2:3435/3950/...})"],
"description": "Set coefficient B for NTC10K."
},
"RELAY_SET": {
"prefix": ["RELAY_SET", "DO"],
"body": ["RELAY_SET(RELAY_${1:1}, ${2:true/false})"],
"description": "Set relay output"
},
"RELAY_TOGGLE": {
"prefix": ["RELAY_TOGGLE", "DO"],
"body": ["RELAY_TOGGLE(RELAY_${1:1})"],
"description": "Toggle relay output"
},
"RELAYS_SET": {
"prefix": ["RELAYS_SET", "DO", "RELAYS"],
"body": ["RELAYS_SET(${1:pinsMask}, ${2:true/false})"],
"description": "Set relays output with mask"
},
"RELAYS_TOGGLE": {
"prefix": ["RELAYS_TOGGLE", "DO"],
"body": ["RELAYS_TOGGLE(${1:pinsMask})"],
"description": "Toggle relays output with mask"
},
"AO_OUTPUT": {
"prefix": ["AO_OUTPUT", "AO"],
"body": ["AO_OUTPUT(AO_${1:1}, ${2:0..10000(mV)})"],
"description": "Set analog output value in mV"
},
"Delay": {
"prefix": ["DelayMs"],
"body": ["DelayMs(${1:sleepFor(mSec)})"],
"description": "Delay current task for (mSec)"
},
"UART_CFG": {
"prefix": ["UART_CFG", "UART", "CFG"],
"body": ["UART_CFG(UART_COM_${1:0}, ${2:9600}, UART_PARITY_${3:NO/EVEN/ODD}, UART_${4:ONE/TWO}_STOPBIT)"],
"description": "Set UART config"
},
"Create Font": {
"prefix": ["Create", "Font"],
"body": ["CreateFont(${1:fontName}, \"./${2:pathToTTF}\", ${3:fontSize})"],
"description": "Create font from file"
},
"Create Image": {
"prefix": ["Create", "Image", "IMG"],
"body": ["CreateIMG(${1:imageName}, \"./${2:pathToImageFile}\")"],
"description": "Create Image from file"
},
"Println": {
"prefix": ["Print"],
"body": [
"Println(`${1}`)"
],
"description": "Println template"
},
"Print": {
"prefix": ["Print"],
"body": [
"Print(`${1}`)"
],
"description": "Print template"
}
}
|