I've build some snippets to generate a fields for a setting class. I'm now using 2 variables - $setting$
and $Setting$
- to generate names for the property and the backing field. I like to use a single variable, because the only difference is that the backing field is always a lower-cased version.
Current code:
string $setting$;
/// <summary>
/// Gets the $bigComment$.
/// </summary>
/// <value>The $smallComment$.</value>
public string $Setting$
{
get
{
if (String.IsNullOrEmpty($setting$))
{
$setting$ = CFW.Common.Configuration.GetAppSetting("$Setting$", $defaultValue$);
}
return $setting$;
}
}
Is this possible?
File-> Preferences -> Keyboard Shortcuts. Now CTRL+SHIFT+U will capitalise selected text, even if multi line. In the same way, CTRL+SHIFT+L will make selected text lowercase. These commands are built into VS Code, and no extensions are required to make them work.
Use Ctrl + Shift P for Windows and Linux. As shown in the image above, you can convert a string or sentence's case into: Upper case. Lower case.
The two functions have default shortcut keys that make the editing process even faster. To capitalise the text press Ctrl-Shift-U. To convert to lower case, press Ctrl-U.
It is not possible to change literals in a Code Snippets. There are some functions available:
GenerateSwitchCases - Generates a switch statement and a set of case statements for the members of the enumeration specified by the EnumerationLiteral parameter. The EnumerationLiteral parameter must be either a reference to an enumeration literal or an enumeration type.
ClassName - Returns the name of the class that contains the inserted snippet.
SimpleTypeName - Reduces the TypeName parameter to its simplest form in the context in which the snippet was invoked.
But they cannot modify literals.
Source: http://msdn.microsoft.com/en-us/library/ms242312(v=vs.110).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With