493 instantiations of TextSpan
dotnet (2)
Commands\Run\FileBasedAppSourceEditor.cs (2)
122var span = new TextSpan(start: addAfter.Info.Span.End, length: 0); 226return new TextChange(new TextSpan(start: start, length: 0), newText: prefix + directive.ToString() + suffix);
dotnet-format (3)
Formatters\EndOfLineFormatter.cs (1)
40var lineEndingSpan = new TextSpan(line.End, line.EndIncludingLineBreak - line.End);
Formatters\FinalNewlineFormatter.cs (2)
43var finalNewlineSpan = new TextSpan(lastLine.End, 0); 53var finalNewlineSpan = new TextSpan(lineBeforeLast.End, lineBeforeLast.EndIncludingLineBreak - lineBeforeLast.End);
GenerateDocumentationAndConfigFiles (31)
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (4)
225addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion)); 226oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 380add(builder, new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, newChange.SpanLength), newChange.NewLength)); 391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (1)
96public TextSpan Span => new(TokenStart + Green.Offset, Green.Width);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
53: this(sequence, new TextSpan(0, sequence.Length)) 88=> new(_leafCharacters, new TextSpan(_span.Start + start, length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (1)
209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (3)
737return new TextSpan(this.StartPosition, 0); 745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0); 751return new TextSpan(this.EndPosition, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
52return new TextSpan(wordStart, 1); 70return new TextSpan(wordStart, 1); 98return new TextSpan(wordStart, 1); 129return new TextSpan(wordStart, end - wordStart); 135return new TextSpan(wordStart, current - wordStart); 147return new TextSpan(wordStart, 1); 159return new TextSpan(wordStart, current - wordStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
126=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
79textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
Microsoft.Analyzers.Extra.Tests (1)
Resources\RoslynTestUtils.cs (1)
107return new TextSpan(start, end - start);
Microsoft.Analyzers.Local.Tests (1)
Resources\RoslynTestUtils.cs (1)
107return new TextSpan(start, end - start);
Microsoft.AspNetCore.App.Analyzers (20)
Infrastructure\RoutePattern\RoutePatternLexer.cs (1)
44return CreateToken(GetKind(ch), Text.GetSubSequence(new TextSpan(Position - 1, 1)));
Infrastructure\RoutePattern\RoutePatternParser.cs (2)
620? new TextSpan(_lexer.Text.Last().Span.End, 0) 621: new TextSpan(token.VirtualChars[0].Span.Start, 0);
Infrastructure\VirtualChars\AbstractVirtualCharService.cs (5)
36span = new TextSpan(offset + index, 2); 164result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 205result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 212result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 219result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 1)));
Infrastructure\VirtualChars\CSharpVirtualCharService.cs (6)
295charResults.Add((ch, new TextSpan(offset + index, 1))); 389result.Add((ch, new TextSpan(offset + index, 2))); 456result.Add(((char)uintChar, new TextSpan(startIndex + offset, 2 + 8))); 467result.Add(((char)highSurrogate, new TextSpan(pos, 0))); 468result.Add(((char)lowSurrogate, new TextSpan(pos, 2 + 8))); 496result.Add((character, new TextSpan(startIndex + offset, 2 + 4)));
Infrastructure\VirtualChars\VirtualCharSequence.Chunks.cs (1)
155var span = new TextSpan(_firstVirtualCharPosition + index, length: 1);
Infrastructure\VirtualChars\VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 91=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (1)
88new TextChange(new TextSpan(int.Parse(startString, CultureInfo.InvariantCulture), int.Parse(lengthString, CultureInfo.InvariantCulture)), newText),
RouteEmbeddedLanguage\RoutePatternCompletionProvider.cs (1)
82new TextChange(new TextSpan(int.Parse(startString, CultureInfo.InvariantCulture), int.Parse(lengthString, CultureInfo.InvariantCulture)), newText),
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (1)
297var targetSpan = new TextSpan(
Microsoft.CodeAnalysis (40)
CodeGen\RawSequencePoint.cs (1)
21internal static readonly TextSpan HiddenSequencePointSpan = new TextSpan(0x7FFFFFFF, 0);
Syntax\SyntaxDiffer.cs (7)
46return new[] { new TextChange(new TextSpan(0, 0), after.GetText().ToString()) }; 82return new[] { new TextSpan(0, after!.GetText().Length) }; 113newSpans.Add(new TextSpan(start, change.Range.NewLength)); 570RecordChange(new ChangeRecord(new TextChangeRange(new TextSpan(start, 0), newSpan.Length), null, insertedNodes)); 582new TextChangeRange(new TextSpan(last.Range.Span.Start, last.Range.Span.Length + change.Range.Span.Length), last.Range.NewLength + change.Range.NewLength), 605new TextChangeRange(new TextSpan(last.Range.Span.Start, last.Range.Span.Length + textChangeRange.Span.Length), last.Range.NewLength + textChangeRange.NewLength), 764new TextSpan(range.Span.Start + commonLeadingCount, range.Span.Length - (commonLeadingCount + commonTrailingCount)),
Syntax\SyntaxNode.cs (2)
85public TextSpan FullSpan => new TextSpan(this.Position, this.Green.FullWidth); 109return new TextSpan(start, width);
Syntax\SyntaxNodeOrToken.cs (1)
279return new TextSpan(Position, _token.FullWidth);
Syntax\SyntaxToken.cs (2)
110return Node != null ? new TextSpan(Position + Node.GetLeadingTriviaWidth(), Node.Width) : default(TextSpan); 133public TextSpan FullSpan => new TextSpan(Position, FullWidth);
Syntax\SyntaxTokenList.cs (1)
161return new TextSpan(this.Position, Node.FullWidth);
Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
Syntax\SyntaxTrivia.cs (2)
97? new TextSpan(Position + UnderlyingNode.GetLeadingTriviaWidth(), UnderlyingNode.Width) 124get { return UnderlyingNode != null ? new TextSpan(Position, UnderlyingNode.FullWidth) : default(TextSpan); }
Syntax\SyntaxTriviaList.cs (1)
159return new TextSpan(this.Position, Node.FullWidth);
Text\ChangedText.cs (1)
206return ImmutableArray.Create(new TextChangeRange(new TextSpan(0, oldText.Length), _newText.Length));
Text\CompositeText.cs (4)
102AddSegments(newSegments, segment.GetSubText(new TextSpan(segOffset, copyLength))); 222segments[i - 1] = prevSegment.GetSubText(new TextSpan(0, prevSegment.Length - 1)); 224segments[i + 1] = curSegment.GetSubText(new TextSpan(1, curSegment.Length - 1)); 537var resultLine = TextLine.FromSpanUnsafe(_compositeText, new TextSpan(firstSegmentOffset + firstSegmentTextLine.Start, lineLength), lineBreakLen);
Text\SourceText.cs (8)
536return this.GetSubText(new TextSpan(start, this.Length - start)); 545this.Write(textWriter, new TextSpan(0, this.Length), cancellationToken); 714return ToString(new TextSpan(0, this.Length)); 817var subText = this.GetSubText(new TextSpan(position, change.Span.Start - position)); 840var subText = this.GetSubText(new TextSpan(position, this.Length - position)); 888return this.Replace(new TextSpan(start, length), newText); 909return ImmutableArray.Create(new TextChangeRange(new TextSpan(0, oldText.Length), this.Length)); 933var span = new TextSpan(newPos, range.NewLength);
Text\SubText.cs (3)
95return new TextSpan(compositeStart, compositeEnd - compositeStart); 145return TextLine.FromSpanUnsafe(_subText, new TextSpan(_subText.UnderlyingSpan.Length, 0), lineBreakLength: 0); 178var resultLine = TextLine.FromSpanUnsafe(_subText, new TextSpan(startInSubText, length), lineBreakLen);
Text\TextChangeRangeExtensions.cs (4)
225addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion)); 226oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 380add(builder, new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, newChange.SpanLength), newChange.NewLength)); 391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
Text\TextLine.cs (1)
77span = new TextSpan(span.Start, span.Length + lineBreakLen);
Text\TextSpan.cs (1)
197return new TextSpan(start, end - start);
Microsoft.CodeAnalysis.Analyzers (34)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer.cs (1)
713fileSpan = new TextSpan(spanSpart, spanLength);
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_ResourceStringsFormat.cs (1)
99var span = new TextSpan(indexOfValue, valueLength);
MetaAnalyzers\Fixers\AnalyzerReleaseTrackingFix.cs (1)
434return unshippedText.Replace(new TextSpan(0, unshippedText.Length), builder.ToString());
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (4)
225addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion)); 226oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 380add(builder, new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, newChange.SpanLength), newChange.NewLength)); 391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (1)
96public TextSpan Span => new(TokenStart + Green.Offset, Green.Width);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
53: this(sequence, new TextSpan(0, sequence.Length)) 88=> new(_leafCharacters, new TextSpan(_span.Start + start, length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (1)
209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (3)
737return new TextSpan(this.StartPosition, 0); 745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0); 751return new TextSpan(this.EndPosition, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
52return new TextSpan(wordStart, 1); 70return new TextSpan(wordStart, 1); 98return new TextSpan(wordStart, 1); 129return new TextSpan(wordStart, end - wordStart); 135return new TextSpan(wordStart, current - wordStart); 147return new TextSpan(wordStart, 1); 159return new TextSpan(wordStart, current - wordStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
126=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
79textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
Microsoft.CodeAnalysis.AnalyzerUtilities (29)
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (4)
225addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion)); 226oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 380add(builder, new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, newChange.SpanLength), newChange.NewLength)); 391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (1)
96public TextSpan Span => new(TokenStart + Green.Offset, Green.Width);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
53: this(sequence, new TextSpan(0, sequence.Length)) 88=> new(_leafCharacters, new TextSpan(_span.Start + start, length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (1)
209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (3)
737return new TextSpan(this.StartPosition, 0); 745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0); 751return new TextSpan(this.EndPosition, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
52return new TextSpan(wordStart, 1); 70return new TextSpan(wordStart, 1); 98return new TextSpan(wordStart, 1); 129return new TextSpan(wordStart, end - wordStart); 135return new TextSpan(wordStart, current - wordStart); 147return new TextSpan(wordStart, 1); 159return new TextSpan(wordStart, current - wordStart);
Microsoft.CodeAnalysis.CodeStyle (37)
src\roslyn\src\Analyzers\Core\Analyzers\FileHeaders\FileHeader.cs (2)
102return Location.Create(syntaxTree, new TextSpan(_fileHeaderStart, 0)); 105return Location.Create(syntaxTree, new TextSpan(_fileHeaderStart, _commentPrefixLength));
src\roslyn\src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (4)
72if (oldText.GetSubText(new TextSpan(change.Span.Start + offset, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 74change = new TextChange(new TextSpan(change.Span.Start, offset), ""); 81if (oldText.GetSubText(new TextSpan(change.Span.Start, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 83change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), "");
src\roslyn\src\Analyzers\Core\Analyzers\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (1)
79Location.Create(badTrivia.SyntaxTree!, new TextSpan(badTrivia.SpanStart, 0)),
src\roslyn\src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
354new Text.TextSpan(
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (4)
225addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion)); 226oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 380add(builder, new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, newChange.SpanLength), newChange.NewLength)); 391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (1)
96public TextSpan Span => new(TokenStart + Green.Offset, Green.Width);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
53: this(sequence, new TextSpan(0, sequence.Length)) 88=> new(_leafCharacters, new TextSpan(_span.Start + start, length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (1)
209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (3)
737return new TextSpan(this.StartPosition, 0); 745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0); 751return new TextSpan(this.EndPosition, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
52return new TextSpan(wordStart, 1); 70return new TextSpan(wordStart, 1); 98return new TextSpan(wordStart, 1); 129return new TextSpan(wordStart, end - wordStart); 135return new TextSpan(wordStart, current - wordStart); 147return new TextSpan(wordStart, 1); 159return new TextSpan(wordStart, current - wordStart);
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (1)
39document, new TextSpan(typeName.Value.Span.Start, 0), forRefactoring: false, cancellationToken).ConfigureAwait(false);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
126=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
79textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
Microsoft.CodeAnalysis.CSharp (20)
Binder\Binder_Expressions.cs (3)
5533var errorSpan = new TextSpan(start, end - start); 7536diagnostics.Add(new CSDiagnosticInfo(ErrorCode.WRN_LowercaseEllSuffix), Location.Create(node.SyntaxTree, new TextSpan(token.Span.End - 1, 1))); 7540diagnostics.Add(new CSDiagnosticInfo(ErrorCode.WRN_LowercaseEllSuffix), Location.Create(node.SyntaxTree, new TextSpan(token.Span.End - 2, 1)));
Binder\Binder_Query.cs (1)
737SourceLocation errorLocation = new SourceLocation(let.SyntaxTree, new TextSpan(let.Identifier.SpanStart, let.Expression.Span.End - let.Identifier.SpanStart));
Compilation\SyntaxTreeSemanticModel.cs (1)
774Compilation.IsNullableAnalysisEnabledIn((CSharpSyntaxTree)SyntaxTree, new TextSpan(position, 0));
Compiler\DocumentationCommentCompiler.cs (1)
699Location location = new SourceLocation(trivia.SyntaxTree, new TextSpan(trivia.SpanStart, 0));
Compiler\UnprocessedDocumentationCommentFinder.cs (1)
104_diagnostics.Add(ErrorCode.WRN_UnprocessedXMLComment, new SourceLocation(trivia.SyntaxTree, new TextSpan(start, length)));
DocumentationComments\SourceDocumentationCommentUtils.cs (1)
81diagnostics.Add(ErrorCode.WRN_UnprocessedXMLComment, new SourceLocation(tree, new TextSpan(start, length)));
FlowAnalysis\AbstractFlowPass.cs (1)
205this.RegionSpan = new TextSpan(startLocation, length);
FlowAnalysis\NullableWalker.cs (2)
1685return compilation.SyntaxTrees.Any(static tree => ((CSharpSyntaxTree)tree).IsNullableAnalysisEnabled(new Text.TextSpan(0, tree.Length)) == true); 9712location = Location.Create(lambdaSyntax.SyntaxTree, new Text.TextSpan(start, lambdaSyntax.ArrowToken.Span.End - start));
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (1)
631return new TextSpan(startSpan.Start, originalSpan.Length - (startSpan.Start - originalSpan.Start));
Lowering\LocalRewriter\LocalRewriter_SwitchExpression.cs (1)
78var spanForSwitchBody = new TextSpan(spanStart, spanEnd - spanStart);
Parser\Blender.cs (1)
151var column = oldTree.SyntaxTree.GetLineSpan(new TextSpan(start, 0)).Span.Start.Character;
Parser\SlidingTextWindow.cs (1)
404var span = new TextSpan(position, length);
Symbols\Synthesized\SynthesizedInteractiveInitializerMethod.cs (1)
252compilation.SyntaxTrees.Any(static tree => ((CSharpSyntaxTree)tree).IsNullableAnalysisEnabled(new TextSpan(0, tree.Length)) == true);
Syntax\CSharpSyntaxTree.cs (2)
551return this.WithChanges(newText, new[] { new TextChangeRange(new TextSpan(0, this.Length), newText.Length) }); 565if (workingChanges.Count == 1 && workingChanges[0].Span == new TextSpan(0, this.Length) && workingChanges[0].NewLength == newText.Length)
Syntax\SyntaxNodeRemover.cs (1)
80return new TextSpan(start, end - start);
Syntax\SyntaxReplacer.cs (1)
157_totalSpan = new TextSpan(start, end - start);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (6)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
67var nodeAtInsertPosition = syntaxRoot.FindNode(new TextSpan(openParenthesisPosition, 0));
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (2)
175new TextSpan(textLine.Start, ComputeCommonIndentationLength(textLine)), 235return new TextChange(new TextSpan(textLine.Start, 0), newText: indentation);
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
92edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
94edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeFixesAndRefactorings\CSharpFixAllSpanMappingService.cs (1)
45fixAllSpan = new TextSpan(root.FullSpan.Start, firstTypeOrNamespaceDecl.FullSpan.Start - 1);
Microsoft.CodeAnalysis.CSharp.Features (32)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (2)
129newLineEdit = new TextChange(new TextSpan(annotatedNewline.SpanStart, 0), annotatedNewline.ToString()); 210var newTextChangeText = formattedText.GetSubText(new TextSpan(newRange.Span.Start + amountToShift, newRange.NewLength)).ToString();
BraceMatching\BlockCommentBraceMatcher.cs (2)
50return new BraceMatchingResult(new TextSpan(trivia.SpanStart, "/*".Length), TextSpan.FromBounds(trivia.Span.End - "*/".Length, trivia.Span.End)); 54var startBrace = new TextSpan(trivia.FullSpan.Start, "/**".Length);
BraceMatching\StringLiteralBraceMatcher.cs (4)
65new TextSpan(token.SpanStart, 2), 66new TextSpan(token.Span.End - endTokenLength, endTokenLength)); 71new TextSpan(token.SpanStart, 1), 72new TextSpan(token.Span.End - endTokenLength, endTokenLength));
Completion\CompletionProviders\CompletionUtilities.cs (2)
213return new TextSpan(caretTarget.Span.End, 0); 236return new TextSpan(propertyDeclaration.Span.End, 0);
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Conversions.cs (4)
95builder.Add(new TextChange(new TextSpan(expression.SpanStart, 0), castText)); 107builder.Add(new TextChange(new TextSpan(dotToken.SpanStart, 1), ")")); 112builder.Add(new TextChange(new TextSpan(questionToken.Value.SpanStart, 0), ")")); 114builder.Add(new TextChange(new TextSpan(dotToken.SpanStart, 1), ""));
Copilot\CSharpCopilotProposalAdjusterService.cs (1)
49d => new TextChange(new TextSpan(d.Location.SourceSpan.Start, 0), "}"));
ExtractInterface\CSharpExtractInterfaceService.cs (1)
34var span = new TextSpan(position, 0);
GenerateType\CSharpGenerateTypeService.cs (2)
563? semanticModel.SyntaxTree.GetLocation(new TextSpan(lastMember.Span.End, 0)) 564: semanticModel.SyntaxTree.GetLocation(new TextSpan());
InlineHints\CSharpInlineTypeHintsService.cs (5)
59: new(type, new TextSpan(variableDesignation.Identifier.SpanStart, 0), textChange: null, trailingSpace: true); 75var span = new TextSpan(parameterNode.Identifier.SpanStart, 0); 94var span = new TextSpan(implicitNew.NewKeyword.Span.End, 0); 107var span = new TextSpan(collectionExpression.OpenBracketToken.SpanStart, 0); 146return new TextSpan(normalSpan.SpanStart, 0);
RawStringLiteral\CSharpRawStringLiteralOnAutoInsertService.cs (3)
71return new TextChange(new TextSpan(position + 1, 0), "\"\"\""); 123return new TextChange(new TextSpan(position + 1, 0), "\""); 175return new TextChange(new TextSpan(token.GetRequiredParent().Span.End, 0), "\"");
Snippets\CSharpSnippetFunctionService.cs (1)
56var typeSpan = new TextSpan(caseGenerationLocation.Start + "case ".Length, fullyQualifiedTypeName.Length);
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
67var nodeAtInsertPosition = syntaxRoot.FindNode(new TextSpan(openParenthesisPosition, 0));
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (2)
175new TextSpan(textLine.Start, ComputeCommonIndentationLength(textLine)), 235return new TextChange(new TextSpan(textLine.Start, 0), newText: indentation);
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
92edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
94edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
Microsoft.CodeAnalysis.CSharp.Workspaces (12)
Classification\Worker_Preprocesser.cs (7)
356AddClassification(new TextSpan(node.Content.SpanStart, firstWhitespaceIndex), ClassificationTypeNames.PreprocessorKeyword); 385AddClassification(new TextSpan(node.Content.SpanStart + nameStart, contentText.Length - nameStart), ClassificationTypeNames.StringLiteral); 411AddClassification(new TextSpan(contentStart + separatorIndex, 1), ClassificationTypeNames.Punctuation); 418AddClassification(new TextSpan(contentStart + valueIndex, contentText.Length - valueIndex), ClassificationTypeNames.StringLiteral); 436AddClassification(new TextSpan(contentStart + segmentStart, index - segmentStart), ClassificationTypeNames.Identifier); 441AddClassification(new TextSpan(contentStart + index, 1), ClassificationTypeNames.Punctuation); 449AddClassification(new TextSpan(contentStart + segmentStart, end - segmentStart), ClassificationTypeNames.Identifier);
EmbeddedLanguages\CSharpTestEmbeddedLanguageUtilities.cs (1)
33new TextSpan(0, virtualCharsWithoutMarkup.Count),
Rename\CSharpRenameRewriterLanguageService.cs (2)
109newSpan = new TextSpan(oldSpan.Start, newSpan.Length); 314_renameSpansTracker.AddComplexifiedSpan(_documentId, oldSpan, new TextSpan(oldSpan.Start, newSpan.Length), _modifiedSubSpans);
Simplification\Simplifiers\NameSimplifier.cs (1)
535issueSpan = new TextSpan(identifierToken.Span.End - 9, 9);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeFixesAndRefactorings\CSharpFixAllSpanMappingService.cs (1)
45fixAllSpan = new TextSpan(root.FullSpan.Start, firstTypeOrNamespaceDecl.FullSpan.Start - 1);
Microsoft.CodeAnalysis.Features (60)
AddFileBanner\AbstractAddFileBannerCodeRefactoringProvider.cs (1)
85new TextSpan(position, length: 0));
ClassifiedSpansAndHighlightSpanFactory.cs (1)
59var highlightSpan = new TextSpan(
CodeFixes\Configuration\ConfigurationUpdater.cs (3)
720var textChange = new TextChange(new TextSpan(lastValidSpecificHeaderSpanEnd.Value.Span.End, 0), newEntry); 730var textChange = new TextChange(new TextSpan(lastValidHeaderSpanEnd.Value.Span.End, 0), newEntry); 768var textChange = new TextChange(new TextSpan(result.Length, 0), prefix + newEntry);
CodeFixes\Service\CodeFixService.cs (1)
295textSpan = new TextSpan(0, text.Length);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs (2)
161currentSpan = new TextSpan(newStart, currentSpan.Length); 168currentSpan = new TextSpan(currentSpan.Start, newLength);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaHelpers.cs (2)
46diagnosticSpan = new TextSpan(diagnosticSpan.Start + spanChange, diagnosticSpan.Length); 224var subtreeRoot = root.FindNode(new TextSpan(previousOfStart.FullSpan.Start, spanEnd - previousOfStart.FullSpan.Start));
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (1)
208var spanToCheck = new TextSpan(
CodeLens\CodeLensReferencesService.cs (2)
138var referenceSpan = new TextSpan(spanStart, token.Span.Length); 225var span = new TextSpan(descriptor.SpanStart, descriptor.SpanLength);
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (1)
114.Select(changes => new TextSpan(changes.Key.Start, changes.Sum(change => change.NewText!.Length)));
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (1)
715[new TextSpan(0, text.Length)],
Common\TaggedText.cs (1)
197yield return new ClassifiedSpan(new TextSpan(index, text.Length), classificationTypeName);
Completion\CompletionChange.cs (1)
59: this(textChange, textChanges, newPosition != null ? new TextSpan(newPosition.Value, 0) : null, includesCommitCharacter, properties)
Completion\CompletionService.cs (1)
252return CompletionChange.Create(new TextChange(new TextSpan(), ""));
Completion\Providers\AbstractAwaitCompletionProvider.cs (2)
196var asyncChange = new TextChange(new TextSpan(GetAsyncKeywordInsertionPosition(declaration), 0), syntaxFacts.GetText(syntaxKinds.AsyncKeyword) + " "); 233builder.Add(new TextChange(new TextSpan(expr.SpanStart, 0), _awaitKeyword + " "));
Completion\Utilities.cs (2)
22return new TextChange(new TextSpan(0, 0), ""); 40var totalNewSpan = new TextSpan(totalOldSpan.Start, totalOldSpan.Length + sumOfDeltas);
Copilot\CopilotUtilities.cs (1)
46newSpans.Add(new TextSpan(change.Span.Start + totalDelta, newTextLength));
Debugging\AbstractBreakpointResolver.cs (1)
83var textSpan = new TextSpan(location.SourceSpan.Start, 0);
Debugging\BreakpointResolutionResult.cs (1)
28=> new(document, new TextSpan(), locationNameOpt, isLineBreakpoint: true);
Diagnostics\Service\DiagnosticAnalyzerService_GetDiagnosticsForSpan.cs (1)
56if (range == new TextSpan(0, text.Length))
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (3)
95new TextSpan(token.Span.Start, spanToReplaceLength), 307replaceSpan = new TextSpan(start, currentLinePosition.Value - start); 348var replaceSpan = new TextSpan(token.Span.Start, 0);
EmbeddedLanguages\DateAndTime\DateAndTimeEmbeddedCompletionProvider.cs (1)
227new TextChange(new TextSpan(int.Parse(startString), int.Parse(lengthString)), newText)));
EmbeddedLanguages\Json\JsonParser.cs (2)
591? new TextSpan(_lexer.Text[^1].Span.End, 0) 592: new TextSpan(token.VirtualChars[0].Span.Start, 0);
EmbeddedLanguages\Json\JsonParser.StrictSyntaxChecker.cs (1)
159return new EmbeddedDiagnostic(FeaturesResources.Value_required, new TextSpan(node.ColonToken.VirtualChars[0].Span.End, 0));
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexEmbeddedCompletionProvider.cs (2)
288new TextChange(new TextSpan(context.Position, 0), name), newPosition: null))); 456new TextChange(new TextSpan(int.Parse(startString), int.Parse(lengthString)), newText),
EmbeddedLanguages\RegularExpressions\RegexParser.cs (2)
732? new TextSpan(_lexer.Text[^1].Span.End, 0) 733: new TextSpan(token.VirtualChars[0].Span.Start, 0);
ExternalAccess\VSTypeScript\VSTypeScriptTaskListService.cs (1)
40var textSpan = new TextSpan(Math.Min(text.Length, Math.Max(0, d.Position)), 0);
GenerateType\AbstractGenerateTypeService.Editor.cs (1)
297new CodeGenerationContext(newSemanticModel.SyntaxTree.GetLocation(new TextSpan()))),
Highlighting\Keywords\AbstractKeywordHighlighter.cs (1)
81=> new(position, 0);
InlineHints\AbstractInlineParameterNameHintsService.cs (1)
107var textSpan = new TextSpan(position, 0);
MetadataAsSource\AbstractMetadataAsSourceService.cs (1)
35contextLocation: newSemanticModel.SyntaxTree.GetLocation(new TextSpan()),
MetadataAsSource\MetadataAsSourceHelpers.cs (1)
82location = Location.Create(tree, new TextSpan(0, 0));
MoveToNamespace\AbstractMoveToNamespaceService.cs (1)
247var moveSpan = new TextSpan(container.FullSpan.Start, 0);
Navigation\IDocumentNavigationService.cs (2)
37=> CanNavigateToSpanAsync(workspace, documentId, new TextSpan(position, 0), allowInvalidSpan: allowInvalidPosition, cancellationToken); 43=> GetLocationForSpanAsync(workspace, documentId, new TextSpan(position, 0), allowInvalidSpan: allowInvalidPosition, cancellationToken);
SemanticSearch\SemanticSearchDefinitionItemFactory.cs (1)
78=> new(span.Start, Math.Min(span.Length, maxLength));
Shared\Utilities\ExtractTypeHelpers.cs (1)
68contextLocation: newSemanticModel.SyntaxTree.GetLocation(new TextSpan()),
Snippets\SnippetFunctionService.cs (1)
42var updatedTextSpan = new TextSpan(fieldSpan.Start, fullyQualifiedTypeName.Length);
src\roslyn\src\Analyzers\Core\Analyzers\FileHeaders\FileHeader.cs (2)
102return Location.Create(syntaxTree, new TextSpan(_fileHeaderStart, 0)); 105return Location.Create(syntaxTree, new TextSpan(_fileHeaderStart, _commentPrefixLength));
src\roslyn\src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (4)
72if (oldText.GetSubText(new TextSpan(change.Span.Start + offset, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 74change = new TextChange(new TextSpan(change.Span.Start, offset), ""); 81if (oldText.GetSubText(new TextSpan(change.Span.Start, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 83change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), "");
src\roslyn\src\Analyzers\Core\Analyzers\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (1)
79Location.Create(badTrivia.SyntaxTree!, new TextSpan(badTrivia.SpanStart, 0)),
src\roslyn\src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
354new Text.TextSpan(
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (1)
39document, new TextSpan(typeName.Value.Span.Start, 0), forRefactoring: false, cancellationToken).ConfigureAwait(false);
TaskList\AbstractTaskListService.cs (2)
112var location = document.SyntaxTree.GetLocation(new TextSpan(position, 0)); 158var endMessage = text.ToString(new TextSpan(endLine.Start, length));
Microsoft.CodeAnalysis.Razor.Compiler (10)
CSharp\SourceSpanExtensions.cs (1)
15return new TextSpan(sourceSpan.AbsoluteIndex, sourceSpan.Length);
Language\DefaultTagHelperResolutionPhase.cs (2)
843new Microsoft.CodeAnalysis.Text.TextSpan(exprStart, exprLength)); 892new Microsoft.CodeAnalysis.Text.TextSpan(innerStart, innerLen));
Language\DefaultTagHelperResolutionPhase.LegacyTagHelperResolver.cs (4)
593new Microsoft.CodeAnalysis.Text.TextSpan(valueStart, valueLength)); 729new Microsoft.CodeAnalysis.Text.TextSpan(valueStart, valueLength)); 1333new Microsoft.CodeAnalysis.Text.TextSpan(contentStart, contentLength)); 1415var text = sourceDocument.Text.ToString(new Microsoft.CodeAnalysis.Text.TextSpan(vss.AbsoluteIndex, vss.Length));
Language\Syntax\SyntaxNode.cs (1)
29public TextSpan Span => new(Position, Green.Width);
Language\Syntax\SyntaxReplacer.cs (1)
117_totalSpan = new TextSpan(start, end - start);
Language\Syntax\SyntaxToken.cs (1)
67=> Node != null ? new TextSpan(Position, Node.Width) : default;
Microsoft.CodeAnalysis.ResxSourceGenerator (29)
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (4)
225addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion)); 226oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 380add(builder, new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, newChange.SpanLength), newChange.NewLength)); 391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (1)
96public TextSpan Span => new(TokenStart + Green.Offset, Green.Width);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
53: this(sequence, new TextSpan(0, sequence.Length)) 88=> new(_leafCharacters, new TextSpan(_span.Start + start, length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (1)
209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (3)
737return new TextSpan(this.StartPosition, 0); 745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0); 751return new TextSpan(this.EndPosition, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
52return new TextSpan(wordStart, 1); 70return new TextSpan(wordStart, 1); 98return new TextSpan(wordStart, 1); 129return new TextSpan(wordStart, end - wordStart); 135return new TextSpan(wordStart, current - wordStart); 147return new TextSpan(wordStart, 1); 159return new TextSpan(wordStart, current - wordStart);
Microsoft.CodeAnalysis.VisualBasic (12)
Binding\Binder_Utils.vb (1)
72Dim location = Me.SyntaxTree.GetLocation(New TextSpan(startLoc, endLoc - startLoc))
Lowering\Instrumentation\CodeCoverageInstrumenter.vb (1)
550Return New Text.TextSpan(startSpan.Start, originalSpan.Length - (startSpan.Start - originalSpan.Start))
Scanner\Blender.vb (4)
93Dim fullSpan = New TextSpan(0, root.FullWidth) 115Return New TextSpan(position, 0) 389Dim range = New TextSpan(_affectedRange.Span.Start, _affectedRange.NewLength) 435Dim _curNodeSpan = New TextSpan(_curNodeStart, _curNodeLength)
Scanner\Directives.vb (1)
617Return New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of VisualBasicSyntaxNode)(Me.GetDisabledTextAt(New TextSpan(startSkipped, lengthSkipped)))
Symbols\Source\SourceMethodSymbol.vb (1)
181Dim location = binder.SyntaxTree.GetLocation(New TextSpan(startLoc, endLoc - startLoc))
Syntax\SyntaxNodeRemover.vb (1)
60Return New TextSpan(start, [end] - start)
Syntax\SyntaxReplacer.vb (1)
128Return New TextSpan(start, [end] - start)
Syntax\VisualBasicSyntaxTree.vb (2)
109Return Me.WithChanges(newText, {New TextChangeRange(New TextSpan(0, Me.Length), newText.Length)}) 121If changes.Length = 1 AndAlso changes(0).Span = New TextSpan(0, Me.Length) AndAlso changes(0).NewLength = newText.Length Then
Microsoft.CodeAnalysis.VisualBasic.Features (16)
BraceMatching\InterpolatedStringBraceMatcher.vb (2)
38New TextSpan(interpolatedString.DollarSignDoubleQuoteToken.SpanStart, 2), 39New TextSpan(interpolatedString.DoubleQuoteToken.Span.End - 1, 1))
BraceMatching\StringLiteralBraceMatcher.vb (2)
31New TextSpan(token.SpanStart, 1), 32New TextSpan(token.Span.End - 1, 1))
ChangeSignature\ChangeSignatureFormattingRule.vb (1)
30New TextSpan(firstToken.SpanStart, lastToken.Span.End - firstToken.SpanStart),
Completion\CompletionProviders\OverrideCompletionProvider.vb (4)
205Return New TextSpan(methodStatement.GetLocation().SourceSpan.End, 0) 212Return New TextSpan(lastStatement.GetLocation().SourceSpan.End, 0) 222Return New TextSpan(lastAccessorStatement.GetLocation().SourceSpan.End, 0) 227Return New TextSpan(0, 0)
Debugging\VisualBasicBreakpointService.vb (1)
52span:=New TextSpan(position, length),
EditAndContinue\BreakpointSpans.vb (3)
65If breakpointSpan.Value = New TextSpan() Then 266Return New TextSpan() 271Return New TextSpan()
GenerateType\VisualBasicGenerateTypeService.vb (2)
444semanticModel.SyntaxTree.GetLocation(New TextSpan()), 445semanticModel.SyntaxTree.GetLocation(New TextSpan(lastMember.Span.End, 0)))
Snippets\VisualBasicSnippetFunctionService.vb (1)
47Dim typeSpan = New TextSpan(caseGenerationLocation.Start + "Case ".Length, fullyQualifiedTypeName.Length)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (5)
Classification\Worker.vb (1)
146AddClassification(New TextSpan(trivia.SpanStart, 1), ClassificationTypeNames.Punctuation)
Rename\VisualBasicRenameRewriterLanguageService.vb (3)
97newSpan = New TextSpan(oldSpan.Start, newSpan.Length) 237Me._renameSpansTracker.AddComplexifiedSpan(Me._documentId, oldSpan, New TextSpan(oldSpan.Start, newSpan.Length), Me._modifiedSubSpans) 295AddModifiedSpan(annotation.OriginalSpan, New TextSpan(token.Span.Start, newToken.Span.Length))
Simplification\Simplifiers\NameSimplifier.vb (1)
375issueSpan = New TextSpan(name.Span.End - 9, 9)
Microsoft.CodeAnalysis.Workspaces (50)
Classification\ClassifierHelper.cs (1)
97var widenedSpan = new TextSpan(spans[0].Start, spans[^1].End);
Classification\IRemoteSemanticClassificationService.cs (1)
119new TextSpan(
CodeCleanup\CodeCleaner.cs (1)
53return await CleanupAsync(document, new TextSpan(0, text.Length), options, providers, cancellationToken: cancellationToken).ConfigureAwait(false);
FindSymbols\FindReferences\Finders\AbstractReferenceFinder_GlobalSuppressions.cs (1)
232var location = Location.Create(root.SyntaxTree, new TextSpan(positionOfReferenceInTree, length));
FindSymbols\FindReferences\Finders\PropertySymbolReferenceFinder.cs (1)
220var location = state.SyntaxTree.GetLocation(new TextSpan(indexerReference.SpanStart, 0));
FindSymbols\SyntaxTree\SyntaxTreeIndex_Persistence.cs (1)
95new TextSpan(reader.ReadInt32(), reader.ReadInt32()));
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (1)
209var span = new TextSpan(spanStart, spanLength);
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (4)
228mergeConflictResolutionSpans.Add(new TextSpan(commentChangesList[commentChangeIndex].Span.Start + currentPositionDelta, commentChangesList[commentChangeIndex].NewText!.Length)); 242var conflictingCommentInsertionLocation = new TextSpan(mergedChange.Span.Start, 0); 246mergeConflictResolutionSpans.Add(new TextSpan(commentChangesList[commentChangeIndex].Span.Start + currentPositionDelta, commentChangesList[commentChangeIndex].NewText!.Length)); 261mergeConflictResolutionSpans.Add(new TextSpan(commentChangesList[commentChangeIndex].Span.Start + currentPositionDelta, commentChangesList[commentChangeIndex].NewText!.Length));
PatternMatching\AllLowerCamelCaseMatcher.cs (1)
192var matchSpanToAdd = new TextSpan(candidateHump.Start, possibleHumpMatchLength);
PatternMatching\PatternMatcher.cs (4)
321=> _includeMatchedSpans ? new TextSpan(start, length) : null; 453=> PartStartsWith(candidate, candidatePart, pattern, new TextSpan(0, pattern.Length), compareOptions); 590matchSpans.Add(new TextSpan(candidateHump.Start, patternChunkCharacterSpan.Length)); 600candidateHump = new TextSpan(candidateHump.Start + patternChunkCharacterSpan.Length, candidateHump.Length - patternChunkCharacterSpan.Length);
Rename\ConflictEngine\ConflictResolver.Session.cs (1)
888var subSpan = new TextSpan(offset, length);
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (1)
438var matchTextSpan = new TextSpan(start, renameText.Length);
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (4)
225addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion)); 226oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 380add(builder, new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, newChange.SpanLength), newChange.NewLength)); 391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (1)
96public TextSpan Span => new(TokenStart + Green.Offset, Green.Width);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
53: this(sequence, new TextSpan(0, sequence.Length)) 88=> new(_leafCharacters, new TextSpan(_span.Start + start, length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (1)
209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (3)
737return new TextSpan(this.StartPosition, 0); 745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0); 751return new TextSpan(this.EndPosition, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
52return new TextSpan(wordStart, 1); 70return new TextSpan(wordStart, 1); 98return new TextSpan(wordStart, 1); 129return new TextSpan(wordStart, end - wordStart); 135return new TextSpan(wordStart, current - wordStart); 147return new TextSpan(wordStart, 1); 159return new TextSpan(wordStart, current - wordStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
126=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
79textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
Workspace\Solution\Document.cs (1)
486if (textChanges.Length > 1 || (textChanges.Length == 1 && textChanges[0].Span != new TextSpan(0, oldText.Length)))
Microsoft.Gen.BuildMetadata.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
131return new TextSpan(start, end - start);
Microsoft.Gen.ComplianceReports.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
131return new TextSpan(start, end - start);
Microsoft.Gen.ContextualOptions.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
131return new TextSpan(start, end - start);
Microsoft.Gen.Logging.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
131return new TextSpan(start, end - start);
Microsoft.Gen.MetadataExtractor.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
131return new TextSpan(start, end - start);
Microsoft.Gen.Metrics.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
131return new TextSpan(start, end - start);
Microsoft.Gen.MetricsReports.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
131return new TextSpan(start, end - start);
Microsoft.Maui.Controls.SourceGen (1)
CodeBehindGenerator.cs (1)
271 var location = projItem.RelativePath is not null ? Location.Create(projItem.RelativePath, new TextSpan(), new LinePositionSpan()) : null;
Roslyn.Diagnostics.Analyzers (31)
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (4)
225addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion)); 226oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 380add(builder, new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, newChange.SpanLength), newChange.NewLength)); 391builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (1)
96public TextSpan Span => new(TokenStart + Green.Offset, Green.Width);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
53: this(sequence, new TextSpan(0, sequence.Length)) 88=> new(_leafCharacters, new TextSpan(_span.Start + start, length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (1)
209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (3)
737return new TextSpan(this.StartPosition, 0); 745return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0); 751return new TextSpan(this.EndPosition, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
52return new TextSpan(wordStart, 1); 70return new TextSpan(wordStart, 1); 98return new TextSpan(wordStart, 1); 129return new TextSpan(wordStart, end - wordStart); 135return new TextSpan(wordStart, current - wordStart); 147return new TextSpan(wordStart, 1); 159return new TextSpan(wordStart, current - wordStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
126=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
79textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
Roslyn.Diagnostics.CSharp.Analyzers (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeFixesAndRefactorings\CSharpFixAllSpanMappingService.cs (1)
45fixAllSpan = new TextSpan(root.FullSpan.Start, firstTypeOrNamespaceDecl.FullSpan.Start - 1);
6163 references to TextSpan
ConfigurationSchemaGenerator (1)
RuntimeSource\Configuration.Binder\Specs\InterceptorInfo.cs (1)
180TextSpan memberNameSpan = memberAccessExprSyntax.Name.Span;
dotnet (2)
Commands\Run\FileBasedAppSourceEditor.cs (2)
122var span = new TextSpan(start: addAfter.Info.Span.End, length: 0); 231var span = directive.Info.Span;
dotnet-format (3)
Formatters\EndOfLineFormatter.cs (1)
40var lineEndingSpan = new TextSpan(line.End, line.EndIncludingLineBreak - line.End);
Formatters\FinalNewlineFormatter.cs (2)
43var finalNewlineSpan = new TextSpan(lastLine.End, 0); 53var finalNewlineSpan = new TextSpan(lineBeforeLast.End, lineBeforeLast.EndIncludingLineBreak - lineBeforeLast.End);
GenerateDocumentationAndConfigFiles (419)
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (3)
29var fullSpan = new TextSpan(0, text.Length); 36var change = TextChangeRange.Collapse(changes).Span; 49var span = node.FullSpan;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\roslyn\src\RoslynAnalyzers\Microsoft.CodeAnalysis.Analyzers\Core\MetaAnalyzers\ReleaseTrackingHelper.cs (5)
439public TextSpan Span { get; } 449TextSpan span, SourceText sourceText, 458TextSpan span, SourceText sourceText, 478TextSpan span, SourceText sourceText, 497TextSpan span, SourceText sourceText,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (3)
105var thisSpan = introspector.GetSpan(value); 125var thisSpan = introspector.GetSpan(value); 138var thisSpan = introspector.GetSpan(value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (40)
14internal sealed class NormalizedTextSpanCollection : ReadOnlyCollection<TextSpan> 29public NormalizedTextSpanCollection(TextSpan span) 42public NormalizedTextSpanCollection(IEnumerable<TextSpan> spans) 93var span1 = left[index1]; 94var span2 = right[index2]; 122spans.Add(TextSpan.FromBounds(start, end)); 161var span1 = left[index1]; 162var span2 = right[index2]; 221var span1 = left[index1]; 222var span2 = right[index2]; 283var span1 = left[index1]; 284var span2 = right[index2]; 296spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 307spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span2.Start)); 333var span1 = left[index1++]; 334spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 398var span1 = this[index1]; 399var span2 = set[index2]; 429public bool OverlapsWith(TextSpan span) 458var span1 = this[index1]; 459var span2 = set[index2]; 483public bool IntersectsWith(TextSpan span) 506foreach (var s in this) 533foreach (var s in this) 546private static IList<TextSpan> ListFromSpan(TextSpan span) 548IList<TextSpan> list = 564private static void UpdateSpanUnion(TextSpan span, IList<TextSpan> spans, ref int start, ref int end) 568spans.Add(TextSpan.FromBounds(start, end)); 585private static IList<TextSpan> NormalizeSpans(IEnumerable<TextSpan> spans) 592var sorted = new List<TextSpan>(spans); 599sorted.Sort(delegate (TextSpan s1, TextSpan s2) { return s1.Start.CompareTo(s2.Start); }); 601IList<TextSpan> normalized = new List<TextSpan>(sorted.Count); 611normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 621normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 626private sealed class OrderedSpanList : List<TextSpan>
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\TextSpanMutableIntervalTree.cs (9)
10internal readonly struct TextSpanIntervalIntrospector : IIntervalIntrospector<TextSpan> 12public TextSpan GetSpan(TextSpan value) 16internal sealed class TextSpanMutableIntervalTree(IEnumerable<TextSpan>? values) 17: SimpleMutableIntervalTree<TextSpan, TextSpanIntervalIntrospector>(new TextSpanIntervalIntrospector(), values) 23public TextSpanMutableIntervalTree(params TextSpan[]? values) : this((IEnumerable<TextSpan>?)values) 27public bool HasIntervalThatIntersectsWith(TextSpan span) 30public bool HasIntervalThatOverlapsWith(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\NamingStyles\NamingStyleOption.cs (3)
13/// The root naming style option composed of several settings as well as a <see cref="TextSpan"/>s describing where they were all defined. 29/// A description of the kinds of symbols a rule should apply to as well as a <see cref="TextSpan"/>s describing where they were all defined. 42/// The rules about how the specified symbols must be named as well as a <see cref="TextSpan"/>s describing where they were all defined.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\Section.cs (2)
16public TextSpan Span { get; init; } 24public Section(string? filePath, bool isGlobal, TextSpan span, string text, string fullText)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxHelpers.cs (4)
12public static TextSpan GetSpan<TSyntaxKind>(EmbeddedSyntaxToken<TSyntaxKind> token1, EmbeddedSyntaxToken<TSyntaxKind> token2) where TSyntaxKind : struct 15public static TextSpan GetSpan(VirtualCharSequence virtualChars) 18public static TextSpan GetSpan(VirtualChar firstChar, VirtualChar lastChar) 19=> TextSpan.FromBounds(firstChar.Span.Start, lastChar.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (6)
42private TextSpan? _fullSpan; 56public TextSpan GetSpan() 63return TextSpan.FromBounds(start, end); 66public TextSpan? GetFullSpan() 69private TextSpan? ComputeFullSpan() 76return TextSpan.FromBounds(start.Value, end.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (2)
68/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 96public TextSpan Span => new(TokenStart + Green.Offset, Green.Width);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharGreenSequence.Chunks.cs (1)
50var span = new VirtualChar(ch, tokenStart).Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
50private readonly TextSpan _span; 57private VirtualCharGreenSequence(Chunk sequence, TextSpan span) 114TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharUtilities.cs (4)
15public static TextSpan FromBounds(VirtualChar vc1, VirtualChar vc2) 16=> TextSpan.FromBounds(vc1.Span.Start, vc2.Span.End); 26public static (ImmutableSegmentedList<VirtualChar> sourceCode, ImmutableArray<TextSpan> markdownSpans) StripMarkupCharacters( 29using var _ = ArrayBuilder<TextSpan>.GetInstance(out var markdownSpans);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (13)
13private static bool ShouldAnalyze(TextSpan? contextFilterSpan, TextSpan span) 23public static bool ShouldAnalyzeSpan(this SyntaxTreeAnalysisContext context, TextSpan span) 33public static bool ShouldAnalyzeSpan(this SemanticModelAnalysisContext context, TextSpan span) 43public static bool ShouldAnalyzeSpan(this SymbolStartAnalysisContext context, TextSpan span, SyntaxTree tree) 63public static bool ShouldAnalyzeSpan(this SymbolAnalysisContext context, TextSpan span, SyntaxTree tree) 83public static bool ShouldAnalyzeSpan(this AdditionalFileAnalysisContext context, TextSpan span) 93public static bool ShouldAnalyzeSpan(this OperationBlockStartAnalysisContext context, TextSpan span) 103public static bool ShouldAnalyzeSpan(this OperationBlockAnalysisContext context, TextSpan span) 113public static bool ShouldAnalyzeSpan(this OperationAnalysisContext context, TextSpan span) 123public static bool ShouldAnalyzeSpan(this SyntaxNodeAnalysisContext context, TextSpan span) 133public static bool ShouldAnalyzeSpan<TSytnaxKind>(this CodeBlockStartAnalysisContext<TSytnaxKind> context, TextSpan span) where TSytnaxKind : struct 143public static bool ShouldAnalyzeSpan(this CodeBlockAnalysisContext context, TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (2)
32this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden, CancellationToken cancellationToken) 44this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (12)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate) 296public static TextSpan GetContainedSpan(this IEnumerable<SyntaxNode> nodes) 301var fullSpan = nodes.First().Span; 304fullSpan = TextSpan.FromBounds( 315public static bool OverlapsHiddenPosition(this SyntaxNode node, TextSpan span, CancellationToken cancellationToken) 323var textSpan = TextSpan.FromBounds(start, end); 409var spans = new List<TextSpan>(nodesToReplace.Count + tokensToReplace.Count + triviaToReplace.Count); 432TextSpan previous = default; 433foreach (var span in spans) 785public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 963var fullSpan = node.FullSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (3)
18public static bool OverlapsHiddenPosition([NotNullWhen(returnValue: true)] this SyntaxTree? tree, TextSpan span, CancellationToken cancellationToken) 98public static bool IsEntirelyHidden(this SyntaxTree tree, TextSpan span, CancellationToken cancellationToken) 252public static SyntaxNode FindNode(this SyntaxTree syntaxTree, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (22)
18public static IEnumerable<TextSpan> ToNormalizedSpans(this IEnumerable<TextSpan> spans) 21public static ImmutableArray<TextSpan> ToNormalizedSpans(this ImmutableArray<TextSpan> spans) 24public static TextSpan Collapse(this IEnumerable<TextSpan> spans) 29foreach (var span in spans) 48return TextSpan.FromBounds(start, end); 54public static bool IsAround(this TextSpan span, SyntaxNodeOrToken node) => IsAround(span, node, node); 60public static bool IsAround(this TextSpan span, SyntaxNodeOrToken startNode, SyntaxNodeOrToken endNode) 62var innerSpan = TextSpan.FromBounds(startNode.Span.Start, endNode.Span.End); 63var outerSpan = TextSpan.FromBounds(startNode.FullSpan.Start, endNode.FullSpan.End); 67public static IEnumerable<TextSpan> Subtract(this TextSpan span, TextSpan except) 81yield return TextSpan.FromBounds(span.Start, startSegmentEnd); 85yield return TextSpan.FromBounds(endSegmentStart, span.End); 88public static IEnumerable<TextSpan> Subtract(this IEnumerable<TextSpan> spans, TextSpan except)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\AbstractSyntaxFormatting.cs (3)
21private static readonly Func<TextSpan, bool> s_notEmpty = s => !s.IsEmpty; 32public IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 34IReadOnlyList<TextSpan> spansToFormat;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.AnchorData.cs (4)
18public TextSpan TextSpan => operation.TextSpan; 34TextSpan IIntervalIntrospector<AnchorData>.GetSpan(AnchorData value) 37TextSpan IIntervalIntrospector<IndentationData>.GetSpan(IndentationData value) 40TextSpan IIntervalIntrospector<RelativeIndentationData>.GetSpan(RelativeIndentationData value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (18)
45private readonly HashSet<TextSpan> _indentationMap = []; 46private readonly HashSet<TextSpan> _suppressWrappingMap = []; 47private readonly HashSet<TextSpan> _suppressSpacingMap = []; 48private readonly HashSet<TextSpan> _suppressFormattingMap = []; 49private readonly HashSet<TextSpan> _anchorMap = []; 140var baseSpan = _initialIndentBlockOperations[0].TextSpan; 159var operationSpan = operations[i].TextSpan; 180var intervalTreeSpan = operation.TextSpan; 409private static void DebugCheckEmpty<T, TIntrospector>(ContextMutableIntervalTree<T, TIntrospector> tree, TextSpan textSpan) 448var span = token.Span; 469var span = token.Span; 592public bool IsWrappingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 614public bool IsSpacingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 643var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End); 650public bool IsFormattingDisabled(TextSpan textSpan) 658var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.IndentationData.cs (14)
17private abstract class IndentationData(TextSpan textSpan) 19public TextSpan TextSpan { get; } = textSpan; 22public IndentationData WithTextSpan(TextSpan span) 25protected abstract IndentationData WithTextSpanCore(TextSpan span); 28private sealed class SimpleIndentationData(TextSpan textSpan, int indentation) : IndentationData(textSpan) 32protected override IndentationData WithTextSpanCore(TextSpan span) 56public RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter) 67this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 70private RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter, int lazyIndentationDelta) 81this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 84public TextSpan InseparableRegionSpan { get; } 106protected override IndentationData WithTextSpanCore(TextSpan span) 118public AdjustedIndentationData(TextSpan textSpan, IndentationData baseIndentationData, int adjustment) 141protected override IndentationData WithTextSpanCore(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ContextMutableIntervalTree.cs (4)
40var thisSpan = introspector.GetSpan(value); 52var thisSpan = introspector.GetSpan(value); 125var resultSpan = Introspector.GetSpan(result!); 126var currentNodeSpan = Introspector.GetSpan(currentNode.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (5)
44protected readonly TextSpan SpanToFormat; 336private TextSpan GetSpanToFormat() 341return TextSpan.FromBounds(startPosition, endPosition); 458var spanBetweenTokens = TextSpan.FromBounds(token1.Span.End, token2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (4)
26public readonly TextSpan FormattedSpan; 31TextSpan formattedSpan) 78var span = TextSpan.FromBounds(token1.RawKind == 0 ? this.TreeInfo.StartPosition : token1.Span.End, token2.RawKind == 0 ? this.TreeInfo.EndPosition : token2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.NodeAndText.cs (3)
37return _text.ToString(TextSpan.FromBounds(token2.FullSpan.Start, token2.SpanStart)); 43return _text.ToString(TextSpan.FromBounds(token1.Span.End, token1.FullSpan.End)); 46return _text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (13)
239var span = textChange.Span; 267internal static IEnumerable<TextSpan> GetAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 277static IEnumerable<TextSpan> EnumerateAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 295internal static TextSpan GetSpanIncludingPreviousAndNextTokens(SyntaxToken firstToken, SyntaxToken lastToken) 307return TextSpan.FromBounds(start, end); 310internal static TextSpan GetElasticSpan(SyntaxToken token) 313private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 315var aggregateSpans = new List<TextSpan>(); 317var last = default(TextSpan); 318foreach (var span in spans) 326last = TextSpan.FromBounds(last.Start, span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (10)
20private readonly TextSpan _span; 22public BaseIndentationFormattingRule(SyntaxNode root, TextSpan span, int baseIndentation, AbstractFormattingRule? vbHelperFormattingRule = null) 130private TextSpan AdjustTextSpan(TextSpan textSpan) 131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End)); 133private static void SetInnermostNodeForSpan(SyntaxNode root, ref TextSpan span, out SyntaxToken token1, out SyntaxToken token2, out SyntaxNode? commonNode) 149private static void GetTokens(SyntaxNode root, TextSpan span, out SyntaxToken token1, out SyntaxToken token2) 168private static TextSpan GetSpanFromTokens(TextSpan span, SyntaxToken token1, SyntaxToken token2) 217return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\FormattingOperations.cs (8)
30=> CreateAnchorIndentationOperation(anchorToken, endToken, TextSpan.FromBounds(anchorToken.Span.End, endToken.Span.End)); 35public static AnchorIndentationOperation CreateAnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 42=> CreateSuppressOperation(startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End), option); 47private static SuppressOperation CreateSuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option) 55var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 62public static IndentBlockOperation CreateIndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 70var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 78public static IndentBlockOperation CreateRelativeIndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\IndentBlockOperation.cs (3)
14internal IndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 33internal IndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 56public TextSpan TextSpan { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\SuppressOperation.cs (2)
14public readonly TextSpan TextSpan; 19internal SuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (13)
45private delegate void WhitespaceAppender<T>(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<T> changes); 387var span = GetTextSpan(trivia1, trivia2); 499var span = TextSpan.FromBounds(start, end); 715var insertionPoint = GetInsertionSpan(changes); 730private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 765TextSpan notUsed, 822private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 825private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes) 831private TextSpan GetTextSpan(SyntaxTrivia trivia1, SyntaxTrivia trivia2) 835return TextSpan.FromBounds(this.StartPosition, trivia2.FullSpan.Start); 840return TextSpan.FromBounds(trivia1.FullSpan.End, this.EndPosition); 843return TextSpan.FromBounds(trivia1.FullSpan.End, trivia2.FullSpan.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\AbstractUnnecessaryImportsProvider.cs (3)
23public ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken) 27SemanticModel model, TextSpan? span, Func<SyntaxNode, bool>? predicate, CancellationToken cancellationToken) 35bool HasImportThatIntersectsWithSpan(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (3)
237private TextSpan GetNormalizedSpan(int position) 241return TextSpan.FromBounds(LineToBeIndented.Start, position); 244return TextSpan.FromBounds(position, LineToBeIndented.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (3)
29using var parts = TemporaryArray<TextSpan>.Empty; 73private static ImmutableArray<string> CreateWords(in TemporaryArray<TextSpan> parts, string name) 76foreach (var part in parts)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (21)
160var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 174private WordSpanEnumerable GetWordSpans(string name, TextSpan nameSpan) 177private static string Substring(string name, TextSpan wordSpan) 180private static readonly Func<string, TextSpan, bool> s_firstCharIsLowerCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsLower(val[span.Start]); 181private static readonly Func<string, TextSpan, bool> s_firstCharIsUpperCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsUpper(val[span.Start]); 183private static readonly Func<string, TextSpan, bool> s_wordIsAllUpperCase = (val, span) => 196private static readonly Func<string, TextSpan, bool> s_wordIsAllLowerCase = (val, span) => 210string name, TextSpan nameSpan, Func<string, TextSpan, bool> wordCheck, 216foreach (var wordSpan in GetWordSpans(name, nameSpan)) 232private bool CheckPascalCase(string name, TextSpan nameSpan, out string reason) 237private bool CheckAllUpper(string name, TextSpan nameSpan, out string reason) 242private bool CheckAllLower(string name, TextSpan nameSpan, out string reason) 248string name, TextSpan nameSpan, 249Func<string, TextSpan, bool> firstWordCheck, 250Func<string, TextSpan, bool> restWordCheck, 260foreach (var wordSpan in GetWordSpans(name, nameSpan)) 291private bool CheckCamelCase(string name, TextSpan nameSpan, out string reason) 298private bool CheckFirstUpper(string name, TextSpan nameSpan, out string reason) 406using var parts = TemporaryArray<TextSpan>.Empty;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (4)
16private readonly TextSpan _nameSpan; 19public WordSpanEnumerator(string name, TextSpan nameSpan, string wordSeparator) 28public TextSpan Current { get; private set; } 70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\RefactoringHelpers\AbstractRefactoringHelpers.cs (10)
39/// Returns unchanged <paramref name="span"/> in case <see cref="TextSpan.IsEmpty"/>. 40/// Returns empty Span with original <see cref="TextSpan.Start"/> in case it contains only whitespace. 42private static TextSpan GetTrimmedTextSpan(SourceText sourceText, TextSpan span) 56return TextSpan.FromBounds(start, end); 60SourceText sourceText, SyntaxNode root, TextSpan selectionRaw, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 69var selectionTrimmed = GetTrimmedTextSpan(sourceText, selectionRaw); 354var rightNodeSpanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, rightNode); 366TextSpan selectionTrimmed, 384var spanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, nonHiddenExtractedNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\RefactoringHelpers\IRefactoringHelpers.cs (1)
55SourceText sourceText, SyntaxNode root, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (4)
34SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 38SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 42SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, 77SyntaxNode root, SourceText text, TextSpan textSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
429TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 432/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 433/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 435/// an empty <see cref="TextSpan"/> at position 0. 438TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 479bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(firstNode.Span.Start, lastNode.Span.End); 182this ISyntaxFacts syntaxFacts, TextSpan span, SyntaxNode node, CancellationToken cancellationToken) 441public static TextSpan GetSpanWithoutAttributes(this ISyntaxFacts syntaxFacts, SyntaxNode root, SyntaxNode node) 461return TextSpan.FromBounds(startOfNodeWithoutAttributes, endOfNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (6)
36private readonly TextSpan[] _wordSpans; 101_wordSpans = new TextSpan[distinctValues.Length]; 177private void Add(TextSpan characterSpan, int insertionIndex) 218TextSpan characterSpan, int insertionIndex, int currentNodeEdgeCount, int currentNodeIndex, int editDistance) 286private struct BuilderNode(TextSpan characterSpan) 288public readonly TextSpan CharacterSpan = characterSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (2)
11private readonly struct Node(TextSpan wordSpan, int edgeCount, int firstEdgeIndex) 17public readonly TextSpan WordSpan = wordSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (10)
45public static IEnumerable<(SyntaxToken, SyntaxToken)> ConvertToTokenPairs(this SyntaxNode root, IReadOnlyList<TextSpan> spans) 81public static ValueTuple<SyntaxToken, SyntaxToken> ConvertToTokenPair(this SyntaxNode root, TextSpan textSpan) 157=> (token1.RawKind == 0) ? text.ToString(TextSpan.FromBounds(0, token2.SpanStart)) : text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart)); 259public static TextSpan GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(SyntaxToken startToken, SyntaxToken endToken) 266return TextSpan.FromBounds(startPosition, endPosition); 324var fullSpan = node.FullSpan; 357public static TextSpan GetFormattingSpan(SyntaxNode root, TextSpan span) 367return TextSpan.FromBounds(startPosition, endPosition);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
17public static void AddWordParts(ReadOnlySpan<char> identifier, ref TemporaryArray<TextSpan> parts) 20public static void AddCharacterParts(ReadOnlySpan<char> identifier, ref TemporaryArray<TextSpan> parts) 23public static void AddParts(ReadOnlySpan<char> text, bool word, ref TemporaryArray<TextSpan> parts) 27var span = StringBreaker.GenerateSpan(text, start, word); 41public static TextSpan GenerateSpan(ReadOnlySpan<char> identifier, int wordStart, bool word) 81private static TextSpan ScanCharacterRun(ReadOnlySpan<char> identifier, int length, int wordStart) 102private static TextSpan ScanWordRun(ReadOnlySpan<char> identifier, int length, int wordStart) 151private static TextSpan ScanLowerCaseRun(ReadOnlySpan<char> identifier, int length, int wordStart) 162private static TextSpan ScanNumber(ReadOnlySpan<char> identifier, int length, int wordStart) 170return TextSpan.FromBounds(wordStart, current);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\MultiProjectSafeFixAllProvider.cs (4)
26protected abstract void FixAll(SyntaxEditor editor, IEnumerable<TextSpan> commonSpans); 79using var _ = PooledHashSet<TextSpan>.GetInstance(out var commonSpans); 110static IEnumerable<TextSpan> GetDiagnosticSpans(ImmutableArray<Diagnostic> diagnostics) 114private SyntaxNode FixAll(SolutionServices services, SyntaxNode root, PooledHashSet<TextSpan> commonSpans)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixesAndRefactorings\AbstractFixAllSpanMappingService.cs (8)
20protected abstract Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansIfWithinGlobalStatementAsync( 21Document document, TextSpan span, CancellationToken cancellationToken); 23public Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 24Document document, TextSpan triggerSpan, FixAllScope fixAllScope, CancellationToken cancellationToken) 32private async Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 33Document document, TextSpan span, bool fixAllInContainingMember, CancellationToken cancellationToken) 50var builder = PooledDictionary<Document, ArrayBuilder<TextSpan>>.GetInstance(); 75TextSpan span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixesAndRefactorings\IFixAllSpanMappingService.cs (2)
30Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 31Document document, TextSpan triggerSpan, FixAllScope fixAllScope, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (3)
50protected static TextSpan GetSpan(SyntaxNode node) 55return TextSpan.FromBounds(start.SpanStart, end.Span.End); 110var span = GetSpan(destination);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (1)
24public void AddRelevantNodes<TSyntaxNode>(SourceText sourceText, SyntaxNode root, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringContextExtensions.cs (9)
21this CodeRefactoringContext context, ImmutableArray<TCodeAction> actions, TextSpan? applicableToSpan = null) 59public static async Task<TSyntaxNode?> TryGetRelevantNodeAsync<TSyntaxNode>(this Document document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 65public static TSyntaxNode? TryGetRelevantNode<TSyntaxNode>(this ParsedDocument document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 68public static TSyntaxNode? TryGetRelevantNode<TSyntaxNode>(this ParsedDocument document, TextSpan span, bool allowEmptyNode, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 76this Document document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 82this Document document, TextSpan span, bool allowEmptyNodes, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 89this ParsedDocument document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 93this ParsedDocument document, TextSpan span, bool allowEmptyNodes, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 102this ParsedDocument document, TextSpan span, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (1)
38public static bool IsNodeUnderselected(SyntaxNode? node, TextSpan selection)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\IRefactoringHelpersService.cs (1)
20this IRefactoringHelpersService service, ParsedDocument document, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
32IEnumerable<TextSpan> spans,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
142public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (2)
393using var parts = TemporaryArray<TextSpan>.Empty; 397var p = parts[i];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\FormatterShared.cs (2)
33public SyntaxNode Format(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 36public IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (1)
17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
39return document.Text.ToString(TextSpan.FromBounds(tokenLine.Start, token.SpanStart));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (2)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxFactsService\ISyntaxFactsService.cs (1)
18Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameActionAnnotation.cs (2)
15TextSpan originalSpan, 28public readonly TextSpan OriginalSpan = originalSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameDeclarationLocationReference.cs (2)
19public readonly TextSpan TextSpan; 36public RenameDeclarationLocationReference(DocumentId documentId, TextSpan textSpan, bool overriddenFromMetadata, int declaringSyntaxReferencesCount)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameNodeSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameTokenSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (2)
56ImmutableArray<TextSpan> spans, 88ImmutableArray<TextSpan> spans,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\ISimplificationService.cs (1)
32ImmutableArray<TextSpan> spans,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractSimplifier.cs (1)
21out TextSpan issueSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
56TextSpan span,
Microsoft.Analyzers.Extra (1)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (1)
71CheckIfCanFixAsync(Document invocationDoc, TextSpan span, CancellationToken cancellationToken)
Microsoft.Analyzers.Extra.Tests (2)
Resources\RoslynTestUtils.cs (2)
90public static TextSpan MakeTextSpan(this string text, int spanNum) 141var expectedSpan = text.MakeTextSpan(spanNum);
Microsoft.Analyzers.Local.Tests (2)
Resources\RoslynTestUtils.cs (2)
90public static TextSpan MakeTextSpan(this string text, int spanNum) 141var expectedSpan = text.MakeTextSpan(spanNum);
Microsoft.AspNetCore.App.Analyzers (57)
Infrastructure\EmbeddedSyntax\EmbeddedDiagnostic.cs (3)
14public readonly TextSpan Span; 16public EmbeddedDiagnostic(string message, TextSpan span) 40hashCode = hashCode * -1521134295 + EqualityComparer<TextSpan>.Default.GetHashCode(Span);
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxHelpers.cs (4)
12public static TextSpan GetSpan<TSyntaxKind>(EmbeddedSyntaxToken<TSyntaxKind> token1, EmbeddedSyntaxToken<TSyntaxKind> token2) where TSyntaxKind : struct 22public static TextSpan GetSpan(VirtualCharSequence virtualChars) 25public static TextSpan GetSpan(VirtualChar firstChar, VirtualChar lastChar) 26=> TextSpan.FromBounds(firstChar.Span.Start, lastChar.Span.End);
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxNode.cs (6)
21private TextSpan? _fullSpan; 34public TextSpan GetSpan() 41return TextSpan.FromBounds(start, end); 44public TextSpan? GetFullSpan() 47private TextSpan? ComputeFullSpan() 56return TextSpan.FromBounds(start.Value, end.Value);
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxNodeOrToken.cs (1)
42public TextSpan? GetFullSpan()
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxToken.cs (3)
58public TextSpan GetSpan() 61public TextSpan? GetFullSpan() 71return TextSpan.FromBounds(start, end);
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxTrivia.cs (1)
33public TextSpan GetSpan()
Infrastructure\RoutePattern\RoutePatternLexer.cs (3)
32=> Text.GetSubSequence(TextSpan.FromBounds(start, end)); 67public TextSpan GetTextSpan(int startInclusive, int endExclusive) 68=> TextSpan.FromBounds(Text[startInclusive].Span.Start, Text[endExclusive - 1].Span.End);
Infrastructure\RoutePattern\RoutePatternParser.cs (1)
617private TextSpan GetTokenStartPositionSpan(RoutePatternToken token)
Infrastructure\RoutePattern\RoutePatternTree.cs (2)
55public RouteParameter(string name, bool encodeSlashes, string? defaultValue, bool isOptional, bool isCatchAll, ImmutableArray<string> policies, TextSpan span) 72public readonly TextSpan Span;
Infrastructure\VirtualChars\AbstractVirtualCharService.cs (3)
27string tokenText, int index, int offset, out TextSpan span) 170if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 240return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
Infrastructure\VirtualChars\CSharpVirtualCharService.cs (11)
218var lineSpan = currentLine.Span; 267var charResults = new List<(char ch, TextSpan span)>(); 285if (!IsLegalBraceEscape(tokenText, index, offset, out var braceSpan)) 304string tokenText, int offset, int startIndexInclusive, int endIndexExclusive, List<(char ch, TextSpan span)> charResults) 314private static void ConvertCharactersToRunes(List<(char ch, TextSpan span)> charResults, ImmutableList<VirtualChar>.Builder runeResults) 334runeResults.Add(VirtualChar.Create(rune, TextSpan.FromBounds(span.Start, nextSpan.End))); 348List<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 361List<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 394List<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 413List<(char ch, TextSpan span)> result, string tokenText, int offset, int index, char character) 526result.Add((character, TextSpan.FromBounds(startIndex + offset, endIndex + offset)));
Infrastructure\VirtualChars\VirtualChar.cs (5)
16/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 46public readonly TextSpan Span; 52public static VirtualChar Create(Rune rune, TextSpan span) 60public static VirtualChar Create(char surrogateChar, TextSpan span) 70private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
Infrastructure\VirtualChars\VirtualCharSequence.Chunks.cs (1)
155var span = new TextSpan(_firstVirtualCharPosition + index, length: 1);
Infrastructure\VirtualChars\VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 90public VirtualCharSequence GetSubSequence(TextSpan span) 179=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 194return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 229TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (3)
491public TextSpan? Value { get; set; } 521var replacementSpan = TextSpan.FromBounds(replacementStart, replacementEnd);
RouteEmbeddedLanguage\RoutePatternCompletionProvider.cs (3)
340public TextSpan? Value { get; set; } 367var replacementSpan = TextSpan.FromBounds(replacementStart, replacementEnd);
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (1)
297var targetSpan = new TextSpan(
Microsoft.AspNetCore.App.CodeFixes (2)
Dependencies\AddPackageFixer.cs (1)
49var location = diagnostic.Location.SourceSpan;
Dependencies\ExtensionMethodsCompletionProvider.cs (1)
40var span = context.CompletionListSpan;
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
35var diagnosticSpan = diagnostic.Location.SourceSpan;
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
35var diagnosticSpan = diagnostic.Location.SourceSpan;
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
ApiActionsDoNotRequireExplicitModelValidationCodeFixProvider.cs (2)
40private readonly TextSpan _ifBlockSpan; 42public MyCodeAction(Document document, TextSpan ifBlockSpan)
Microsoft.CodeAnalysis (282)
CodeGen\ILBuilder.cs (1)
1029internal void DefineSequencePoint(SyntaxTree syntaxTree, TextSpan span)
CodeGen\RawSequencePoint.cs (3)
18internal readonly TextSpan Span; 21internal static readonly TextSpan HiddenSequencePointSpan = new TextSpan(0x7FFFFFFF, 0); 23internal RawSequencePoint(SyntaxTree syntaxTree, int ilMarker, TextSpan span)
CodeGen\SequencePointList.cs (4)
134TextSpan span = offsetAndSpan.Span; 224TextSpan span = offsetAndSpan.Span; 247public readonly TextSpan Span; 249public OffsetAndSpan(int offset, TextSpan span)
Compilation\SemanticModel.cs (5)
331public abstract ImmutableArray<Diagnostic> GetSyntaxDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)); 345public abstract ImmutableArray<Diagnostic> GetDeclarationDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)); 359public abstract ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)); 376public abstract ImmutableArray<Diagnostic> GetDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)); 882internal abstract void ComputeDeclarationsInSpan(TextSpan span, bool getSymbol, ArrayBuilder<DeclarationInfo> builder, CancellationToken cancellationToken);
Diagnostic\Diagnostic.cs (2)
494internal bool HasIntersectingLocation(SyntaxTree tree, TextSpan? filterSpanWithinTree = null) 517static bool isLocationWithinSpan(Location location, SyntaxTree tree, TextSpan? filterSpan)
Diagnostic\ExternalFileLocation.cs (4)
16private readonly TextSpan _sourceSpan; 19internal ExternalFileLocation(string filePath, TextSpan sourceSpan, LinePositionSpan lineSpan) 26internal ExternalFileLocation(string filePath, TextSpan sourceSpan, LinePositionSpan lineSpan, string mappedFilePath, LinePositionSpan mappedLineSpan) 33public override TextSpan SourceSpan
Diagnostic\Location.cs (6)
59/// If <see cref="IsInSource"/> returns False this method returns an empty <see cref="TextSpan"/> which starts at position 0. 61public virtual TextSpan SourceSpan { get { return default(TextSpan); } } 158public static Location Create(SyntaxTree syntaxTree, TextSpan textSpan) 171public static Location Create(string filePath, TextSpan textSpan, LinePositionSpan lineSpan) 184public static Location Create(string filePath, TextSpan textSpan, LinePositionSpan lineSpan, string mappedFilePath, LinePositionSpan mappedLineSpan)
Diagnostic\SourceLocation.cs (3)
18private readonly TextSpan _span; 20public SourceLocation(SyntaxTree syntaxTree, TextSpan span) 64public override TextSpan SourceSpan
DiagnosticAnalyzer\AnalysisScope.cs (12)
26public TextSpan? FilterSpanOpt { get; } 48public TextSpan? OriginalFilterSpan { get; } 117public static AnalysisScope Create(ImmutableArray<DiagnosticAnalyzer> analyzers, SourceOrAdditionalFile filterFile, TextSpan? filterSpan, bool isSyntacticSingleFileAnalysis, CompilationWithAnalyzers compilationWithAnalyzers) 120public static AnalysisScope Create(ImmutableArray<DiagnosticAnalyzer> analyzers, SourceOrAdditionalFile filterFile, TextSpan? filterSpan, SourceOrAdditionalFile originalFilterFile, TextSpan? originalFilterSpan, bool isSyntacticSingleFileAnalysis, CompilationWithAnalyzers compilationWithAnalyzers) 135TextSpan? filterSpanOpt, 137TextSpan? originalFilterSpan, 157private static TextSpan? GetEffectiveFilterSpan(TextSpan? filterSpan, SourceOrAdditionalFile? filterFile) 209public AnalysisScope WithFilterSpan(TextSpan? filterSpan) 281public bool ShouldInclude(TextSpan filterSpan) 286public bool ContainsSpan(TextSpan filterSpan)
DiagnosticAnalyzer\AnalyzerDriver.cs (7)
1337var span = root.FullSpan; 2161TextSpan? filterSpan, 2187async ValueTask<IGroupedAnalyzerActions> getAllActionsAsync(AnalyzerDriver driver, ISymbol symbol, DiagnosticAnalyzer analyzer, SyntaxTree? filterTree, TextSpan? filterSpan, CancellationToken cancellationToken) 2203async ValueTask<IGroupedAnalyzerActions> getInheritedActionsAsync(AnalyzerDriver driver, ISymbol symbol, DiagnosticAnalyzer analyzer, SyntaxTree? filterTree, TextSpan? filterSpan, CancellationToken cancellationToken) 2227static async ValueTask<AnalyzerActions> getSymbolActionsCoreAsync(AnalyzerDriver driver, ISymbol symbol, DiagnosticAnalyzer analyzer, SyntaxTree? filterTree, TextSpan? filterSpan, CancellationToken cancellationToken) 2351protected bool IsGeneratedOrHiddenCodeLocation(SyntaxTree syntaxTree, TextSpan span, CancellationToken cancellationToken) 2354protected bool IsHiddenSourceLocation(SyntaxTree syntaxTree, TextSpan span)
DiagnosticAnalyzer\AnalyzerExecutor.AnalyzerDiagnosticReporter.cs (2)
29TextSpan? span, 89public TextSpan? FilterSpanForLocalDiagnostics;
DiagnosticAnalyzer\AnalyzerExecutor.cs (20)
45private readonly Func<SyntaxTree, TextSpan, CancellationToken, bool> _isGeneratedCodeLocation; 125Func<SyntaxTree, TextSpan, CancellationToken, bool> isGeneratedCodeLocation, 159Func<SyntaxTree, TextSpan, CancellationToken, bool> isGeneratedCodeLocation, 322TextSpan? filterSpan, 447TextSpan? filterSpan, 516TextSpan? filterSpan, 553TextSpan? filterSpan, 570TextSpan? filterSpan, 628TextSpan? filterSpan, 679TextSpan? filterSpan, 732TextSpan? filterSpan, 820TextSpan? filterSpan, 827public readonly TextSpan? FilterSpan = filterSpan; 844TextSpan? filterSpan, 948TextSpan? filterSpan, 1107TextSpan spanForContainingTopmostNodeForAnalysis, 1109TextSpan? filterSpan, 1209TextSpan spanForContainingOperationBlock, 1211TextSpan? filterSpan, 1605TextSpan? span,
DiagnosticAnalyzer\AnalyzerManager.AnalyzerExecutionContext.cs (1)
143TextSpan? filterSpan,
DiagnosticAnalyzer\AnalyzerManager.cs (3)
96TextSpan? filterSpan, 110TextSpan? filterSpan, 190TextSpan? filterSpan,
DiagnosticAnalyzer\CompilationUnitCompletedEvent.cs (2)
13public CompilationUnitCompletedEvent(Compilation compilation, SyntaxTree compilationUnit, TextSpan? filterSpan = null) 34public TextSpan? FilterSpan { get; }
DiagnosticAnalyzer\CompilationWithAnalyzers.cs (15)
406public async Task<ImmutableArray<Diagnostic>> GetAnalyzerSyntaxDiagnosticsAsync(SyntaxTree tree, TextSpan? filterSpan, CancellationToken cancellationToken) 440public async Task<ImmutableArray<Diagnostic>> GetAnalyzerSyntaxDiagnosticsAsync(SyntaxTree tree, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 469public Task<AnalysisResult> GetAnalysisResultAsync(SyntaxTree tree, TextSpan? filterSpan, CancellationToken cancellationToken) 500public Task<AnalysisResult> GetAnalysisResultAsync(SyntaxTree tree, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 547public async Task<AnalysisResult> GetAnalysisResultAsync(AdditionalText file, TextSpan? filterSpan, CancellationToken cancellationToken) 564public async Task<AnalysisResult> GetAnalysisResultAsync(AdditionalText file, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 572private async Task<AnalysisResult> GetAnalysisResultCoreAsync(SourceOrAdditionalFile file, ImmutableArray<DiagnosticAnalyzer> analyzers, TextSpan? filterSpan, CancellationToken cancellationToken) 579private async Task<ImmutableArray<Diagnostic>> GetAnalyzerSyntaxDiagnosticsCoreAsync(SyntaxTree tree, ImmutableArray<DiagnosticAnalyzer> analyzers, TextSpan? filterSpan, CancellationToken cancellationToken) 593public async Task<ImmutableArray<Diagnostic>> GetAnalyzerSemanticDiagnosticsAsync(SemanticModel model, TextSpan? filterSpan, CancellationToken cancellationToken) 608public async Task<ImmutableArray<Diagnostic>> GetAnalyzerSemanticDiagnosticsAsync(SemanticModel model, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 623public Task<AnalysisResult> GetAnalysisResultAsync(SemanticModel model, TextSpan? filterSpan, CancellationToken cancellationToken) 638public Task<AnalysisResult> GetAnalysisResultAsync(SemanticModel model, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 646private async Task<AnalysisResult> GetAnalysisResultCoreAsync(SemanticModel model, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 653private async Task<ImmutableArray<Diagnostic>> GetAnalyzerSemanticDiagnosticsCoreAsync(SemanticModel model, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 874TextSpan? originalSpan,
DiagnosticAnalyzer\DiagnosticAnalysisContext.cs (23)
721public TextSpan? FilterSpan { get; } 739TextSpan? filterSpan, 807public TextSpan? FilterSpan { get; } 835TextSpan? filterSpan, 903public TextSpan? FilterSpan { get; } 916internal SymbolStartAnalysisContext(ISymbol symbol, Compilation compilation, AnalyzerOptions options, bool isGeneratedCode, SyntaxTree? filterTree, TextSpan? filterSpan, CancellationToken cancellationToken) 1065public TextSpan? FilterSpan { get; } 1088TextSpan? filterSpan, 1176public TextSpan? FilterSpan { get; } 1201TextSpan? filterSpan, 1286public TextSpan? FilterSpan { get; } 1317TextSpan? filterSpan, 1429public TextSpan? FilterSpan { get; } 1464TextSpan? filterSpan, 1542public TextSpan? FilterSpan { get; } 1568TextSpan? filterSpan, 1620public TextSpan? FilterSpan { get; } 1638TextSpan? filterSpan, 1653/// which can be created using <see cref="Location.Create(string, TextSpan, LinePositionSpan)"/> API. 1714public TextSpan? FilterSpan { get; } 1745TextSpan? filterSpan, 1820public TextSpan? FilterSpan { get; } 1853TextSpan? filterSpan,
DiagnosticAnalyzer\DiagnosticStartAnalysisScope.cs (3)
239TextSpan? filterSpan, 307TextSpan? filterSpan, 343TextSpan? filterSpan,
Symbols\ISymbolInternal.cs (1)
190bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken = default);
Syntax\LineDirectiveMap.cs (2)
49public FileLinePositionSpan TranslateSpan(SourceText sourceText, string treeFilePath, TextSpan span) 111internal abstract FileLinePositionSpan TranslateSpanAndVisibility(SourceText sourceText, string treeFilePath, TextSpan span, out bool isHiddenPosition);
Syntax\SeparatedSyntaxList.cs (2)
173public TextSpan FullSpan 181public TextSpan Span
Syntax\SyntaxDiffer.cs (17)
23private readonly TextSpan _oldSpan; 72internal static IList<TextSpan> GetPossiblyDifferentTextSpans(SyntaxTree? before, SyntaxTree? after) 77return SpecializedCollections.EmptyList<TextSpan>(); 95internal static IList<TextSpan> GetPossiblyDifferentTextSpans(SyntaxNode oldNode, SyntaxNode newNode) 100private IList<TextSpan> ComputeSpansInNew() 106var newSpans = new List<TextSpan>(); 533var oldSpan = GetSpan(_oldNodes, 0, oldNodeCount); 545var oldSpan = removedNode.FullSpan; 548var newSpan = insertedNode.FullSpan; 554var oldSpan = GetSpan(_oldNodes, 0, oldNodeCount); 557var newSpan = GetSpan(_newNodes, 0, newNodeCount); 566var newSpan = GetSpan(_newNodes, 0, newNodeCount); 625private static TextSpan GetSpan(Stack<SyntaxNodeOrToken> stack, int first, int length) 647return TextSpan.FromBounds(start, end); 650private static TextSpan GetSpan(Queue<SyntaxNodeOrToken> queue, int first, int length) 672return TextSpan.FromBounds(start, end); 827var span = GetSpan(queue, 0, queue.Count);
Syntax\SyntaxList`1.cs (6)
158public TextSpan FullSpan 164return default(TextSpan); 168return TextSpan.FromBounds(this[0].FullSpan.Start, this[this.Count - 1].FullSpan.End); 176public TextSpan Span 182return default(TextSpan); 186return TextSpan.FromBounds(this[0].Span.Start, this[this.Count - 1].Span.End);
Syntax\SyntaxNode.cs (13)
85public TextSpan FullSpan => new TextSpan(this.Position, this.Green.FullWidth); 92public TextSpan Span 114/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 888public IEnumerable<SyntaxNode> DescendantNodes(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 909public IEnumerable<SyntaxNode> DescendantNodesAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 930public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 951public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 966public SyntaxNode FindNode(TextSpan span, bool findInsideTrivia = false, bool getInnermostNodeForTie = false) 975!.FirstAncestorOrSelf<SyntaxNode, TextSpan>((a, span) => a.FullSpan.Contains(span), span); 1056public IEnumerable<SyntaxToken> DescendantTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 1193public IEnumerable<SyntaxTrivia> DescendantTrivia(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 1213TextSpan span, 1570var span = token.Span;
Syntax\SyntaxNode.Iterators.cs (16)
16private IEnumerable<SyntaxNode> DescendantNodesImpl(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool descendIntoTrivia, bool includeSelf) 23private IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensImpl(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool descendIntoTrivia, bool includeSelf) 29TextSpan span, 41TextSpan span, 51private static bool IsInSpan(in TextSpan span, TextSpan childSpan) 104public bool TryGetNextInSpan(in TextSpan span, out SyntaxNodeOrToken value) 119public SyntaxNode? TryGetNextAsNodeInSpan(in TextSpan span) 262public bool TryGetNextInSpan(in TextSpan span, out SyntaxNodeOrToken value) 359public bool TryGetNextInSpan(in TextSpan span, out SyntaxNodeOrToken value) 431private IEnumerable<SyntaxNode> DescendantNodesOnly(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool includeSelf) 456private bool ShouldYieldSelf(bool includeSelf, in TextSpan span, Func<GreenNode, bool>? descendIntoChildrenGreen) 460TextSpan span, 493TextSpan span, 585TextSpan span, 626TextSpan span,
Syntax\SyntaxNodeOrToken.cs (5)
227public TextSpan Span 241return default(TextSpan); 246/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 273public TextSpan FullSpan 287return default(TextSpan);
Syntax\SyntaxNodeOrTokenList.cs (4)
168public TextSpan FullSpan => _node?.FullSpan ?? default(TextSpan); 173public TextSpan Span => _node?.Span ?? default(TextSpan);
Syntax\SyntaxReference.cs (1)
24public abstract TextSpan Span { get; }
Syntax\SyntaxToken.cs (4)
106public TextSpan Span 110return Node != null ? new TextSpan(Position + Node.GetLeadingTriviaWidth(), Node.Width) : default(TextSpan); 120/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 133public TextSpan FullSpan => new TextSpan(Position, FullWidth);
Syntax\SyntaxTokenList.cs (5)
152public TextSpan FullSpan 158return default(TextSpan); 168public TextSpan Span 174return default(TextSpan); 177return TextSpan.FromBounds(Position + Node.GetLeadingTriviaWidth(),
Syntax\SyntaxTree.cs (7)
219public abstract FileLinePositionSpan GetLineSpan(TextSpan span, CancellationToken cancellationToken = default); 236public abstract FileLinePositionSpan GetMappedLineSpan(TextSpan span, CancellationToken cancellationToken = default); 269internal virtual FileLinePositionSpan GetMappedLineSpanAndVisibility(TextSpan span, out bool isHiddenPosition) 285internal string GetDisplayPath(TextSpan span, SourceReferenceResolver? resolver) 320internal int GetDisplayLineNumber(TextSpan span) 336public abstract IList<TextSpan> GetChangedSpans(SyntaxTree syntaxTree); 341public abstract Location GetLocation(TextSpan span);
Syntax\SyntaxTreeExtensions.cs (3)
29var fullSpan = new TextSpan(0, text.Length); 36var change = TextChangeRange.Collapse(changes).Span; 49var span = node.FullSpan;
Syntax\SyntaxTrivia.cs (5)
92public TextSpan Span 98: default(TextSpan); 103/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 122public TextSpan FullSpan 124get { return UnderlyingNode != null ? new TextSpan(Position, UnderlyingNode.FullWidth) : default(TextSpan); }
Syntax\SyntaxTriviaList.cs (5)
150public TextSpan FullSpan 156return default(TextSpan); 166public TextSpan Span 172return default(TextSpan); 175return TextSpan.FromBounds(Position + Node.GetLeadingTriviaWidth(),
Syntax\TranslationSyntaxReference.cs (1)
24public sealed override TextSpan Span
Text\ChangedText.cs (2)
137public override string ToString(TextSpan span) 142public override SourceText GetSubText(TextSpan span)
Text\CompositeText.cs (1)
83public override SourceText GetSubText(TextSpan span)
Text\LargeText.cs (1)
183public override void Write(TextWriter writer, TextSpan span, CancellationToken cancellationToken = default(CancellationToken))
Text\SourceText.cs (8)
488internal void CheckSubSpan(TextSpan span) 501public virtual SourceText GetSubText(TextSpan span) 551public virtual void Write(TextWriter writer, TextSpan span, CancellationToken cancellationToken = default(CancellationToken)) 721public virtual string ToString(TextSpan span) 878public SourceText Replace(TextSpan span, string newText) 933var span = new TextSpan(newPos, range.NewLength); 1039return TextLine.FromSpanUnsafe(_text, TextSpan.FromBounds(start, _text.Length), lineBreakLength: 0); 1046return TextLine.FromSpanUnsafe(_text, TextSpan.FromBounds(start, end), lineBreakLen);
Text\StringBuilderText.cs (1)
78public override string ToString(TextSpan span)
Text\StringText.cs (2)
71public override string ToString(TextSpan span) 91public override void Write(TextWriter textWriter, TextSpan span, CancellationToken cancellationToken = default(CancellationToken))
Text\SubText.cs (6)
17public SubText(SourceText text, TextSpan span) 41public TextSpan UnderlyingSpan { get; } 71public override string ToString(TextSpan span) 78public override SourceText GetSubText(TextSpan span) 87var span = GetCompositeSpan(sourceIndex, count); 91private TextSpan GetCompositeSpan(int start, int length)
Text\TextChange.cs (3)
25public TextSpan Span { get; } 38public TextChange(TextSpan span, string newText) 66EqualityComparer<TextSpan>.Default.Equals(this.Span, other.Span) &&
Text\TextChangeRange.cs (4)
22public TextSpan Span { get; } 36public TextChangeRange(TextSpan span, int newLength) 127var combined = TextSpan.FromBounds(start, end);
Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
Text\TextLine.cs (6)
45public static TextLine FromSpan(SourceText text, TextSpan span) 98internal static TextLine FromSpanUnsafe(SourceText text, TextSpan span, int lineBreakLength) 160public TextSpan Span 162get { return TextSpan.FromBounds(this.Start, this.End); } 168public TextSpan SpanIncludingLineBreak 170get { return TextSpan.FromBounds(this.Start, this.EndIncludingLineBreak); }
Text\TextLineCollection.cs (5)
53/// Convert a <see cref="TextSpan"/> to a <see cref="LinePositionSpan"/>. 55public LinePositionSpan GetLinePositionSpan(TextSpan span) 74/// Convert a <see cref="LinePositionSpan"/> to <see cref="TextSpan"/>. 76public TextSpan GetTextSpan(LinePositionSpan span) 78return TextSpan.FromBounds(GetPosition(span.Start), GetPosition(span.End));
Text\TextSpan.cs (29)
16public readonly struct TextSpan : IEquatable<TextSpan>, IComparable<TextSpan> 84public bool Contains(TextSpan span) 100public bool OverlapsWith(TextSpan span) 117public TextSpan? Overlap(TextSpan span) 123? TextSpan.FromBounds(overlapStart, overlapEnd) 124: (TextSpan?)null; 138public bool IntersectsWith(TextSpan span) 168public TextSpan? Intersection(TextSpan span) 174? TextSpan.FromBounds(intersectStart, intersectEnd) 175: (TextSpan?)null; 179/// Creates a new <see cref="TextSpan"/> from <paramref name="start" /> and <paramref 185public static TextSpan FromBounds(int start, int end) 201/// Determines if two instances of <see cref="TextSpan"/> are the same. 203public static bool operator ==(TextSpan left, TextSpan right) 209/// Determines if two instances of <see cref="TextSpan"/> are different. 211public static bool operator !=(TextSpan left, TextSpan right) 217/// Determines if current instance of <see cref="TextSpan"/> is equal to another. 219public bool Equals(TextSpan other) 225/// Determines if current instance of <see cref="TextSpan"/> is equal to another. 228=> obj is TextSpan span && Equals(span); 231/// Produces a hash code for <see cref="TextSpan"/>. 239/// Provides a string representation for <see cref="TextSpan"/>. 249/// Compares current instance of <see cref="TextSpan"/> with another. 251public int CompareTo(TextSpan other)
Microsoft.CodeAnalysis.Analyzers (434)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer.cs (2)
682var span = fixLocation.SourceSpan; 691[NotNullWhen(returnValue: true)] out TextSpan? fileSpan)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_ResourceStringsFormat.cs (1)
99var span = new TextSpan(indexOfValue, valueLength);
MetaAnalyzers\Fixers\CompareSymbolsCorrectlyFix.cs (2)
65private async Task<Document> ConvertToEqualsAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken) 80private async Task<Document> CallOverloadWithEqualityComparerAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken)
MetaAnalyzers\Fixers\ConfigureGeneratedCodeAnalysisFix.cs (1)
43private async Task<Document> ConfigureGeneratedCodeAnalysisAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken)
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.cs (2)
91public FixInfo(string fixValue, TextDocument additionalDocumentToFix, TextSpan additionalDocumentSpanToFix) 101public TextSpan? AdditionalDocumentSpanToFix { get; }
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.CustomFixAllProvider.cs (2)
133using var _2 = PooledHashSet<TextSpan>.GetInstance(out var seenInputSpansToFix); 136var inputSpanToFix = fixInfo.AdditionalDocumentSpanToFix!.Value;
MetaAnalyzers\Fixers\EnableConcurrentExecutionFix.cs (1)
42private async Task<Document> EnableConcurrentExecutionAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken)
MetaAnalyzers\Fixers\PreferIsKindFix.cs (2)
37private async Task<Document> ConvertKindToIsKindAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken) 48protected abstract SyntaxNode? TryGetNodeToFix(SyntaxNode root, TextSpan span);
MetaAnalyzers\ReleaseTrackingHelper.cs (5)
439public TextSpan Span { get; } 449TextSpan span, SourceText sourceText, 458TextSpan span, SourceText sourceText, 478TextSpan span, SourceText sourceText, 497TextSpan span, SourceText sourceText,
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (3)
29var fullSpan = new TextSpan(0, text.Length); 36var change = TextChangeRange.Collapse(changes).Span; 49var span = node.FullSpan;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\roslyn\src\RoslynAnalyzers\Microsoft.CodeAnalysis.BannedApiAnalyzers\Core\SymbolIsBannedAnalyzerBase.cs (2)
480public TextSpan Span { get; } 489public BanFileEntry(Compilation compilation, string text, TextSpan span, SourceText sourceText, string path)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (3)
105var thisSpan = introspector.GetSpan(value); 125var thisSpan = introspector.GetSpan(value); 138var thisSpan = introspector.GetSpan(value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (40)
14internal sealed class NormalizedTextSpanCollection : ReadOnlyCollection<TextSpan> 29public NormalizedTextSpanCollection(TextSpan span) 42public NormalizedTextSpanCollection(IEnumerable<TextSpan> spans) 93var span1 = left[index1]; 94var span2 = right[index2]; 122spans.Add(TextSpan.FromBounds(start, end)); 161var span1 = left[index1]; 162var span2 = right[index2]; 221var span1 = left[index1]; 222var span2 = right[index2]; 283var span1 = left[index1]; 284var span2 = right[index2]; 296spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 307spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span2.Start)); 333var span1 = left[index1++]; 334spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 398var span1 = this[index1]; 399var span2 = set[index2]; 429public bool OverlapsWith(TextSpan span) 458var span1 = this[index1]; 459var span2 = set[index2]; 483public bool IntersectsWith(TextSpan span) 506foreach (var s in this) 533foreach (var s in this) 546private static IList<TextSpan> ListFromSpan(TextSpan span) 548IList<TextSpan> list = 564private static void UpdateSpanUnion(TextSpan span, IList<TextSpan> spans, ref int start, ref int end) 568spans.Add(TextSpan.FromBounds(start, end)); 585private static IList<TextSpan> NormalizeSpans(IEnumerable<TextSpan> spans) 592var sorted = new List<TextSpan>(spans); 599sorted.Sort(delegate (TextSpan s1, TextSpan s2) { return s1.Start.CompareTo(s2.Start); }); 601IList<TextSpan> normalized = new List<TextSpan>(sorted.Count); 611normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 621normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 626private sealed class OrderedSpanList : List<TextSpan>
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\TextSpanMutableIntervalTree.cs (9)
10internal readonly struct TextSpanIntervalIntrospector : IIntervalIntrospector<TextSpan> 12public TextSpan GetSpan(TextSpan value) 16internal sealed class TextSpanMutableIntervalTree(IEnumerable<TextSpan>? values) 17: SimpleMutableIntervalTree<TextSpan, TextSpanIntervalIntrospector>(new TextSpanIntervalIntrospector(), values) 23public TextSpanMutableIntervalTree(params TextSpan[]? values) : this((IEnumerable<TextSpan>?)values) 27public bool HasIntervalThatIntersectsWith(TextSpan span) 30public bool HasIntervalThatOverlapsWith(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\NamingStyles\NamingStyleOption.cs (3)
13/// The root naming style option composed of several settings as well as a <see cref="TextSpan"/>s describing where they were all defined. 29/// A description of the kinds of symbols a rule should apply to as well as a <see cref="TextSpan"/>s describing where they were all defined. 42/// The rules about how the specified symbols must be named as well as a <see cref="TextSpan"/>s describing where they were all defined.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\Section.cs (2)
16public TextSpan Span { get; init; } 24public Section(string? filePath, bool isGlobal, TextSpan span, string text, string fullText)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxHelpers.cs (4)
12public static TextSpan GetSpan<TSyntaxKind>(EmbeddedSyntaxToken<TSyntaxKind> token1, EmbeddedSyntaxToken<TSyntaxKind> token2) where TSyntaxKind : struct 15public static TextSpan GetSpan(VirtualCharSequence virtualChars) 18public static TextSpan GetSpan(VirtualChar firstChar, VirtualChar lastChar) 19=> TextSpan.FromBounds(firstChar.Span.Start, lastChar.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (6)
42private TextSpan? _fullSpan; 56public TextSpan GetSpan() 63return TextSpan.FromBounds(start, end); 66public TextSpan? GetFullSpan() 69private TextSpan? ComputeFullSpan() 76return TextSpan.FromBounds(start.Value, end.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (2)
68/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 96public TextSpan Span => new(TokenStart + Green.Offset, Green.Width);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharGreenSequence.Chunks.cs (1)
50var span = new VirtualChar(ch, tokenStart).Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
50private readonly TextSpan _span; 57private VirtualCharGreenSequence(Chunk sequence, TextSpan span) 114TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharUtilities.cs (4)
15public static TextSpan FromBounds(VirtualChar vc1, VirtualChar vc2) 16=> TextSpan.FromBounds(vc1.Span.Start, vc2.Span.End); 26public static (ImmutableSegmentedList<VirtualChar> sourceCode, ImmutableArray<TextSpan> markdownSpans) StripMarkupCharacters( 29using var _ = ArrayBuilder<TextSpan>.GetInstance(out var markdownSpans);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (13)
13private static bool ShouldAnalyze(TextSpan? contextFilterSpan, TextSpan span) 23public static bool ShouldAnalyzeSpan(this SyntaxTreeAnalysisContext context, TextSpan span) 33public static bool ShouldAnalyzeSpan(this SemanticModelAnalysisContext context, TextSpan span) 43public static bool ShouldAnalyzeSpan(this SymbolStartAnalysisContext context, TextSpan span, SyntaxTree tree) 63public static bool ShouldAnalyzeSpan(this SymbolAnalysisContext context, TextSpan span, SyntaxTree tree) 83public static bool ShouldAnalyzeSpan(this AdditionalFileAnalysisContext context, TextSpan span) 93public static bool ShouldAnalyzeSpan(this OperationBlockStartAnalysisContext context, TextSpan span) 103public static bool ShouldAnalyzeSpan(this OperationBlockAnalysisContext context, TextSpan span) 113public static bool ShouldAnalyzeSpan(this OperationAnalysisContext context, TextSpan span) 123public static bool ShouldAnalyzeSpan(this SyntaxNodeAnalysisContext context, TextSpan span) 133public static bool ShouldAnalyzeSpan<TSytnaxKind>(this CodeBlockStartAnalysisContext<TSytnaxKind> context, TextSpan span) where TSytnaxKind : struct 143public static bool ShouldAnalyzeSpan(this CodeBlockAnalysisContext context, TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (2)
32this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden, CancellationToken cancellationToken) 44this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (12)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate) 296public static TextSpan GetContainedSpan(this IEnumerable<SyntaxNode> nodes) 301var fullSpan = nodes.First().Span; 304fullSpan = TextSpan.FromBounds( 315public static bool OverlapsHiddenPosition(this SyntaxNode node, TextSpan span, CancellationToken cancellationToken) 323var textSpan = TextSpan.FromBounds(start, end); 409var spans = new List<TextSpan>(nodesToReplace.Count + tokensToReplace.Count + triviaToReplace.Count); 432TextSpan previous = default; 433foreach (var span in spans) 785public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 963var fullSpan = node.FullSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (3)
18public static bool OverlapsHiddenPosition([NotNullWhen(returnValue: true)] this SyntaxTree? tree, TextSpan span, CancellationToken cancellationToken) 98public static bool IsEntirelyHidden(this SyntaxTree tree, TextSpan span, CancellationToken cancellationToken) 252public static SyntaxNode FindNode(this SyntaxTree syntaxTree, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (22)
18public static IEnumerable<TextSpan> ToNormalizedSpans(this IEnumerable<TextSpan> spans) 21public static ImmutableArray<TextSpan> ToNormalizedSpans(this ImmutableArray<TextSpan> spans) 24public static TextSpan Collapse(this IEnumerable<TextSpan> spans) 29foreach (var span in spans) 48return TextSpan.FromBounds(start, end); 54public static bool IsAround(this TextSpan span, SyntaxNodeOrToken node) => IsAround(span, node, node); 60public static bool IsAround(this TextSpan span, SyntaxNodeOrToken startNode, SyntaxNodeOrToken endNode) 62var innerSpan = TextSpan.FromBounds(startNode.Span.Start, endNode.Span.End); 63var outerSpan = TextSpan.FromBounds(startNode.FullSpan.Start, endNode.FullSpan.End); 67public static IEnumerable<TextSpan> Subtract(this TextSpan span, TextSpan except) 81yield return TextSpan.FromBounds(span.Start, startSegmentEnd); 85yield return TextSpan.FromBounds(endSegmentStart, span.End); 88public static IEnumerable<TextSpan> Subtract(this IEnumerable<TextSpan> spans, TextSpan except)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\AbstractSyntaxFormatting.cs (3)
21private static readonly Func<TextSpan, bool> s_notEmpty = s => !s.IsEmpty; 32public IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 34IReadOnlyList<TextSpan> spansToFormat;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.AnchorData.cs (4)
18public TextSpan TextSpan => operation.TextSpan; 34TextSpan IIntervalIntrospector<AnchorData>.GetSpan(AnchorData value) 37TextSpan IIntervalIntrospector<IndentationData>.GetSpan(IndentationData value) 40TextSpan IIntervalIntrospector<RelativeIndentationData>.GetSpan(RelativeIndentationData value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (18)
45private readonly HashSet<TextSpan> _indentationMap = []; 46private readonly HashSet<TextSpan> _suppressWrappingMap = []; 47private readonly HashSet<TextSpan> _suppressSpacingMap = []; 48private readonly HashSet<TextSpan> _suppressFormattingMap = []; 49private readonly HashSet<TextSpan> _anchorMap = []; 140var baseSpan = _initialIndentBlockOperations[0].TextSpan; 159var operationSpan = operations[i].TextSpan; 180var intervalTreeSpan = operation.TextSpan; 409private static void DebugCheckEmpty<T, TIntrospector>(ContextMutableIntervalTree<T, TIntrospector> tree, TextSpan textSpan) 448var span = token.Span; 469var span = token.Span; 592public bool IsWrappingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 614public bool IsSpacingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 643var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End); 650public bool IsFormattingDisabled(TextSpan textSpan) 658var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.IndentationData.cs (14)
17private abstract class IndentationData(TextSpan textSpan) 19public TextSpan TextSpan { get; } = textSpan; 22public IndentationData WithTextSpan(TextSpan span) 25protected abstract IndentationData WithTextSpanCore(TextSpan span); 28private sealed class SimpleIndentationData(TextSpan textSpan, int indentation) : IndentationData(textSpan) 32protected override IndentationData WithTextSpanCore(TextSpan span) 56public RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter) 67this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 70private RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter, int lazyIndentationDelta) 81this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 84public TextSpan InseparableRegionSpan { get; } 106protected override IndentationData WithTextSpanCore(TextSpan span) 118public AdjustedIndentationData(TextSpan textSpan, IndentationData baseIndentationData, int adjustment) 141protected override IndentationData WithTextSpanCore(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ContextMutableIntervalTree.cs (4)
40var thisSpan = introspector.GetSpan(value); 52var thisSpan = introspector.GetSpan(value); 125var resultSpan = Introspector.GetSpan(result!); 126var currentNodeSpan = Introspector.GetSpan(currentNode.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (5)
44protected readonly TextSpan SpanToFormat; 336private TextSpan GetSpanToFormat() 341return TextSpan.FromBounds(startPosition, endPosition); 458var spanBetweenTokens = TextSpan.FromBounds(token1.Span.End, token2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (4)
26public readonly TextSpan FormattedSpan; 31TextSpan formattedSpan) 78var span = TextSpan.FromBounds(token1.RawKind == 0 ? this.TreeInfo.StartPosition : token1.Span.End, token2.RawKind == 0 ? this.TreeInfo.EndPosition : token2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.NodeAndText.cs (3)
37return _text.ToString(TextSpan.FromBounds(token2.FullSpan.Start, token2.SpanStart)); 43return _text.ToString(TextSpan.FromBounds(token1.Span.End, token1.FullSpan.End)); 46return _text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (13)
239var span = textChange.Span; 267internal static IEnumerable<TextSpan> GetAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 277static IEnumerable<TextSpan> EnumerateAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 295internal static TextSpan GetSpanIncludingPreviousAndNextTokens(SyntaxToken firstToken, SyntaxToken lastToken) 307return TextSpan.FromBounds(start, end); 310internal static TextSpan GetElasticSpan(SyntaxToken token) 313private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 315var aggregateSpans = new List<TextSpan>(); 317var last = default(TextSpan); 318foreach (var span in spans) 326last = TextSpan.FromBounds(last.Start, span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (10)
20private readonly TextSpan _span; 22public BaseIndentationFormattingRule(SyntaxNode root, TextSpan span, int baseIndentation, AbstractFormattingRule? vbHelperFormattingRule = null) 130private TextSpan AdjustTextSpan(TextSpan textSpan) 131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End)); 133private static void SetInnermostNodeForSpan(SyntaxNode root, ref TextSpan span, out SyntaxToken token1, out SyntaxToken token2, out SyntaxNode? commonNode) 149private static void GetTokens(SyntaxNode root, TextSpan span, out SyntaxToken token1, out SyntaxToken token2) 168private static TextSpan GetSpanFromTokens(TextSpan span, SyntaxToken token1, SyntaxToken token2) 217return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\FormattingOperations.cs (8)
30=> CreateAnchorIndentationOperation(anchorToken, endToken, TextSpan.FromBounds(anchorToken.Span.End, endToken.Span.End)); 35public static AnchorIndentationOperation CreateAnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 42=> CreateSuppressOperation(startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End), option); 47private static SuppressOperation CreateSuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option) 55var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 62public static IndentBlockOperation CreateIndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 70var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 78public static IndentBlockOperation CreateRelativeIndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\IndentBlockOperation.cs (3)
14internal IndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 33internal IndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 56public TextSpan TextSpan { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\SuppressOperation.cs (2)
14public readonly TextSpan TextSpan; 19internal SuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (13)
45private delegate void WhitespaceAppender<T>(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<T> changes); 387var span = GetTextSpan(trivia1, trivia2); 499var span = TextSpan.FromBounds(start, end); 715var insertionPoint = GetInsertionSpan(changes); 730private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 765TextSpan notUsed, 822private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 825private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes) 831private TextSpan GetTextSpan(SyntaxTrivia trivia1, SyntaxTrivia trivia2) 835return TextSpan.FromBounds(this.StartPosition, trivia2.FullSpan.Start); 840return TextSpan.FromBounds(trivia1.FullSpan.End, this.EndPosition); 843return TextSpan.FromBounds(trivia1.FullSpan.End, trivia2.FullSpan.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\AbstractUnnecessaryImportsProvider.cs (3)
23public ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken) 27SemanticModel model, TextSpan? span, Func<SyntaxNode, bool>? predicate, CancellationToken cancellationToken) 35bool HasImportThatIntersectsWithSpan(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (3)
237private TextSpan GetNormalizedSpan(int position) 241return TextSpan.FromBounds(LineToBeIndented.Start, position); 244return TextSpan.FromBounds(position, LineToBeIndented.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (3)
29using var parts = TemporaryArray<TextSpan>.Empty; 73private static ImmutableArray<string> CreateWords(in TemporaryArray<TextSpan> parts, string name) 76foreach (var part in parts)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (21)
160var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 174private WordSpanEnumerable GetWordSpans(string name, TextSpan nameSpan) 177private static string Substring(string name, TextSpan wordSpan) 180private static readonly Func<string, TextSpan, bool> s_firstCharIsLowerCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsLower(val[span.Start]); 181private static readonly Func<string, TextSpan, bool> s_firstCharIsUpperCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsUpper(val[span.Start]); 183private static readonly Func<string, TextSpan, bool> s_wordIsAllUpperCase = (val, span) => 196private static readonly Func<string, TextSpan, bool> s_wordIsAllLowerCase = (val, span) => 210string name, TextSpan nameSpan, Func<string, TextSpan, bool> wordCheck, 216foreach (var wordSpan in GetWordSpans(name, nameSpan)) 232private bool CheckPascalCase(string name, TextSpan nameSpan, out string reason) 237private bool CheckAllUpper(string name, TextSpan nameSpan, out string reason) 242private bool CheckAllLower(string name, TextSpan nameSpan, out string reason) 248string name, TextSpan nameSpan, 249Func<string, TextSpan, bool> firstWordCheck, 250Func<string, TextSpan, bool> restWordCheck, 260foreach (var wordSpan in GetWordSpans(name, nameSpan)) 291private bool CheckCamelCase(string name, TextSpan nameSpan, out string reason) 298private bool CheckFirstUpper(string name, TextSpan nameSpan, out string reason) 406using var parts = TemporaryArray<TextSpan>.Empty;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (4)
16private readonly TextSpan _nameSpan; 19public WordSpanEnumerator(string name, TextSpan nameSpan, string wordSeparator) 28public TextSpan Current { get; private set; } 70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\RefactoringHelpers\AbstractRefactoringHelpers.cs (10)
39/// Returns unchanged <paramref name="span"/> in case <see cref="TextSpan.IsEmpty"/>. 40/// Returns empty Span with original <see cref="TextSpan.Start"/> in case it contains only whitespace. 42private static TextSpan GetTrimmedTextSpan(SourceText sourceText, TextSpan span) 56return TextSpan.FromBounds(start, end); 60SourceText sourceText, SyntaxNode root, TextSpan selectionRaw, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 69var selectionTrimmed = GetTrimmedTextSpan(sourceText, selectionRaw); 354var rightNodeSpanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, rightNode); 366TextSpan selectionTrimmed, 384var spanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, nonHiddenExtractedNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\RefactoringHelpers\IRefactoringHelpers.cs (1)
55SourceText sourceText, SyntaxNode root, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (4)
34SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 38SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 42SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, 77SyntaxNode root, SourceText text, TextSpan textSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
429TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 432/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 433/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 435/// an empty <see cref="TextSpan"/> at position 0. 438TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 479bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(firstNode.Span.Start, lastNode.Span.End); 182this ISyntaxFacts syntaxFacts, TextSpan span, SyntaxNode node, CancellationToken cancellationToken) 441public static TextSpan GetSpanWithoutAttributes(this ISyntaxFacts syntaxFacts, SyntaxNode root, SyntaxNode node) 461return TextSpan.FromBounds(startOfNodeWithoutAttributes, endOfNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (6)
36private readonly TextSpan[] _wordSpans; 101_wordSpans = new TextSpan[distinctValues.Length]; 177private void Add(TextSpan characterSpan, int insertionIndex) 218TextSpan characterSpan, int insertionIndex, int currentNodeEdgeCount, int currentNodeIndex, int editDistance) 286private struct BuilderNode(TextSpan characterSpan) 288public readonly TextSpan CharacterSpan = characterSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (2)
11private readonly struct Node(TextSpan wordSpan, int edgeCount, int firstEdgeIndex) 17public readonly TextSpan WordSpan = wordSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (10)
45public static IEnumerable<(SyntaxToken, SyntaxToken)> ConvertToTokenPairs(this SyntaxNode root, IReadOnlyList<TextSpan> spans) 81public static ValueTuple<SyntaxToken, SyntaxToken> ConvertToTokenPair(this SyntaxNode root, TextSpan textSpan) 157=> (token1.RawKind == 0) ? text.ToString(TextSpan.FromBounds(0, token2.SpanStart)) : text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart)); 259public static TextSpan GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(SyntaxToken startToken, SyntaxToken endToken) 266return TextSpan.FromBounds(startPosition, endPosition); 324var fullSpan = node.FullSpan; 357public static TextSpan GetFormattingSpan(SyntaxNode root, TextSpan span) 367return TextSpan.FromBounds(startPosition, endPosition);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
17public static void AddWordParts(ReadOnlySpan<char> identifier, ref TemporaryArray<TextSpan> parts) 20public static void AddCharacterParts(ReadOnlySpan<char> identifier, ref TemporaryArray<TextSpan> parts) 23public static void AddParts(ReadOnlySpan<char> text, bool word, ref TemporaryArray<TextSpan> parts) 27var span = StringBreaker.GenerateSpan(text, start, word); 41public static TextSpan GenerateSpan(ReadOnlySpan<char> identifier, int wordStart, bool word) 81private static TextSpan ScanCharacterRun(ReadOnlySpan<char> identifier, int length, int wordStart) 102private static TextSpan ScanWordRun(ReadOnlySpan<char> identifier, int length, int wordStart) 151private static TextSpan ScanLowerCaseRun(ReadOnlySpan<char> identifier, int length, int wordStart) 162private static TextSpan ScanNumber(ReadOnlySpan<char> identifier, int length, int wordStart) 170return TextSpan.FromBounds(wordStart, current);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\MultiProjectSafeFixAllProvider.cs (4)
26protected abstract void FixAll(SyntaxEditor editor, IEnumerable<TextSpan> commonSpans); 79using var _ = PooledHashSet<TextSpan>.GetInstance(out var commonSpans); 110static IEnumerable<TextSpan> GetDiagnosticSpans(ImmutableArray<Diagnostic> diagnostics) 114private SyntaxNode FixAll(SolutionServices services, SyntaxNode root, PooledHashSet<TextSpan> commonSpans)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixesAndRefactorings\AbstractFixAllSpanMappingService.cs (8)
20protected abstract Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansIfWithinGlobalStatementAsync( 21Document document, TextSpan span, CancellationToken cancellationToken); 23public Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 24Document document, TextSpan triggerSpan, FixAllScope fixAllScope, CancellationToken cancellationToken) 32private async Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 33Document document, TextSpan span, bool fixAllInContainingMember, CancellationToken cancellationToken) 50var builder = PooledDictionary<Document, ArrayBuilder<TextSpan>>.GetInstance(); 75TextSpan span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixesAndRefactorings\IFixAllSpanMappingService.cs (2)
30Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 31Document document, TextSpan triggerSpan, FixAllScope fixAllScope, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (3)
50protected static TextSpan GetSpan(SyntaxNode node) 55return TextSpan.FromBounds(start.SpanStart, end.Span.End); 110var span = GetSpan(destination);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (1)
24public void AddRelevantNodes<TSyntaxNode>(SourceText sourceText, SyntaxNode root, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringContextExtensions.cs (9)
21this CodeRefactoringContext context, ImmutableArray<TCodeAction> actions, TextSpan? applicableToSpan = null) 59public static async Task<TSyntaxNode?> TryGetRelevantNodeAsync<TSyntaxNode>(this Document document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 65public static TSyntaxNode? TryGetRelevantNode<TSyntaxNode>(this ParsedDocument document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 68public static TSyntaxNode? TryGetRelevantNode<TSyntaxNode>(this ParsedDocument document, TextSpan span, bool allowEmptyNode, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 76this Document document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 82this Document document, TextSpan span, bool allowEmptyNodes, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 89this ParsedDocument document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 93this ParsedDocument document, TextSpan span, bool allowEmptyNodes, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 102this ParsedDocument document, TextSpan span, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (1)
38public static bool IsNodeUnderselected(SyntaxNode? node, TextSpan selection)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\IRefactoringHelpersService.cs (1)
20this IRefactoringHelpersService service, ParsedDocument document, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
32IEnumerable<TextSpan> spans,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
142public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (2)
393using var parts = TemporaryArray<TextSpan>.Empty; 397var p = parts[i];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\FormatterShared.cs (2)
33public SyntaxNode Format(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 36public IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (1)
17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
39return document.Text.ToString(TextSpan.FromBounds(tokenLine.Start, token.SpanStart));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (2)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxFactsService\ISyntaxFactsService.cs (1)
18Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameActionAnnotation.cs (2)
15TextSpan originalSpan, 28public readonly TextSpan OriginalSpan = originalSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameDeclarationLocationReference.cs (2)
19public readonly TextSpan TextSpan; 36public RenameDeclarationLocationReference(DocumentId documentId, TextSpan textSpan, bool overriddenFromMetadata, int declaringSyntaxReferencesCount)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameNodeSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameTokenSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (2)
56ImmutableArray<TextSpan> spans, 88ImmutableArray<TextSpan> spans,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\ISimplificationService.cs (1)
32ImmutableArray<TextSpan> spans,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractSimplifier.cs (1)
21out TextSpan issueSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
56TextSpan span,
Microsoft.CodeAnalysis.AnalyzerUtilities (363)
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (3)
29var fullSpan = new TextSpan(0, text.Length); 36var change = TextChangeRange.Collapse(changes).Span; 49var span = node.FullSpan;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (3)
105var thisSpan = introspector.GetSpan(value); 125var thisSpan = introspector.GetSpan(value); 138var thisSpan = introspector.GetSpan(value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (40)
14internal sealed class NormalizedTextSpanCollection : ReadOnlyCollection<TextSpan> 29public NormalizedTextSpanCollection(TextSpan span) 42public NormalizedTextSpanCollection(IEnumerable<TextSpan> spans) 93var span1 = left[index1]; 94var span2 = right[index2]; 122spans.Add(TextSpan.FromBounds(start, end)); 161var span1 = left[index1]; 162var span2 = right[index2]; 221var span1 = left[index1]; 222var span2 = right[index2]; 283var span1 = left[index1]; 284var span2 = right[index2]; 296spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 307spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span2.Start)); 333var span1 = left[index1++]; 334spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 398var span1 = this[index1]; 399var span2 = set[index2]; 429public bool OverlapsWith(TextSpan span) 458var span1 = this[index1]; 459var span2 = set[index2]; 483public bool IntersectsWith(TextSpan span) 506foreach (var s in this) 533foreach (var s in this) 546private static IList<TextSpan> ListFromSpan(TextSpan span) 548IList<TextSpan> list = 564private static void UpdateSpanUnion(TextSpan span, IList<TextSpan> spans, ref int start, ref int end) 568spans.Add(TextSpan.FromBounds(start, end)); 585private static IList<TextSpan> NormalizeSpans(IEnumerable<TextSpan> spans) 592var sorted = new List<TextSpan>(spans); 599sorted.Sort(delegate (TextSpan s1, TextSpan s2) { return s1.Start.CompareTo(s2.Start); }); 601IList<TextSpan> normalized = new List<TextSpan>(sorted.Count); 611normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 621normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 626private sealed class OrderedSpanList : List<TextSpan>
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\TextSpanMutableIntervalTree.cs (9)
10internal readonly struct TextSpanIntervalIntrospector : IIntervalIntrospector<TextSpan> 12public TextSpan GetSpan(TextSpan value) 16internal sealed class TextSpanMutableIntervalTree(IEnumerable<TextSpan>? values) 17: SimpleMutableIntervalTree<TextSpan, TextSpanIntervalIntrospector>(new TextSpanIntervalIntrospector(), values) 23public TextSpanMutableIntervalTree(params TextSpan[]? values) : this((IEnumerable<TextSpan>?)values) 27public bool HasIntervalThatIntersectsWith(TextSpan span) 30public bool HasIntervalThatOverlapsWith(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\NamingStyles\NamingStyleOption.cs (3)
13/// The root naming style option composed of several settings as well as a <see cref="TextSpan"/>s describing where they were all defined. 29/// A description of the kinds of symbols a rule should apply to as well as a <see cref="TextSpan"/>s describing where they were all defined. 42/// The rules about how the specified symbols must be named as well as a <see cref="TextSpan"/>s describing where they were all defined.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\Section.cs (2)
16public TextSpan Span { get; init; } 24public Section(string? filePath, bool isGlobal, TextSpan span, string text, string fullText)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxHelpers.cs (4)
12public static TextSpan GetSpan<TSyntaxKind>(EmbeddedSyntaxToken<TSyntaxKind> token1, EmbeddedSyntaxToken<TSyntaxKind> token2) where TSyntaxKind : struct 15public static TextSpan GetSpan(VirtualCharSequence virtualChars) 18public static TextSpan GetSpan(VirtualChar firstChar, VirtualChar lastChar) 19=> TextSpan.FromBounds(firstChar.Span.Start, lastChar.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (6)
42private TextSpan? _fullSpan; 56public TextSpan GetSpan() 63return TextSpan.FromBounds(start, end); 66public TextSpan? GetFullSpan() 69private TextSpan? ComputeFullSpan() 76return TextSpan.FromBounds(start.Value, end.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (2)
68/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 96public TextSpan Span => new(TokenStart + Green.Offset, Green.Width);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharGreenSequence.Chunks.cs (1)
50var span = new VirtualChar(ch, tokenStart).Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
50private readonly TextSpan _span; 57private VirtualCharGreenSequence(Chunk sequence, TextSpan span) 114TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharUtilities.cs (4)
15public static TextSpan FromBounds(VirtualChar vc1, VirtualChar vc2) 16=> TextSpan.FromBounds(vc1.Span.Start, vc2.Span.End); 26public static (ImmutableSegmentedList<VirtualChar> sourceCode, ImmutableArray<TextSpan> markdownSpans) StripMarkupCharacters( 29using var _ = ArrayBuilder<TextSpan>.GetInstance(out var markdownSpans);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (13)
13private static bool ShouldAnalyze(TextSpan? contextFilterSpan, TextSpan span) 23public static bool ShouldAnalyzeSpan(this SyntaxTreeAnalysisContext context, TextSpan span) 33public static bool ShouldAnalyzeSpan(this SemanticModelAnalysisContext context, TextSpan span) 43public static bool ShouldAnalyzeSpan(this SymbolStartAnalysisContext context, TextSpan span, SyntaxTree tree) 63public static bool ShouldAnalyzeSpan(this SymbolAnalysisContext context, TextSpan span, SyntaxTree tree) 83public static bool ShouldAnalyzeSpan(this AdditionalFileAnalysisContext context, TextSpan span) 93public static bool ShouldAnalyzeSpan(this OperationBlockStartAnalysisContext context, TextSpan span) 103public static bool ShouldAnalyzeSpan(this OperationBlockAnalysisContext context, TextSpan span) 113public static bool ShouldAnalyzeSpan(this OperationAnalysisContext context, TextSpan span) 123public static bool ShouldAnalyzeSpan(this SyntaxNodeAnalysisContext context, TextSpan span) 133public static bool ShouldAnalyzeSpan<TSytnaxKind>(this CodeBlockStartAnalysisContext<TSytnaxKind> context, TextSpan span) where TSytnaxKind : struct 143public static bool ShouldAnalyzeSpan(this CodeBlockAnalysisContext context, TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (2)
32this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden, CancellationToken cancellationToken) 44this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (12)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate) 296public static TextSpan GetContainedSpan(this IEnumerable<SyntaxNode> nodes) 301var fullSpan = nodes.First().Span; 304fullSpan = TextSpan.FromBounds( 315public static bool OverlapsHiddenPosition(this SyntaxNode node, TextSpan span, CancellationToken cancellationToken) 323var textSpan = TextSpan.FromBounds(start, end); 409var spans = new List<TextSpan>(nodesToReplace.Count + tokensToReplace.Count + triviaToReplace.Count); 432TextSpan previous = default; 433foreach (var span in spans) 785public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 963var fullSpan = node.FullSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (3)
18public static bool OverlapsHiddenPosition([NotNullWhen(returnValue: true)] this SyntaxTree? tree, TextSpan span, CancellationToken cancellationToken) 98public static bool IsEntirelyHidden(this SyntaxTree tree, TextSpan span, CancellationToken cancellationToken) 252public static SyntaxNode FindNode(this SyntaxTree syntaxTree, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (22)
18public static IEnumerable<TextSpan> ToNormalizedSpans(this IEnumerable<TextSpan> spans) 21public static ImmutableArray<TextSpan> ToNormalizedSpans(this ImmutableArray<TextSpan> spans) 24public static TextSpan Collapse(this IEnumerable<TextSpan> spans) 29foreach (var span in spans) 48return TextSpan.FromBounds(start, end); 54public static bool IsAround(this TextSpan span, SyntaxNodeOrToken node) => IsAround(span, node, node); 60public static bool IsAround(this TextSpan span, SyntaxNodeOrToken startNode, SyntaxNodeOrToken endNode) 62var innerSpan = TextSpan.FromBounds(startNode.Span.Start, endNode.Span.End); 63var outerSpan = TextSpan.FromBounds(startNode.FullSpan.Start, endNode.FullSpan.End); 67public static IEnumerable<TextSpan> Subtract(this TextSpan span, TextSpan except) 81yield return TextSpan.FromBounds(span.Start, startSegmentEnd); 85yield return TextSpan.FromBounds(endSegmentStart, span.End); 88public static IEnumerable<TextSpan> Subtract(this IEnumerable<TextSpan> spans, TextSpan except)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\AbstractSyntaxFormatting.cs (3)
21private static readonly Func<TextSpan, bool> s_notEmpty = s => !s.IsEmpty; 32public IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 34IReadOnlyList<TextSpan> spansToFormat;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.AnchorData.cs (4)
18public TextSpan TextSpan => operation.TextSpan; 34TextSpan IIntervalIntrospector<AnchorData>.GetSpan(AnchorData value) 37TextSpan IIntervalIntrospector<IndentationData>.GetSpan(IndentationData value) 40TextSpan IIntervalIntrospector<RelativeIndentationData>.GetSpan(RelativeIndentationData value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (18)
45private readonly HashSet<TextSpan> _indentationMap = []; 46private readonly HashSet<TextSpan> _suppressWrappingMap = []; 47private readonly HashSet<TextSpan> _suppressSpacingMap = []; 48private readonly HashSet<TextSpan> _suppressFormattingMap = []; 49private readonly HashSet<TextSpan> _anchorMap = []; 140var baseSpan = _initialIndentBlockOperations[0].TextSpan; 159var operationSpan = operations[i].TextSpan; 180var intervalTreeSpan = operation.TextSpan; 409private static void DebugCheckEmpty<T, TIntrospector>(ContextMutableIntervalTree<T, TIntrospector> tree, TextSpan textSpan) 448var span = token.Span; 469var span = token.Span; 592public bool IsWrappingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 614public bool IsSpacingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 643var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End); 650public bool IsFormattingDisabled(TextSpan textSpan) 658var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.IndentationData.cs (14)
17private abstract class IndentationData(TextSpan textSpan) 19public TextSpan TextSpan { get; } = textSpan; 22public IndentationData WithTextSpan(TextSpan span) 25protected abstract IndentationData WithTextSpanCore(TextSpan span); 28private sealed class SimpleIndentationData(TextSpan textSpan, int indentation) : IndentationData(textSpan) 32protected override IndentationData WithTextSpanCore(TextSpan span) 56public RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter) 67this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 70private RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter, int lazyIndentationDelta) 81this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 84public TextSpan InseparableRegionSpan { get; } 106protected override IndentationData WithTextSpanCore(TextSpan span) 118public AdjustedIndentationData(TextSpan textSpan, IndentationData baseIndentationData, int adjustment) 141protected override IndentationData WithTextSpanCore(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ContextMutableIntervalTree.cs (4)
40var thisSpan = introspector.GetSpan(value); 52var thisSpan = introspector.GetSpan(value); 125var resultSpan = Introspector.GetSpan(result!); 126var currentNodeSpan = Introspector.GetSpan(currentNode.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (5)
44protected readonly TextSpan SpanToFormat; 336private TextSpan GetSpanToFormat() 341return TextSpan.FromBounds(startPosition, endPosition); 458var spanBetweenTokens = TextSpan.FromBounds(token1.Span.End, token2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (4)
26public readonly TextSpan FormattedSpan; 31TextSpan formattedSpan) 78var span = TextSpan.FromBounds(token1.RawKind == 0 ? this.TreeInfo.StartPosition : token1.Span.End, token2.RawKind == 0 ? this.TreeInfo.EndPosition : token2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.NodeAndText.cs (3)
37return _text.ToString(TextSpan.FromBounds(token2.FullSpan.Start, token2.SpanStart)); 43return _text.ToString(TextSpan.FromBounds(token1.Span.End, token1.FullSpan.End)); 46return _text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (13)
239var span = textChange.Span; 267internal static IEnumerable<TextSpan> GetAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 277static IEnumerable<TextSpan> EnumerateAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 295internal static TextSpan GetSpanIncludingPreviousAndNextTokens(SyntaxToken firstToken, SyntaxToken lastToken) 307return TextSpan.FromBounds(start, end); 310internal static TextSpan GetElasticSpan(SyntaxToken token) 313private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 315var aggregateSpans = new List<TextSpan>(); 317var last = default(TextSpan); 318foreach (var span in spans) 326last = TextSpan.FromBounds(last.Start, span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (10)
20private readonly TextSpan _span; 22public BaseIndentationFormattingRule(SyntaxNode root, TextSpan span, int baseIndentation, AbstractFormattingRule? vbHelperFormattingRule = null) 130private TextSpan AdjustTextSpan(TextSpan textSpan) 131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End)); 133private static void SetInnermostNodeForSpan(SyntaxNode root, ref TextSpan span, out SyntaxToken token1, out SyntaxToken token2, out SyntaxNode? commonNode) 149private static void GetTokens(SyntaxNode root, TextSpan span, out SyntaxToken token1, out SyntaxToken token2) 168private static TextSpan GetSpanFromTokens(TextSpan span, SyntaxToken token1, SyntaxToken token2) 217return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\FormattingOperations.cs (8)
30=> CreateAnchorIndentationOperation(anchorToken, endToken, TextSpan.FromBounds(anchorToken.Span.End, endToken.Span.End)); 35public static AnchorIndentationOperation CreateAnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 42=> CreateSuppressOperation(startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End), option); 47private static SuppressOperation CreateSuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option) 55var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 62public static IndentBlockOperation CreateIndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 70var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 78public static IndentBlockOperation CreateRelativeIndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\IndentBlockOperation.cs (3)
14internal IndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 33internal IndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 56public TextSpan TextSpan { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\SuppressOperation.cs (2)
14public readonly TextSpan TextSpan; 19internal SuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (13)
45private delegate void WhitespaceAppender<T>(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<T> changes); 387var span = GetTextSpan(trivia1, trivia2); 499var span = TextSpan.FromBounds(start, end); 715var insertionPoint = GetInsertionSpan(changes); 730private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 765TextSpan notUsed, 822private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 825private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes) 831private TextSpan GetTextSpan(SyntaxTrivia trivia1, SyntaxTrivia trivia2) 835return TextSpan.FromBounds(this.StartPosition, trivia2.FullSpan.Start); 840return TextSpan.FromBounds(trivia1.FullSpan.End, this.EndPosition); 843return TextSpan.FromBounds(trivia1.FullSpan.End, trivia2.FullSpan.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\AbstractUnnecessaryImportsProvider.cs (3)
23public ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken) 27SemanticModel model, TextSpan? span, Func<SyntaxNode, bool>? predicate, CancellationToken cancellationToken) 35bool HasImportThatIntersectsWithSpan(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (3)
237private TextSpan GetNormalizedSpan(int position) 241return TextSpan.FromBounds(LineToBeIndented.Start, position); 244return TextSpan.FromBounds(position, LineToBeIndented.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (3)
29using var parts = TemporaryArray<TextSpan>.Empty; 73private static ImmutableArray<string> CreateWords(in TemporaryArray<TextSpan> parts, string name) 76foreach (var part in parts)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (21)
160var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 174private WordSpanEnumerable GetWordSpans(string name, TextSpan nameSpan) 177private static string Substring(string name, TextSpan wordSpan) 180private static readonly Func<string, TextSpan, bool> s_firstCharIsLowerCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsLower(val[span.Start]); 181private static readonly Func<string, TextSpan, bool> s_firstCharIsUpperCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsUpper(val[span.Start]); 183private static readonly Func<string, TextSpan, bool> s_wordIsAllUpperCase = (val, span) => 196private static readonly Func<string, TextSpan, bool> s_wordIsAllLowerCase = (val, span) => 210string name, TextSpan nameSpan, Func<string, TextSpan, bool> wordCheck, 216foreach (var wordSpan in GetWordSpans(name, nameSpan)) 232private bool CheckPascalCase(string name, TextSpan nameSpan, out string reason) 237private bool CheckAllUpper(string name, TextSpan nameSpan, out string reason) 242private bool CheckAllLower(string name, TextSpan nameSpan, out string reason) 248string name, TextSpan nameSpan, 249Func<string, TextSpan, bool> firstWordCheck, 250Func<string, TextSpan, bool> restWordCheck, 260foreach (var wordSpan in GetWordSpans(name, nameSpan)) 291private bool CheckCamelCase(string name, TextSpan nameSpan, out string reason) 298private bool CheckFirstUpper(string name, TextSpan nameSpan, out string reason) 406using var parts = TemporaryArray<TextSpan>.Empty;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (4)
16private readonly TextSpan _nameSpan; 19public WordSpanEnumerator(string name, TextSpan nameSpan, string wordSeparator) 28public TextSpan Current { get; private set; } 70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\RefactoringHelpers\AbstractRefactoringHelpers.cs (10)
39/// Returns unchanged <paramref name="span"/> in case <see cref="TextSpan.IsEmpty"/>. 40/// Returns empty Span with original <see cref="TextSpan.Start"/> in case it contains only whitespace. 42private static TextSpan GetTrimmedTextSpan(SourceText sourceText, TextSpan span) 56return TextSpan.FromBounds(start, end); 60SourceText sourceText, SyntaxNode root, TextSpan selectionRaw, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 69var selectionTrimmed = GetTrimmedTextSpan(sourceText, selectionRaw); 354var rightNodeSpanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, rightNode); 366TextSpan selectionTrimmed, 384var spanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, nonHiddenExtractedNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\RefactoringHelpers\IRefactoringHelpers.cs (1)
55SourceText sourceText, SyntaxNode root, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (4)
34SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 38SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 42SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, 77SyntaxNode root, SourceText text, TextSpan textSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
429TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 432/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 433/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 435/// an empty <see cref="TextSpan"/> at position 0. 438TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 479bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(firstNode.Span.Start, lastNode.Span.End); 182this ISyntaxFacts syntaxFacts, TextSpan span, SyntaxNode node, CancellationToken cancellationToken) 441public static TextSpan GetSpanWithoutAttributes(this ISyntaxFacts syntaxFacts, SyntaxNode root, SyntaxNode node) 461return TextSpan.FromBounds(startOfNodeWithoutAttributes, endOfNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (6)
36private readonly TextSpan[] _wordSpans; 101_wordSpans = new TextSpan[distinctValues.Length]; 177private void Add(TextSpan characterSpan, int insertionIndex) 218TextSpan characterSpan, int insertionIndex, int currentNodeEdgeCount, int currentNodeIndex, int editDistance) 286private struct BuilderNode(TextSpan characterSpan) 288public readonly TextSpan CharacterSpan = characterSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (2)
11private readonly struct Node(TextSpan wordSpan, int edgeCount, int firstEdgeIndex) 17public readonly TextSpan WordSpan = wordSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (10)
45public static IEnumerable<(SyntaxToken, SyntaxToken)> ConvertToTokenPairs(this SyntaxNode root, IReadOnlyList<TextSpan> spans) 81public static ValueTuple<SyntaxToken, SyntaxToken> ConvertToTokenPair(this SyntaxNode root, TextSpan textSpan) 157=> (token1.RawKind == 0) ? text.ToString(TextSpan.FromBounds(0, token2.SpanStart)) : text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart)); 259public static TextSpan GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(SyntaxToken startToken, SyntaxToken endToken) 266return TextSpan.FromBounds(startPosition, endPosition); 324var fullSpan = node.FullSpan; 357public static TextSpan GetFormattingSpan(SyntaxNode root, TextSpan span) 367return TextSpan.FromBounds(startPosition, endPosition);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
17public static void AddWordParts(ReadOnlySpan<char> identifier, ref TemporaryArray<TextSpan> parts) 20public static void AddCharacterParts(ReadOnlySpan<char> identifier, ref TemporaryArray<TextSpan> parts) 23public static void AddParts(ReadOnlySpan<char> text, bool word, ref TemporaryArray<TextSpan> parts) 27var span = StringBreaker.GenerateSpan(text, start, word); 41public static TextSpan GenerateSpan(ReadOnlySpan<char> identifier, int wordStart, bool word) 81private static TextSpan ScanCharacterRun(ReadOnlySpan<char> identifier, int length, int wordStart) 102private static TextSpan ScanWordRun(ReadOnlySpan<char> identifier, int length, int wordStart) 151private static TextSpan ScanLowerCaseRun(ReadOnlySpan<char> identifier, int length, int wordStart) 162private static TextSpan ScanNumber(ReadOnlySpan<char> identifier, int length, int wordStart) 170return TextSpan.FromBounds(wordStart, current);
Microsoft.CodeAnalysis.CodeStyle (397)
src\roslyn\src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (1)
51var span = context.FilterSpan.HasValue ? context.FilterSpan.GetValueOrDefault() : root.FullSpan;
src\roslyn\src\Analyzers\Core\Analyzers\OrderModifiers\AbstractOrderModifiersDiagnosticAnalyzer.cs (1)
82context.Tree.GetLocation(TextSpan.FromBounds(modifiers.First().SpanStart, modifiers.Last().Span.End)),
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessaryCast\AbstractRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
30protected abstract TextSpan GetFadeSpan(TCastExpression node);
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (10)
146private IEnumerable<TextSpan> GetContiguousSpans(ImmutableArray<SyntaxNode> nodes) 149(SyntaxNode node, TextSpan textSpan)? previous = null; 154TextSpan textSpan; 158textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 166textSpan = TextSpan.FromBounds(previous.Value.textSpan.Start, nodeEnd); 172textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 199IEnumerable<TextSpan> contiguousSpans, SyntaxTree tree, 202foreach (var span in contiguousSpans) 213protected abstract IEnumerable<TextSpan> GetFixableDiagnosticSpans( 221foreach (var span in spans)
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
139return Location.Create(parenthesizedExpression.SyntaxTree, TextSpan.FromBounds(parenthesizedExpressionLocation.SourceSpan.Start, textSpanEndPosition));
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (3)
86TextSpan? span, 227TextSpan? span, 735TextSpan? span,
src\roslyn\src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (5)
80using var _ = ArrayBuilder<TextSpan>.GetInstance(out var unnecessarySpans); 127ArrayBuilder<TextSpan> unnecessarySpans) 256private static TextSpan GetSpanWithinLiteralQuotes(IVirtualCharService virtualCharService, SyntaxToken formatToken) 261: TextSpan.FromBounds(sequence[0].Span.Start, sequence[^1].Span.End); 269ArrayBuilder<TextSpan> unnecessarySpans)
src\roslyn\src\Analyzers\Core\Analyzers\SimplifyLinqExpression\AbstractSimplifyLinqExpressionDiagnosticAnalyzer.cs (1)
186TextSpan.FromBounds(memberName.SpanStart, nextInvocationNode.Span.End)));
src\roslyn\src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (5)
67out TextSpan issueSpan, out string diagnosticId, out bool inDeclaration, 104out var issueSpan, out var diagnosticId, out var inDeclaration, 121internal static Diagnostic CreateDiagnostic(SemanticModel model, TSimplifierOptions options, AnalyzerOptions analyzerOptions, TextSpan issueSpan, string diagnosticId, bool inDeclaration) 192/// indicate that <c>intervalTree</c> may be updated by adding a new non-overlapping <see cref="TextSpan"/> 235static bool TryProceedWithInterval(bool addIfAvailable, TextSpan span, StrongBox<bool> completed, TextSpanMutableIntervalTree intervalTree)
src\roslyn\src\Analyzers\Core\Analyzers\UseCollectionInitializer\UseCollectionInitializerHelpers.cs (4)
36syntaxTree.GetLocation(TextSpan.FromBounds(match.SpanStart, arguments[0].SpanStart)), 37syntaxTree.GetLocation(TextSpan.FromBounds(arguments.Last().FullSpan.End, match.Span.End))); 48syntaxTree.GetLocation(TextSpan.FromBounds(match.SpanStart, expression.SpanStart)), 49syntaxTree.GetLocation(TextSpan.FromBounds(expression.FullSpan.End, match.Span.End)));
src\roslyn\src\Analyzers\Core\Analyzers\UseObjectInitializer\AbstractUseObjectInitializerDiagnosticAnalyzer.cs (2)
164var location1 = Location.Create(syntaxTree, TextSpan.FromBounds( 170locations.Add(syntaxTree.GetLocation(TextSpan.FromBounds(match.Initializer.FullSpan.End, match.Statement.Span.End)));
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (3)
29var fullSpan = new TextSpan(0, text.Length); 36var change = TextChangeRange.Collapse(changes).Span; 49var span = node.FullSpan;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (3)
105var thisSpan = introspector.GetSpan(value); 125var thisSpan = introspector.GetSpan(value); 138var thisSpan = introspector.GetSpan(value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (40)
14internal sealed class NormalizedTextSpanCollection : ReadOnlyCollection<TextSpan> 29public NormalizedTextSpanCollection(TextSpan span) 42public NormalizedTextSpanCollection(IEnumerable<TextSpan> spans) 93var span1 = left[index1]; 94var span2 = right[index2]; 122spans.Add(TextSpan.FromBounds(start, end)); 161var span1 = left[index1]; 162var span2 = right[index2]; 221var span1 = left[index1]; 222var span2 = right[index2]; 283var span1 = left[index1]; 284var span2 = right[index2]; 296spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 307spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span2.Start)); 333var span1 = left[index1++]; 334spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 398var span1 = this[index1]; 399var span2 = set[index2]; 429public bool OverlapsWith(TextSpan span) 458var span1 = this[index1]; 459var span2 = set[index2]; 483public bool IntersectsWith(TextSpan span) 506foreach (var s in this) 533foreach (var s in this) 546private static IList<TextSpan> ListFromSpan(TextSpan span) 548IList<TextSpan> list = 564private static void UpdateSpanUnion(TextSpan span, IList<TextSpan> spans, ref int start, ref int end) 568spans.Add(TextSpan.FromBounds(start, end)); 585private static IList<TextSpan> NormalizeSpans(IEnumerable<TextSpan> spans) 592var sorted = new List<TextSpan>(spans); 599sorted.Sort(delegate (TextSpan s1, TextSpan s2) { return s1.Start.CompareTo(s2.Start); }); 601IList<TextSpan> normalized = new List<TextSpan>(sorted.Count); 611normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 621normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 626private sealed class OrderedSpanList : List<TextSpan>
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\TextSpanMutableIntervalTree.cs (9)
10internal readonly struct TextSpanIntervalIntrospector : IIntervalIntrospector<TextSpan> 12public TextSpan GetSpan(TextSpan value) 16internal sealed class TextSpanMutableIntervalTree(IEnumerable<TextSpan>? values) 17: SimpleMutableIntervalTree<TextSpan, TextSpanIntervalIntrospector>(new TextSpanIntervalIntrospector(), values) 23public TextSpanMutableIntervalTree(params TextSpan[]? values) : this((IEnumerable<TextSpan>?)values) 27public bool HasIntervalThatIntersectsWith(TextSpan span) 30public bool HasIntervalThatOverlapsWith(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\NamingStyles\NamingStyleOption.cs (3)
13/// The root naming style option composed of several settings as well as a <see cref="TextSpan"/>s describing where they were all defined. 29/// A description of the kinds of symbols a rule should apply to as well as a <see cref="TextSpan"/>s describing where they were all defined. 42/// The rules about how the specified symbols must be named as well as a <see cref="TextSpan"/>s describing where they were all defined.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\Section.cs (2)
16public TextSpan Span { get; init; } 24public Section(string? filePath, bool isGlobal, TextSpan span, string text, string fullText)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxHelpers.cs (4)
12public static TextSpan GetSpan<TSyntaxKind>(EmbeddedSyntaxToken<TSyntaxKind> token1, EmbeddedSyntaxToken<TSyntaxKind> token2) where TSyntaxKind : struct 15public static TextSpan GetSpan(VirtualCharSequence virtualChars) 18public static TextSpan GetSpan(VirtualChar firstChar, VirtualChar lastChar) 19=> TextSpan.FromBounds(firstChar.Span.Start, lastChar.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (6)
42private TextSpan? _fullSpan; 56public TextSpan GetSpan() 63return TextSpan.FromBounds(start, end); 66public TextSpan? GetFullSpan() 69private TextSpan? ComputeFullSpan() 76return TextSpan.FromBounds(start.Value, end.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (2)
68/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 96public TextSpan Span => new(TokenStart + Green.Offset, Green.Width);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharGreenSequence.Chunks.cs (1)
50var span = new VirtualChar(ch, tokenStart).Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
50private readonly TextSpan _span; 57private VirtualCharGreenSequence(Chunk sequence, TextSpan span) 114TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharUtilities.cs (4)
15public static TextSpan FromBounds(VirtualChar vc1, VirtualChar vc2) 16=> TextSpan.FromBounds(vc1.Span.Start, vc2.Span.End); 26public static (ImmutableSegmentedList<VirtualChar> sourceCode, ImmutableArray<TextSpan> markdownSpans) StripMarkupCharacters( 29using var _ = ArrayBuilder<TextSpan>.GetInstance(out var markdownSpans);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (13)
13private static bool ShouldAnalyze(TextSpan? contextFilterSpan, TextSpan span) 23public static bool ShouldAnalyzeSpan(this SyntaxTreeAnalysisContext context, TextSpan span) 33public static bool ShouldAnalyzeSpan(this SemanticModelAnalysisContext context, TextSpan span) 43public static bool ShouldAnalyzeSpan(this SymbolStartAnalysisContext context, TextSpan span, SyntaxTree tree) 63public static bool ShouldAnalyzeSpan(this SymbolAnalysisContext context, TextSpan span, SyntaxTree tree) 83public static bool ShouldAnalyzeSpan(this AdditionalFileAnalysisContext context, TextSpan span) 93public static bool ShouldAnalyzeSpan(this OperationBlockStartAnalysisContext context, TextSpan span) 103public static bool ShouldAnalyzeSpan(this OperationBlockAnalysisContext context, TextSpan span) 113public static bool ShouldAnalyzeSpan(this OperationAnalysisContext context, TextSpan span) 123public static bool ShouldAnalyzeSpan(this SyntaxNodeAnalysisContext context, TextSpan span) 133public static bool ShouldAnalyzeSpan<TSytnaxKind>(this CodeBlockStartAnalysisContext<TSytnaxKind> context, TextSpan span) where TSytnaxKind : struct 143public static bool ShouldAnalyzeSpan(this CodeBlockAnalysisContext context, TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (2)
32this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden, CancellationToken cancellationToken) 44this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (12)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate) 296public static TextSpan GetContainedSpan(this IEnumerable<SyntaxNode> nodes) 301var fullSpan = nodes.First().Span; 304fullSpan = TextSpan.FromBounds( 315public static bool OverlapsHiddenPosition(this SyntaxNode node, TextSpan span, CancellationToken cancellationToken) 323var textSpan = TextSpan.FromBounds(start, end); 409var spans = new List<TextSpan>(nodesToReplace.Count + tokensToReplace.Count + triviaToReplace.Count); 432TextSpan previous = default; 433foreach (var span in spans) 785public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 963var fullSpan = node.FullSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (3)
18public static bool OverlapsHiddenPosition([NotNullWhen(returnValue: true)] this SyntaxTree? tree, TextSpan span, CancellationToken cancellationToken) 98public static bool IsEntirelyHidden(this SyntaxTree tree, TextSpan span, CancellationToken cancellationToken) 252public static SyntaxNode FindNode(this SyntaxTree syntaxTree, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (22)
18public static IEnumerable<TextSpan> ToNormalizedSpans(this IEnumerable<TextSpan> spans) 21public static ImmutableArray<TextSpan> ToNormalizedSpans(this ImmutableArray<TextSpan> spans) 24public static TextSpan Collapse(this IEnumerable<TextSpan> spans) 29foreach (var span in spans) 48return TextSpan.FromBounds(start, end); 54public static bool IsAround(this TextSpan span, SyntaxNodeOrToken node) => IsAround(span, node, node); 60public static bool IsAround(this TextSpan span, SyntaxNodeOrToken startNode, SyntaxNodeOrToken endNode) 62var innerSpan = TextSpan.FromBounds(startNode.Span.Start, endNode.Span.End); 63var outerSpan = TextSpan.FromBounds(startNode.FullSpan.Start, endNode.FullSpan.End); 67public static IEnumerable<TextSpan> Subtract(this TextSpan span, TextSpan except) 81yield return TextSpan.FromBounds(span.Start, startSegmentEnd); 85yield return TextSpan.FromBounds(endSegmentStart, span.End); 88public static IEnumerable<TextSpan> Subtract(this IEnumerable<TextSpan> spans, TextSpan except)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\AbstractSyntaxFormatting.cs (3)
21private static readonly Func<TextSpan, bool> s_notEmpty = s => !s.IsEmpty; 32public IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 34IReadOnlyList<TextSpan> spansToFormat;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.AnchorData.cs (4)
18public TextSpan TextSpan => operation.TextSpan; 34TextSpan IIntervalIntrospector<AnchorData>.GetSpan(AnchorData value) 37TextSpan IIntervalIntrospector<IndentationData>.GetSpan(IndentationData value) 40TextSpan IIntervalIntrospector<RelativeIndentationData>.GetSpan(RelativeIndentationData value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (18)
45private readonly HashSet<TextSpan> _indentationMap = []; 46private readonly HashSet<TextSpan> _suppressWrappingMap = []; 47private readonly HashSet<TextSpan> _suppressSpacingMap = []; 48private readonly HashSet<TextSpan> _suppressFormattingMap = []; 49private readonly HashSet<TextSpan> _anchorMap = []; 140var baseSpan = _initialIndentBlockOperations[0].TextSpan; 159var operationSpan = operations[i].TextSpan; 180var intervalTreeSpan = operation.TextSpan; 409private static void DebugCheckEmpty<T, TIntrospector>(ContextMutableIntervalTree<T, TIntrospector> tree, TextSpan textSpan) 448var span = token.Span; 469var span = token.Span; 592public bool IsWrappingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 614public bool IsSpacingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 643var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End); 650public bool IsFormattingDisabled(TextSpan textSpan) 658var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.IndentationData.cs (14)
17private abstract class IndentationData(TextSpan textSpan) 19public TextSpan TextSpan { get; } = textSpan; 22public IndentationData WithTextSpan(TextSpan span) 25protected abstract IndentationData WithTextSpanCore(TextSpan span); 28private sealed class SimpleIndentationData(TextSpan textSpan, int indentation) : IndentationData(textSpan) 32protected override IndentationData WithTextSpanCore(TextSpan span) 56public RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter) 67this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 70private RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter, int lazyIndentationDelta) 81this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 84public TextSpan InseparableRegionSpan { get; } 106protected override IndentationData WithTextSpanCore(TextSpan span) 118public AdjustedIndentationData(TextSpan textSpan, IndentationData baseIndentationData, int adjustment) 141protected override IndentationData WithTextSpanCore(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ContextMutableIntervalTree.cs (4)
40var thisSpan = introspector.GetSpan(value); 52var thisSpan = introspector.GetSpan(value); 125var resultSpan = Introspector.GetSpan(result!); 126var currentNodeSpan = Introspector.GetSpan(currentNode.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (5)
44protected readonly TextSpan SpanToFormat; 336private TextSpan GetSpanToFormat() 341return TextSpan.FromBounds(startPosition, endPosition); 458var spanBetweenTokens = TextSpan.FromBounds(token1.Span.End, token2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (4)
26public readonly TextSpan FormattedSpan; 31TextSpan formattedSpan) 78var span = TextSpan.FromBounds(token1.RawKind == 0 ? this.TreeInfo.StartPosition : token1.Span.End, token2.RawKind == 0 ? this.TreeInfo.EndPosition : token2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.NodeAndText.cs (3)
37return _text.ToString(TextSpan.FromBounds(token2.FullSpan.Start, token2.SpanStart)); 43return _text.ToString(TextSpan.FromBounds(token1.Span.End, token1.FullSpan.End)); 46return _text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (13)
239var span = textChange.Span; 267internal static IEnumerable<TextSpan> GetAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 277static IEnumerable<TextSpan> EnumerateAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 295internal static TextSpan GetSpanIncludingPreviousAndNextTokens(SyntaxToken firstToken, SyntaxToken lastToken) 307return TextSpan.FromBounds(start, end); 310internal static TextSpan GetElasticSpan(SyntaxToken token) 313private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 315var aggregateSpans = new List<TextSpan>(); 317var last = default(TextSpan); 318foreach (var span in spans) 326last = TextSpan.FromBounds(last.Start, span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (10)
20private readonly TextSpan _span; 22public BaseIndentationFormattingRule(SyntaxNode root, TextSpan span, int baseIndentation, AbstractFormattingRule? vbHelperFormattingRule = null) 130private TextSpan AdjustTextSpan(TextSpan textSpan) 131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End)); 133private static void SetInnermostNodeForSpan(SyntaxNode root, ref TextSpan span, out SyntaxToken token1, out SyntaxToken token2, out SyntaxNode? commonNode) 149private static void GetTokens(SyntaxNode root, TextSpan span, out SyntaxToken token1, out SyntaxToken token2) 168private static TextSpan GetSpanFromTokens(TextSpan span, SyntaxToken token1, SyntaxToken token2) 217return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\FormattingOperations.cs (8)
30=> CreateAnchorIndentationOperation(anchorToken, endToken, TextSpan.FromBounds(anchorToken.Span.End, endToken.Span.End)); 35public static AnchorIndentationOperation CreateAnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 42=> CreateSuppressOperation(startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End), option); 47private static SuppressOperation CreateSuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option) 55var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 62public static IndentBlockOperation CreateIndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 70var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 78public static IndentBlockOperation CreateRelativeIndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\IndentBlockOperation.cs (3)
14internal IndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 33internal IndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 56public TextSpan TextSpan { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\SuppressOperation.cs (2)
14public readonly TextSpan TextSpan; 19internal SuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (13)
45private delegate void WhitespaceAppender<T>(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<T> changes); 387var span = GetTextSpan(trivia1, trivia2); 499var span = TextSpan.FromBounds(start, end); 715var insertionPoint = GetInsertionSpan(changes); 730private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 765TextSpan notUsed, 822private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 825private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes) 831private TextSpan GetTextSpan(SyntaxTrivia trivia1, SyntaxTrivia trivia2) 835return TextSpan.FromBounds(this.StartPosition, trivia2.FullSpan.Start); 840return TextSpan.FromBounds(trivia1.FullSpan.End, this.EndPosition); 843return TextSpan.FromBounds(trivia1.FullSpan.End, trivia2.FullSpan.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\AbstractUnnecessaryImportsProvider.cs (3)
23public ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken) 27SemanticModel model, TextSpan? span, Func<SyntaxNode, bool>? predicate, CancellationToken cancellationToken) 35bool HasImportThatIntersectsWithSpan(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (3)
237private TextSpan GetNormalizedSpan(int position) 241return TextSpan.FromBounds(LineToBeIndented.Start, position); 244return TextSpan.FromBounds(position, LineToBeIndented.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (3)
29using var parts = TemporaryArray<TextSpan>.Empty; 73private static ImmutableArray<string> CreateWords(in TemporaryArray<TextSpan> parts, string name) 76foreach (var part in parts)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (21)
160var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 174private WordSpanEnumerable GetWordSpans(string name, TextSpan nameSpan) 177private static string Substring(string name, TextSpan wordSpan) 180private static readonly Func<string, TextSpan, bool> s_firstCharIsLowerCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsLower(val[span.Start]); 181private static readonly Func<string, TextSpan, bool> s_firstCharIsUpperCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsUpper(val[span.Start]); 183private static readonly Func<string, TextSpan, bool> s_wordIsAllUpperCase = (val, span) => 196private static readonly Func<string, TextSpan, bool> s_wordIsAllLowerCase = (val, span) => 210string name, TextSpan nameSpan, Func<string, TextSpan, bool> wordCheck, 216foreach (var wordSpan in GetWordSpans(name, nameSpan)) 232private bool CheckPascalCase(string name, TextSpan nameSpan, out string reason) 237private bool CheckAllUpper(string name, TextSpan nameSpan, out string reason) 242private bool CheckAllLower(string name, TextSpan nameSpan, out string reason) 248string name, TextSpan nameSpan, 249Func<string, TextSpan, bool> firstWordCheck, 250Func<string, TextSpan, bool> restWordCheck, 260foreach (var wordSpan in GetWordSpans(name, nameSpan)) 291private bool CheckCamelCase(string name, TextSpan nameSpan, out string reason) 298private bool CheckFirstUpper(string name, TextSpan nameSpan, out string reason) 406using var parts = TemporaryArray<TextSpan>.Empty;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (4)
16private readonly TextSpan _nameSpan; 19public WordSpanEnumerator(string name, TextSpan nameSpan, string wordSeparator) 28public TextSpan Current { get; private set; } 70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\RefactoringHelpers\AbstractRefactoringHelpers.cs (10)
39/// Returns unchanged <paramref name="span"/> in case <see cref="TextSpan.IsEmpty"/>. 40/// Returns empty Span with original <see cref="TextSpan.Start"/> in case it contains only whitespace. 42private static TextSpan GetTrimmedTextSpan(SourceText sourceText, TextSpan span) 56return TextSpan.FromBounds(start, end); 60SourceText sourceText, SyntaxNode root, TextSpan selectionRaw, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 69var selectionTrimmed = GetTrimmedTextSpan(sourceText, selectionRaw); 354var rightNodeSpanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, rightNode); 366TextSpan selectionTrimmed, 384var spanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, nonHiddenExtractedNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\RefactoringHelpers\IRefactoringHelpers.cs (1)
55SourceText sourceText, SyntaxNode root, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (4)
34SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 38SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 42SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, 77SyntaxNode root, SourceText text, TextSpan textSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
429TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 432/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 433/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 435/// an empty <see cref="TextSpan"/> at position 0. 438TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 479bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(firstNode.Span.Start, lastNode.Span.End); 182this ISyntaxFacts syntaxFacts, TextSpan span, SyntaxNode node, CancellationToken cancellationToken) 441public static TextSpan GetSpanWithoutAttributes(this ISyntaxFacts syntaxFacts, SyntaxNode root, SyntaxNode node) 461return TextSpan.FromBounds(startOfNodeWithoutAttributes, endOfNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (6)
36private readonly TextSpan[] _wordSpans; 101_wordSpans = new TextSpan[distinctValues.Length]; 177private void Add(TextSpan characterSpan, int insertionIndex) 218TextSpan characterSpan, int insertionIndex, int currentNodeEdgeCount, int currentNodeIndex, int editDistance) 286private struct BuilderNode(TextSpan characterSpan) 288public readonly TextSpan CharacterSpan = characterSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (2)
11private readonly struct Node(TextSpan wordSpan, int edgeCount, int firstEdgeIndex) 17public readonly TextSpan WordSpan = wordSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (10)
45public static IEnumerable<(SyntaxToken, SyntaxToken)> ConvertToTokenPairs(this SyntaxNode root, IReadOnlyList<TextSpan> spans) 81public static ValueTuple<SyntaxToken, SyntaxToken> ConvertToTokenPair(this SyntaxNode root, TextSpan textSpan) 157=> (token1.RawKind == 0) ? text.ToString(TextSpan.FromBounds(0, token2.SpanStart)) : text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart)); 259public static TextSpan GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(SyntaxToken startToken, SyntaxToken endToken) 266return TextSpan.FromBounds(startPosition, endPosition); 324var fullSpan = node.FullSpan; 357public static TextSpan GetFormattingSpan(SyntaxNode root, TextSpan span) 367return TextSpan.FromBounds(startPosition, endPosition);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
17public static void AddWordParts(ReadOnlySpan<char> identifier, ref TemporaryArray<TextSpan> parts) 20public static void AddCharacterParts(ReadOnlySpan<char> identifier, ref TemporaryArray<TextSpan> parts) 23public static void AddParts(ReadOnlySpan<char> text, bool word, ref TemporaryArray<TextSpan> parts) 27var span = StringBreaker.GenerateSpan(text, start, word); 41public static TextSpan GenerateSpan(ReadOnlySpan<char> identifier, int wordStart, bool word) 81private static TextSpan ScanCharacterRun(ReadOnlySpan<char> identifier, int length, int wordStart) 102private static TextSpan ScanWordRun(ReadOnlySpan<char> identifier, int length, int wordStart) 151private static TextSpan ScanLowerCaseRun(ReadOnlySpan<char> identifier, int length, int wordStart) 162private static TextSpan ScanNumber(ReadOnlySpan<char> identifier, int length, int wordStart) 170return TextSpan.FromBounds(wordStart, current);
Microsoft.CodeAnalysis.CodeStyle.Fixes (76)
src\roslyn\src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
55var span = diagnostic.Location.SourceSpan;
src\roslyn\src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (8)
334edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 338edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, bottomEnd), "")); 347edits.Add(new TextChange(TextSpan.FromBounds(startPos, equalsEnd), "")); 351edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), "")); 360edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 366edits.Add(new TextChange(TextSpan.FromBounds(secondMiddlePos, equalsEnd), "")); 372edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, equalsEnd), "")); 377edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), ""));
src\roslyn\src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (1)
38SyntaxNode root, TextSpan span, [NotNullWhen(true)] out SyntaxNode? node)
src\roslyn\src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
48private static TXmlElementSyntax? GetParamNode(SyntaxNode root, TextSpan span)
src\roslyn\src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (3)
74var diagnosticSpan = diagnostic.Location.SourceSpan; 76var spanToFormat = TextSpan.FromBounds(
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.cs (2)
22SemanticDocument document, TextSpan textSpan, CancellationToken cancellationToken, 27TextSpan textSpan,
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (2)
30TextSpan textSpan, 46TextSpan textSpan,
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\IGenerateDefaultConstructorsService.cs (1)
17Document document, TextSpan textSpan, bool forRefactoring, CancellationToken cancellationToken);
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (1)
61TextSpan span, Diagnostic diagnostic)
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (1)
21var span = context.Span;
src\roslyn\src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (1)
35SyntaxNode root, TextSpan span, [NotNullWhen(true)] out SyntaxNode? node)
src\roslyn\src\Analyzers\Core\CodeFixes\MakeFieldReadonly\AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
46var diagnosticSpan = diagnostic.Location.SourceSpan;
src\roslyn\src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
55var span = context.Span;
src\roslyn\src\Analyzers\Core\CodeFixes\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
553ISet<(string filePath, TextSpan span)> constructorSpans,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\MultiProjectSafeFixAllProvider.cs (4)
26protected abstract void FixAll(SyntaxEditor editor, IEnumerable<TextSpan> commonSpans); 79using var _ = PooledHashSet<TextSpan>.GetInstance(out var commonSpans); 110static IEnumerable<TextSpan> GetDiagnosticSpans(ImmutableArray<Diagnostic> diagnostics) 114private SyntaxNode FixAll(SolutionServices services, SyntaxNode root, PooledHashSet<TextSpan> commonSpans)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixesAndRefactorings\AbstractFixAllSpanMappingService.cs (8)
20protected abstract Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansIfWithinGlobalStatementAsync( 21Document document, TextSpan span, CancellationToken cancellationToken); 23public Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 24Document document, TextSpan triggerSpan, FixAllScope fixAllScope, CancellationToken cancellationToken) 32private async Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 33Document document, TextSpan span, bool fixAllInContainingMember, CancellationToken cancellationToken) 50var builder = PooledDictionary<Document, ArrayBuilder<TextSpan>>.GetInstance(); 75TextSpan span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixesAndRefactorings\IFixAllSpanMappingService.cs (2)
30Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 31Document document, TextSpan triggerSpan, FixAllScope fixAllScope, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (3)
50protected static TextSpan GetSpan(SyntaxNode node) 55return TextSpan.FromBounds(start.SpanStart, end.Span.End); 110var span = GetSpan(destination);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (1)
24public void AddRelevantNodes<TSyntaxNode>(SourceText sourceText, SyntaxNode root, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringContextExtensions.cs (9)
21this CodeRefactoringContext context, ImmutableArray<TCodeAction> actions, TextSpan? applicableToSpan = null) 59public static async Task<TSyntaxNode?> TryGetRelevantNodeAsync<TSyntaxNode>(this Document document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 65public static TSyntaxNode? TryGetRelevantNode<TSyntaxNode>(this ParsedDocument document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 68public static TSyntaxNode? TryGetRelevantNode<TSyntaxNode>(this ParsedDocument document, TextSpan span, bool allowEmptyNode, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 76this Document document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 82this Document document, TextSpan span, bool allowEmptyNodes, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 89this ParsedDocument document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 93this ParsedDocument document, TextSpan span, bool allowEmptyNodes, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 102this ParsedDocument document, TextSpan span, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (1)
38public static bool IsNodeUnderselected(SyntaxNode? node, TextSpan selection)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\IRefactoringHelpersService.cs (1)
20this IRefactoringHelpersService service, ParsedDocument document, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
32IEnumerable<TextSpan> spans,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
142public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (2)
393using var parts = TemporaryArray<TextSpan>.Empty; 397var p = parts[i];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\FormatterShared.cs (2)
33public SyntaxNode Format(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 36public IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (1)
17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
39return document.Text.ToString(TextSpan.FromBounds(tokenLine.Start, token.SpanStart));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (2)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxFactsService\ISyntaxFactsService.cs (1)
18Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameActionAnnotation.cs (2)
15TextSpan originalSpan, 28public readonly TextSpan OriginalSpan = originalSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameDeclarationLocationReference.cs (2)
19public readonly TextSpan TextSpan; 36public RenameDeclarationLocationReference(DocumentId documentId, TextSpan textSpan, bool overriddenFromMetadata, int declaringSyntaxReferencesCount)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameNodeSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameTokenSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (2)
56ImmutableArray<TextSpan> spans, 88ImmutableArray<TextSpan> spans,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\ISimplificationService.cs (1)
32ImmutableArray<TextSpan> spans,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractSimplifier.cs (1)
21out TextSpan issueSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
56TextSpan span,
Microsoft.CodeAnalysis.CSharp (199)
Binder\Binder_Expressions.cs (2)
5533var errorSpan = new TextSpan(start, end - start); 9788location = expr.Syntax.SyntaxTree.GetLocation(TextSpan.FromBounds(expr.Syntax.SpanStart, conditional.OperatorToken.Span.End));
Binder\Binder_Statements.cs (2)
3472Text.TextSpan.FromBounds(lambdaSyntax.SpanStart, lambdaSyntax.ArrowToken.Span.End)); 3476Text.TextSpan.FromBounds(anonymousMethodSyntax.SpanStart,
Binder\Binder_Symbols.cs (1)
468diagnostics.Add(info, Location.Create(@delegate.SyntaxTree, TextSpan.FromBounds(@delegate.SpanStart, asterisk.Span.End)));
Binder\BinderFactory.BinderFactoryVisitor.cs (5)
560private Symbol GetMemberSymbol(string memberName, TextSpan memberSpan, NamedTypeSymbol container, SymbolKind kind) 592bool checkSymbol(Symbol sym, TextSpan memberSpan, SymbolKind kind, out Symbol result) 631private static bool InSpan(Location location, SyntaxTree syntaxTree, TextSpan span) 640private static bool InSpan(ImmutableArray<Location> locations, SyntaxTree syntaxTree, TextSpan span) 1070TextSpan containingSpan = containingNode.Span;
BoundTree\BoundSequencePoint.cs (1)
11public static BoundStatement Create(SyntaxNode? syntax, TextSpan? part, BoundStatement statement, bool hasErrors = false)
CodeGen\CodeGenerator.cs (10)
68private PooledDictionary<object, TextSpan> _savedSequencePoints; 419TextSpan span = node.Span; 420if (span != default(TextSpan) && _emitPdbSequencePoints) 432if (instructionsEmitted == 0 && span != default(TextSpan) && _ilEmitStyle == ILEmitStyle.Debug) 451var span = sequencePoints[i].Span; 456_savedSequencePoints ??= PooledDictionary<object, TextSpan>.GetInstance(); 465if (_savedSequencePoints is null || !_savedSequencePoints.TryGetValue(node.Identifier, out var span)) 476private void EmitStepThroughSequencePoint(SyntaxNode syntaxNode, TextSpan span) 517private TextSpan EmitSequencePoint(SyntaxTree syntaxTree, TextSpan span)
CodeGen\EmitStatement.cs (2)
1089TextSpan spSpan; 1098spSpan = TextSpan.FromBounds(syntax.SpanStart, syntax.Declaration.Span.End);
CommandLine\CSharpCompiler.cs (1)
216tree.GetMappedLineSpanAndVisibility(default(TextSpan), out isHiddenDummy);
Compilation\CSharpCompilation.cs (17)
286internal bool IsNullableAnalysisEnabledIn(CSharpSyntaxTree tree, TextSpan span) 300/// from <see cref="IsNullableAnalysisEnabledIn(CSharpSyntaxTree, TextSpan)"/>. 2766TextSpan infoSpan = info.Span; 2893public readonly TextSpan Span; 2895public ImportInfo(SyntaxTree tree, SyntaxKind kind, TextSpan span) 3080var location = syntaxTree.GetLocation(TextSpan.FromBounds(0, 0)); 3181private static bool IsDefinedOrImplementedInSourceTree(Symbol symbol, SyntaxTree tree, TextSpan? span) 3200public TextSpan? Span { get; } 3203public MethodBodyDiagnostics(SyntaxTree tree, TextSpan? span, ImmutableArray<Diagnostic> diagnostics) 3211private ImmutableArray<Diagnostic> GetDiagnosticsForMethodBodiesInTree(SyntaxTree tree, TextSpan? span, CancellationToken cancellationToken) 3308void updateCachedDiagnostics(ImmutableArray<Diagnostic> diagnostics, SyntaxTree tree, TextSpan? span) 3344void compileMethodBodiesAndDocComments(SyntaxTree? filterTree, TextSpan? filterSpan, BindingDiagnosticBag bindingDiagnostics, CancellationToken cancellationToken) 3395private ReadOnlyBindingDiagnostic<AssemblySymbol> GetSourceDeclarationDiagnostics(SyntaxTree? syntaxTree = null, TextSpan? filterSpanWithinTree = null, Func<IEnumerable<Diagnostic>, SyntaxTree, TextSpan?, IEnumerable<Diagnostic>>? locationFilterOpt = null, Predicate<Symbol>? symbolFilter = null, CancellationToken cancellationToken = default) 3444private ReadOnlyBindingDiagnostic<AssemblySymbol> GetClsComplianceDiagnostics(SyntaxTree? syntaxTree, TextSpan? filterSpanWithinTree, CancellationToken cancellationToken) 3467private static IEnumerable<Diagnostic> FilterDiagnosticsByLocation(IEnumerable<Diagnostic> diagnostics, SyntaxTree tree, TextSpan? filterSpanWithinTree) 3481TextSpan? filterSpanWithinTree,
Compilation\CSharpSemanticModel.cs (2)
1330var fullSpan = this.Root.FullSpan; 5309internal override void ComputeDeclarationsInSpan(TextSpan span, bool getSymbol, ArrayBuilder<DeclarationInfo> builder, CancellationToken cancellationToken)
Compilation\MemberSemanticModel.cs (7)
572public sealed override ImmutableArray<Diagnostic> GetSyntaxDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 577public sealed override ImmutableArray<Diagnostic> GetDeclarationDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 582public sealed override ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 587public sealed override ImmutableArray<Diagnostic> GetDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 1873TextSpan resultSpan = default(TextSpan); 1879var span = expr.Syntax.FullSpan;
Compilation\SpeculativeSemanticModelWithMemberModel.cs (4)
235public override ImmutableArray<Diagnostic> GetSyntaxDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 240public override ImmutableArray<Diagnostic> GetDeclarationDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 245public override ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 250public override ImmutableArray<Diagnostic> GetDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SyntaxTreeSemanticModel.cs (11)
106private void VerifySpanForGetDiagnostics(TextSpan? span) 114public override ImmutableArray<Diagnostic> GetSyntaxDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 121public override ImmutableArray<Diagnostic> GetDeclarationDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 128public override ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 135public override ImmutableArray<Diagnostic> GetDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 848var span = node.Span; 1004private MemberSemanticModel GetOrAddModelForParameter(ParameterSyntax paramDecl, TextSpan span) 1045private MemberSemanticModel GetOrAddModelIfContains(CSharpSyntaxNode node, TextSpan span) 1399var declarationSpan = extensionDeclaration.Span; 1748private NamespaceSymbol GetDeclaredNamespace(NamespaceOrTypeSymbol container, TextSpan declarationSpan, NameSyntax name) 1779private Symbol GetDeclaredMember(NamespaceOrTypeSymbol container, TextSpan declarationSpan, bool isKnownToBeANamespace, string name = null)
Compiler\ClsComplianceChecker.cs (3)
28private readonly TextSpan? _filterSpanWithinTree; //if filterTree and filterSpanWithinTree is not null, limit analysis to types residing within this span in the filterTree. 40TextSpan? filterSpanWithinTree, 73public static void CheckCompliance(CSharpCompilation compilation, BindingDiagnosticBag diagnostics, CancellationToken cancellationToken, SyntaxTree filterTree = null, TextSpan? filterSpanWithinTree = null)
Compiler\DocumentationCommentCompiler.cs (3)
37private readonly TextSpan? _filterSpanWithinTree; //if filterTree and filterSpanWithinTree is not null, limit analysis to types residing within this span in the filterTree. 55TextSpan? filterSpanWithinTree, 85public static void WriteDocumentationCommentXml(CSharpCompilation compilation, string? assemblyName, Stream? xmlDocStream, BindingDiagnosticBag diagnostics, CancellationToken cancellationToken, SyntaxTree? filterTree = null, TextSpan? filterSpanWithinTree = null)
Compiler\UnprocessedDocumentationCommentFinder.cs (4)
17private readonly TextSpan? _filterSpanWithinTree; 21private UnprocessedDocumentationCommentFinder(DiagnosticBag diagnostics, TextSpan? filterSpanWithinTree, CancellationToken cancellationToken) 29public static void ReportUnprocessed(SyntaxTree tree, TextSpan? filterSpanWithinTree, DiagnosticBag diagnostics, CancellationToken cancellationToken) 38private bool IsSyntacticallyFilteredOut(TextSpan fullSpan)
Errors\ErrorFacts.cs (1)
587/// <see cref="SemanticModel.GetDiagnostics(Text.TextSpan?, System.Threading.CancellationToken)"/> API.
FlowAnalysis\AbstractFlowPass.cs (2)
293protected readonly TextSpan RegionSpan; 295protected bool RegionContains(TextSpan span)
Generated\BoundNodes.xml.Generated.cs (7)
3228public BoundSequencePointWithSpan(SyntaxNode syntax, BoundStatement? statementOpt, TextSpan span, bool hasErrors = false) 3236public TextSpan Span { get; } 3241public BoundSequencePointWithSpan Update(BoundStatement? statementOpt, TextSpan span) 3329public BoundStepThroughSequencePoint(SyntaxNode syntax, TextSpan span, bool hasErrors) 3335public BoundStepThroughSequencePoint(SyntaxNode syntax, TextSpan span) 3341public TextSpan Span { get; } 3346public BoundStepThroughSequencePoint Update(TextSpan span)
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (5)
493private BoundStatement AddAnalysisPoint(SyntaxNode syntaxForSpan, Text.TextSpan alternateSpan, SyntheticBoundNodeFactory statementFactory) 593private static TextSpan SkipAttributes(SyntaxNode syntax) 623private static TextSpan SkipAttributes(SyntaxNode syntax, SyntaxList<AttributeListSyntax> attributes, SyntaxTokenList modifiers, SyntaxToken keyword, TypeSyntax? type) 627var originalSpan = syntax.Span; 630var startSpan = modifiers.Node != null ? modifiers.Span : (keyword.Node != null ? keyword.Span : type!.Span);
Lowering\Instrumentation\DebugInfoInjector.cs (18)
67TextSpan span; 75span = TextSpan.FromBounds(start, end); 90TextSpan.FromBounds(ctorInit.ThisOrBaseKeyword.SpanStart, ctorInit.ArgumentList.CloseParenToken.Span.End)); 98return new BoundSequencePointWithSpan(typeDecl, rewritten, TextSpan.FromBounds(typeDecl.Identifier.SpanStart, typeDecl.ParameterList.Span.End)); 244var span = TextSpan.FromBounds( 254TextSpan conditionSequencePointSpan = TextSpan.FromBounds( 293var span = forEachSyntax.AwaitKeyword != default 294? TextSpan.FromBounds(forEachSyntax.AwaitKeyword.Span.Start, forEachSyntax.ForEachKeyword.Span.End) 313TextSpan iterationVarDeclSpan; 319iterationVarDeclSpan = TextSpan.FromBounds(forEachSyntax.Type.SpanStart, forEachSyntax.Identifier.Span.End); 364TextSpan.FromBounds( 380var span = TextSpan.FromBounds(labeledSyntax.Identifier.SpanStart, labeledSyntax.ColonToken.Span.End); 399TextSpan.FromBounds(lockSyntax.LockKeyword.SpanStart, lockSyntax.CloseParenToken.Span.End)); 426TextSpan switchSequencePointSpan = TextSpan.FromBounds(
Lowering\Instrumentation\DebugInfoInjector_SequencePoints.cs (12)
22GetBreakpointSpan(declaratorSyntax, out _, out TextSpan? part); 33TextSpan part = TextSpan.FromBounds(start, end); 44TextSpan span = TextSpan.FromBounds(start, end); 48private static TextSpan CreateSpan(ParameterSyntax parameter) 53private static TextSpan CreateSpan(SyntaxTokenList startOpt, SyntaxNodeOrToken startFallbackOpt, SyntaxNodeOrToken endOpt) 81return TextSpan.FromBounds(startPos, endPos); 87internal static void GetBreakpointSpan(VariableDeclaratorSyntax declaratorSyntax, out SyntaxNode node, out TextSpan? part) 125part = TextSpan.FromBounds(declarationSyntax.SpanStart, declaratorSyntax.Span.End); 142internal static void GetFirstLocalOrFieldBreakpointSpan(SyntaxToken? firstToken, VariableDeclaratorSyntax declaratorSyntax, out SyntaxNode node, out TextSpan? part) 167part = TextSpan.FromBounds(start, end);
Lowering\LocalRewriter\LocalRewriter_SwitchExpression.cs (1)
78var spanForSwitchBody = new TextSpan(spanStart, spanEnd - spanStart);
Lowering\SyntheticBoundNodeFactory.cs (1)
1236public BoundStatement SequencePointWithSpan(CSharpSyntaxNode syntax, TextSpan span, BoundStatement statement)
Parser\Blender.cs (2)
155var finalSpan = TextSpan.FromBounds(start, changeRange.Span.End);
Parser\Blender.Reader.cs (2)
284var oldSpan = nodeOrToken.FullSpan; 285var changeSpan = _changes.Peek().Span;
Parser\Lexer.cs (2)
720info.Text = TextWindow.Text.ToString(TextSpan.FromBounds(startingPosition, end)); 1991var text = TextWindow.Text.GetSubText(TextSpan.FromBounds(savePosition, TextWindow.Position));
Parser\LexerCache.cs (2)
191var span = TextSpan.FromBounds(lexemeStartPosition, textWindow.Position);
Parser\SlidingTextWindow.cs (4)
188public readonly bool SpanIsWithinWindow(TextSpan span) 197/// cref="SpanIsWithinWindow(TextSpan)"/>). Otherwise, returns <see langword="false"/>. Used to allow 203public readonly bool TryGetTextIfWithinWindow(TextSpan span, out ReadOnlySpan<char> textSpan) 404var span = new TextSpan(position, length);
src\roslyn\src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
21TextSpan span,
Symbols\Source\GlobalExpressionVariable.cs (3)
35TextSpan locationSpan) 48TextSpan locationSpan, 174TextSpan locationSpan,
Symbols\Source\SourceConstructorSymbolBase.cs (1)
182TextSpan span;
Symbols\Source\SourceFieldSymbol.cs (3)
170private readonly TextSpan _locationSpan; 178protected SourceFieldSymbolWithSyntaxReference(SourceMemberContainerTypeSymbol containingType, string name, SyntaxReference syntax, TextSpan locationSpan) 228public override bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken = default)
Symbols\Source\SourceMemberContainerSymbol.cs (1)
1127public override bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken)
Symbols\Source\SourceMemberFieldSymbol.cs (2)
30TextSpan locationSpan) 676public override bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken = default(CancellationToken))
Symbols\Source\SourceNamespaceSymbol.cs (2)
108public override bool HasLocationContainedWithin(SyntaxTree tree, TextSpan declarationSpan, out bool wasZeroWidthMatch) 460public override bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken = default(CancellationToken))
Symbols\Source\SourceOrdinaryMethodSymbol.cs (1)
475TextSpan? definedWithinSpan,
Symbols\Symbol.cs (4)
438public virtual bool HasLocationContainedWithin(SyntaxTree tree, TextSpan declarationSpan, out bool wasZeroWidthMatch) 450protected static bool IsLocationContainedWithin(Location loc, SyntaxTree tree, TextSpan declarationSpan, out bool wasZeroWidthMatch) 939public virtual bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken = default(CancellationToken)) 960protected static bool IsDefinedInSourceTree(SyntaxReference syntaxRef, SyntaxTree tree, TextSpan? definedWithinSpan)
Symbols\SymbolDistinguisher.cs (1)
167var span = syntaxReferences[0].Span;
Symbols\Synthesized\Records\SynthesizedRecordCopyCtor.cs (1)
72TextSpan.FromBounds(recordDeclaration.Identifier.Span.Start, recordDeclaration.TypeParameterList.Span.End)));
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (2)
270public override bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken) 280var span = definedWithinSpan.GetValueOrDefault();
Syntax\CSharpLineDirectiveMap.cs (1)
228internal override FileLinePositionSpan TranslateSpanAndVisibility(SourceText sourceText, string treeFilePath, TextSpan span, out bool isHiddenPosition)
Syntax\CSharpSyntaxTree.cs (8)
598public override IList<TextSpan> GetChangedSpans(SyntaxTree oldTree) 647public override FileLinePositionSpan GetLineSpan(TextSpan span, CancellationToken cancellationToken = default) 666public override FileLinePositionSpan GetMappedLineSpan(TextSpan span, CancellationToken cancellationToken = default) 682/// Gets a <see cref="FileLinePositionSpan"/> for a <see cref="TextSpan"/>. FileLinePositionSpans are used 685/// <param name="span">The source <see cref="TextSpan" /> to convert.</param> 688internal override FileLinePositionSpan GetMappedLineSpanAndVisibility(TextSpan span, out bool isHiddenPosition) 721internal bool? IsNullableAnalysisEnabled(TextSpan span) => GetNullableContextStateMap().IsNullableAnalysisEnabled(span); 759public override Location GetLocation(TextSpan span)
Syntax\CSharpSyntaxTree.Dummy.cs (1)
89public override FileLinePositionSpan GetLineSpan(TextSpan span, CancellationToken cancellationToken = default(CancellationToken))
Syntax\NullableContextStateMap.cs (1)
103internal bool? IsNullableAnalysisEnabled(TextSpan span)
Syntax\SimpleSyntaxReference.cs (1)
30public override TextSpan Span
Syntax\SyntaxNodeRemover.cs (19)
52private readonly TextSpan _searchSpan; 67private static TextSpan ComputeTotalSpan(SyntaxNode[] nodes) 69var span0 = nodes[0].FullSpan; 75var span = nodes[i].FullSpan; 344var span = TextSpan.FromBounds(token.Span.Start, node.Span.End); 345var fullSpan = TextSpan.FromBounds(token.FullSpan.Start, node.FullSpan.End); 378var span = TextSpan.FromBounds(node.Span.Start, token.Span.End); 379var fullSpan = TextSpan.FromBounds(node.FullSpan.Start, token.FullSpan.End); 404private TextSpan GetRemovedSpan(TextSpan span, TextSpan fullSpan) 406var removedSpan = fullSpan; 410removedSpan = TextSpan.FromBounds(span.Start, removedSpan.End); 415removedSpan = TextSpan.FromBounds(removedSpan.Start, span.End); 421private void AddDirectives(SyntaxNode node, TextSpan span)
Syntax\SyntaxNormalizer.cs (2)
16private readonly TextSpan _consideredSpan; 34private SyntaxNormalizer(TextSpan consideredSpan, int initialDepth, string indentWhitespace, string eolWhitespace, bool useElasticTrivia)
Syntax\SyntaxReplacer.cs (9)
73private readonly HashSet<TextSpan> _spanSet; 75private TextSpan _totalSpan; 95_spanSet = new HashSet<TextSpan>(); 142foreach (var span in _spanSet) 167private bool ShouldVisit(TextSpan span) 177foreach (var s in _spanSet) 339private readonly TextSpan _elementSpan; 346TextSpan elementSpan, 365private bool ShouldVisit(TextSpan span)
Syntax\SyntaxTreeDiagnosticEnumerator.cs (1)
60yield return new CSDiagnostic(sdi, new SourceLocation(syntaxTree, TextSpan.FromBounds(spanStart, spanEnd)));
Microsoft.CodeAnalysis.CSharp.Analyzers (1)
MetaAnalyzers\Fixers\CSharpPreferIsKindFix.cs (1)
22protected override SyntaxNode? TryGetNodeToFix(SyntaxNode root, TextSpan span)
Microsoft.CodeAnalysis.CSharp.CodeStyle (94)
src\roslyn\src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (2)
132var ifStatementSpanWithoutElse = TextSpan.FromBounds(statement.Span.Start, embeddedStatement.Span.End);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
54: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.SemicolonToken.Span.End));
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
57: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.Name.Span.End));
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_ProgramMain.cs (1)
71TextSpan.FromBounds(start, root.Members.OfType<GlobalStatementSyntax>().Last().FullSpan.End));
src\roslyn\src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (2)
183var fadeLocation = Location.Create(tree, TextSpan.FromBounds(firstStatement.SpanStart, previousToken.Span.End)); 204fadeLocation = Location.Create(tree, TextSpan.FromBounds(nextToken.Span.Start, ifStatement.Span.End));
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastDiagnosticAnalyzer.cs (3)
28protected override TextSpan GetFadeSpan(ExpressionSyntax node) 31CastExpressionSyntax cast => TextSpan.FromBounds(cast.OpenParenToken.SpanStart, cast.CloseParenToken.Span.End), 32BinaryExpressionSyntax binary => TextSpan.FromBounds(binary.OperatorToken.SpanStart, node.Span.End),
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryImports\CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (1)
53protected override IEnumerable<TextSpan> GetFixableDiagnosticSpans(
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (4)
229var startReportSpan = TextSpan.FromBounds(anonymousFunction.SpanStart, invokedExpression.SpanStart); 230var endReportSpan = TextSpan.FromBounds(invokedExpression.Span.End, anonymousFunction.Span.End);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (8)
74private static ImmutableArray<TextSpan> AnalyzeCodeBlock(CodeBlockAnalysisContext context, int positionOfFirstReducingNullableDirective) 89foreach (var interval in simplifier.Spans) 209public bool TryProceedWithInterval(TextSpan span) 213public bool TryReportNullableImpactingSpans(TextSpan span, ImmutableArray<TextSpan> nullableImpactingSpans) 217private bool TryProceedOrReportNullableImpactingSpans(TextSpan span, ImmutableArray<TextSpan>? nullableImpactingSpans) 232foreach (var nullableImpactingSpan in spans)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (4)
28private ImmutableArray<TextSpan>.Builder? _spans; 32public ImmutableArray<TextSpan> Spans => _spans?.ToImmutable() ?? []; 34public ImmutableArray<TextSpan>.Builder SpansBuilder 39Interlocked.CompareExchange(ref _spans, ImmutableArray.CreateBuilder<TextSpan>(), null);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\UnnecessaryNullableWarningSuppressionsUtilities.cs (2)
139var span = TextSpan.FromBounds(globalStatements.First().SpanStart, globalStatements.Last().Span.End);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (3)
79SemanticModelAnalysisContext context, SyntaxNode root, TextSpan sourceSpan) 132var span = TextSpan.FromBounds(section[0].FullSpan.Start, section.Last().FullSpan.End);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
218syntaxTree.GetLocation(TextSpan.FromBounds(
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (1)
60syntaxTree.GetLocation(TextSpan.FromBounds(
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (1)
102syntaxTree.GetLocation(TextSpan.FromBounds(
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (2)
70syntaxTree.GetLocation(TextSpan.FromBounds( 110syntaxTree.GetLocation(TextSpan.FromBounds(
src\roslyn\src\Analyzers\CSharp\Analyzers\UseDefaultLiteral\CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (2)
45var fadeSpan = TextSpan.FromBounds(defaultExpression.OpenParenToken.SpanStart, defaultExpression.CloseParenToken.Span.End);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (1)
105TextSpan.FromBounds(declaration.SpanStart, declaration.ArrowToken.Span.End));
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
319TextSpan.FromBounds(arguments.First().SpanStart, arguments.Last().Span.End));
src\roslyn\src\Analyzers\CSharp\Analyzers\UseInferredMemberName\CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (4)
50var fadeSpan = TextSpan.FromBounds(nameColon.Name.SpanStart, nameColon.ColonToken.Span.End); 76var fadeSpan = TextSpan.FromBounds(nameEquals.Name.SpanStart, nameEquals.EqualsToken.Span.End);
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
354var scopeSpan = scope.Span;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (1)
81TextSpan.FromBounds(typeArgumentList.LessThanToken.Span.End, typeArgumentList.GreaterThanToken.Span.Start))]));
src\roslyn\src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (2)
123var span = TextSpan.FromBounds(elements[0].Syntax.SpanStart, elements[^1].Syntax.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (1)
205var lineSpan = currentLine.Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (5)
516public static bool ContainsInterleavedDirective(this SyntaxNode syntaxNode, TextSpan span, CancellationToken cancellationToken) 521TextSpan textSpan, 530TextSpan textSpan, 549TextSpan textSpan, 561var matchSpan = match.Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (1)
247var name = SyntaxFactory.ParseName(syntaxTree.GetText(cancellationToken).ToString(TextSpan.FromBounds(genericIdentifier.SpanStart, lastToken.Span.End)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (7)
201var fullSpan = trivia.FullSpan; 230var span = trivia.FullSpan; 248var span = trivia.FullSpan; 285var span = trivia.FullSpan; 311var span = trivia.FullSpan; 411var span = token.Span; 457var span = token.Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (1)
156var span = trivia.FullSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\FormattingResult.cs (1)
19internal FormattingResult(TreeData treeInfo, TokenStream tokenStream, TextSpan spanToFormat)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (3)
54var span = TextSpan.FromBounds(commonToken1.Span.End, formatSpanEnd); 104public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs (1)
57public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (1)
102public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (4)
98private TextSpan GetTextSpan(ValueTuple<SyntaxToken, SyntaxToken> pair) 102return TextSpan.FromBounds(_node.FullSpan.Start, pair.Item2.SpanStart); 107return TextSpan.FromBounds(pair.Item1.Span.End, _node.FullSpan.End); 110return TextSpan.FromBounds(pair.Item1.Span.End, pair.Item2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (3)
21TextSpan textSpan, 41startToken, endToken, TextSpan.FromBounds(startToken.Span.Start, endToken.Span.End), 77TextSpan textSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (6)
115TextSpan.FromBounds(lastTokenOfLabel.FullSpan.End, nextToken.SpanStart) : TextSpan.FromBounds(lastTokenOfLabel.FullSpan.End, lastTokenOfLabel.FullSpan.End)); 123var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 124span = lastSection ? span : TextSpan.FromBounds(span.Start, endToken.FullSpan.End); 306TextSpan.FromBounds(openParen.Span.End, closeParen.Span.Start)); 370AddIndentBlockOperation(list, firstToken, lastToken, TextSpan.FromBounds(firstToken.FullSpan.Start, lastToken.FullSpan.End));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (2)
327var textSpan = TextSpan.FromBounds(startToken.Span.End, endToken.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (2)
184var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (2)
65_root, [TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)], _options.FormattingOptions, smartTokenformattingRules, cancellationToken); 119_root, [TextSpan.FromBounds(adjustedStartPosition, adjustedEndPosition)], _options.FormattingOptions, smartTokenFormattingRules, cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (5)
934public TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node) 945return TextSpan.FromBounds(method.Body.OpenBraceToken.Span.End, method.Body.CloseBraceToken.SpanStart); 1013public TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) 1042return !branch.IsActive || !branch.BranchTaken ? TextSpan.FromBounds(branch.FullSpan.Start, position) : default; 1289public bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (51)
src\roslyn\src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (1)
48private static (SyntaxNode container, SyntaxNode exprOrStatement) GetContainer(SyntaxNode root, TextSpan span)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
37var diagnosticSpan = diagnostic.Location.SourceSpan;
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (3)
62public static (SourceText text, TextSpan semicolonSpan) ConvertNamespaceDeclaration(ParsedDocument document, NamespaceDeclarationSyntax namespaceDeclaration, SyntaxFormattingOptions options, CancellationToken cancellationToken) 81private static (SyntaxNode root, TextSpan semicolonSpan) ReplaceWithFileScopedNamespace( 108private static (SourceText text, TextSpan semicolonSpan) DedentNamespace(
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
44using var _ = ArrayBuilder<TextSpan>.GetInstance(diagnostics.Length, out var spans);
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\CSharpConvertToRecordCodeFixProvider.cs (1)
32var span = context.Span;
src\roslyn\src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
60var span = diagnostic.Location.SourceSpan;
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (1)
26SemanticDocument semanticDocument, TextSpan textSpan, CancellationToken cancellationToken,
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (1)
42var span = context.Span;
src\roslyn\src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (1)
34var diagnosticSpan = diagnostic.Location.SourceSpan;
src\roslyn\src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
211SyntaxNode root, TextSpan span, [NotNullWhen(true)] out SyntaxNode? node)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
131var referenceSpan = location.Location.SourceSpan;
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
34var span = context.Span;
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeRefStruct\MakeRefStructCodeFixProvider.cs (1)
39var span = context.Span;
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
91edits.Add(new TextChange(TextSpan.FromBounds(start, end), ""));
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
93edits.Add(new TextChange(TextSpan.FromBounds(start, end), ""));
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (1)
38var diagnosticSpan = diagnostic.Location.SourceSpan;
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveNewModifier\RemoveNewModifierCodeFixProvider.cs (1)
36var diagnosticSpan = diagnostic.Location.SourceSpan;
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnneccessaryUnsafeModifier\CSharpRemoveUnnecessaryUnsafeModifierCodeFixProvider.cs (3)
50private static void FixAll(SyntaxEditor editor, IEnumerable<TextSpan> spans) 59foreach (var span in spans.OrderByDescending(d => d.Start)) 91protected override void FixAll(SyntaxEditor editor, IEnumerable<TextSpan> commonSpans)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryNullableWarningSuppressionsCodeFixProvider.cs (4)
47using var _1 = ArrayBuilder<HashSet<TextSpan>>.GetInstance(out var linkedSpansArray); 83IEnumerable<TextSpan> spans, 88foreach (var span in spans.OrderByDescending(d => d.Start)) 126protected override void FixAll(SyntaxEditor editor, IEnumerable<TextSpan> commonSpans)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
65Document document, TextSpan span, SyntaxNode newExpression, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
911var lineBreakSpan = TextSpan.FromBounds(lineToConsider.End, lineToConsider.EndIncludingLineBreak);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExplicitTypeForConst\UseExplicitTypeForConstCodeFixProvider.cs (1)
62Document document, TextSpan span, ITypeSymbol type, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeFixesAndRefactorings\CSharpFixAllSpanMappingService.cs (6)
24protected override async Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansIfWithinGlobalStatementAsync( 25Document document, TextSpan span, CancellationToken cancellationToken) 30return ImmutableDictionary<Document, ImmutableArray<TextSpan>>.Empty; 35var fixAllSpan = root.FullSpan; 43return ImmutableDictionary<Document, ImmutableArray<TextSpan>>.Empty; 48return ImmutableDictionary<Document, ImmutableArray<TextSpan>>.Empty
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (5)
28var span = GetUsingsSpan(root, namespaceDeclaration); 37private static TextSpan GetUsingsSpan(CompilationUnitSyntax root, BaseNamespaceDeclarationSyntax? namespaceDeclaration) 44return TextSpan.FromBounds(start, end); 53return TextSpan.FromBounds(start, end); 61return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
547var existingAccessorSpan = existingAccessor.Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (3)
30indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken)); 36indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken)); 48indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\CSharpSyntaxFormattingService.cs (2)
337public ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken) 339var formattingSpan = CommonFormattingHelpers.GetFormattingSpan(document.Root, textSpan);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.cs (3)
58using var _ = ArrayBuilder<TextSpan>.GetInstance(out var spansToFormat); 63spansToFormat.Add(TextSpan.FromBounds(0, firstMemberA.SpanStart)); 67spansToFormat.Add(TextSpan.FromBounds(baseNamespace.Name.Span.End, firstMemberB.SpanStart));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (1)
116public Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.CSharp.Features (467)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (3)
202var newTextChangeSpan = newRange.Span; 253var spanToFormat = TextSpan.FromBounds(Math.Max(startPoint, 0), endPoint);
BraceMatching\BlockCommentBraceMatcher.cs (5)
28var span = token.Span; 50return new BraceMatchingResult(new TextSpan(trivia.SpanStart, "/*".Length), TextSpan.FromBounds(trivia.Span.End - "*/".Length, trivia.Span.End)); 54var startBrace = new TextSpan(trivia.FullSpan.Start, "/**".Length); 55var endBrace = TextSpan.FromBounds(trivia.FullSpan.End - "*/".Length, trivia.FullSpan.End);
BraceMatching\CSharpDirectiveTriviaBraceMatcher.cs (2)
35internal override TextSpan GetSpanForTagging(DirectiveTriviaSyntax directive) 36=> TextSpan.FromBounds(directive.HashToken.SpanStart, directive.DirectiveNameToken.Span.End);
ChangeSignature\ChangeSignatureFormattingRule.cs (2)
45var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 46span = TextSpan.FromBounds(Math.Max(baseToken.Span.End, span.Start), span.End);
CodeRefactorings\MoveType\CSharpMoveTypeService.cs (1)
29protected override async Task<BaseTypeDeclarationSyntax?> GetRelevantNodeAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken)
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (2)
56TextSpan containerSpan; 344protected override async Task<SyntaxNode?> TryGetApplicableContainerFromSpanAsync(Document document, TextSpan span, CancellationToken cancellationToken)
CodeRefactorings\SyncNamespace\CSharpSyncNamespaceCodeRefactoringProvider.cs (1)
25protected override async Task<SyntaxNode?> TryGetApplicableInvocationNodeAsync(Document document, TextSpan span, CancellationToken cancellationToken)
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (1)
584ImmutableArray<TextSpan> fixAllSpans,
Completion\CompletionProviders\CompletionUtilities.cs (3)
20internal static TextSpan GetCompletionItemSpan(SourceText text, int position) 189public static TextSpan GetTargetSelectionSpanForMethod(BaseMethodDeclarationSyntax methodDeclaration) 207public static TextSpan GetTargetSelectionSpanForInsertedMember(SyntaxNode caretTarget)
Completion\CompletionProviders\CSharpSuggestionModeCompletionProvider.cs (1)
32Document document, int position, TextSpan itemSpan, CompletionTrigger trigger, CancellationToken cancellationToken = default)
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (2)
191var subSpan = TextSpan.FromBounds(start, end);
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.NameGenerator.cs (7)
26using var parts = TemporaryArray<TextSpan>.Empty; 43using var breaks = TemporaryArray<TextSpan>.Empty; 50in TemporaryArray<TextSpan> breaks, string baseName, bool pluralize) 68private static Words GetLongestBackwardSubsequence(int length, in TemporaryArray<TextSpan> breaks, string baseName, bool pluralize) 75private static Words GetLongestForwardSubsequence(int length, in TemporaryArray<TextSpan> breaks, string baseName, bool pluralize) 78private static Words GetWords(int start, int end, in TemporaryArray<TextSpan> breaks, string baseName, bool pluralize) 84var @break = breaks[start];
Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProvider.cs (1)
99protected override TextSpan GetTargetSelectionSpan(SyntaxNode caretTarget)
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider.cs (1)
200new TextChange(TextSpan.FromBounds(replacementStart, tokenOnLeft.Span.End), text),
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Operators.cs (2)
143var replacement = item.DisplayText + text.ToString(TextSpan.FromBounds(expressionStart, dotLikeToken.SpanStart)); 145TextSpan.FromBounds(
Completion\CompletionProviders\OverrideCompletionProvider.cs (1)
206protected override TextSpan GetTargetSelectionSpan(SyntaxNode caretTarget)
Completion\CompletionProviders\PartialMethodCompletionProvider.cs (1)
58protected override TextSpan GetTargetSelectionSpan(SyntaxNode caretTarget)
Completion\CSharpCompletionService.cs (1)
42public override TextSpan GetDefaultCompletionListSpan(SourceText text, int caretPosition)
ConvertNamespace\ConvertNamespaceCodeRefactoringProvider.cs (1)
89ImmutableArray<TextSpan> fixAllSpans,
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs (2)
60var triggerSpan = TextSpan.FromBounds(typeDeclaration.SpanStart, typeDeclaration.ParameterList.FullSpan.End);
ConvertToExtension\ConvertToExtensionFixAllProvider.cs (2)
31Optional<ImmutableArray<TextSpan>> refactorAllSpans) 60SyntaxNode root, Optional<ImmutableArray<TextSpan>> fixAllSpans)
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (17)
314builder.Append(text.ToString(TextSpan.FromBounds(line.End, line.EndIncludingLineBreak))); 334builder.Append(text.ToString(TextSpan.FromBounds(firstNonWhitespacePos, line.EndIncludingLineBreak))); 482private static (ImmutableIntervalTree<TextSpan> interpolationInteriorSpans, ImmutableIntervalTree<TextSpan> restrictedSpans) GetInterpolationSpans( 485var interpolationInteriorSpans = new SegmentedList<TextSpan>(); 486var restrictedSpans = new SegmentedList<TextSpan>(); 493interpolationInteriorSpans.Add(TextSpan.FromBounds(interpolation.OpenBraceToken.Span.End, interpolation.CloseBraceToken.Span.Start)); 503var descendantSpan = descendant.Span; 514restrictedSpans.Add(TextSpan.FromBounds(start, descendantSpan.End)); 522ImmutableIntervalTree<TextSpan>.CreateFromUnsorted(new TextSpanIntervalIntrospector(), interpolationInteriorSpans), 523ImmutableIntervalTree<TextSpan>.CreateFromUnsorted(new TextSpanIntervalIntrospector(), restrictedSpans)); 579builder.Append(text.ToString(TextSpan.FromBounds(line.End, line.EndIncludingLineBreak))); 591var currentLineLeadingWhitespace = line.Text!.ToString(TextSpan.FromBounds(line.Start, pos)); 594builder.Append(text.ToString(TextSpan.FromBounds(line.Start + commonWhitespacePrefix.Length, line.EndIncludingLineBreak))); 612builder.Append(text.ToString(TextSpan.FromBounds(line.Start + commonWhitespacePrefix.Length, line.EndIncludingLineBreak))); 637ImmutableIntervalTree<TextSpan> interpolationInteriorSpans) 666var currentLineLeadingWhitespace = line.Text!.ToString(TextSpan.FromBounds(line.Start, pos));
ConvertToRawString\ConvertStringToRawStringCodeRefactoringProvider.cs (2)
144ImmutableArray<TextSpan> fixAllSpans, 158foreach (var fixSpan in fixAllSpans)
Debugging\CSharpBreakpointResolutionService.cs (2)
31public async Task<BreakpointResolutionResult?> ResolveBreakpointAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) 36if (tree == null || !BreakpointSpans.TryGetBreakpointSpan(tree, textSpan.Start, cancellationToken, out var span))
Debugging\DataTipInfoGetter.cs (2)
66var span = current == expression 68: TextSpan.FromBounds(current.SpanStart, expression.Span.End);
Diagnostics\Analyzers\CSharpSimplifyTypeNamesDiagnosticAnalyzer.cs (1)
83out TextSpan issueSpan, out string diagnosticId, out bool inDeclaration,
Diagnostics\CSharpAnalyzerDriverService.cs (1)
22TextSpan span,
EditAndContinue\BreakpointSpans.cs (35)
19public static bool TryGetBreakpointSpan(SyntaxTree tree, int position, CancellationToken cancellationToken, out TextSpan breakpointSpan) 70public static bool TryGetClosestBreakpointSpan(SyntaxNode root, int position, int minLength, out TextSpan span) 73var candidate = (TextSpan?)null; 110private static TextSpan CreateSpan(SyntaxToken startToken, SyntaxToken endToken) 111=> TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End); 113private static TextSpan CreateSpan(SyntaxNode node) 116private static TextSpan CreateSpan(SyntaxNode node, SyntaxToken token) 117=> TextSpan.FromBounds(node.SpanStart, token.Span.End); 119private static TextSpan CreateSpan(SyntaxToken token) 120=> TextSpan.FromBounds(token.SpanStart, token.Span.End); 122private static TextSpan CreateSpan(SyntaxTokenList startOpt, SyntaxNodeOrToken startFallbackOpt, SyntaxNodeOrToken endOpt) 150return TextSpan.FromBounds(startPos, endPos); 165private static TextSpan? TryCreateSpanForNode(SyntaxNode node, int position) 300TextSpan createSpanForSwitchArm(SwitchExpressionArmSyntax switchArm) 440internal static TextSpan? CreateSpanForConstructorDeclaration(ConstructorDeclarationSyntax constructorSyntax, int position) 472internal static TextSpan CreateSpanForImplicitConstructorInitializer(ConstructorDeclarationSyntax constructor) 478internal static TextSpan CreateSpanForExplicitConstructorInitializer(ConstructorInitializerSyntax constructorInitializer) 484internal static TextSpan CreateSpanForImplicitPrimaryConstructorInitializer(TypeDeclarationSyntax typeDeclaration) 487return TextSpan.FromBounds(typeDeclaration.Identifier.SpanStart, typeDeclaration.ParameterList.Span.End); 506internal static TextSpan CreateSpanForExplicitPrimaryConstructorInitializer(PrimaryConstructorBaseTypeSyntax baseTypeSyntax) 512internal static TextSpan CreateSpanForCopyConstructor(RecordDeclarationSyntax recordDeclaration) 528internal static TextSpan CreateSpanForRecordParameter(ParameterSyntax parameter) 545internal static TextSpan CreateSpanForAutoPropertyAccessor(AccessorDeclarationSyntax accessor) 551private static TextSpan? TryCreateSpanForFieldDeclaration(BaseFieldDeclarationSyntax fieldDeclaration, int position) 554private static TextSpan? TryCreateSpanForSwitchLabel(SwitchLabelSyntax switchLabel, int position) 564private static TextSpan CreateSpanForBlock(BlockSyntax block, int position) 578private static TextSpan? TryCreateSpanForStatement(StatementSyntax statement, int position) 773private static TextSpan? TryCreateSpanForVariableDeclaration(VariableDeclarationSyntax declaration, int position) 782private static TextSpan? TryCreateSpanForVariableDeclaration( 797return default(TextSpan); 804return default(TextSpan); 828return default(TextSpan); 849internal static TextSpan CreateSpanForVariableDeclarator( 937private static TextSpan CreateSpanForCatchClause(CatchClauseSyntax catchClause) 997private static TextSpan? CreateSpanForAccessors(SyntaxList<AccessorDeclarationSyntax> accessors, int position)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (40)
69internal override bool TryFindMemberDeclaration(SyntaxNode? root, SyntaxNode node, TextSpan activeSpan, out OneOrMany<SyntaxNode> declarations) 182TextSpan span, 309private static TextSpan GetActiveSpan(BlockSyntax node, BlockPart part) 323private static TextSpan GetActiveSpan(ForEachStatementSyntax node, ForEachPart part) 327ForEachPart.VariableDeclaration => TextSpan.FromBounds(node.Type.SpanStart, node.Identifier.Span.End), 333private static TextSpan GetActiveSpan(ForEachVariableStatementSyntax node, ForEachPart part) 337ForEachPart.VariableDeclaration => TextSpan.FromBounds(node.Variable.SpanStart, node.Variable.Span.End), 343private static TextSpan GetActiveSpan(SwitchExpressionSyntax node, SwitchExpressionPart part) 347SwitchExpressionPart.SwitchBody => TextSpan.FromBounds(node.SwitchKeyword.SpanStart, node.CloseBraceToken.Span.End), 576protected override bool TryGetEnclosingBreakpointSpan(SyntaxToken token, out TextSpan span) 579protected override bool TryGetActiveSpan(SyntaxNode node, int statementPart, int minLength, out TextSpan span) 1595protected override TextSpan? TryGetDiagnosticSpan(SyntaxNode node, EditKind editKind) 1598internal static new TextSpan GetDiagnosticSpan(SyntaxNode node, EditKind editKind) 1601private static TextSpan? TryGetDiagnosticSpanImpl(SyntaxNode node, EditKind editKind) 1605internal static TextSpan? TryGetDiagnosticSpanImpl(SyntaxKind kind, SyntaxNode node, EditKind editKind) 1635return TextSpan.FromBounds(ns.NamespaceKeyword.SpanStart, ns.Name.Span.End); 1722return TextSpan.FromBounds(constraint.WhereKeyword.SpanStart, constraint.Constraints.Last().Span.End); 1763return TextSpan.FromBounds(usingStatement.UsingKeyword.SpanStart, usingStatement.CloseParenToken.Span.End); 1767return TextSpan.FromBounds(fixedStatement.FixedKeyword.SpanStart, fixedStatement.CloseParenToken.Span.End); 1771return TextSpan.FromBounds(lockStatement.LockKeyword.SpanStart, lockStatement.CloseParenToken.Span.End); 1794return TextSpan.FromBounds(ifStatement.IfKeyword.SpanStart, ifStatement.CloseParenToken.Span.End); 1801return TextSpan.FromBounds(switchStatement.SwitchKeyword.SpanStart, 1809return TextSpan.FromBounds(whileStatement.WhileKeyword.SpanStart, whileStatement.CloseParenToken.Span.End); 1816return TextSpan.FromBounds(forStatement.ForKeyword.SpanStart, forStatement.CloseParenToken.Span.End); 1821return TextSpan.FromBounds( 1934private static TextSpan GetDiagnosticSpan(SyntaxTokenList modifiers, SyntaxNodeOrToken start, SyntaxNodeOrToken end) 1935=> TextSpan.FromBounds((modifiers.Count != 0) ? modifiers.First().SpanStart : start.SpanStart, end.Span.End); 1937private static TextSpan CombineSpans(TextSpan first, TextSpan second, TextSpan defaultSpan) 1938=> (first.Length > 0 && second.Length > 0) ? TextSpan.FromBounds(first.Start, second.End) : (first.Length > 0) ? first : (second.Length > 0) ? second : defaultSpan; 1940internal override TextSpan GetLambdaParameterDiagnosticSpan(SyntaxNode lambda, int ordinal) 2292private readonly TextSpan? _span; 2301TextSpan? span = null) 2319var span = (spanNode != null) ? GetDiagnosticSpan(spanNode, _kind) : GetSpan(); 2326private TextSpan GetSpan() 2641TextSpan newStatementSpan) 2688protected override TextSpan GetExceptionHandlingRegion(SyntaxNode node, out bool coversAllChildren) 2703return TextSpan.FromBounds(
EditAndContinue\DeclarationBody\CopyConstructorDeclarationBody.cs (2)
35public override TextSpan InitializerActiveStatementSpan 44public override TextSpan Envelope
EditAndContinue\DeclarationBody\ExplicitAutoPropertyAccessorDeclarationBody.cs (1)
29public override TextSpan HeaderActiveStatementSpan
EditAndContinue\DeclarationBody\FieldWithInitializerDeclarationBody.cs (2)
38public override TextSpan Envelope 80public override SyntaxNode FindStatementAndPartner(TextSpan span, MemberBody? partnerDeclarationBody, out SyntaxNode? partnerStatement, out int statementPart)
EditAndContinue\DeclarationBody\InstanceConstructorDeclarationBody.cs (2)
17public abstract TextSpan InitializerActiveStatementSpan { get; } 37public sealed override SyntaxNode FindStatementAndPartner(TextSpan span, MemberBody? partnerDeclarationBody, out SyntaxNode? partnerStatement, out int statementPart)
EditAndContinue\DeclarationBody\OrdinaryInstanceConstructorWithExplicitInitializerDeclarationBody.cs (3)
34public override TextSpan InitializerActiveStatementSpan 40public override TextSpan Envelope 41=> TextSpan.FromBounds(InitializerActiveStatementSpan.Start, Body.Span.End);
EditAndContinue\DeclarationBody\OrdinaryInstanceConstructorWithImplicitInitializerDeclarationBody.cs (3)
28public override TextSpan InitializerActiveStatementSpan 34public override TextSpan Envelope 35=> TextSpan.FromBounds(InitializerActiveStatementSpan.Start, Body.Span.End);
EditAndContinue\DeclarationBody\PrimaryConstructorDeclarationBody.cs (1)
31public sealed override TextSpan Envelope
EditAndContinue\DeclarationBody\PrimaryConstructorWithExplicitInitializerDeclarationBody.cs (1)
30public override TextSpan InitializerActiveStatementSpan
EditAndContinue\DeclarationBody\PrimaryConstructorWithImplicitInitializerDeclarationBody.cs (2)
30public override TextSpan InitializerActiveStatementSpan 50public override bool IsExcludedActiveStatementSpanWithinEnvelope(TextSpan span)
EditAndContinue\DeclarationBody\PropertyOrIndexerAccessorDeclarationBody.cs (3)
55public abstract TextSpan HeaderActiveStatementSpan { get; } 65public sealed override TextSpan Envelope 80public sealed override SyntaxNode FindStatementAndPartner(TextSpan span, MemberBody? partnerDeclarationBody, out SyntaxNode? partnerStatement, out int statementPart)
EditAndContinue\DeclarationBody\PropertyOrIndexerAccessorWithExplicitBodyDeclarationBody.cs (1)
36public override TextSpan HeaderActiveStatementSpan
EditAndContinue\DeclarationBody\PropertyOrIndexerWithExplicitBodyDeclarationBody.cs (1)
31public override TextSpan HeaderActiveStatementSpan
EditAndContinue\DeclarationBody\RecordParameterDeclarationBody.cs (1)
23public override TextSpan HeaderActiveStatementSpan
EditAndContinue\DeclarationBody\SimpleMemberBody.cs (1)
16public override SyntaxNode FindStatementAndPartner(TextSpan span, MemberBody? partnerDeclarationBody, out SyntaxNode? partnerStatement, out int statementPart)
EditAndContinue\DeclarationBody\TopLevelCodeDeclarationBody.cs (3)
34public override TextSpan Envelope 35=> TextSpan.FromBounds(unit.Members[0].SpanStart, GlobalStatements.Last().Span.End); 58public override SyntaxNode FindStatementAndPartner(TextSpan span, MemberBody? partnerDeclarationBody, out SyntaxNode? partnerStatement, out int statementPart)
EmbeddedLanguages\CSharpTestEmbeddedLanguageClassifier.cs (3)
57foreach (var span in markdownSpans) 81TextSpan.FromBounds( 91TextSpan.FromBounds(
EncapsulateField\CSharpEncapsulateFieldService.cs (1)
123protected override async Task<ImmutableArray<IFieldSymbol>> GetFieldsAsync(Document document, TextSpan span, CancellationToken cancellationToken)
ExtractInterface\CSharpExtractInterfaceService.cs (1)
34var span = new TextSpan(position, 0);
ExtractMethod\CSharpExtractMethodService.cs (1)
23protected override SelectionValidator CreateSelectionValidator(SemanticDocument document, TextSpan textSpan, bool localFunction)
ExtractMethod\CSharpSelectionResult.cs (2)
26TextSpan finalSpan) 46var finalSpan = selectionInfo.FinalSpan;
ExtractMethod\CSharpSelectionResult.ExpressionResult.cs (1)
27TextSpan finalSpan)
ExtractMethod\CSharpSelectionResult.StatementResult.cs (1)
25TextSpan finalSpan)
ExtractMethod\CSharpSelectionValidator.cs (13)
22TextSpan textSpan, 31var adjustedSpan = GetAdjustedSpan(OriginalSpan); 209private static bool CheckTopLevel(SyntaxNode node, TextSpan span) 245private static bool ContainsInBlockBody(BlockSyntax block, TextSpan textSpan) 252var blockSpan = TextSpan.FromBounds(block.OpenBraceToken.Span.End, block.CloseBraceToken.SpanStart); 256private static bool ContainsInExpressionBodiedMemberBody(ArrowExpressionClauseSyntax expressionBodiedMember, TextSpan textSpan) 263var expressionBodiedMemberBody = TextSpan.FromBounds(expressionBodiedMember.Expression.SpanStart, expressionBodiedMember.Expression.Span.End); 401protected override TextSpan GetAdjustedSpan(TextSpan textSpan) 426return TextSpan.FromBounds(textSpan.Start, previousLine.EndIncludingLineBreak); 429return TextSpan.FromBounds(textSpan.Start, previousLine.End);
ExtractMethod\Extensions.cs (3)
85public static bool ContainsInArgument(this ConstructorInitializerSyntax initializer, TextSpan textSpan) 143public static bool ContainArgumentlessThrowWithoutEnclosingCatch(this IEnumerable<SyntaxToken> tokens, TextSpan textSpan) 167public static bool ContainPreprocessorCrossOver(this IEnumerable<SyntaxToken> tokens, TextSpan textSpan)
Highlighting\KeywordHighlighters\AsyncAwaitHighlighter.cs (6)
36protected override void AddHighlightsForNode(SyntaxNode node, List<TextSpan> highlights, CancellationToken cancellationToken) 70private static bool HighlightRelatedKeywords(SyntaxNode node, List<TextSpan> spans) 84private static bool TryAddAsyncModifier(SyntaxTokenList modifiers, List<TextSpan> spans) 97private static bool TryAddAsyncOrAwaitKeyword(SyntaxToken mod, List<TextSpan> spans) 107var lastSpan = spans[^1]; 110spans[^1] = TextSpan.FromBounds(lastSpan.Start, mod.Span.End);
Highlighting\KeywordHighlighters\CheckedExpressionHighlighter.cs (1)
27protected override void AddHighlights(CheckedExpressionSyntax checkedExpressionSyntax, List<TextSpan> highlights, CancellationToken cancellationToken)
Highlighting\KeywordHighlighters\CheckedStatementHighlighter.cs (1)
27protected override void AddHighlights(CheckedStatementSyntax checkedStatement, List<TextSpan> highlights, CancellationToken cancellationToken)
Highlighting\KeywordHighlighters\ConditionalPreprocessorHighlighter.cs (2)
23DirectiveTriviaSyntax directive, List<TextSpan> highlights, CancellationToken cancellationToken) 28highlights.Add(TextSpan.FromBounds(
Highlighting\KeywordHighlighters\IfStatementHighlighter.cs (3)
32IfStatementSyntax ifStatement, List<TextSpan> highlights, CancellationToken cancellationToken) 41IfStatementSyntax ifStatement, List<TextSpan> highlights) 56highlights.Add(TextSpan.FromBounds(
Highlighting\KeywordHighlighters\LockStatementHighlighter.cs (1)
27protected override void AddHighlights(LockStatementSyntax lockStatement, List<TextSpan> highlights, CancellationToken cancellationToken)
Highlighting\KeywordHighlighters\LoopHighlighter.cs (6)
39SyntaxNode node, List<TextSpan> spans, CancellationToken cancellationToken) 60private static void HighlightDoStatement(DoStatementSyntax statement, List<TextSpan> spans) 67private static void HighlightForStatement(ForStatementSyntax statement, List<TextSpan> spans) 70private static void HighlightForEachStatement(CommonForEachStatementSyntax statement, List<TextSpan> spans) 73private static void HighlightWhileStatement(WhileStatementSyntax statement, List<TextSpan> spans) 79private static void HighlightRelatedKeywords(SyntaxNode node, List<TextSpan> spans,
Highlighting\KeywordHighlighters\RegionHighlighter.cs (3)
29DirectiveTriviaSyntax directive, List<TextSpan> highlights, CancellationToken cancellationToken) 37highlights.Add(TextSpan.FromBounds( 41highlights.Add(TextSpan.FromBounds(
Highlighting\KeywordHighlighters\ReturnStatementHighlighter.cs (2)
31ReturnStatementSyntax returnStatement, List<TextSpan> spans, CancellationToken cancellationToken) 48private static void HighlightRelatedKeywords(SyntaxNode node, List<TextSpan> spans)
Highlighting\KeywordHighlighters\SwitchStatementHighlighter.cs (3)
37SwitchStatementSyntax switchStatement, List<TextSpan> spans, CancellationToken cancellationToken) 57private static void HighlightRelatedKeywords(SyntaxNode node, List<TextSpan> spans, 80spans.Add(TextSpan.FromBounds(start, end));
Highlighting\KeywordHighlighters\TryStatementHighlighter.cs (1)
28TryStatementSyntax tryStatement, List<TextSpan> highlights, CancellationToken cancellationToken)
Highlighting\KeywordHighlighters\UnsafeStatementHighlighter.cs (1)
27protected override void AddHighlights(UnsafeStatementSyntax unsafeStatement, List<TextSpan> highlights, CancellationToken cancellationToken)
Highlighting\KeywordHighlighters\UsingStatementHighlighter.cs (1)
27protected override void AddHighlights(UsingStatementSyntax usingStatement, List<TextSpan> highlights, CancellationToken cancellationToken)
Highlighting\KeywordHighlighters\YieldStatementHighlighter.cs (3)
31YieldStatementSyntax yieldStatement, List<TextSpan> spans, CancellationToken cancellationToken) 48private static void HighlightRelatedKeywords(SyntaxNode node, List<TextSpan> spans) 54TextSpan.FromBounds(
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (2)
146var applicableSpan = explicitName == null 148: TextSpan.FromBounds(explicitName.FullSpan.Start, identifier.FullSpan.End);
InlineHints\CSharpInlineTypeHintsService.cs (5)
75var span = new TextSpan(parameterNode.Identifier.SpanStart, 0); 94var span = new TextSpan(implicitNew.NewKeyword.Span.End, 0); 107var span = new TextSpan(collectionExpression.OpenBracketToken.SpanStart, 0); 130var span = GetSpan(displayAllOverride, forImplicitVariableTypes, displayAllSpan, normalSpan); 138private static TextSpan GetSpan(
IntroduceVariable\CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs (1)
41protected override bool IsValid(ExpressionStatementSyntax expressionStatement, TextSpan span)
LineSeparators\CSharpLineSeparatorService.cs (9)
33public async Task<ImmutableArray<TextSpan>> GetLineSeparatorsAsync( 35TextSpan textSpan, 40using var _ = ArrayBuilder<TextSpan>.GetInstance(out var spans); 243private static void ProcessUsings(SyntaxList<UsingDirectiveSyntax> usings, ArrayBuilder<TextSpan> spans, CancellationToken cancellationToken) 258private static void ProcessNodeList<T>(SyntaxList<T> children, ArrayBuilder<TextSpan> spans, CancellationToken cancellationToken) where T : SyntaxNode 311private static void AddLineSeparatorSpanForNode(SyntaxNode node, ArrayBuilder<TextSpan> spans, CancellationToken cancellationToken) 318var span = GetLineSeparatorSpanForNode(node); 326private static bool IsLegalSpanForLineSeparator(SyntaxTree syntaxTree, TextSpan textSpan, CancellationToken cancellationToken) 345private static TextSpan GetLineSeparatorSpanForNode(SyntaxNode node)
NavigationBar\CSharpNavigationBarItemService.cs (4)
269private static TextSpan GetFieldReferenceSpan(SyntaxReference reference) 288return TextSpan.FromBounds(spanStart, spanEnd); 291private static TextSpan GetEnumMemberSpan(SyntaxReference reference) 307return TextSpan.FromBounds(start, end);
QuickInfo\CSharpDiagnosticAnalyzerQuickInfoProvider.cs (3)
126Document document, string errorCode, TextSpan location, CancellationToken cancellationToken) 142private static QuickInfoItem CreateQuickInfo(TextSpan location, DiagnosticDescriptor descriptor, 143params ReadOnlySpan<TextSpan> relatedSpans)
QuickInfo\CSharpSemanticQuickInfoProvider.cs (1)
365var span = reference.Span;
QuickInfo\CSharpSyntacticQuickInfoProvider.cs (1)
84var spans = ImmutableArray.Create(TextSpan.FromBounds(spanStart, spanEnd));
SignatureHelp\AbstractGenericNameSignatureHelpProvider.cs (2)
29protected abstract TextSpan GetTextSpan(SyntaxToken genericIdentifier, SyntaxToken lessThanToken); 92var textSpan = GetTextSpan(genericIdentifier, lessThanToken);
SignatureHelp\AttributeSignatureHelpProvider.cs (2)
104var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(attribute.ArgumentList!); 115private SignatureHelpState? GetCurrentArgumentState(SyntaxNode root, int position, ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken)
SignatureHelp\ConstructorInitializerSignatureHelpProvider.cs (2)
96var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(constructorInitializer.ArgumentList); 109Document document, int position, TextSpan currentSpan, CancellationToken cancellationToken)
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (7)
104var textSpan = GetTextSpan(expression, openBrace); 112private static TextSpan GetTextSpan(ExpressionSyntax expression, SyntaxToken openBracket) 118return TextSpan.FromBounds(conditional.Span.Start, openBracket.FullSpan.End); 133private static SignatureHelpState? GetCurrentArgumentState(SyntaxNode root, int position, ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken) 292internal static TextSpan GetTextSpan(SyntaxToken openBracket) 334internal static TextSpan GetTextSpan(SyntaxNode expression, SyntaxToken openBracket) 337return TextSpan.FromBounds(expression.SpanStart, openBracket.Parent.Span.End);
SignatureHelp\GenericNameFullyWrittenSignatureHelpProvider.cs (1)
58protected override TextSpan GetTextSpan(SyntaxToken genericIdentifier, SyntaxToken lessThanToken)
SignatureHelp\GenericNamePartiallyWrittenSignatureHelpProvider.cs (2)
24protected override TextSpan GetTextSpan(SyntaxToken genericIdentifier, SyntaxToken lessThanToken) 29return TextSpan.FromBounds(genericIdentifier.SpanStart, nextToken.SpanStart);
SignatureHelp\InitializerExpressionSignatureHelpProvider.cs (2)
68var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(initializerExpression); 77private SignatureHelpState? GetCurrentArgumentState(SyntaxNode root, int position, ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken)
SignatureHelp\InvocationExpressionSignatureHelpProvider.cs (3)
103var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(invocationExpression.ArgumentList); 149var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(invocationExpression.ArgumentList); 158TextSpan currentSpan,
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.cs (3)
95var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(objectCreationExpression.ArgumentList); 119var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(objectCreationExpression.ArgumentList); 126Document document, int position, TextSpan currentSpan, CancellationToken cancellationToken)
SignatureHelp\PrimaryConstructorBaseTypeSignatureHelpProvider.cs (2)
98var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(baseTypeSyntax.ArgumentList); 107private SignatureHelpState? GetCurrentArgumentState(SyntaxNode root, int position, ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken)
SignatureHelp\SignatureHelpUtilities.cs (4)
88internal static TextSpan GetSignatureHelpSpan(BaseArgumentListSyntax argumentList) 91internal static TextSpan GetSignatureHelpSpan(TypeArgumentListSyntax argumentList) 94internal static TextSpan GetSignatureHelpSpan(InitializerExpressionSyntax initializer) 97internal static TextSpan GetSignatureHelpSpan(AttributeArgumentListSyntax argumentList)
SignatureHelp\TupleConstructionSignatureHelpProvider.cs (3)
38private SignatureHelpState? GetCurrentArgumentState(SyntaxNode root, int position, ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken) 65ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken, [NotNullWhen(true)] out TupleExpressionSyntax? result) 84ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken, [NotNullWhen(true)] out ParenthesizedExpressionSyntax? result)
SignatureHelp\WithElementSignatureHelpProvider.cs (2)
93var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(withElement.ArgumentList); 100Document document, int position, TextSpan currentSpan, CancellationToken cancellationToken)
Snippets\AbstractCSharpAutoPropertySnippetProvider.cs (1)
92var node = root.FindNode(TextSpan.FromBounds(position, position));
Snippets\AbstractCSharpTypeSnippetProvider.cs (3)
81return new TextChange(TextSpan.FromBounds(targetPosition, targetPosition), SyntaxFacts.GetText(SyntaxKind.PublicKeyword) + " "); 86var triviaSpan = typeDeclaration.CloseBraceToken.LeadingTrivia.Span; 94var node = root.FindNode(TextSpan.FromBounds(position, position));
Snippets\CSharpConstructorSnippetProvider.cs (1)
75return new TextChange(TextSpan.FromBounds(position, position), constructorDeclaration.NormalizeWhitespace().ToFullString());
Snippets\CSharpElseSnippetProvider.cs (1)
60return Task.FromResult(new TextChange(TextSpan.FromBounds(position, position), elseClause.ToFullString()));
Snippets\CSharpIntMainSnippetProvider.cs (1)
44var triviaSpan = returnStatement.GetLeadingTrivia().Span;
Snippets\CSharpSnippetFunctionService.cs (4)
30protected override async Task<ITypeSymbol?> GetEnumSymbolAsync(Document document, TextSpan switchExpressionSpan, CancellationToken cancellationToken) 47protected override async Task<(Document, TextSpan)> GetDocumentWithEnumCaseAsync( 51TextSpan caseGenerationLocation, 56var typeSpan = new TextSpan(caseGenerationLocation.Start + "case ".Length, fullyQualifiedTypeName.Length);
Snippets\CSharpSnippetHelpers.cs (1)
23var triviaSpan = block.CloseBraceToken.LeadingTrivia.Span;
Snippets\CSharpUnsafeSnippetProvider.cs (1)
27=> Task.FromResult(new TextChange(TextSpan.FromBounds(position, position), SyntaxFactory.UnsafeStatement().ToFullString()));
SolutionCrawler\CSharpDocumentDifferenceService.cs (3)
19protected override bool IsContainedInMemberBody(SyntaxNode node, TextSpan span) 39private static TextSpan GetBlockBodySpan(BlockSyntax body) 40=> TextSpan.FromBounds(body.OpenBraceToken.Span.End, body.CloseBraceToken.SpanStart);
SplitOrMergeIfStatements\CSharpMergeConsecutiveIfStatementsCodeRefactoringProvider.cs (1)
27protected override bool IsApplicableSpan(SyntaxNode node, TextSpan span, out SyntaxNode ifOrElseIf)
SplitOrMergeIfStatements\CSharpMergeNestedIfStatementsCodeRefactoringProvider.cs (1)
27protected override bool IsApplicableSpan(SyntaxNode node, TextSpan span, out SyntaxNode ifOrElseIf)
SplitStringLiteral\InterpolatedStringSplitter.cs (1)
83var content = Document.Text.ToString(TextSpan.FromBounds(start, end));
SplitStringLiteral\SimpleStringSplitter.cs (3)
41var prefix = Document.Text.GetSubText(TextSpan.FromBounds(_token.SpanStart, CursorPosition)).ToString(); 42var suffix = Document.Text.GetSubText(TextSpan.FromBounds(CursorPosition, _token.Span.End)).ToString(); 47? Document.Text.GetSubText(TextSpan.FromBounds(_token.Span.End - "u8".Length, _token.Span.End)).ToString()
src\roslyn\src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (2)
132var ifStatementSpanWithoutElse = TextSpan.FromBounds(statement.Span.Start, embeddedStatement.Span.End);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
54: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.SemicolonToken.Span.End));
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
57: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.Name.Span.End));
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_ProgramMain.cs (1)
71TextSpan.FromBounds(start, root.Members.OfType<GlobalStatementSyntax>().Last().FullSpan.End));
src\roslyn\src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (2)
183var fadeLocation = Location.Create(tree, TextSpan.FromBounds(firstStatement.SpanStart, previousToken.Span.End)); 204fadeLocation = Location.Create(tree, TextSpan.FromBounds(nextToken.Span.Start, ifStatement.Span.End));
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastDiagnosticAnalyzer.cs (3)
28protected override TextSpan GetFadeSpan(ExpressionSyntax node) 31CastExpressionSyntax cast => TextSpan.FromBounds(cast.OpenParenToken.SpanStart, cast.CloseParenToken.Span.End), 32BinaryExpressionSyntax binary => TextSpan.FromBounds(binary.OperatorToken.SpanStart, node.Span.End),
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryImports\CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (1)
53protected override IEnumerable<TextSpan> GetFixableDiagnosticSpans(
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (4)
229var startReportSpan = TextSpan.FromBounds(anonymousFunction.SpanStart, invokedExpression.SpanStart); 230var endReportSpan = TextSpan.FromBounds(invokedExpression.Span.End, anonymousFunction.Span.End);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (8)
74private static ImmutableArray<TextSpan> AnalyzeCodeBlock(CodeBlockAnalysisContext context, int positionOfFirstReducingNullableDirective) 89foreach (var interval in simplifier.Spans) 209public bool TryProceedWithInterval(TextSpan span) 213public bool TryReportNullableImpactingSpans(TextSpan span, ImmutableArray<TextSpan> nullableImpactingSpans) 217private bool TryProceedOrReportNullableImpactingSpans(TextSpan span, ImmutableArray<TextSpan>? nullableImpactingSpans) 232foreach (var nullableImpactingSpan in spans)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (4)
28private ImmutableArray<TextSpan>.Builder? _spans; 32public ImmutableArray<TextSpan> Spans => _spans?.ToImmutable() ?? []; 34public ImmutableArray<TextSpan>.Builder SpansBuilder 39Interlocked.CompareExchange(ref _spans, ImmutableArray.CreateBuilder<TextSpan>(), null);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\UnnecessaryNullableWarningSuppressionsUtilities.cs (2)
139var span = TextSpan.FromBounds(globalStatements.First().SpanStart, globalStatements.Last().Span.End);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (3)
79SemanticModelAnalysisContext context, SyntaxNode root, TextSpan sourceSpan) 132var span = TextSpan.FromBounds(section[0].FullSpan.Start, section.Last().FullSpan.End);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
218syntaxTree.GetLocation(TextSpan.FromBounds(
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (1)
60syntaxTree.GetLocation(TextSpan.FromBounds(
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (1)
102syntaxTree.GetLocation(TextSpan.FromBounds(
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (2)
70syntaxTree.GetLocation(TextSpan.FromBounds( 110syntaxTree.GetLocation(TextSpan.FromBounds(
src\roslyn\src\Analyzers\CSharp\Analyzers\UseDefaultLiteral\CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (2)
45var fadeSpan = TextSpan.FromBounds(defaultExpression.OpenParenToken.SpanStart, defaultExpression.CloseParenToken.Span.End);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (1)
105TextSpan.FromBounds(declaration.SpanStart, declaration.ArrowToken.Span.End));
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
319TextSpan.FromBounds(arguments.First().SpanStart, arguments.Last().Span.End));
src\roslyn\src\Analyzers\CSharp\Analyzers\UseInferredMemberName\CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (4)
50var fadeSpan = TextSpan.FromBounds(nameColon.Name.SpanStart, nameColon.ColonToken.Span.End); 76var fadeSpan = TextSpan.FromBounds(nameEquals.Name.SpanStart, nameEquals.EqualsToken.Span.End);
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
354var scopeSpan = scope.Span;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (1)
81TextSpan.FromBounds(typeArgumentList.LessThanToken.Span.End, typeArgumentList.GreaterThanToken.Span.Start))]));
src\roslyn\src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (2)
123var span = TextSpan.FromBounds(elements[0].Syntax.SpanStart, elements[^1].Syntax.Span.End);
src\roslyn\src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (1)
48private static (SyntaxNode container, SyntaxNode exprOrStatement) GetContainer(SyntaxNode root, TextSpan span)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
37var diagnosticSpan = diagnostic.Location.SourceSpan;
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (3)
62public static (SourceText text, TextSpan semicolonSpan) ConvertNamespaceDeclaration(ParsedDocument document, NamespaceDeclarationSyntax namespaceDeclaration, SyntaxFormattingOptions options, CancellationToken cancellationToken) 81private static (SyntaxNode root, TextSpan semicolonSpan) ReplaceWithFileScopedNamespace( 108private static (SourceText text, TextSpan semicolonSpan) DedentNamespace(
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
44using var _ = ArrayBuilder<TextSpan>.GetInstance(diagnostics.Length, out var spans);
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\CSharpConvertToRecordCodeFixProvider.cs (1)
32var span = context.Span;
src\roslyn\src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
60var span = diagnostic.Location.SourceSpan;
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (1)
26SemanticDocument semanticDocument, TextSpan textSpan, CancellationToken cancellationToken,
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (1)
42var span = context.Span;
src\roslyn\src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (1)
34var diagnosticSpan = diagnostic.Location.SourceSpan;
src\roslyn\src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
211SyntaxNode root, TextSpan span, [NotNullWhen(true)] out SyntaxNode? node)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
131var referenceSpan = location.Location.SourceSpan;
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
34var span = context.Span;
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeRefStruct\MakeRefStructCodeFixProvider.cs (1)
39var span = context.Span;
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
91edits.Add(new TextChange(TextSpan.FromBounds(start, end), ""));
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
93edits.Add(new TextChange(TextSpan.FromBounds(start, end), ""));
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (1)
38var diagnosticSpan = diagnostic.Location.SourceSpan;
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveNewModifier\RemoveNewModifierCodeFixProvider.cs (1)
36var diagnosticSpan = diagnostic.Location.SourceSpan;
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnneccessaryUnsafeModifier\CSharpRemoveUnnecessaryUnsafeModifierCodeFixProvider.cs (3)
50private static void FixAll(SyntaxEditor editor, IEnumerable<TextSpan> spans) 59foreach (var span in spans.OrderByDescending(d => d.Start)) 91protected override void FixAll(SyntaxEditor editor, IEnumerable<TextSpan> commonSpans)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryNullableWarningSuppressionsCodeFixProvider.cs (4)
47using var _1 = ArrayBuilder<HashSet<TextSpan>>.GetInstance(out var linkedSpansArray); 83IEnumerable<TextSpan> spans, 88foreach (var span in spans.OrderByDescending(d => d.Start)) 126protected override void FixAll(SyntaxEditor editor, IEnumerable<TextSpan> commonSpans)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
65Document document, TextSpan span, SyntaxNode newExpression, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
911var lineBreakSpan = TextSpan.FromBounds(lineToConsider.End, lineToConsider.EndIncludingLineBreak);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExplicitTypeForConst\UseExplicitTypeForConstCodeFixProvider.cs (1)
62Document document, TextSpan span, ITypeSymbol type, CancellationToken cancellationToken)
src\roslyn\src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
21TextSpan span,
StringIndentation\CSharpStringIndentationService.cs (8)
29Document document, TextSpan textSpan, CancellationToken cancellationToken) 54var childSpan = child.FullSpan; 87if (!TryGetIndentSpan(text, (ExpressionSyntax)token.GetRequiredParent(), out _, out var indentSpan)) 109if (!TryGetIndentSpan(text, interpolatedString, out var offset, out var indentSpan)) 112using var _ = ArrayBuilder<TextSpan>.GetInstance(out var builder); 126private static bool IsInHole(InterpolatedStringExpressionSyntax interpolatedString, TextSpan sourceSpan) 158private static bool TryGetIndentSpan(SourceText text, ExpressionSyntax expression, out int offset, out TextSpan indentSpan) 179indentSpan = TextSpan.FromBounds(firstLine.Start, lastLine.Start + offset);
Structure\CSharpStructureHelpers.cs (15)
152var span = TextSpan.FromBounds(startComment.SpanStart, endComment.Span.End); 255textSpan: TextSpan.FromBounds(startPosition, endPosition), 256hintSpan: TextSpan.FromBounds(startPosition, hintTextEndToken.Span.End), 300TextSpan textSpan, string bannerText, bool autoCollapse, 308TextSpan textSpan, TextSpan hintSpan, 359var span = TextSpan.FromBounds(GetCollapsibleStart(startToken), spanEndPos); 360var hintSpan = GetHintSpan(node, hintEndPos); 372private static TextSpan GetHintSpan(SyntaxNode node, int endPos) 382return TextSpan.FromBounds(child.SpanStart, endPos); 386return TextSpan.FromBounds(node.SpanStart, endPos); 464textSpan: TextSpan.FromBounds(spanStart, spanEnd), 465hintSpan: TextSpan.FromBounds(hintSpanStart, hintSpanEnd),
Structure\Providers\AnonymousObjectCreationExpressionStructureProvider.cs (1)
38textSpan: TextSpan.FromBounds(node.NewKeyword.Span.End, node.Span.End),
Structure\Providers\ArrowExpressionClauseStructureProvider.cs (2)
29textSpan: TextSpan.FromBounds(previousToken.Span.End, end), 30hintSpan: TextSpan.FromBounds(parent.Span.Start, end),
Structure\Providers\BlockSyntaxStructureProvider.cs (8)
42using var subHeadings = TemporaryArray<(TextSpan textSpan, TextSpan hintSpan, string type)>.Empty; 72using var subHeadings = TemporaryArray<(TextSpan textSpan, TextSpan hintSpan, string type)>.Empty; 154private static TextSpan GetHintSpan(BlockSyntax node) 164return TextSpan.FromBounds(start, end); 167private static TextSpan GetTextSpan(BlockSyntax node) 175return TextSpan.FromBounds(previousToken.Span.End, GetEnd(node));
Structure\Providers\CollectionExpressionStructureProvider.cs (4)
42var textSpan = TextSpan.FromBounds(node.SpanStart, end); 61var textSpan = TextSpan.FromBounds(previousToken.Span.End, node.Span.End);
Structure\Providers\DisabledTextTriviaStructureProvider.cs (2)
58var span = TextSpan.FromBounds(startPos, endPos);
Structure\Providers\DocumentationCommentStructureProvider.cs (2)
36var span = TextSpan.FromBounds(startPos, endPos);
Structure\Providers\IfDirectiveTriviaStructureProvider.cs (2)
53var span = TextSpan.FromBounds(startLine.Start, endLine.End);
Structure\Providers\InitializerExpressionStructureProvider.cs (4)
46textSpan: TextSpan.FromBounds(node.SpanStart, end), 47hintSpan: TextSpan.FromBounds(node.SpanStart, end), 63var hintSpan = containingStatement != null 69textSpan: TextSpan.FromBounds(node.SpanStart, node.Span.End),
Structure\Providers\RegionDirectiveStructureProvider.cs (1)
54textSpan: TextSpan.FromBounds(regionDirective.SpanStart, match.Span.End),
Structure\Providers\StringLiteralExpressionStructureProvider.cs (1)
48var span = node.Span;
Structure\Providers\SwitchExpressionStructureProvider.cs (1)
24textSpan: TextSpan.FromBounds(node.SwitchKeyword.Span.End, node.CloseBraceToken.Span.End),
Structure\Providers\SwitchStatementStructureProvider.cs (2)
24textSpan: TextSpan.FromBounds(node.CloseParenToken != default ? node.CloseParenToken.Span.End : node.Expression.Span.End, node.CloseBraceToken.Span.End), 37textSpan: TextSpan.FromBounds(start, end),
SyncedSource\FileBasedPrograms\FileLevelDirectiveHelpers.cs (11)
93TextSpan previousWhiteSpaceSpan = default; 113TextSpan span = GetFullSpan(previousWhiteSpaceSpan, trivia); 127TextSpan span = GetFullSpan(previousWhiteSpaceSpan, trivia); 180static TextSpan GetFullSpan(TextSpan previousWhiteSpaceSpan, SyntaxTrivia trivia) 183return previousWhiteSpaceSpan.IsEmpty ? trivia.FullSpan : TextSpan.FromBounds(previousWhiteSpaceSpan.Start, trivia.FullSpan.End); 242public string GetLocationString(TextSpan span) 277public required TextSpan Span { get; init; } 292public void ReportError(TextSpan span, string message) 811public TextSpan TextSpan { get; init; } 815internal delegate void ErrorReporter(SourceText text, string path, TextSpan textSpan, string message, Exception? innerException = null);
UseExpressionBody\UseExpressionBodyCodeRefactoringProvider.cs (3)
189ImmutableArray<TextSpan> fixAllSpans, 205ImmutableArray<TextSpan> fixAllSpans, 213foreach (var span in fixAllSpans)
UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeRefactoringProvider.cs (4)
79var span = context.Span; 91Document document, TextSpan span, ExpressionBodyPreference option, CancellationToken cancellationToken) 147Document document, TextSpan span, CancellationToken cancellationToken) 163Document document, TextSpan span, ExpressionBodyPreference option, CancellationToken cancellationToken)
Wrapping\SeparatedSyntaxList\CSharpArgumentWrapper.cs (2)
97var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
Wrapping\SeparatedSyntaxList\CSharpParameterWrapper.cs (2)
68var headerSpan = TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End);
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (1)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\CSharpStaticHolderTypes.Fixer.cs (1)
33CodeAnalysis.Text.TextSpan span = context.Span;
Microsoft.CodeAnalysis.CSharp.Workspaces (134)
CaseCorrection\CSharpCaseCorrectionService.cs (1)
29ImmutableArray<TextSpan> spans,
Classification\ClassificationHelpers.cs (2)
507internal static void AddLexicalClassifications(SourceText text, TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 533var span = classifiedSpan.TextSpan;
Classification\CSharpClassificationService.cs (1)
30public override void AddLexicalClassifications(SourceText text, TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken)
Classification\SyntaxClassification\CSharpSyntaxClassificationService.cs (3)
44public override void AddLexicalClassifications(SourceText text, TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 47public override void AddSyntacticClassifications(SyntaxNode root, ImmutableArray<TextSpan> textSpans, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 49foreach (var textSpan in textSpans)
Classification\SyntaxClassification\DiscardSyntaxClassifier.cs (1)
22TextSpan textSpan,
Classification\SyntaxClassification\DocCommentCodeBlockClassifier.cs (6)
35TextSpan textSpan, 68TextSpan textSpan, 101TextSpan textSpan, 121foreach (var span in markdownSpans) 167TextSpan.FromBounds(start, end))); 172XmlElementSyntax xmlElement, TextSpan textSpan, ArrayBuilder<VirtualChar> virtualCharsBuilder, CancellationToken cancellationToken)
Classification\SyntaxClassification\FunctionPointerUnmanagedCallingConventionClassifier.cs (1)
22TextSpan textSpan,
Classification\SyntaxClassification\NameSyntaxClassifier.cs (1)
25TextSpan textSpan,
Classification\SyntaxClassification\OperatorOverloadSyntaxClassifier.cs (3)
28TextSpan textSpan, 41var operatorSpan = GetOperatorTokenSpan(syntax); 54private static TextSpan GetOperatorTokenSpan(SyntaxNode syntax)
Classification\SyntaxClassification\SyntaxTokenClassifier.cs (1)
28TextSpan textSpan,
Classification\SyntaxClassification\UsingDirectiveSyntaxClassifier.cs (1)
20TextSpan textSpan,
Classification\Worker.cs (10)
26private readonly TextSpan _textSpan; 30private Worker(TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 38IEnumerable<SyntaxToken> tokens, TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 46SyntaxNode node, TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 52private readonly void AddClassification(TextSpan span, string type) 58private readonly bool ShouldAddSpan(TextSpan span) 98var childSpan = childNode.FullSpan; 120var span = token.Span; 133AddClassification(TextSpan.FromBounds(token.Span.Start, token.Span.End - "u8".Length), type); 134AddClassification(TextSpan.FromBounds(token.Span.End - "u8".Length, token.Span.End), ClassificationTypeNames.Keyword);
Classification\Worker_DocumentationComments.cs (5)
23var childFullSpan = xmlNode.FullSpan; 109var span = TextSpan.FromBounds(spanStart.Value, spanStart.Value + index); 123var span = TextSpan.FromBounds(spanStart.Value, trivia.Span.End);
CodeCleanup\CSharpCodeCleanerService.cs (1)
19protected override ImmutableArray<TextSpan> GetSpansToAvoid(SyntaxNode root)
EmbeddedLanguages\CSharpTestEmbeddedLanguageUtilities.cs (2)
42Action<TArgs, string, TextSpan> addClassification, 52Action<TArgs, string, TextSpan> addClassification,
Rename\CSharpRenameRewriterLanguageService.cs (15)
54private readonly ImmutableDictionary<TextSpan, RenameLocation> _renameLocations; 55private readonly ImmutableHashSet<TextSpan> _conflictLocations; 91private readonly ImmutableDictionary<TextSpan, ImmutableSortedSet<TextSpan>?> _stringAndCommentTextSpans; 103private List<(TextSpan oldSpan, TextSpan newSpan)>? _modifiedSubSpans; 107private void AddModifiedSpan(TextSpan oldSpan, TextSpan newSpan) 294var oldSpan = originalNode.Span; 309var newSpan = newNode.Span; 388var oldSpan = token.Span; 634private SyntaxToken RenameInStringLiteral(SyntaxToken oldToken, SyntaxToken newToken, ImmutableSortedSet<TextSpan>? subSpansToReplace, Func<SyntaxTriviaList, string, string, SyntaxTriviaList, SyntaxToken> createNewStringLiteral) 640var oldSpan = oldToken.Span; 668var oldSpan = trivia.Span; 679ImmutableSortedSet<TextSpan>? subSpansToReplace = null;
Simplification\Simplifiers\ExpressionSimplifier.cs (6)
35out TextSpan issueSpan, 67out TextSpan issueSpan, 90out TextSpan issueSpan, 261out TextSpan issueSpan, 275out TextSpan issueSpan, 410out TextSpan issueSpan)
Simplification\Simplifiers\NameSimplifier.cs (4)
38out TextSpan issueSpan, 189out var issueSpanWithoutAttributeSuffix)) 462ref TextSpan issueSpan, 488out TextSpan issueSpan)
Simplification\Simplifiers\QualifiedCrefSimplifier.cs (2)
29out TextSpan issueSpan, 79CrefSyntax replacement, out CrefSyntax replacementNode, out TextSpan issueSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (1)
205var lineSpan = currentLine.Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (5)
516public static bool ContainsInterleavedDirective(this SyntaxNode syntaxNode, TextSpan span, CancellationToken cancellationToken) 521TextSpan textSpan, 530TextSpan textSpan, 549TextSpan textSpan, 561var matchSpan = match.Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (1)
247var name = SyntaxFactory.ParseName(syntaxTree.GetText(cancellationToken).ToString(TextSpan.FromBounds(genericIdentifier.SpanStart, lastToken.Span.End)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (7)
201var fullSpan = trivia.FullSpan; 230var span = trivia.FullSpan; 248var span = trivia.FullSpan; 285var span = trivia.FullSpan; 311var span = trivia.FullSpan; 411var span = token.Span; 457var span = token.Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (1)
156var span = trivia.FullSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\FormattingResult.cs (1)
19internal FormattingResult(TreeData treeInfo, TokenStream tokenStream, TextSpan spanToFormat)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (3)
54var span = TextSpan.FromBounds(commonToken1.Span.End, formatSpanEnd); 104public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs (1)
57public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (1)
102public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (4)
98private TextSpan GetTextSpan(ValueTuple<SyntaxToken, SyntaxToken> pair) 102return TextSpan.FromBounds(_node.FullSpan.Start, pair.Item2.SpanStart); 107return TextSpan.FromBounds(pair.Item1.Span.End, _node.FullSpan.End); 110return TextSpan.FromBounds(pair.Item1.Span.End, pair.Item2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (3)
21TextSpan textSpan, 41startToken, endToken, TextSpan.FromBounds(startToken.Span.Start, endToken.Span.End), 77TextSpan textSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (6)
115TextSpan.FromBounds(lastTokenOfLabel.FullSpan.End, nextToken.SpanStart) : TextSpan.FromBounds(lastTokenOfLabel.FullSpan.End, lastTokenOfLabel.FullSpan.End)); 123var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 124span = lastSection ? span : TextSpan.FromBounds(span.Start, endToken.FullSpan.End); 306TextSpan.FromBounds(openParen.Span.End, closeParen.Span.Start)); 370AddIndentBlockOperation(list, firstToken, lastToken, TextSpan.FromBounds(firstToken.FullSpan.Start, lastToken.FullSpan.End));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (2)
327var textSpan = TextSpan.FromBounds(startToken.Span.End, endToken.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (2)
184var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (2)
65_root, [TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)], _options.FormattingOptions, smartTokenformattingRules, cancellationToken); 119_root, [TextSpan.FromBounds(adjustedStartPosition, adjustedEndPosition)], _options.FormattingOptions, smartTokenFormattingRules, cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
532if (!syntaxIndex.TryGetInterceptsLocation(interceptsLocationData, out var methodDeclarationSpan))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (5)
934public TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node) 945return TextSpan.FromBounds(method.Body.OpenBraceToken.Span.End, method.Body.CloseBraceToken.SpanStart); 1013public TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) 1042return !branch.IsActive || !branch.BranchTaken ? TextSpan.FromBounds(branch.FullSpan.Start, position) : default; 1289public bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeFixesAndRefactorings\CSharpFixAllSpanMappingService.cs (6)
24protected override async Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansIfWithinGlobalStatementAsync( 25Document document, TextSpan span, CancellationToken cancellationToken) 30return ImmutableDictionary<Document, ImmutableArray<TextSpan>>.Empty; 35var fixAllSpan = root.FullSpan; 43return ImmutableDictionary<Document, ImmutableArray<TextSpan>>.Empty; 48return ImmutableDictionary<Document, ImmutableArray<TextSpan>>.Empty
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (5)
28var span = GetUsingsSpan(root, namespaceDeclaration); 37private static TextSpan GetUsingsSpan(CompilationUnitSyntax root, BaseNamespaceDeclarationSyntax? namespaceDeclaration) 44return TextSpan.FromBounds(start, end); 53return TextSpan.FromBounds(start, end); 61return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
547var existingAccessorSpan = existingAccessor.Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (3)
30indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken)); 36indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken)); 48indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\CSharpSyntaxFormattingService.cs (2)
337public ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken) 339var formattingSpan = CommonFormattingHelpers.GetFormattingSpan(document.Root, textSpan);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.cs (3)
58using var _ = ArrayBuilder<TextSpan>.GetInstance(out var spansToFormat); 63spansToFormat.Add(TextSpan.FromBounds(0, firstMemberA.SpanStart)); 67spansToFormat.Add(TextSpan.FromBounds(baseNamespace.Name.Span.End, firstMemberB.SpanStart));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (1)
116public Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken)
Workspace\LanguageServices\CSharpSyntaxTreeFactoryService.NodeSyntaxReference.cs (1)
24public override TextSpan Span
Microsoft.CodeAnalysis.ExternalAccess.AspNetCore (7)
EmbeddedLanguages\AspNetCoreVirtualChar.cs (1)
34public TextSpan Span => VirtualChar.Span;
EmbeddedLanguages\AspNetCoreVirtualCharSequence.cs (1)
36public AspNetCoreVirtualCharSequence GetSubSequence(TextSpan span) => new(_virtualCharSequence[span.Start..span.End]);
EmbeddedLanguages\BraceMatching\AspNetCoreBraceMatchingResult.cs (2)
12TextSpan LeftSpan, 13TextSpan RightSpan)
EmbeddedLanguages\Classification\AspNetCoreEmbeddedLanguageClassificationContext.cs (1)
30public void AddClassification(string classificationType, TextSpan span)
EmbeddedLanguages\DocumentHighlighting\IEmbeddedLanguageDocumentHighlighter.cs (2)
36public TextSpan TextSpan { get; } 41public AspNetCoreHighlightSpan(TextSpan textSpan, AspNetCoreHighlightSpanKind kind) : this()
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (18)
CodeActions\OmniSharpCodeFixContextFactory.cs (4)
19TextSpan span, 27TextSpan span, 28Action<CodeAction, TextSpan?> registerRefactoring, 34TextSpan? diagnosticSpan,
DocumentationComments\OmniSharpDocumentationCommentSnippet.cs (2)
14public TextSpan SpanToReplace { get; } 26internal OmniSharpDocumentationCommentSnippet(TextSpan spanToReplace, string snippetText, int caretOffset)
Formatting\OmniSharpFormatter.cs (1)
17public static Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, OmniSharpSyntaxFormattingOptionsWrapper options, CancellationToken cancellationToken)
InlineHints\OmniSharpInlineHintsService.cs (3)
17public static async Task<ImmutableArray<OmniSharpInlineHint>> GetInlineHintsAsync(Document document, TextSpan textSpan, OmniSharpInlineHintsOptions options, CancellationToken cancellationToken) 37TextSpan span, 50public readonly TextSpan Span { get; }
NavigateTo\OmniSharpNavigateToSearchResult.cs (1)
17ImmutableArray<TextSpan> NameMatchSpans,
Navigation\OmniSharpNavigableItem.cs (2)
12public OmniSharpNavigableItem(ImmutableArray<TaggedText> displayTaggedParts, Document document, TextSpan sourceSpan) 23public TextSpan SourceSpan { get; }
Structure\OmniSharpBlockSpan.cs (5)
21public TextSpan TextSpan { get; } 26public TextSpan HintSpan { get; } 48string type, bool isCollapsible, TextSpan textSpan, string bannerText = Ellipses, bool autoCollapse = false, bool isDefaultCollapsed = false) 56string type, bool isCollapsible, TextSpan textSpan, TextSpan hintSpan, string bannerText = Ellipses, bool autoCollapse = false, bool isDefaultCollapsed = false)
Microsoft.CodeAnalysis.Features (795)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.cs (2)
50Document document, TextSpan textSpan, CancellationToken cancellationToken) 155TextSpan priorSelection,
AddFileBanner\AbstractAddFileBannerCodeRefactoringProvider.cs (1)
150ImmutableArray<TextSpan> fixAllSpans,
AddImport\AbstractAddImportCodeFixProvider.cs (1)
53var span = context.Span;
AddImport\AbstractAddImportFeatureService.cs (5)
66Document document, TextSpan span, string diagnosticId, int maxResults, 90Document document, TextSpan span, string diagnosticId, int maxResults, 492Document document, TextSpan span, ImmutableArray<Diagnostic> diagnostics, int maxResultsPerDiagnostic, 515Document document, TextSpan span, ImmutableArray<string> diagnosticIds, 540TextSpan span,
AddImport\IAddImportFeatureService.cs (4)
23Document document, TextSpan span, string diagnosticId, int maxResults, 32Document document, TextSpan span, ImmutableArray<Diagnostic> diagnostics, int maxResultsPerDiagnostic, 46/// <see cref="GetFixesAsync(Document, TextSpan, string, int, ISymbolSearchService, AddImportOptions, 51Document document, TextSpan span, ImmutableArray<string> diagnosticIds,
AddImport\Remote\IRemoteMissingImportDiscoveryService.cs (2)
25Checksum solutionChecksum, RemoteServiceCallbackId callbackId, DocumentId documentId, TextSpan span, string diagnosticId, int maxResults, 29Checksum solutionChecksum, RemoteServiceCallbackId callbackId, DocumentId id, TextSpan span, ImmutableArray<string> diagnosticIds,
BraceCompletion\AbstractBraceCompletionService.cs (1)
61var braceTextEdit = new TextChange(TextSpan.FromBounds(closingPoint, closingPoint), ClosingBrace.ToString());
BraceMatching\AbstractDirectiveTriviaBraceMatcher.cs (1)
27internal abstract TextSpan GetSpanForTagging(TDirectiveTriviaSyntax directive);
BraceMatching\IBraceMatchingService.cs (2)
19[property: DataMember(Order = 0)] TextSpan LeftSpan, 20[property: DataMember(Order = 1)] TextSpan RightSpan);
BraceMatching\IBraceMatchingServiceExtensions.cs (1)
13public static async Task<TextSpan?> FindMatchingSpanAsync(
BracePairs\IBracePairsService.cs (4)
17TextSpan Start, 18TextSpan End); 22Task AddBracePairsAsync(Document document, TextSpan textSpan, ArrayBuilder<BracePairData> bracePairs, CancellationToken cancellationToken); 47Document document, TextSpan span, ArrayBuilder<BracePairData> bracePairs, CancellationToken cancellationToken)
ChangeSignature\AbstractChangeSignatureService.cs (1)
94public async Task<ImmutableArray<ChangeSignatureCodeAction>> GetChangeSignatureCodeActionAsync(Document document, TextSpan span, CancellationToken cancellationToken)
ClassifiedSpansAndHighlightSpan.cs (2)
12TextSpan highlightSpan) 17public readonly TextSpan HighlightSpan = highlightSpan;
ClassifiedSpansAndHighlightSpanFactory.cs (13)
32Document document, TextSpan sourceSpan, ClassificationOptions options, CancellationToken cancellationToken) 36var narrowSpan = sourceSpan; 37var lineSpan = GetLineSpanForReference(sourceText, narrowSpan); 44private static TextSpan GetLineSpanForReference(SourceText sourceText, TextSpan referenceSpan) 53return TextSpan.FromBounds(Math.Min(firstNonWhitespacePosition, referenceSpan.Start), sourceLine.End); 57Document document, TextSpan narrowSpan, TextSpan widenedSpan, ClassificationOptions options, CancellationToken cancellationToken) 59var highlightSpan = new TextSpan( 69Document document, TextSpan narrowSpan, TextSpan widenedSpan, ClassificationOptions options, CancellationToken cancellationToken) 83new ClassifiedSpan(ClassificationTypeNames.Text, TextSpan.FromBounds(widenedSpan.Start, narrowSpan.Start)), 85new ClassifiedSpan(ClassificationTypeNames.Text, TextSpan.FromBounds(narrowSpan.End, widenedSpan.End)),
CodeFixes\CodeFixCollection.cs (2)
17TextSpan span, 24public TextSpan TextSpan { get; } = span;
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.cs (1)
55public Task<ImmutableArray<CodeFix>> GetFixesAsync(TextDocument document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken)
CodeFixes\Configuration\ConfigureSeverity\ConfigureSeverityLevelCodeFixProvider.cs (1)
47public Task<ImmutableArray<CodeFix>> GetFixesAsync(TextDocument document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken)
CodeFixes\Service\CodeFixService.cs (18)
96TextDocument document, TextSpan range, CodeActionRequestPriority? priority, CancellationToken cancellationToken) 125var spanToErrorDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>>(); 126var spanToOtherDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>>(); 152SortedDictionary<TextSpan, List<DiagnosticData>> spanToDiagnostics, 172TextSpan range, 250TextSpan range, 260private static SortedDictionary<TextSpan, List<DiagnosticData>> ConvertToMap( 267var spanToDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>>(); 285Document document, TextSpan? textSpan, string diagnosticId, DiagnosticSeverity minimumSeverity, CancellationToken cancellationToken) 316var spanToDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>> 337TextSpan? textSpan, 437SortedDictionary<TextSpan, List<DiagnosticData>> spanToDiagnostics, 457using var _2 = PooledDictionary<CodeFixProvider, List<(TextSpan range, List<DiagnosticData> diagnostics)>>.GetInstance(out var fixerToRangesAndDiagnostics); 587TextSpan range, 590PooledDictionary<CodeFixProvider, List<(TextSpan range, List<DiagnosticData> diagnostics)>> fixerToRangesAndDiagnostics) 657TextDocument document, TextSpan span, CodeFixProvider fixer, CodeChangeProviderMetadata? fixerMetadata, 738TextSpan diagnosticsSpan, 773TextSpan fixesSpan,
CodeFixes\Service\CodeFixService.FixAllDiagnosticProvider.cs (1)
52public override async Task<IEnumerable<Diagnostic>> GetDocumentSpanDiagnosticsAsync(Document document, TextSpan fixAllSpan, CancellationToken cancellationToken)
CodeFixes\Service\ICodeFixService.cs (7)
17IAsyncEnumerable<CodeFixCollection> StreamFixesAsync(TextDocument document, TextSpan textSpan, CodeActionRequestPriority? priority, CancellationToken cancellationToken); 24Task<CodeFixCollection?> GetMostSevereFixAsync(TextDocument document, TextSpan range, CodeActionRequestPriority? priority, CancellationToken cancellationToken); 26Task<CodeFixCollection?> GetDocumentFixAllForIdInSpanAsync(Document document, TextSpan? textSpan, string diagnosticId, DiagnosticSeverity severity, CancellationToken cancellationToken); 27Task<Document> ApplyCodeFixesForSpecificDiagnosticIdAsync(Document document, TextSpan? textSpan, string diagnosticId, DiagnosticSeverity severity, IProgress<CodeAnalysisProgress> progressTracker, CancellationToken cancellationToken); 34public static IAsyncEnumerable<CodeFixCollection> StreamFixesAsync(this ICodeFixService service, TextDocument document, TextSpan range, CancellationToken cancellationToken) 37public static Task<ImmutableArray<CodeFixCollection>> GetFixesAsync(this ICodeFixService service, TextDocument document, TextSpan range, CancellationToken cancellationToken) 40public static Task<ImmutableArray<CodeFixCollection>> GetFixesAsync(this ICodeFixService service, TextDocument document, TextSpan textSpan, CodeActionRequestPriority? priority, CancellationToken cancellationToken)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.cs (6)
142TextDocument textDocument, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) 150internal async Task<ImmutableArray<PragmaWarningCodeAction>> GetPragmaSuppressionsAsync(Document document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) 157Document document, TextSpan span, IEnumerable<Diagnostic> diagnostics, bool skipSuppressMessage, bool skipUnsuppress, CancellationToken cancellationToken) 261private async Task<SuppressionTargetInfo?> GetSuppressionTargetInfoAsync(Document document, TextSpan span, CancellationToken cancellationToken) 321TextSpan? minContainingSpan = null; 324var declSpan = decl.DeclaredNode.Span;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs (8)
50var currentDiagnosticSpans = new Dictionary<Diagnostic, TextSpan>(); 62if (!currentDiagnosticSpans.TryGetValue(diagnostic, out var currentDiagnosticSpan)) 130private static void UpdateDiagnosticSpans(ImmutableArray<Diagnostic> diagnostics, Dictionary<Diagnostic, TextSpan> currentDiagnosticSpans, IEnumerable<TextChange> textChanges) 132static bool IsPriorSpan(TextSpan span, TextChange textChange) => span.End <= textChange.Span.Start; 133static bool IsFollowingSpan(TextSpan span, TextChange textChange) => span.Start >= textChange.Span.End; 134static bool IsEnclosingSpan(TextSpan span, TextChange textChange) => span.Contains(textChange.Span); 140if (!currentDiagnosticSpans.TryGetValue(diagnostic, out var originalSpan)) 145var currentSpan = originalSpan;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaHelpers.cs (6)
26TextSpan diagnosticSpan, 28Func<SyntaxToken, TextSpan, SyntaxToken> getNewStartToken, 29Func<SyntaxToken, TextSpan, SyntaxToken> getNewEndToken, 65private static int GetPositionForPragmaInsertion(ImmutableArray<SyntaxTrivia> triviaList, TextSpan currentDiagnosticSpan, AbstractSuppressionCodeFixProvider fixer, bool isStartToken, out SyntaxTrivia triviaAtIndex) 104TextSpan currentDiagnosticSpan, 156TextSpan currentDiagnosticSpan,
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaWarningBatchFixAllProvider.cs (1)
36var span = diagnostic.Location.SourceSpan;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.BatchFixer.cs (1)
45var span = diagnostic.Location.SourceSpan;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (6)
87SyntaxToken getNewStartToken(SyntaxToken startToken, TextSpan currentDiagnosticSpan) => includeStartTokenChange 91SyntaxToken getNewEndToken(SyntaxToken endToken, TextSpan currentDiagnosticSpan) => includeEndTokenChange 124var diagnosticSpan = diagnostic.Location.SourceSpan; 158private SyntaxToken GetNewTokenWithModifiedPragma(SyntaxToken token, TextSpan currentDiagnosticSpan, bool add, bool toggle, int indexOfTriviaToRemoveOrToggle, bool isStartToken, CancellationToken cancellationToken) 165private SyntaxToken GetNewTokenWithAddedPragma(SyntaxToken token, TextSpan currentDiagnosticSpan, bool isStartToken, CancellationToken cancellationToken) 208var spanToCheck = new TextSpan(
CodeLens\CodeLensReferencesService.cs (2)
138var referenceSpan = new TextSpan(spanStart, token.Span.Length); 225var span = new TextSpan(descriptor.SpanStart, descriptor.SpanLength);
CodeLens\ICodeLensMemberFinder.cs (1)
24internal record struct CodeLensMember(SyntaxNode Node, TextSpan Span);
CodeLens\IRemoteCodeLensReferencesService.cs (4)
14ValueTask<ReferenceCount?> GetReferenceCountAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, int maxResultCount, CancellationToken cancellationToken); 15ValueTask<ImmutableArray<ReferenceLocationDescriptorAndDocument>?> FindReferenceLocationsAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken); 16ValueTask<ImmutableArray<ReferenceMethodDescriptor>?> FindReferenceMethodsAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken); 17ValueTask<string?> GetFullyQualifiedNameAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken);
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (4)
34Document document, TextSpan textSpan, bool cleanDocument, CancellationToken cancellationToken) 137private async Task<Document> CleanUpNewLinesAsync(Document document, IEnumerable<TextSpan> insertSpans, SyntaxFormattingOptions formattingOptions, CancellationToken cancellationToken) 144foreach (var insertSpan in insertSpans) 150private async Task<Document> CleanUpNewLinesAsync(Document document, TextSpan insertSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken)
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsRefactoringProvider.cs (1)
33if (!pasteTrackingService.TryGetPastedTextSpan(sourceText.Container, out var textSpan))
CodeRefactorings\AddMissingImports\IAddMissingImportsFeatureService.cs (4)
23Task<ImmutableArray<AddImportFixData>> AnalyzeAsync(Document document, TextSpan textSpan, bool cleanupDocument, CancellationToken cancellationToken); 27/// IAddMissingImportsFeatureService, Document, TextSpan, IProgress{CodeAnalysisProgress}, CancellationToken)"/> but 40this IAddMissingImportsFeatureService service, Document document, TextSpan textSpan, IProgress<CodeAnalysisProgress> progressTracker, CancellationToken cancellationToken) 46this IAddMissingImportsFeatureService service, Document document, TextSpan textSpan, bool cleanupDocument, IProgress<CodeAnalysisProgress> progressTracker, CancellationToken cancellationToken)
CodeRefactorings\CodeRefactoring.cs (3)
25/// applicable to. It doesn't have to precisely represent the exact <see cref="TextSpan"/> that will get changed. 27public ImmutableArray<(CodeAction action, TextSpan? applicableToSpan)> CodeActions { get; } 33ImmutableArray<(CodeAction, TextSpan?)> actions,
CodeRefactorings\CodeRefactoringService.cs (4)
123TextSpan state, 182TextSpan state, 239TextSpan state, 252using var _ = ArrayBuilder<(CodeAction action, TextSpan? applicableToSpan)>.GetInstance(out var actions);
CodeRefactorings\ExtractMethod\AbstractExtractMethodCodeRefactoringProvider.cs (3)
55TextSpan textSpan, 70Document document, TextSpan textSpan, ExtractMethodGenerationOptions extractOptions, CancellationToken cancellationToken) 95Document document, TextSpan textSpan, ExtractMethodGenerationOptions extractOptions, CancellationToken cancellationToken)
CodeRefactorings\ICodeRefactoringService.cs (3)
15Task<bool> HasRefactoringsAsync(TextDocument document, TextSpan textSpan, CancellationToken cancellationToken); 17Task<ImmutableArray<CodeRefactoring>> GetRefactoringsAsync(TextDocument document, TextSpan textSpan, CodeActionRequestPriority? priority, CancellationToken cancellationToken); 22public static Task<ImmutableArray<CodeRefactoring>> GetRefactoringsAsync(this ICodeRefactoringService service, TextDocument document, TextSpan state, CancellationToken cancellationToken)
CodeRefactorings\MoveType\AbstractMoveTypeService.cs (6)
29public abstract Task<Solution> GetModifiedSolutionAsync(Document document, TextSpan textSpan, MoveTypeOperationKind operationKind, CancellationToken cancellationToken); 30public abstract Task<ImmutableArray<CodeAction>> GetRefactoringAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); 41protected abstract Task<TTypeDeclarationSyntax?> GetRelevantNodeAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); 49Document document, TextSpan textSpan, CancellationToken cancellationToken) 56public override async Task<Solution> GetModifiedSolutionAsync(Document document, TextSpan textSpan, MoveTypeOperationKind operationKind, CancellationToken cancellationToken) 70private async Task<TTypeDeclarationSyntax?> GetTypeDeclarationAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken)
CodeRefactorings\MoveType\IMoveTypeService.cs (2)
16Task<ImmutableArray<CodeAction>> GetRefactoringAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); 18Task<Solution> GetModifiedSolutionAsync(Document document, TextSpan textSpan, MoveTypeOperationKind operationKind, CancellationToken cancellationToken);
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (3)
94protected abstract Task<SyntaxNode?> TryGetApplicableContainerFromSpanAsync(Document document, TextSpan span, CancellationToken cancellationToken); 272TextSpan span, 282using var _2 = PooledHashSet<TextSpan>.GetInstance(out var spanForContainers);
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.cs (1)
30protected abstract Task<SyntaxNode?> TryGetApplicableInvocationNodeAsync(Document document, TextSpan span, CancellationToken cancellationToken);
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.State.cs (1)
69TextSpan textSpan,
Completion\CommonCompletionUtilities.cs (3)
27public static TextSpan GetWordSpan(SourceText text, int position, 33public static TextSpan GetWordSpan(SourceText text, int position, 57return TextSpan.FromBounds(start, end);
Completion\CompletionChange.cs (3)
40internal TextSpan? NewSelection { get; } 64TextChange textChange, ImmutableArray<TextChange> textChanges, TextSpan? newSelection, bool includesCommitCharacter, ImmutableDictionary<string, string> properties) 125TextSpan? newSpan = null,
Completion\CompletionContext.cs (4)
50public TextSpan DefaultItemSpan { get; } 63public TextSpan CompletionListSpan { get; set; } 113TextSpan defaultSpan, 140TextSpan defaultSpan,
Completion\CompletionItem.cs (6)
90public TextSpan Span { get; internal set; } 181TextSpan span, 320TextSpan span, 344Optional<TextSpan> span = default, 357var newSpan = span.HasValue ? span.Value : Span; 411public CompletionItem WithSpan(TextSpan span)
Completion\CompletionList.cs (9)
40public TextSpan DefaultSpan { get; } 53public TextSpan Span { get; } 75TextSpan defaultSpan, 103TextSpan defaultSpan, 112TextSpan defaultSpan, 122Optional<TextSpan> span = default, 127var newSpan = span.HasValue ? span.Value : Span; 149public CompletionList WithDefaultSpan(TextSpan span) 152public CompletionList WithSpan(TextSpan span)
Completion\CompletionService.cs (3)
171public virtual TextSpan GetDefaultItemSpan(SourceText text, int caretPosition) 174public virtual TextSpan GetDefaultCompletionListSpan(SourceText text, int caretPosition) 416var defaultItemSpan = _completionServiceWithProviders.GetDefaultCompletionListSpan(text, position);
Completion\CompletionService_GetCompletions.cs (3)
75var completionListSpan = GetDefaultCompletionListSpan(text, caretPosition); 232CompletionOptions options, TextSpan completionListSpan, 336TextSpan defaultSpan,
Completion\PatternMatchHelper.cs (1)
42public ImmutableArray<TextSpan> GetHighlightedSpans(string text, CultureInfo culture)
Completion\Providers\AbstractAwaitCompletionProvider.cs (2)
221builder.Add(new TextChange(TextSpan.FromBounds(item.Span.Start, currentSpanEnd), _awaitKeyword)); 240builder.Add(new TextChange(TextSpan.FromBounds(dotToken.Value.SpanStart, currentSpanEnd), replacementText));
Completion\Providers\AbstractDocCommentCompletionProvider.cs (3)
304var itemSpan = item.Span; 305var replacementSpan = TextSpan.FromBounds(text[itemSpan.Start - 1] == '<' && beforeCaretText[0] == '<' ? itemSpan.Start - 1 : itemSpan.Start, spanEnd);
Completion\Providers\AbstractInternalsVisibleToCompletionProvider.cs (3)
248private static async Task<TextSpan> GetTextChangeSpanAsync(Document document, TextSpan startSpan, CancellationToken cancellationToken) 250var result = startSpan;
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (9)
41protected abstract TextSpan GetTargetSelectionSpan(SyntaxNode caretTarget); 60private async Task<(Document, TextSpan? caretPosition)> DetermineNewDocumentAsync( 144beforeThisLocation: semanticModel.SyntaxTree.GetLocation(TextSpan.FromBounds(line.Start, line.Start)))); 159private TextSpan ComputeDestinationSpan(SyntaxNode insertionRoot, SourceText text) 168return TextSpan.FromBounds(startToken.Value.SpanStart, line.EndIncludingLineBreak); 171private async Task<(Document Document, TextSpan? Selection)> RemoveDestinationNodeAsync( 186var destinationSpan = ComputeDestinationSpan(root, text); 232TextSpan? newSpan = null; 236var targetSelectionSpan = GetTargetSelectionSpan(caretTarget);
Completion\Providers\AbstractPartialMethodCompletionProvider.cs (3)
79Document document, int position, TextSpan span, DeclarationModifiers modifiers, SyntaxToken token, CancellationToken cancellationToken) 98var lineSpan = text.Lines.GetLineFromPosition(position).Span; 102private CompletionItem CreateItem(IMethodSymbol method, int line, TextSpan span, SemanticModel semanticModel, DeclarationModifiers modifiers, SyntaxToken token)
Completion\Providers\AbstractSuggestionModeCompletionProvider.cs (1)
14protected abstract Task<CompletionItem?> GetSuggestionModeItemAsync(Document document, int position, TextSpan span, CompletionTrigger triggerInfo, CancellationToken cancellationToken);
Completion\Providers\Scripting\AbstractDirectivePathCompletionProvider.cs (2)
110private static TextSpan GetTextChangeSpan(string quotedPath, int quotedPathStart, int position) 131return TextSpan.FromBounds(startIndex + quotedPathStart, endIndex + quotedPathStart);
Completion\Providers\Snippets\AbstractSnippetCompletionProvider.cs (3)
55var textSpan = TextSpan.FromBounds(item.Span.Start, change.Span.End); 126var span = completionService.GetDefaultCompletionListSpan(originalText, position);
Completion\Utilities.cs (3)
31var totalOldSpan = TextSpan.FromBounds(changes.First().Span.Start, changes.Last().Span.End); 40var totalNewSpan = new TextSpan(totalOldSpan.Start, totalOldSpan.Length + sumOfDeltas);
ConvertAnonymousType\AbstractConvertAnonymousTypeCodeRefactoringProvider.cs (1)
18Document document, TextSpan span, CancellationToken cancellationToken)
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (1)
79private async Task<Document> ConvertAsync(Document document, TextSpan span, bool isRecord, CancellationToken cancellationToken)
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.cs (1)
183ImmutableArray<TextSpan> fixAllSpans,
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
38var ifSpan = ifStatement.Span;
ConvertToInterpolatedString\AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (1)
269ImmutableArray<TextSpan> fixAllSpans,
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (6)
120TextSpan span, 170private CodeAction CreateAction(Document document, TextSpan span, Scope scope, bool isRecord) 184Document document, TextSpan span, CancellationToken cancellationToken) 217Document document, TextSpan span, Scope scope, bool isRecord, CancellationToken cancellationToken) 251(DocumentId documentId, TextSpan span) renamedToken, 263Document document, TextSpan span, Scope scope, bool isRecord, CancellationToken cancellationToken)
ConvertTupleToStruct\IConvertTupleToStructCodeRefactoringProvider.cs (1)
15Document document, TextSpan span, Scope scope, bool isRecord, CancellationToken cancellationToken);
ConvertTupleToStruct\IRemoteConvertTupleToStructCodeRefactoringService.cs (3)
18TextSpan span, 27(DocumentId, TextSpan) renamedToken) 33public readonly (DocumentId, TextSpan) RenamedToken = renamedToken;
Copilot\CopilotUtilities.cs (5)
19public static (SourceText newText, ImmutableArray<TextSpan> newSpans) GetNewTextAndChangedSpans( 24return (oldText, ImmutableArray<TextSpan>.Empty); 34public static ImmutableArray<TextSpan> GetTextSpansFromTextChanges(IEnumerable<TextChange>? changes) 37return ImmutableArray<TextSpan>.Empty; 41var newSpans = ImmutableArray.CreateBuilder<TextSpan>();
Copilot\Extensions.cs (1)
16public static async Task<ImmutableArray<DiagnosticData>> GetCachedCopilotDiagnosticsAsync(this TextDocument document, TextSpan? span, CancellationToken cancellationToken)
Copilot\ICopilotChangeAnalysisService.cs (4)
164ImmutableArray<TextSpan> newSpans, 204ImmutableArray<TextSpan> newSpans, 235ImmutableArray<TextSpan> newSpans, 372public TextSpan GetSpan(CodeFixCollection value)
Copilot\ICopilotCodeAnalysisService.cs (2)
46Task AnalyzeDocumentAsync(Document document, TextSpan? span, string promptTitle, CancellationToken cancellationToken); 57Task<ImmutableArray<Diagnostic>> GetCachedDocumentDiagnosticsAsync(Document document, TextSpan? span, ImmutableArray<string> promptTitles, CancellationToken cancellationToken);
Copilot\IProposalAdjusterService.cs (29)
55TextSpan? applicableToSpan, CancellationToken cancellationToken); 64LineFormattingOptions? lineFormattingOptions, TextSpan? applicableToSpan, 90TextSpan? applicableToSpan, CancellationToken cancellationToken) 116TextSpan? applicableToSpan, CancellationToken cancellationToken) 192var span = change.Span; 210span = TextSpan.FromBounds(span.Start + 1, Math.Max(span.Start + 1, span.End)); 225span = TextSpan.FromBounds(Math.Min(span.Start, span.End - 1), span.End - 1); 255SourceText originalText, ImmutableArray<TextChange> changes, TextSpan protectedSpan) 284private static bool IntersectsProtectedSpan(TextSpan editSpan, TextSpan protectedSpan) 301TextSpan protectedSpan, 319var beforeSpan = TextSpan.FromBounds(change.Span.Start, protectedSpan.Start); 324var afterSpan = TextSpan.FromBounds(protectedSpan.End, change.Span.End); 331var overlapText = originalText.ToString(TextSpan.FromBounds(protectedSpan.Start, change.Span.End)); 336TextSpan.FromBounds(change.Span.Start, protectedSpan.Start), 341var overlapText = originalText.ToString(TextSpan.FromBounds(change.Span.Start, protectedSpan.End)); 346TextSpan.FromBounds(protectedSpan.End, change.Span.End), 387var totalNewSpan = await GetSpanOfChangesAsync(originalDocument, forkedDocument, cancellationToken).ConfigureAwait(false); 413var totalNewSpan = await GetSpanOfChangesAsync(originalDocument, forkedDocument, cancellationToken).ConfigureAwait(false); 424private static TextSpan GetSpanToAnalyze(SyntaxNode forkedRoot, ImmutableArray<TextSpan> newSpans) 427var newSpan = TextSpan.FromBounds( 434return TextSpan.FromBounds( 442private static async Task<TextSpan> GetSpanOfChangesAsync(Document oldDocument, Document newDocument, CancellationToken cancellationToken) 447var totalNewSpan = GetSpanToAnalyze(forkedRoot, totalSpans); 458SourceText originalText, ImmutableArray<TextChange> changes, TextSpan protectedSpan)
Debugging\AbstractBreakpointResolver.cs (1)
83var textSpan = new TextSpan(location.SourceSpan.Start, 0);
Debugging\AbstractDataTipInfoGetter.cs (1)
23protected static async ValueTask<(DebugDataTipInfoKind kind, TextSpan? expressionSpan)> ComputeKindAsync(
Debugging\BreakpointResolutionResult.cs (3)
12public TextSpan TextSpan { get; } 16private BreakpointResolutionResult(Document document, TextSpan textSpan, string? locationNameOpt, bool isLineBreakpoint) 24internal static BreakpointResolutionResult CreateSpanResult(Document document, TextSpan textSpan, string? locationNameOpt = null)
Debugging\DebugDataTipInfo.cs (3)
16TextSpan Span, TextSpan ExpressionSpan, string? Text, DebugDataTipInfoKind Kind = DebugDataTipInfoKind.None) 18public DebugDataTipInfo(TextSpan span, string? text)
Debugging\IBreakpointResolutionService.cs (1)
15Task<BreakpointResolutionResult?> ResolveBreakpointAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken = default);
Diagnostics\AbstractAnalyzerDriverService.cs (2)
15SemanticModel model, TextSpan span, CancellationToken cancellationToken) 22protected abstract void ComputeDeclarationsInSpan(SemanticModel model, TextSpan span, ArrayBuilder<DeclarationInfo> infos, CancellationToken cancellationToken);
Diagnostics\IAnalyzerDriverService.cs (1)
19ImmutableArray<DeclarationInfo> ComputeDeclarationsInSpan(SemanticModel model, TextSpan span, CancellationToken cancellationToken);
Diagnostics\IDiagnosticAnalyzerService.cs (3)
90TextDocument document, TextSpan? range, 126this IDiagnosticAnalyzerService service, TextDocument document, TextSpan? range, DiagnosticKind diagnosticKind, CancellationToken cancellationToken) 143TextDocument document, TextSpan? range, string? diagnosticId,
Diagnostics\Service\DiagnosticAnalyzerService.IncrementalMemberEditAnalyzer.cs (10)
40private readonly record struct MemberSpans(DocumentId DocumentId, VersionStamp Version, ImmutableArray<TextSpan> Spans); 134ImmutableArray<TextSpan> oldMemberSpans, 141var span = spanBased ? changedMember.FullSpan : (TextSpan?)null; 149ImmutableArray<TextSpan> oldMemberSpans, 161ImmutableArray<TextSpan> oldMemberSpans, 174ImmutableArray<TextSpan> oldMemberSpans, 190private async Task<(SyntaxNode changedMember, int changedMemberId, ImmutableArray<TextSpan> memberSpans, Document lastDocument)?> TryGetChangedMemberAsync( 227private async Task<ImmutableArray<TextSpan>> GetOrCreateMemberSpansAsync(Document document, VersionStamp version, CancellationToken cancellationToken) 244static async Task<ImmutableArray<TextSpan>> CreateMemberSpansAsync(Document document, VersionStamp version, CancellationToken cancellationToken) 257private void SaveMemberSpans(DocumentId documentId, VersionStamp version, ImmutableArray<TextSpan> memberSpans)
Diagnostics\Service\DiagnosticAnalyzerService_CoreAnalyze.cs (1)
194TextSpan? span,
Diagnostics\Service\DiagnosticAnalyzerService_GetDiagnosticsForSpan.cs (5)
41TextSpan? range, 223TextSpan? span) 242DiagnosticAnalyzer analyzer, AnalysisKind kind, TextSpan? span) 279TextSpan? range, 310TextSpan? span,
Diagnostics\Service\DiagnosticAnalyzerService_RemoteOrLocalDispatcher.cs (1)
216TextSpan? range,
Diagnostics\Service\DocumentAnalysisExecutor.cs (5)
183async ValueTask<ImmutableArray<DiagnosticData>> GetCompilerAnalyzerDiagnosticsInProcessAsync(TextSpan? span) 267async ValueTask<TextSpan?> GetAdjustedSpanForCompilerAnalyzerAsync(Document document) 296var startSpan = service.IsMethodLevelMember(startNode) ? startNode.FullSpan : span.Value; 297var endSpan = service.IsMethodLevelMember(endNode) ? endNode.FullSpan : span.Value; 299return TextSpan.FromBounds(Math.Min(startSpan.Start, endSpan.Start), Math.Max(startSpan.End, endSpan.End));
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (4)
301var replaceSpan = token.Span; 348var replaceSpan = new TextSpan(token.Span.Start, 0); 422var replaceSpan = firstNonWhitespaceOffset != null 423? TextSpan.FromBounds(currentLine.Start, currentLine.Start + firstNonWhitespaceOffset.Value)
DocumentationComments\DocumentationCommentProposedEdit.cs (2)
15public TextSpan SpanToReplace { get; } 23public DocumentationCommentProposedEdit(TextSpan spanToReplace, string? symbolName, DocumentationCommentTagType tagType)
DocumentationComments\DocumentationCommentSnippet.cs (2)
14public TextSpan SpanToReplace { get; } 42internal DocumentationCommentSnippet(TextSpan spanToReplace, string snippetText, int caretOffset, int? position, SyntaxNode? memberNode, string? indentText)
DocumentHighlighting\IDocumentHighlightsService.cs (2)
26public TextSpan TextSpan { get; } 31public HighlightSpan(TextSpan textSpan, HighlightSpanKind kind) : this()
DocumentIdSpan.cs (2)
18internal readonly record struct DocumentIdSpan(DocumentId documentId, TextSpan sourceSpan) 23public readonly TextSpan SourceSpan = sourceSpan;
DocumentSpan.cs (3)
10/// Represents a <see cref="TextSpan"/> location in a <see cref="Document"/>. 13Document Document, TextSpan SourceSpan, bool IsGeneratedCode) 15public DocumentSpan(Document document, TextSpan sourceSpan)
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (48)
89internal abstract bool TryFindMemberDeclaration(SyntaxNode? root, SyntaxNode node, TextSpan activeSpan, out OneOrMany<SyntaxNode> declarations); 122protected abstract bool TryGetEnclosingBreakpointSpan(SyntaxToken token, out TextSpan span); 139protected abstract bool TryGetActiveSpan(SyntaxNode node, int statementPart, int minLength, out TextSpan span); 258protected abstract TextSpan? TryGetDiagnosticSpan(SyntaxNode node, EditKind editKind); 260internal TextSpan GetDiagnosticSpan(SyntaxNode node, EditKind editKind) 263protected virtual TextSpan GetBodyDiagnosticSpan(SyntaxNode node, EditKind editKind) 283internal abstract TextSpan GetLambdaParameterDiagnosticSpan(SyntaxNode lambda, int ordinal); 395protected abstract TextSpan GetExceptionHandlingRegion(SyntaxNode node, out bool coversAllChildren); 398internal abstract void ReportEnclosingExceptionHandlingRudeEdits(RudeEditDiagnosticsBuilder diagnostics, IEnumerable<Edit<SyntaxNode>> exceptionHandlingEdits, SyntaxNode oldStatement, TextSpan newStatementSpan); 619using var _3 = ArrayBuilder<(SyntaxNode OldNode, SyntaxNode NewNode, TextSpan DiagnosticSpan)>.GetInstance(out var triviaEdits); 719lineText = text.ToString(TextSpan.FromBounds(diagnostic.Span.Start, Math.Min(diagnostic.Span.Start + 120, line.End))); 968var oldStatementSpan = oldActiveStatements[i].UnmappedSpan; 1040var newStatementSpan = FindClosestActiveSpan(newStatement, statementPart); 1177var newSpan = GetDeletedDeclarationActiveSpan(topMatch.Matches, oldDeclaration); 1189var oldStatementSpan = oldActiveStatements[activeStatementIndex].UnmappedSpan; 1366TextSpan newSpan; 1496var trackedSpan = text.Lines.GetTextSpan(trackedLineSpan); 1511private ActiveStatement GetActiveStatementWithSpan(UnmappedActiveStatement oldStatement, SyntaxTree newTree, TextSpan newSpan, RudeEditDiagnosticsBuilder diagnostics, CancellationToken cancellationToken) 1534TextSpan newStatementSyntaxSpan, 1752public ActiveStatementExceptionRegions GetExceptionRegions(SyntaxNode root, TextSpan unmappedActiveStatementSpan, bool isNonLeaf, CancellationToken cancellationToken) 1773var span = GetExceptionHandlingRegion(exceptionHandlingAncestors[i], out var coversAllChildren); 1792private TextSpan GetDeletedNodeDiagnosticSpan( 1817private TextSpan FindClosestActiveSpan(SyntaxNode statement, int statementPart) 1819if (TryGetActiveSpan(statement, statementPart, minLength: statement.Span.Length, out var span)) 1844internal TextSpan GetDeletedNodeActiveSpan(IReadOnlyDictionary<SyntaxNode, SyntaxNode> forwardMap, SyntaxNode deletedNode) 1862internal TextSpan GetDeletedDeclarationActiveSpan(IReadOnlyDictionary<SyntaxNode, SyntaxNode> forwardMap, SyntaxNode deletedDeclaration) 1884internal TextSpan GetDeletedNodeDiagnosticSpan(IReadOnlyDictionary<SyntaxNode, SyntaxNode> forwardMap, SyntaxNode deletedNode) 1944protected void AddAroundActiveStatementRudeDiagnostic(RudeEditDiagnosticsBuilder diagnostics, SyntaxNode? oldNode, SyntaxNode? newNode, TextSpan newActiveStatementSpan) 1989protected void AddRudeDeleteAroundActiveStatement(RudeEditDiagnosticsBuilder diagnostics, SyntaxNode oldNode, TextSpan newActiveStatementSpan) 2218[Out] ArrayBuilder<(SyntaxNode OldNode, SyntaxNode NewNode, TextSpan DiagnosticSpan)> triviaEdits, 2271var rudeEditSpan = default(TextSpan); 2284if (!TryGetEnclosingBreakpointSpan(oldToken, out var oldBreakpointSpan) || 2285!TryGetEnclosingBreakpointSpan(newToken, out var newBreakpointSpan)) 2344var oldSpan = oldTokensEnum.Current.Span; 2345var newSpan = newTokensEnum.Current.Span; 2404rudeEditSpan = TextSpan.FromBounds(newTokensEnum.Current.FullSpan.Start, newTokensEnum.Current.SpanStart); 2410rudeEditSpan = TextSpan.FromBounds(lastNewToken.Span.End, newTokensEnum.Current.SpanStart); 2698IReadOnlyList<(SyntaxNode OldNode, SyntaxNode NewNode, TextSpan DiagnosticSpan)> triviaEdits, 2939var diagnosticSpan = GetDeletedNodeDiagnosticSpan(editScript.Match.Matches, oldDeclaration); 3323TextSpan? newActiveStatementSpan = null; 5158TextSpan diagnosticSpan) 5259public void Report(RudeEditKind kind, TextSpan span) 5286public void Report(RudeEditKind kind, CancellationToken cancellationToken, TextSpan? span = null, string?[]? arguments = null, RudeEditReportingCondition? condition = null) 5289public RudeEditDiagnostic CreateRudeEdit(RudeEditKind kind, CancellationToken cancellationToken, TextSpan? span = null, string?[]? arguments = null) 5365TextSpan diagnosticSpan = default) 6429private TextSpan GetSymbolLocationSpan(ISymbol symbol, CancellationToken cancellationToken) 6885var span = node.FullSpan;
EditAndContinue\AbstractSimpleMemberBody.cs (1)
25public sealed override TextSpan Envelope
EditAndContinue\ActiveStatementsMap.cs (3)
194if (TryGetTextSpan(oldText.Lines, unmappedLineSpan, out var unmappedSpan) && 266private static bool TryGetTextSpan(TextLineCollection lines, LinePositionSpan lineSpan, out TextSpan span) 276span = TextSpan.FromBounds(start, end);
EditAndContinue\EditSession.cs (4)
207private static TextSpan GetFirstLineDifferenceSpan(SourceText oldText, SourceText newText) 214var oldLineSpan = oldText.Lines[i].Span; 215var newLineSpan = newText.Lines[i].Span; 224TextSpan.FromBounds(newText.Lines[newLineCount - 1].End, newText.Lines[newLineCount - 1].EndIncludingLineBreak);
EditAndContinue\IEditAndContinueAnalyzer.cs (1)
28ActiveStatementExceptionRegions GetExceptionRegions(SyntaxNode syntaxRoot, TextSpan unmappedActiveStatementSpan, bool isNonLeaf, CancellationToken cancellationToken);
EditAndContinue\MemberBody.cs (7)
24public abstract TextSpan Envelope { get; } 29public bool ContainsActiveStatementSpan(TextSpan span) 35public virtual bool IsExcludedActiveStatementSpanWithinEnvelope(TextSpan span) 56public abstract SyntaxNode FindStatementAndPartner(TextSpan span, MemberBody? partnerDeclarationBody, out SyntaxNode? partnerStatement, out int statementPart); 58public SyntaxNode FindStatement(TextSpan span, out int statementPart) 63var envelope = Envelope; 73var span = statements[i].UnmappedSpan;
EditAndContinue\RudeEditDiagnostic.cs (3)
20public readonly TextSpan Span; 28internal RudeEditDiagnostic(RudeEditKind kind, TextSpan span, ushort syntaxKind, string?[] arguments) 36internal RudeEditDiagnostic(RudeEditKind kind, TextSpan span, SyntaxNode? node = null, string?[]? arguments = null)
EditAndContinue\UnmappedActiveStatement.cs (3)
9internal readonly struct UnmappedActiveStatement(TextSpan unmappedSpan, ActiveStatement statement, ActiveStatementExceptionRegions exceptionRegions) 15public TextSpan UnmappedSpan { get; } = unmappedSpan; 27public void Deconstruct(out TextSpan unmappedSpan, out ActiveStatement statement, out ActiveStatementExceptionRegions exceptionRegions)
EmbeddedLanguages\Classification\AbstractEmbeddedLanguageClassificationService.cs (5)
39Document document, ImmutableArray<TextSpan> textSpans, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 52SolutionServices services, Project? project, SemanticModel semanticModel, ImmutableArray<TextSpan> textSpans, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 58foreach (var textSpan in textSpans) 70TextSpan textSpan, 79private readonly TextSpan _textSpan = textSpan;
EmbeddedLanguages\Classification\EmbeddedLanguageClassifierContext.cs (3)
23private readonly TextSpan _spanToClassify; 54TextSpan spanToClassify, 73public void AddClassification(string classificationType, TextSpan span)
EmbeddedLanguages\DateAndTime\EmbeddedCompletionContext.cs (2)
22private readonly TextSpan _replacementSpan; 50_replacementSpan = TextSpan.FromBounds(startPosition, context.Position);
EmbeddedLanguages\Json\JsonLexer.cs (2)
316private readonly TextSpan GetTextSpan(int startInclusive, int endExclusive) 317=> TextSpan.FromBounds(Text[startInclusive].Span.Start, Text[endExclusive - 1].Span.End);
EmbeddedLanguages\Json\JsonParser.cs (1)
589private readonly TextSpan GetTokenStartPositionSpan(JsonToken token)
EmbeddedLanguages\Json\JsonParser.StrictSyntaxChecker.cs (1)
243return new EmbeddedDiagnostic(FeaturesResources.Invalid_escape_sequence, TextSpan.FromBounds(chars[i].Span.Start, chars[i + 1].Span.End));
EmbeddedLanguages\RegularExpressions\LanguageServices\EmbeddedCompletionContext.cs (2)
50var replacementSpan = TextSpan.FromBounds(replacementStart, Position);
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexDocumentHighlighter.cs (4)
91if (tree.CaptureNumbersToSpan.TryGetValue(val, out var captureSpan)) 99if (tree.CaptureNamesToSpan.TryGetValue(val, out var captureSpan)) 109RegexEscapeNode node, TextSpan captureSpan) 114private static HighlightSpan CreateHighlightSpan(TextSpan textSpan)
EmbeddedLanguages\RegularExpressions\RegexLexer.cs (2)
176public readonly TextSpan GetTextSpan(int startInclusive, int endExclusive) 177=> TextSpan.FromBounds(Text[startInclusive].Span.Start, Text[endExclusive - 1].Span.End);
EmbeddedLanguages\RegularExpressions\RegexParser.CaptureInfoAnalyzer.cs (12)
32private readonly ImmutableDictionary<int, TextSpan>.Builder _captureNumberToSpan; 33private readonly ImmutableDictionary<string, TextSpan>.Builder _captureNameToSpan; 41_captureNumberToSpan = ImmutableDictionary.CreateBuilder<int, TextSpan>(); 42_captureNameToSpan = ImmutableDictionary.CreateBuilder<string, TextSpan>(); 50public static (ImmutableDictionary<string, TextSpan>, ImmutableDictionary<int, TextSpan>) Analyze( 57private (ImmutableDictionary<string, TextSpan>, ImmutableDictionary<int, TextSpan>) Analyze( 139private readonly TextSpan GetGroupingSpan(RegexGroupingNode grouping) 181private readonly void RecordCapture(RegexToken token, TextSpan span) 197ImmutableDictionary<T, TextSpan>.Builder mapping, 199T val, TextSpan span)
EmbeddedLanguages\RegularExpressions\RegexParser.cs (8)
81private readonly ImmutableDictionary<string, TextSpan> _captureNamesToSpan; 82private readonly ImmutableDictionary<int, TextSpan> _captureNumbersToSpan; 91ImmutableDictionary<string, TextSpan> captureNamesToSpan, 92ImmutableDictionary<int, TextSpan> captureNumbersToSpan) : this() 144ImmutableDictionary<string, TextSpan>.Empty, 145ImmutableDictionary<int, TextSpan>.Empty).ParseTree(); 724private readonly TextSpan GetTokenSpanIncludingEOF(RegexToken token) 729private readonly TextSpan GetTokenStartPositionSpan(RegexToken token)
EmbeddedLanguages\RegularExpressions\RegexTree.cs (4)
16ImmutableDictionary<string, TextSpan> captureNamesToSpan, 17ImmutableDictionary<int, TextSpan> captureNumbersToSpan) : EmbeddedSyntaxTree<RegexKind, RegexNode, RegexCompilationUnit>(text, root, diagnostics) 19public readonly ImmutableDictionary<string, TextSpan> CaptureNamesToSpan = captureNamesToSpan; 20public readonly ImmutableDictionary<int, TextSpan> CaptureNumbersToSpan = captureNumbersToSpan;
EncapsulateField\AbstractEncapsulateFieldService.cs (7)
42protected abstract Task<ImmutableArray<IFieldSymbol>> GetFieldsAsync(Document document, TextSpan span, CancellationToken cancellationToken); 45public async Task<EncapsulateFieldResult?> EncapsulateFieldsInSpanAsync(Document document, TextSpan span, bool useDefaultBehavior, CancellationToken cancellationToken) 58public async Task<ImmutableArray<CodeAction>> GetEncapsulateFieldCodeActionsAsync(Document document, TextSpan span, CancellationToken cancellationToken) 280Func<DocumentId, TextSpan, bool> filter, 297private static bool IntersectsWithAny(DocumentId documentId, TextSpan span, ISet<(DocumentId documentId, TextSpan span)> constructorLocations) 311private ISet<(DocumentId documentId, TextSpan span)> GetConstructorLocations(Solution solution, INamedTypeSymbol containingType)
EncapsulateField\IEncapsulateFieldService.cs (2)
16Task<ImmutableArray<CodeAction>> GetEncapsulateFieldCodeActionsAsync(Document document, TextSpan span, CancellationToken cancellationToken); 19Task<EncapsulateFieldResult?> EncapsulateFieldsInSpanAsync(Document document, TextSpan span, bool useDefaultBehavior, CancellationToken cancellationToken);
ExternalAccess\UnitTesting\API\UnitTestingDocumentSpan.cs (1)
21/// The raw <see cref="Document"/> and <see cref="TextSpan"/> that the symbol is located at.
ExternalAccess\UnitTesting\UnitTestingFeaturesReferencesService.cs (2)
18Guid projectGuid, string filePath, TextSpan span, DocumentId? sourceGeneratedDocumentId, CancellationToken cancellationToken); 34TextSpan span,
ExternalAccess\VSTypeScript\Api\IVSTypeScriptClassificationService.cs (1)
16Task AddSemanticClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, List<ClassifiedSpan> result, CancellationToken cancellationToken);
ExternalAccess\VSTypeScript\Api\IVSTypeScriptCommentSlectionServiceImplementation.cs (2)
17Task<VSTypeScriptCommentSelectionInfo> GetInfoAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); 19Task<Document> FormatAsync(Document document, ImmutableArray<TextSpan> changes, CancellationToken cancellationToken);
ExternalAccess\VSTypeScript\Api\IVSTypeScriptFormattingServiceImplementation.cs (1)
19Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, VSTypeScriptIndentationOptions options, CancellationToken cancellationToken);
ExternalAccess\VSTypeScript\Api\IVSTypeScriptNavigableItem.cs (1)
33TextSpan SourceSpan { get; }
ExternalAccess\VSTypeScript\Api\IVSTypeScriptNavigateToSearchResult.cs (1)
17ImmutableArray<TextSpan> NameMatchSpans { get; }
ExternalAccess\VSTypeScript\VSTypeScriptClassificationService.cs (5)
26public void AddLexicalClassifications(SourceText text, TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 30public void AddSyntacticClassifications(SolutionServices services, SyntaxNode? root, ImmutableArray<TextSpan> textSpans, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 34public Task AddSyntacticClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 37public Task AddEmbeddedLanguageClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 49public async Task AddSemanticClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken)
ExternalAccess\VSTypeScript\VSTypeScriptFormattingService.cs (1)
24public Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, LineFormattingOptions lineFormattingOptions, SyntaxFormattingOptions? syntaxFormattingOptions, CancellationToken cancellationToken)
ExternalAccess\VSTypeScript\VSTypeScriptNavigableItemWrapper.cs (1)
26public TextSpan SourceSpan => _navigableItem.SourceSpan;
ExternalAccess\VSTypeScript\VSTypeScriptNavigateToSearchService.cs (1)
123public ImmutableArray<TextSpan> NameMatchSpans => _result.NameMatchSpans;
ExternalAccess\VSTypeScript\VSTypeScriptTaskListService.cs (1)
40var textSpan = new TextSpan(Math.Min(text.Length, Math.Max(0, d.Position)), 0);
ExtractClass\AbstractExtractClassRefactoringProvider.cs (2)
81var memberSpan = TextSpan.FromBounds(
ExtractClass\ExtractClassWithDialogCodeAction.cs (2)
28TextSpan span, 47public TextSpan Span { get; } = span;
ExtractInterface\AbstractExtractInterfaceService.cs (1)
48public async Task<ImmutableArray<ExtractInterfaceCodeAction>> GetExtractInterfaceCodeActionAsync(Document document, TextSpan span, CancellationToken cancellationToken)
ExtractMethod\AbstractExtractMethodService.cs (2)
26protected abstract SelectionValidator CreateSelectionValidator(SemanticDocument document, TextSpan textSpan, bool localFunction); 31TextSpan textSpan,
ExtractMethod\AbstractSyntaxTriviaService.cs (3)
26public ITriviaSavedResult SaveTriviaAroundSelection(SyntaxNode root, TextSpan textSpan) 92private static Dictionary<TriviaLocation, IEnumerable<SyntaxTrivia>> GetTriviaAtEdges(Dictionary<TriviaLocation, SyntaxToken> tokens, TextSpan textSpan) 108private static Dictionary<TriviaLocation, SyntaxToken> GetTokensAtEdges(SyntaxNode root, TextSpan textSpan)
ExtractMethod\ExtractMethodService.cs (1)
14public static Task<ExtractMethodResult> ExtractMethodAsync(Document document, TextSpan textSpan, bool localFunction, ExtractMethodGenerationOptions options, CancellationToken cancellationToken)
ExtractMethod\IExtractMethodService.cs (1)
14Task<ExtractMethodResult> ExtractMethodAsync(Document document, TextSpan textSpan, bool localFunction, ExtractMethodGenerationOptions options, CancellationToken cancellationToken);
ExtractMethod\ISyntaxTriviaService.cs (1)
67ITriviaSavedResult SaveTriviaAroundSelection(SyntaxNode root, TextSpan textSpan);
ExtractMethod\MethodExtractor.Analyzer.cs (3)
434var analysisRange = TextSpan.FromBounds(SelectionResult.FinalSpan.Start, containingScope.Span.End); 740var selectionSpan = this.SelectionResult.FinalSpan;
ExtractMethod\SelectionInfo.cs (3)
66public TextSpan FinalSpan { get; init; } 78Optional<TextSpan> finalSpan = default, 84var resultFinalSpan = finalSpan.HasValue ? finalSpan.Value : this.FinalSpan;
ExtractMethod\SelectionResult.cs (4)
27TextSpan finalSpan) 36public TextSpan FinalSpan { get; } = finalSpan; 131var span = TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End);
ExtractMethod\SelectionValidator.cs (9)
23TextSpan textSpan) 26protected readonly TextSpan OriginalSpan = textSpan; 30protected abstract TextSpan GetAdjustedSpan(TextSpan textSpan); 65SyntaxNode root, TextSpan textSpan, CancellationToken cancellationToken) 97var adjustedSpan = GetAdjustedSpan(OriginalSpan); 110FinalSpan = GetAdjustedSpan(TextSpan.FromBounds(start, end)), 140var textSpan = TextSpan.FromBounds(firstTokenInOriginalSpan.SpanStart, lastTokenInOriginalSpan.Span.End);
FindUsages\AbstractFindUsagesService.ProgressAdapter.cs (1)
35public async ValueTask OnReferenceFoundAsync(Document document, TextSpan span, CancellationToken cancellationToken)
FindUsages\AbstractFindUsagesService_FindImplementations.cs (2)
110var seenLocations = new HashSet<(string filePath, TextSpan span)>(); 129static bool AddedAllLocations(ISymbol implementation, HashSet<(string filePath, TextSpan span)> seenLocations)
FindUsages\DefinitionItemFactory.cs (1)
315var sourceSpan = location.SourceSpan;
FindUsages\IRemoteFindUsagesService.cs (4)
163DocumentId documentId, TextSpan sourceSpan, bool isGeneratedCode) 169public readonly TextSpan SourceSpan = sourceSpan; 256SerializableClassifiedSpans classifiedSpans, TextSpan highlightSpan) 262public readonly TextSpan HighlightSpan = highlightSpan;
Formatting\FormattingRuleUtilities.cs (1)
14ParsedDocument document, TextSpan span, IEnumerable<AbstractFormattingRule>? additionalRules)
FullyQualify\AbstractFullyQualifyService.cs (2)
40Document document, TextSpan span, CancellationToken cancellationToken) 60Document document, TextSpan span, CancellationToken cancellationToken)
FullyQualify\IFullyQualifyService.cs (1)
35Task<FullyQualifyFixData?> GetFixDataAsync(Document document, TextSpan span, CancellationToken cancellationToken);
FullyQualify\IRemoteFullyQualifyService.cs (1)
13ValueTask<FullyQualifyFixData?> GetFixDataAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan span, CancellationToken cancellationToken);
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.cs (6)
78Document priorDocument, TextSpan priorSelection, Document currentDocument, IntentDataProvider intentDataProvider, CancellationToken cancellationToken) 153TextSpan textSpan, 154Action<CodeAction, TextSpan> registerSingleAction, 190private async Task<(CodeAction CodeAction, TextSpan ApplicableToSpan)?> HandleNonSelectionAsync( 192TextSpan textSpan, 266Document document, TextSpan textSpan, bool addNullChecks, Accessibility? desiredAccessibility, CancellationToken cancellationToken)
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.GenerateConstructorWithDialogCodeAction.cs (2)
25TextSpan textSpan, 35private readonly TextSpan _textSpan = textSpan;
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.State.cs (3)
25public TextSpan TextSpan { get; private set; } 38TextSpan textSpan, 54TextSpan textSpan,
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.cs (1)
170TextSpan textSpan,
GenerateFromMembers\GenerateFromMembersHelpers.cs (1)
23Document document, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken)
GenerateOverrides\GenerateOverridesWithDialogCodeAction.cs (2)
26TextSpan textSpan, 34private readonly TextSpan _textSpan = textSpan;
GoToDefinition\AbstractGoToDefinitionSymbolService.cs (2)
22public async Task<(ISymbol? symbol, Project project, TextSpan boundSpan)> GetSymbolProjectAndBoundSpanAsync( 64public async Task<(int? targetPosition, TextSpan tokenSpan)> GetTargetIfControlFlowAsync(
GoToDefinition\IGoToDefinitionSymbolService.cs (2)
14Task<(ISymbol? symbol, Project project, TextSpan boundSpan)> GetSymbolProjectAndBoundSpanAsync( 21Task<(int? targetPosition, TextSpan tokenSpan)> GetTargetIfControlFlowAsync(
Highlighting\HighlightingService.cs (5)
23private static readonly PooledObjects.ObjectPool<List<TextSpan>> s_listPool = new(() => []); 26SyntaxNode root, int position, List<TextSpan> highlights, CancellationToken cancellationToken) 37var lastSpan = default(TextSpan); 38foreach (var span in tempHighlights)
Highlighting\IHighlighter.cs (1)
13void AddHighlights(SyntaxNode root, int position, List<TextSpan> highlights, CancellationToken cancellationToken);
Highlighting\IHighlightingService.cs (1)
19void AddHighlights(SyntaxNode root, int position, List<TextSpan> highlights, CancellationToken cancellationToken);
Highlighting\Keywords\AbstractKeywordHighlighter.cs (8)
21protected sealed override void AddHighlightsForNode(SyntaxNode node, List<TextSpan> highlights, CancellationToken cancellationToken) 24protected abstract void AddHighlights(TNode node, List<TextSpan> highlights, CancellationToken cancellationToken); 31private static readonly ObjectPool<List<TextSpan>> s_textSpanListPool = new(() => []); 39SyntaxNode root, int position, List<TextSpan> highlights, CancellationToken cancellationToken) 67private static bool AnyIntersects(int position, List<TextSpan> highlights) 69foreach (var highlight in highlights) 78protected abstract void AddHighlightsForNode(SyntaxNode node, List<TextSpan> highlights, CancellationToken cancellationToken); 80protected static TextSpan EmptySpan(int position)
InheritanceMargin\AbstractInheritanceMarginService.cs (1)
32TextSpan spanToSearch,
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (3)
85TextSpan spanToSearch, 134TextSpan spanToSearch, 166TextSpan spanToSearch,
InheritanceMargin\IInheritanceMarginService.cs (1)
22TextSpan spanToSearch,
InheritanceMargin\IRemoteInheritanceMarginService.cs (1)
17TextSpan spanToSearch,
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (2)
74TextSpan parameterSpan, 177TextSpan parameterSpan,
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (1)
51ImmutableArray<SyntaxNode> listOfParameterNodes, TextSpan parameterSpan,
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (1)
43TextSpan parameterSpan,
InlineHints\AbstractInlineHintsService.cs (1)
18Document document, TextSpan textSpan, InlineHintsOptions options, bool displayAllOverride, CancellationToken cancellationToken)
InlineHints\AbstractInlineParameterNameHintsService.cs (2)
37TextSpan textSpan, 107var textSpan = new TextSpan(position, 0);
InlineHints\AbstractInlineTypeHintsService.cs (1)
33TextSpan textSpan,
InlineHints\IInlineHintsService.cs (1)
16Document document, TextSpan textSpan, InlineHintsOptions options, bool displayAllOverride, CancellationToken cancellationToken);
InlineHints\IInlineParameterNameHintsService.cs (1)
22TextSpan textSpan,
InlineHints\IInlineTypeHintsService.cs (1)
22TextSpan textSpan,
InlineHints\InlineHint.cs (4)
16public readonly TextSpan Span; 23TextSpan span, 31TextSpan span, 40TextSpan span,
InlineHints\TypeHint.cs (3)
10internal readonly struct TypeHint(ITypeSymbol type, TextSpan span, TextChange? textChange, bool leadingSpace = false, bool trailingSpace = false) 15public TextSpan Span { get; } = span; 23public void Deconstruct(out ITypeSymbol type, out TextSpan span, out TextChange? textChange, out ImmutableArray<SymbolDisplayPart> prefix, out ImmutableArray<SymbolDisplayPart> suffix)
Intents\IIntentProvider.cs (1)
16TextSpan priorSelection,
IntroduceVariable\AbstractIntroduceLocalForExpressionCodeRefactoringProvider.cs (1)
26protected abstract bool IsValid(TExpressionStatementSyntax expressionStatement, TextSpan span);
IntroduceVariable\AbstractIntroduceVariableService.cs (1)
64TextSpan textSpan,
IntroduceVariable\AbstractIntroduceVariableService.State.cs (2)
47TextSpan textSpan, 63TextSpan textSpan,
IntroduceVariable\IIntroduceVariableService.cs (1)
16Task<CodeAction> IntroduceVariableAsync(Document document, TextSpan textSpan, CodeCleanupOptions options, CancellationToken cancellationToken);
InvertConditional\AbstractInvertConditionalCodeRefactoringProvider.cs (1)
40Document document, TextSpan span, CancellationToken cancellationToken)
InvertIf\AbstractInvertIfCodeRefactoringProvider.cs (4)
175var trueSpan = TextSpan.FromBounds(trueSpanStart, Math.Max(trueSpanStart, text.Lines[elseDirectiveLine.LineNumber - 1].SpanIncludingLineBreak.End)); 178var falseSpan = TextSpan.FromBounds(falseSpanStart, Math.Max(falseSpanStart, text.Lines[endIfDirectiveLine.LineNumber - 1].SpanIncludingLineBreak.End));
LineSeparators\ILineSeparatorService.cs (2)
15Task<ImmutableArray<TextSpan>> GetLineSeparatorsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken);
MapCode\IMapCodeService.cs (1)
33ImmutableArray<(Document, TextSpan)> prioritizedFocusLocations,
MoveStaticMembers\AbstractMoveStaticMembersRefactoringProvider.cs (2)
64var memberSpan = TextSpan.FromBounds(
MoveToNamespace\AbstractMoveToNamespaceService.cs (3)
25Task<ImmutableArray<MoveToNamespaceCodeAction>> GetCodeActionsAsync(Document document, TextSpan span, CancellationToken cancellationToken); 47TextSpan span, 247var moveSpan = new TextSpan(container.FullSpan.Start, 0);
NameTupleElement\AbstractNameTupleElementCodeRefactoringProvider.cs (2)
41Document document, TextSpan span, CancellationToken cancellationToken) 82private async Task<Document> AddNamedElementAsync(Document document, TextSpan span, CancellationToken cancellationToken)
NavigateTo\AbstractNavigateToSearchService.InProcess.cs (1)
209using var matchedSpans = TemporaryArray<TextSpan>.Empty;
NavigateTo\AbstractNavigateToSearchService.NormalSearch.cs (1)
120var documentToTextSpans = new MultiDictionary<Document, TextSpan>();
NavigateTo\INavigateToSearchResult.cs (1)
19ImmutableArray<TextSpan> NameMatchSpans { get; }
NavigateTo\NavigateToUtilities.cs (2)
29public static TextSpan GetBoundedSpan(INavigableItem item, SourceText sourceText) 42return TextSpan.FromBounds(spanStart, spanEnd);
NavigateTo\RegexPatternDetector.cs (1)
91var dotSpan = wildcard.DotToken.VirtualChars[0].Span;
NavigateTo\RoslynNavigateToItem.cs (4)
35ImmutableArray<TextSpan> nameMatchSpans, 63public readonly ImmutableArray<TextSpan> NameMatchSpans = nameMatchSpans; 206ImmutableArray<TextSpan> INavigateToSearchResult.NameMatchSpans => _item.NameMatchSpans; 300TextSpan INavigableItem.SourceSpan => _item.DeclaredSymbolInfo.Span;
Navigation\IDefinitionLocationService.cs (4)
25/// returns that <see cref="INavigableLocation"/>. The <see cref="TextSpan"/> returned in the span of the 39/// <param name="Span">The <see cref="TextSpan"/> returned in the span of the symbol in the code that references that 47Document document, int position, Func<CancellationToken, Task<IEnumerable<(Document document, TextSpan sourceSpan)>?>> getNavigableItems, CancellationToken cancellationToken) 81return new DocumentSpan(document, TextSpan.FromBounds(startPosition, endPosition));
Navigation\IDocumentNavigationService.cs (6)
19Task<bool> CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken); 27Task<INavigableLocation?> GetLocationForSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken); 33public virtual Task<bool> CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) 39public virtual Task<INavigableLocation?> GetLocationForSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) 48public static Task<bool> CanNavigateToSpanAsync(this IDocumentNavigationService service, Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) 54public static Task<INavigableLocation?> GetLocationForSpanAsync(this IDocumentNavigationService service, Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken)
Navigation\INavigableItem.cs (1)
39TextSpan SourceSpan { get; }
Navigation\NavigableItemFactory.SymbolLocationNavigableItem.cs (1)
58public TextSpan SourceSpan => _location.SourceSpan;
NavigationBar\AbstractNavigationBarItemService.cs (3)
44Solution solution, ISymbol symbol, SyntaxTree tree, Func<SyntaxReference, TextSpan> computeFullSpan) 51Func<SyntaxReference, TextSpan> computeFullSpan, 67var navigationLocationSpan = symbol.Locations.FirstOrDefault(loc => loc.SourceTree == tree)?.SourceSpan ??
NavigationBar\NavigationBarItems\RoslynNavigationBarItem.SymbolItem.cs (6)
67public readonly (ImmutableArray<TextSpan> spans, TextSpan navigationSpan)? InDocumentInfo; 77public readonly (DocumentId documentId, TextSpan navigationSpan)? OtherDocumentInfo; 80(ImmutableArray<TextSpan> spans, TextSpan navigationSpan)? inDocumentInfo, 81(DocumentId documentId, TextSpan navigationSpan)? otherDocumentInfo)
OrganizeImports\OrganizeImportsCodeRefactoringProvider.cs (1)
55Document document, ImmutableArray<TextSpan> fixAllSpans, SyntaxEditor editor, string? equivalenceKey, CancellationToken cancellationToken)
PasteTracking\IPasteTrackingService.cs (1)
11bool TryGetPastedTextSpan(SourceTextContainer sourceTextContainer, out TextSpan textSpan);
PullMemberUp\AbstractPullMemberUpRefactoringProvider.cs (1)
73TextSpan.FromBounds(
QuickInfo\IndentationHelper.cs (6)
47var span = classifiedSpan.TextSpan; 57var deletion = TextSpan.FromBounds(line.Start, line.Start + lineOffsetOfColumn); 61var spanBeforeDeletion = TextSpan.FromBounds(span.Start, Math.Min(span.End, deletion.Start)); 70span = TextSpan.FromBounds(Math.Min(deletion.End, span.End), span.End);
QuickInfo\OnTheFlyDocsRelevantFileInfo.cs (2)
12public TextSpan TextSpan { get; } 14public OnTheFlyDocsRelevantFileInfo(Document document, TextSpan textSpan)
QuickInfo\Presentation\QuickInfoContentBuilder.cs (1)
138foreach (var relatedSpan in quickInfoItem.RelatedSpans)
QuickInfo\QuickInfoItem.cs (8)
15public TextSpan Span { get; } 31public ImmutableArray<TextSpan> RelatedSpans { get; } 36TextSpan span, 39ImmutableArray<TextSpan> relatedSpans, 50TextSpan span, 53ImmutableArray<TextSpan> relatedSpans = default) 59TextSpan span, 62ImmutableArray<TextSpan> relatedSpans,
QuickInfo\QuickInfoUtilities.cs (2)
21public static Task<QuickInfoItem> CreateQuickInfoItemAsync(SolutionServices services, SemanticModel semanticModel, TextSpan span, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, CancellationToken cancellationToken) 27TextSpan span,
ReplaceDocCommentTextWithTag\AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (8)
47var singleWordSpan = ExpandSpan(sourceText, span, fullyQualifiedName: false); 69var fullyQualifiedSpan = ExpandSpan(sourceText, span, fullyQualifiedName: true); 116CodeRefactoringContext context, SemanticModel semanticModel, SyntaxToken token, TextSpan replacementSpan, CancellationToken cancellationToken) 147CodeRefactoringContext context, TextSpan expandedSpan, string replacement) 158Document document, TextSpan span, string replacement, CancellationToken cancellationToken) 166private static TextSpan ExpandSpan(SourceText sourceText, TextSpan span, bool fullyQualifiedName) 187return TextSpan.FromBounds(startInclusive, endExclusive);
SemanticSearch\ExecuteQueryResult.cs (1)
45[property: DataMember(Order = 2)] TextSpan Span);
SemanticSearch\ISemanticSearchResultsObserver.cs (1)
52[property: DataMember(Order = 4)] TextSpan Span);
SemanticSearch\SemanticSearchDefinitionItemFactory.cs (4)
63private static async ValueTask<DefinitionItem> CreateItemAsync(Document document, TextSpan span, CancellationToken cancellationToken) 66var displaySpan = Clip(span, maxLength: 100); 77private static TextSpan Clip(TextSpan span, int maxLength)
SignatureHelp\AbstractSignatureHelpProvider.cs (2)
37IList<SignatureHelpItem> items, TextSpan applicableSpan, SignatureHelpState? state, int? selectedItemIndex, int parameterIndexOverride) 69IList<SignatureHelpItem> items, TextSpan applicableSpan, SignatureHelpState? state)
SignatureHelp\CommonSignatureHelpUtilities.cs (4)
72internal static TextSpan GetSignatureHelpSpan<TArgumentList>( 80internal static TextSpan GetSignatureHelpSpan<TArgumentList>( 89return TextSpan.FromBounds(start, closeToken.SpanStart); 100return TextSpan.FromBounds(start, nextToken.SpanStart);
SignatureHelp\SignatureHelpItems.cs (2)
26public TextSpan ApplicableSpan { get; } 63TextSpan applicableSpan,
SimplifyTypeNames\AbstractSimplifyTypeNamesCodeFixProvider.cs (4)
40SyntaxNode root, SemanticModel model, TextSpan span, 73var span = context.Span; 114private bool CanSimplifyTypeNameExpression(SemanticModel model, SyntaxNode node, TSimplifierOptions options, TextSpan span, out string diagnosticId, CancellationToken cancellationToken) 119model, node, options, out var issueSpan, out diagnosticId, out _, cancellationToken))
Snippets\RoslynLSPSnippetConverter.cs (3)
110var extendedSpan = GetUpdatedTextSpan(textChange, placeholders, caretPosition, triggerLocation); 123private static TextSpan GetUpdatedTextSpan(TextChange textChange, ImmutableArray<SnippetPlaceholder> placeholders, int caretPosition, int triggerLocation) 142return TextSpan.FromBounds(startPosition, endPosition);
Snippets\SnippetFunctionService.cs (9)
39public static async Task<string?> GetSimplifiedTypeNameAsync(Document document, TextSpan fieldSpan, string fullyQualifiedTypeName, SimplifierOptions simplifierOptions, CancellationToken cancellationToken) 42var updatedTextSpan = new TextSpan(fieldSpan.Start, fullyQualifiedTypeName.Length); 57public async Task<string?> GetSwitchExpansionAsync(Document document, TextSpan caseGenerationLocation, TextSpan switchExpressionLocation, SimplifierOptions simplifierOptions, CancellationToken cancellationToken) 121protected abstract Task<ITypeSymbol?> GetEnumSymbolAsync(Document document, TextSpan switchExpressionSpan, CancellationToken cancellationToken); 123protected abstract Task<(Document, TextSpan)> GetDocumentWithEnumCaseAsync(Document document, string fullyQualifiedTypeName, string firstEnumMemberName, TextSpan caseGenerationLocation, CancellationToken cancellationToken); 129TextSpan caseGenerationLocation, 141private static async Task<string?> GetSimplifiedTypeNameAtSpanAsync(Document documentWithFullyQualifiedTypeName, TextSpan fullyQualifiedTypeSpan, SimplifierOptions simplifierOptions, CancellationToken cancellationToken)
Snippets\SnippetProviders\AbstractConsoleSnippetProvider.cs (2)
55var change = new TextChange(TextSpan.FromBounds(position, position), resultingNode.ToFullString()); 87var closestNode = root.FindNode(TextSpan.FromBounds(position, position));
Snippets\SnippetProviders\AbstractInlineStatementSnippetProvider.cs (2)
69return new TextChange(TextSpan.FromBounds(inlineExpressionInfo?.Node.SpanStart ?? position, position), statement.ToFullString()); 74var closestNode = root.FindNode(TextSpan.FromBounds(position, position), getInnermostNodeForTie: true);
Snippets\SnippetProviders\AbstractLockSnippetProvider.cs (1)
19return Task.FromResult(new TextChange(TextSpan.FromBounds(position, position), statement.NormalizeWhitespace().ToFullString()));
Snippets\SnippetProviders\AbstractMainMethodSnippetProvider.cs (1)
34return Task.FromResult(new TextChange(TextSpan.FromBounds(position, position), method.NormalizeWhitespace().ToFullString()));
Snippets\SnippetProviders\AbstractPropertySnippetProvider.cs (1)
24return new TextChange(TextSpan.FromBounds(position, position), propertyDeclaration.NormalizeWhitespace().ToFullString());
Snippets\SnippetProviders\AbstractSnippetProvider.cs (1)
229=> root.FindNode(TextSpan.FromBounds(position, position), getInnermostNodeForTie: true) as TSnippetSyntax;
Snippets\SnippetProviders\AbstractTypeSnippetProvider.cs (1)
35var mainChange = new TextChange(TextSpan.FromBounds(position, position), typeDeclaration.NormalizeWhitespace().ToFullString());
Snippets\SnippetProviders\AbstractUsingSnippetProvider.cs (1)
24return new TextChange(TextSpan.FromBounds(position, position), statement.NormalizeWhitespace().ToFullString());
Snippets\SnippetUtilities.cs (2)
13public static bool TryGetWordOnLeft(int position, SourceText currentText, ISyntaxFactsService syntaxFactsService, [NotNullWhen(true)] out TextSpan? wordSpan) 36wordSpan = TextSpan.FromBounds(startPosition, endPosition);
SolutionCrawler\AbstractDocumentDifferenceService.cs (1)
17protected abstract bool IsContainedInMemberBody(SyntaxNode oldMember, TextSpan span);
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (1)
43var span = context.Span;
SpellCheck\AbstractSpellCheckSpanService.cs (1)
189AddSpan(new SpellCheckSpan(TextSpan.FromBounds(spanStart, spanEnd), SpellCheckKind.String));
SpellCheck\SpellCheckSpan.cs (1)
10TextSpan TextSpan,
SplitOrMergeIfStatements\AbstractMergeIfStatementsCodeRefactoringProvider.cs (7)
22protected abstract bool IsApplicableSpan(SyntaxNode node, TextSpan span, out SyntaxNode ifOrElseIf); 52void RegisterRefactoring(MergeDirection direction, TextSpan upperIfOrElseIfSpan, TextSpan lowerIfOrElseIfSpan) 59TextSpan.FromBounds(upperIfOrElseIfSpan.Start, lowerIfOrElseIfSpan.End)); 64private async Task<Document> RefactorAsync(Document document, TextSpan upperIfOrElseIfSpan, TextSpan lowerIfOrElseIfSpan, CancellationToken cancellationToken) 79static SyntaxNode FindIfOrElseIf(TextSpan span, IIfLikeStatementGenerator ifGenerator, SyntaxNode root)
SplitOrMergeIfStatements\AbstractSplitIfStatementCodeRefactoringProvider.cs (3)
59private async Task<Document> RefactorAsync(Document document, TextSpan tokenSpan, TextSpan ifOrElseIfSpan, CancellationToken cancellationToken) 74SyntaxNode FindIfOrElseIf(TextSpan span)
src\roslyn\src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (1)
51var span = context.FilterSpan.HasValue ? context.FilterSpan.GetValueOrDefault() : root.FullSpan;
src\roslyn\src\Analyzers\Core\Analyzers\OrderModifiers\AbstractOrderModifiersDiagnosticAnalyzer.cs (1)
82context.Tree.GetLocation(TextSpan.FromBounds(modifiers.First().SpanStart, modifiers.Last().Span.End)),
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessaryCast\AbstractRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
30protected abstract TextSpan GetFadeSpan(TCastExpression node);
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (10)
146private IEnumerable<TextSpan> GetContiguousSpans(ImmutableArray<SyntaxNode> nodes) 149(SyntaxNode node, TextSpan textSpan)? previous = null; 154TextSpan textSpan; 158textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 166textSpan = TextSpan.FromBounds(previous.Value.textSpan.Start, nodeEnd); 172textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 199IEnumerable<TextSpan> contiguousSpans, SyntaxTree tree, 202foreach (var span in contiguousSpans) 213protected abstract IEnumerable<TextSpan> GetFixableDiagnosticSpans( 221foreach (var span in spans)
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
139return Location.Create(parenthesizedExpression.SyntaxTree, TextSpan.FromBounds(parenthesizedExpressionLocation.SourceSpan.Start, textSpanEndPosition));
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (3)
86TextSpan? span, 227TextSpan? span, 735TextSpan? span,
src\roslyn\src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (5)
80using var _ = ArrayBuilder<TextSpan>.GetInstance(out var unnecessarySpans); 127ArrayBuilder<TextSpan> unnecessarySpans) 256private static TextSpan GetSpanWithinLiteralQuotes(IVirtualCharService virtualCharService, SyntaxToken formatToken) 261: TextSpan.FromBounds(sequence[0].Span.Start, sequence[^1].Span.End); 269ArrayBuilder<TextSpan> unnecessarySpans)
src\roslyn\src\Analyzers\Core\Analyzers\SimplifyLinqExpression\AbstractSimplifyLinqExpressionDiagnosticAnalyzer.cs (1)
186TextSpan.FromBounds(memberName.SpanStart, nextInvocationNode.Span.End)));
src\roslyn\src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (5)
67out TextSpan issueSpan, out string diagnosticId, out bool inDeclaration, 104out var issueSpan, out var diagnosticId, out var inDeclaration, 121internal static Diagnostic CreateDiagnostic(SemanticModel model, TSimplifierOptions options, AnalyzerOptions analyzerOptions, TextSpan issueSpan, string diagnosticId, bool inDeclaration) 192/// indicate that <c>intervalTree</c> may be updated by adding a new non-overlapping <see cref="TextSpan"/> 235static bool TryProceedWithInterval(bool addIfAvailable, TextSpan span, StrongBox<bool> completed, TextSpanMutableIntervalTree intervalTree)
src\roslyn\src\Analyzers\Core\Analyzers\UseCollectionInitializer\UseCollectionInitializerHelpers.cs (4)
36syntaxTree.GetLocation(TextSpan.FromBounds(match.SpanStart, arguments[0].SpanStart)), 37syntaxTree.GetLocation(TextSpan.FromBounds(arguments.Last().FullSpan.End, match.Span.End))); 48syntaxTree.GetLocation(TextSpan.FromBounds(match.SpanStart, expression.SpanStart)), 49syntaxTree.GetLocation(TextSpan.FromBounds(expression.FullSpan.End, match.Span.End)));
src\roslyn\src\Analyzers\Core\Analyzers\UseObjectInitializer\AbstractUseObjectInitializerDiagnosticAnalyzer.cs (2)
164var location1 = Location.Create(syntaxTree, TextSpan.FromBounds( 170locations.Add(syntaxTree.GetLocation(TextSpan.FromBounds(match.Initializer.FullSpan.End, match.Statement.Span.End)));
src\roslyn\src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
55var span = diagnostic.Location.SourceSpan;
src\roslyn\src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (8)
334edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 338edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, bottomEnd), "")); 347edits.Add(new TextChange(TextSpan.FromBounds(startPos, equalsEnd), "")); 351edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), "")); 360edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 366edits.Add(new TextChange(TextSpan.FromBounds(secondMiddlePos, equalsEnd), "")); 372edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, equalsEnd), "")); 377edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), ""));
src\roslyn\src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (1)
38SyntaxNode root, TextSpan span, [NotNullWhen(true)] out SyntaxNode? node)
src\roslyn\src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
48private static TXmlElementSyntax? GetParamNode(SyntaxNode root, TextSpan span)
src\roslyn\src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (3)
74var diagnosticSpan = diagnostic.Location.SourceSpan; 76var spanToFormat = TextSpan.FromBounds(
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.cs (2)
22SemanticDocument document, TextSpan textSpan, CancellationToken cancellationToken, 27TextSpan textSpan,
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (2)
30TextSpan textSpan, 46TextSpan textSpan,
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\IGenerateDefaultConstructorsService.cs (1)
17Document document, TextSpan textSpan, bool forRefactoring, CancellationToken cancellationToken);
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (1)
61TextSpan span, Diagnostic diagnostic)
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (1)
21var span = context.Span;
src\roslyn\src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (1)
35SyntaxNode root, TextSpan span, [NotNullWhen(true)] out SyntaxNode? node)
src\roslyn\src\Analyzers\Core\CodeFixes\MakeFieldReadonly\AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
46var diagnosticSpan = diagnostic.Location.SourceSpan;
src\roslyn\src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
55var span = context.Span;
src\roslyn\src\Analyzers\Core\CodeFixes\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
553ISet<(string filePath, TextSpan span)> constructorSpans,
StringIndentation\IStringIndentationService.cs (5)
15Task<ImmutableArray<StringIndentationRegion>> GetStringIndentationRegionsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); 18internal readonly struct StringIndentationRegion(TextSpan indentSpan, ImmutableArray<TextSpan> holeSpans = default) 55public readonly TextSpan IndentSpan = indentSpan; 109public readonly ImmutableArray<TextSpan> OrderedHoleSpans = holeSpans.NullToEmpty().Sort();
Structure\BlockSpan.cs (15)
13TextSpan textSpan, 14TextSpan hintSpan, 15ImmutableArray<(TextSpan textSpan, TextSpan hintSpan, string type)> subHeadings = default, 30public TextSpan TextSpan { get; } = textSpan; 35public TextSpan HintSpan { get; } = hintSpan; 54public ImmutableArray<(TextSpan textSpan, TextSpan hintSpan, string type)> SubHeadings { get; } = subHeadings; 77string type, bool isCollapsible, TextSpan textSpan, string bannerText = Ellipses, bool autoCollapse = false, bool isDefaultCollapsed = false) 97Optional<TextSpan> textSpan = default, 98Optional<TextSpan> hintSpan = default, 99Optional<ImmutableArray<(TextSpan textSpan, TextSpan hintSpan, string type)>> subHeadings = default, 106var newTextSpan = textSpan.HasValue ? textSpan.Value : TextSpan; 107var newHintSpan = hintSpan.HasValue ? hintSpan.Value : HintSpan;
TaskList\AbstractTaskListService.cs (2)
128var fullSpan = trivia.FullSpan; 143var startMessage = text.ToString(TextSpan.FromBounds(fullSpan.Start, startLine.End));
Testing\AbstractTestMethodFinder.cs (2)
33public async Task<ImmutableArray<SyntaxNode>> GetPotentialTestMethodsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) 86private async Task<ImmutableArray<SyntaxNode>> GetPotentialTestNodesAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken)
Testing\ITestMethodFinder.cs (1)
19Task<ImmutableArray<SyntaxNode>> GetPotentialTestMethodsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken);
ValueTracking\IValueTrackingService.cs (2)
15Task<ImmutableArray<ValueTrackedItem>> TrackValueSourceAsync(TextSpan selection, Document document, CancellationToken cancellationToken); 21ValueTask<ImmutableArray<SerializableValueTrackedItem>> TrackValueSourceAsync(Checksum solutionChecksum, TextSpan selection, DocumentId document, CancellationToken cancellationToken);
ValueTracking\SerializableValueTrackedItem.cs (2)
16TextSpan textSpan, 24public TextSpan TextSpan { get; } = textSpan;
ValueTracking\ValueTrackedItem.cs (2)
18public TextSpan Span { get; } 25TextSpan textSpan,
ValueTracking\ValueTracker.cs (2)
20TextSpan selection, 255private static async Task<(ISymbol?, SyntaxNode?)> GetSelectedSymbolAsync(TextSpan textSpan, Document document, CancellationToken cancellationToken)
ValueTracking\ValueTracker.FindReferencesProgress.cs (2)
147var span = referenceLocation.Location.SourceSpan; 170var span = referenceLocation.Location.SourceSpan;
ValueTracking\ValueTrackingService.cs (1)
28TextSpan selection,
Wrapping\AbstractCodeActionComputer.cs (6)
91new TextChange(TextSpan.FromBounds(nodeOrToken.Span.End, OriginalSourceText.Length), newLine)); 164SyntaxNode rewrittenRoot, TextSpan spanToFormat, CancellationToken cancellationToken) 172private async Task<(SyntaxNode root, SyntaxNode rewrittenRoot, TextSpan spanToFormat)> RewriteTreeAsync( 180var span = TextSpan.FromBounds(edit.Left.Span.End, edit.Right.Span.Start); 221private async Task<(SyntaxNode root, SyntaxNode rewrittenRoot, TextSpan spanToFormat)> RewriteTreeAsync(
Wrapping\AbstractWrapper.cs (1)
65protected static bool ContainsOverlappingSyntaxError(SyntaxNode declaration, TextSpan headerSpan)
Microsoft.CodeAnalysis.Razor.Compiler (38)
CSharp\SourceSpanExtensions.cs (1)
13public static TextSpan AsTextSpan(this SourceSpan sourceSpan)
CSharp\TextSpanExtensions.cs (1)
13public static SourceSpan AsSourceSpan(this TextSpan textSpan)
Language\Legacy\RoslynCSharpTokenizer.cs (1)
693private void AdvancePastSpan(TextSpan span)
Language\Legacy\SeekableTextReader.cs (4)
17private (TextSpan Span, int LineIndex) _cachedLineInfo; 80var nextLineSpan = SourceText.Lines[nextLineIndex].Span; 95var prevLineSpan = SourceText.Lines[prevLineIndex].Span; 110var lineSpan = SourceText.Lines[_location.LineIndex].Span;
Language\SpanComputer.cs (3)
12/// <see cref="CodeAnalysis.Text.TextSpan"/> from a set of syntax tokens. 118public readonly TextSpan ToTextSpan() 132return TextSpan.FromBounds(start, end);
Language\Syntax\SyntaxList`1.cs (2)
110public TextSpan Span 112? TextSpan.FromBounds(this[0].Span.Start, this[Count - 1].Span.End)
Language\Syntax\SyntaxNode.cs (6)
29public TextSpan Span => new(Position, Green.Width); 297public IEnumerable<SyntaxNode> DescendantNodes(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null) 316public IEnumerable<SyntaxNode> DescendantNodesAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null) 335public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null) 353public IEnumerable<SyntaxNodeOrToken> DescendandNodesAndTokensAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null) 371public IEnumerable<SyntaxToken> DescendantTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null)
Language\Syntax\SyntaxNode.Iterators.cs (6)
14private IEnumerable<SyntaxNode> DescendantNodesImpl(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool includeSelf) 38private IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensImpl(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool includeSelf) 64private static bool IsInSpan(in TextSpan span, TextSpan childSpan) 118public bool TryGetNextInSpan(in TextSpan span, out SyntaxNodeOrToken value) 134public SyntaxNode? TryGetNextAsNodeInSpan(in TextSpan span)
Language\Syntax\SyntaxNodeOrToken.cs (2)
165public TextSpan Span 184/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>.
Language\Syntax\SyntaxReplacer.cs (8)
63private readonly HashSet<TextSpan> _spanSet; 65private TextSpan _totalSpan; 102foreach (var span in _spanSet) 120private bool ShouldVisit(TextSpan span) 130foreach (var s in _spanSet) 229private readonly TextSpan _elementSpan; 233protected BaseListEditor(TextSpan elementSpan, ListEditKind editKind) 239private bool ShouldVisit(TextSpan span)
Language\Syntax\SyntaxSerializer.cs (1)
106protected virtual void WriteSpan(TextSpan span)
Language\Syntax\SyntaxToken.cs (1)
66public TextSpan Span
Language\Syntax\SyntaxTokenList.cs (2)
115public TextSpan Span 116=> Node == null ? default : TextSpan.FromBounds(Position, Position + Node.Width);
Microsoft.CodeAnalysis.ResxSourceGenerator (363)
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (3)
29var fullSpan = new TextSpan(0, text.Length); 36var change = TextChangeRange.Collapse(changes).Span; 49var span = node.FullSpan;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (3)
105var thisSpan = introspector.GetSpan(value); 125var thisSpan = introspector.GetSpan(value); 138var thisSpan = introspector.GetSpan(value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (40)
14internal sealed class NormalizedTextSpanCollection : ReadOnlyCollection<TextSpan> 29public NormalizedTextSpanCollection(TextSpan span) 42public NormalizedTextSpanCollection(IEnumerable<TextSpan> spans) 93var span1 = left[index1]; 94var span2 = right[index2]; 122spans.Add(TextSpan.FromBounds(start, end)); 161var span1 = left[index1]; 162var span2 = right[index2]; 221var span1 = left[index1]; 222var span2 = right[index2]; 283var span1 = left[index1]; 284var span2 = right[index2]; 296spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 307spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span2.Start)); 333var span1 = left[index1++]; 334spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 398var span1 = this[index1]; 399var span2 = set[index2]; 429public bool OverlapsWith(TextSpan span) 458var span1 = this[index1]; 459var span2 = set[index2]; 483public bool IntersectsWith(TextSpan span) 506foreach (var s in this) 533foreach (var s in this) 546private static IList<TextSpan> ListFromSpan(TextSpan span) 548IList<TextSpan> list = 564private static void UpdateSpanUnion(TextSpan span, IList<TextSpan> spans, ref int start, ref int end) 568spans.Add(TextSpan.FromBounds(start, end)); 585private static IList<TextSpan> NormalizeSpans(IEnumerable<TextSpan> spans) 592var sorted = new List<TextSpan>(spans); 599sorted.Sort(delegate (TextSpan s1, TextSpan s2) { return s1.Start.CompareTo(s2.Start); }); 601IList<TextSpan> normalized = new List<TextSpan>(sorted.Count); 611normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 621normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 626private sealed class OrderedSpanList : List<TextSpan>
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\TextSpanMutableIntervalTree.cs (9)
10internal readonly struct TextSpanIntervalIntrospector : IIntervalIntrospector<TextSpan> 12public TextSpan GetSpan(TextSpan value) 16internal sealed class TextSpanMutableIntervalTree(IEnumerable<TextSpan>? values) 17: SimpleMutableIntervalTree<TextSpan, TextSpanIntervalIntrospector>(new TextSpanIntervalIntrospector(), values) 23public TextSpanMutableIntervalTree(params TextSpan[]? values) : this((IEnumerable<TextSpan>?)values) 27public bool HasIntervalThatIntersectsWith(TextSpan span) 30public bool HasIntervalThatOverlapsWith(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\NamingStyles\NamingStyleOption.cs (3)
13/// The root naming style option composed of several settings as well as a <see cref="TextSpan"/>s describing where they were all defined. 29/// A description of the kinds of symbols a rule should apply to as well as a <see cref="TextSpan"/>s describing where they were all defined. 42/// The rules about how the specified symbols must be named as well as a <see cref="TextSpan"/>s describing where they were all defined.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\Section.cs (2)
16public TextSpan Span { get; init; } 24public Section(string? filePath, bool isGlobal, TextSpan span, string text, string fullText)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxHelpers.cs (4)
12public static TextSpan GetSpan<TSyntaxKind>(EmbeddedSyntaxToken<TSyntaxKind> token1, EmbeddedSyntaxToken<TSyntaxKind> token2) where TSyntaxKind : struct 15public static TextSpan GetSpan(VirtualCharSequence virtualChars) 18public static TextSpan GetSpan(VirtualChar firstChar, VirtualChar lastChar) 19=> TextSpan.FromBounds(firstChar.Span.Start, lastChar.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (6)
42private TextSpan? _fullSpan; 56public TextSpan GetSpan() 63return TextSpan.FromBounds(start, end); 66public TextSpan? GetFullSpan() 69private TextSpan? ComputeFullSpan() 76return TextSpan.FromBounds(start.Value, end.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (2)
68/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 96public TextSpan Span => new(TokenStart + Green.Offset, Green.Width);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharGreenSequence.Chunks.cs (1)
50var span = new VirtualChar(ch, tokenStart).Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
50private readonly TextSpan _span; 57private VirtualCharGreenSequence(Chunk sequence, TextSpan span) 114TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharUtilities.cs (4)
15public static TextSpan FromBounds(VirtualChar vc1, VirtualChar vc2) 16=> TextSpan.FromBounds(vc1.Span.Start, vc2.Span.End); 26public static (ImmutableSegmentedList<VirtualChar> sourceCode, ImmutableArray<TextSpan> markdownSpans) StripMarkupCharacters( 29using var _ = ArrayBuilder<TextSpan>.GetInstance(out var markdownSpans);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (13)
13private static bool ShouldAnalyze(TextSpan? contextFilterSpan, TextSpan span) 23public static bool ShouldAnalyzeSpan(this SyntaxTreeAnalysisContext context, TextSpan span) 33public static bool ShouldAnalyzeSpan(this SemanticModelAnalysisContext context, TextSpan span) 43public static bool ShouldAnalyzeSpan(this SymbolStartAnalysisContext context, TextSpan span, SyntaxTree tree) 63public static bool ShouldAnalyzeSpan(this SymbolAnalysisContext context, TextSpan span, SyntaxTree tree) 83public static bool ShouldAnalyzeSpan(this AdditionalFileAnalysisContext context, TextSpan span) 93public static bool ShouldAnalyzeSpan(this OperationBlockStartAnalysisContext context, TextSpan span) 103public static bool ShouldAnalyzeSpan(this OperationBlockAnalysisContext context, TextSpan span) 113public static bool ShouldAnalyzeSpan(this OperationAnalysisContext context, TextSpan span) 123public static bool ShouldAnalyzeSpan(this SyntaxNodeAnalysisContext context, TextSpan span) 133public static bool ShouldAnalyzeSpan<TSytnaxKind>(this CodeBlockStartAnalysisContext<TSytnaxKind> context, TextSpan span) where TSytnaxKind : struct 143public static bool ShouldAnalyzeSpan(this CodeBlockAnalysisContext context, TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (2)
32this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden, CancellationToken cancellationToken) 44this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (12)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate) 296public static TextSpan GetContainedSpan(this IEnumerable<SyntaxNode> nodes) 301var fullSpan = nodes.First().Span; 304fullSpan = TextSpan.FromBounds( 315public static bool OverlapsHiddenPosition(this SyntaxNode node, TextSpan span, CancellationToken cancellationToken) 323var textSpan = TextSpan.FromBounds(start, end); 409var spans = new List<TextSpan>(nodesToReplace.Count + tokensToReplace.Count + triviaToReplace.Count); 432TextSpan previous = default; 433foreach (var span in spans) 785public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 963var fullSpan = node.FullSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (3)
18public static bool OverlapsHiddenPosition([NotNullWhen(returnValue: true)] this SyntaxTree? tree, TextSpan span, CancellationToken cancellationToken) 98public static bool IsEntirelyHidden(this SyntaxTree tree, TextSpan span, CancellationToken cancellationToken) 252public static SyntaxNode FindNode(this SyntaxTree syntaxTree, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (22)
18public static IEnumerable<TextSpan> ToNormalizedSpans(this IEnumerable<TextSpan> spans) 21public static ImmutableArray<TextSpan> ToNormalizedSpans(this ImmutableArray<TextSpan> spans) 24public static TextSpan Collapse(this IEnumerable<TextSpan> spans) 29foreach (var span in spans) 48return TextSpan.FromBounds(start, end); 54public static bool IsAround(this TextSpan span, SyntaxNodeOrToken node) => IsAround(span, node, node); 60public static bool IsAround(this TextSpan span, SyntaxNodeOrToken startNode, SyntaxNodeOrToken endNode) 62var innerSpan = TextSpan.FromBounds(startNode.Span.Start, endNode.Span.End); 63var outerSpan = TextSpan.FromBounds(startNode.FullSpan.Start, endNode.FullSpan.End); 67public static IEnumerable<TextSpan> Subtract(this TextSpan span, TextSpan except) 81yield return TextSpan.FromBounds(span.Start, startSegmentEnd); 85yield return TextSpan.FromBounds(endSegmentStart, span.End); 88public static IEnumerable<TextSpan> Subtract(this IEnumerable<TextSpan> spans, TextSpan except)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\AbstractSyntaxFormatting.cs (3)
21private static readonly Func<TextSpan, bool> s_notEmpty = s => !s.IsEmpty; 32public IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 34IReadOnlyList<TextSpan> spansToFormat;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.AnchorData.cs (4)
18public TextSpan TextSpan => operation.TextSpan; 34TextSpan IIntervalIntrospector<AnchorData>.GetSpan(AnchorData value) 37TextSpan IIntervalIntrospector<IndentationData>.GetSpan(IndentationData value) 40TextSpan IIntervalIntrospector<RelativeIndentationData>.GetSpan(RelativeIndentationData value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (18)
45private readonly HashSet<TextSpan> _indentationMap = []; 46private readonly HashSet<TextSpan> _suppressWrappingMap = []; 47private readonly HashSet<TextSpan> _suppressSpacingMap = []; 48private readonly HashSet<TextSpan> _suppressFormattingMap = []; 49private readonly HashSet<TextSpan> _anchorMap = []; 140var baseSpan = _initialIndentBlockOperations[0].TextSpan; 159var operationSpan = operations[i].TextSpan; 180var intervalTreeSpan = operation.TextSpan; 409private static void DebugCheckEmpty<T, TIntrospector>(ContextMutableIntervalTree<T, TIntrospector> tree, TextSpan textSpan) 448var span = token.Span; 469var span = token.Span; 592public bool IsWrappingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 614public bool IsSpacingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 643var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End); 650public bool IsFormattingDisabled(TextSpan textSpan) 658var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.IndentationData.cs (14)
17private abstract class IndentationData(TextSpan textSpan) 19public TextSpan TextSpan { get; } = textSpan; 22public IndentationData WithTextSpan(TextSpan span) 25protected abstract IndentationData WithTextSpanCore(TextSpan span); 28private sealed class SimpleIndentationData(TextSpan textSpan, int indentation) : IndentationData(textSpan) 32protected override IndentationData WithTextSpanCore(TextSpan span) 56public RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter) 67this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 70private RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter, int lazyIndentationDelta) 81this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 84public TextSpan InseparableRegionSpan { get; } 106protected override IndentationData WithTextSpanCore(TextSpan span) 118public AdjustedIndentationData(TextSpan textSpan, IndentationData baseIndentationData, int adjustment) 141protected override IndentationData WithTextSpanCore(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ContextMutableIntervalTree.cs (4)
40var thisSpan = introspector.GetSpan(value); 52var thisSpan = introspector.GetSpan(value); 125var resultSpan = Introspector.GetSpan(result!); 126var currentNodeSpan = Introspector.GetSpan(currentNode.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (5)
44protected readonly TextSpan SpanToFormat; 336private TextSpan GetSpanToFormat() 341return TextSpan.FromBounds(startPosition, endPosition); 458var spanBetweenTokens = TextSpan.FromBounds(token1.Span.End, token2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (4)
26public readonly TextSpan FormattedSpan; 31TextSpan formattedSpan) 78var span = TextSpan.FromBounds(token1.RawKind == 0 ? this.TreeInfo.StartPosition : token1.Span.End, token2.RawKind == 0 ? this.TreeInfo.EndPosition : token2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.NodeAndText.cs (3)
37return _text.ToString(TextSpan.FromBounds(token2.FullSpan.Start, token2.SpanStart)); 43return _text.ToString(TextSpan.FromBounds(token1.Span.End, token1.FullSpan.End)); 46return _text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (13)
239var span = textChange.Span; 267internal static IEnumerable<TextSpan> GetAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 277static IEnumerable<TextSpan> EnumerateAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 295internal static TextSpan GetSpanIncludingPreviousAndNextTokens(SyntaxToken firstToken, SyntaxToken lastToken) 307return TextSpan.FromBounds(start, end); 310internal static TextSpan GetElasticSpan(SyntaxToken token) 313private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 315var aggregateSpans = new List<TextSpan>(); 317var last = default(TextSpan); 318foreach (var span in spans) 326last = TextSpan.FromBounds(last.Start, span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (10)
20private readonly TextSpan _span; 22public BaseIndentationFormattingRule(SyntaxNode root, TextSpan span, int baseIndentation, AbstractFormattingRule? vbHelperFormattingRule = null) 130private TextSpan AdjustTextSpan(TextSpan textSpan) 131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End)); 133private static void SetInnermostNodeForSpan(SyntaxNode root, ref TextSpan span, out SyntaxToken token1, out SyntaxToken token2, out SyntaxNode? commonNode) 149private static void GetTokens(SyntaxNode root, TextSpan span, out SyntaxToken token1, out SyntaxToken token2) 168private static TextSpan GetSpanFromTokens(TextSpan span, SyntaxToken token1, SyntaxToken token2) 217return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\FormattingOperations.cs (8)
30=> CreateAnchorIndentationOperation(anchorToken, endToken, TextSpan.FromBounds(anchorToken.Span.End, endToken.Span.End)); 35public static AnchorIndentationOperation CreateAnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 42=> CreateSuppressOperation(startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End), option); 47private static SuppressOperation CreateSuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option) 55var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 62public static IndentBlockOperation CreateIndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 70var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 78public static IndentBlockOperation CreateRelativeIndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\IndentBlockOperation.cs (3)
14internal IndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 33internal IndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 56public TextSpan TextSpan { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\SuppressOperation.cs (2)
14public readonly TextSpan TextSpan; 19internal SuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (13)
45private delegate void WhitespaceAppender<T>(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<T> changes); 387var span = GetTextSpan(trivia1, trivia2); 499var span = TextSpan.FromBounds(start, end); 715var insertionPoint = GetInsertionSpan(changes); 730private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 765TextSpan notUsed, 822private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 825private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes) 831private TextSpan GetTextSpan(SyntaxTrivia trivia1, SyntaxTrivia trivia2) 835return TextSpan.FromBounds(this.StartPosition, trivia2.FullSpan.Start); 840return TextSpan.FromBounds(trivia1.FullSpan.End, this.EndPosition); 843return TextSpan.FromBounds(trivia1.FullSpan.End, trivia2.FullSpan.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\AbstractUnnecessaryImportsProvider.cs (3)
23public ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken) 27SemanticModel model, TextSpan? span, Func<SyntaxNode, bool>? predicate, CancellationToken cancellationToken) 35bool HasImportThatIntersectsWithSpan(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (3)
237private TextSpan GetNormalizedSpan(int position) 241return TextSpan.FromBounds(LineToBeIndented.Start, position); 244return TextSpan.FromBounds(position, LineToBeIndented.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (3)
29using var parts = TemporaryArray<TextSpan>.Empty; 73private static ImmutableArray<string> CreateWords(in TemporaryArray<TextSpan> parts, string name) 76foreach (var part in parts)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (21)
160var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 174private WordSpanEnumerable GetWordSpans(string name, TextSpan nameSpan) 177private static string Substring(string name, TextSpan wordSpan) 180private static readonly Func<string, TextSpan, bool> s_firstCharIsLowerCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsLower(val[span.Start]); 181private static readonly Func<string, TextSpan, bool> s_firstCharIsUpperCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsUpper(val[span.Start]); 183private static readonly Func<string, TextSpan, bool> s_wordIsAllUpperCase = (val, span) => 196private static readonly Func<string, TextSpan, bool> s_wordIsAllLowerCase = (val, span) => 210string name, TextSpan nameSpan, Func<string, TextSpan, bool> wordCheck, 216foreach (var wordSpan in GetWordSpans(name, nameSpan)) 232private bool CheckPascalCase(string name, TextSpan nameSpan, out string reason) 237private bool CheckAllUpper(string name, TextSpan nameSpan, out string reason) 242private bool CheckAllLower(string name, TextSpan nameSpan, out string reason) 248string name, TextSpan nameSpan, 249Func<string, TextSpan, bool> firstWordCheck, 250Func<string, TextSpan, bool> restWordCheck, 260foreach (var wordSpan in GetWordSpans(name, nameSpan)) 291private bool CheckCamelCase(string name, TextSpan nameSpan, out string reason) 298private bool CheckFirstUpper(string name, TextSpan nameSpan, out string reason) 406using var parts = TemporaryArray<TextSpan>.Empty;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (4)
16private readonly TextSpan _nameSpan; 19public WordSpanEnumerator(string name, TextSpan nameSpan, string wordSeparator) 28public TextSpan Current { get; private set; } 70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\RefactoringHelpers\AbstractRefactoringHelpers.cs (10)
39/// Returns unchanged <paramref name="span"/> in case <see cref="TextSpan.IsEmpty"/>. 40/// Returns empty Span with original <see cref="TextSpan.Start"/> in case it contains only whitespace. 42private static TextSpan GetTrimmedTextSpan(SourceText sourceText, TextSpan span) 56return TextSpan.FromBounds(start, end); 60SourceText sourceText, SyntaxNode root, TextSpan selectionRaw, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 69var selectionTrimmed = GetTrimmedTextSpan(sourceText, selectionRaw); 354var rightNodeSpanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, rightNode); 366TextSpan selectionTrimmed, 384var spanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, nonHiddenExtractedNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\RefactoringHelpers\IRefactoringHelpers.cs (1)
55SourceText sourceText, SyntaxNode root, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (4)
34SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 38SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 42SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, 77SyntaxNode root, SourceText text, TextSpan textSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
429TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 432/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 433/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 435/// an empty <see cref="TextSpan"/> at position 0. 438TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 479bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(firstNode.Span.Start, lastNode.Span.End); 182this ISyntaxFacts syntaxFacts, TextSpan span, SyntaxNode node, CancellationToken cancellationToken) 441public static TextSpan GetSpanWithoutAttributes(this ISyntaxFacts syntaxFacts, SyntaxNode root, SyntaxNode node) 461return TextSpan.FromBounds(startOfNodeWithoutAttributes, endOfNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (6)
36private readonly TextSpan[] _wordSpans; 101_wordSpans = new TextSpan[distinctValues.Length]; 177private void Add(TextSpan characterSpan, int insertionIndex) 218TextSpan characterSpan, int insertionIndex, int currentNodeEdgeCount, int currentNodeIndex, int editDistance) 286private struct BuilderNode(TextSpan characterSpan) 288public readonly TextSpan CharacterSpan = characterSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (2)
11private readonly struct Node(TextSpan wordSpan, int edgeCount, int firstEdgeIndex) 17public readonly TextSpan WordSpan = wordSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (10)
45public static IEnumerable<(SyntaxToken, SyntaxToken)> ConvertToTokenPairs(this SyntaxNode root, IReadOnlyList<TextSpan> spans) 81public static ValueTuple<SyntaxToken, SyntaxToken> ConvertToTokenPair(this SyntaxNode root, TextSpan textSpan) 157=> (token1.RawKind == 0) ? text.ToString(TextSpan.FromBounds(0, token2.SpanStart)) : text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart)); 259public static TextSpan GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(SyntaxToken startToken, SyntaxToken endToken) 266return TextSpan.FromBounds(startPosition, endPosition); 324var fullSpan = node.FullSpan; 357public static TextSpan GetFormattingSpan(SyntaxNode root, TextSpan span) 367return TextSpan.FromBounds(startPosition, endPosition);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
17public static void AddWordParts(ReadOnlySpan<char> identifier, ref TemporaryArray<TextSpan> parts) 20public static void AddCharacterParts(ReadOnlySpan<char> identifier, ref TemporaryArray<TextSpan> parts) 23public static void AddParts(ReadOnlySpan<char> text, bool word, ref TemporaryArray<TextSpan> parts) 27var span = StringBreaker.GenerateSpan(text, start, word); 41public static TextSpan GenerateSpan(ReadOnlySpan<char> identifier, int wordStart, bool word) 81private static TextSpan ScanCharacterRun(ReadOnlySpan<char> identifier, int length, int wordStart) 102private static TextSpan ScanWordRun(ReadOnlySpan<char> identifier, int length, int wordStart) 151private static TextSpan ScanLowerCaseRun(ReadOnlySpan<char> identifier, int length, int wordStart) 162private static TextSpan ScanNumber(ReadOnlySpan<char> identifier, int length, int wordStart) 170return TextSpan.FromBounds(wordStart, current);
Microsoft.CodeAnalysis.VisualBasic (158)
Analysis\FlowAnalysis\AbstractFlowPass.Regions.vb (2)
27Protected ReadOnly _region As TextSpan 52Protected Function IsInsideRegion(span As TextSpan) As Boolean
Analysis\FlowAnalysis\FlowAnalysisInfo.vb (2)
45Public ReadOnly Region As TextSpan 47Public Sub New(_firstInRegion As BoundNode, _lastInRegion As BoundNode, _region As TextSpan)
Analysis\FlowAnalysis\RegionAnalysisContext.vb (2)
31Private ReadOnly _region As TextSpan 53Friend Sub New(compilation As VisualBasicCompilation, member As Symbol, boundNode As BoundNode, firstInRegion As BoundNode, lastInRegion As BoundNode, region As textspan)
Binding\Binder.vb (1)
659Public Function GetLocation(span As TextSpan) As Location
Binding\Binder_Invocation.vb (1)
3282Private Shared Function GetCallerLocation(syntax As SyntaxNode) As TextSpan
Binding\Binder_Query.vb (11)
829Dim operatorNameLocation As TextSpan 1145Dim operatorNameLocation As TextSpan 1837Private Shared Function GetGroupByOperatorNameSpan(groupBy As GroupByClauseSyntax) As TextSpan 2268Private Shared Function GetQueryOperatorNameSpan(ByRef left As SyntaxToken, ByRef right As SyntaxToken) As TextSpan 2269Dim operatorNameSpan As TextSpan = left.Span 2272operatorNameSpan = TextSpan.FromBounds(operatorNameSpan.Start, right.Span.End) 2304operatorNameLocation As TextSpan, 2581Dim operatorNameLocation As TextSpan 4591operatorNameLocation As TextSpan, 4609operatorNameLocation As TextSpan, 4630operatorNameLocation As TextSpan,
Binding\MemberSemanticModel.vb (4)
412Public NotOverridable Overrides Function GetSyntaxDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 427Public NotOverridable Overrides Function GetDeclarationDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 442Public NotOverridable Overrides Function GetMethodBodyDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 459Public NotOverridable Overrides Function GetDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic)
CodeGen\CodeGenerator.vb (2)
298Private Function EmitSequencePoint(tree As SyntaxTree, span As TextSpan) As TextSpan
CommandLine\CommandLineDiagnosticFormatter.vb (1)
130Private Function GetDiagnosticSpanAndFileText(diagnostic As Diagnostic, <Out> ByRef text As SourceText) As TextSpan?
Compilation\ClsComplianceChecker.vb (3)
29Private ReadOnly _filterSpanWithinTree As TextSpan? 40Private Sub New(compilation As VisualBasicCompilation, filterTree As SyntaxTree, filterSpanWithinTree As TextSpan?, diagnostics As BindingDiagnosticBag, cancellationToken As CancellationToken) 72Public Shared Sub CheckCompliance(compilation As VisualBasicCompilation, diagnostics As BindingDiagnosticBag, cancellationToken As CancellationToken, Optional filterTree As SyntaxTree = Nothing, Optional filterSpanWithinTree As TextSpan? = Nothing)
Compilation\DocumentationComments\DocumentationCommentCompiler.Includes.vb (3)
33Private ReadOnly _filterSpanWithinTree As TextSpan? 48filterSpanWithinTree As TextSpan?, 157filterSpanWithinTree As TextSpan?,
Compilation\DocumentationComments\DocumentationCommentCompiler.vb (3)
28Private ReadOnly _filterSpanWithinTree As TextSpan? ' if filterTree and filterSpanWithinTree is not null, limit analysis to types residing within this span in the filterTree. 37filterTree As SyntaxTree, filterSpanWithinTree As TextSpan?, 67Optional filterSpanWithinTree As TextSpan? = Nothing)
Compilation\DocumentationComments\UnprocessedDocumentationCommentFinder.vb (4)
24Private ReadOnly _filterSpanWithinTree As TextSpan? 30filterSpanWithinTree As TextSpan?, 43Public Shared Sub ReportUnprocessed(tree As SyntaxTree, filterSpanWithinTree As TextSpan?, diagnostics As DiagnosticBag, cancellationToken As CancellationToken) 50Private Function IsSyntacticallyFilteredOut(fullSpan As TextSpan) As Boolean
Compilation\MethodCompiler.vb (2)
121Private Shared Function IsDefinedOrImplementedInSourceTree(symbol As Symbol, tree As SyntaxTree, span As TextSpan?) As Boolean 159filterSpanWithinTree As TextSpan?,
Compilation\SemanticModel.vb (1)
3514Friend Overrides Sub ComputeDeclarationsInSpan(span As TextSpan, getSymbol As Boolean, builder As ArrayBuilder(Of DeclarationInfo), cancellationToken As CancellationToken)
Compilation\SpeculativeSemanticModelWithMemberModel.vb (4)
137Public Overrides Function GetSyntaxDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 141Public Overrides Function GetDeclarationDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 145Public Overrides Function GetMethodBodyDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 149Public Overrides Function GetDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic)
Compilation\SpeculativeSyntaxTreeSemanticModel.vb (3)
113Public Overrides Function GetSyntaxDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 117Public Overrides Function GetDeclarationDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 121Public Overrides Function GetDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic)
Compilation\SyntaxTreeSemanticModel.vb (7)
93Public Overrides Function GetDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 105Public Overrides Function GetSyntaxDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 120Public Overrides Function GetDeclarationDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 135Public Overrides Function GetMethodBodyDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 1891Dim region As TextSpan = expression.Span 1907Dim region As TextSpan = TextSpan.FromBounds(firstStatement.SpanStart, lastStatement.Span.End)
Compilation\VisualBasicCompilation.vb (11)
1708Dim unusedBuilder As ArrayBuilder(Of TextSpan) = Nothing 1733unusedBuilder = ArrayBuilder(Of TextSpan).GetInstance() 1762Private Sub AddImportsDependencies(diagnostics As BindingDiagnosticBag, infoTree As SyntaxTree, clauseSpan As TextSpan) 1834Public ReadOnly StatementSpan As TextSpan 1835Public ReadOnly ClauseSpans As ImmutableArray(Of TextSpan) 1845Dim builder = ArrayBuilder(Of TextSpan).GetInstance() 2181Dim location = tree.GetLocation(TextSpan.FromBounds(0, 0)) 2214Private Sub AddClsComplianceDiagnostics(diagnostics As BindingDiagnosticBag, cancellationToken As CancellationToken, Optional filterTree As SyntaxTree = Nothing, Optional filterSpanWithinTree As TextSpan? = Nothing) 2235Private Shared Iterator Function FilterDiagnosticsByLocation(diagnostics As IEnumerable(Of Diagnostic), tree As SyntaxTree, filterSpanWithinTree As TextSpan?) As IEnumerable(Of Diagnostic) 2245filterSpanWithinTree As TextSpan?, 2302Private Sub GetDiagnosticsForMethodBodiesInTree(tree As SyntaxTree, filterSpanWithinTree As TextSpan?, hasDeclarationErrors As Boolean, diagnostics As BindingDiagnosticBag, cancellationToken As CancellationToken)
Errors\ErrorFacts.vb (1)
9''' <see cref="SemanticModel.GetDiagnostics(Text.TextSpan?, System.Threading.CancellationToken)"/> API.
Generated\BoundNodes.xml.Generated.vb (4)
2573Public Sub New(syntax As SyntaxNode, statementOpt As BoundStatement, span As TextSpan, Optional hasErrors As Boolean = False) 2587Private ReadOnly _Span As TextSpan 2588Public ReadOnly Property Span As TextSpan 2599Public Function Update(statementOpt As BoundStatement, span As TextSpan) As BoundSequencePointWithSpan
Locations\EmbeddedTreeLocation.vb (3)
17Friend ReadOnly _span As TextSpan 31Friend Overrides ReadOnly Property PossiblyEmbeddedOrMySourceSpan As TextSpan 43Public Sub New(embeddedKind As EmbeddedSymbolKind, span As TextSpan)
Locations\LocationExtensions.vb (1)
23Public Function PossiblyEmbeddedOrMySourceSpan(location As Location) As TextSpan
Locations\MyTemplateLocation.vb (3)
16Private ReadOnly _span As TextSpan 25Friend Overrides ReadOnly Property PossiblyEmbeddedOrMySourceSpan As TextSpan 37Public Sub New(tree As SyntaxTree, span As TextSpan)
Locations\VBLocation.vb (1)
23Friend Overridable ReadOnly Property PossiblyEmbeddedOrMySourceSpan As TextSpan
Lowering\Instrumentation\CodeCoverageInstrumenter.vb (5)
449Private Function AddAnalysisPoint(syntaxForSpan As SyntaxNode, alternateSpan As Text.TextSpan, statementFactory As SyntheticBoundNodeFactory) As BoundStatement 520Private Shared Function SkipAttributes(syntax As SyntaxNode) As Text.TextSpan 546Private Shared Function SkipAttributes(syntax As SyntaxNode, attributes As SyntaxList(Of AttributeListSyntax), modifiers As SyntaxTokenList, keyword As SyntaxToken) As Text.TextSpan 547Dim originalSpan As Text.TextSpan = syntax.Span 549Dim startSpan As Text.TextSpan = If(modifiers.Node IsNot Nothing, modifiers.Span, keyword.Span)
Lowering\Instrumentation\DebugInfoInjector.vb (5)
105Dim sequencePointSpan As TextSpan 125sequencePointSpan = TextSpan.FromBounds(aggregateClause.SpanStart, 128sequencePointSpan = TextSpan.FromBounds(aggregateClause.SpanStart, 138sequencePointSpan = TextSpan.FromBounds(original.Syntax.SpanStart, original.Syntax.Span.End) 209condGoto = New BoundSequencePointWithSpan(asSingleLine, condGoto, TextSpan.FromBounds(asSingleLine.IfKeyword.SpanStart, asSingleLine.ThenKeyword.EndPosition - 1))
Lowering\Instrumentation\DebugInfoInjector_SequencePoints.vb (2)
105Dim statementSpanWithoutAttributes = TextSpan.FromBounds(firstModifierOrKeyword.SpanStart, methodStatement.Span.End) 124Dim span = TextSpan.FromBounds(propertyStatement.Identifier.SpanStart,
Lowering\SyntheticBoundNodeFactory.vb (1)
1117Public Function SequencePointWithSpan(syntax As SyntaxNode, textSpan As TextSpan, boundStatement As BoundStatement) As BoundStatement
Scanner\Blender.vb (8)
92Private Shared Function ExpandToNearestStatements(root As VisualBasic.VisualBasicSyntaxNode, span As TextSpan) As TextSpan 101Return TextSpan.FromBounds(start.Start, [end].End) 111rootFullSpan As TextSpan) As TextSpan 154Private Shared Function ExpandByLookAheadAndBehind(root As VisualBasic.VisualBasicSyntaxNode, span As TextSpan) As TextSpan 181Return TextSpan.FromBounds(start, [end])
Scanner\Scanner.vb (3)
258Public Function SkipToNextConditionalLine() As TextSpan 326Return TextSpan.FromBounds(start, condLineStart) 347Friend Function GetDisabledTextAt(span As TextSpan) As SyntaxTrivia
src\roslyn\src\Compilers\VisualBasic\BasicAnalyzerDriver\VisualBasicDeclarationComputer.vb (1)
16span As TextSpan,
Symbols\NamedTypeSymbolExtensions.vb (2)
24Friend Function FindMember(container As NamedTypeSymbol, symbolName As String, kind As SymbolKind, nameSpan As TextSpan, tree As SyntaxTree) As Symbol 55Friend Function FindFieldOrProperty(container As NamedTypeSymbol, symbolName As String, nameSpan As TextSpan, tree As SyntaxTree) As Symbol
Symbols\NamespaceSymbol.vb (1)
391Friend Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Symbols\Source\SourceComplexParameterSymbol.vb (1)
201Friend NotOverridable Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Symbols\Source\SourceEventSymbol.vb (1)
457Friend NotOverridable Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Symbols\Source\SourceFieldSymbol.vb (2)
874Private Shared Function GetFieldLocationFromSyntax(node As SyntaxToken) As TextSpan 885Dim nameSpan As TextSpan = GetFieldLocationFromSyntax(variableName)
Symbols\Source\SourceFile.vb (4)
161Private Function BindFileInformation(diagBag As DiagnosticBag, cancellationToken As CancellationToken, Optional filterSpan As TextSpan? = Nothing) As BoundFileInformation 193Optional filterSpan As TextSpan? = Nothing) 247Optional filterSpan As TextSpan? = Nothing) 468Friend Function GetDeclarationErrorsInSpan(filterSpan As TextSpan, cancellationToken As CancellationToken) As IEnumerable(Of Diagnostic)
Symbols\Source\SourceMemberFieldSymbol.vb (1)
52Friend NotOverridable Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Symbols\Source\SourceMethodSymbol.vb (3)
804Friend NotOverridable Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean 861Private Shared Function GetMethodLocationFromSyntax(node As VisualBasicSyntaxNode) As TextSpan 1204Dim span As TextSpan
Symbols\Source\SourceModuleSymbol.vb (2)
585filterSpanWithinTree As TextSpan?, 586locationFilter As Func(Of IEnumerable(Of Diagnostic), SyntaxTree, TextSpan?, IEnumerable(Of Diagnostic)),
Symbols\Source\SourceNamespaceSymbol.vb (2)
310Friend Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean 354Friend Sub GenerateDeclarationErrorsInTree(tree As SyntaxTree, filterSpanWithinTree As TextSpan?, cancellationToken As CancellationToken)
Symbols\Source\SourcePropertySymbol.vb (1)
464Friend Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Symbols\Symbol.vb (2)
911Friend Overridable Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean Implements ISymbolInternal.IsDefinedInSourceTree 931Friend Shared Function IsDefinedInSourceTree(syntaxNode As SyntaxNode, tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Syntax\SimpleSyntaxReference.vb (1)
29Public Overrides ReadOnly Property Span As TextSpan
Syntax\SyntaxNodeRemover.vb (12)
35Private ReadOnly _searchSpan As TextSpan 47Private Shared Function ComputeTotalSpan(nodes As SyntaxNode()) As TextSpan 239Dim fullSpan = TextSpan.FromBounds(token.FullSpan.Start, node.FullSpan.End) 240Dim span = TextSpan.FromBounds(token.Span.Start, node.Span.End) 263Dim fullSpan = TextSpan.FromBounds(node.FullSpan.Start, token.FullSpan.End) 264Dim span = TextSpan.FromBounds(node.Span.Start, token.Span.End) 282Private Function GetRemovedSpan(span As TextSpan, fullSpan As TextSpan) As TextSpan 285removedSpan = TextSpan.FromBounds(span.Start, removedSpan.End) 288removedSpan = TextSpan.FromBounds(removedSpan.Start, span.End) 293Private Sub AddDirectives(node As SyntaxNode, span As TextSpan)
Syntax\SyntaxNormalizer.vb (2)
16Private ReadOnly _consideredSpan As TextSpan 44Private Sub New(consideredSpan As TextSpan, indentWhitespace As String, eolWhitespace As String, useElasticTrivia As Boolean, useDefaultCasing As Boolean)
Syntax\SyntaxReplacer.vb (9)
62Private ReadOnly _spanSet As HashSet(Of TextSpan) 63Private ReadOnly _totalSpan As TextSpan 83Me._spanSet = New HashSet(Of TextSpan)(Me._nodeSet.Select(Function(n) n.FullSpan).Concat( 112Private Shared Function ComputeTotalSpan(spans As IEnumerable(Of TextSpan)) As TextSpan 131Private Function ShouldVisit(span As TextSpan) As Boolean 238Private ReadOnly _elementSpan As TextSpan 244elementSpan As TextSpan, 260Private Function ShouldVisit(span As TextSpan) As Boolean
Syntax\VisualBasicLineDirectiveMap.vb (1)
209Friend Overrides Function TranslateSpanAndVisibility(sourceText As SourceText, treeFilePath As String, span As TextSpan, ByRef isHiddenPosition As Boolean) As FileLinePositionSpan
Syntax\VisualBasicSyntaxNode.vb (1)
142''' Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>.
Syntax\VisualBasicSyntaxTree.vb (5)
437Public Overrides Function GetLineSpan(span As TextSpan, Optional cancellationToken As CancellationToken = Nothing) As FileLinePositionSpan 451Public Overrides Function GetMappedLineSpan(span As TextSpan, Optional cancellationToken As CancellationToken = Nothing) As FileLinePositionSpan 460Friend Overrides Function GetMappedLineSpanAndVisibility(span As TextSpan, ByRef isHiddenPosition As Boolean) As FileLinePositionSpan 494Public Overrides Function GetLocation(span As TextSpan) As Location 522Public Overrides Function GetChangedSpans(oldTree As SyntaxTree) As IList(Of TextSpan)
Microsoft.CodeAnalysis.VisualBasic.Analyzers (1)
MetaAnalyzers\Fixers\BasicPreferIsKindFix.vb (1)
23Protected Overrides Function TryGetNodeToFix(root As SyntaxNode, span As TextSpan) As SyntaxNode
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (35)
src\roslyn\src\Analyzers\VisualBasic\Analyzers\RemoveUnnecessaryCast\VisualBasicRemoveUnnecessaryCastDiagnosticAnalyzer.vb (1)
35Protected Overrides Function GetFadeSpan(node As ExpressionSyntax) As TextSpan
src\roslyn\src\Analyzers\VisualBasic\Analyzers\RemoveUnnecessaryImports\VisualBasicRemoveUnnecessaryImportsDiagnosticAnalyzer.vb (1)
56nodes As IEnumerable(Of SyntaxNode), tree As SyntaxTree, cancellationToken As CancellationToken) As IEnumerable(Of TextSpan)
src\roslyn\src\Analyzers\VisualBasic\Analyzers\UseInferredMemberName\VisualBasicUseInferredMemberNameDiagnosticAnalyzer.vb (2)
52Dim fadeSpan = TextSpan.FromBounds(nameColonEquals.Name.SpanStart, nameColonEquals.ColonEqualsToken.Span.End) 73Dim fadeSpan = TextSpan.FromBounds(fieldInitializer.Name.SpanStart, fieldInitializer.EqualsToken.Span.End)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (6)
381textSpan As TextSpan, 389textSpan As TextSpan, 405textSpan As TextSpan, 857Public Function CheckTopLevel(node As SyntaxNode, span As TextSpan) As Boolean 881Public Function ContainsInMethodBlockBody(block As MethodBlockBaseSyntax, textSpan As TextSpan) As Boolean 886Dim blockSpan = TextSpan.FromBounds(block.BlockStatement.Span.End, block.EndBlockStatement.SpanStart)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\FormattingResult.vb (1)
21Friend Sub New(treeInfo As TreeData, tokenStream As TokenStream, spanToFormat As TextSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
96Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.vb (1)
58Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
89Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (5)
84Private Function GetTextSpan(pair As ValueTuple(Of SyntaxToken, SyntaxToken)) As TextSpan 86Return TextSpan.FromBounds(_node.FullSpan.Start, pair.Item2.SpanStart) 90Return TextSpan.FromBounds(pair.Item1.Span.End, _node.FullSpan.End) 93Return TextSpan.FromBounds(pair.Item1.Span.End, pair.Item2.SpanStart) 108Private Shared Function GetSyntaxTriviaList(textSpan As TextSpan, triviaData As TriviaData, cancellationToken As CancellationToken) As SyntaxTriviaList
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Rules\BaseFormattingRule.vb (8)
28Optional textSpan As TextSpan = Nothing, 38Protected Shared Sub SetAlignmentBlockOperation(operations As List(Of IndentBlockOperation), baseToken As SyntaxToken, startToken As SyntaxToken, endToken As SyntaxToken, span As TextSpan, Optional [option] As IndentBlockOption = IndentBlockOption.RelativePosition) 46Protected Shared Sub AddAbsolutePositionIndentBlockOperation(operations As List(Of IndentBlockOperation), startToken As SyntaxToken, endToken As SyntaxToken, indentation As Integer, span As TextSpan, Optional [option] As IndentBlockOption = IndentBlockOption.AbsolutePosition) 50Private Shared Function GetAlignmentSpan(startToken As SyntaxToken, endToken As SyntaxToken) As TextSpan 52Return TextSpan.FromBounds(previousToken.Span.End, endToken.FullSpan.End) 55Private Shared Function GetIndentBlockSpan(startToken As SyntaxToken, endToken As SyntaxToken) As TextSpan 64Return TextSpan.FromBounds(spanStart, trivia.FullSpan.Start) 68Return TextSpan.FromBounds(spanStart, nextToken.SpanStart)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Rules\NodeBasedFormattingRule.vb (2)
79AddIndentBlockOperation(operations, baseToken, startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)) 157operations.Add(FormattingOperations.CreateIndentBlockOperation(caseBlockLastToken, nextTokenAfterCase, TextSpan.FromBounds(caseBlockLastToken.Span.End, nextTokenAfterCase.SpanStart), 1, IndentBlockOption.RelativePosition))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Indentation\VisualBasicSmartTokenFormatter.vb (1)
41Dim spans = SpecializedCollections.SingletonEnumerable(TextSpan.FromBounds(previousToken.SpanStart, token.Span.End))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (4)
829Public Function GetMemberBodySpanForSpeculativeBinding(node As SyntaxNode) As TextSpan Implements ISyntaxFacts.GetMemberBodySpanForSpeculativeBinding 852Return TextSpan.FromBounds(spanStart, method.EndBlockStatement.SpanStart) 1084Public Function GetInactiveRegionSpanAroundPosition(tree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As TextSpan Implements ISyntaxFacts.GetInactiveRegionSpanAroundPosition 1415Public Function ContainsInterleavedDirective(span As TextSpan, token As SyntaxToken, cancellationToken As CancellationToken) As Boolean Implements ISyntaxFacts.ContainsInterleavedDirective
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (17)
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\GenerateDefaultConstructors\VisualBasicGenerateDefaultConstructorsService.vb (1)
24semanticDocument As SemanticDocument, textSpan As TextSpan, cancellationToken As CancellationToken,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeFixesAndRefactorings\VisualBasicFixAllSpanMappingService.vb (3)
22Protected Overrides Function GetFixAllSpansIfWithinGlobalStatementAsync(document As Document, diagnosticSpan As TextSpan, cancellationToken As CancellationToken) As Task(Of ImmutableDictionary(Of Document, ImmutableArray(Of TextSpan))) 24Return Task.FromResult(ImmutableDictionary(Of Document, ImmutableArray(Of TextSpan)).Empty)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (2)
72indices.Add(Not destination.OverlapsHiddenPosition(TextSpan.FromBounds(0, destination.Members.First.SpanStart), cancellationToken)) 85TextSpan.FromBounds(destination.Members.Last.Span.End, destination.EndOfFileToken.SpanStart), cancellationToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\CompilationUnitSyntaxExtensions.vb (2)
32Return Not contextNode.SyntaxTree.OverlapsHiddenPosition(TextSpan.FromBounds(start, [end]), cancellationToken) 39Return Not contextNode.SyntaxTree.OverlapsHiddenPosition(TextSpan.FromBounds(start, [end]), cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (1)
221Public Function GetImplicitMemberAccessExpressions(expression As SyntaxNode, span As TextSpan) As IEnumerable(Of ExpressionSyntax)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Formatting\VisualBasicSyntaxFormattingService.vb (1)
32Public Function GetFormattingChangesOnPaste(document As ParsedDocument, textSpan As TextSpan, options As SyntaxFormattingOptions, cancellationToken As CancellationToken) As ImmutableArray(Of TextChange) Implements ISyntaxFormattingService.GetFormattingChangesOnPaste
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\SpecialFormattingOperation.vb (5)
73TextSpan.FromBounds(startToken.FullSpan.Start, node.FullSpan.End), indentationDelta:=1, [option]:=IndentBlockOption.RelativePosition)) 111baseToken, startToken, endToken, TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End), indentationDelta, IndentBlockOption.RelativePosition)) 149Dim span As TextSpan 157span = TextSpan.FromBounds(baseToken.Span.End, firstToken.SpanStart) 160span = TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSymbolDeclarationService.vb (1)
51Public Overrides ReadOnly Property Span As TextSpan
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSyntaxFactsService.vb (1)
38Public Function GetSelectedFieldsAndPropertiesAsync(tree As SyntaxTree, textSpan As TextSpan, allowPartialSelection As Boolean, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of SyntaxNode)) Implements ISyntaxFactsService.GetSelectedFieldsAndPropertiesAsync
Microsoft.CodeAnalysis.VisualBasic.Features (218)
BraceMatching\VisualBasicDirectiveTriviaBraceMatcher.vb (2)
34Friend Overrides Function GetSpanForTagging(directive As DirectiveTriviaSyntax) As TextSpan 42Return TextSpan.FromBounds(directive.HashToken.SpanStart, keywordToken.Span.End)
CodeFixes\GenerateEndConstruct\GenerateEndConstructCodeFixProvider.vb (1)
252Dim updatedText = text.WithChanges(New TextChange(TextSpan.FromBounds(insertionPoint, insertionPoint), stringToAppend))
CodeFixes\IncorrectFunctionReturnType\IncorrectFunctionReturnTypeCodeFixProvider.vb (1)
74Private Shared Function GetNodeToFix(Of T As SyntaxNode)(token As SyntaxToken, span As TextSpan) As T
CodeFixes\MoveToTopOfFile\MoveToTopOfFileCodeFixProvider.MoveToLineCodeAction.vb (1)
39Dim textWithMovedLine = textWithoutLine.WithChanges(New TextChange(TextSpan.FromBounds(destinationLineSpan, destinationLineSpan), textLineToMove.ToString().TrimStart() + vbCrLf))
CodeRefactorings\MoveType\VisualBasicMoveTypeService.vb (1)
32Protected Overrides Async Function GetRelevantNodeAsync(document As Document, textSpan As TextSpan, cancellationToken As CancellationToken) As Task(Of TypeBlockSyntax)
CodeRefactorings\NodeSelectionHelpers.vb (1)
16Dim span As TextSpan = context.Span
CodeRefactorings\SyncNamespace\VisualBasicChangeNamespaceService.vb (1)
85Protected Overrides Function TryGetApplicableContainerFromSpanAsync(document As Document, span As TextSpan, cancellationToken As CancellationToken) As Task(Of SyntaxNode)
Completion\CompletionProviders\CompletionUtilities.vb (1)
23Public Function GetCompletionItemSpan(text As SourceText, position As Integer) As TextSpan
Completion\CompletionProviders\OverrideCompletionProvider.vb (1)
199Protected Overrides Function GetTargetSelectionSpan(caretTarget As SyntaxNode) As TextSpan
Completion\CompletionProviders\VisualBasicSuggestionModeCompletionProvider.vb (1)
33Protected Overrides Async Function GetSuggestionModeItemAsync(document As Document, position As Integer, itemSpan As TextSpan, trigger As CompletionTrigger, cancellationToken As CancellationToken) As Task(Of CompletionItem)
Completion\KeywordRecommenders\Statements\FinallyKeywordRecommender.vb (1)
43If TextSpan.FromBounds(tryBlock.CatchBlocks.Last().SpanStart, tryBlock.EndTryStatement.SpanStart).Contains(context.Position) Then
Completion\VisualBasicCompletionService.vb (1)
123Public Overrides Function GetDefaultCompletionListSpan(text As SourceText, caretPosition As Integer) As TextSpan
Debugging\DataTipInfoGetter.vb (1)
64span = TextSpan.FromBounds(conditionalAccess.SpanStart, span.End)
Debugging\VisualBasicBreakpointService.vb (2)
61Dim span As TextSpan 76Public Function ResolveBreakpointAsync(document As Document, textSpan As TextSpan, Optional cancellationToken As CancellationToken = Nothing) As Task(Of BreakpointResolutionResult) Implements IBreakpointResolutionService.ResolveBreakpointAsync
Diagnostics\Analyzers\VisualBasicSimplifyTypeNamesDiagnosticAnalyzer.vb (1)
75ByRef issueSpan As TextSpan, ByRef diagnosticId As String, ByRef inDeclaration As Boolean,
Diagnostics\VisualBasicAnalyzerDriverService.vb (1)
24span As TextSpan,
EditAndContinue\BreakpointSpans.vb (28)
13Friend Function TryGetBreakpointSpan(tree As SyntaxTree, position As Integer, cancellationToken As CancellationToken, <Out> ByRef breakpointSpan As TextSpan) As Boolean 58Public Function TryGetClosestBreakpointSpan(root As SyntaxNode, position As Integer, minLength As Integer, <Out> ByRef span As TextSpan) As Boolean 61Dim candidate As TextSpan? = Nothing 91Private Function CreateSpan(node As SyntaxNode) As TextSpan 92Return TextSpan.FromBounds(node.SpanStart, node.Span.End) 95Private Function TryCreateSpan(Of TNode As SyntaxNode)(list As SeparatedSyntaxList(Of TNode)) As TextSpan? 100Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End) 103Private Function TryCreateSpanForNode(node As SyntaxNode, position As Integer) As TextSpan? 174Return TextSpan.FromBounds(asSingleLine.IfKeyword.SpanStart, asSingleLine.ThenKeyword.Span.End) 235Private Function CreateSpanForMethodBase(methodBase As MethodBaseSyntax) As TextSpan 237Return TextSpan.FromBounds(methodBase.DeclarationKeyword.SpanStart, methodBase.Span.End) 240Return TextSpan.FromBounds(methodBase.Modifiers.First().SpanStart, methodBase.Span.End) 243Private Function TryCreateSpanForPropertyStatement(node As PropertyStatementSyntax) As TextSpan? 250Return TextSpan.FromBounds(node.Identifier.Span.Start, node.Initializer.Span.End) 254Return TextSpan.FromBounds(node.Identifier.Span.Start, node.AsClause.Span.End) 260Private Function TryCreateSpanForVariableDeclaration(modifiers As SyntaxTokenList, declarators As SeparatedSyntaxList(Of VariableDeclaratorSyntax), position As Integer) As TextSpan? 334Private Function TryCreateSpanForFromClause(fromClause As FromClauseSyntax, position As Integer) As TextSpan? 352Private Function TryCreateSpanForFunctionAggregation(functionAggregation As FunctionAggregationSyntax) As TextSpan? 360Private Function TryCreateSpanForOrderByClause(orderByClause As OrderByClauseSyntax, position As Integer) As TextSpan? 368Private Function TryCreateSpanForOrderingSyntax(orderingSyntax As OrderingSyntax) As TextSpan? 372Private Function TryCreateSpanForPartitionWhileClauseSyntax(partitionWhileClause As PartitionWhileClauseSyntax) As TextSpan? 376Private Function TryCreateSpanForCollectionRangeVariable(collectionRangeVariable As CollectionRangeVariableSyntax) As TextSpan? 392Private Function TryCreateSpanForWhereClause(clause As WhereClauseSyntax) As TextSpan? 396Private Function TryCreateSpanForGroupByClause(clause As GroupByClauseSyntax, position As Integer) As TextSpan? 417Return TextSpan.FromBounds(clause.Keys.First.SpanStart, clause.Span.End) 420Private Function TryCreateSpanForSelectClause(clause As SelectClauseSyntax) As TextSpan? 428Private Function TryCreateSpanForLetClause(clause As LetClauseSyntax, position As Integer) As TextSpan? 432Private Function TryCreateSpanForExpression(expression As ExpressionSyntax) As TextSpan?
EditAndContinue\DeclarationBody\FieldOrPropertyDeclarationBody.vb (2)
82span As TextSpan, partnerDeclarationBody As MemberBody, ByRef partnerStatement As SyntaxNode, ByRef statementPart As Integer) As SyntaxNode 121Public Overrides ReadOnly Property Envelope As TextSpan
EditAndContinue\DeclarationBody\FieldWithMultipleAsNewClauseDeclarationBody.vb (4)
40Public Overrides ReadOnly Property Envelope As TextSpan 42Return TextSpan.FromBounds(_modifedIdentifier.Span.Start, NewExpression.Span.End) 46Public Overrides Function IsExcludedActiveStatementSpanWithinEnvelope(span As TextSpan) As Boolean 48Return TextSpan.FromBounds(_modifedIdentifier.Span.End, NewExpression.Span.Start).Contains(span)
EditAndContinue\DeclarationBody\MethodBody.vb (1)
38Public Overrides Function FindStatementAndPartner(span As TextSpan, partnerDeclarationBody As MemberBody, <Out> ByRef partnerStatement As SyntaxNode, <Out> ByRef statementPart As Integer) As SyntaxNode
EditAndContinue\DeclarationBody\PropertyWithInitializerDeclarationBody.vb (2)
34Public Overrides ReadOnly Property Envelope As TextSpan 36Return TextSpan.FromBounds(PropertyStatement.Identifier.Span.Start, PropertyStatement.Initializer.Span.End)
EditAndContinue\DeclarationBody\PropertyWithNewClauseDeclarationBody.vb (2)
40Public Overrides ReadOnly Property Envelope As TextSpan 42Return TextSpan.FromBounds(PropertyStatement.Identifier.Span.Start, PropertyStatement.AsClause.Span.End)
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (31)
29Friend Overrides Function TryFindMemberDeclaration(rootOpt As SyntaxNode, node As SyntaxNode, activeSpan As TextSpan, <Out> ByRef declarations As OneOrMany(Of SyntaxNode)) As Boolean 101span As TextSpan, 302Protected Overrides Function TryGetEnclosingBreakpointSpan(token As SyntaxToken, <Out> ByRef span As TextSpan) As Boolean 306Protected Overrides Function TryGetActiveSpan(node As SyntaxNode, statementPart As Integer, minLength As Integer, <Out> ByRef span As TextSpan) As Boolean 1057Protected Overrides Function TryGetDiagnosticSpan(node As SyntaxNode, editKind As EditKind) As TextSpan? 1061Protected Overloads Shared Function GetDiagnosticSpan(node As SyntaxNode, editKind As EditKind) As TextSpan 1065Private Shared Function TryGetDiagnosticSpanImpl(node As SyntaxNode, editKind As EditKind) As TextSpan? 1069Protected Overrides Function GetBodyDiagnosticSpan(node As SyntaxNode, editKind As EditKind) As TextSpan 1074Friend Shared Function TryGetDiagnosticSpanImpl(kind As SyntaxKind, node As SyntaxNode, editKind As EditKind) As TextSpan? 1245Return TextSpan.FromBounds(newWith.NewKeyword.Span.Start, 1277Return TextSpan.FromBounds(groupJoin.GroupKeyword.SpanStart, groupJoin.JoinKeyword.Span.End) 1292Return TextSpan.FromBounds(partition.SkipOrTakeKeyword.SpanStart, partition.WhileKeyword.Span.End) 1306Private Overloads Shared Function GetDiagnosticSpan(ifKeyword As SyntaxToken, condition As SyntaxNode, thenKeywordOpt As SyntaxToken) As TextSpan 1307Return TextSpan.FromBounds(ifKeyword.Span.Start, 1311Private Overloads Shared Function GetDiagnosticSpan(node As NamespaceStatementSyntax) As TextSpan 1312Return TextSpan.FromBounds(node.NamespaceKeyword.SpanStart, node.Name.Span.End) 1315Private Overloads Shared Function GetDiagnosticSpan(node As TypeStatementSyntax) As TextSpan 1321Private Overloads Shared Function GetDiagnosticSpan(modifiers As SyntaxTokenList, start As SyntaxNodeOrToken, endNode As SyntaxNodeOrToken) As TextSpan 1322Return TextSpan.FromBounds(If(modifiers.Count <> 0, modifiers.First.SpanStart, start.SpanStart), 1326Private Overloads Shared Function GetDiagnosticSpan(header As MethodBaseSyntax) As TextSpan 1387Return TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End) 1390Private Overloads Shared Function GetDiagnosticSpan(lambda As LambdaHeaderSyntax) As TextSpan 1400Return TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End) 1403Friend Overrides Function GetLambdaParameterDiagnosticSpan(lambda As SyntaxNode, ordinal As Integer) As TextSpan 1697Private ReadOnly _span As TextSpan? 1705Optional span As TextSpan? = Nothing) 1724Private Function GetSpan() As TextSpan 2083newStatementSpan As TextSpan) 2115Protected Overrides Function GetExceptionHandlingRegion(node As SyntaxNode, <Out> ByRef coversAllChildren As Boolean) As TextSpan 2123Return TextSpan.FromBounds(tryBlock.FinallyBlock.SpanStart, tryBlock.EndTryStatement.Span.End) 2126Return TextSpan.FromBounds(tryBlock.CatchBlocks.First().SpanStart, tryBlock.EndTryStatement.Span.End)
EncapsulateField\VisualBasicEncapsulateFieldService.vb (1)
71Protected Overrides Async Function GetFieldsAsync(document As Document, span As TextSpan, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of IFieldSymbol))
ExtractMethod\Extensions.vb (7)
158Public Function ContainArgumentlessThrowWithoutEnclosingCatch(ByVal tokens As IEnumerable(Of SyntaxToken), ByVal textSpan As TextSpan) As Boolean 179Public Function ContainPreprocessorCrossOver(ByVal tokens As IEnumerable(Of SyntaxToken), ByVal textSpan As TextSpan) As Boolean 252Dim withBlockSpan = TextSpan.FromBounds(withBlock.WithStatement.Span.End, withBlock.EndWithStatement.SpanStart) 263Dim initializerSpan = TextSpan.FromBounds(initializer.WithKeyword.Span.End, initializer.Span.End) 283Dim span = TextSpan.FromBounds(asNewClause.NewExpression.NewKeyword.Span.End, asNewClause.NewExpression.Span.End) 315Public Function ContainsInMethodBlockBody(block As MethodBlockBaseSyntax, textSpan As TextSpan) As Boolean 320Dim blockSpan = TextSpan.FromBounds(block.BlockStatement.Span.End, block.EndBlockStatement.SpanStart)
ExtractMethod\VisualBasicExtractMethodService.vb (1)
24Protected Overrides Function CreateSelectionValidator(document As SemanticDocument, textSpan As TextSpan, localFunction As Boolean) As SelectionValidator
ExtractMethod\VisualBasicMethodExtractor.VisualBasicCodeGenerator.vb (1)
176Return node.DescendantNodesAndSelf(TextSpan.FromBounds(first.SpanStart, last.Span.End)).
ExtractMethod\VisualBasicSelectionResult.vb (1)
41finalSpan As TextSpan)
ExtractMethod\VisualBasicSelectionValidator.vb (3)
17Public Sub New(document As SemanticDocument, textSpan As TextSpan) 326Protected Overrides Function GetAdjustedSpan(textSpan As TextSpan) As TextSpan
Highlighting\KeywordHighlighters\AccessorDeclarationHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 39highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\ConditionalPreprocessorHighlighter.vb (4)
22Protected Overloads Overrides Sub AddHighlights(directive As DirectiveTriviaSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 27highlights.Add(TextSpan.FromBounds(.HashToken.SpanStart, .IfOrElseIfKeyword.Span.End)) 34highlights.Add(TextSpan.FromBounds(.HashToken.SpanStart, .ElseKeyword.Span.End)) 38highlights.Add(TextSpan.FromBounds(.HashToken.SpanStart, .IfKeyword.Span.End))
Highlighting\KeywordHighlighters\ConstructorDeclarationHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 31highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .NewKeyword.Span.End))
Highlighting\KeywordHighlighters\DoLoopBlockHighlighter.vb (3)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 38highlights.Add(TextSpan.FromBounds(.DoKeyword.SpanStart, .WhileOrUntilClause.WhileOrUntilKeyword.Span.End)) 50highlights.Add(TextSpan.FromBounds(.LoopKeyword.SpanStart, .WhileOrUntilClause.WhileOrUntilKeyword.Span.End))
Highlighting\KeywordHighlighters\EnumBlockHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 38highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .EnumKeyword.Span.End))
Highlighting\KeywordHighlighters\EventBlockHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 32highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\EventDeclarationHighlighter.vb (2)
22Protected Overrides Sub AddHighlights(eventDeclaration As EventStatementSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 32highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\ForLoopBlockHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 38highlights.Add(TextSpan.FromBounds(.ForKeyword.SpanStart, .EachKeyword.Span.End))
Highlighting\KeywordHighlighters\MethodDeclarationHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 37highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\MultiLineIfBlockHighlighter.vb (1)
22Protected Overloads Overrides Sub addHighlights(ifBlock As MultiLineIfBlockSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\MultiLineLambdaExpressionHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 37highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\NamespaceBlockHighlighter.vb (1)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\OperatorDeclarationHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 31highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\PropertyBlockHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 31highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\PropertyDeclarationHighlighter.vb (2)
22Protected Overrides Sub AddHighlights(propertyDeclaration As PropertyStatementSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 32highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\RegionHighlighter.vb (3)
22Protected Overloads Overrides Sub AddHighlights(directive As DirectiveTriviaSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 37highlights.Add(TextSpan.FromBounds(region.HashToken.SpanStart, region.RegionKeyword.Span.End)) 38highlights.Add(TextSpan.FromBounds(endRegion.HashToken.SpanStart, endRegion.RegionKeyword.Span.End))
Highlighting\KeywordHighlighters\SelectBlockHighlighter.vb (3)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 35TextSpan.FromBounds( 44highlights.Add(TextSpan.FromBounds(.CaseKeyword.SpanStart, elseKeyword.Span.End))
Highlighting\KeywordHighlighters\SingleLineIfBlockHighlighter.vb (1)
22Protected Overloads Overrides Sub AddHighlights(ifStatement As SingleLineIfStatementSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\SyncLockBlockHighlighter.vb (1)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\TryBlockHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 57Private Shared Sub HighlightRelatedStatements(node As SyntaxNode, highlights As List(Of TextSpan))
Highlighting\KeywordHighlighters\TypeBlockHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 41highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\UsingBlockHighlighter.vb (1)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\WhileBlockHighlighter.vb (1)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\WithBlockHighlighter.vb (1)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\XmlCDataHighlighter.vb (1)
22Protected Overloads Overrides Sub addHighlights(xmlComment As XmlCDataSectionSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\XmlCommentHighlighter.vb (1)
22Protected Overloads Overrides Sub addHighlights(xmlComment As XmlCommentSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\XmlDocumentPrologueHighlighter.vb (1)
22Protected Overloads Overrides Sub addHighlights(xmlProcessingInstruction As XmlProcessingInstructionSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\XmlElementHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As XmlNodeSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 33highlights.Add(TextSpan.FromBounds(.LessThanToken.SpanStart, .Name.Span.End))
Highlighting\KeywordHighlighters\XmlEmbeddedExpressionHighlighter.vb (1)
22Protected Overloads Overrides Sub addHighlights(xmlEmbeddExpression As XmlEmbeddedExpressionSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\XmlProcessingInstructionHighlighter.vb (1)
22Protected Overloads Overrides Sub addHighlights(xmlDocumentPrologue As XmlDeclarationSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlightingHelpers.vb (8)
15highlights As List(Of TextSpan), 50Optional checkReturns As Boolean = False) As IEnumerable(Of TextSpan) 52Dim highlights As New List(Of TextSpan) 78Friend Sub HighlightRelatedAwaits(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 96highlights(index) = TextSpan.FromBounds(span.Start, .AwaitKeyword.Span.End) 115Private Sub HighlightRelatedYieldStatements(Of T)(node As SyntaxNode, highlights As List(Of TextSpan)) 130Friend Function GetRelatedYieldStatementHighlights(Of T As SyntaxNode)(node As T) As IEnumerable(Of TextSpan) 131Dim highlights As New List(Of TextSpan)
IntroduceVariable\VisualBasicIntroduceLocalForExpressionCodeRefactoringProvider.vb (1)
27Protected Overrides Function IsValid(expressionStatement As ExpressionStatementSyntax, span As TextSpan) As Boolean
IntroduceVariable\VisualBasicIntroduceVariableService.vb (1)
168Return block.OverlapsHiddenPosition(TextSpan.FromBounds(first.SpanStart, last.SpanStart), cancellationToken)
LineSeparators\VisualBasicLineSeparatorService.vb (7)
56textSpan As TextSpan, 57cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of TextSpan)) Implements ILineSeparatorService.GetLineSeparatorsAsync 61Dim spans = ArrayBuilder(Of TextSpan).GetInstance() 67Return ImmutableArray(Of TextSpan).Empty 103Private Shared Sub ProcessNodeList(Of T As SyntaxNode)(children As SyntaxList(Of T), spans As ArrayBuilder(Of TextSpan), token As CancellationToken) 145Private Shared Sub ProcessImports(importsList As SyntaxList(Of ImportsStatementSyntax), spans As ArrayBuilder(Of TextSpan)) 151Private Shared Function GetLineSeparatorSpanForNode(node As SyntaxNode) As TextSpan
SignatureHelp\AbstractIntrinsicOperatorSignatureHelpProvider.vb (1)
105Private Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState
SignatureHelp\AttributeSignatureHelpProvider.vb (1)
92Private Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\CollectionInitializerSignatureHelpProvider.vb (1)
67Private Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\FunctionAggregationSignatureHelpProvider.vb (1)
31Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState
SignatureHelp\GenericNameSignatureHelpProvider.vb (1)
30Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\InvocationExpressionSignatureHelpProvider.vb (1)
31Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.vb (1)
30Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\RaiseEventStatementSignatureHelpProvider.vb (1)
29Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\SignatureHelpUtilities.vb (4)
51Friend Function GetSignatureHelpSpan(argumentList As ArgumentListSyntax) As TextSpan 55Friend Function GetSignatureHelpSpan(argumentList As ArgumentListSyntax, start As Integer) As TextSpan 59Friend Function GetSignatureHelpSpan(argumentList As TypeArgumentListSyntax) As TextSpan 63Friend Function GetSignatureHelpSpan(initializer As CollectionInitializerSyntax) As TextSpan
Snippets\VisualBasicSnippetFunctionService.vb (3)
29Protected Overrides Async Function GetEnumSymbolAsync(document As Document, switchExpressionSpan As TextSpan, cancellationToken As CancellationToken) As Task(Of ITypeSymbol) 44Protected Overrides Async Function GetDocumentWithEnumCaseAsync(document As Document, fullyQualifiedTypeName As String, firstEnumMemberName As String, caseGenerationLocation As TextSpan, cancellationToken As CancellationToken) As Task(Of (Document, TextSpan))
SolutionCrawler\VisualBasicDocumentDifferenceService.vb (7)
21Protected Overrides Function IsContainedInMemberBody(node As SyntaxNode, span As Text.TextSpan) As Boolean 55Private Shared Function ContainsExclusively(outerSpan As TextSpan, innerSpan As TextSpan) As Boolean 63Private Shared Function GetSyntaxListSpan(Of T As SyntaxNode)(list As SyntaxList(Of T)) As TextSpan 65Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End) 68Private Shared Function GetSeparatedSyntaxListSpan(Of T As SyntaxNode)(list As SeparatedSyntaxList(Of T)) As TextSpan 70Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End)
SplitOrMergeIfStatements\VisualBasicMergeConsecutiveIfStatementsCodeRefactoringProvider.vb (1)
22Protected Overrides Function IsApplicableSpan(node As SyntaxNode, span As TextSpan, ByRef ifOrElseIf As SyntaxNode) As Boolean
SplitOrMergeIfStatements\VisualBasicMergeNestedIfStatementsCodeRefactoringProvider.vb (1)
22Protected Overrides Function IsApplicableSpan(node As SyntaxNode, span As TextSpan, ByRef ifOrElseIf As SyntaxNode) As Boolean
src\roslyn\src\Analyzers\VisualBasic\Analyzers\RemoveUnnecessaryCast\VisualBasicRemoveUnnecessaryCastDiagnosticAnalyzer.vb (1)
35Protected Overrides Function GetFadeSpan(node As ExpressionSyntax) As TextSpan
src\roslyn\src\Analyzers\VisualBasic\Analyzers\RemoveUnnecessaryImports\VisualBasicRemoveUnnecessaryImportsDiagnosticAnalyzer.vb (1)
56nodes As IEnumerable(Of SyntaxNode), tree As SyntaxTree, cancellationToken As CancellationToken) As IEnumerable(Of TextSpan)
src\roslyn\src\Analyzers\VisualBasic\Analyzers\UseInferredMemberName\VisualBasicUseInferredMemberNameDiagnosticAnalyzer.vb (2)
52Dim fadeSpan = TextSpan.FromBounds(nameColonEquals.Name.SpanStart, nameColonEquals.ColonEqualsToken.Span.End) 73Dim fadeSpan = TextSpan.FromBounds(fieldInitializer.Name.SpanStart, fieldInitializer.EqualsToken.Span.End)
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\GenerateDefaultConstructors\VisualBasicGenerateDefaultConstructorsService.vb (1)
24semanticDocument As SemanticDocument, textSpan As TextSpan, cancellationToken As CancellationToken,
src\roslyn\src\Compilers\VisualBasic\BasicAnalyzerDriver\VisualBasicDeclarationComputer.vb (1)
16span As TextSpan,
Structure\Providers\CollectionInitializerStructureProvider.vb (2)
44textSpan:=TextSpan.FromBounds(node.SpanStart, endPos), 45hintSpan:=TextSpan.FromBounds(node.SpanStart, endPos),
Structure\Providers\CompilationUnitStructureProvider.vb (1)
26Dim span = TextSpan.FromBounds(startPos, endPos)
Structure\Providers\DisabledTextTriviaStructureProvider.vb (1)
24Dim span = TextSpan.FromBounds(startPos, endPos)
Structure\Providers\DocumentationCommentStructureProvider.vb (1)
33Dim fullSpan = TextSpan.FromBounds(startPos, endPos)
Structure\Providers\ObjectCreationInitializerStructureProvider.vb (1)
34textSpan:=TextSpan.FromBounds(previousToken.Span.End, node.Span.End),
Structure\Providers\RegionDirectiveStructureProvider.vb (1)
42Dim span = TextSpan.FromBounds(regionDirective.SpanStart, matchingDirective.Span.End)
Structure\VisualBasicStructureHelpers.vb (7)
28Dim span = TextSpan.FromBounds(startComment.SpanStart, endComment.Span.End) 114textSpan:=TextSpan.FromBounds(startPosition, endPosition), 115hintSpan:=TextSpan.FromBounds(startPosition, hintTextEndToken.Span.End), 167span As TextSpan, 168hintSpan As TextSpan, 208Private Function GetHintSpan(blockNode As SyntaxNode) As TextSpan 218Return TextSpan.FromBounds(child.SpanStart, blockNode.Span.End)
Wrapping\SeparatedSyntaxList\VisualBasicArgumentWrapper.vb (1)
68Dim span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)
Wrapping\SeparatedSyntaxList\VisualBasicParameterWrapper.vb (1)
60Dim headerSpan = TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (123)
CaseCorrection\VisualBasicCaseCorrectionService.vb (2)
29spans As ImmutableArray(Of TextSpan), 39span As TextSpan,
Classification\ClassificationHelpers.vb (1)
321Friend Sub AddLexicalClassifications(text As SourceText, textSpan As TextSpan, result As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken)
Classification\SyntaxClassification\IdentifierNameSyntaxClassifier.vb (1)
23textSpan As TextSpan,
Classification\SyntaxClassification\ImportAliasClauseSyntaxClassifier.vb (1)
19Public Overrides Sub AddClassifications(syntax As SyntaxNode, textSpan As TextSpan, semanticModel As SemanticModel, options As ClassificationOptions, result As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken)
Classification\SyntaxClassification\NameSyntaxClassifier.vb (1)
32textSpan As TextSpan,
Classification\SyntaxClassification\OperatorOverloadSyntaxClassifier.vb (2)
24textSpan As TextSpan, 48Private Shared Function GetOperatorTokenSpan(syntax As SyntaxNode) As TextSpan
Classification\SyntaxClassification\VisualBasicSyntaxClassificationService.vb (2)
35Public Overrides Sub AddLexicalClassifications(text As SourceText, textSpan As TextSpan, result As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken) 39Public Overrides Sub AddSyntacticClassifications(root As SyntaxNode, textSpans As ImmutableArray(Of TextSpan), result As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken)
Classification\VisualBasicClassificationService.vb (1)
23Public Overrides Sub AddLexicalClassifications(text As SourceText, textSpan As TextSpan, result As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken)
Classification\Worker.DocumentationCommentClassifier.vb (2)
88Dim span = TextSpan.FromBounds(spanStart.Value, spanStart.Value + index) 98Dim span = TextSpan.FromBounds(spanStart.Value, trivia.Span.End)
Classification\Worker.vb (5)
14Private ReadOnly _textSpan As TextSpan 19Private Sub New(textSpan As TextSpan, list As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken) 28tokens As IEnumerable(Of SyntaxToken), textSpan As TextSpan, list As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken) 37node As SyntaxNode, textSpan As TextSpan, list As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken) 42Private Sub AddClassification(textSpan As TextSpan, classificationType As String)
CodeCleanup\Providers\AbstractTokensCodeCleanupProvider.vb (4)
20document As Document, root As SyntaxNode, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) As Task(Of Rewriter) 22Public Async Function CleanupAsync(document As Document, spans As ImmutableArray(Of TextSpan), options As CodeCleanupOptions, cancellationToken As CancellationToken) As Task(Of Document) Implements ICodeCleanupProvider.CleanupAsync 30Public Async Function CleanupAsync(root As SyntaxNode, spans As ImmutableArray(Of TextSpan), options As SyntaxFormattingOptions, services As SolutionServices, cancellationToken As CancellationToken) As Task(Of SyntaxNode) Implements ICodeCleanupProvider.CleanupAsync 44Public Sub New(spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken)
CodeCleanup\Providers\AddMissingTokensCodeCleanupProvider.vb (3)
30Protected Overrides Async Function GetRewriterAsync(document As Document, root As SyntaxNode, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) As Task(Of Rewriter) 39Private Sub New(semanticModel As SemanticModel, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) 45Public Shared Async Function CreateAsync(document As Document, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) As Task(Of AddMissingTokensRewriter)
CodeCleanup\Providers\CaseCorrectionCodeCleanupProvider.vb (2)
31Public Function CleanupAsync(document As Document, spans As ImmutableArray(Of TextSpan), options As CodeCleanupOptions, cancellationToken As CancellationToken) As Task(Of Document) Implements ICodeCleanupProvider.CleanupAsync 35Public Function CleanupAsync(root As SyntaxNode, spans As ImmutableArray(Of TextSpan), options As SyntaxFormattingOptions, services As SolutionServices, cancellationToken As CancellationToken) As Task(Of SyntaxNode) Implements ICodeCleanupProvider.CleanupAsync
CodeCleanup\Providers\FixIncorrectTokensCodeCleanupProvider.vb (3)
39Protected Overrides Function GetRewriterAsync(document As Document, root As SyntaxNode, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) As Task(Of Rewriter) 49spans As ImmutableArray(Of TextSpan), 56Public Shared Async Function CreateAsync(document As Document, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) As Task(Of Rewriter)
CodeCleanup\Providers\NormalizeModifiersOrOperatorsCodeCleanupProvider.vb (3)
35Public Async Function CleanupAsync(document As Document, spans As ImmutableArray(Of TextSpan), options As CodeCleanupOptions, cancellationToken As CancellationToken) As Task(Of Document) Implements ICodeCleanupProvider.CleanupAsync 42Public Function CleanupAsync(root As SyntaxNode, spans As ImmutableArray(Of TextSpan), options As SyntaxFormattingOptions, services As SolutionServices, cancellationToken As CancellationToken) As Task(Of SyntaxNode) Implements ICodeCleanupProvider.CleanupAsync 81Public Sub New(spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken)
CodeCleanup\Providers\ReduceTokensCodeCleanupProvider.vb (2)
33Protected Overrides Function GetRewriterAsync(document As Document, root As SyntaxNode, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) As Task(Of Rewriter) 40Public Sub New(spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken)
CodeCleanup\Providers\RemoveUnnecessaryLineContinuationCodeCleanupProvider.vb (6)
32Public Async Function CleanupAsync(document As Document, spans As ImmutableArray(Of TextSpan), options As CodeCleanupOptions, cancellationToken As CancellationToken) As Task(Of Document) Implements ICodeCleanupProvider.CleanupAsync 45Public Function CleanupAsync(root As SyntaxNode, spans As ImmutableArray(Of TextSpan), options As SyntaxFormattingOptions, services As SolutionServices, cancellationToken As CancellationToken) As Task(Of SyntaxNode) Implements ICodeCleanupProvider.CleanupAsync 55Private ReadOnly _spans As ImmutableArray(Of TextSpan) 57Public Shared Function Process(root As SyntaxNode, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) As SyntaxNode 62Private Sub New(root As SyntaxNode, spans As ImmutableArray(Of TextSpan)) 102Private Sub Cleanup(root As SyntaxNode, span As TextSpan, cancellationToken As CancellationToken)
CodeCleanup\VisualBasicCodeCleanerService.vb (5)
31Protected Overrides Function GetSpansToAvoid(root As SyntaxNode) As ImmutableArray(Of TextSpan) 39Dim result = ArrayBuilder(Of TextSpan).GetInstance() 46Private Shared Sub ProcessNode(node As SyntaxNode, result As ArrayBuilder(Of TextSpan)) 60Private Shared Sub ProcessToken(token As SyntaxToken, result As ArrayBuilder(Of TextSpan)) 73Private Shared Function SkipProcessing(nodeOrToken As SyntaxNodeOrToken, result As ArrayBuilder(Of TextSpan)) As Boolean
ObsoleteSymbol\VisualBasicObsoleteSymbolService.vb (2)
25Protected Overrides Sub ProcessDimKeyword(ByRef result As ArrayBuilder(Of TextSpan), semanticModel As SemanticModel, token As SyntaxToken, cancellationToken As CancellationToken) 50result = ArrayBuilder(Of TextSpan).GetInstance()
Rename\VisualBasicRenameRewriterLanguageService.vb (14)
46Private ReadOnly _renameLocations As ImmutableDictionary(Of TextSpan, RenameLocation) 47Private ReadOnly _conflictLocations As ImmutableHashSet(Of TextSpan) 81Private ReadOnly _stringAndCommentTextSpans As ImmutableDictionary(Of TextSpan, ImmutableSortedSet(Of TextSpan)) 91Private _modifiedSubSpans As List(Of ValueTuple(Of TextSpan, TextSpan)) 94Private ReadOnly _complexifiedSpans As HashSet(Of TextSpan) = New HashSet(Of TextSpan) 96Private Sub AddModifiedSpan(oldSpan As TextSpan, newSpan As TextSpan) 186Me._modifiedSubSpans = New List(Of ValueTuple(Of TextSpan, TextSpan))() 590Private Function RenameInStringLiteral(oldToken As SyntaxToken, newToken As SyntaxToken, subSpansToReplace As ImmutableSortedSet(Of TextSpan), createNewStringLiteral As Func(Of SyntaxTriviaList, String, String, SyntaxTriviaList, SyntaxToken)) As SyntaxToken 627Dim subSpansToReplace As ImmutableSortedSet(Of TextSpan) = Nothing
Simplification\Reducers\VisualBasicNameReducer.vb (1)
39Dim issueSpan As TextSpan
Simplification\Reducers\VisualBasicVariableDeclaratorReducer.vb (2)
37Dim issueSpan As TextSpan 52<Out> ByRef issueSpan As TextSpan) As Boolean
Simplification\Simplifiers\ExpressionSimplifier.vb (6)
28ByRef issueSpan As TextSpan, 54<Out> ByRef issueSpan As TextSpan, 78<Out> ByRef issueSpan As TextSpan, 175<Out> ByRef issueSpan As TextSpan 230<Out()> ByRef issueSpan As TextSpan 275<Out> ByRef issueSpan As TextSpan,
Simplification\Simplifiers\NameSimplifier.vb (4)
29<Out> ByRef issueSpan As TextSpan, 119Dim issueSpanWithoutAttributeSuffix As TextSpan = Nothing 323Private Shared Function TryOmitModuleName(name As QualifiedNameSyntax, semanticModel As SemanticModel, <Out()> ByRef replacementNode As ExpressionSyntax, <Out()> ByRef issueSpan As TextSpan, cancellationToken As CancellationToken) As Boolean 356<Out> ByRef issueSpan As TextSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (6)
381textSpan As TextSpan, 389textSpan As TextSpan, 405textSpan As TextSpan, 857Public Function CheckTopLevel(node As SyntaxNode, span As TextSpan) As Boolean 881Public Function ContainsInMethodBlockBody(block As MethodBlockBaseSyntax, textSpan As TextSpan) As Boolean 886Dim blockSpan = TextSpan.FromBounds(block.BlockStatement.Span.End, block.EndBlockStatement.SpanStart)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\FormattingResult.vb (1)
21Friend Sub New(treeInfo As TreeData, tokenStream As TokenStream, spanToFormat As TextSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
96Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.vb (1)
58Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
89Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (5)
84Private Function GetTextSpan(pair As ValueTuple(Of SyntaxToken, SyntaxToken)) As TextSpan 86Return TextSpan.FromBounds(_node.FullSpan.Start, pair.Item2.SpanStart) 90Return TextSpan.FromBounds(pair.Item1.Span.End, _node.FullSpan.End) 93Return TextSpan.FromBounds(pair.Item1.Span.End, pair.Item2.SpanStart) 108Private Shared Function GetSyntaxTriviaList(textSpan As TextSpan, triviaData As TriviaData, cancellationToken As CancellationToken) As SyntaxTriviaList
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Rules\BaseFormattingRule.vb (8)
28Optional textSpan As TextSpan = Nothing, 38Protected Shared Sub SetAlignmentBlockOperation(operations As List(Of IndentBlockOperation), baseToken As SyntaxToken, startToken As SyntaxToken, endToken As SyntaxToken, span As TextSpan, Optional [option] As IndentBlockOption = IndentBlockOption.RelativePosition) 46Protected Shared Sub AddAbsolutePositionIndentBlockOperation(operations As List(Of IndentBlockOperation), startToken As SyntaxToken, endToken As SyntaxToken, indentation As Integer, span As TextSpan, Optional [option] As IndentBlockOption = IndentBlockOption.AbsolutePosition) 50Private Shared Function GetAlignmentSpan(startToken As SyntaxToken, endToken As SyntaxToken) As TextSpan 52Return TextSpan.FromBounds(previousToken.Span.End, endToken.FullSpan.End) 55Private Shared Function GetIndentBlockSpan(startToken As SyntaxToken, endToken As SyntaxToken) As TextSpan 64Return TextSpan.FromBounds(spanStart, trivia.FullSpan.Start) 68Return TextSpan.FromBounds(spanStart, nextToken.SpanStart)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Rules\NodeBasedFormattingRule.vb (2)
79AddIndentBlockOperation(operations, baseToken, startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)) 157operations.Add(FormattingOperations.CreateIndentBlockOperation(caseBlockLastToken, nextTokenAfterCase, TextSpan.FromBounds(caseBlockLastToken.Span.End, nextTokenAfterCase.SpanStart), 1, IndentBlockOption.RelativePosition))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Indentation\VisualBasicSmartTokenFormatter.vb (1)
41Dim spans = SpecializedCollections.SingletonEnumerable(TextSpan.FromBounds(previousToken.SpanStart, token.Span.End))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (4)
829Public Function GetMemberBodySpanForSpeculativeBinding(node As SyntaxNode) As TextSpan Implements ISyntaxFacts.GetMemberBodySpanForSpeculativeBinding 852Return TextSpan.FromBounds(spanStart, method.EndBlockStatement.SpanStart) 1084Public Function GetInactiveRegionSpanAroundPosition(tree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As TextSpan Implements ISyntaxFacts.GetInactiveRegionSpanAroundPosition 1415Public Function ContainsInterleavedDirective(span As TextSpan, token As SyntaxToken, cancellationToken As CancellationToken) As Boolean Implements ISyntaxFacts.ContainsInterleavedDirective
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeFixesAndRefactorings\VisualBasicFixAllSpanMappingService.vb (3)
22Protected Overrides Function GetFixAllSpansIfWithinGlobalStatementAsync(document As Document, diagnosticSpan As TextSpan, cancellationToken As CancellationToken) As Task(Of ImmutableDictionary(Of Document, ImmutableArray(Of TextSpan))) 24Return Task.FromResult(ImmutableDictionary(Of Document, ImmutableArray(Of TextSpan)).Empty)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (2)
72indices.Add(Not destination.OverlapsHiddenPosition(TextSpan.FromBounds(0, destination.Members.First.SpanStart), cancellationToken)) 85TextSpan.FromBounds(destination.Members.Last.Span.End, destination.EndOfFileToken.SpanStart), cancellationToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\CompilationUnitSyntaxExtensions.vb (2)
32Return Not contextNode.SyntaxTree.OverlapsHiddenPosition(TextSpan.FromBounds(start, [end]), cancellationToken) 39Return Not contextNode.SyntaxTree.OverlapsHiddenPosition(TextSpan.FromBounds(start, [end]), cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (1)
221Public Function GetImplicitMemberAccessExpressions(expression As SyntaxNode, span As TextSpan) As IEnumerable(Of ExpressionSyntax)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Formatting\VisualBasicSyntaxFormattingService.vb (1)
32Public Function GetFormattingChangesOnPaste(document As ParsedDocument, textSpan As TextSpan, options As SyntaxFormattingOptions, cancellationToken As CancellationToken) As ImmutableArray(Of TextChange) Implements ISyntaxFormattingService.GetFormattingChangesOnPaste
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\SpecialFormattingOperation.vb (5)
73TextSpan.FromBounds(startToken.FullSpan.Start, node.FullSpan.End), indentationDelta:=1, [option]:=IndentBlockOption.RelativePosition)) 111baseToken, startToken, endToken, TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End), indentationDelta, IndentBlockOption.RelativePosition)) 149Dim span As TextSpan 157span = TextSpan.FromBounds(baseToken.Span.End, firstToken.SpanStart) 160span = TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSymbolDeclarationService.vb (1)
51Public Overrides ReadOnly Property Span As TextSpan
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSyntaxFactsService.vb (1)
38Public Function GetSelectedFieldsAndPropertiesAsync(tree As SyntaxTree, textSpan As TextSpan, allowPartialSelection As Boolean, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of SyntaxNode)) Implements ISyntaxFactsService.GetSelectedFieldsAndPropertiesAsync
Workspace\LanguageServices\VisualBasicSyntaxTreeFactoryService.NodeSyntaxReference.vb (1)
24Public Overrides ReadOnly Property Span As TextSpan
Microsoft.CodeAnalysis.Workspaces (824)
CaseCorrection\AbstractCaseCorrectionService.cs (4)
20protected abstract void AddReplacements(SemanticModel? semanticModel, SyntaxNode root, ImmutableArray<TextSpan> spans, ConcurrentDictionary<SyntaxToken, SyntaxToken> replacements, CancellationToken cancellationToken); 22public async Task<Document> CaseCorrectAsync(Document document, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken) 41public SyntaxNode CaseCorrect(SyntaxNode root, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken) 44private SyntaxNode CaseCorrect(SemanticModel? semanticModel, SyntaxNode root, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken)
CaseCorrection\CaseCorrector.cs (3)
55public static async Task<Document> CaseCorrectAsync(Document document, TextSpan span, CancellationToken cancellationToken = default) 63public static Task<Document> CaseCorrectAsync(Document document, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken = default) 69internal static SyntaxNode CaseCorrect(SyntaxNode root, ImmutableArray<TextSpan> spans, SolutionServices services, CancellationToken cancellationToken = default)
CaseCorrection\ICaseCorrectionService.cs (2)
18Task<Document> CaseCorrectAsync(Document document, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken); 23SyntaxNode CaseCorrect(SyntaxNode root, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken);
Classification\AbstractClassificationService.cs (10)
30public abstract void AddLexicalClassifications(SourceText text, TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken); 34Document document, ImmutableArray<TextSpan> textSpans, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 40Document document, ImmutableArray<TextSpan> textSpans, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 47ImmutableArray<TextSpan> textSpans, 108ImmutableArray<TextSpan> textSpans, 138ImmutableArray<TextSpan> textSpans, 157foreach (var span in reassignedVariableSpans) 165foreach (var span in obsoleteSymbolSpans) 201public async Task AddSyntacticClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 208SolutionServices services, SyntaxNode? root, ImmutableArray<TextSpan> textSpans, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken)
Classification\ClassificationServiceExtensions.cs (4)
19TextSpan textSpan, 29TextSpan textSpan, 39TextSpan textSpan, 50TextSpan textSpan,
Classification\ClassifiedSpan.cs (3)
13public readonly struct ClassifiedSpan(TextSpan textSpan, string classificationType) : IEquatable<ClassifiedSpan> 18public TextSpan TextSpan { get; } = textSpan; 20public ClassifiedSpan(string classificationType, TextSpan textSpan)
Classification\ClassifiedSpanIntervalIntrospector.cs (1)
16public TextSpan GetSpan(ClassifiedSpan value)
Classification\Classifier.cs (5)
29TextSpan textSpan, 49TextSpan textSpan, 61TextSpan textSpan, 73TextSpan textSpan, 114LanguageServices languageServices, SemanticModel semanticModel, TextSpan textSpan, ClassificationOptions options,
Classification\ClassifierHelper.cs (16)
31TextSpan span, 59ImmutableArray<TextSpan> spans, 97var widenedSpan = new TextSpan(spans[0].Start, spans[^1].End); 114TextSpan widenedSpan, 158private static void AdjustSpans(SegmentedList<ClassifiedSpan> spans, TextSpan widenedSpan) 206TextSpan.FromBounds( 239Func<TClassifiedSpan, TextSpan> getSpan, 240Func<TClassifiedSpan, TextSpan, TClassifiedSpan> createSpan) 265var syntacticPartSpan = getSpan(syntacticPart); 289var firstSemanticPartSpan = getSpan(firstSemanticPart); 290var lastSemanticPartSpan = getSpan(lastSemanticPart); 297finalParts.Add(createSpan(syntacticPart, TextSpan.FromBounds( 307var semanticPart1Span = getSpan(semanticPart1); 308var semanticPart2Span = getSpan(semanticPart2); 315finalParts.Add(createSpan(syntacticPart, TextSpan.FromBounds( 323finalParts.Add(createSpan(syntacticPart, TextSpan.FromBounds(
Classification\EmbeddedLanguageClassificationServiceExtensions.cs (1)
19TextSpan textSpan,
Classification\IClassificationService.cs (5)
28void AddLexicalClassifications(SourceText text, TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken); 34void AddSyntacticClassifications(SolutionServices services, SyntaxNode? root, ImmutableArray<TextSpan> textSpans, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken); 46Task AddSyntacticClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken); 63Task AddSemanticClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken); 74Task AddEmbeddedLanguageClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken);
Classification\IEmbeddedLanguageClassificationService.cs (2)
18ImmutableArray<TextSpan> textSpans, 27ImmutableArray<TextSpan> textSpans,
Classification\IRemoteSemanticClassificationService.cs (3)
33ImmutableArray<TextSpan> textSpans, 52ImmutableArray<TextSpan> textSpans, 88var textSpan = classifiedSpan.TextSpan;
Classification\SyntaxClassification\AbstractNameSyntaxClassifier.cs (1)
31TextSpan span,
Classification\SyntaxClassification\AbstractSyntaxClassificationService.cs (4)
18public abstract void AddLexicalClassifications(SourceText text, TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken); 19public abstract void AddSyntacticClassifications(SyntaxNode root, ImmutableArray<TextSpan> textSpans, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken); 27ImmutableArray<TextSpan> textSpans, 49ImmutableArray<TextSpan> textSpans,
Classification\SyntaxClassification\AbstractSyntaxClassificationService.Worker.cs (5)
22private readonly TextSpan _textSpan; 36TextSpan textSpan, 58ImmutableArray<TextSpan> textSpans, 66foreach (var textSpan in textSpans) 85private void AddClassification(TextSpan textSpan, string type)
Classification\SyntaxClassification\AbstractSyntaxClassifier.cs (2)
22public virtual void AddClassifications(SyntaxNode syntax, TextSpan textSpan, SemanticModel semanticModel, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 26public virtual void AddClassifications(SyntaxToken syntax, TextSpan textSpan, SemanticModel semanticModel, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken)
Classification\SyntaxClassification\ISyntaxClassificationService.cs (4)
22TextSpan textSpan, 29ImmutableArray<TextSpan> textSpans, 36ImmutableArray<TextSpan> textSpans, 46ImmutableArray<TextSpan> textSpans,
Classification\SyntaxClassification\ISyntaxClassifier.cs (2)
29void AddClassifications(SyntaxNode node, TextSpan textSpan, SemanticModel semanticModel, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken); 34void AddClassifications(SyntaxToken token, TextSpan textSpan, SemanticModel semanticModel, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken);
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (1)
114TextSpan.FromBounds(start: commonLeftWidth.Value, end: oldRootWidth - commonRightWidth),
Classification\SyntaxClassification\SyntaxClassificationExtensions.cs (3)
20TextSpan textSpan, 30TextSpan textSpan, 50TextSpan textSpan,
CodeCleanup\AbstractCodeCleanerService.cs (30)
27protected abstract ImmutableArray<TextSpan> GetSpansToAvoid(SyntaxNode root); 29public async Task<Document> CleanupAsync(Document document, ImmutableArray<TextSpan> spans, CodeCleanupOptions options, ImmutableArray<ICodeCleanupProvider> providers, CancellationToken cancellationToken) 73public async Task<SyntaxNode> CleanupAsync(SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SolutionServices services, ImmutableArray<ICodeCleanupProvider> providers, CancellationToken cancellationToken) 114private static ImmutableArray<TextSpan> GetTextSpansFromAnnotation( 120var builder = ArrayBuilder<TextSpan>.GetInstance(); 137out var span)) 152out TextSpan span) 219span = TextSpan.FromBounds(node.SpanStart, GetNextTokenEndPosition(nextTokenMarker.Type, nextToken)); 226span = TextSpan.FromBounds(GetPreviousTokenStartPosition(previousTokenMarker.Type, previousToken), node.Span.End); 270SyntaxNode root, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken) 278foreach (var span in nonOverlappingSpans) 320private static ImmutableArray<TextSpan> GetNonOverlappingSpans( 321SyntaxNode root, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken) 327var tokenSpans = new List<TextSpan>(); 328foreach (var span in spans) 347tokenSpans.Add(TextSpan.FromBounds(start, end)); 359SyntaxNode root, TextSpan span, 381private static TextSpan GetSpanAlignedToTokens( 382SyntaxNode root, TextSpan span, 391return TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End); 444private static bool CleanupWholeNode(TextSpan nodeSpan, ImmutableArray<TextSpan> spans) 458Func<SyntaxNode, ImmutableArray<TextSpan>> spanGetter, 466var spans = ImmutableArray<TextSpan>.Empty; 520private ImmutableArray<TextSpan> GetSpans( 521SyntaxNode root, Func<SyntaxNode, ImmutableArray<TextSpan>> spanGetter) 539Func<SyntaxNode, ImmutableArray<TextSpan>> spanGetter, 548var spans = ImmutableArray<TextSpan>.Empty; 599private static bool TryCreateTextSpan(int start, int end, out TextSpan span) 608span = TextSpan.FromBounds(start, end);
CodeCleanup\CodeCleaner.cs (4)
70public static Task<Document> CleanupAsync(Document document, TextSpan span, CodeCleanupOptions options, ImmutableArray<ICodeCleanupProvider> providers = default, CancellationToken cancellationToken = default) 77public static async Task<Document> CleanupAsync(Document document, ImmutableArray<TextSpan> spans, CodeCleanupOptions options, ImmutableArray<ICodeCleanupProvider> providers = default, CancellationToken cancellationToken = default) 87public static Task<SyntaxNode> CleanupAsync(SyntaxNode root, TextSpan span, SyntaxFormattingOptions options, SolutionServices services, ImmutableArray<ICodeCleanupProvider> providers = default, CancellationToken cancellationToken = default) 94public static Task<SyntaxNode> CleanupAsync(SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SolutionServices services, ImmutableArray<ICodeCleanupProvider> providers = default, CancellationToken cancellationToken = default)
CodeCleanup\ICodeCleanerService.cs (2)
30Task<Document> CleanupAsync(Document document, ImmutableArray<TextSpan> spans, CodeCleanupOptions options, ImmutableArray<ICodeCleanupProvider> providers, CancellationToken cancellationToken); 37Task<SyntaxNode> CleanupAsync(SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SolutionServices services, ImmutableArray<ICodeCleanupProvider> providers, CancellationToken cancellationToken);
CodeCleanup\Providers\FormatCodeCleanupProvider.cs (2)
20public async Task<Document> CleanupAsync(Document document, ImmutableArray<TextSpan> spans, CodeCleanupOptions options, CancellationToken cancellationToken) 32public Task<SyntaxNode> CleanupAsync(SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SolutionServices services, CancellationToken cancellationToken)
CodeCleanup\Providers\ICodeCleanupProvider.cs (2)
27Task<Document> CleanupAsync(Document document, ImmutableArray<TextSpan> spans, CodeCleanupOptions options, CancellationToken cancellationToken); 34Task<SyntaxNode> CleanupAsync(SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SolutionServices services, CancellationToken cancellationToken);
CodeCleanup\Providers\SimplificationCodeCleanupProvider.cs (2)
19public Task<Document> CleanupAsync(Document document, ImmutableArray<TextSpan> spans, CodeCleanupOptions options, CancellationToken cancellationToken) 22public async Task<SyntaxNode> CleanupAsync(SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SolutionServices services, CancellationToken cancellationToken)
CodeFixes\CodeFixContext.cs (4)
54public TextSpan Span { get; } 87TextSpan span, 118TextSpan span, 238private static void VerifyDiagnosticsArgument(ImmutableArray<Diagnostic> diagnostics, TextSpan span)
CodeFixes\FixAllOccurrences\FixAllContext.cs (3)
148TextSpan? diagnosticSpan, 241TextSpan? filterSpan) 259internal async Task<ImmutableArray<Diagnostic>> GetDocumentSpanDiagnosticsAsync(Document document, TextSpan filterSpan)
CodeFixes\FixAllOccurrences\FixAllContext.SpanBasedDiagnosticProvider.cs (3)
19/// which supports a <see cref="GetDocumentSpanDiagnosticsAsync(Document, TextSpan, CancellationToken)"/> 26/// <see cref="GetDocumentSpanDiagnosticsAsync(Document, TextSpan, CancellationToken)"/> method to compute 34public abstract Task<IEnumerable<Diagnostic>> GetDocumentSpanDiagnosticsAsync(Document document, TextSpan fixAllSpan, CancellationToken cancellationToken);
CodeFixes\FixAllOccurrences\FixAllState.cs (2)
24public TextSpan? DiagnosticSpan { get; } 28TextSpan? diagnosticSpan,
CodeFixes\FixAllOccurrences\TextChangeMerger.cs (1)
24public TextSpan GetSpan(TextChange value)
CodeFixes\Supression\IConfigurationFixProvider.cs (1)
28Task<ImmutableArray<CodeFix>> GetFixesAsync(TextDocument document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken);
CodeRefactorings\CodeRefactoringContext.cs (12)
49public TextSpan Span { get; } 56private readonly Action<CodeAction, TextSpan?> _registerRefactoring; 64TextSpan span, 75TextSpan span, 86TextSpan span, 87Action<CodeAction, TextSpan?> registerRefactoring, 108/// <param name="applicableToSpan">The <see cref="TextSpan"/> within original document the <paramref name="action"/> is applicable to.</param> 111/// applicable to. It doesn't have to precisely represent the exact <see cref="TextSpan"/> that will get changed. 113internal void RegisterRefactoring(CodeAction action, TextSpan applicableToSpan) => RegisterRefactoring(action, new Nullable<TextSpan>(applicableToSpan)); 115private void RegisterRefactoring(CodeAction action, TextSpan? applicableToSpan) 125internal void Deconstruct(out Document document, out TextSpan span, out CancellationToken cancellationToken)
CodeRefactorings\FixAllOccurences\DocumentBasedRefactorAllProvider.cs (1)
60RefactorAllContext refactorAllContext, Document document, Optional<ImmutableArray<TextSpan>> refactorAllSpans);
CodeRefactorings\FixAllOccurences\RefactorAllContext.cs (1)
99public Task<ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>> GetRefactorAllSpansAsync(CancellationToken cancellationToken)
CodeRefactorings\FixAllOccurences\RefactorAllProvider.cs (5)
55public static RefactorAllProvider Create(Func<RefactorAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> refactorAllAsync) 74Func<RefactorAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> refactorAllAsync, 81Func<RefactorAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> refactorAllAsync, 98Func<RefactorAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> refactorAllAsync, 104protected override Task<Document?> RefactorAllAsync(RefactorAllContext context, Document document, Optional<ImmutableArray<TextSpan>> refactorAllSpans)
CodeRefactorings\FixAllOccurences\RefactorAllState.cs (9)
27private readonly TextSpan _selectionSpan; 36TextSpan selectionSpan, 48TextSpan selectionSpan, 61TextSpan selectionSpan, 89internal async Task<ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>> GetRefactorAllSpansAsync(CancellationToken cancellationToken) 98return ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>.Empty; 102return spansByDocument.Select(kvp => KeyValuePair.Create(kvp.Key, new Optional<ImmutableArray<TextSpan>>(kvp.Value))) 119return ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>.Empty; 122return documentsToRefactor.ToImmutableDictionary(d => d, _ => default(Optional<ImmutableArray<TextSpan>>));
CodeRefactorings\SyntaxEditorBasedCodeRefactoringProvider.cs (3)
38TextSpan refactorAllSpan, 49Optional<ImmutableArray<TextSpan>> refactorAllSpans, 80ImmutableArray<TextSpan> refactorAllSpans,
Diagnostics\DiagnosticDataLocation.cs (1)
104public DiagnosticDataLocation WithSpan(TextSpan newSourceSpan, SyntaxTree tree)
Diagnostics\DocumentAnalysisScope.cs (3)
23TextSpan? span, 39public TextSpan? Span { get; } 57public DocumentAnalysisScope WithSpan(TextSpan? span)
Diagnostics\Extensions.cs (5)
60var span = dataLocation.UnmappedFileSpan.GetClampedTextSpan(text); 251TextSpan? span, 267TextSpan? span, 313TextSpan? filterSpan = null) 432public static ImmutableArray<DiagnosticData> ConvertToLocalDiagnostics(ImmutableArray<Diagnostic> diagnostics, TextDocument targetTextDocument, TextSpan? span = null)
Diagnostics\IRemoteDiagnosticAnalyzerService.cs (1)
26TextSpan? range,
Diagnostics\IWorkspaceVenusSpanMappingService.cs (1)
18void GetAdjustedDiagnosticSpan(DocumentId documentId, Location location, out TextSpan span, out FileLinePositionSpan originalLineInfo, out FileLinePositionSpan mappedLineInfo);
Differencing\AbstractSyntaxComparer.cs (1)
48protected internal sealed override TextSpan GetSpan(SyntaxNode node)
Differencing\TreeComparer.cs (1)
132protected internal abstract TextSpan GetSpan(TNode node);
Editing\ImportAdder.cs (7)
18private static async ValueTask<IEnumerable<TextSpan>> GetSpansAsync(Document document, CancellationToken cancellationToken) 24private static async ValueTask<IEnumerable<TextSpan>> GetSpansAsync(Document document, SyntaxAnnotation annotation, CancellationToken cancellationToken) 39public static Task<Document> AddImportsAsync(Document document, TextSpan span, OptionSet? options = null, CancellationToken cancellationToken = default) 51public static Task<Document> AddImportsAsync(Document document, IEnumerable<TextSpan> spans, OptionSet? options = null, CancellationToken cancellationToken = default) 54private static async Task<Document> AddImportsFromSyntaxesAsync(Document document, IEnumerable<TextSpan> spans, OptionSet? _, CancellationToken cancellationToken) 82internal static Task<Document> AddImportsFromSyntaxesAsync(Document document, IEnumerable<TextSpan> spans, AddImportPlacementOptions options, CancellationToken cancellationToken) 97internal static Task<Document> AddImportsFromSymbolAnnotationAsync(Document document, IEnumerable<TextSpan> spans, AddImportPlacementOptions options, CancellationToken cancellationToken)
FindSymbols\FindReferences\FindReferenceCache.cs (1)
202var span = token.Span;
FindSymbols\IRemoteSymbolFinderService.cs (1)
27ValueTask OnLiteralReferenceFoundAsync(RemoteServiceCallbackId callbackId, DocumentId documentId, TextSpan span, CancellationToken cancellationToken);
FindSymbols\IStreamingFindReferencesProgress.cs (1)
83ValueTask OnReferenceFoundAsync(Document document, TextSpan span, CancellationToken cancellationToken);
FindSymbols\SymbolFinder.CallbackDispatcher.cs (1)
61public ValueTask OnLiteralReferenceFoundAsync(RemoteServiceCallbackId callbackId, DocumentId documentId, TextSpan span, CancellationToken cancellationToken)
FindSymbols\SymbolFinder.FindLiteralsServerCallback.cs (1)
24public async ValueTask OnLiteralReferenceFoundAsync(DocumentId documentId, TextSpan span, CancellationToken cancellationToken)
FindSymbols\SyntaxTree\SyntaxTreeIndex.cs (2)
20private readonly Dictionary<InterceptsLocationData, TextSpan>? _interceptsLocationInfo; 28Dictionary<InterceptsLocationData, TextSpan>? interceptsLocationInfo)
FindSymbols\SyntaxTree\SyntaxTreeIndex_Create.cs (2)
53Dictionary<InterceptsLocationData, TextSpan>? interceptsLocationInfo = null; 266ref Dictionary<InterceptsLocationData, TextSpan>? interceptsLocationInfo,
FindSymbols\SyntaxTree\SyntaxTreeIndex_Forwarders.cs (1)
76public bool TryGetInterceptsLocation(InterceptsLocationData data, out TextSpan span)
FindSymbols\SyntaxTree\SyntaxTreeIndex_Persistence.cs (1)
84Dictionary<InterceptsLocationData, TextSpan>? interceptsLocationInfo = null;
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (4)
52TextSpan span, 89public readonly TextSpan Span = span; 123TextSpan span, 209var span = new TextSpan(spanStart, spanLength);
FindSymbols\TopLevelSyntaxTree\NavigateToSearchIndex.NavigateToSearchInfo.cs (7)
198using var charParts = TemporaryArray<TextSpan>.Empty; 238foreach (var part in charParts) 262foreach (var part in charParts) 320foreach (var part in charParts) 434using var charParts = TemporaryArray<TextSpan>.Empty; 440foreach (var part in charParts) 582using var charParts = TemporaryArray<TextSpan>.Empty;
Formatting\AbstractFormattingService.cs (1)
17public Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, LineFormattingOptions lineFormattingOptions, SyntaxFormattingOptions? syntaxFormattingOptions, CancellationToken cancellationToken)
Formatting\Formatter.cs (17)
63public static Task<Document> FormatAsync(Document document, TextSpan span, OptionSet? options = null, CancellationToken cancellationToken = default) 68internal static Task<Document> FormatAsync(Document document, TextSpan span, SyntaxFormattingOptions options, CancellationToken cancellationToken) 79public static async Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, OptionSet? options = null, CancellationToken cancellationToken = default) 91internal static async Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions? options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 205public static SyntaxNode Format(SyntaxNode node, TextSpan span, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 208internal static SyntaxNode Format(SyntaxNode node, TextSpan span, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken) 220public static SyntaxNode Format(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 223private static SyntaxNode Format(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 229internal static SyntaxNode Format(SyntaxNode node, IEnumerable<TextSpan>? spans, SolutionServices services, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 232private static IFormattingResult? GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 256internal static IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SolutionServices services, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 282public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, TextSpan span, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 285internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, TextSpan span, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken = default) 297public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 300internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken = default) 303private static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 311internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, SolutionServices services, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken = default)
Formatting\IFormattingService.cs (1)
24Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, LineFormattingOptions lineFormattingOptions, SyntaxFormattingOptions? syntaxFormattingOptions, CancellationToken cancellationToken);
Formatting\Rules\DefaultFormattingRuleFactoryServiceFactory.cs (1)
31public IEnumerable<TextChange> FilterFormattedChanges(DocumentId document, TextSpan span, IList<TextChange> changes)
Formatting\Rules\IHostDependentFormattingRuleFactoryService.cs (1)
16IEnumerable<TextChange> FilterFormattedChanges(DocumentId documentId, TextSpan span, IList<TextChange> changes);
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (4)
74var oldText = oldDocumentText.GetSubText(TextSpan.FromBounds(startLineStartPosition, endLineEndPosition)); 75var adjustedChanges = changePartition.Select(c => new TextChange(TextSpan.FromBounds(c.Span.Start - startLineStartPosition, c.Span.End - startLineStartPosition), c.NewText!)); 84commentChanges.Add(new TextChange(TextSpan.FromBounds(startLineStartPosition, startLineStartPosition), warningText)); 144? text.GetSubText(TextSpan.FromBounds(text.Lines[startLine].Start, text.Lines[endLine].End)).ToString()
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (4)
208private static (ImmutableArray<TextChange> mergeChanges, ImmutableArray<TextSpan> mergeConflictResolutionSpans) MergeChangesWithMergeFailComments( 216using var _2 = ArrayBuilder<TextSpan>.GetInstance(out var mergeConflictResolutionSpans); 242var conflictingCommentInsertionLocation = new TextSpan(mergedChange.Span.Start, 0); 283currentChange = new TextChange(TextSpan.FromBounds(currentChange.Span.Start, nextChange.Span.End), currentChange.NewText + nextChange.NewText);
LinkedFileDiffMerging\LinkedFileMergeResult.cs (2)
10internal readonly struct LinkedFileMergeResult(ImmutableArray<DocumentId> documentIds, SourceText mergedSourceText, ImmutableArray<TextSpan> mergeConflictResolutionSpans) 14public readonly ImmutableArray<TextSpan> MergeConflictResolutionSpans = mergeConflictResolutionSpans;
LinkedFileDiffMerging\LinkedFileMergeSessionResult.cs (1)
16public readonly Dictionary<DocumentId, ImmutableArray<TextSpan>> MergeConflictCommentSpans = [];
ObsoleteSymbol\AbstractObsoleteSymbolService.cs (8)
25protected virtual void ProcessDimKeyword(ref ArrayBuilder<TextSpan>? result, SemanticModel semanticModel, SyntaxToken token, CancellationToken cancellationToken) 30public async Task<ImmutableArray<TextSpan>> GetLocationsAsync(Document document, ImmutableArray<TextSpan> textSpans, CancellationToken cancellationToken) 40ArrayBuilder<TextSpan>? result = null; 43foreach (var span in textSpans) 59void Recurse(TextSpan span, SemanticModel semanticModel) 103void AddResult(TextSpan span) 105result ??= ArrayBuilder<TextSpan>.GetInstance();
ObsoleteSymbol\IObsoleteSymbolService.cs (2)
20Task<ImmutableArray<TextSpan>> GetLocationsAsync(Document document, ImmutableArray<TextSpan> textSpans, CancellationToken cancellationToken);
PatternMatching\AllLowerCamelCaseMatcher.cs (12)
39in TemporaryArray<TextSpan> candidateHumps, out ImmutableArray<TextSpan> matchedSpans) 66private static PatternMatchKind GetKind(CamelCaseResult result, in TemporaryArray<TextSpan> candidateHumps) 70int patternIndex, int candidateHumpIndex, bool? contiguous, in TemporaryArray<TextSpan> candidateHumps) 76var matchedSpansInReverse = includeMatchedSpans ? ArrayBuilder<TextSpan>.GetInstance() : null; 96var candidateHump = candidateHumps[humpIndex]; 150int patternIndex, int humpIndex, bool contiguous, in TemporaryArray<TextSpan> candidateHumps) 154var candidateHump = candidateHumps[humpIndex]; 192var matchSpanToAdd = new TextSpan(candidateHump.Start, possibleHumpMatchLength); 212CamelCaseResult result, ref CamelCaseResult? bestResult, TextSpan? matchSpanToAdd, in TemporaryArray<TextSpan> candidateHumps) 241private static bool IsBetter(CamelCaseResult result, CamelCaseResult? currentBestResult, in TemporaryArray<TextSpan> candidateHumps)
PatternMatching\CamelCaseResult.cs (4)
22public readonly ArrayBuilder<TextSpan> MatchedSpansInReverse; 24public CamelCaseResult(bool fromStart, bool contiguous, int matchCount, ArrayBuilder<TextSpan> matchedSpansInReverse) 40public CamelCaseResult WithAddedMatchedSpan(TextSpan value) 47private static PatternMatchKind GetCamelCaseKind(CamelCaseResult result, in TemporaryArray<TextSpan> candidateHumps)
PatternMatching\PatternMatch.cs (4)
35public ImmutableArray<TextSpan> MatchedSpans { get; } 41TextSpan? matchedSpan) 51ImmutableArray<TextSpan> matchedSpans) 59public PatternMatch WithMatchedSpans(ImmutableArray<TextSpan> matchedSpans)
PatternMatching\PatternMatcher.cs (15)
180using var candidateHumps = TemporaryArray<TextSpan>.Empty; 270var hump = TextSpan.FromBounds(candidateHumps[i].Start, candidateLength); 320private TextSpan? GetMatchedSpan(int start, int length) 431private bool PartStartsWith(string candidate, TextSpan candidatePart, string pattern, TextSpan patternPart, CompareOptions compareOptions) 452private bool PartStartsWith(string candidate, TextSpan candidatePart, string pattern, CompareOptions compareOptions) 460in TemporaryArray<TextSpan> candidateHumps) 507in TemporaryArray<TextSpan> candidateHumps, 509out ImmutableArray<TextSpan> matchedSpans) 517in TemporaryArray<TextSpan> candidateHumps, 520out ImmutableArray<TextSpan> matchedSpans) 537using var matchSpans = TemporaryArray<TextSpan>.Empty; 562var candidateHump = candidateHumps[currentCandidateHump]; 571var patternChunkCharacterSpan = patternHumps[currentPatternHump];
PatternMatching\PatternMatcher.TextChunk.cs (2)
30public TemporaryArray<TextSpan> PatternHumps; 38PatternHumps = TemporaryArray<TextSpan>.Empty;
ReassignedVariable\AbstractReassignedVariableService.cs (8)
39public async Task<ImmutableArray<TextSpan>> GetLocationsAsync( 40Document document, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken) 49using var _2 = ArrayBuilder<TextSpan>.GetInstance(out var result); 53foreach (var span in spans) 61void Recurse(TextSpan span, SemanticModel semanticModel) 178if (!TryGetParameterLocation(semanticModel, parameter, out var parameterLocation)) 240bool TryGetParameterLocation(SemanticModel semanticModel, IParameterSymbol parameter, out TextSpan location) 293TextSpan localOrParameterDeclarationSpan,
ReassignedVariable\IReassignedVariableService.cs (2)
20Task<ImmutableArray<TextSpan>> GetLocationsAsync(Document document, ImmutableArray<TextSpan> textSpans, CancellationToken cancellationToken);
Remote\RemoteArguments.cs (2)
132TextSpan location, 145public readonly TextSpan Location = location;
Rename\ConflictEngine\ComplexifiedSpan.cs (8)
12internal readonly struct ComplexifiedSpan(TextSpan originalSpan, TextSpan newSpan, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)> modifiedSubSpans) 15public readonly TextSpan OriginalSpan = originalSpan; 18public readonly TextSpan NewSpan = newSpan; 21public readonly ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)> ModifiedSubSpans = modifiedSubSpans;
Rename\ConflictEngine\ConflictResolver.Session.cs (7)
73public readonly TextSpan ComplexifiedSpan; 77public readonly TextSpan OriginalIdentifierSpan; 375var originalLocation = conflictAnnotation.OriginalSpan; 869private static ImmutableSortedSet<TextSpan>? GetSubSpansToRenameInStringAndCommentTextSpans( 870TextSpan containingLocationForStringOrComment, 873var builder = ImmutableSortedSet.CreateBuilder<TextSpan>(); 888var subSpan = new TextSpan(offset, length);
Rename\ConflictEngine\RelatedLocation.cs (2)
23[property: DataMember(Order = 0)] TextSpan ConflictCheckSpan, 27[property: DataMember(Order = 4)] TextSpan ComplexifiedTargetSpan = default)
Rename\ConflictEngine\RenamedSpansTracker.cs (24)
25private readonly Dictionary<DocumentId, List<(TextSpan oldSpan, TextSpan newSpan)>> _documentToModifiedSpansMap = []; 31internal void AddModifiedSpan(DocumentId documentId, TextSpan oldSpan, TextSpan newSpan) 42internal void AddComplexifiedSpan(DocumentId documentId, TextSpan oldSpan, TextSpan newSpan, List<(TextSpan oldSpan, TextSpan newSpan)> modifiedSubSpans) 70var appliedTextSpans = new HashSet<TextSpan>(); 122TextSpan originalSpan, TextSpan newSpan, List<(TextSpan oldSpan, TextSpan newSpan)> modifiedSubSpans) 124public TextSpan OriginalSpan = originalSpan; 125public TextSpan NewSpan = newSpan; 126public List<(TextSpan oldSpan, TextSpan newSpan)> ModifiedSubSpans = modifiedSubSpans; 191var oldSpan = annotationAndNode.Item1.OriginalTextSpan; 197var modifiedSubSpans = new List<(TextSpan oldSpan, TextSpan newSpan)>(); 232public ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> GetDocumentToModifiedSpansMap() 234var builder = ImmutableDictionary.CreateBuilder<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>>();
Rename\ConflictResolution.cs (14)
49private readonly ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> _documentToModifiedSpansMap; 65_documentToModifiedSpansMap = ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>>.Empty; 76ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> documentToModifiedSpansMap, 98public ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)> GetComplexifiedSpans(DocumentId documentId) 103public ImmutableDictionary<TextSpan, TextSpan> GetModifiedSpanMap(DocumentId documentId) 105var result = ImmutableDictionary.CreateBuilder<TextSpan, TextSpan>(); 129internal TextSpan GetResolutionTextSpan(TextSpan originalSpan, DocumentId documentId)
Rename\IRemoteRenamerService.cs (8)
50TextSpan location, 55TextSpan containingLocationForStringOrComment, 59public readonly TextSpan Location = location; 74public readonly TextSpan ContainingLocationForStringOrComment = containingLocationForStringOrComment; 213ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> documentToModifiedSpansMap, 233public readonly ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> DocumentToModifiedSpansMap = documentToModifiedSpansMap;
Rename\LightweightRenameLocations.cs (1)
128public LightweightRenameLocations Filter(Func<DocumentId, TextSpan, bool> filter)
Rename\RenameLocation.cs (2)
18TextSpan containingLocationForStringOrComment = default) : IEquatable<RenameLocation> 25public readonly TextSpan ContainingLocationForStringOrComment = containingLocationForStringOrComment;
Rename\RenameRewriterParameters.cs (8)
21ImmutableDictionary<TextSpan, RenameLocation> renameLocations, 22ImmutableDictionary<TextSpan, ImmutableSortedSet<TextSpan>?> stringAndCommentTextSpans, 23ImmutableHashSet<TextSpan> conflictLocationSpans, 34internal readonly ImmutableHashSet<TextSpan> ConflictLocationSpans = conflictLocationSpans; 42internal readonly ImmutableDictionary<TextSpan, RenameLocation> RenameLocations = renameLocations; 47internal readonly ImmutableDictionary<TextSpan, ImmutableSortedSet<TextSpan>?> StringAndCommentTextSpans = stringAndCommentTextSpans;
Rename\RenameUtilities.cs (2)
284ImmutableSortedSet<TextSpan>? subSpansToReplace = null) 300foreach (var subSpan in subSpansToReplace)
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (3)
419IEnumerable<Tuple<string, int, TextSpan>> renameStringsAndPositions, 427var containingSpan = renameStringAndPosition.Item3; 438var matchTextSpan = new TextSpan(start, renameText.Length);
Shared\Extensions\FileLinePositionSpanExtensions.cs (3)
13public static TextSpan GetClampedTextSpan(this FileLinePositionSpan span, SourceText text) 24/// Returns a new <see cref="TextSpan"/> based off of the positions in <paramref name="span"/>, but 27public static TextSpan GetClampedTextSpan(this LinePositionSpan span, SourceText text)
Shared\Extensions\SourceTextExtensions.cs (1)
52TextSpan textSpan,
Shared\Extensions\TokenSemanticInfo.cs (2)
21TextSpan span) 32public readonly TextSpan Span = span;
Simplification\Simplifier.cs (4)
203public static Task<Document> ReduceAsync(Document document, TextSpan span, OptionSet? optionSet = null, CancellationToken cancellationToken = default) 215internal static Task<Document> ReduceAsync(Document document, TextSpan span, SimplifierOptions options, CancellationToken cancellationToken) 222public static async Task<Document> ReduceAsync(Document document, IEnumerable<TextSpan> spans, OptionSet? optionSet = null, CancellationToken cancellationToken = default) 240internal static Task<Document> ReduceAsync(Document document, IEnumerable<TextSpan> spans, SimplifierOptions options, CancellationToken cancellationToken)
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (3)
29var fullSpan = new TextSpan(0, text.Length); 36var change = TextChangeRange.Collapse(changes).Span; 49var span = node.FullSpan;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (3)
105var thisSpan = introspector.GetSpan(value); 125var thisSpan = introspector.GetSpan(value); 138var thisSpan = introspector.GetSpan(value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (40)
14internal sealed class NormalizedTextSpanCollection : ReadOnlyCollection<TextSpan> 29public NormalizedTextSpanCollection(TextSpan span) 42public NormalizedTextSpanCollection(IEnumerable<TextSpan> spans) 93var span1 = left[index1]; 94var span2 = right[index2]; 122spans.Add(TextSpan.FromBounds(start, end)); 161var span1 = left[index1]; 162var span2 = right[index2]; 221var span1 = left[index1]; 222var span2 = right[index2]; 283var span1 = left[index1]; 284var span2 = right[index2]; 296spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 307spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span2.Start)); 333var span1 = left[index1++]; 334spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 398var span1 = this[index1]; 399var span2 = set[index2]; 429public bool OverlapsWith(TextSpan span) 458var span1 = this[index1]; 459var span2 = set[index2]; 483public bool IntersectsWith(TextSpan span) 506foreach (var s in this) 533foreach (var s in this) 546private static IList<TextSpan> ListFromSpan(TextSpan span) 548IList<TextSpan> list = 564private static void UpdateSpanUnion(TextSpan span, IList<TextSpan> spans, ref int start, ref int end) 568spans.Add(TextSpan.FromBounds(start, end)); 585private static IList<TextSpan> NormalizeSpans(IEnumerable<TextSpan> spans) 592var sorted = new List<TextSpan>(spans); 599sorted.Sort(delegate (TextSpan s1, TextSpan s2) { return s1.Start.CompareTo(s2.Start); }); 601IList<TextSpan> normalized = new List<TextSpan>(sorted.Count); 611normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 621normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 626private sealed class OrderedSpanList : List<TextSpan>
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\TextSpanMutableIntervalTree.cs (9)
10internal readonly struct TextSpanIntervalIntrospector : IIntervalIntrospector<TextSpan> 12public TextSpan GetSpan(TextSpan value) 16internal sealed class TextSpanMutableIntervalTree(IEnumerable<TextSpan>? values) 17: SimpleMutableIntervalTree<TextSpan, TextSpanIntervalIntrospector>(new TextSpanIntervalIntrospector(), values) 23public TextSpanMutableIntervalTree(params TextSpan[]? values) : this((IEnumerable<TextSpan>?)values) 27public bool HasIntervalThatIntersectsWith(TextSpan span) 30public bool HasIntervalThatOverlapsWith(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\NamingStyles\NamingStyleOption.cs (3)
13/// The root naming style option composed of several settings as well as a <see cref="TextSpan"/>s describing where they were all defined. 29/// A description of the kinds of symbols a rule should apply to as well as a <see cref="TextSpan"/>s describing where they were all defined. 42/// The rules about how the specified symbols must be named as well as a <see cref="TextSpan"/>s describing where they were all defined.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\Section.cs (2)
16public TextSpan Span { get; init; } 24public Section(string? filePath, bool isGlobal, TextSpan span, string text, string fullText)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxHelpers.cs (4)
12public static TextSpan GetSpan<TSyntaxKind>(EmbeddedSyntaxToken<TSyntaxKind> token1, EmbeddedSyntaxToken<TSyntaxKind> token2) where TSyntaxKind : struct 15public static TextSpan GetSpan(VirtualCharSequence virtualChars) 18public static TextSpan GetSpan(VirtualChar firstChar, VirtualChar lastChar) 19=> TextSpan.FromBounds(firstChar.Span.Start, lastChar.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (6)
42private TextSpan? _fullSpan; 56public TextSpan GetSpan() 63return TextSpan.FromBounds(start, end); 66public TextSpan? GetFullSpan() 69private TextSpan? ComputeFullSpan() 76return TextSpan.FromBounds(start.Value, end.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (2)
68/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 96public TextSpan Span => new(TokenStart + Green.Offset, Green.Width);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharGreenSequence.Chunks.cs (1)
50var span = new VirtualChar(ch, tokenStart).Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
50private readonly TextSpan _span; 57private VirtualCharGreenSequence(Chunk sequence, TextSpan span) 114TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharUtilities.cs (4)
15public static TextSpan FromBounds(VirtualChar vc1, VirtualChar vc2) 16=> TextSpan.FromBounds(vc1.Span.Start, vc2.Span.End); 26public static (ImmutableSegmentedList<VirtualChar> sourceCode, ImmutableArray<TextSpan> markdownSpans) StripMarkupCharacters( 29using var _ = ArrayBuilder<TextSpan>.GetInstance(out var markdownSpans);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (13)
13private static bool ShouldAnalyze(TextSpan? contextFilterSpan, TextSpan span) 23public static bool ShouldAnalyzeSpan(this SyntaxTreeAnalysisContext context, TextSpan span) 33public static bool ShouldAnalyzeSpan(this SemanticModelAnalysisContext context, TextSpan span) 43public static bool ShouldAnalyzeSpan(this SymbolStartAnalysisContext context, TextSpan span, SyntaxTree tree) 63public static bool ShouldAnalyzeSpan(this SymbolAnalysisContext context, TextSpan span, SyntaxTree tree) 83public static bool ShouldAnalyzeSpan(this AdditionalFileAnalysisContext context, TextSpan span) 93public static bool ShouldAnalyzeSpan(this OperationBlockStartAnalysisContext context, TextSpan span) 103public static bool ShouldAnalyzeSpan(this OperationBlockAnalysisContext context, TextSpan span) 113public static bool ShouldAnalyzeSpan(this OperationAnalysisContext context, TextSpan span) 123public static bool ShouldAnalyzeSpan(this SyntaxNodeAnalysisContext context, TextSpan span) 133public static bool ShouldAnalyzeSpan<TSytnaxKind>(this CodeBlockStartAnalysisContext<TSytnaxKind> context, TextSpan span) where TSytnaxKind : struct 143public static bool ShouldAnalyzeSpan(this CodeBlockAnalysisContext context, TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (2)
32this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden, CancellationToken cancellationToken) 44this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (12)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate) 296public static TextSpan GetContainedSpan(this IEnumerable<SyntaxNode> nodes) 301var fullSpan = nodes.First().Span; 304fullSpan = TextSpan.FromBounds( 315public static bool OverlapsHiddenPosition(this SyntaxNode node, TextSpan span, CancellationToken cancellationToken) 323var textSpan = TextSpan.FromBounds(start, end); 409var spans = new List<TextSpan>(nodesToReplace.Count + tokensToReplace.Count + triviaToReplace.Count); 432TextSpan previous = default; 433foreach (var span in spans) 785public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 963var fullSpan = node.FullSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (3)
18public static bool OverlapsHiddenPosition([NotNullWhen(returnValue: true)] this SyntaxTree? tree, TextSpan span, CancellationToken cancellationToken) 98public static bool IsEntirelyHidden(this SyntaxTree tree, TextSpan span, CancellationToken cancellationToken) 252public static SyntaxNode FindNode(this SyntaxTree syntaxTree, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (22)
18public static IEnumerable<TextSpan> ToNormalizedSpans(this IEnumerable<TextSpan> spans) 21public static ImmutableArray<TextSpan> ToNormalizedSpans(this ImmutableArray<TextSpan> spans) 24public static TextSpan Collapse(this IEnumerable<TextSpan> spans) 29foreach (var span in spans) 48return TextSpan.FromBounds(start, end); 54public static bool IsAround(this TextSpan span, SyntaxNodeOrToken node) => IsAround(span, node, node); 60public static bool IsAround(this TextSpan span, SyntaxNodeOrToken startNode, SyntaxNodeOrToken endNode) 62var innerSpan = TextSpan.FromBounds(startNode.Span.Start, endNode.Span.End); 63var outerSpan = TextSpan.FromBounds(startNode.FullSpan.Start, endNode.FullSpan.End); 67public static IEnumerable<TextSpan> Subtract(this TextSpan span, TextSpan except) 81yield return TextSpan.FromBounds(span.Start, startSegmentEnd); 85yield return TextSpan.FromBounds(endSegmentStart, span.End); 88public static IEnumerable<TextSpan> Subtract(this IEnumerable<TextSpan> spans, TextSpan except)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\AbstractSyntaxFormatting.cs (3)
21private static readonly Func<TextSpan, bool> s_notEmpty = s => !s.IsEmpty; 32public IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 34IReadOnlyList<TextSpan> spansToFormat;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.AnchorData.cs (4)
18public TextSpan TextSpan => operation.TextSpan; 34TextSpan IIntervalIntrospector<AnchorData>.GetSpan(AnchorData value) 37TextSpan IIntervalIntrospector<IndentationData>.GetSpan(IndentationData value) 40TextSpan IIntervalIntrospector<RelativeIndentationData>.GetSpan(RelativeIndentationData value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (18)
45private readonly HashSet<TextSpan> _indentationMap = []; 46private readonly HashSet<TextSpan> _suppressWrappingMap = []; 47private readonly HashSet<TextSpan> _suppressSpacingMap = []; 48private readonly HashSet<TextSpan> _suppressFormattingMap = []; 49private readonly HashSet<TextSpan> _anchorMap = []; 140var baseSpan = _initialIndentBlockOperations[0].TextSpan; 159var operationSpan = operations[i].TextSpan; 180var intervalTreeSpan = operation.TextSpan; 409private static void DebugCheckEmpty<T, TIntrospector>(ContextMutableIntervalTree<T, TIntrospector> tree, TextSpan textSpan) 448var span = token.Span; 469var span = token.Span; 592public bool IsWrappingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 614public bool IsSpacingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 643var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End); 650public bool IsFormattingDisabled(TextSpan textSpan) 658var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.IndentationData.cs (14)
17private abstract class IndentationData(TextSpan textSpan) 19public TextSpan TextSpan { get; } = textSpan; 22public IndentationData WithTextSpan(TextSpan span) 25protected abstract IndentationData WithTextSpanCore(TextSpan span); 28private sealed class SimpleIndentationData(TextSpan textSpan, int indentation) : IndentationData(textSpan) 32protected override IndentationData WithTextSpanCore(TextSpan span) 56public RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter) 67this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 70private RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter, int lazyIndentationDelta) 81this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 84public TextSpan InseparableRegionSpan { get; } 106protected override IndentationData WithTextSpanCore(TextSpan span) 118public AdjustedIndentationData(TextSpan textSpan, IndentationData baseIndentationData, int adjustment) 141protected override IndentationData WithTextSpanCore(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ContextMutableIntervalTree.cs (4)
40var thisSpan = introspector.GetSpan(value); 52var thisSpan = introspector.GetSpan(value); 125var resultSpan = Introspector.GetSpan(result!); 126var currentNodeSpan = Introspector.GetSpan(currentNode.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (5)
44protected readonly TextSpan SpanToFormat; 336private TextSpan GetSpanToFormat() 341return TextSpan.FromBounds(startPosition, endPosition); 458var spanBetweenTokens = TextSpan.FromBounds(token1.Span.End, token2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (4)
26public readonly TextSpan FormattedSpan; 31TextSpan formattedSpan) 78var span = TextSpan.FromBounds(token1.RawKind == 0 ? this.TreeInfo.StartPosition : token1.Span.End, token2.RawKind == 0 ? this.TreeInfo.EndPosition : token2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.NodeAndText.cs (3)
37return _text.ToString(TextSpan.FromBounds(token2.FullSpan.Start, token2.SpanStart)); 43return _text.ToString(TextSpan.FromBounds(token1.Span.End, token1.FullSpan.End)); 46return _text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (13)
239var span = textChange.Span; 267internal static IEnumerable<TextSpan> GetAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 277static IEnumerable<TextSpan> EnumerateAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 295internal static TextSpan GetSpanIncludingPreviousAndNextTokens(SyntaxToken firstToken, SyntaxToken lastToken) 307return TextSpan.FromBounds(start, end); 310internal static TextSpan GetElasticSpan(SyntaxToken token) 313private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 315var aggregateSpans = new List<TextSpan>(); 317var last = default(TextSpan); 318foreach (var span in spans) 326last = TextSpan.FromBounds(last.Start, span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (10)
20private readonly TextSpan _span; 22public BaseIndentationFormattingRule(SyntaxNode root, TextSpan span, int baseIndentation, AbstractFormattingRule? vbHelperFormattingRule = null) 130private TextSpan AdjustTextSpan(TextSpan textSpan) 131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End)); 133private static void SetInnermostNodeForSpan(SyntaxNode root, ref TextSpan span, out SyntaxToken token1, out SyntaxToken token2, out SyntaxNode? commonNode) 149private static void GetTokens(SyntaxNode root, TextSpan span, out SyntaxToken token1, out SyntaxToken token2) 168private static TextSpan GetSpanFromTokens(TextSpan span, SyntaxToken token1, SyntaxToken token2) 217return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\FormattingOperations.cs (8)
30=> CreateAnchorIndentationOperation(anchorToken, endToken, TextSpan.FromBounds(anchorToken.Span.End, endToken.Span.End)); 35public static AnchorIndentationOperation CreateAnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 42=> CreateSuppressOperation(startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End), option); 47private static SuppressOperation CreateSuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option) 55var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 62public static IndentBlockOperation CreateIndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 70var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 78public static IndentBlockOperation CreateRelativeIndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\IndentBlockOperation.cs (3)
14internal IndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 33internal IndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 56public TextSpan TextSpan { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\SuppressOperation.cs (2)
14public readonly TextSpan TextSpan; 19internal SuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (13)
45private delegate void WhitespaceAppender<T>(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<T> changes); 387var span = GetTextSpan(trivia1, trivia2); 499var span = TextSpan.FromBounds(start, end); 715var insertionPoint = GetInsertionSpan(changes); 730private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 765TextSpan notUsed, 822private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 825private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes) 831private TextSpan GetTextSpan(SyntaxTrivia trivia1, SyntaxTrivia trivia2) 835return TextSpan.FromBounds(this.StartPosition, trivia2.FullSpan.Start); 840return TextSpan.FromBounds(trivia1.FullSpan.End, this.EndPosition); 843return TextSpan.FromBounds(trivia1.FullSpan.End, trivia2.FullSpan.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\AbstractUnnecessaryImportsProvider.cs (3)
23public ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken) 27SemanticModel model, TextSpan? span, Func<SyntaxNode, bool>? predicate, CancellationToken cancellationToken) 35bool HasImportThatIntersectsWithSpan(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (3)
237private TextSpan GetNormalizedSpan(int position) 241return TextSpan.FromBounds(LineToBeIndented.Start, position); 244return TextSpan.FromBounds(position, LineToBeIndented.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (3)
29using var parts = TemporaryArray<TextSpan>.Empty; 73private static ImmutableArray<string> CreateWords(in TemporaryArray<TextSpan> parts, string name) 76foreach (var part in parts)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (21)
160var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 174private WordSpanEnumerable GetWordSpans(string name, TextSpan nameSpan) 177private static string Substring(string name, TextSpan wordSpan) 180private static readonly Func<string, TextSpan, bool> s_firstCharIsLowerCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsLower(val[span.Start]); 181private static readonly Func<string, TextSpan, bool> s_firstCharIsUpperCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsUpper(val[span.Start]); 183private static readonly Func<string, TextSpan, bool> s_wordIsAllUpperCase = (val, span) => 196private static readonly Func<string, TextSpan, bool> s_wordIsAllLowerCase = (val, span) => 210string name, TextSpan nameSpan, Func<string, TextSpan, bool> wordCheck, 216foreach (var wordSpan in GetWordSpans(name, nameSpan)) 232private bool CheckPascalCase(string name, TextSpan nameSpan, out string reason) 237private bool CheckAllUpper(string name, TextSpan nameSpan, out string reason) 242private bool CheckAllLower(string name, TextSpan nameSpan, out string reason) 248string name, TextSpan nameSpan, 249Func<string, TextSpan, bool> firstWordCheck, 250Func<string, TextSpan, bool> restWordCheck, 260foreach (var wordSpan in GetWordSpans(name, nameSpan)) 291private bool CheckCamelCase(string name, TextSpan nameSpan, out string reason) 298private bool CheckFirstUpper(string name, TextSpan nameSpan, out string reason) 406using var parts = TemporaryArray<TextSpan>.Empty;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (4)
16private readonly TextSpan _nameSpan; 19public WordSpanEnumerator(string name, TextSpan nameSpan, string wordSeparator) 28public TextSpan Current { get; private set; } 70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\RefactoringHelpers\AbstractRefactoringHelpers.cs (10)
39/// Returns unchanged <paramref name="span"/> in case <see cref="TextSpan.IsEmpty"/>. 40/// Returns empty Span with original <see cref="TextSpan.Start"/> in case it contains only whitespace. 42private static TextSpan GetTrimmedTextSpan(SourceText sourceText, TextSpan span) 56return TextSpan.FromBounds(start, end); 60SourceText sourceText, SyntaxNode root, TextSpan selectionRaw, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 69var selectionTrimmed = GetTrimmedTextSpan(sourceText, selectionRaw); 354var rightNodeSpanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, rightNode); 366TextSpan selectionTrimmed, 384var spanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, nonHiddenExtractedNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\RefactoringHelpers\IRefactoringHelpers.cs (1)
55SourceText sourceText, SyntaxNode root, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (4)
34SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 38SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 42SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, 77SyntaxNode root, SourceText text, TextSpan textSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
429TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 432/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 433/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 435/// an empty <see cref="TextSpan"/> at position 0. 438TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 479bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(firstNode.Span.Start, lastNode.Span.End); 182this ISyntaxFacts syntaxFacts, TextSpan span, SyntaxNode node, CancellationToken cancellationToken) 441public static TextSpan GetSpanWithoutAttributes(this ISyntaxFacts syntaxFacts, SyntaxNode root, SyntaxNode node) 461return TextSpan.FromBounds(startOfNodeWithoutAttributes, endOfNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (6)
36private readonly TextSpan[] _wordSpans; 101_wordSpans = new TextSpan[distinctValues.Length]; 177private void Add(TextSpan characterSpan, int insertionIndex) 218TextSpan characterSpan, int insertionIndex, int currentNodeEdgeCount, int currentNodeIndex, int editDistance) 286private struct BuilderNode(TextSpan characterSpan) 288public readonly TextSpan CharacterSpan = characterSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (2)
11private readonly struct Node(TextSpan wordSpan, int edgeCount, int firstEdgeIndex) 17public readonly TextSpan WordSpan = wordSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (10)
45public static IEnumerable<(SyntaxToken, SyntaxToken)> ConvertToTokenPairs(this SyntaxNode root, IReadOnlyList<TextSpan> spans) 81public static ValueTuple<SyntaxToken, SyntaxToken> ConvertToTokenPair(this SyntaxNode root, TextSpan textSpan) 157=> (token1.RawKind == 0) ? text.ToString(TextSpan.FromBounds(0, token2.SpanStart)) : text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart)); 259public static TextSpan GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(SyntaxToken startToken, SyntaxToken endToken) 266return TextSpan.FromBounds(startPosition, endPosition); 324var fullSpan = node.FullSpan; 357public static TextSpan GetFormattingSpan(SyntaxNode root, TextSpan span) 367return TextSpan.FromBounds(startPosition, endPosition);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
17public static void AddWordParts(ReadOnlySpan<char> identifier, ref TemporaryArray<TextSpan> parts) 20public static void AddCharacterParts(ReadOnlySpan<char> identifier, ref TemporaryArray<TextSpan> parts) 23public static void AddParts(ReadOnlySpan<char> text, bool word, ref TemporaryArray<TextSpan> parts) 27var span = StringBreaker.GenerateSpan(text, start, word); 41public static TextSpan GenerateSpan(ReadOnlySpan<char> identifier, int wordStart, bool word) 81private static TextSpan ScanCharacterRun(ReadOnlySpan<char> identifier, int length, int wordStart) 102private static TextSpan ScanWordRun(ReadOnlySpan<char> identifier, int length, int wordStart) 151private static TextSpan ScanLowerCaseRun(ReadOnlySpan<char> identifier, int length, int wordStart) 162private static TextSpan ScanNumber(ReadOnlySpan<char> identifier, int length, int wordStart) 170return TextSpan.FromBounds(wordStart, current);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (2)
115IEnumerable<KeyValuePair<Document, ImmutableArray<TextSpan>>> documentsAndSpans) 120foreach (var span in spans)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\MultiProjectSafeFixAllProvider.cs (4)
26protected abstract void FixAll(SyntaxEditor editor, IEnumerable<TextSpan> commonSpans); 79using var _ = PooledHashSet<TextSpan>.GetInstance(out var commonSpans); 110static IEnumerable<TextSpan> GetDiagnosticSpans(ImmutableArray<Diagnostic> diagnostics) 114private SyntaxNode FixAll(SolutionServices services, SyntaxNode root, PooledHashSet<TextSpan> commonSpans)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixesAndRefactorings\AbstractFixAllSpanMappingService.cs (8)
20protected abstract Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansIfWithinGlobalStatementAsync( 21Document document, TextSpan span, CancellationToken cancellationToken); 23public Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 24Document document, TextSpan triggerSpan, FixAllScope fixAllScope, CancellationToken cancellationToken) 32private async Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 33Document document, TextSpan span, bool fixAllInContainingMember, CancellationToken cancellationToken) 50var builder = PooledDictionary<Document, ArrayBuilder<TextSpan>>.GetInstance(); 75TextSpan span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixesAndRefactorings\IFixAllSpanMappingService.cs (2)
30Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 31Document document, TextSpan triggerSpan, FixAllScope fixAllScope, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (3)
50protected static TextSpan GetSpan(SyntaxNode node) 55return TextSpan.FromBounds(start.SpanStart, end.Span.End); 110var span = GetSpan(destination);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (1)
24public void AddRelevantNodes<TSyntaxNode>(SourceText sourceText, SyntaxNode root, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringContextExtensions.cs (9)
21this CodeRefactoringContext context, ImmutableArray<TCodeAction> actions, TextSpan? applicableToSpan = null) 59public static async Task<TSyntaxNode?> TryGetRelevantNodeAsync<TSyntaxNode>(this Document document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 65public static TSyntaxNode? TryGetRelevantNode<TSyntaxNode>(this ParsedDocument document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 68public static TSyntaxNode? TryGetRelevantNode<TSyntaxNode>(this ParsedDocument document, TextSpan span, bool allowEmptyNode, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 76this Document document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 82this Document document, TextSpan span, bool allowEmptyNodes, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 89this ParsedDocument document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 93this ParsedDocument document, TextSpan span, bool allowEmptyNodes, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 102this ParsedDocument document, TextSpan span, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (1)
38public static bool IsNodeUnderselected(SyntaxNode? node, TextSpan selection)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\IRefactoringHelpersService.cs (1)
20this IRefactoringHelpersService service, ParsedDocument document, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
32IEnumerable<TextSpan> spans,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
142public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (2)
393using var parts = TemporaryArray<TextSpan>.Empty; 397var p = parts[i];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\FormatterShared.cs (2)
33public SyntaxNode Format(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 36public IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (1)
17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
39return document.Text.ToString(TextSpan.FromBounds(tokenLine.Start, token.SpanStart));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (2)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxFactsService\ISyntaxFactsService.cs (1)
18Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameActionAnnotation.cs (2)
15TextSpan originalSpan, 28public readonly TextSpan OriginalSpan = originalSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameDeclarationLocationReference.cs (2)
19public readonly TextSpan TextSpan; 36public RenameDeclarationLocationReference(DocumentId documentId, TextSpan textSpan, bool overriddenFromMetadata, int declaringSyntaxReferencesCount)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameNodeSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameTokenSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (2)
56ImmutableArray<TextSpan> spans, 88ImmutableArray<TextSpan> spans,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\ISimplificationService.cs (1)
32ImmutableArray<TextSpan> spans,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractSimplifier.cs (1)
21out TextSpan issueSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
56TextSpan span,
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (1)
25IEnumerable<TextSpan> spans,
Workspace\Host\DocumentService\DocumentExcerptHelper.cs (1)
26public static async Task<ExcerptResult?> TryExcerptAsync(Document document, TextSpan span, ExcerptMode mode, ClassificationOptions classificationOptions, CancellationToken cancellationToken)
Workspace\Host\DocumentService\IDocumentExcerptService.cs (8)
19/// return <see cref="ExcerptResult"/> of given <see cref="Document"/> and <see cref="TextSpan"/> 23Task<ExcerptResult?> TryExcerptAsync(Document document, TextSpan span, ExcerptMode mode, ClassificationOptions classificationOptions, CancellationToken cancellationToken); 38internal readonly struct ExcerptResult(SourceText content, TextSpan mappedSpan, ImmutableArray<ClassifiedSpan> classifiedSpans, Document document, TextSpan span) 48public readonly TextSpan MappedSpan = mappedSpan; 58/// should be same document in <see cref="IDocumentExcerptService.TryExcerptAsync(Document, TextSpan, ExcerptMode, ClassificationOptions, CancellationToken)" /> 65/// should be same text span in <see cref="IDocumentExcerptService.TryExcerptAsync(Document, TextSpan, ExcerptMode, ClassificationOptions, CancellationToken)" /> 67public readonly TextSpan Span = span;
Workspace\Host\DocumentService\IRazorSourceGeneratedDocumentExcerptService.cs (1)
14Task<ExcerptResult?> TryExcerptAsync(SourceGeneratedDocument document, TextSpan span, ExcerptMode mode, ClassificationOptions classificationOptions, CancellationToken cancellationToken);
Workspace\Host\DocumentService\IRazorSourceGeneratedDocumentSpanMappingService.cs (1)
16Task<ImmutableArray<MappedSpanResult>> MapSpansAsync(SourceGeneratedDocument document, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken);
Workspace\Host\DocumentService\ISourceGeneratedDocumentExcerptService.cs (1)
16Task<ExcerptResult?> TryExcerptAsync(SourceGeneratedDocument document, TextSpan span, ExcerptMode mode, ClassificationOptions classificationOptions, CancellationToken cancellationToken);
Workspace\Host\DocumentService\ISourceGeneratedDocumentSpanMappingService.cs (1)
18Task<ImmutableArray<MappedSpanResult>> MapSpansAsync(SourceGeneratedDocument document, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken);
Workspace\Host\DocumentService\ISpanMappingService.cs (3)
47Task<ImmutableArray<MappedSpanResult>> MapSpansAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken); 68public readonly TextSpan Span; 70public MappedSpanResult(string filePath, LinePositionSpan linePositionSpan, TextSpan span)
Workspace\Host\DocumentService\SpanMappingHelper.cs (1)
25public static async Task<ImmutableArray<MappedSpanResult>?> TryGetMappedSpanResultAsync(Document document, ImmutableArray<TextSpan> textSpans, CancellationToken cancellationToken)
Microsoft.DotNet.ProjectTools (13)
src\sdk\src\Cli\Microsoft.DotNet.FileBasedPrograms\FileLevelDirectiveHelpers.cs (13)
93TextSpan previousWhiteSpaceSpan = default; 113TextSpan span = GetFullSpan(previousWhiteSpaceSpan, trivia); 127TextSpan span = GetFullSpan(previousWhiteSpaceSpan, trivia); 174static TextSpan GetFullSpan(TextSpan previousWhiteSpaceSpan, SyntaxTrivia trivia) 177return previousWhiteSpaceSpan.IsEmpty ? trivia.FullSpan : TextSpan.FromBounds(previousWhiteSpaceSpan.Start, trivia.FullSpan.End); 180static (WhiteSpaceInfo Leading, WhiteSpaceInfo Trailing) GetWhiteSpaceInfo(in SyntaxTriviaList triviaList, int index, TextSpan excludeSpan) 196static bool Fill(ref WhiteSpaceInfo info, in SyntaxTriviaList triviaList, int index, TextSpan excludeSpan) 243public string GetLocationString(TextSpan span) 286public required TextSpan Span { get; init; } 309public void ReportError(TextSpan span, string message) 988public TextSpan TextSpan { get; init; } 992internal delegate void ErrorReporter(SourceText text, string path, TextSpan textSpan, string message, Exception? innerException = null);
Microsoft.Extensions.Logging.Generators (1)
LoggerMessageGenerator.Roslyn4.0.cs (1)
111HashSet<(string Id, TextSpan? Span, string? FilePath, string Message)>? seen = null;
Microsoft.Gen.BuildMetadata.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
114public static TextSpan? MakeTextSpan(this string text, int spanNum) 156TextSpan? expectedSpan = Location.None.SourceSpan;
Microsoft.Gen.ComplianceReports.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
114public static TextSpan? MakeTextSpan(this string text, int spanNum) 156TextSpan? expectedSpan = Location.None.SourceSpan;
Microsoft.Gen.ContextualOptions.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
114public static TextSpan? MakeTextSpan(this string text, int spanNum) 156TextSpan? expectedSpan = Location.None.SourceSpan;
Microsoft.Gen.Logging.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
114public static TextSpan? MakeTextSpan(this string text, int spanNum) 156TextSpan? expectedSpan = Location.None.SourceSpan;
Microsoft.Gen.MetadataExtractor.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
114public static TextSpan? MakeTextSpan(this string text, int spanNum) 156TextSpan? expectedSpan = Location.None.SourceSpan;
Microsoft.Gen.Metrics.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
114public static TextSpan? MakeTextSpan(this string text, int spanNum) 156TextSpan? expectedSpan = Location.None.SourceSpan;
Microsoft.Gen.MetricsReports.Unit.Tests (2)
test\Generators\Shared\RoslynTestUtils.cs (2)
114public static TextSpan? MakeTextSpan(this string text, int spanNum) 156TextSpan? expectedSpan = Location.None.SourceSpan;
Microsoft.Maui.Controls.BindingSourceGen (1)
BindingInvocationDescription.cs (1)
19public sealed record SourceCodeLocation(string FilePath, TextSpan TextSpan, LinePositionSpan LineSpan)
Microsoft.ML.InternalCodeAnalyzer (1)
ContractsCheckNameofFixProvider.cs (1)
41var diagnosticSpan = diagnostic.Location.SourceSpan;
Roslyn.Diagnostics.Analyzers (428)
AbstractCreateTestAccessor`1.cs (1)
58private async Task<Document> CreateTestAccessorAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken)
AbstractExposeMemberForTesting`1.cs (1)
100private async Task<Solution> AddMemberToTestAccessorAsync(Document document, TextSpan sourceSpan, string memberName, string memberDocumentationCommentId, CancellationToken cancellationToken)
ExportedPartsShouldHaveImportingConstructorCodeFixProvider.cs (3)
79private static async Task<Document> AddExplicitImportingConstructorAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken) 141private static async Task<Document> MakeConstructorPublicAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken) 158private static async Task<Document> AddImportingConstructorAttributeAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken)
ImportingConstructorShouldBeObsoleteCodeFixProvider.cs (5)
85private async Task<Document> AddObsoleteAttributeAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken) 117private static async Task<Document> AddDescriptionAndErrorAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken) 138private static async Task<Document> UpdateDescriptionAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken) 163private static async Task<Document> AddErrorAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken) 182private static async Task<Document> SetErrorToTrueAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken)
src\roslyn\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (3)
29var fullSpan = new TextSpan(0, text.Length); 36var change = TextChangeRange.Collapse(changes).Span; 49var span = node.FullSpan;
src\roslyn\src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\roslyn\src\RoslynAnalyzers\Utilities\Refactoring\CodeRefactoringContextExtensions.cs (3)
30TextSpan span, 41TextSpan span, 54TextSpan span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (3)
105var thisSpan = introspector.GetSpan(value); 125var thisSpan = introspector.GetSpan(value); 138var thisSpan = introspector.GetSpan(value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (40)
14internal sealed class NormalizedTextSpanCollection : ReadOnlyCollection<TextSpan> 29public NormalizedTextSpanCollection(TextSpan span) 42public NormalizedTextSpanCollection(IEnumerable<TextSpan> spans) 93var span1 = left[index1]; 94var span2 = right[index2]; 122spans.Add(TextSpan.FromBounds(start, end)); 161var span1 = left[index1]; 162var span2 = right[index2]; 221var span1 = left[index1]; 222var span2 = right[index2]; 283var span1 = left[index1]; 284var span2 = right[index2]; 296spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 307spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span2.Start)); 333var span1 = left[index1++]; 334spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 398var span1 = this[index1]; 399var span2 = set[index2]; 429public bool OverlapsWith(TextSpan span) 458var span1 = this[index1]; 459var span2 = set[index2]; 483public bool IntersectsWith(TextSpan span) 506foreach (var s in this) 533foreach (var s in this) 546private static IList<TextSpan> ListFromSpan(TextSpan span) 548IList<TextSpan> list = 564private static void UpdateSpanUnion(TextSpan span, IList<TextSpan> spans, ref int start, ref int end) 568spans.Add(TextSpan.FromBounds(start, end)); 585private static IList<TextSpan> NormalizeSpans(IEnumerable<TextSpan> spans) 592var sorted = new List<TextSpan>(spans); 599sorted.Sort(delegate (TextSpan s1, TextSpan s2) { return s1.Start.CompareTo(s2.Start); }); 601IList<TextSpan> normalized = new List<TextSpan>(sorted.Count); 611normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 621normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 626private sealed class OrderedSpanList : List<TextSpan>
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\TextSpanMutableIntervalTree.cs (9)
10internal readonly struct TextSpanIntervalIntrospector : IIntervalIntrospector<TextSpan> 12public TextSpan GetSpan(TextSpan value) 16internal sealed class TextSpanMutableIntervalTree(IEnumerable<TextSpan>? values) 17: SimpleMutableIntervalTree<TextSpan, TextSpanIntervalIntrospector>(new TextSpanIntervalIntrospector(), values) 23public TextSpanMutableIntervalTree(params TextSpan[]? values) : this((IEnumerable<TextSpan>?)values) 27public bool HasIntervalThatIntersectsWith(TextSpan span) 30public bool HasIntervalThatOverlapsWith(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\NamingStyles\NamingStyleOption.cs (3)
13/// The root naming style option composed of several settings as well as a <see cref="TextSpan"/>s describing where they were all defined. 29/// A description of the kinds of symbols a rule should apply to as well as a <see cref="TextSpan"/>s describing where they were all defined. 42/// The rules about how the specified symbols must be named as well as a <see cref="TextSpan"/>s describing where they were all defined.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\Section.cs (2)
16public TextSpan Span { get; init; } 24public Section(string? filePath, bool isGlobal, TextSpan span, string text, string fullText)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxHelpers.cs (4)
12public static TextSpan GetSpan<TSyntaxKind>(EmbeddedSyntaxToken<TSyntaxKind> token1, EmbeddedSyntaxToken<TSyntaxKind> token2) where TSyntaxKind : struct 15public static TextSpan GetSpan(VirtualCharSequence virtualChars) 18public static TextSpan GetSpan(VirtualChar firstChar, VirtualChar lastChar) 19=> TextSpan.FromBounds(firstChar.Span.Start, lastChar.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (6)
42private TextSpan? _fullSpan; 56public TextSpan GetSpan() 63return TextSpan.FromBounds(start, end); 66public TextSpan? GetFullSpan() 69private TextSpan? ComputeFullSpan() 76return TextSpan.FromBounds(start.Value, end.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (2)
68/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 96public TextSpan Span => new(TokenStart + Green.Offset, Green.Width);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharGreenSequence.Chunks.cs (1)
50var span = new VirtualChar(ch, tokenStart).Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
50private readonly TextSpan _span; 57private VirtualCharGreenSequence(Chunk sequence, TextSpan span) 114TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharUtilities.cs (4)
15public static TextSpan FromBounds(VirtualChar vc1, VirtualChar vc2) 16=> TextSpan.FromBounds(vc1.Span.Start, vc2.Span.End); 26public static (ImmutableSegmentedList<VirtualChar> sourceCode, ImmutableArray<TextSpan> markdownSpans) StripMarkupCharacters( 29using var _ = ArrayBuilder<TextSpan>.GetInstance(out var markdownSpans);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (13)
13private static bool ShouldAnalyze(TextSpan? contextFilterSpan, TextSpan span) 23public static bool ShouldAnalyzeSpan(this SyntaxTreeAnalysisContext context, TextSpan span) 33public static bool ShouldAnalyzeSpan(this SemanticModelAnalysisContext context, TextSpan span) 43public static bool ShouldAnalyzeSpan(this SymbolStartAnalysisContext context, TextSpan span, SyntaxTree tree) 63public static bool ShouldAnalyzeSpan(this SymbolAnalysisContext context, TextSpan span, SyntaxTree tree) 83public static bool ShouldAnalyzeSpan(this AdditionalFileAnalysisContext context, TextSpan span) 93public static bool ShouldAnalyzeSpan(this OperationBlockStartAnalysisContext context, TextSpan span) 103public static bool ShouldAnalyzeSpan(this OperationBlockAnalysisContext context, TextSpan span) 113public static bool ShouldAnalyzeSpan(this OperationAnalysisContext context, TextSpan span) 123public static bool ShouldAnalyzeSpan(this SyntaxNodeAnalysisContext context, TextSpan span) 133public static bool ShouldAnalyzeSpan<TSytnaxKind>(this CodeBlockStartAnalysisContext<TSytnaxKind> context, TextSpan span) where TSytnaxKind : struct 143public static bool ShouldAnalyzeSpan(this CodeBlockAnalysisContext context, TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (2)
32this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden, CancellationToken cancellationToken) 44this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (12)
104this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate) 296public static TextSpan GetContainedSpan(this IEnumerable<SyntaxNode> nodes) 301var fullSpan = nodes.First().Span; 304fullSpan = TextSpan.FromBounds( 315public static bool OverlapsHiddenPosition(this SyntaxNode node, TextSpan span, CancellationToken cancellationToken) 323var textSpan = TextSpan.FromBounds(start, end); 409var spans = new List<TextSpan>(nodesToReplace.Count + tokensToReplace.Count + triviaToReplace.Count); 432TextSpan previous = default; 433foreach (var span in spans) 785public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 963var fullSpan = node.FullSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (3)
18public static bool OverlapsHiddenPosition([NotNullWhen(returnValue: true)] this SyntaxTree? tree, TextSpan span, CancellationToken cancellationToken) 98public static bool IsEntirelyHidden(this SyntaxTree tree, TextSpan span, CancellationToken cancellationToken) 252public static SyntaxNode FindNode(this SyntaxTree syntaxTree, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (22)
18public static IEnumerable<TextSpan> ToNormalizedSpans(this IEnumerable<TextSpan> spans) 21public static ImmutableArray<TextSpan> ToNormalizedSpans(this ImmutableArray<TextSpan> spans) 24public static TextSpan Collapse(this IEnumerable<TextSpan> spans) 29foreach (var span in spans) 48return TextSpan.FromBounds(start, end); 54public static bool IsAround(this TextSpan span, SyntaxNodeOrToken node) => IsAround(span, node, node); 60public static bool IsAround(this TextSpan span, SyntaxNodeOrToken startNode, SyntaxNodeOrToken endNode) 62var innerSpan = TextSpan.FromBounds(startNode.Span.Start, endNode.Span.End); 63var outerSpan = TextSpan.FromBounds(startNode.FullSpan.Start, endNode.FullSpan.End); 67public static IEnumerable<TextSpan> Subtract(this TextSpan span, TextSpan except) 81yield return TextSpan.FromBounds(span.Start, startSegmentEnd); 85yield return TextSpan.FromBounds(endSegmentStart, span.End); 88public static IEnumerable<TextSpan> Subtract(this IEnumerable<TextSpan> spans, TextSpan except)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\AbstractSyntaxFormatting.cs (3)
21private static readonly Func<TextSpan, bool> s_notEmpty = s => !s.IsEmpty; 32public IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 34IReadOnlyList<TextSpan> spansToFormat;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.AnchorData.cs (4)
18public TextSpan TextSpan => operation.TextSpan; 34TextSpan IIntervalIntrospector<AnchorData>.GetSpan(AnchorData value) 37TextSpan IIntervalIntrospector<IndentationData>.GetSpan(IndentationData value) 40TextSpan IIntervalIntrospector<RelativeIndentationData>.GetSpan(RelativeIndentationData value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (18)
45private readonly HashSet<TextSpan> _indentationMap = []; 46private readonly HashSet<TextSpan> _suppressWrappingMap = []; 47private readonly HashSet<TextSpan> _suppressSpacingMap = []; 48private readonly HashSet<TextSpan> _suppressFormattingMap = []; 49private readonly HashSet<TextSpan> _anchorMap = []; 140var baseSpan = _initialIndentBlockOperations[0].TextSpan; 159var operationSpan = operations[i].TextSpan; 180var intervalTreeSpan = operation.TextSpan; 409private static void DebugCheckEmpty<T, TIntrospector>(ContextMutableIntervalTree<T, TIntrospector> tree, TextSpan textSpan) 448var span = token.Span; 469var span = token.Span; 592public bool IsWrappingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 614public bool IsSpacingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 643var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End); 650public bool IsFormattingDisabled(TextSpan textSpan) 658var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.IndentationData.cs (14)
17private abstract class IndentationData(TextSpan textSpan) 19public TextSpan TextSpan { get; } = textSpan; 22public IndentationData WithTextSpan(TextSpan span) 25protected abstract IndentationData WithTextSpanCore(TextSpan span); 28private sealed class SimpleIndentationData(TextSpan textSpan, int indentation) : IndentationData(textSpan) 32protected override IndentationData WithTextSpanCore(TextSpan span) 56public RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter) 67this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 70private RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter, int lazyIndentationDelta) 81this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 84public TextSpan InseparableRegionSpan { get; } 106protected override IndentationData WithTextSpanCore(TextSpan span) 118public AdjustedIndentationData(TextSpan textSpan, IndentationData baseIndentationData, int adjustment) 141protected override IndentationData WithTextSpanCore(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ContextMutableIntervalTree.cs (4)
40var thisSpan = introspector.GetSpan(value); 52var thisSpan = introspector.GetSpan(value); 125var resultSpan = Introspector.GetSpan(result!); 126var currentNodeSpan = Introspector.GetSpan(currentNode.Value);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (5)
44protected readonly TextSpan SpanToFormat; 336private TextSpan GetSpanToFormat() 341return TextSpan.FromBounds(startPosition, endPosition); 458var spanBetweenTokens = TextSpan.FromBounds(token1.Span.End, token2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormattingResult.cs (4)
26public readonly TextSpan FormattedSpan; 31TextSpan formattedSpan) 78var span = TextSpan.FromBounds(token1.RawKind == 0 ? this.TreeInfo.StartPosition : token1.Span.End, token2.RawKind == 0 ? this.TreeInfo.EndPosition : token2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.NodeAndText.cs (3)
37return _text.ToString(TextSpan.FromBounds(token2.FullSpan.Start, token2.SpanStart)); 43return _text.ToString(TextSpan.FromBounds(token1.Span.End, token1.FullSpan.End)); 46return _text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (13)
239var span = textChange.Span; 267internal static IEnumerable<TextSpan> GetAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 277static IEnumerable<TextSpan> EnumerateAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 295internal static TextSpan GetSpanIncludingPreviousAndNextTokens(SyntaxToken firstToken, SyntaxToken lastToken) 307return TextSpan.FromBounds(start, end); 310internal static TextSpan GetElasticSpan(SyntaxToken token) 313private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 315var aggregateSpans = new List<TextSpan>(); 317var last = default(TextSpan); 318foreach (var span in spans) 326last = TextSpan.FromBounds(last.Start, span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (10)
20private readonly TextSpan _span; 22public BaseIndentationFormattingRule(SyntaxNode root, TextSpan span, int baseIndentation, AbstractFormattingRule? vbHelperFormattingRule = null) 130private TextSpan AdjustTextSpan(TextSpan textSpan) 131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End)); 133private static void SetInnermostNodeForSpan(SyntaxNode root, ref TextSpan span, out SyntaxToken token1, out SyntaxToken token2, out SyntaxNode? commonNode) 149private static void GetTokens(SyntaxNode root, TextSpan span, out SyntaxToken token1, out SyntaxToken token2) 168private static TextSpan GetSpanFromTokens(TextSpan span, SyntaxToken token1, SyntaxToken token2) 217return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\FormattingOperations.cs (8)
30=> CreateAnchorIndentationOperation(anchorToken, endToken, TextSpan.FromBounds(anchorToken.Span.End, endToken.Span.End)); 35public static AnchorIndentationOperation CreateAnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 42=> CreateSuppressOperation(startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End), option); 47private static SuppressOperation CreateSuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option) 55var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 62public static IndentBlockOperation CreateIndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 70var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 78public static IndentBlockOperation CreateRelativeIndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\IndentBlockOperation.cs (3)
14internal IndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 33internal IndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 56public TextSpan TextSpan { get; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\SuppressOperation.cs (2)
14public readonly TextSpan TextSpan; 19internal SuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (13)
45private delegate void WhitespaceAppender<T>(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<T> changes); 387var span = GetTextSpan(trivia1, trivia2); 499var span = TextSpan.FromBounds(start, end); 715var insertionPoint = GetInsertionSpan(changes); 730private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 765TextSpan notUsed, 822private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 825private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes) 831private TextSpan GetTextSpan(SyntaxTrivia trivia1, SyntaxTrivia trivia2) 835return TextSpan.FromBounds(this.StartPosition, trivia2.FullSpan.Start); 840return TextSpan.FromBounds(trivia1.FullSpan.End, this.EndPosition); 843return TextSpan.FromBounds(trivia1.FullSpan.End, trivia2.FullSpan.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\AbstractUnnecessaryImportsProvider.cs (3)
23public ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken) 27SemanticModel model, TextSpan? span, Func<SyntaxNode, bool>? predicate, CancellationToken cancellationToken) 35bool HasImportThatIntersectsWithSpan(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (3)
237private TextSpan GetNormalizedSpan(int position) 241return TextSpan.FromBounds(LineToBeIndented.Start, position); 244return TextSpan.FromBounds(position, LineToBeIndented.Start);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Naming\IdentifierNameParts.cs (3)
29using var parts = TemporaryArray<TextSpan>.Empty; 73private static ImmutableArray<string> CreateWords(in TemporaryArray<TextSpan> parts, string name) 76foreach (var part in parts)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (21)
160var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 174private WordSpanEnumerable GetWordSpans(string name, TextSpan nameSpan) 177private static string Substring(string name, TextSpan wordSpan) 180private static readonly Func<string, TextSpan, bool> s_firstCharIsLowerCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsLower(val[span.Start]); 181private static readonly Func<string, TextSpan, bool> s_firstCharIsUpperCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsUpper(val[span.Start]); 183private static readonly Func<string, TextSpan, bool> s_wordIsAllUpperCase = (val, span) => 196private static readonly Func<string, TextSpan, bool> s_wordIsAllLowerCase = (val, span) => 210string name, TextSpan nameSpan, Func<string, TextSpan, bool> wordCheck, 216foreach (var wordSpan in GetWordSpans(name, nameSpan)) 232private bool CheckPascalCase(string name, TextSpan nameSpan, out string reason) 237private bool CheckAllUpper(string name, TextSpan nameSpan, out string reason) 242private bool CheckAllLower(string name, TextSpan nameSpan, out string reason) 248string name, TextSpan nameSpan, 249Func<string, TextSpan, bool> firstWordCheck, 250Func<string, TextSpan, bool> restWordCheck, 260foreach (var wordSpan in GetWordSpans(name, nameSpan)) 291private bool CheckCamelCase(string name, TextSpan nameSpan, out string reason) 298private bool CheckFirstUpper(string name, TextSpan nameSpan, out string reason) 406using var parts = TemporaryArray<TextSpan>.Empty;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (4)
16private readonly TextSpan _nameSpan; 19public WordSpanEnumerator(string name, TextSpan nameSpan, string wordSeparator) 28public TextSpan Current { get; private set; } 70Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\RefactoringHelpers\AbstractRefactoringHelpers.cs (10)
39/// Returns unchanged <paramref name="span"/> in case <see cref="TextSpan.IsEmpty"/>. 40/// Returns empty Span with original <see cref="TextSpan.Start"/> in case it contains only whitespace. 42private static TextSpan GetTrimmedTextSpan(SourceText sourceText, TextSpan span) 56return TextSpan.FromBounds(start, end); 60SourceText sourceText, SyntaxNode root, TextSpan selectionRaw, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 69var selectionTrimmed = GetTrimmedTextSpan(sourceText, selectionRaw); 354var rightNodeSpanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, rightNode); 366TextSpan selectionTrimmed, 384var spanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, nonHiddenExtractedNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\RefactoringHelpers\IRefactoringHelpers.cs (1)
55SourceText sourceText, SyntaxNode root, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (4)
34SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 38SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 42SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, 77SyntaxNode root, SourceText text, TextSpan textSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
429TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 432/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 433/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 435/// an empty <see cref="TextSpan"/> at position 0. 438TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 479bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(firstNode.Span.Start, lastNode.Span.End); 182this ISyntaxFacts syntaxFacts, TextSpan span, SyntaxNode node, CancellationToken cancellationToken) 441public static TextSpan GetSpanWithoutAttributes(this ISyntaxFacts syntaxFacts, SyntaxNode root, SyntaxNode node) 461return TextSpan.FromBounds(startOfNodeWithoutAttributes, endOfNode);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (6)
36private readonly TextSpan[] _wordSpans; 101_wordSpans = new TextSpan[distinctValues.Length]; 177private void Add(TextSpan characterSpan, int insertionIndex) 218TextSpan characterSpan, int insertionIndex, int currentNodeEdgeCount, int currentNodeIndex, int editDistance) 286private struct BuilderNode(TextSpan characterSpan) 288public readonly TextSpan CharacterSpan = characterSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (2)
11private readonly struct Node(TextSpan wordSpan, int edgeCount, int firstEdgeIndex) 17public readonly TextSpan WordSpan = wordSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (10)
45public static IEnumerable<(SyntaxToken, SyntaxToken)> ConvertToTokenPairs(this SyntaxNode root, IReadOnlyList<TextSpan> spans) 81public static ValueTuple<SyntaxToken, SyntaxToken> ConvertToTokenPair(this SyntaxNode root, TextSpan textSpan) 157=> (token1.RawKind == 0) ? text.ToString(TextSpan.FromBounds(0, token2.SpanStart)) : text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart)); 259public static TextSpan GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(SyntaxToken startToken, SyntaxToken endToken) 266return TextSpan.FromBounds(startPosition, endPosition); 324var fullSpan = node.FullSpan; 357public static TextSpan GetFormattingSpan(SyntaxNode root, TextSpan span) 367return TextSpan.FromBounds(startPosition, endPosition);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
17public static void AddWordParts(ReadOnlySpan<char> identifier, ref TemporaryArray<TextSpan> parts) 20public static void AddCharacterParts(ReadOnlySpan<char> identifier, ref TemporaryArray<TextSpan> parts) 23public static void AddParts(ReadOnlySpan<char> text, bool word, ref TemporaryArray<TextSpan> parts) 27var span = StringBreaker.GenerateSpan(text, start, word); 41public static TextSpan GenerateSpan(ReadOnlySpan<char> identifier, int wordStart, bool word) 81private static TextSpan ScanCharacterRun(ReadOnlySpan<char> identifier, int length, int wordStart) 102private static TextSpan ScanWordRun(ReadOnlySpan<char> identifier, int length, int wordStart) 151private static TextSpan ScanLowerCaseRun(ReadOnlySpan<char> identifier, int length, int wordStart) 162private static TextSpan ScanNumber(ReadOnlySpan<char> identifier, int length, int wordStart) 170return TextSpan.FromBounds(wordStart, current);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\MultiProjectSafeFixAllProvider.cs (4)
26protected abstract void FixAll(SyntaxEditor editor, IEnumerable<TextSpan> commonSpans); 79using var _ = PooledHashSet<TextSpan>.GetInstance(out var commonSpans); 110static IEnumerable<TextSpan> GetDiagnosticSpans(ImmutableArray<Diagnostic> diagnostics) 114private SyntaxNode FixAll(SolutionServices services, SyntaxNode root, PooledHashSet<TextSpan> commonSpans)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixesAndRefactorings\AbstractFixAllSpanMappingService.cs (8)
20protected abstract Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansIfWithinGlobalStatementAsync( 21Document document, TextSpan span, CancellationToken cancellationToken); 23public Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 24Document document, TextSpan triggerSpan, FixAllScope fixAllScope, CancellationToken cancellationToken) 32private async Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 33Document document, TextSpan span, bool fixAllInContainingMember, CancellationToken cancellationToken) 50var builder = PooledDictionary<Document, ArrayBuilder<TextSpan>>.GetInstance(); 75TextSpan span,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixesAndRefactorings\IFixAllSpanMappingService.cs (2)
30Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 31Document document, TextSpan triggerSpan, FixAllScope fixAllScope, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (3)
50protected static TextSpan GetSpan(SyntaxNode node) 55return TextSpan.FromBounds(start.SpanStart, end.Span.End); 110var span = GetSpan(destination);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (1)
24public void AddRelevantNodes<TSyntaxNode>(SourceText sourceText, SyntaxNode root, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringContextExtensions.cs (9)
21this CodeRefactoringContext context, ImmutableArray<TCodeAction> actions, TextSpan? applicableToSpan = null) 59public static async Task<TSyntaxNode?> TryGetRelevantNodeAsync<TSyntaxNode>(this Document document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 65public static TSyntaxNode? TryGetRelevantNode<TSyntaxNode>(this ParsedDocument document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 68public static TSyntaxNode? TryGetRelevantNode<TSyntaxNode>(this ParsedDocument document, TextSpan span, bool allowEmptyNode, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 76this Document document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 82this Document document, TextSpan span, bool allowEmptyNodes, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 89this ParsedDocument document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 93this ParsedDocument document, TextSpan span, bool allowEmptyNodes, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 102this ParsedDocument document, TextSpan span, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (1)
38public static bool IsNodeUnderselected(SyntaxNode? node, TextSpan selection)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\IRefactoringHelpersService.cs (1)
20this IRefactoringHelpersService service, ParsedDocument document, TextSpan selection, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
32IEnumerable<TextSpan> spans,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
142public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (2)
393using var parts = TemporaryArray<TextSpan>.Empty; 397var p = parts[i];
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\FormatterShared.cs (2)
33public SyntaxNode Format(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 36public IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (1)
17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
39return document.Text.ToString(TextSpan.FromBounds(tokenLine.Start, token.SpanStart));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (2)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxFactsService\ISyntaxFactsService.cs (1)
18Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameActionAnnotation.cs (2)
15TextSpan originalSpan, 28public readonly TextSpan OriginalSpan = originalSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameDeclarationLocationReference.cs (2)
19public readonly TextSpan TextSpan; 36public RenameDeclarationLocationReference(DocumentId documentId, TextSpan textSpan, bool overriddenFromMetadata, int declaringSyntaxReferencesCount)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameNodeSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameTokenSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (2)
56ImmutableArray<TextSpan> spans, 88ImmutableArray<TextSpan> spans,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\ISimplificationService.cs (1)
32ImmutableArray<TextSpan> spans,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractSimplifier.cs (1)
21out TextSpan issueSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
56TextSpan span,
TestExportsShouldNotBeDiscoverableCodeFixProvider.cs (1)
50private static async Task<Document> AddPartNotDiscoverableAttributeAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken)
Roslyn.Diagnostics.CSharp.Analyzers (66)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (1)
205var lineSpan = currentLine.Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (5)
516public static bool ContainsInterleavedDirective(this SyntaxNode syntaxNode, TextSpan span, CancellationToken cancellationToken) 521TextSpan textSpan, 530TextSpan textSpan, 549TextSpan textSpan, 561var matchSpan = match.Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (1)
247var name = SyntaxFactory.ParseName(syntaxTree.GetText(cancellationToken).ToString(TextSpan.FromBounds(genericIdentifier.SpanStart, lastToken.Span.End)));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (7)
201var fullSpan = trivia.FullSpan; 230var span = trivia.FullSpan; 248var span = trivia.FullSpan; 285var span = trivia.FullSpan; 311var span = trivia.FullSpan; 411var span = token.Span; 457var span = token.Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (1)
156var span = trivia.FullSpan;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\FormattingResult.cs (1)
19internal FormattingResult(TreeData treeInfo, TokenStream tokenStream, TextSpan spanToFormat)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (3)
54var span = TextSpan.FromBounds(commonToken1.Span.End, formatSpanEnd); 104public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs (1)
57public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (1)
102public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (4)
98private TextSpan GetTextSpan(ValueTuple<SyntaxToken, SyntaxToken> pair) 102return TextSpan.FromBounds(_node.FullSpan.Start, pair.Item2.SpanStart); 107return TextSpan.FromBounds(pair.Item1.Span.End, _node.FullSpan.End); 110return TextSpan.FromBounds(pair.Item1.Span.End, pair.Item2.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (3)
21TextSpan textSpan, 41startToken, endToken, TextSpan.FromBounds(startToken.Span.Start, endToken.Span.End), 77TextSpan textSpan,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (6)
115TextSpan.FromBounds(lastTokenOfLabel.FullSpan.End, nextToken.SpanStart) : TextSpan.FromBounds(lastTokenOfLabel.FullSpan.End, lastTokenOfLabel.FullSpan.End)); 123var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 124span = lastSection ? span : TextSpan.FromBounds(span.Start, endToken.FullSpan.End); 306TextSpan.FromBounds(openParen.Span.End, closeParen.Span.Start)); 370AddIndentBlockOperation(list, firstToken, lastToken, TextSpan.FromBounds(firstToken.FullSpan.Start, lastToken.FullSpan.End));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (2)
327var textSpan = TextSpan.FromBounds(startToken.Span.End, endToken.SpanStart);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (2)
184var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (2)
65_root, [TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)], _options.FormattingOptions, smartTokenformattingRules, cancellationToken); 119_root, [TextSpan.FromBounds(adjustedStartPosition, adjustedEndPosition)], _options.FormattingOptions, smartTokenFormattingRules, cancellationToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (5)
934public TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node) 945return TextSpan.FromBounds(method.Body.OpenBraceToken.Span.End, method.Body.CloseBraceToken.SpanStart); 1013public TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) 1042return !branch.IsActive || !branch.BranchTaken ? TextSpan.FromBounds(branch.FullSpan.Start, position) : default; 1289public bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeFixesAndRefactorings\CSharpFixAllSpanMappingService.cs (6)
24protected override async Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansIfWithinGlobalStatementAsync( 25Document document, TextSpan span, CancellationToken cancellationToken) 30return ImmutableDictionary<Document, ImmutableArray<TextSpan>>.Empty; 35var fixAllSpan = root.FullSpan; 43return ImmutableDictionary<Document, ImmutableArray<TextSpan>>.Empty; 48return ImmutableDictionary<Document, ImmutableArray<TextSpan>>.Empty
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (5)
28var span = GetUsingsSpan(root, namespaceDeclaration); 37private static TextSpan GetUsingsSpan(CompilationUnitSyntax root, BaseNamespaceDeclarationSyntax? namespaceDeclaration) 44return TextSpan.FromBounds(start, end); 53return TextSpan.FromBounds(start, end); 61return TextSpan.FromBounds(start, end);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (1)
547var existingAccessorSpan = existingAccessor.Span;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (3)
30indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken)); 36indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken)); 48indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\CSharpSyntaxFormattingService.cs (2)
337public ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken) 339var formattingSpan = CommonFormattingHelpers.GetFormattingSpan(document.Root, textSpan);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.cs (3)
58using var _ = ArrayBuilder<TextSpan>.GetInstance(out var spansToFormat); 63spansToFormat.Add(TextSpan.FromBounds(0, firstMemberA.SpanStart)); 67spansToFormat.Add(TextSpan.FromBounds(baseNamespace.Name.Span.End, firstMemberB.SpanStart));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (1)
116public Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken)
Roslyn.Diagnostics.VisualBasic.Analyzers (47)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (6)
381textSpan As TextSpan, 389textSpan As TextSpan, 405textSpan As TextSpan, 857Public Function CheckTopLevel(node As SyntaxNode, span As TextSpan) As Boolean 881Public Function ContainsInMethodBlockBody(block As MethodBlockBaseSyntax, textSpan As TextSpan) As Boolean 886Dim blockSpan = TextSpan.FromBounds(block.BlockStatement.Span.End, block.EndBlockStatement.SpanStart)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\FormattingResult.vb (1)
21Friend Sub New(treeInfo As TreeData, tokenStream As TokenStream, spanToFormat As TextSpan)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
96Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.vb (1)
58Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
89Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (5)
84Private Function GetTextSpan(pair As ValueTuple(Of SyntaxToken, SyntaxToken)) As TextSpan 86Return TextSpan.FromBounds(_node.FullSpan.Start, pair.Item2.SpanStart) 90Return TextSpan.FromBounds(pair.Item1.Span.End, _node.FullSpan.End) 93Return TextSpan.FromBounds(pair.Item1.Span.End, pair.Item2.SpanStart) 108Private Shared Function GetSyntaxTriviaList(textSpan As TextSpan, triviaData As TriviaData, cancellationToken As CancellationToken) As SyntaxTriviaList
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Rules\BaseFormattingRule.vb (8)
28Optional textSpan As TextSpan = Nothing, 38Protected Shared Sub SetAlignmentBlockOperation(operations As List(Of IndentBlockOperation), baseToken As SyntaxToken, startToken As SyntaxToken, endToken As SyntaxToken, span As TextSpan, Optional [option] As IndentBlockOption = IndentBlockOption.RelativePosition) 46Protected Shared Sub AddAbsolutePositionIndentBlockOperation(operations As List(Of IndentBlockOperation), startToken As SyntaxToken, endToken As SyntaxToken, indentation As Integer, span As TextSpan, Optional [option] As IndentBlockOption = IndentBlockOption.AbsolutePosition) 50Private Shared Function GetAlignmentSpan(startToken As SyntaxToken, endToken As SyntaxToken) As TextSpan 52Return TextSpan.FromBounds(previousToken.Span.End, endToken.FullSpan.End) 55Private Shared Function GetIndentBlockSpan(startToken As SyntaxToken, endToken As SyntaxToken) As TextSpan 64Return TextSpan.FromBounds(spanStart, trivia.FullSpan.Start) 68Return TextSpan.FromBounds(spanStart, nextToken.SpanStart)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Rules\NodeBasedFormattingRule.vb (2)
79AddIndentBlockOperation(operations, baseToken, startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)) 157operations.Add(FormattingOperations.CreateIndentBlockOperation(caseBlockLastToken, nextTokenAfterCase, TextSpan.FromBounds(caseBlockLastToken.Span.End, nextTokenAfterCase.SpanStart), 1, IndentBlockOption.RelativePosition))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Indentation\VisualBasicSmartTokenFormatter.vb (1)
41Dim spans = SpecializedCollections.SingletonEnumerable(TextSpan.FromBounds(previousToken.SpanStart, token.Span.End))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (4)
829Public Function GetMemberBodySpanForSpeculativeBinding(node As SyntaxNode) As TextSpan Implements ISyntaxFacts.GetMemberBodySpanForSpeculativeBinding 852Return TextSpan.FromBounds(spanStart, method.EndBlockStatement.SpanStart) 1084Public Function GetInactiveRegionSpanAroundPosition(tree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As TextSpan Implements ISyntaxFacts.GetInactiveRegionSpanAroundPosition 1415Public Function ContainsInterleavedDirective(span As TextSpan, token As SyntaxToken, cancellationToken As CancellationToken) As Boolean Implements ISyntaxFacts.ContainsInterleavedDirective
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeFixesAndRefactorings\VisualBasicFixAllSpanMappingService.vb (3)
22Protected Overrides Function GetFixAllSpansIfWithinGlobalStatementAsync(document As Document, diagnosticSpan As TextSpan, cancellationToken As CancellationToken) As Task(Of ImmutableDictionary(Of Document, ImmutableArray(Of TextSpan))) 24Return Task.FromResult(ImmutableDictionary(Of Document, ImmutableArray(Of TextSpan)).Empty)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\VisualBasicCodeGenerationService.vb (2)
72indices.Add(Not destination.OverlapsHiddenPosition(TextSpan.FromBounds(0, destination.Members.First.SpanStart), cancellationToken)) 85TextSpan.FromBounds(destination.Members.Last.Span.End, destination.EndOfFileToken.SpanStart), cancellationToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\CompilationUnitSyntaxExtensions.vb (2)
32Return Not contextNode.SyntaxTree.OverlapsHiddenPosition(TextSpan.FromBounds(start, [end]), cancellationToken) 39Return Not contextNode.SyntaxTree.OverlapsHiddenPosition(TextSpan.FromBounds(start, [end]), cancellationToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (1)
221Public Function GetImplicitMemberAccessExpressions(expression As SyntaxNode, span As TextSpan) As IEnumerable(Of ExpressionSyntax)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Formatting\VisualBasicSyntaxFormattingService.vb (1)
32Public Function GetFormattingChangesOnPaste(document As ParsedDocument, textSpan As TextSpan, options As SyntaxFormattingOptions, cancellationToken As CancellationToken) As ImmutableArray(Of TextChange) Implements ISyntaxFormattingService.GetFormattingChangesOnPaste
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Indentation\SpecialFormattingOperation.vb (5)
73TextSpan.FromBounds(startToken.FullSpan.Start, node.FullSpan.End), indentationDelta:=1, [option]:=IndentBlockOption.RelativePosition)) 111baseToken, startToken, endToken, TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End), indentationDelta, IndentBlockOption.RelativePosition)) 149Dim span As TextSpan 157span = TextSpan.FromBounds(baseToken.Span.End, firstToken.SpanStart) 160span = TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSymbolDeclarationService.vb (1)
51Public Overrides ReadOnly Property Span As TextSpan
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSyntaxFactsService.vb (1)
38Public Function GetSelectedFieldsAndPropertiesAsync(tree As SyntaxTree, textSpan As TextSpan, allowPartialSelection As Boolean, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of SyntaxNode)) Implements ISyntaxFactsService.GetSelectedFieldsAndPropertiesAsync
System.Text.RegularExpressions.Generator (2)
UpgradeToGeneratedRegexAnalyzer.cs (2)
188TextSpan span = TextSpan.FromBounds(start, end);
System.Windows.Forms.Analyzers.CodeFixes.CSharp (1)
System\Windows\Forms\CSharp\CodeFixes\AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.cs (1)
39TextSpan diagnosticSpan = diagnostic.Location.SourceSpan;