From 25f2c3171a4a57f88152278eec8b27b7ed758971 Mon Sep 17 00:00:00 2001 From: Fluffy <65877598+FluffyGhoster@users.noreply.github.com> Date: Wed, 12 Jul 2023 15:57:12 +0200 Subject: [PATCH] VSC Code snippets (templates) (#16673) * some snippets + changelog * typo fix * added for loops, fixed parenthesis for addtimer --- .gitignore | 1 + .vscode/dm_callbacks.code-snippets | 33 ++++++++++++++++ .vscode/dm_controlflow-for.code-snippets | 42 +++++++++++++++++++++ .vscode/dm_flags.code-snippets | 29 ++++++++++++++ .vscode/dm_new-definitions.code-snippets | 40 ++++++++++++++++++++ .vscode/dm_procrefs.code-snippets | 33 ++++++++++++++++ html/changelogs/fluffyghost-vscsnippets.yml | 41 ++++++++++++++++++++ 7 files changed, 219 insertions(+) create mode 100644 .vscode/dm_callbacks.code-snippets create mode 100644 .vscode/dm_controlflow-for.code-snippets create mode 100644 .vscode/dm_flags.code-snippets create mode 100644 .vscode/dm_new-definitions.code-snippets create mode 100644 .vscode/dm_procrefs.code-snippets create mode 100644 html/changelogs/fluffyghost-vscsnippets.yml diff --git a/.gitignore b/.gitignore index b4e21091e79..7cf8fdb5a4a 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ __pycache__/ !.vscode/launch.json !.vscode/tasks.json !.vscode/extensions.json +!.vscode/*.code-snippets .vs/ define_sanity_output.txt diff --git a/.vscode/dm_callbacks.code-snippets b/.vscode/dm_callbacks.code-snippets new file mode 100644 index 00000000000..79003b59f79 --- /dev/null +++ b/.vscode/dm_callbacks.code-snippets @@ -0,0 +1,33 @@ +{ + // Place your Aurora.3 workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and + // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope + // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is + // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: + // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. + // Placeholders with the same ids are connected. + // Example: + // "Print to console": { + // "scope": "javascript,typescript", + // "prefix": "log", + // "body": [ + // "console.log('$1');", + // "$2" + // ], + // "description": "Log output to console" + // } + // + // Refer to https://code.visualstudio.com/docs/editor/userdefinedsnippets + + "INVOKE_ASYNC": { + "prefix": ["INVOKE_ASYNC", "ASYNC"], + "body": [ + "INVOKE_ASYNC(${1|src,GLOBAL_PROC|}, ${2|PROC_REF(your_proc_name),GLOBAL_PROC_REF(your_proc_name),TYPE_PROC_REF(/object/type\\, your_proc_name)|}, ${3:VARPARAMS})" + ] + }, + "addtimer": { + "prefix": ["addtimer", "TIMER"], + "body": [ + "addtimer(CALLBACK(${1|src,GLOBAL_PROC|}, ${2|PROC_REF(your_proc_name),GLOBAL_PROC_REF(your_proc_name),TYPE_PROC_REF(/object/type\\, your_proc_name)|}, ${3:VARPARAMS}), ${4} SECONDS)" + ] + } +} diff --git a/.vscode/dm_controlflow-for.code-snippets b/.vscode/dm_controlflow-for.code-snippets new file mode 100644 index 00000000000..42e6073c896 --- /dev/null +++ b/.vscode/dm_controlflow-for.code-snippets @@ -0,0 +1,42 @@ +{ + // Place your Aurora.3 workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and + // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope + // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is + // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: + // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. + // Placeholders with the same ids are connected. + // Example: + // "Print to console": { + // "scope": "javascript,typescript", + // "prefix": "log", + // "body": [ + // "console.log('$1');", + // "$2" + // ], + // "description": "Log output to console" + // } + // + // Refer to https://code.visualstudio.com/docs/editor/userdefinedsnippets + + "FOR_IN_LIST": { + "prefix": "FOR_IN_LIST", + "body": [ + "for(var/${1:iterator} in ${2:list})", + "\t", + ] + }, + "FOR_INDEX": { + "prefix": "FOR_INDEX", + "body": [ + "for(var/${1:index}, ${2:condition}, ${3:step})", + "\t", + ] + }, + "FOR_IN_TO": { + "prefix": "FOR_IN_TO", + "body": [ + "for(var/${1:count} in ${2:begin} to ${3:end})", + "\t", + ] + }, +} diff --git a/.vscode/dm_flags.code-snippets b/.vscode/dm_flags.code-snippets new file mode 100644 index 00000000000..f3c0fa9a30c --- /dev/null +++ b/.vscode/dm_flags.code-snippets @@ -0,0 +1,29 @@ +{ + // Place your Aurora.3 workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and + // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope + // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is + // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: + // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. + // Placeholders with the same ids are connected. + // Example: + // "Print to console": { + // "scope": "javascript,typescript", + // "prefix": "log", + // "body": [ + // "console.log('$1');", + // "$2" + // ], + // "description": "Log output to console" + // } + // + // Refer to https://code.visualstudio.com/docs/editor/userdefinedsnippets + + "CHECK_FLAG": { + "prefix": ["CHECK_FLAG", "HAS_FLAG", "NOT_FLAG"], + "body": ["${1|HAS_FLAG,NOT_FLAG|}(${2:variable}, ${3:flag})"] + }, + "SET_FLAG": { + "prefix": ["SET_FLAG", "BITFLAG"], + "body": ["${1:variable} = BITFLAG(${2:flag_position})"] + }, +} diff --git a/.vscode/dm_new-definitions.code-snippets b/.vscode/dm_new-definitions.code-snippets new file mode 100644 index 00000000000..9c4a0f81cb4 --- /dev/null +++ b/.vscode/dm_new-definitions.code-snippets @@ -0,0 +1,40 @@ +{ + // Place your Aurora.3 workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and + // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope + // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is + // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: + // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. + // Placeholders with the same ids are connected. + // Example: + // "Print to console": { + // "scope": "javascript,typescript", + // "prefix": "log", + // "body": [ + // "console.log('$1');", + // "$2" + // ], + // "description": "Log output to console" + // } + // + // Refer to https://code.visualstudio.com/docs/editor/userdefinedsnippets + + "NEW_PROC": { + "prefix": ["NEW_PROC"], + "body": [ + "proc/${1:procname}(${2:VARPARAMS})", + "\tRETURN_TYPE(${3})", + "\tSHOULD_BE_PURE(${4|FALSE,TRUE|})", + "\tSHOULD_CALL_PARENT(${5|TRUE,FALSE|})", + "\tSHOULD_NOT_OVERRIDE(${6|FALSE,TRUE|})", + "\tSHOULD_NOT_SLEEP(${7|TRUE,FALSE|})", + "\tPROTECTED_PROC(${8|FALSE,TRUE|})", + "\t", + ] + }, + "NEW_VAR": { + "prefix": ["var"], + "body": [ + "${8|var,VAR_FINAL,VAR_PRIVATE,VAR_PROTECTED|}", + ] + }, +} diff --git a/.vscode/dm_procrefs.code-snippets b/.vscode/dm_procrefs.code-snippets new file mode 100644 index 00000000000..34729b833c9 --- /dev/null +++ b/.vscode/dm_procrefs.code-snippets @@ -0,0 +1,33 @@ +{ + // Place your Aurora.3 workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and + // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope + // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is + // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: + // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. + // Placeholders with the same ids are connected. + // Example: + // "Print to console": { + // "scope": "javascript,typescript", + // "prefix": "log", + // "body": [ + // "console.log('$1');", + // "$2" + // ], + // "description": "Log output to console" + // } + // + // Refer to https://code.visualstudio.com/docs/editor/userdefinedsnippets + + "PROC_REF": { + "prefix": "PROC_REF", + "body": ["PROC_REF(${1:your_proc_name})"] + }, + "TYPE_PROC_REF": { + "prefix": "PROC_REF", + "body": ["TYPE_PROC_REF(${1:/object/type}, ${2:your_proc_name})"] + }, + "GLOBAL_PROC_REF": { + "prefix": "PROC_REF", + "body": ["GLOBAL_PROC_REF(${1:your_proc_name})"] + }, +} diff --git a/html/changelogs/fluffyghost-vscsnippets.yml b/html/changelogs/fluffyghost-vscsnippets.yml new file mode 100644 index 00000000000..e564b1d6b60 --- /dev/null +++ b/html/changelogs/fluffyghost-vscsnippets.yml @@ -0,0 +1,41 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: FluffyGhost + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - backend: "Added some code snippets to more conveniently code."