I am trying to set up snippets for getters and setters in C++. This is what I have:
<snippet>
<description>getter</description>
<content><![CDATA[
${1:(type)} get${2:(var)}() { return ${2:}; }
]]></content>
<tabTrigger>getter</tabTrigger>
<scope>source.c, source.objc, source.c++, source.objc++</scope>
</snippet>
However, I like to use camel case. Is there a way in which to capitalise the first letter after “get” but not capitalise it in the return statement?
This works. First field will be type
, fill that in, then tab to the next spot and enter your variable name.
<snippet>
<description>getter</description>
<content><![CDATA[
${1:type} get${2/./\U${0}\E/}() { return ${2:}; }
$0]]></content>
<tabTrigger>getter</tabTrigger>
<scope>source.c, source.objc, source.c++, source.objc++</scope>
</snippet>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.