Open sandboxFocus

Struct SourceReference

Represents a syntax node in source code. Using Metalama.Framework.Sdk you can use ToSyntaxNodeOrToken to convert it to a Roslyn object.

Implements
Namespace: Metalama.Framework.Code
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public readonly struct SourceReference : IDiagnosticLocation

Properties

Name Description
IsImplementationPart

Gets a value indicating whether the current syntax node is contains the implementation of the declaration. This property evaluates to false only for partial methods without implementation.

Kind

Gets the SyntaxKind of the node or token.

NodeOrToken

Gets the Roslyn SyntaxNode, SyntaxToken. This property can be used by SDK-based plugins.

Span

Gets source file, line and column for the node.

Methods

Name Description
GetText(bool)

Gets the text representation (i.e. the source code) of the current syntax node or token.

ToString()

Gets the content of the node or token (without trivia).