共用方式為


ProvideLanguageServiceAttribute.MatchBracesAtCaret Property

Determines if a language service supports matching language pairs while typing.

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.11.0 (in Microsoft.VisualStudio.Shell.11.0.dll)

Syntax

'宣告
Public Property MatchBracesAtCaret As Boolean
public bool MatchBracesAtCaret { get; set; }

Property Value

Type: System.Boolean
Returns true if language pairs can be matched while typing; otherwise, returns false.

Remarks

All computer languages support what can be called language pairs such as '{' and '}', '(' and ')', or '<' and '>'. When an element of a language is typed or moved over by the caret, the corresponding matching element can be highlighted. A language service indicates its support for matching language pairs in this manner by setting the MatchBracesAtCaret property to true. The MatchBraces property must also be set to true.

This property is specific to the managed package framework (MPF).

The default is true 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]\
    MatchBracesAtCaret = reg_dword: 0x00000001

Examples

    [ProvideLanguageService(typeof(MyLanguageService),           // Required
                            MyConstants.languageName,            // Required
                            MyConstants.languageNameResourceID,  // Required
        // Optional language service properties
        MatchBracesAtCaret = true,  // brace matching while typing is supported
                           )]

.NET Framework Security

See Also

Reference

ProvideLanguageServiceAttribute Class

Microsoft.VisualStudio.Shell Namespace