Delen via


AuthoringSink.MatchTriple Method

Called to add a matching set of three elements to an internal list.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.12.0 (in Microsoft.VisualStudio.Package.LanguageService.12.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)

Syntax

'Declaration
Public Overridable Sub MatchTriple ( _
    startSpan As TextSpan, _
    middleSpan As TextSpan, _
    endSpan As TextSpan, _
    priority As Integer _
)
public virtual void MatchTriple(
    TextSpan startSpan,
    TextSpan middleSpan,
    TextSpan endSpan,
    int priority
)
public:
virtual void MatchTriple(
    TextSpan startSpan, 
    TextSpan middleSpan, 
    TextSpan endSpan, 
    int priority
)
abstract MatchTriple : 
        startSpan:TextSpan * 
        middleSpan:TextSpan * 
        endSpan:TextSpan * 
        priority:int -> unit  
override MatchTriple : 
        startSpan:TextSpan * 
        middleSpan:TextSpan * 
        endSpan:TextSpan * 
        priority:int -> unit
public function MatchTriple(
    startSpan : TextSpan, 
    middleSpan : TextSpan, 
    endSpan : TextSpan, 
    priority : int
)

Parameters

  • priority
    Type: Int32

    [in] A priority value used to sort overlapping triples.

Remarks

If the BraceMatching property returns true, this method is called to add the triple to an internal list that describes matching triples, sorted in priority order (typically the highest priority for overlapping triples wins) that is used for overlapping triples. Two examples of a matching triple in C# is "foreach(...)", "{", "}"; and "while (...)", "{", "}".

One way where matching triples overlap is with nested loops. In this scheme, the innermost loop has the highest priority and the outermost loop has the lowest priority.

The base method determines if any of the spans include the parse operation's starting point (as given by the Line and Column properties). If any of the spans include the starting point, the spans are normalized, added to an internal list of spans, and are then bundled into a TripleMatch structure that is added to another internal list. The internal list is an array of TripleMatch structures and is called Braces. See the example for the internal definition of the TripleMatch structure.

Examples

The following structure is used by the managed package framework to contain a prioritized set of three language elements (for example, "foreach()", "{", and "}"). Note that this structure derives from the BraceMatch structure as described in the Example section for the MatchPair method.

internal class TripleMatch : BraceMatch
{
    internal TextSpan c;

    public TripleMatch(TextSpan a, TextSpan b, TextSpan c, int priority)
        : base(a, b, priority)
    {
        this.c = c;
    }
}

.NET Framework Security

See Also

Reference

AuthoringSink Class

Microsoft.VisualStudio.Package Namespace