ProvideLanguageServiceAttribute.EnableFormatSelection Property
Determines if the language service supports automatic formatting of the source code.
Namespace: Microsoft.VisualStudio.Shell
Assembly: Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
Syntax
'Declaration
Public Property EnableFormatSelection As Boolean
public bool EnableFormatSelection { get; set; }
public:
property bool EnableFormatSelection {
bool get ();
void set (bool value);
}
member EnableFormatSelection : bool with get, set
function get EnableFormatSelection () : boolean
function set EnableFormatSelection (value : boolean)
Property Value
Type: System.Boolean
Returns true if formatting is supported; otherwise, returns false.
Remarks
A language service can support formatting source code which enhances the readability of the code. Formatting typically involves inserting white space at the beginning of each line to move it to the proper level of indentation. This formatting can occur when the user selects a command (Edit -> Advanced -> Format Selection or Edit -> Advanced -> Format Document) or it can be triggered automatically within the language service when a particular character is typed (for example, in C#, typing a closing brace '}' causes all the source between it and the corresponding opening brace '{' to be properly indented). The EnableFormatSelection property applies to any formatting.
This property is specific to the managed package framework (MPF).
The default is false when the corresponding registry entry is accessed through the LanguagePreferences class.
The registry entry looks like this:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[X.Y]\Languages\Language Services\
[Language Name]\
EnableFormatSelection = reg_dword: 0x00000001
Examples
[ProvideLanguageService(typeof(MyLanguageService), // Required
MyConstants.languageName, // Required
MyConstants.languageNameResourceID, // Required
// Optional language service properties
EnableFormatSelection = true, // formatting is supported
)]
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.