Freigeben über


ProvideLanguageServiceAttribute.DefaultToInsertSpaces Property

Definition

Determines the default setting for the Insert spaces option in the Options dialog box for a language service.

public:
 property bool DefaultToInsertSpaces { bool get(); void set(bool value); };
public:
 property bool DefaultToInsertSpaces { bool get(); void set(bool value); };
public bool DefaultToInsertSpaces { get; set; }
member this.DefaultToInsertSpaces : bool with get, set
Public Property DefaultToInsertSpaces As Boolean

Property Value

Returns true if the language service initially uses spaces for formatting; otherwise, returns false to indicate the language service uses tabs.

Examples

[ProvideLanguageService(typeof(MyLanguageService),           // Required  
                        MyConstants.languageName,            // Required  
                        MyConstants.languageNameResourceID,  // Required  
    // Optional language service properties  
    DefaultToInsertSpaces = true,  // Use spaces for formatting  
                       )]  

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  

Applies to