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.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Syntax
'宣告
Public Overridable Sub MatchTriple ( _
startSpan As TextSpan, _
middleSpan As TextSpan, _
endSpan As TextSpan, _
priority As Integer _
)
'用途
Dim instance As AuthoringSink
Dim startSpan As TextSpan
Dim middleSpan As TextSpan
Dim endSpan As TextSpan
Dim priority As Integer
instance.MatchTriple(startSpan, middleSpan, _
endSpan, priority)
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
- startSpan
Type: Microsoft.VisualStudio.TextManager.Interop.TextSpan
[in] A TextSpan object indicating the starting element.
- middleSpan
Type: Microsoft.VisualStudio.TextManager.Interop.TextSpan
[in] A TextSpan object indicating the middle element.
- endSpan
Type: Microsoft.VisualStudio.TextManager.Interop.TextSpan
[in] A TextSpan Span object indicating the ending element.
- priority
Type: System.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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.