ProvideLanguageServiceAttribute.DefaultToInsertSpaces Property
Determines the default setting for the Insert spaces option in the Options dialog box for a language service.
Namespace: Microsoft.VisualStudio.Shell
Assemblies: Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)
Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)
Syntax
'Déclaration
Public Property DefaultToInsertSpaces As Boolean
Get
Set
'Utilisation
Dim instance As ProvideLanguageServiceAttribute
Dim value As Boolean
value = instance.DefaultToInsertSpaces
instance.DefaultToInsertSpaces = value
public bool DefaultToInsertSpaces { get; set; }
public:
property bool DefaultToInsertSpaces {
bool get ();
void set (bool value);
}
member DefaultToInsertSpaces : bool with get, set
function get DefaultToInsertSpaces () : boolean
function set DefaultToInsertSpaces (value : boolean)
Property Value
Type: System.Boolean
Returns true if the language service initially uses spaces for formatting; otherwise, returns false to indicate the language service uses tabs.
Remarks
A language service can support formatting source code (the EnableFormatSelection property is set to true) which typically involves inserting or removing white space at the beginning of a line to adjust its indentation to the proper level. What kind of white space used for formatting is controlled from the Options dialog box (available from the Tools -> Options menu), typically under the Tabs property page for each language. The DefaultToInsertSpaces property determines the initial setting of the Insert spaces option.
This property is available to any language service implementation.
The default is false, indicating the Insert spaces option is not initially selected.
The registry entry looks like this:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[X.Y]\Languages\Language Services\
[Language Name]\
DefaultToInsertSpaces = reg_dword: 0x00000001
Examples
[ProvideLanguageService(typeof(MyLanguageService), // Required
MyConstants.languageName, // Required
MyConstants.languageNameResourceID, // Required
// Optional language service properties
DefaultToInsertSpaces = true, // Use spaces for formatting
)]
.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.
See Also
Reference
ProvideLanguageServiceAttribute Class