Registering Custom Code Snippets in Visual Studio Code
You can create code snippet files using the following steps:
Select File > Preferences > User Snippets from the code editor's top menu.
Snippets are written in JSON format.
Code Snippets
propp
Defines a property that requires update notifications.
About ${3:...}
${2/(.*)/${1:/camelcase}/}
: This part is a combination of regular expression and replacement pattern. It generates the name of the backing field based on the value of${2:Name}
.(.*)
: This is a regular expression capture group. It captures the property name (Name) entered by the user.${1:/camelcase}
: This is a replacement pattern for converting the captured string to camel case.${1:...}
references the captured value, and:camelcase
instructs camel case conversion.
cmd
Delegate command.
cmdg
Parameterized delegate command.