125 instantiations of SourceSpan
Microsoft.CodeAnalysis.Razor.Compiler (124)
CSharp\TextSpanExtensions.cs (1)
15return new SourceSpan(filePath: null, absoluteIndex: textSpan.Start, lineIndex: -1, characterIndex: -1, length: textSpan.Length);
Language\CodeGeneration\CodeRenderingContext.cs (1)
145var generatedLocation = new SourceSpan(
Language\Components\ComponentBindLoweringPass.cs (1)
1124return new SourceSpan(span.FilePath,
Language\DefaultDirectiveSyntaxTreePass.cs (1)
85var error = RazorDiagnosticFactory.CreateParsing_SectionsCannotBeNested(new SourceSpan(directiveStart, errorLength));
Language\DefaultRazorIntermediateNodeLoweringPhase.cs (5)
923node.Source = new SourceSpan( 955return new SourceSpan( 968return new SourceSpan( 984return new SourceSpan( 1043node.Source = new SourceSpan(
Language\DefaultTagHelperResolutionPhase.cs (6)
896return new SourceSpan( 927new SourceSpan(filePath, exprStart, atLoc.Line, atLoc.Character, 1, 0, atLoc.Character + 1))); 938new SourceSpan(filePath, exprStart, loc.Line, loc.Character, exprLength, 0, loc.Character + exprLength))); 959new SourceSpan(filePath, parenStart, openLoc.Line, openLoc.Character, 1, 0, openLoc.Character + 1))); 971new SourceSpan(filePath, innerStart, innerLoc.Line, innerLoc.Character, innerLen, 0, innerLoc.Character + innerLen))); 979new SourceSpan(filePath, closePos, closeLoc.Line, closeLoc.Character, 1, 0, closeLoc.Character + 1)));
Language\DefaultTagHelperResolutionPhase.LegacyTagHelperResolver.cs (12)
598var valueSource = new SourceSpan( 676var emptySource = new SourceSpan(atSrc.FilePath, transAbsIdx, atSrc.LineIndex, transCharIdx, 0, 0, transCharIdx); 679var transSource = new SourceSpan(atSrc.FilePath, transAbsIdx, atSrc.LineIndex, transCharIdx, 1, 0, transCharIdx + 1); 691var openSource = new SourceSpan(innerSource.FilePath, openAbsIndex, innerSource.LineIndex, openCharIndex, 1, 0, openCharIndex + 1); 704var closeSource = new SourceSpan(lastSource.FilePath, closeAbsIndex, lastSource.LineIndex, closeCharIndex, 1, 0, closeCharIndex + 1); 740var openParenSource = new SourceSpan( 766var closeParenSource = new SourceSpan( 864return new SourceSpan( 1342expr.Source = new SourceSpan(exprSource.FilePath, contentStart, openLoc.Line, openLoc.Character, contentLength, 0, closeLoc.Character + 1); 1348var contentSpan = new SourceSpan( 1456emptySpan = new SourceSpan(nextSrc.FilePath, nextSrc.AbsoluteIndex, loc.Line, loc.Character, 0, 0, loc.Character); 1633diagSource = new SourceSpan(
Language\Legacy\CSharpCodeParser.cs (43)
356new SourceSpan(CurrentStart, CurrentToken.Content.Length)); 414new SourceSpan(CurrentStart, CurrentToken.Content.Length))); 420new SourceSpan(CurrentStart, contentLength: 1 /* end of file */))); 426new SourceSpan(CurrentStart, CurrentToken.Content.Length), 470new SourceSpan(block.Start, contentLength: 1 /* ( */), block.Name, ")", "(")); 727new SourceSpan(block.Start, contentLength: 1 /* { OR } */), block.Name, "}", "{")); 854new SourceSpan(location, contentLength: 1 /* @ */))); 887new SourceSpan(block.Start, contentLength: 1 /* { OR } */), block.Name, "}", "{")); 949new SourceSpan(CurrentStart, contentLength: 1 /* { */))); 1074new SourceSpan(CurrentStart, contentLength: 1 /* @ */))); 1166new SourceSpan(CurrentStart, contentLength: 1 /* @ */))); 1214new SourceSpan(CurrentStart, CurrentToken.Content.Length))); 1236new SourceSpan(CurrentStart, currentDirective.Length), currentDirective)); 1260new SourceSpan(directiveStart, errorLength), 1372new SourceSpan(keywordStartLocation, keywordLength), keyword)); 1394new SourceSpan(valueStartLocation.Value, rawValue.Length), keyword)); 1483new SourceSpan(directiveLocation, Math.Max(text?.Length ?? 0, 1)), text ?? string.Empty)); 1539new SourceSpan(directiveLocation, prefix.Length), 1599new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1652new SourceSpan(CurrentStart, contentLength: 1), 1666new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1678new SourceSpan(CurrentStart, identifierLength), descriptor.Directive)); 1695new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1710new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1725new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1743new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive)); 1764new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive, CurrentToken.Content, lastSeenMemberIdentifier ?? string.Empty)); 1794new SourceSpan(CurrentStart, CurrentToken.Content.Length), 1817new SourceSpan(CurrentStart, identifierLength), descriptor.Directive)); 1857new SourceSpan(CurrentStart, CurrentToken.Content.Length), 1980new SourceSpan(directiveStart, errorLength), descriptor.Directive)); 2061new SourceSpan( 2074new SourceSpan( 2189new SourceSpan(CurrentStart, contentLength: 1 /* { */), descriptor.Directive, "{")); 2195new SourceSpan(CurrentStart, CurrentToken.Content.Length), descriptor.Directive, "{")); 2225new SourceSpan(startingBraceLocation, contentLength: 1 /* } */), descriptor.Directive, "}", "{")); 2387new SourceSpan(CurrentStart, CurrentToken.Content.Length))); 2395new SourceSpan(CurrentStart, contentLength: 2 /* @: */))); 2403new SourceSpan(CurrentStart, contentLength: 2 /* @@ */))); 2665new SourceSpan(block.Start, block.Name.Length))); 2910new SourceSpan(CurrentStart, CurrentToken.Content.Length), CurrentToken.Content)); 3092new SourceSpan(start, contentLength: 1 /* { OR } */), 3197new SourceSpan(start, contentLength: 1 /* { OR } */),
Language\Legacy\HtmlMarkupParser.cs (9)
179new SourceSpan(CurrentStart, CurrentToken.Content.Length))); 356new SourceSpan( 571new SourceSpan(SourceLocationTracker.Advance(endTagStartLocation, "</"), Math.Max(endTagName.Length, 1)), endTagName)); 587new SourceSpan( 688new SourceSpan(tagStartLocation, contentLength: 1))); 719new SourceSpan( 845new SourceSpan(textLocation, contentLength: 4 /* text */))); 997new SourceSpan(textLocation, contentLength: 4 /* text */))); 1575new SourceSpan(SourceLocationTracker.Advance(tagStart, "</"), ScriptTagName.Length),
Language\Legacy\NativeCSharpTokenizer.cs (3)
561new SourceSpan(CurrentStart, contentLength: 1 /* end of file */))); 591new SourceSpan(CurrentStart, contentLength: 1 /* " */))); 608new SourceSpan(CurrentStart, contentLength: 1 /* end of file */)));
Language\Legacy\RoslynCSharpTokenizer.cs (7)
393new SourceSpan(CurrentStart, contentLength: expectedPrefix?.Length ?? 0 /* " */))); 500new SourceSpan(CurrentStart, contentLength: 1 /* end of file */))); 528new SourceSpan(CurrentStart, contentLength: trivia.FullSpan.Length))); 546new SourceSpan(CurrentStart, contentLength: trivia.FullSpan.Length))); 556new SourceSpan(CurrentStart, contentLength: directiveTrivia.FullSpan.Length))); 590new SourceSpan( 604new SourceSpan(
Language\Legacy\TagHelperBlockRewriter.cs (3)
113var location = new SourceSpan(codeBlock.GetSourceLocation(source), codeBlock.Width); 190var errorLocation = new SourceSpan(attributeNameLocation, result.AttributeName.Length); 200var errorLocation = new SourceSpan(attributeNameLocation, result.AttributeName.Length);
Language\Legacy\TagHelperParseTreeRewriter.cs (9)
142var source = new SourceSpan(SourceLocationTracker.Advance(startTag.GetSourceLocation(_source), "<"), tagName.Length); 187new SourceSpan(SourceLocationTracker.Advance(endTag.GetSourceLocation(_source), "</"), tagName.Length), tagName)); 368new SourceSpan(SourceLocationTracker.Advance(endTag.GetSourceLocation(_source), "</"), tagName.Length), 493new SourceSpan(tagBlock.GetSourceLocation(_source), tagBlock.Width), 515new SourceSpan(errorStart, tagName.Length), tagName)); 532new SourceSpan(errorStart, tagName.Length), tagName)); 587new SourceSpan(errorStart, length), 705new SourceSpan(errorStart, tagName.Length), 723new SourceSpan(errorStart, tagName.Length),
Language\Legacy\TokenizerBackedParser.cs (2)
385new SourceSpan(start, contentLength: 2 /* @* */)); 395new SourceSpan(start, contentLength: 2 /* @* */));
Language\MarkupSplitter.Slicing.cs (1)
126var slicedSource = new SourceSpan(
Language\SourceChange.cs (1)
31Span = new SourceSpan(absoluteIndex, length);
Language\SourceSpan.cs (10)
14public static readonly SourceSpan Undefined = new SourceSpan(SourceLocation.Undefined, 0); 101return new SourceSpan(FilePath, AbsoluteIndex + Length, LineIndex, characterIndex: EndCharacterIndex, length: 0, lineCount: 0, EndCharacterIndex); 106return new SourceSpan(FilePath, AbsoluteIndex + startIndex, LineIndex, CharacterIndex + startIndex, length, LineCount, endCharacterIndex: CharacterIndex + startIndex + length); 130public readonly SourceSpan WithFilePath(string filePath) => new(filePath, AbsoluteIndex, LineIndex, CharacterIndex, Length, LineCount, EndCharacterIndex); 131public readonly SourceSpan WithAbsoluteIndex(int absoluteIndex) => new(FilePath, absoluteIndex, LineIndex, CharacterIndex, Length, LineCount, EndCharacterIndex); 132public readonly SourceSpan WithLineIndex(int lineIndex) => new(FilePath, AbsoluteIndex, lineIndex, CharacterIndex, Length, LineCount, EndCharacterIndex); 133public readonly SourceSpan WithCharacterIndex(int characterIndex) => new(FilePath, AbsoluteIndex, LineIndex, characterIndex, Length, LineCount, EndCharacterIndex); 134public readonly SourceSpan WithLength(int length) => new(FilePath, AbsoluteIndex, LineIndex, CharacterIndex, length, LineCount, EndCharacterIndex); 135public readonly SourceSpan WithLineCount(int lineCount) => new(FilePath, AbsoluteIndex, LineIndex, CharacterIndex, Length, lineCount, EndCharacterIndex); 136public readonly SourceSpan WithEndCharacterIndex(int endCharacterIndex) => new(FilePath, AbsoluteIndex, LineIndex, CharacterIndex, Length, LineCount, endCharacterIndex);
Language\SpanComputer.cs (1)
115return new SourceSpan(source.FilePath, absoluteIndex: start, startLinePosition.Line, startLinePosition.Character, length, lineCount, endLinePosition.Character);
Language\Syntax\SyntaxNodeExtensions.cs (2)
123return new SourceSpan(location.FilePath, location.AbsoluteIndex, location.LineIndex, location.CharacterIndex, node.Width, lineCount, endLocation.Character); 131return new SourceSpan(location.FilePath, location.AbsoluteIndex, location.LineIndex, location.CharacterIndex, token.Width, lineCount, endLocation.Character);
Mvc\InjectDirective.cs (1)
92typeSpan = new SourceSpan(typeSpan.Value.FilePath, typeSpan.Value.AbsoluteIndex, typeSpan.Value.LineIndex, typeSpan.Value.CharacterIndex, typeSpan.Value.Length - tModel.Length, typeSpan.Value.LineCount, typeSpan.Value.EndCharacterIndex - tModel.Length);
Mvc\RazorExtensionsDiagnosticFactory.cs (5)
22new SourceSpan(SourceLocation.Undefined, contentLength: 0), 35new SourceSpan(SourceLocation.Undefined, contentLength: 0), 48new SourceSpan(SourceLocation.Undefined, contentLength: 0), 61new SourceSpan(SourceLocation.Undefined, contentLength: 0), 73new SourceSpan(SourceLocation.Undefined, contentLength: 0),
rzc (1)
Json\ObjectReaders.cs (1)
26var span = new SourceSpan(filePath, absoluteIndex, lineIndex, characterIndex, length);
363 references to SourceSpan
Microsoft.CodeAnalysis.Razor.Compiler (356)
CSharp\SourceSpanExtensions.cs (1)
13public static TextSpan AsTextSpan(this SourceSpan sourceSpan)
CSharp\TextSpanExtensions.cs (1)
13public static SourceSpan AsSourceSpan(this TextSpan textSpan)
Language\CodeGeneration\CodeRenderingContext.cs (3)
120if (node.Source is not SourceSpan nodeSource) 128public void AddSourceMappingFor(SourceSpan source, int offset = 0) 145var generatedLocation = new SourceSpan(
Language\CodeGeneration\CodeRenderingContextExtensions.cs (8)
12this CodeRenderingContext context, SourceSpan? span, bool suppressLineDefaultAndHidden = false) 15return span is SourceSpan spanValue && !spanValue.FilePath.IsNullOrEmpty() 21this CodeRenderingContext context, SourceSpan? span, int characterOffset = 0, bool suppressLineDefaultAndHidden = false) 24return span is SourceSpan spanValue && !spanValue.FilePath.IsNullOrEmpty() 32private readonly SourceSpan _span; 39SourceSpan span, 53public static LinePragmaScope Standard(CodeRenderingContext context, SourceSpan span, bool suppressLineDefaultAndHidden) 65public static LinePragmaScope Enhanced(CodeRenderingContext context, SourceSpan span, int characterOffset, bool suppressLineDefaultAndHidden)
Language\CodeGeneration\CodeWriterExtensions.cs (10)
81public static CodeWriter WritePadding(this CodeWriter writer, int offset, SourceSpan? span, CodeRenderingContext context) 304public static CodeWriter WriteEnhancedLineNumberDirective(this CodeWriter writer, SourceSpan span, int characterOffset, bool ensurePathBackslashes) 326public static CodeWriter WriteLineNumberDirective(this CodeWriter writer, SourceSpan span, bool ensurePathBackslashes) 558SourceSpan? typeSpan = null, 559SourceSpan? nameSpan = null, 588SourceSpan? typeSpan, 589SourceSpan? nameSpan, 598static void WriteToken(CodeWriter writer, string content, SourceSpan? span, CodeRenderingContext context) 690public static CSharpCodeWritingScope BuildNamespace(this CodeWriter writer, string? name, SourceSpan? span, CodeRenderingContext context) 828static void WriteWithPragma(string content, CodeRenderingContext context, SourceSpan source)
Language\Components\ComponentBindLoweringPass.cs (2)
1109private static SourceSpan? GetOriginalPropertySpan(IntermediateNode node) 1120if (originalSpan is SourceSpan span)
Language\Components\ComponentDiagnosticFactory.cs (48)
23public static RazorDiagnostic Create_UnsupportedTagHelperDirective(SourceSpan? source) 33public static RazorDiagnostic Create_CodeBlockInAttribute(SourceSpan? source, string expression) 41public static RazorDiagnostic Create_UnclosedTag(SourceSpan? span, string tagName) 49public static RazorDiagnostic Create_UnexpectedClosingTag(SourceSpan? span, string tagName) 57public static RazorDiagnostic Create_UnexpectedClosingTagForVoidElement(SourceSpan? span, string tagName) 65public static RazorDiagnostic Create_InvalidHtmlContent(SourceSpan? span, string text) 73public static RazorDiagnostic Create_MultipleComponents(SourceSpan? span, string tagName, IEnumerable<TagHelperDescriptor> components) 86public static RazorDiagnostic Create_AmbiguousComponentSelection(SourceSpan? span, string tagName, TagHelperDescriptor genericComponent, TagHelperDescriptor nonGenericComponent) 108public static RazorDiagnostic CreatePageDirective_CannotBeImported(SourceSpan source) 120public static RazorDiagnostic CreatePageDirective_MustSpecifyRoute(SourceSpan? source) 129SourceSpan? source, string attribute, IEnumerable<TagHelperDirectiveAttributeIntermediateNode> attributes) 141public static RazorDiagnostic CreateEventHandler_Duplicates(SourceSpan? source, string attribute, TagHelperDirectiveAttributeIntermediateNode[] attributes) 154public static RazorDiagnostic CreateBindAttribute_InvalidSyntax(SourceSpan? source, string attribute) 164public static RazorDiagnostic Create_DisallowedScriptTag(SourceSpan? source) 172public static RazorDiagnostic Create_TemplateInvalidLocation(SourceSpan? source) 180public static RazorDiagnostic Create_ChildContentSetByAttributeAndBody(SourceSpan? source, string attribute) 189public static RazorDiagnostic Create_ChildContentMixedWithExplicitChildContent(SourceSpan? source, ComponentIntermediateNode component) 201public static RazorDiagnostic Create_ChildContentHasInvalidAttribute(SourceSpan? source, string attribute, string element) 209public static RazorDiagnostic Create_ChildContentHasInvalidParameter(SourceSpan? source, string attribute, string element) 219SourceSpan? source, 245SourceSpan? source, 262SourceSpan? source, 277public static RazorDiagnostic Create_ChildContentHasInvalidParameterOnComponent(SourceSpan? source, string attribute, string element) 285public static RazorDiagnostic Create_UnsupportedComponentImportContent(SourceSpan? source) 293public static RazorDiagnostic CreateBindAttributeParameter_MissingBind(SourceSpan? source, string attribute) 304public static RazorDiagnostic Create_DuplicateMarkupAttribute(string attributeName, SourceSpan? source = null) 313public static RazorDiagnostic Create_DuplicateMarkupAttributeDirective(string attributeName, string directiveAttributeName, SourceSpan? source = null) 321public static RazorDiagnostic Create_DuplicateComponentParameter(string attributeName, SourceSpan? source = null) 330public static RazorDiagnostic Create_DuplicateComponentParameterDirective(string attributeName, string directiveAttributeName, SourceSpan? source = null) 338public static RazorDiagnostic Create_ComponentNamesCannotStartWithLowerCase(string componentName, SourceSpan? source = null) 346public static RazorDiagnostic Create_UnexpectedMarkupElement(string elementName, SourceSpan? source = null) 354public static RazorDiagnostic Create_InconsistentStartAndEndTagName(string startTagName, string endTagName, SourceSpan? source = null) 362public static RazorDiagnostic CreateEventHandlerParameter_Duplicates(SourceSpan? source, string attribute, TagHelperDirectiveAttributeParameterIntermediateNode[] attributes) 374public static RazorDiagnostic CreateBindAttributeParameter_UseBindGet(SourceSpan? source, string attribute) 383public static RazorDiagnostic CreateBindAttributeParameter_MissingBindGet(SourceSpan? source, string attribute) 391public static RazorDiagnostic CreateBindAttribute_MissingBindSet(SourceSpan? source, string attributeGet, string attributeSet) 399public static RazorDiagnostic CreateBindAttributeParameter_InvalidSyntaxBindAndBindGet(SourceSpan? source, string attribute) 407public static RazorDiagnostic CreateBindAttributeParameter_InvalidSyntaxBindSetAfter(SourceSpan? source, string attribute) 415public static RazorDiagnostic CreateBindAttributeParameter_UnsupportedSyntaxBindGetSet(SourceSpan? source, string attribute) 425public static RazorDiagnostic CreateFormName_NotAForm(SourceSpan? source) 433public static RazorDiagnostic CreateAttribute_ValidOnlyOnComponent(SourceSpan? source, string attribute) 441public static RazorDiagnostic CreateRenderModeAttribute_ComponentDeclaredRenderMode(SourceSpan? source, string component) 452public static RazorDiagnostic Create_UnknownComponentParameter(SourceSpan? source, string component, string parameter) 461public static RazorDiagnostic CreateBindAttribute_MissingTarget(SourceSpan? source, string attribute, string component) 471SourceSpan? source, 483public static RazorDiagnostic Create_UnboundDirectiveAttribute(SourceSpan? source, string attribute) 491public static RazorDiagnostic CreateTildePath_MixedContent(SourceSpan? source, string attribute) 499public static RazorDiagnostic CreateAssetPath_NonStringParameter(SourceSpan? source, string parameter)
Language\Components\ComponentInjectIntermediateNode.cs (4)
22public ComponentInjectIntermediateNode(string typeName, string memberName, SourceSpan? typeSpan, SourceSpan? memberSpan) 34public SourceSpan? TypeSpan { get; } 36public SourceSpan? MemberSpan { get; }
Language\Components\ComponentLoweringPass.cs (1)
570private ComponentChildContentIntermediateNode RewriteChildContent(BoundAttributeDescriptor attribute, SourceSpan? source, IntermediateNodeCollection children)
Language\Components\ComponentNodeWriter.cs (2)
385var attributeSourceSpan = (SourceSpan)(attribute.PropertySpan ?? attribute.OriginalAttributeSpan);
Language\DefaultRazorIntermediateNodeLoweringPhase.cs (6)
264public UsingReference(string @namespace, SourceSpan? source, bool hasExplicitSemicolon) 272public SourceSpan? Source { get; } 543protected SourceSpan? BuildSourceSpanFromNode(SyntaxNode node) 556protected SourceSpan? BuildTagHelperDirectiveSourceSpan(CSharpStatementLiteralSyntax node) 921if (node.Source is SourceSpan source) 939protected SourceSpan? ComputeAttributeValueSourceSpan(MarkupAttributeBlockSyntax node)
Language\DefaultTagHelperResolutionPhase.ComponentTagHelperResolver.cs (14)
75SourceSpan? valueSourceSpan, 209if (directiveNameSpan is SourceSpan ns && attributeName.StartsWith('@')) 218if (match.IsParameterMatch && directiveAttributeName.HasParameter && parameterOriginalSpan is SourceSpan ps) 567SourceSpan? firstSpan = null; 568SourceSpan? lastSpan = null; 598SourceSpan? mergedSpan = null; 838SourceSpan? fallbackSource) 884if (directiveNameSpan is SourceSpan nameSpan && attributeName.StartsWith('@')) 1033private static SourceSpan? ComputeAttributeNameSpan(HtmlAttributeIntermediateNode htmlAttr) 1035if (htmlAttr.Source is not SourceSpan attrSource) 1064private static SourceSpan? ComputeAttributeValueSpan(HtmlAttributeIntermediateNode htmlAttr) 1067if (htmlAttr.Children is [{ Source: SourceSpan childSource }, ..]) 1077if (lastChild.Source is SourceSpan lastSource) 1092if (htmlAttr.Source is not SourceSpan attrSource)
Language\DefaultTagHelperResolutionPhase.cs (40)
393if (diagSource is SourceSpan ds) 400if (elementNode is { HasMissingEndCloseAngle: true, EndTagSpan: SourceSpan endDs }) 413if (diagSource is SourceSpan ds) 430if (diagSource is SourceSpan ds) 493if (current.Source is SourceSpan cs && next.Source is SourceSpan ns) 546elementNode.Source ?? SourceSpan.Undefined, 554elementNode.Source ?? SourceSpan.Undefined, 577child.Source ?? SourceSpan.Undefined, childTagName, parentTagName, allowedChildrenString)); 592child.Source ?? SourceSpan.Undefined, childTagName, parentTagName, allowedChildrenString)); 604child.Source ?? SourceSpan.Undefined, parentTagName, allowedChildrenString)); 613child.Source ?? SourceSpan.Undefined, parentTagName, allowedChildrenString)); 722SourceSpan? source, 850private static SourceSpan? ComputeValueSource(HtmlAttributeIntermediateNode htmlAttr) 852SourceSpan? result = null; 861if (token.Source is SourceSpan tokenSource) 867else if (child.Source is SourceSpan childSource) 875private static SourceSpan MergeSpans(SourceSpan a, SourceSpan b) 879var first = a.AbsoluteIndex <= b.AbsoluteIndex ? a : b; 880var last = a.AbsoluteIndex + a.Length >= b.AbsoluteIndex + b.Length ? a : b; 892internal static SourceSpan MergeSourceSpans(SourceSpan first, SourceSpan last) 989SourceSpan expressionSource, 1007private static (string Content, SourceSpan? Source) CollectAttributeValueContent(HtmlAttributeValueIntermediateNode attrValue) 1036private static HtmlContentIntermediateNode CreateEmptyHtmlContent(SourceSpan? source) 1048private static CSharpIntermediateToken CreateEmptyCSharpToken(SourceSpan? source) 1074private static SourceSpan? ExtendSpanBackward(SourceSpan? source, int prefixLength) 1090private static (string Content, SourceSpan? MergedSpan) CollectUnresolvedLiteralContent( 1092SourceSpan? valueSourceSpan) 1095SourceSpan? firstSpan = null; 1096SourceSpan? lastSpan = null; 1178if (elementNode.EndTagSpan is SourceSpan ets) 1187if (diagSource is SourceSpan ds) 1234elementNode.Source ?? SourceSpan.Undefined, 1341SourceSpan? valueSourceSpan, 1383SourceSpan? valueSourceSpan,
Language\DefaultTagHelperResolutionPhase.LegacyTagHelperResolver.cs (43)
21SourceSpan? valueSourceSpan, 159unresolvedAttr.AttributeNameSpan ?? SourceSpan.Undefined, attributeName, tagHelperNode.TagName, propertyType!)); 184unresolvedAttr.AttributeNameSpan ?? SourceSpan.Undefined, attributeName, tagHelperNode.TagName, propertyType!)); 573if (htmlAttr.Source is SourceSpan attrSource && sourceDocument != null) 598var valueSource = new SourceSpan( 617SourceSpan? lastAtTokenSource = null; 627if (intermediateToken.Content == "@" && intermediateToken.Source is SourceSpan src) 629if (lastAtTokenSource is SourceSpan last && last.AbsoluteIndex == src.AbsoluteIndex) 656if (attrContent == "@" && tokenSource is SourceSpan ats) 658if (lastAtTokenSource is SourceSpan last && last.AbsoluteIndex == ats.AbsoluteIndex) 671if (lastAtTokenSource is SourceSpan atSrc) 676var emptySource = new SourceSpan(atSrc.FilePath, transAbsIdx, atSrc.LineIndex, transCharIdx, 0, 0, transCharIdx); 679var transSource = new SourceSpan(atSrc.FilePath, transAbsIdx, atSrc.LineIndex, transCharIdx, 1, 0, transCharIdx + 1); 687if (firstInnerChild.Source is SourceSpan innerSource) 691var openSource = new SourceSpan(innerSource.FilePath, openAbsIndex, innerSource.LineIndex, openCharIndex, 1, 0, openCharIndex + 1); 700if (lastInnerChild.Source is SourceSpan lastSource) 704var closeSource = new SourceSpan(lastSource.FilePath, closeAbsIndex, lastSource.LineIndex, closeCharIndex, 1, 0, closeCharIndex + 1); 720if (htmlAttr.Source is SourceSpan attrSource && sourceDocument != null) 740var openParenSource = new SourceSpan( 766var closeParenSource = new SourceSpan( 851private static SourceSpan? ComputeEmptyValueSource(HtmlAttributeIntermediateNode htmlAttr) 853if (htmlAttr.Source is not SourceSpan attrSource) 1155if (current.Source is SourceSpan currentSource && next.Source is SourceSpan nextSource) 1238if (a.Source is SourceSpan aSource && b.Source is SourceSpan bSource) 1250SourceSpan? valueSourceSpan, 1348var contentSpan = new SourceSpan( 1364SourceSpan? firstSpan = null; 1365SourceSpan? lastSpan = null; 1412SourceSpan vss, 1452SourceSpan? emptySpan = null; 1492using var pendingLiteralParts = new PooledArrayBuilder<(string text, SourceSpan? source)>(); 1493SourceSpan? pendingFirstSpan = null; 1494SourceSpan? pendingLastSpan = null; 1585ref PooledArrayBuilder<(string text, SourceSpan? source)> pendingParts, 1586ref SourceSpan? pendingFirstSpan, 1587ref SourceSpan? pendingLastSpan) 1622codeChild.Source ?? elementNode.Source ?? SourceSpan.Undefined, elementNode.TagName)); 1630var diagSource = exprChild.Source ?? elementNode.Source ?? SourceSpan.Undefined; 1658ref SourceSpan? firstSpan, 1659ref SourceSpan? lastSpan)
Language\Extensions\DefaultTagHelperTargetExtension.cs (2)
415SourceSpan? span) 428SourceSpan? span)
Language\Intermediate\BaseTypeWithModel.cs (2)
17public BaseTypeWithModel(string baseType, SourceSpan? location = null) 27if (location is SourceSpan span)
Language\Intermediate\ComponentAttributeIntermediateNode.cs (2)
40public SourceSpan? PropertySpan { get; set; } 44public SourceSpan? OriginalAttributeSpan { get; set; }
Language\Intermediate\ComponentIntermediateNode.cs (1)
52public SourceSpan StartTagSpan { get; init; }
Language\Intermediate\ComponentTypeArgumentIntermediateNode.cs (5)
52SourceSpan? firstSpan = null; 53SourceSpan? lastSpan = null; 57SourceSpan? mergedSpan = null; 70private static void AppendTokens(IntermediateNode node, StringBuilder sb, ref SourceSpan? firstSpan, ref SourceSpan? lastSpan)
Language\Intermediate\CSharpIntermediateToken.cs (2)
8public CSharpIntermediateToken(string content, SourceSpan? source) 13internal CSharpIntermediateToken(LazyContent content, SourceSpan? source)
Language\Intermediate\HtmlIntermediateToken.cs (2)
8public HtmlIntermediateToken(string content, SourceSpan? source) 13internal HtmlIntermediateToken(LazyContent content, SourceSpan? source)
Language\Intermediate\IntermediateNode.cs (1)
23public SourceSpan? Source { get; set; }
Language\Intermediate\IntermediateNodeFactory.cs (4)
10public static CSharpIntermediateToken CSharpToken(string content, SourceSpan? source = null) 13public static CSharpIntermediateToken CSharpToken<T>(T arg, Func<T, string> contentFactory, SourceSpan? source = null) 16public static HtmlIntermediateToken HtmlToken(string content, SourceSpan? source = null) 19public static HtmlIntermediateToken HtmlToken<T>(T arg, Func<T, string> contentFactory, SourceSpan? source = null)
Language\Intermediate\IntermediateToken.cs (2)
17protected IntermediateToken(string content, SourceSpan? source) 28private protected IntermediateToken(LazyContent content, SourceSpan? source)
Language\Intermediate\TagHelperDirectiveAttributeIntermediateNode.cs (1)
16public SourceSpan? OriginalAttributeSpan { get; init; }
Language\Intermediate\TagHelperDirectiveAttributeParameterIntermediateNode.cs (1)
14public SourceSpan? OriginalAttributeSpan { get; init; }
Language\Intermediate\TagHelperHtmlAttributeIntermediateNode.cs (1)
10internal SourceSpan? AttributeNameSpan { get; init; }
Language\Intermediate\TagHelperIntermediateNode.cs (1)
16public SourceSpan? StartTagSpan { get; init; }
Language\Intermediate\TagHelperPropertyIntermediateNode.cs (1)
13public SourceSpan? OriginalAttributeSpan { get; init; }
Language\Intermediate\TypeParameter.cs (2)
21public TypeParameter(string name, SourceSpan? nameSource, string? constraints, SourceSpan? constraintsSource)
Language\Intermediate\UnresolvedAttributeIntermediateNode.cs (2)
35public SourceSpan? ValueSourceSpan { get; set; } 47public SourceSpan? AttributeNameSpan { get; set; }
Language\Intermediate\UnresolvedElementIntermediateNode.cs (3)
32public SourceSpan? EndTagSpan { get; set; } 38public SourceSpan? StartTagNameSpan { get; set; } 41public SourceSpan? StartTagSpan { get; set; }
Language\Legacy\ClassifiedSpanInternal.cs (4)
12public ClassifiedSpanInternal(SourceSpan span, SourceSpan blockSpan, SpanKindInternal spanKind, BlockKindInternal blockKind, AcceptedCharactersInternal acceptedCharacters) 28public SourceSpan BlockSpan { get; } 30public SourceSpan Span { get; }
Language\Legacy\ClassifiedSpanVisitor.cs (8)
23private SourceSpan? _currentBlockSpan; 240var sourceSpan = spanComputer.ToSourceSpan(_source); 277var sourceSpan = spanComputer.ToSourceSpan(_source); 406private readonly SourceSpan? _previousBlockSpan = visitor._currentBlockSpan; 417private SourceSpan CurrentBlockSpan 429var nodeSpan = node.GetSourceSpan(_source); 447var tokenSpan = token.GetSourceSpan(_source); 452private void AddSpan(SourceSpan span, SpanKindInternal kind, AcceptedCharactersInternal acceptedCharacters)
Language\Legacy\TagHelperBlockRewriter.cs (4)
113var location = new SourceSpan(codeBlock.GetSourceLocation(source), codeBlock.Width); 126var location = contentChild.GetSourceSpan(source); 190var errorLocation = new SourceSpan(attributeNameLocation, result.AttributeName.Length); 200var errorLocation = new SourceSpan(attributeNameLocation, result.AttributeName.Length);
Language\Legacy\TagHelperParseTreeRewriter.cs (1)
142var source = new SourceSpan(SourceLocationTracker.Advance(startTag.GetSourceLocation(_source), "<"), tagName.Length);
Language\Legacy\TagHelperSpanInternal.cs (1)
6internal readonly record struct TagHelperSpanInternal(SourceSpan Span, TagHelperBinding Binding)
Language\MarkupSplitter.Slicing.cs (1)
126var slicedSource = new SourceSpan(
Language\NamespaceComputer.cs (6)
24out SourceSpan? namespaceSpan) 37if (TryGetNamespaceFromDirective(codeDocument, considerImports, out var directiveNamespaceName, out var directiveNamespaceSpan)) 184out SourceSpan namespaceSpan) 221private SourceSpan _lastNamespaceSpan; 226out SourceSpan namespaceSpan) 237namespaceSpan = SourceSpan.Undefined;
Language\RazorCodeDocument.cs (1)
345out SourceSpan? namespaceSpan)
Language\RazorCodeDocumentExtensions.cs (1)
51out SourceSpan? namespaceSpan)
Language\RazorDiagnostic.cs (7)
18public SourceSpan Span { get; } 22private RazorDiagnostic(RazorDiagnosticDescriptor descriptor, SourceSpan? span, object[]? args) 25Span = span ?? SourceSpan.Undefined; 32public static RazorDiagnostic Create(RazorDiagnosticDescriptor descriptor, SourceSpan? span) 38public static RazorDiagnostic Create(RazorDiagnosticDescriptor descriptor, SourceSpan? span, params object[] args) 57var span = Span; 115var span = diagnostic.Span;
Language\RazorDiagnosticFactory.cs (63)
36public static RazorDiagnostic CreateParsing_UnterminatedStringLiteral(SourceSpan location) 44public static RazorDiagnostic CreateParsing_BlockCommentNotTerminated(SourceSpan location) 52public static RazorDiagnostic CreateParsing_HelperDirectiveNotAvailable(SourceSpan location) 60public static RazorDiagnostic CreateParsing_UnexpectedWhiteSpaceAtStartOfCodeBlock(SourceSpan location) 68public static RazorDiagnostic CreateParsing_UnexpectedEndOfFileAtStartOfCodeBlock(SourceSpan location) 76public static RazorDiagnostic CreateParsing_UnexpectedCharacterAtStartOfCodeBlock(SourceSpan location, string content) 84public static RazorDiagnostic CreateParsing_ExpectedEndOfBlockBeforeEOF(SourceSpan location, string blockName, string closeBlock, string openBlock) 92public static RazorDiagnostic CreateParsing_ReservedWord(SourceSpan location, string content) 100public static RazorDiagnostic CreateParsing_SingleLineControlFlowStatementsCannotContainMarkup(SourceSpan location) 108public static RazorDiagnostic CreateParsing_AtInCodeMustBeFollowedByColonParenOrIdentifierStart(SourceSpan location) 116public static RazorDiagnostic CreateParsing_UnexpectedNestedCodeBlock(SourceSpan location) 124public static RazorDiagnostic CreateParsing_DirectiveTokensMustBeSeparatedByWhitespace(SourceSpan location, string directiveName) 132public static RazorDiagnostic CreateParsing_UnexpectedEOFAfterDirective(SourceSpan location, string directiveName, string expectedToken) 140public static RazorDiagnostic CreateParsing_DirectiveExpectsTypeName(SourceSpan location, string directiveName) 148public static RazorDiagnostic CreateParsing_DirectiveExpectsNamespace(SourceSpan location, string directiveName) 156public static RazorDiagnostic CreateParsing_DirectiveExpectsIdentifier(SourceSpan location, string directiveName) 164public static RazorDiagnostic CreateParsing_DirectiveExpectsQuotedStringLiteral(SourceSpan location, string directiveName) 172public static RazorDiagnostic CreateParsing_UnexpectedDirectiveLiteral(SourceSpan location, string directiveName, string expected) 180public static RazorDiagnostic CreateParsing_DirectiveMustHaveValue(SourceSpan location, string directiveName) 188public static RazorDiagnostic CreateParsing_IncompleteQuotesAroundDirective(SourceSpan location, string directiveName) 196public static RazorDiagnostic CreateParsing_InvalidTagHelperPrefixValue(SourceSpan location, string directiveName, char character, string prefix) 204public static RazorDiagnostic CreateParsing_MarkupBlockMustStartWithTag(SourceSpan location) 213public static RazorDiagnostic CreateParsing_OuterTagMissingName(SourceSpan location) 221public static RazorDiagnostic CreateParsing_TextTagCannotContainAttributes(SourceSpan location) 229public static RazorDiagnostic CreateParsing_UnfinishedTag(SourceSpan location, string tagName) 237public static RazorDiagnostic CreateParsing_MissingEndTag(SourceSpan location, string tagName) 245public static RazorDiagnostic CreateParsing_UnexpectedEndTag(SourceSpan location, string tagName) 253public static RazorDiagnostic CreateParsing_ExpectedCloseBracketBeforeEOF(SourceSpan location, string openBrace, string closeBrace) 261public static RazorDiagnostic CreateParsing_RazorCommentNotTerminated(SourceSpan location) 269public static RazorDiagnostic CreateParsing_TagHelperIndexerAttributeNameMustIncludeKey(SourceSpan location, string attributeName, string tagName) 277public static RazorDiagnostic CreateParsing_TagHelperAttributeListMustBeWellFormed(SourceSpan location) 285public static RazorDiagnostic CreateParsing_TagHelpersCannotHaveCSharpInTagDeclaration(SourceSpan location, string tagName) 293public static RazorDiagnostic CreateParsing_TagHelperAttributesMustHaveAName(SourceSpan location, string tagName) 301public static RazorDiagnostic CreateParsing_TagHelperMustNotHaveAnEndTag(SourceSpan location, string tagName, string displayName, TagStructure tagStructure) 309public static RazorDiagnostic CreateParsing_TagHelperFoundMalformedTagHelper(SourceSpan location, string tagName) 317public static RazorDiagnostic CreateParsing_TagHelperMissingCloseAngle(SourceSpan location, string tagName) 325public static RazorDiagnostic CreateParsing_InvalidTagHelperLookupText(SourceSpan location, string lookupText) 333public static RazorDiagnostic CreateParsing_DirectiveExpectsCSharpAttribute(SourceSpan location, string directiveName) 341public static RazorDiagnostic CreateParsing_DirectiveExpectsBooleanLiteral(SourceSpan location, string directiveName) 349public static RazorDiagnostic CreateParsing_GenericTypeParameterIdentifierMismatch(SourceSpan location, string directiveName, string constraintIdentifier, string originalMember) 357public static RazorDiagnostic CreateParsing_UnexpectedIdentifier(SourceSpan location, string content, params string[] options) 365public static RazorDiagnostic CreateParsing_DirectiveExpectsIdentifierOrExpression(SourceSpan location, string directiveName) 373public static RazorDiagnostic CreateParsing_VoidElement(SourceSpan location, string tagName) 381public static RazorDiagnostic CreateParsing_PreprocessorDirectivesMustBeAtTheStartOfLine(SourceSpan location) 389public static RazorDiagnostic CreateParsing_PossibleMisplacedPreprocessorDirective(SourceSpan location) 397public static RazorDiagnostic CreateParsing_DefineAndUndefNotAllowed(SourceSpan location) 405public static RazorDiagnostic CreateParsing_DocumentationCommentTerminator(SourceSpan location) 414public static RazorDiagnostic CreateParsing_DocumentationDirectiveWillChangeMeaning(SourceSpan location) 422public static RazorDiagnostic CreateParsing_DocumentationShouldStartWithTag(SourceSpan location) 444public static RazorDiagnostic CreateParsing_DuplicateDirective(SourceSpan location, string directive) 452public static RazorDiagnostic CreateParsing_SectionsCannotBeNested(SourceSpan location) 460public static RazorDiagnostic CreateParsing_InlineMarkupBlocksCannotBeNested(SourceSpan location) 468public static RazorDiagnostic CreateParsing_NamespaceImportAndTypeAliasCannotExistWithinCodeBlock(SourceSpan location) 476public static RazorDiagnostic CreateParsing_DirectiveMustAppearAtStartOfLine(SourceSpan location, string directiveName) 484public static RazorDiagnostic CreateTagHelper_CodeBlocksNotSupportedInAttributes(SourceSpan? location) 492public static RazorDiagnostic CreateTagHelper_InlineMarkupBlocksNotSupportedInAttributes(SourceSpan? location, string expectedTypeName) 500public static RazorDiagnostic CreateTagHelper_EmptyBoundAttribute(SourceSpan location, string attributeName, string tagName, string propertyTypeName) 508public static RazorDiagnostic CreateTagHelper_CannotHaveNonTagContent(SourceSpan location, string tagName, string allowedChildren) 516public static RazorDiagnostic CreateTagHelper_InvalidNestedTag(SourceSpan location, string tagName, string parent, string allowedChildren) 524public static RazorDiagnostic CreateTagHelper_InconsistentTagStructure(SourceSpan location, string firstDescriptor, string secondDescriptor, string tagName) 538public static RazorDiagnostic CreateComponent_EditorRequiredParameterNotSpecified(SourceSpan? location, string tagName, string parameterName) 701public static RazorDiagnostic CreateRewriter_InsufficientStack(SourceSpan? location = null) 715public static RazorDiagnostic CreateCssRewriting_ImportNotAllowed(SourceSpan location)
Language\SourceChange.cs (2)
35public SourceChange(SourceSpan span, string newText) 52public SourceSpan Span { get; }
Language\SourceLocation.cs (1)
90public static SourceLocation FromSpan(SourceSpan? span)
Language\SourceMapping.cs (4)
14public SourceMapping(SourceSpan originalSpan, SourceSpan generatedSpan) 20public SourceSpan OriginalSpan { get; } 22public SourceSpan GeneratedSpan { get; }
Language\SourceSpan.cs (18)
12public readonly struct SourceSpan : IEquatable<SourceSpan> 14public static readonly SourceSpan Undefined = new SourceSpan(SourceLocation.Undefined, 0); 61public bool Equals(SourceSpan other) 73return obj is SourceSpan span && Equals(span); 99internal readonly SourceSpan GetZeroWidthEndSpan() 104internal readonly SourceSpan Slice(int startIndex, int length) 109public static bool operator ==(SourceSpan left, SourceSpan right) 114public static bool operator !=(SourceSpan left, SourceSpan right) 119public readonly int CompareByStartThenLength(SourceSpan other) 130public readonly SourceSpan WithFilePath(string filePath) => new(filePath, AbsoluteIndex, LineIndex, CharacterIndex, Length, LineCount, EndCharacterIndex); 131public readonly SourceSpan WithAbsoluteIndex(int absoluteIndex) => new(FilePath, absoluteIndex, LineIndex, CharacterIndex, Length, LineCount, EndCharacterIndex); 132public readonly SourceSpan WithLineIndex(int lineIndex) => new(FilePath, AbsoluteIndex, lineIndex, CharacterIndex, Length, LineCount, EndCharacterIndex); 133public readonly SourceSpan WithCharacterIndex(int characterIndex) => new(FilePath, AbsoluteIndex, LineIndex, characterIndex, Length, LineCount, EndCharacterIndex); 134public readonly SourceSpan WithLength(int length) => new(FilePath, AbsoluteIndex, LineIndex, CharacterIndex, length, LineCount, EndCharacterIndex); 135public readonly SourceSpan WithLineCount(int lineCount) => new(FilePath, AbsoluteIndex, LineIndex, CharacterIndex, Length, lineCount, EndCharacterIndex); 136public readonly SourceSpan WithEndCharacterIndex(int endCharacterIndex) => new(FilePath, AbsoluteIndex, LineIndex, CharacterIndex, Length, LineCount, endCharacterIndex);
Language\SpanComputer.cs (1)
94public readonly SourceSpan ToSourceSpan(RazorSourceDocument source)
Language\Syntax\SyntaxNodeExtensions.cs (2)
118public static SourceSpan GetSourceSpan(this SyntaxNode node, RazorSourceDocument source) 126public static SourceSpan GetSourceSpan(this SyntaxToken token, RazorSourceDocument source)
Mvc.Version2_X\InstrumentationPass.cs (2)
57public InstrumentationItem(IntermediateNode node, IntermediateNode parent, bool isLiteral, SourceSpan source) 71public SourceSpan Source { get; }
Mvc\InjectIntermediateNode.cs (2)
17public SourceSpan? TypeSource { get; set; } 21public SourceSpan? MemberSource { get; set; }
Mvc\ModelDirective.cs (1)
105modelType.Source is SourceSpan modelSource &&
Mvc\PageDirective.cs (3)
27private PageDirective(string routeTemplate, IntermediateNode directiveNode, SourceSpan? source) 38public SourceSpan? Source { get; } 67SourceSpan? sourceSpan = null;
Mvc\RazorExtensionsDiagnosticFactory.cs (3)
83public static RazorDiagnostic CreatePageDirective_CannotBeImported(SourceSpan source) 95public static RazorDiagnostic CreatePageDirective_MustExistAtTheTopOfFile(SourceSpan source) 104public static RazorDiagnostic CreateModelDirective_ModelTypeNotApplied(SourceSpan source)
SourceGenerators\Diagnostics\RazorDiagnostics.cs (2)
107var span = razorDiagnostic.Span; 110if (span == SourceSpan.Undefined || span.FilePath is null)
rzc (7)
Json\ObjectReaders.cs (6)
19var filePath = reader.ReadStringOrNull(nameof(SourceSpan.FilePath)); 20var absoluteIndex = reader.ReadInt32OrZero(nameof(SourceSpan.AbsoluteIndex)); 21var lineIndex = reader.ReadInt32OrZero(nameof(SourceSpan.LineIndex)); 22var characterIndex = reader.ReadInt32OrZero(nameof(SourceSpan.CharacterIndex)); 23var length = reader.ReadInt32OrZero(nameof(SourceSpan.Length)); 26var span = new SourceSpan(filePath, absoluteIndex, lineIndex, characterIndex, length);
Json\ObjectWriters.cs (1)
20var span = value.Span;