Closed ghost closed 4 years ago
I have this function to capitalize the first letter of a word:
function titleCase(first, rest) return first:upper()..rest:lower() end
And want to use this in my snippet: Basically i want capitalize what I typed on first placeholder
typescriptreact = { ["ush"] = [[ const [${1}, ${=string.gsub($1, "(%a)([%w_']*)", titleCase)}] = useState(${3}) ]] };
I'm very noob on lua so apologies if it's a dumb question, but I'm really struggle with this
Already solved! It was just lack of reading the documentation haha.
Solution:
["ush"] = [[ const [${1}, ${1|string.format('set%s', S.v:sub(1, 1):upper()..S.v:sub(2))}] = useState(${3})$0 ]],
I have this function to capitalize the first letter of a word:
And want to use this in my snippet: Basically i want capitalize what I typed on first placeholder
I'm very noob on lua so apologies if it's a dumb question, but I'm really struggle with this