英語で読む

次の方法で共有


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
Assembly:  Microsoft.VisualStudio.Shell.11.0 (in Microsoft.VisualStudio.Shell.11.0.dll)

Syntax

'宣言
Public Property DefaultToInsertSpaces As Boolean
public bool DefaultToInsertSpaces { get; set; }

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

See Also

Reference

ProvideLanguageServiceAttribute Class

Microsoft.VisualStudio.Shell Namespace