SyntaxTrivia SyntaxTrivia SyntaxTrivia SyntaxTrivia Struct

Definition

Represents a trivia in the syntax tree. This is the language agnostic equivalent of Microsoft.CodeAnalysis.CSharp.SyntaxTrivia and Microsoft.CodeAnalysis.VisualBasic.SyntaxTrivia.

public value class SyntaxTrivia : IEquatable<Microsoft::CodeAnalysis::SyntaxTrivia>
[System.Diagnostics.DebuggerDisplay("{GetDebuggerDisplay(), nq}")]
public struct SyntaxTrivia : IEquatable<Microsoft.CodeAnalysis.SyntaxTrivia>
type SyntaxTrivia = struct
Public Structure SyntaxTrivia
Implements IEquatable(Of SyntaxTrivia)
Inheritance
SyntaxTriviaSyntaxTriviaSyntaxTriviaSyntaxTrivia
Attributes
Implements

Properties

ContainsDiagnostics ContainsDiagnostics ContainsDiagnostics ContainsDiagnostics

Determines whether this trivia has any diagnostics on it. If this trivia is a structured trivia then the returned value will indicate whether this trivia or any of its descendant nodes, tokens or trivia have any diagnostics on them.

FullSpan FullSpan FullSpan FullSpan

The absolute span of this trivia in characters. If this trivia is a structured trivia then the returned span will include spans of any leading or trailing trivia present on the child non-terminal node of this trivia.

HasStructure HasStructure HasStructure HasStructure

Determines whether this trivia is a structured trivia.

IsDirective IsDirective IsDirective IsDirective

Determines whether this trivia represents a preprocessor directive.

Language Language Language Language

The language name that this trivia is syntax of.

RawKind RawKind RawKind RawKind

An integer representing the language specific kind of this trivia.

Span Span Span Span

The absolute span of this trivia in characters. If this trivia is a structured trivia then the returned span will not include spans of any leading or trailing trivia present on the child non-terminal node of this trivia.

SpanStart SpanStart SpanStart SpanStart

Same as accessing Start on Span.

SyntaxTree SyntaxTree SyntaxTree SyntaxTree

SyntaxTree which contains current SyntaxTrivia.

Token Token Token Token

The parent token that contains this token in its LeadingTrivia or TrailingTrivia collection.

Methods

CopyAnnotationsTo(SyntaxTrivia) CopyAnnotationsTo(SyntaxTrivia) CopyAnnotationsTo(SyntaxTrivia) CopyAnnotationsTo(SyntaxTrivia)

Copies all SyntaxAnnotations, if any, from this SyntaxTrivia instance and attaches them to a new instance based on trivia.

Equals(SyntaxTrivia) Equals(SyntaxTrivia) Equals(SyntaxTrivia) Equals(SyntaxTrivia)

Determines whether the supplied SyntaxTrivia is equal to this SyntaxTrivia.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the supplied SyntaxTrivia is equal to this SyntaxTrivia.

GetAnnotations(String) GetAnnotations(String) GetAnnotations(String) GetAnnotations(String)

Get all the annotations of the specified annotation kind.

GetAnnotations(String[]) GetAnnotations(String[]) GetAnnotations(String[]) GetAnnotations(String[])

Get all the annotations of the specified annotation kinds.

GetDiagnostics() GetDiagnostics() GetDiagnostics() GetDiagnostics()

Gets a list of all the diagnostics associated with this trivia. This method does not filter diagnostics based on #pragmas and compiler options like nowarn, warnaserror etc.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as hash function for SyntaxTrivia.

GetLocation() GetLocation() GetLocation() GetLocation()

Get the location of this trivia.

GetStructure() GetStructure() GetStructure() GetStructure()

Returns the child non-terminal node representing the syntax tree structure under this structured trivia.

HasAnnotation(SyntaxAnnotation) HasAnnotation(SyntaxAnnotation) HasAnnotation(SyntaxAnnotation) HasAnnotation(SyntaxAnnotation)

Determines whether this trivia has the specific annotation.

HasAnnotations(String) HasAnnotations(String) HasAnnotations(String) HasAnnotations(String)

Determines where this trivia has annotations of the specified annotation kind.

HasAnnotations(String[]) HasAnnotations(String[]) HasAnnotations(String[]) HasAnnotations(String[])

Determines where this trivia has any annotations of the specified annotation kinds.

IsEquivalentTo(SyntaxTrivia) IsEquivalentTo(SyntaxTrivia) IsEquivalentTo(SyntaxTrivia) IsEquivalentTo(SyntaxTrivia)

Determines if this trivia is equivalent to the specified trivia.

IsPartOfStructuredTrivia() IsPartOfStructuredTrivia() IsPartOfStructuredTrivia() IsPartOfStructuredTrivia()

Determines whether this trivia is a descendant of a structured trivia.

ToFullString() ToFullString() ToFullString() ToFullString()

Returns the full string representation of this trivia. If this trivia is structured trivia then the returned string will include any leading or trailing trivia present on the StructuredTriviaSyntax node of this trivia.

ToString() ToString() ToString() ToString()

Returns the string representation of this trivia. If this trivia is structured trivia then the returned string will not include any leading or trailing trivia present on the StructuredTriviaSyntax node of this trivia.

WithAdditionalAnnotations(SyntaxAnnotation[]) WithAdditionalAnnotations(SyntaxAnnotation[]) WithAdditionalAnnotations(SyntaxAnnotation[]) WithAdditionalAnnotations(SyntaxAnnotation[])

Creates a new SyntaxTrivia with the specified annotations.

WithAdditionalAnnotations(IEnumerable<SyntaxAnnotation>) WithAdditionalAnnotations(IEnumerable<SyntaxAnnotation>) WithAdditionalAnnotations(IEnumerable<SyntaxAnnotation>) WithAdditionalAnnotations(IEnumerable<SyntaxAnnotation>)

Creates a new SyntaxTrivia with the specified annotations.

WithoutAnnotations(SyntaxAnnotation[]) WithoutAnnotations(SyntaxAnnotation[]) WithoutAnnotations(SyntaxAnnotation[]) WithoutAnnotations(SyntaxAnnotation[])

Creates a new SyntaxTrivia without the specified annotations.

WithoutAnnotations(IEnumerable<SyntaxAnnotation>) WithoutAnnotations(IEnumerable<SyntaxAnnotation>) WithoutAnnotations(IEnumerable<SyntaxAnnotation>) WithoutAnnotations(IEnumerable<SyntaxAnnotation>)

Creates a new SyntaxTrivia without the specified annotations.

WithoutAnnotations(String) WithoutAnnotations(String) WithoutAnnotations(String) WithoutAnnotations(String)

Creates a new SyntaxTrivia without annotations of the specified kind.

WriteTo(TextWriter) WriteTo(TextWriter) WriteTo(TextWriter) WriteTo(TextWriter)

Writes the full text of this trivia to the specified TextWriter.

Operators

Equality(SyntaxTrivia, SyntaxTrivia) Equality(SyntaxTrivia, SyntaxTrivia) Equality(SyntaxTrivia, SyntaxTrivia) Equality(SyntaxTrivia, SyntaxTrivia)

Determines whether two SyntaxTrivias are equal.

Inequality(SyntaxTrivia, SyntaxTrivia) Inequality(SyntaxTrivia, SyntaxTrivia) Inequality(SyntaxTrivia, SyntaxTrivia) Inequality(SyntaxTrivia, SyntaxTrivia)

Determines whether two SyntaxTrivias are unequal.

Extension Methods

Kind(SyntaxTrivia) Kind(SyntaxTrivia) Kind(SyntaxTrivia) Kind(SyntaxTrivia)
IsKind(SyntaxTrivia, SyntaxKind) IsKind(SyntaxTrivia, SyntaxKind) IsKind(SyntaxTrivia, SyntaxKind) IsKind(SyntaxTrivia, SyntaxKind)

Applies to