Skip to content

Instantly share code, notes, and snippets.

@Nimblz
Created October 13, 2019 00:31
Show Gist options
  • Save Nimblz/7ce252a956c64fbdef2673169e4efc3e to your computer and use it in GitHub Desktop.
Save Nimblz/7ce252a956c64fbdef2673169e4efc3e to your computer and use it in GitHub Desktop.
my vscode snippets
{
// Place your snippets for lua here. Each snippet is defined under a snippet name and has a prefix, body and
// description. 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": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Create a new path variable": {
"prefix": "p",
"body": [
"local ${1:pathname} = ${2:basepath}:WaitForChild(\"${1}\")"
]
},
"Require a library from a path": {
"prefix": "r",
"body": [
"local ${1:ModuleName} = require(${2:path}:WaitForChild(\"${1}\"))"
]
},
"Globals used by most scripts": {
"prefix": "g",
"body": [
"local ReplicatedStorage = game:GetService(\"ReplicatedStorage\")",
"",
"local common = ReplicatedStorage:WaitForChild(\"common\")",
"local lib = ReplicatedStorage:WaitForChild(\"lib\")",
"local event = ReplicatedStorage:WaitForChild(\"event\")",
"",
]
},
"Require PizzaAlpaca": {
"prefix": "pz",
"body": [
"local PizzaAlpaca = require(lib:WaitForChild(\"PizzaAlpaca\"))",
"",
]
},
"Create PizzaAlpaca module": {
"prefix": "pzm",
"body": [
"local ${1:GameModule} = PizzaAlpaca.GameModule:extend(\"${1}\")",
"",
"function ${1}:preInit()",
"end",
"",
"function ${1}:init()",
"end",
"",
"function ${1}:postInit()",
"end",
"",
"return ${1}"
]
},
"Require Roact": {
"prefix": "rct",
"body": [
"local Roact = require(lib:WaitForChild(\"Roact\"))",
"",
]
},
"Require Rodux": {
"prefix": "rdx",
"body": [
"local Rodux = require(lib:WaitForChild(\"Rodux\"))",
"",
]
},
"Require RoactRodux": {
"prefix": "rctrdx",
"body": [
"local RoactRodux = require(lib:WaitForChild(\"RoactRodux\"))",
"",
]
},
"Create stateful component": {
"prefix": "rcc",
"body": [
"local ${1:MyComponent} = Roact.Component:extend(\"${1}\")",
"",
"function ${1}:init()",
"end",
"",
"function ${1}:didMount()",
"end",
"",
"function ${1}:render()",
"\t$0",
"end",
"",
"return ${1}"
]
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment