From 9c285753e5215ff920d4c787e8f4d25569d66bd4 Mon Sep 17 00:00:00 2001 From: dom3 Date: Sat, 24 Jan 2026 18:19:16 -0800 Subject: [PATCH 1/2] Added 12 snippets based off the wiki --- package.json | 7 +++ snippets.json | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 snippets.json diff --git a/package.json b/package.json index 0c2c399..e258589 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ }, "publisher": "GeodeSDK", "categories": [ + "Snippets", "Other" ], "repository": { @@ -309,6 +310,12 @@ "fileMatch": "mod.json", "url": "./dist/validation/mod.json" } + ], + "snippets": [ + { + "language": "cpp", + "path": "./snippets.json" + } ] }, "icon": "assets/geode-circle-no-gradient.png", diff --git a/snippets.json b/snippets.json new file mode 100644 index 0000000..958480a --- /dev/null +++ b/snippets.json @@ -0,0 +1,131 @@ +{ + "Button": { + "prefix": ["btn", "button"], + "body": [ + "auto ${1:btn} = CCMenuItemSpriteExtra::create(", + " ButtonSprite::create(\"${2:}\"), ${3:this}, ${4:nullptr}", + ");" + ], + "description": "Simple CCMenuItemSpriteExtra button." + }, + "Info Log": { + "prefix": ["info"], + "body": [ + "log::info(\"${1:}\");" + ], + "description": "Logs an info message." + }, + "Debug Log": { + "prefix": ["debug"], + "body": [ + "log::debug(\"${1:}\");" + ], + "description": "Logs a debug message." + }, + "Coroutine": { + "prefix": ["coro", "coroutine"], + "body": [ + "coro::Generator<${1:void}> ${2:coroutine}() {", + " ", + "}" + ], + "description": "Creates a coroutine." + }, + "FL Alert": { + "prefix": ["flalert", "flalertlayer"], + "body": [ + "FLAlertLayer::create(", + " \"${1:}\",", + " \"${2:}\",", + " \"${3:}\"", + ")->show();" + ], + "description": "Creates and shows a basic FLAlertLayer popup." + }, + "Quick popup": { + "prefix": ["createQuickPopup", "quickPopup"], + "body": [ + "geode::createQuickPopup(", + " \"${1:}\",", + " \"${2:}\",", + " \"${3:}\", ${4:},", + " [](auto, bool btn2) {", + " ${5:}", + " }", + ");" + ], + "description": "Creates a Geode quick popup." + }, + "Complex popup": { + "prefix": ["popup"], + "body": [ + "class ${1:MyPopup} : public geode::Popup<${2:std::string} const&> {", + "protected:", + " bool setup(${2:std::string} const& value) override {", + " this->setTitle(\"${3:}\");", + " return true;", + " }", + "public:", + " static ${1:MyPopup}* create(${2:std::string} const& text) {", + " auto ret = new ${1:MyPopup}();", + " if (ret->initAnchored(240.f, 160.f, text)) {", + " ret->autorelease();", + " return ret", + " }", + " ", + " delete ret;", + " return nullptr;", + " }", + "}" + ], + "description": "Creates a complex popup class." + }, + "Color": { + "prefix": ["${2:}" + ], + "description": "Creates a color tag." + }, + "Event": { + "prefix": ["event"], + "body": [ + "class ${1:MyEvent} : public Event {", + "public:", + " ${1:MyEvent}();", + "}" + ], + "description": "Creates a basic event class." + }, + "Modify": { + "prefix": ["modify"], + "body": [ + "class $modify(${1:MyMenuLayer}, ${2:MenuLayer}) {", + " ${3:}", + "};" + ], + "description": "Creates a modify macro." + }, + "Web Response": { + "prefix": ["bind"], + "body": [ + "${1:m_listener}.bind([] (web::WebTask::Event* e) {", + " if (web::WebResponse* value = e->getValue()) {", + " ${2:}", + " } else if (web::WebProgress* progress = e->getProgress()) {", + " ${3:}", + " } else if (e->isCancelled()) {", + " ${4:}", + " }", + "});" + ], + "description": "Creates a basic web response for an event listener." + }, + "Get Window Size": { + "prefix": ["winSize", "getWinSize"], + "body": [ + "auto ${1:screenSize} = CCDirector::sharedDirector()->getWinSize();" + ], + "description": "Creates a variable that gets the current window size." + } +} \ No newline at end of file From e1e34ed2949040ad6a62420341cd5defef3d93b9 Mon Sep 17 00:00:00 2001 From: dom3 Date: Sat, 24 Jan 2026 21:22:57 -0800 Subject: [PATCH 2/2] Fixed an error with variables $modify --- snippets.json | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/snippets.json b/snippets.json index 958480a..dd20837 100644 --- a/snippets.json +++ b/snippets.json @@ -3,7 +3,7 @@ "prefix": ["btn", "button"], "body": [ "auto ${1:btn} = CCMenuItemSpriteExtra::create(", - " ButtonSprite::create(\"${2:}\"), ${3:this}, ${4:nullptr}", + " ButtonSprite::create(\"$1\"), ${3:this}, ${4:nullptr}", ");" ], "description": "Simple CCMenuItemSpriteExtra button." @@ -11,14 +11,14 @@ "Info Log": { "prefix": ["info"], "body": [ - "log::info(\"${1:}\");" + "log::info(\"$1\");" ], "description": "Logs an info message." }, "Debug Log": { "prefix": ["debug"], "body": [ - "log::debug(\"${1:}\");" + "log::debug(\"$1\");" ], "description": "Logs a debug message." }, @@ -35,9 +35,9 @@ "prefix": ["flalert", "flalertlayer"], "body": [ "FLAlertLayer::create(", - " \"${1:}\",", - " \"${2:}\",", - " \"${3:}\"", + " \"$1\",", + " \"$2\",", + " \"$3\"", ")->show();" ], "description": "Creates and shows a basic FLAlertLayer popup." @@ -46,11 +46,11 @@ "prefix": ["createQuickPopup", "quickPopup"], "body": [ "geode::createQuickPopup(", - " \"${1:}\",", - " \"${2:}\",", - " \"${3:}\", ${4:},", + " \"$1\",", + " \"$2\",", + " \"$3\", $4,", " [](auto, bool btn2) {", - " ${5:}", + " $5", " }", ");" ], @@ -62,7 +62,7 @@ "class ${1:MyPopup} : public geode::Popup<${2:std::string} const&> {", "protected:", " bool setup(${2:std::string} const& value) override {", - " this->setTitle(\"${3:}\");", + " this->setTitle(\"$3\");", " return true;", " }", "public:", @@ -83,7 +83,7 @@ "Color": { "prefix": ["${2:}" + "$2" ], "description": "Creates a color tag." }, @@ -100,8 +100,8 @@ "Modify": { "prefix": ["modify"], "body": [ - "class $modify(${1:MyMenuLayer}, ${2:MenuLayer}) {", - " ${3:}", + "class \\$modify(${1:MyMenuLayer}, ${2:MenuLayer}) {", + " $3", "};" ], "description": "Creates a modify macro." @@ -111,11 +111,11 @@ "body": [ "${1:m_listener}.bind([] (web::WebTask::Event* e) {", " if (web::WebResponse* value = e->getValue()) {", - " ${2:}", + " $2", " } else if (web::WebProgress* progress = e->getProgress()) {", - " ${3:}", + " $3", " } else if (e->isCancelled()) {", - " ${4:}", + " $4", " }", "});" ],