mirror of
https://github.com/exoticorn/microw8.git
synced 2026-01-20 19:26:43 +01:00
more Sublime Text fetures
This commit is contained in:
@@ -28,13 +28,13 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trigger": "let",
|
"trigger": "let",
|
||||||
"contents": "let ${1:variable}${2:: ${3:type}} = ${4:value};",
|
"contents": "let ${1:variable} = ${2:value};",
|
||||||
"details": "let variable[: type] = value;",
|
"details": "let variable[: type] = value;",
|
||||||
"kind": "keyword"
|
"kind": "keyword"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trigger": "const",
|
"trigger": "const",
|
||||||
"contents": "const ${1:name}${2:: ${3:type}} = ${4:value};",
|
"contents": "const ${1:name} = ${2:value};",
|
||||||
"details": "const name[: type] = value;",
|
"details": "const name[: type] = value;",
|
||||||
"kind": "keyword"
|
"kind": "keyword"
|
||||||
},
|
},
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trigger": "global",
|
"trigger": "global",
|
||||||
"contents": "global mut ${1:name}${2:: ${3:type}} = ${4:value};",
|
"contents": "global mut ${1:name} = ${2:value};",
|
||||||
"details": "global mut name[: type] = value;",
|
"details": "global mut name[: type] = value;",
|
||||||
"kind": "keyword"
|
"kind": "keyword"
|
||||||
},
|
},
|
||||||
@@ -69,9 +69,9 @@
|
|||||||
"kind": "keyword"
|
"kind": "keyword"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trigger": "return",
|
"trigger": "block",
|
||||||
"contents": "return${1: expression}",
|
"contents": "block ${1:label} { ${2:block} }",
|
||||||
"details": "return [expression]",
|
"details": "block label { block }",
|
||||||
"kind": "keyword"
|
"kind": "keyword"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"trigger": "data",
|
"trigger": "data",
|
||||||
"contents": "data ${1:address} {\n\t${2:content}\n}",
|
"contents": "data ${1:address} {\n\t${2:type}(\n\t\t${3:values}\n\t)\n}",
|
||||||
"details": "data address { content }",
|
"details": "data address { content }",
|
||||||
"kind": "keyword"
|
"kind": "keyword"
|
||||||
},
|
},
|
||||||
@@ -199,7 +199,6 @@
|
|||||||
"kind": "support.function"
|
"kind": "support.function"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// API functions
|
// API functions
|
||||||
{
|
{
|
||||||
"trigger": "sin",
|
"trigger": "sin",
|
||||||
@@ -526,6 +525,241 @@
|
|||||||
"contents": "i32.trunc_sat_f32_s(${1:value})",
|
"contents": "i32.trunc_sat_f32_s(${1:value})",
|
||||||
"details": "i32.trunc_sat_f32_s(value: f32) -> i32: Truncate f32 to i32 signed, saturating",
|
"details": "i32.trunc_sat_f32_s(value: f32) -> i32: Truncate f32 to i32 signed, saturating",
|
||||||
"kind": "support.function"
|
"kind": "support.function"
|
||||||
|
},
|
||||||
|
// Added Constants
|
||||||
|
{
|
||||||
|
"trigger": "TIME_MS",
|
||||||
|
"contents": "TIME_MS",
|
||||||
|
"details": "0x40 Time since module start in ms",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "GAMEPAD",
|
||||||
|
"contents": "GAMEPAD",
|
||||||
|
"details": "0x44 Gamepad state",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "FRAMEBUFFER",
|
||||||
|
"contents": "FRAMEBUFFER",
|
||||||
|
"details": "0x78 Frame buffer address",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "PALETTE",
|
||||||
|
"contents": "PALETTE",
|
||||||
|
"details": "0x13000 Palette address",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "FONT",
|
||||||
|
"contents": "FONT",
|
||||||
|
"details": "0x13400 Font address",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "USER_MEM",
|
||||||
|
"contents": "USER_MEM",
|
||||||
|
"details": "0x14000 Start of general user memory",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "BUTTON_UP",
|
||||||
|
"contents": "BUTTON_UP",
|
||||||
|
"details": "0x00 Gamepad button Up",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "BUTTON_DOWN",
|
||||||
|
"contents": "BUTTON_DOWN",
|
||||||
|
"details": "0x01 Gamepad button Down",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "BUTTON_LEFT",
|
||||||
|
"contents": "BUTTON_LEFT",
|
||||||
|
"details": "0x02 Gamepad button Left",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "BUTTON_RIGHT",
|
||||||
|
"contents": "BUTTON_RIGHT",
|
||||||
|
"details": "0x03 Gamepad button Right",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "BUTTON_A",
|
||||||
|
"contents": "BUTTON_A",
|
||||||
|
"details": "0x04 Gamepad button A (Z on keyboard)",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "BUTTON_B",
|
||||||
|
"contents": "BUTTON_B",
|
||||||
|
"details": "0x05 Gamepad button B (X on keyboard)",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "BUTTON_X",
|
||||||
|
"contents": "BUTTON_X",
|
||||||
|
"details": "0x06 Gamepad button X (A on keyboard)",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "BUTTON_Y",
|
||||||
|
"contents": "BUTTON_Y",
|
||||||
|
"details": "0x07 Gamepad button Y (S on keyboard)",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "PI",
|
||||||
|
"contents": "PI",
|
||||||
|
"details": "Mathematical constant π",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "RAD",
|
||||||
|
"contents": "RAD",
|
||||||
|
"details": "One radian value",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "SCR_X",
|
||||||
|
"contents": "SCR_X",
|
||||||
|
"details": "Screen width in pixels",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "SCR_Y",
|
||||||
|
"contents": "SCR_Y",
|
||||||
|
"details": "Screen height in pixels",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "SCR_W",
|
||||||
|
"contents": "SCR_W",
|
||||||
|
"details": "Screen width in chars (40)",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "SCR_H",
|
||||||
|
"contents": "SCR_H",
|
||||||
|
"details": "Screen height in chars (30)",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "CENTER_X",
|
||||||
|
"contents": "CENTER_X",
|
||||||
|
"details": "X-coordinate of the screen center (160)",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "CENTER_Y",
|
||||||
|
"contents": "CENTER_Y",
|
||||||
|
"details": "Y-coordinate of the screen center (120)",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "SCR_SIZE",
|
||||||
|
"contents": "SCR_SIZE",
|
||||||
|
"details": "Total screen size in pixels (76800)",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "MEM_END",
|
||||||
|
"contents": "MEM_END",
|
||||||
|
"details": "End of available memory",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "CUSTOM_FONT",
|
||||||
|
"contents": "CUSTOM_FONT",
|
||||||
|
"details": "Address for a custom font",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "COLOR_BLACK",
|
||||||
|
"contents": "COLOR_BLACK",
|
||||||
|
"details": "0x00 Black",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "COLOR_DARK_BLUE",
|
||||||
|
"contents": "COLOR_DARK_BLUE",
|
||||||
|
"details": "0x17 Dark Blue",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "COLOR_DARK_PURPLE",
|
||||||
|
"contents": "COLOR_DARK_PURPLE",
|
||||||
|
"details": "0x27 Dark Purple",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "COLOR_CYAN",
|
||||||
|
"contents": "COLOR_CYAN",
|
||||||
|
"details": "0x37 Cyan",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "COLOR_BRIGHT_RED",
|
||||||
|
"contents": "COLOR_BRIGHT_RED",
|
||||||
|
"details": "0x47 Bright Red",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "COLOR_MAGENTA",
|
||||||
|
"contents": "COLOR_MAGENTA",
|
||||||
|
"details": "0x57 Magenta",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "COLOR_ORANGE",
|
||||||
|
"contents": "COLOR_ORANGE",
|
||||||
|
"details": "0x58 Orange",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "COLOR_BRIGHT_YELLOW",
|
||||||
|
"contents": "COLOR_BRIGHT_YELLOW",
|
||||||
|
"details": "0x67 Bright Yellow",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "COLOR_MEDIUM_GREY",
|
||||||
|
"contents": "COLOR_MEDIUM_GREY",
|
||||||
|
"details": "0x78 Medium Grey",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "COLOR_LIGHT_GREY",
|
||||||
|
"contents": "COLOR_LIGHT_GREY",
|
||||||
|
"details": "0x7C Light Grey",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "COLOR_WHITE",
|
||||||
|
"contents": "COLOR_WHITE",
|
||||||
|
"details": "0xF8 White",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "COLOR_BRIGHT_GREEN",
|
||||||
|
"contents": "COLOR_BRIGHT_GREEN",
|
||||||
|
"details": "0x87 Bright Green",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "COLOR_BROWN",
|
||||||
|
"contents": "COLOR_BROWN",
|
||||||
|
"details": "0xD4 Brown",
|
||||||
|
"kind": "constant"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"trigger": "COLOR_DARK_GREY",
|
||||||
|
"contents": "COLOR_DARK_GREY",
|
||||||
|
"details": "0xE1 Dark Grey",
|
||||||
|
"kind": "constant"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ contexts:
|
|||||||
scope: storage.modifier.curlywasm
|
scope: storage.modifier.curlywasm
|
||||||
|
|
||||||
# Control flow
|
# Control flow
|
||||||
- match: \b(return|if|else|loop|branch|branch_if)\b
|
- match: \b(if|else|block|loop|branch|branch_if)\b
|
||||||
scope: keyword.control.flow.curlywasm
|
scope: keyword.control.flow.curlywasm
|
||||||
|
|
||||||
# Type conversion
|
# Type conversion
|
||||||
11
syntax/SublimeText/data-block.sublime-snippet
Normal file
11
syntax/SublimeText/data-block.sublime-snippet
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<snippet>
|
||||||
|
<content><![CDATA[
|
||||||
|
data ${1:address} {
|
||||||
|
${2:type}(
|
||||||
|
${3:values}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
]]></content>
|
||||||
|
<tabTrigger>datatype</tabTrigger>
|
||||||
|
<description>Data block definition</description>
|
||||||
|
</snippet>
|
||||||
9
syntax/SublimeText/fn-export.sublime-snippet
Normal file
9
syntax/SublimeText/fn-export.sublime-snippet
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<snippet>
|
||||||
|
<content><![CDATA[
|
||||||
|
export fn ${1:name}(${2:params}) -> ${3:return_type} {
|
||||||
|
${4:// Function body}
|
||||||
|
}
|
||||||
|
]]></content>
|
||||||
|
<tabTrigger>fnexport</tabTrigger>
|
||||||
|
<description>Exported function definition</description>
|
||||||
|
</snippet>
|
||||||
11
syntax/SublimeText/if-else.sublime-snippet
Normal file
11
syntax/SublimeText/if-else.sublime-snippet
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<snippet>
|
||||||
|
<content><![CDATA[
|
||||||
|
if (${1:condition}) {
|
||||||
|
${2:// Your if code here}
|
||||||
|
} else {
|
||||||
|
${3:// Your else code here}
|
||||||
|
}
|
||||||
|
]]></content>
|
||||||
|
<tabTrigger>ifelse</tabTrigger>
|
||||||
|
<description>If-else statement</description>
|
||||||
|
</snippet>
|
||||||
7
syntax/SublimeText/let-inline.sublime-snippet
Normal file
7
syntax/SublimeText/let-inline.sublime-snippet
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<snippet>
|
||||||
|
<content><![CDATA[
|
||||||
|
let inline ${1:variable} = ${2:value};
|
||||||
|
]]></content>
|
||||||
|
<tabTrigger>letinline</tabTrigger>
|
||||||
|
<description>Lazy variable declaration</description>
|
||||||
|
</snippet>
|
||||||
7
syntax/SublimeText/let-lazy.sublime-snippet
Normal file
7
syntax/SublimeText/let-lazy.sublime-snippet
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<snippet>
|
||||||
|
<content><![CDATA[
|
||||||
|
let lazy ${1:variable} = ${2:value};
|
||||||
|
]]></content>
|
||||||
|
<tabTrigger>letlazy</tabTrigger>
|
||||||
|
<description>Lazy variable declaration</description>
|
||||||
|
</snippet>
|
||||||
11
syntax/SublimeText/loop-branch_if.sublime-snippet
Normal file
11
syntax/SublimeText/loop-branch_if.sublime-snippet
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<snippet>
|
||||||
|
<content><![CDATA[
|
||||||
|
${1:label} = 0;
|
||||||
|
loop ${1:label} {
|
||||||
|
${2:// Your loop code here}
|
||||||
|
branch_if (${3:condition}): ${1:label};
|
||||||
|
}
|
||||||
|
]]></content>
|
||||||
|
<tabTrigger>loopbr</tabTrigger>
|
||||||
|
<description>Loop with branch_if</description>
|
||||||
|
</snippet>
|
||||||
Reference in New Issue
Block a user