From a19b2ce0a05652a603554123f58c34d5a2bf7de7 Mon Sep 17 00:00:00 2001 From: yuki Date: Tue, 11 Nov 2025 19:20:41 -0300 Subject: [PATCH] add gameobject vscode snippet --- .vscode/gameobject.code-snippets | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .vscode/gameobject.code-snippets diff --git a/.vscode/gameobject.code-snippets b/.vscode/gameobject.code-snippets new file mode 100644 index 0000000..7e90b77 --- /dev/null +++ b/.vscode/gameobject.code-snippets @@ -0,0 +1,44 @@ +{ + // Place your learns 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" + // } + "GameObject Extension": { + "scope": "lua", + "prefix": "extendGameObject", + "body": [ + "---@class ${1:ClassName}:GameObject", + "local ${1:ClassName} = GameObject:extend()", + "", + "function ${1:ClassName}:new(area, x, y, opts)", + " ${1:ClassName}.super.new(self, area, x, y, opts)", + "end", + "", + "---Updates ${1:ClassName}", + "---@param dt number delta time", + "function ${1:ClassName}:update(dt)", + " ${1:ClassName}.super.update(self, dt)", + "end", + "", + "---Draws ${1:ClassName}", + "function ${1:ClassName}:draw()", + " ${1:ClassName}.super.draw(self)", + "end", + "", + "return ${1:ClassName}" + ], + "description": "Extends GameObject with a LuaLS class definition and implements new, update, and draw." + } +} \ No newline at end of file