ProvideLanguageServiceAttribute.MatchBraces Property

 

Determines if the language service supports matching language pairs.

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

public bool MatchBraces { get; set; }

Property Value

Type: System.Boolean

Returns true if matching language pairs is supported; otherwise, returns false.

All computer languages support what can be called language pairs such as '{' and '}', '(' and ')', or '<' and '>'. It is possible to position the caret after an element of a language pair and type Ctrl-] to jump to the corresponding matching pair. A language service indicates its support for matching language pairs in this manner by setting the MatchBraces property to true. To indicate support for matching pairs while typing, the MatchBracesAtCaret 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]\
    MatchBraces = reg_dword: 0x00000001

[ProvideLanguageService(typeof(MyLanguageService),           // Required
                        MyConstants.languageName,            // Required
                        MyConstants.languageNameResourceID,  // Required
    // Optional language service properties
    MatchBraces = true,  // brace matching is supported
                       )]
Return to top
Show: