1651 instantiations of TextSpan
AnalyzerRunner (1)
CodeRefactoringRunner.cs (1)
89var context = new CodeRefactoringContext(document, new TextSpan(node.SpanStart, 0), codeActions.Add, cancellationToken);
GenerateDocumentationAndConfigFiles (36)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
38span = new TextSpan(offset + index, 2); 167result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 206result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 213result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 220result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 1)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
51return new TextSpan(wordStart, 1); 69return new TextSpan(wordStart, 1); 97return new TextSpan(wordStart, 1); 128return new TextSpan(wordStart, end - wordStart); 134return new TextSpan(wordStart, current - wordStart); 146return new TextSpan(wordStart, 1); 158return new TextSpan(wordStart, current - wordStart);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
112=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
79textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
IdeBenchmarks (2)
RegexClassifierBenchmarks.cs (2)
43return GetClassificationSpansAsync(code, new TextSpan(0, code.Length), parseOptions: null).Result; 50return GetClassificationSpansAsync(code, new TextSpan(0, code.Length), parseOptions: null).Result;
IdeCoreBenchmarks (5)
ClassificationBenchmarks.cs (1)
98var span = new TextSpan(0, text.Length);
SyntacticChangeRangeBenchmark.cs (4)
54var newText = _text.WithChanges(new TextChange(new TextSpan(_index + 8, 1), "m")); 63var newText = _text.WithChanges(new TextChange(new TextSpan(_index, 0), "var v = x ")); 72var newText = _text.WithChanges(new TextChange(new TextSpan(0, addedText.Length), addedText)); 81var newText = _text.WithChanges(new TextChange(new TextSpan(_text.Length - addedText.Length, addedText.Length), addedText));
Metrics (34)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
38span = new TextSpan(offset + index, 2); 167result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 206result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 213result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 220result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 1)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
51return new TextSpan(wordStart, 1); 69return new TextSpan(wordStart, 1); 97return new TextSpan(wordStart, 1); 128return new TextSpan(wordStart, end - wordStart); 134return new TextSpan(wordStart, current - wordStart); 146return new TextSpan(wordStart, 1); 158return new TextSpan(wordStart, current - wordStart);
Metrics.Legacy (34)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
38span = new TextSpan(offset + index, 2); 167result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 206result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 213result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 220result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 1)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
51return new TextSpan(wordStart, 1); 69return new TextSpan(wordStart, 1); 97return new TextSpan(wordStart, 1); 128return new TextSpan(wordStart, end - wordStart); 134return new TextSpan(wordStart, current - wordStart); 146return new TextSpan(wordStart, 1); 158return new TextSpan(wordStart, current - wordStart);
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.AspNetCore.App.Analyzers.Test (1)
RouteEmbeddedLanguage\RoutePatternParserTests.cs (1)
361var allCharsString = allChars.GetSubSequence(new TextSpan(position, virtualChars.Length)).CreateString();
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (3)
CompilerFailedExceptionFactoryTest.cs (3)
242new TextSpan(10, 5), 248new TextSpan(1, 6), 254new TextSpan(40, 50),
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)
96? new TextSpan(Position + UnderlyingNode.GetLeadingTriviaWidth(), UnderlyingNode.Width) 123get { 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)); 530var resultLine = TextLine.FromSpanUnsafe(_compositeText, new TextSpan(firstSegmentOffset + firstSegmentTextLine.Start, lineLength));
Text\SourceText.cs (8)
534return this.GetSubText(new TextSpan(start, this.Length - start)); 543this.Write(textWriter, new TextSpan(0, this.Length), cancellationToken); 710return ToString(new TextSpan(0, this.Length)); 798var subText = this.GetSubText(new TextSpan(position, change.Span.Start - position)); 821var subText = this.GetSubText(new TextSpan(position, this.Length - position)); 869return this.Replace(new TextSpan(start, length), newText); 890return ImmutableArray.Create(new TextChangeRange(new TextSpan(0, oldText.Length), this.Length)); 914var span = new TextSpan(newPos, range.NewLength);
Text\SubText.cs (3)
95return new TextSpan(compositeStart, compositeEnd - compositeStart); 154return TextLine.FromSpanUnsafe(_subText, new TextSpan(_subText.UnderlyingSpan.End, 0)); 181var resultLine = TextLine.FromSpanUnsafe(_subText, new TextSpan(startInSubText, length));
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)
67span = new TextSpan(span.Start, span.Length + lineBreakLen);
Text\TextSpan.cs (1)
197return new TextSpan(start, end - start);
Microsoft.CodeAnalysis.Analyzers (39)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer.cs (1)
714fileSpan = 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\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
38span = new TextSpan(offset + index, 2); 167result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 206result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 213result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 220result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 1)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
51return new TextSpan(wordStart, 1); 69return new TextSpan(wordStart, 1); 97return new TextSpan(wordStart, 1); 128return new TextSpan(wordStart, end - wordStart); 134return new TextSpan(wordStart, current - wordStart); 146return new TextSpan(wordStart, 1); 158return new TextSpan(wordStart, current - wordStart);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
112=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
79textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
Microsoft.CodeAnalysis.AnalyzerUtilities (34)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
38span = new TextSpan(offset + index, 2); 167result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 206result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 213result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 220result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 1)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
51return new TextSpan(wordStart, 1); 69return new TextSpan(wordStart, 1); 97return new TextSpan(wordStart, 1); 128return new TextSpan(wordStart, end - wordStart); 134return new TextSpan(wordStart, current - wordStart); 146return new TextSpan(wordStart, 1); 158return new TextSpan(wordStart, current - wordStart);
Microsoft.CodeAnalysis.BannedApiAnalyzers (37)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
38span = new TextSpan(offset + index, 2); 167result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 206result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 213result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 220result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 1)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
51return new TextSpan(wordStart, 1); 69return new TextSpan(wordStart, 1); 97return new TextSpan(wordStart, 1); 128return new TextSpan(wordStart, end - wordStart); 134return new TextSpan(wordStart, current - wordStart); 146return new TextSpan(wordStart, 1); 158return new TextSpan(wordStart, current - wordStart);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
112=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
79textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
SymbolIsBannedAnalyzer.cs (1)
71let span = commentIndex == -1 ? line.Span : new Text.TextSpan(line.Span.Start, trimmedTextWithoutComment.Length)
Microsoft.CodeAnalysis.CodeStyle (42)
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\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\Analyzers\Core\Analyzers\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (1)
78Location.Create(badTrivia.SyntaxTree!, new TextSpan(badTrivia.SpanStart, 0)),
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
354new Text.TextSpan(
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
38span = new TextSpan(offset + index, 2); 167result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 206result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 213result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 220result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 1)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
51return new TextSpan(wordStart, 1); 69return new TextSpan(wordStart, 1); 97return new TextSpan(wordStart, 1); 128return new TextSpan(wordStart, end - wordStart); 134return new TextSpan(wordStart, current - wordStart); 146return new TextSpan(wordStart, 1); 158return new TextSpan(wordStart, current - wordStart);
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (1)
39document, new TextSpan(typeName.Value.Span.Start, 0), forRefactoring: false, cancellationToken).ConfigureAwait(false);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
112=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
79textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
Microsoft.CodeAnalysis.CSharp (11)
Compilation\SyntaxTreeSemanticModel.cs (1)
774Compilation.IsNullableAnalysisEnabledIn((CSharpSyntaxTree)SyntaxTree, new TextSpan(position, 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 (1)
1643return compilation.SyntaxTrees.Any(static tree => ((CSharpSyntaxTree)tree).IsNullableAnalysisEnabled(new Text.TextSpan(0, tree.Length)) == true);
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);
Syntax\SyntaxTreeDiagnosticEnumerator.cs (1)
66_current = new CSDiagnostic(sdi, new SourceLocation(_syntaxTree, new TextSpan(spanStart, spanWidth)));
Microsoft.CodeAnalysis.CSharp.CodeStyle (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (6)
277charResults.Add((ch, new TextSpan(offset + index, 1))); 381result.Add((ch, new TextSpan(offset + index, 2))); 448result.Add(((char)uintChar, new TextSpan(startIndex + offset, 2 + 8))); 459result.Add(((char)highSurrogate, new TextSpan(pos, 0))); 460result.Add(((char)lowSurrogate, new TextSpan(pos, 2 + 8))); 488result.Add((character, new TextSpan(startIndex + offset, 2 + 4)));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (5)
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
67var nodeAtInsertPosition = syntaxRoot.FindNode(new TextSpan(openParenthesisPosition, 0));
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\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
93edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
95edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (1)
CommandLineTests.cs (1)
15233var diagnosticSpan = new TextSpan(2, 2);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (17)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (1)
650var insertChange = new TextChange(new TextSpan(insertionPosition, 0), bracePair);
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (1)
262var textChange = new TextChange(new TextSpan(position, 0), textToInsert);
InlineRename\CSharpEditorInlineRenameService.cs (1)
162surroundingSpanOfInterest = new TextSpan(startPosition, length);
RawStringLiteral\RawStringLiteralCommandHandler_TypeChar.cs (2)
125return new TextChange(new TextSpan(position + 1, 0), "\"\"\""); 182return new TextChange(new TextSpan(position + 1, 0), "\"");
StringCopyPaste\KnownSourcePasteProcessor.cs (7)
188edits.Add(new TextChange(new TextSpan(StringExpressionBeforePaste.Span.Start, 0), dollarSignsToAdd)); 192edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.ContentSpans.First().Start, 0), quotesToAdd)); 197edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.StartDelimiterSpan.End, 0), NewLine + IndentationWhitespace)); 213edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpan.Start, 0), NewLine + IndentationWhitespace)); 217edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpanWithoutSuffix.End, 0), quotesToAdd)); 237edits.Add(new TextChange(new TextSpan(interpolation.OpenBraceToken.Span.End, 0), new string('{', dollarSignsToAdd))); 238edits.Add(new TextChange(new TextSpan(interpolation.CloseBraceToken.Span.Start, 0), new string('}', dollarSignsToAdd)));
StringCopyPaste\UnknownSourcePasteProcessor.cs (5)
125edits.Add(new TextChange(new TextSpan(StringExpressionBeforePaste.Span.Start, 0), dollarSignsToAdd)); 129edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.ContentSpans.First().Start, 0), quotesToAdd)); 140edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpanWithoutSuffix.End, 0), quotesToAdd)); 169edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.StartDelimiterSpan.End, 0), NewLine + IndentationWhitespace)); 213edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpan.Start, 0), NewLine + IndentationWhitespace));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (46)
Classification\SemanticClassifierTests_TestMarkup.cs (4)
52var spans = ImmutableArray.Create(new TextSpan(start, length)); 73var spans = ImmutableArray.Create(new TextSpan(start, length)); 141new TextSpan(allCode.IndexOf(code1, StringComparison.Ordinal), code1.Length), 142new TextSpan(allCode.IndexOf(code2, StringComparison.Ordinal), code2.Length)
Classification\SyntacticClassifierTests.cs (29)
6213var classifications = await GetSyntacticClassificationsAsync(document, [new TextSpan(0, source.Length)]); 6216new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(0, 3)), 6217new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentText, new TextSpan(3, 1)), 6218new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(4, 1)), 6219new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentName, new TextSpan(5, 5)), 6220new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeName, new TextSpan(11, 4)), 6221new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(15, 1)), 6222new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeQuotes, new TextSpan(16, 1)), 6223new ClassifiedSpan(ClassificationTypeNames.Identifier, new TextSpan(17, 5)), 6224new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeQuotes, new TextSpan(22, 1)), 6225new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(23, 1)), 6226new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(24, 2)), 6227new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentName, new TextSpan(26, 5)), 6228new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(31, 1)) 6243var classifications = await GetSyntacticClassificationsAsync(document, [new TextSpan(0, source.Length)]); 6246new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(2, 3)), 6247new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentText, new TextSpan(5, 1)), 6248new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(6, 1)), 6249new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentName, new TextSpan(7, 5)), 6250new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(14, 3)), 6251new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeName, new TextSpan(18, 4)), 6252new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(22, 1)), 6253new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeQuotes, new TextSpan(23, 1)), 6254new ClassifiedSpan(ClassificationTypeNames.Identifier, new TextSpan(24, 5)), 6255new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeQuotes, new TextSpan(29, 1)), 6256new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(30, 1)), 6257new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(31, 2)), 6258new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentName, new TextSpan(33, 5)), 6259new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(38, 1))
CodeActions\ApplyChangesOperationTests.cs (1)
247var context = new CodeRefactoringContext(document, new TextSpan(), refactorings.Add, CancellationToken.None);
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (6)
67await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, document, new TextSpan(0, document.GetTextAsync().Result.Length)); 95await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(ideEngineWorkspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length)); 131return await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, document, new TextSpan(0, document.GetTextAsync().Result.Length)); 177await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, sourceDocument, new TextSpan(0, sourceDocument.GetTextAsync().Result.Length)); 207var diagnostics = await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length)); 263var diagnostics = await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(ideEngineWorkspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length));
ExtractMethod\SelectionValidatorTests.cs (1)
1874var span = new TextSpan(12, 1);
NavigateTo\NavigateToSearcherTests.cs (5)
126var results = ImmutableArray.Create<INavigateToSearchResult>(new TestNavigateToSearchResult(workspace, new TextSpan(0, 0))); 161var results = ImmutableArray.Create<INavigateToSearchResult>(new TestNavigateToSearchResult(workspace, new TextSpan(0, 0))); 238var results = ImmutableArray.Create<INavigateToSearchResult>(new TestNavigateToSearchResult(workspace, new TextSpan(0, 0))); 274var results = ImmutableArray.Create<INavigateToSearchResult>(new TestNavigateToSearchResult(workspace, new TextSpan(0, 0))); 322var results = ImmutableArray.Create<INavigateToSearchResult>(new TestNavigateToSearchResult(workspace, new TextSpan(0, 0)));
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (1)
EmbeddedLanguages\RegularExpressions\CSharpRegexParserTests.cs (1)
355Assert.True(RegexLexer.IsEscapeCategoryChar(VirtualChar.Create(new Rune(ch), new TextSpan(0, 1))));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (7)
CodeGen\CodeGenTupleTest.cs (7)
5799var loc1 = Location.Create(tree, new TextSpan(0, 1)); 5910var loc1 = Location.Create(tree, new TextSpan(0, 1)); 5911var loc2 = Location.Create(tree, new TextSpan(1, 1)); 6351var loc1 = Location.Create(syntaxTree, new TextSpan(0, 1)); 6387var loc1 = Location.Create(syntaxTree, new TextSpan(0, 1)); 6388var loc2 = Location.Create(syntaxTree, new TextSpan(1, 1)); 22617var newText = text.WithChanges(new TextChange(new TextSpan(pos, 0), " ")); // add space before closing-paren
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (4)
Diagnostics\DiagnosticAnalyzerTests.cs (4)
1104var badSpan = new Text.TextSpan(100000, 10000); 3885var diagnosticSpan = new TextSpan(2, 2); 3926var diagnosticSpan = new TextSpan(2, 2); 4325? new TextSpan(0, 1)
Microsoft.CodeAnalysis.CSharp.Features (28)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (1)
129newLineEdit = new TextChange(new TextSpan(annotatedNewline.SpanStart, 0), annotatedNewline.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); 235return 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), ""));
EmbeddedLanguages\CSharpTestEmbeddedLanguageClassifier.cs (1)
122new TextSpan(0, virtualCharsWithoutMarkup.Length),
ExtractInterface\CSharpExtractInterfaceService.cs (1)
34var span = new TextSpan(position, 0);
GenerateType\CSharpGenerateTypeService.cs (2)
564? semanticModel.SyntaxTree.GetLocation(new TextSpan(lastMember.Span.End, 0)) 565: 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);
Snippets\CSharpSnippetFunctionService.cs (1)
56var typeSpan = new TextSpan(caseGenerationLocation.Start + "case ".Length, fullyQualifiedTypeName.Length);
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
67var nodeAtInsertPosition = syntaxRoot.FindNode(new TextSpan(openParenthesisPosition, 0));
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\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
93edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
95edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (4)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (2)
82yield return new TextSpan(start, end - start); 310var oldStatementTextSpan = new TextSpan(oldStatementPosition, oldStatementSource.Length);
Testing\CSharpTestMethodFinderTests.cs (2)
555var span = testDocument.CursorPosition != null ? new TextSpan(testDocument.CursorPosition.Value, 0) : testDocument.SelectedSpans.Single(); 569var span = testDocument.CursorPosition != null ? new TextSpan(testDocument.CursorPosition.Value, 0) : testDocument.SelectedSpans.Single();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (3)
Semantics\BindingAwaitTests.cs (1)
28TextSpan span = new TextSpan(text.Length, 0);
Semantics\TopLevelStatementsTests.cs (1)
8792(CSharpSyntaxNode)oldTree.GetRoot(), new[] { new TextChangeRange(new TextSpan(282, 0), 1) });
SourceGeneration\GeneratorDriverTests.cs (1)
1233new[] { (gen001, new TextSpan(0, 0)) },
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (6)
Compilation\CompilationAPITests.cs (2)
2621var loc1 = Location.Create(tree, new TextSpan(0, 1)); 2622var loc2 = Location.Create(tree, new TextSpan(1, 1));
Compilation\SemanticModelAPITests.cs (1)
3645var symbolInfo = semanticModel.GetSymbolInfo(crefSyntax.FindNode(new TextSpan(91, 34)));
Symbols\Metadata\MetadataTypeTests.cs (2)
364var span = new TextSpan(oldIText.Length, 0); 379span = new TextSpan(oldIText.Length, 0);
Symbols\Source\NullablePublicAPITests.cs (1)
1770return comp.IsNullableAnalysisEnabledIn(tree, new Text.TextSpan(0, tree.Length));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (157)
Diagnostics\DiagnosticTest.cs (7)
83Location l1 = new SourceLocation(syntaxTree, new TextSpan(5, 8)); 87Assert.Equal(new TextSpan(5, 8), d1.Location.SourceSpan); 98DiagnosticInfo di3 = new CustomErrorInfo(provider, "OtherSymbol", new SourceLocation(syntaxTree, new TextSpan(14, 8))); 99var d3 = new CSDiagnostic(di3, new SourceLocation(syntaxTree, new TextSpan(1, 1))); 101Assert.Equal(new TextSpan(1, 1), d3.Location.SourceSpan); 103Assert.Equal(new TextSpan(14, 8), d3.AdditionalLocations.First().SourceSpan); 2415return new TextSpan(index, textToFind.Length);
Diagnostics\LocationsTests.cs (11)
71return new TextSpan(index, textToFind.Length); 89TextSpan xSpan = new TextSpan(sampleProgram.IndexOf("x;", StringComparison.Ordinal), 2); 90TextSpan xToCloseBraceSpan = new TextSpan(xSpan.Start, sampleProgram.IndexOf('}') - xSpan.Start + 1); 429SourceLocation loc1 = new SourceLocation(syntaxTree, new TextSpan(3, 4)); 430SourceLocation loc2 = new SourceLocation(syntaxTree, new TextSpan(3, 4)); 431SourceLocation loc3 = new SourceLocation(syntaxTree, new TextSpan(3, 7)); 432SourceLocation loc4 = new SourceLocation(tree2, new TextSpan(3, 4)); 490TextSpan span1 = new TextSpan(sampleProgram.IndexOf("i;", StringComparison.Ordinal), 2); 491TextSpan span2 = new TextSpan(sampleProgram.IndexOf("c;", StringComparison.Ordinal), 2); 504Location location = Location.Create("test.txt", new TextSpan(), new LinePositionSpan(new LinePosition(2, 1), new LinePosition(3, 1))); 514var sourceSpan = new TextSpan();
IncrementalParsing\IncrementalParsingTests.cs (46)
495var span = new TextSpan(source.IndexOf("]") + 1, length: 1); 527var span = new TextSpan(source.IndexOf("."), length: 1); 572var prefixSpan = new TextSpan(source.IndexOf(prefix), length: prefix.Length); 573var suffixSpan = new TextSpan(source.IndexOf(suffix), length: suffix.Length); 1395var newText = text.WithChanges(new TextChange(new TextSpan(0, 8), "")); 1409var newText = text.WithChanges(new TextChange(new TextSpan(0, 8), "")); 3178new TextChange(new TextSpan(str.IndexOf(" abc", StringComparison.Ordinal), 0), "//"), 3179new TextChange(new TextSpan(str.IndexOf(" 123", StringComparison.Ordinal), 0), "//"), 3180new TextChange(new TextSpan(str.IndexOf(" def", StringComparison.Ordinal), 0), "//")); 3200var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), "{")); 3216var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), @"System.Console.WriteLine(false) 3275var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), @"if (false) 3330var span = new TextSpan(oldIText.Length, 0); 3344span = new TextSpan(oldIText.Length, 0); 3413var span = new TextSpan(currLen, 0); 3450var span = new TextSpan(text.LastIndexOf('x'), 0); 3530var change = new TextChange(new TextSpan(0, 0), items[1]); // Prepend 3628var span = new TextSpan(source.IndexOf(" A[]?"), 0); 3649var span = new TextSpan(src.IndexOf(":"), 1); 3670var span = new TextSpan(source.IndexOf(";"), 0); 3691var span = new TextSpan(source.IndexOf(";") + 1, 0); 3712var span = new TextSpan(source.IndexOf(";") + 1, 0); 3734var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3758var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3782var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3806var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3830var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3854var span = new TextSpan(source.IndexOf(substring) + substring.Length, 1); 3880var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3905var span = new TextSpan(source.IndexOf(substring), 0); 3931var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3957var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3975var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3993var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 4011var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 4025var span = new TextSpan(start: 0, length: 1); // delete first character 4039var span = new TextSpan(start: 0, length: 0); 4054var span = new TextSpan(start: source.IndexOf(substring), length: 3); // Goo[Goo] -> [Goo] 4091var span = new TextSpan(start: source.IndexOf(":") + 1, length: 0); 4118new TextChange(new TextSpan(position1, 0), "n"), 4119new TextChange(new TextSpan(position2, 0), "n"), 4120new TextChange(new TextSpan(position3, 0), "n")); 4158new TextChange(new TextSpan(locationOfChange, 0), "/*"), 4159new TextChange(new TextSpan(locationOfChange + widthOfChange, 0), "*/") 4168var newText = oldText.WithChanges(new TextChange(new TextSpan(locationOfChange, widthOfChange), "")); 4194var newText = oldText.WithChanges(new TextChange(new TextSpan(oldText.Length, 0), newChar.ToString()));
LexicalAndXml\SyntaxTokenParserTests.cs (50)
39AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 22), """ 44AssertToken(expectedKind: SyntaxKind.IdentifierToken, expectedContextualKind: SyntaxKind.None, new TextSpan(22, 3), """ 49AssertToken(expectedKind: SyntaxKind.OpenBraceToken, expectedContextualKind: SyntaxKind.None, new TextSpan(25, 3), """ 54AssertToken(expectedKind: SyntaxKind.CloseBraceToken, expectedContextualKind: SyntaxKind.None, new TextSpan(28, 3), """ 59AssertToken(expectedKind: SyntaxKind.EndOfFileToken, expectedContextualKind: SyntaxKind.None, new TextSpan(31, 0), "", parser.ParseNextToken()); 60AssertToken(expectedKind: SyntaxKind.EndOfFileToken, expectedContextualKind: SyntaxKind.None, new TextSpan(31, 0), "", parser.ParseNextToken()); 78AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 54), """ 89AssertToken(expectedKind: SyntaxKind.IdentifierToken, expectedContextualKind: SyntaxKind.None, new TextSpan(54, 3), """ 94AssertToken(expectedKind: SyntaxKind.OpenBraceToken, expectedContextualKind: SyntaxKind.None, new TextSpan(57, 3), """ 99AssertToken(expectedKind: SyntaxKind.CloseBraceToken, expectedContextualKind: SyntaxKind.None, new TextSpan(60, 3), """ 104AssertToken(expectedKind: SyntaxKind.EndOfFileToken, expectedContextualKind: SyntaxKind.None, new TextSpan(63, 0), "", parser.ParseNextToken()); 121AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 16), """ 126AssertToken(expectedKind: SyntaxKind.IdentifierToken, expectedContextualKind: SyntaxKind.None, new TextSpan(16, 3), """ 131AssertToken(expectedKind: SyntaxKind.OpenBraceToken, expectedContextualKind: SyntaxKind.None, new TextSpan(19, 3), """ 136AssertToken(expectedKind: SyntaxKind.EndOfFileToken, expectedContextualKind: SyntaxKind.None, new TextSpan(22, 18), """ 143AssertToken(expectedKind: SyntaxKind.EndOfFileToken, expectedContextualKind: SyntaxKind.None, new TextSpan(40, 0), "", parser.ParseNextToken()); 162AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(18, 22), """ 169AssertToken(expectedKind: SyntaxKind.OpenBraceToken, expectedContextualKind: SyntaxKind.None, new TextSpan(43, 3), """ 174AssertToken(expectedKind: SyntaxKind.CloseBraceToken, expectedContextualKind: SyntaxKind.None, new TextSpan(46, 3), """ 187AssertToken(expectedKind: SyntaxKind.IdentifierToken, expectedContextualKind: SyntaxKind.None, new TextSpan(1, 4), """lass""", parser.ParseNextToken()); 196AssertToken(expectedKind: SyntaxKind.EndOfFileToken, expectedContextualKind: SyntaxKind.None, new TextSpan(100, 0), "", parser.ParseNextToken()); 205AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 6), "class ", parser.ParseNextToken()); 223AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 16), """ 229AssertToken(expectedKind: SyntaxKind.IdentifierToken, expectedContextualKind: SyntaxKind.None, new TextSpan(16, 3), """ 244AssertToken(expectedKind: SyntaxKind.OpenBraceToken, expectedContextualKind: SyntaxKind.None, new TextSpan(19, 3), """ 249AssertToken(expectedKind: SyntaxKind.EndOfFileToken, expectedContextualKind: SyntaxKind.None, new TextSpan(22, 18), """ 264AssertToken(expectedKind: SyntaxKind.IdentifierToken, expectedContextualKind: SyntaxKind.WhenKeyword, new TextSpan(0, 5), "when ", parser.ParseNextToken()); 265AssertToken(expectedKind: SyntaxKind.IdentifierToken, expectedContextualKind: SyntaxKind.None, new TextSpan(5, 11), "identifier ", parser.ParseNextToken()); 266AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(16, 5), "class", parser.ParseNextToken()); 276AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 0), "", result); 281AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 0), "", result); 285AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 6), "class ", parser.ParseNextToken()); 295AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 11), "/* test */ ", result); 302AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(11, 0), "", intermediateResult); 307AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(11, 0), "", intermediateResult); 311AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(11, 6), "class ", parser.ParseNextToken()); 314AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 17), "/* test */ class ", parser.ParseNextToken()); 328AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 14), $"/* test */\r\n\r\n", result); 336AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(14, 0), "", intermediateResult); 341AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(14, 0), "", intermediateResult); 345AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(14, 6), "class ", parser.ParseNextToken()); 348AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 20), "/* test */\r\n\r\nclass ", parser.ParseNextToken()); 358AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 0), "", result); 362AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 6), "class ", parser.ParseNextToken()); 372AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 11), "/* test */ ", result); 378AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(11, 6), "class ", parser.ParseNextToken()); 381AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 17), "/* test */ class ", parser.ParseNextToken()); 395AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 12), $"/* test */\r\n", result); 401AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(12, 8), "\r\nclass ", parser.ParseNextToken()); 404AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 20), "/* test */\r\n\r\nclass ", parser.ParseNextToken());
LexicalAndXml\XmlDocCommentTests.cs (2)
3228filterSpanWithinTree: new TextSpan(0, 0)); 3276filterSpanWithinTree: new TextSpan(0, 0));
Syntax\StructuredTriviaTests.cs (1)
93var resultList = identExpr.DescendantTokens(t => t.FullSpan.OverlapsWith(new TextSpan(3, 18)));
Syntax\SyntaxDiffingTests.cs (23)
33Assert.Equal(new TextSpan(0, 0), changes[0].Span); 53Assert.Equal(new TextSpan(6, 1), changes[0].Span); 75Assert.Equal(new TextSpan(6, 1), changes[0].Span); 77Assert.Equal(new TextSpan(18, 1), changes[1].Span); 90Assert.Equal(new TextSpan(0, 6), spans[0]); 95Assert.Equal(new TextSpan(0, 0), changes[0].Span); 108Assert.Equal(new TextSpan(0, 8), spans[0]); 113Assert.Equal(new TextSpan(0, 0), changes[0].Span); 127Assert.Equal(new TextSpan(11, 11), spans[0]); // its going to pick one of the two spans. 132Assert.Equal(new TextSpan(11, 0), changes[0].Span); 147Assert.Equal(new TextSpan(10, 12), spans[0]); 152Assert.Equal(new TextSpan(10, 0), changes[0].Span); 165Assert.Equal(new TextSpan(0, 14), spans[0]); 170Assert.Equal(new TextSpan(0, 0), changes[0].Span); 183Assert.Equal(new TextSpan(10, 7), spans[0]); // int X; 188Assert.Equal(new TextSpan(10, 0), changes[0].Span); 205Assert.Equal(new TextSpan(10, 7), changes[0].Span); 222Assert.Equal(new TextSpan(24, 7), changes[0].Span); 239Assert.Equal(new TextSpan(14, 1), changes[0].Span); 252Assert.Equal(new TextSpan(14, 6), spans[0]); // 'struct' 257Assert.Equal(new TextSpan(14, 5), changes[0].Span); 307var span = new TextSpan(index, 4); 372var span = new TextSpan(index, 6);
Syntax\SyntaxNodeTests.cs (13)
578var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(0, 16)).ToList(); 590var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(1, 14)).ToList(); 602var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(7, 17)).ToList(); 615var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(8, 15)).ToList(); 664var node = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(6, 3)).First(); 745var EOFSpan = new TextSpan(root.FullSpan.End, 0); 754var nodeEndPositionSpan = new TextSpan(classDecl.FullSpan.End, 0); 764var invalidSpan = new TextSpan(100, 100); 766invalidSpan = new TextSpan(root.FullSpan.End - 1, 2); 768invalidSpan = new TextSpan(classDecl2.FullSpan.Start - 1, root.FullSpan.End); 770invalidSpan = new TextSpan(classDecl.FullSpan.End, root.FullSpan.End); 920var tree2 = tree1.WithChangedText(tree1.GetText().WithChanges(new TextChange(new TextSpan(22, 0), " return; "))); 2092var textSpan = new TextSpan(5, 10);
TextExtensions.cs (4)
25var span = new TextSpan(offset, length); 35var span = new TextSpan(offset, length); 45var span = new TextSpan(offset, length); 59var span = new TextSpan(offset, 0);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
CompilationTestUtils.cs (1)
454Assert.True(compilation.IsNullableAnalysisEnabledIn((CSharpSyntaxTree)tree, new TextSpan(0, tree.Length)));
SyntaxTreeExtensions.cs (1)
20var newFullText = oldFullText.WithChanges(new TextChange(new TextSpan(offset, length), newText));
Microsoft.CodeAnalysis.CSharp.Workspaces (10)
Classification\Worker_Preprocesser.cs (1)
340var keywordSpan = new TextSpan(node.Content.SpanStart, firstSpaceIndex);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (6)
277charResults.Add((ch, new TextSpan(offset + index, 1))); 381result.Add((ch, new TextSpan(offset + index, 2))); 448result.Add(((char)uintChar, new TextSpan(startIndex + offset, 2 + 8))); 459result.Add(((char)highSurrogate, new TextSpan(pos, 0))); 460result.Add(((char)lowSurrogate, new TextSpan(pos, 2 + 8))); 488result.Add((character, new TextSpan(startIndex + offset, 2 + 4)));
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (2)
Formatting\CSharpFormattingTestBase.cs (2)
30return AssertFormatAsync(code, code, [new TextSpan(0, code.Length)], changedOptionSet, testWithTransformation, parseOptions); 40return AssertFormatAsync(expected, code, [new TextSpan(0, code.Length)], changedOptionSet, testWithTransformation, parseOptions);
Microsoft.CodeAnalysis.EditorFeatures (20)
AutomaticCompletion\AbstractAutomaticLineEnderCommandHandler.cs (1)
207var insertChange = new TextChange(new TextSpan(insertPosition, 0), endingString);
Classification\Semantic\AbstractSemanticOrEmbeddedClassificationViewTaggerProvider.cs (1)
173var changedSpan = new TextSpan(collapsedRange.Span.Start, collapsedRange.NewLength);
CodeActions\CodeActionEditHandlerService.cs (1)
313_renameService.StartInlineSession(openDocument, new TextSpan(renameOperation.Position, 0), cancellationToken);
CommentSelection\AbstractCommentSelectionBase.cs (1)
80=> textChanges.Add(new TextChange(new TextSpan(position, 0), text));
CommentSelection\AbstractToggleBlockCommentBase.cs (1)
388commentedSpanOnSameLine = new TextSpan();
DocumentationComments\CopilotGenerateDocumentationCommentProvider.cs (6)
102proposedEdits.Add(new DocumentationCommentProposedEdit(new TextSpan(caret + startIndex, 0), symbolName: null, DocumentationCommentTagType.Summary)); 106proposedEdits.Add(new DocumentationCommentProposedEdit(new TextSpan(summaryEndTag + "</summary>".Length + startIndex, 0), symbolName: null, DocumentationCommentTagType.Remarks)); 123proposedEdits.Add(new DocumentationCommentProposedEdit(new TextSpan(typeParamEndTag + startIndex, 0), parameterName, DocumentationCommentTagType.TypeParam)); 144proposedEdits.Add(new DocumentationCommentProposedEdit(new TextSpan(paramEndTag + startIndex, 0), parameterName, DocumentationCommentTagType.Param)); 153proposedEdits.Add(new DocumentationCommentProposedEdit(new TextSpan(returnsEndTag + startIndex, 0), symbolName: null, DocumentationCommentTagType.Returns)); 171proposedEdits.Add(new DocumentationCommentProposedEdit(new TextSpan(exceptionEndTag + startIndex, 0), exceptionName, DocumentationCommentTagType.Exception));
EditorConfigSettings\Updater\NamingStyles\SourceTextExtensions.cs (1)
46var span = new TextSpan(sourceText.Length, 0);
EditorConfigSettings\Updater\SettingsUpdateHelper.cs (3)
306return (editorConfigText.WithChanges(new TextChange(new TextSpan(lastValidSpecificHeaderSpanEnd.Value.Span.End, 0), newEntry)), lastValidHeaderSpanEnd, lastValidSpecificHeaderSpanEnd); 315return (editorConfigText.WithChanges(new TextChange(new TextSpan(lastValidHeaderSpanEnd.Value.Span.End, 0), newEntry)), lastValidHeaderSpanEnd, lastValidSpecificHeaderSpanEnd); 349var result = editorConfigText.WithChanges(new TextChange(new TextSpan(editorConfigText.Length, 0), prefix + newEntry));
InlineRename\AbstractEditorInlineRenameService.SymbolRenameInfo.cs (2)
102return new TextSpan(location.TextSpan.Start + index, searchName.Length); 122return new TextSpan(location.TextSpan.Start + position, replacementText.Length);
InlineRename\UI\InlineRenameAdornmentManager.cs (1)
133var identifierSelection = new TextSpan(start, length);
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (1)
187var textChange = new TextChange(new TextSpan(_snapshotSpan.Start, _snapshotSpan.Length), _stateMachine.TrackingSession.OriginalName);
Shared\Extensions\SpanExtensions.cs (1)
20=> new(span.Start, span.Length);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (18)
BraceHighlighting\MultiCharacterBraceHighlightingTests.cs (8)
59return new BraceMatchingResult(new TextSpan(position, 2), new TextSpan(secondAt, 2)); 68return new BraceMatchingResult(new TextSpan(position - 1, 2), new TextSpan(secondAt, 2)); 74return new BraceMatchingResult(new TextSpan(lessThan, 2), new TextSpan(position, 2)); 83return new BraceMatchingResult(new TextSpan(lessThan, 2), new TextSpan(position - 1, 2));
BracePairs\AbstractBracePairsTests.cs (1)
36await service.AddBracePairsAsync(document, new TextSpan(0, text.Length), bracePairs, CancellationToken.None);
Classification\AbstractClassifierTests.cs (2)
49spans = [new TextSpan(start, length)]; 60spans = [new TextSpan(0, allCode.Length)];
Completion\AbstractCompletionProviderTests.cs (3)
769var textChange = new TextChange(new TextSpan(firstItem.Span.End, 0), commitChar.ToString()); 1296var assertText = "'" + text.ToString(new TextSpan(position, 1)) + "' expected to be textual trigger character"; 1301var assertText = "'" + text.ToString(new TextSpan(position, 1)) + "' expected to NOT be textual trigger character";
ExtractInterface\ExtractInterfaceTestState.cs (1)
102new TextSpan(_testDocument.CursorPosition.Value, 1),
ObsoleteSymbol\AbstractObsoleteSymbolTests.cs (1)
37var textSpans = ImmutableArray.Create(new TextSpan(0, text.Length));
ReassignedVariable\AbstractReassignedVariableTests.cs (1)
36var textSpans = ImmutableArray.Create(new TextSpan(0, text.Length));
Workspaces\EditorTestWorkspace.cs (1)
477tempMappedMarkupSpans[key].Add(new TextSpan(spanStartLocation!.Value, spanEndLocationExclusive!.Value - spanStartLocation.Value));
Microsoft.CodeAnalysis.EditorFeatures.Text (6)
Extensions.SnapshotSourceText.cs (2)
302return [new TextChangeRange(new TextSpan(0, oldText.Length), this.Length)]; 353return [new TextChangeRange(new TextSpan(0, oldTextLength), this.Length)];
Extensions.TextBufferContainer.cs (1)
113var changes = ImmutableArray.CreateRange(args.Changes.Select(c => new TextChangeRange(new TextSpan(c.OldSpan.Start, c.OldSpan.Length), c.NewLength)));
ITextImageHelpers.cs (2)
107return new TextChangeRange(new TextSpan(change.OldSpan.Start, change.OldSpan.Length), change.NewLength); 111return new TextChangeRange(new TextSpan(change.NewSpan.Start, change.NewSpan.Length), change.OldLength);
Shared\Extensions\TextSpanExtensions.cs (1)
22=> new TextSpan(textSpan.Start + offset, textSpan.Length);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (106)
CodeFixes\CodeFixServiceTests.cs (2)
601context.ReportDiagnostic(Diagnostic.Create(s_descriptor, tree.GetLocation(new TextSpan(0, 1)))); 911var span = new TextSpan(line.Start, line.End);
CodeGeneration\CodeGenerationTests.cs (1)
643var destSpan = new TextSpan();
CommentSelection\CommentUncommentSelectionCommandHandlerTests.cs (78)
103new TextChange(new TextSpan(8, 0), "/*"), 104new TextChange(new TextSpan(14, 0), "*/"), 117new TextChange(new TextSpan(0, 0), "//"), 118new TextChange(new TextSpan(16, 0), "//"), 145new TextChange(new TextSpan(20, 0), "//"), 146new TextChange(new TextSpan(34, 0), "//"), 147new TextChange(new TextSpan(41, 0), "//"), 171new TextChange(new TextSpan(0, 0), "//"), 172new TextChange(new TextSpan(9, 0), "//"), 173new TextChange(new TextSpan(12, 0), "//"), 174new TextChange(new TextSpan(30, 0), "//"), 185new TextChange(new TextSpan(0, 0), "//"), 186new TextChange(new TextSpan(11, 0), "//"), 187new TextChange(new TextSpan(16, 0), "//"), 188new TextChange(new TextSpan(36, 0), "//"), 211new TextChange(new TextSpan(20, 0), "//"), 212new TextChange(new TextSpan(34, 0), "//"), 213new TextChange(new TextSpan(41, 0), "//"), 232new TextChange(new TextSpan(20, 0), "//"), 233new TextChange(new TextSpan(34, 0), "//"), 234new TextChange(new TextSpan(41, 0), "//"), 254new TextChange(new TextSpan(20, 0), "//"), 255new TextChange(new TextSpan(34, 0), "//"), 256new TextChange(new TextSpan(41, 0), "//"), 277new TextChange(new TextSpan(20, 0), "/*"), 278new TextChange(new TextSpan(21, 0), "*/"), 279new TextChange(new TextSpan(34, 0), "//"), 280new TextChange(new TextSpan(41, 0), "/*"), 281new TextChange(new TextSpan(42, 0), "*/"), 282new TextChange(new TextSpan(52, 0), "//"), 302new TextChange(new TextSpan(20, 0), "//"), 303new TextChange(new TextSpan(34, 0), "//"), 304new TextChange(new TextSpan(41, 0), "//"), 313UncommentSelection(code, new[] { new TextChange(new TextSpan(0, 2), string.Empty) }, Span.FromBounds(0, 6), supportBlockComments: true); 322new TextChange(new TextSpan(7, 2), string.Empty), 323new TextChange(new TextSpan(30, 2), string.Empty), 335new TextChange(new TextSpan(11, 2), string.Empty), 336new TextChange(new TextSpan(34, 2), string.Empty), 359new TextChange(new TextSpan(18, 2), string.Empty), 360new TextChange(new TextSpan(34, 2), string.Empty), 361new TextChange(new TextSpan(47, 2), string.Empty), 362new TextChange(new TextSpan(68, 2), string.Empty), 363new TextChange(new TextSpan(119, 2), string.Empty), 364new TextChange(new TextSpan(128, 2), string.Empty), 385new TextChange(new TextSpan(20, 2), string.Empty), 386new TextChange(new TextSpan(23, 2), string.Empty), 387new TextChange(new TextSpan(38, 2), string.Empty), 388new TextChange(new TextSpan(49, 2), string.Empty), 389new TextChange(new TextSpan(52, 2), string.Empty), 390new TextChange(new TextSpan(64, 2), string.Empty), 411new TextChange(new TextSpan(2, 2), string.Empty), 412new TextChange(new TextSpan(19, 2), string.Empty), 413new TextChange(new TextSpan(26, 2), string.Empty), 433new TextChange(new TextSpan(6, 2), string.Empty), 434new TextChange(new TextSpan(16, 2), string.Empty) 447new TextChange(new TextSpan(19, 2), string.Empty), 448new TextChange(new TextSpan(29, 2), string.Empty) 461new TextChange(new TextSpan(0, 2), string.Empty), 462new TextChange(new TextSpan(15, 2), string.Empty) 475new TextChange(new TextSpan(0, 2), string.Empty), 476new TextChange(new TextSpan(15, 2), string.Empty) 513new TextChange(new TextSpan(18, 2), string.Empty), 514new TextChange(new TextSpan(112, 2), string.Empty), 544new TextChange(new TextSpan(20, 2), string.Empty), 545new TextChange(new TextSpan(114, 2), string.Empty), 573new TextChange(new TextSpan(18, 2), string.Empty), 574new TextChange(new TextSpan(112, 2), string.Empty), 602new TextChange(new TextSpan(18, 2), string.Empty), 603new TextChange(new TextSpan(112, 2), string.Empty), 631new TextChange(new TextSpan(55, 2), string.Empty), 659new TextChange(new TextSpan(55, 2), string.Empty), 687new TextChange(new TextSpan(18, 2), string.Empty), 688new TextChange(new TextSpan(28, 2), string.Empty), 689new TextChange(new TextSpan(44, 2), string.Empty), 690new TextChange(new TextSpan(53, 2), string.Empty), 691new TextChange(new TextSpan(78, 2), string.Empty), 692new TextChange(new TextSpan(109, 2), string.Empty), 693new TextChange(new TextSpan(118, 2), string.Empty),
Diagnostics\DiagnosticAnalyzerServiceTests.cs (3)
367var diagnosticSpan = new TextSpan(2, 2); 692? new TextSpan(0, 1) 793var generator = new DiagnosticProducingGenerator(c => Location.Create(c.Compilation.SyntaxTrees.Single(), new TextSpan(0, 10)));
Diagnostics\DiagnosticDataTests.cs (10)
28await VerifyTextSpanAsync(code, 10, 10, 20, 20, new TextSpan(0, 0)); 37await VerifyTextSpanAsync(code, 30, 30, 40, 40, new TextSpan(code.Length, 0)); 46await VerifyTextSpanAsync(code, 0, 30, 40, 40, new TextSpan(code.Length, 0)); 55await VerifyTextSpanAsync(code, 0, 30, 0, 40, new TextSpan(code.Length, 0)); 64await VerifyTextSpanAsync(code, 1, 30, 1, 40, new TextSpan(code.Length, 0)); 73await VerifyTextSpanAsync(code, 1, 30, 1, 40, new TextSpan(code.Length, 0)); 82await VerifyTextSpanAsync(code, 1, 30, 2, 40, new TextSpan(code.Length, 0)); 91await VerifyTextSpanAsync(code, 1, 0, 1, 2, new TextSpan(code.Length, 0)); 106await VerifyTextSpanAsync(code, 3, 10, 3, 11, new TextSpan(28, 1)); 226await VerifyTextSpanAsync(content, 3, 10, 3, 11, new TextSpan(28, 1));
EditorAdapter\TextSnapshotImplementationTest.cs (4)
43Assert.Equal(new TextSpan(0, 3), line1.Span); 44Assert.Equal(new TextSpan(0, 5), line1.SpanIncludingLineBreak); 54Assert.Equal(new TextSpan(5, 3), line1.Span); 55Assert.Equal(new TextSpan(5, 3), line1.SpanIncludingLineBreak);
EditorAdapter\TextSpanExtensionsTest.cs (3)
23var textSpan = new TextSpan(start, length); 38var textSpan = new TextSpan(0, 5); 50var textSpan = new TextSpan(0, 10);
RenameTracking\RenameTrackingTestState.cs (1)
166var span = textSpan ?? new TextSpan(_view.Caret.Position.BufferPosition, 0);
Snippets\RoslynLSPSnippetConvertTests.cs (3)
404[], new TextChange(new TextSpan(8, 0), "quux"), triggerLocation: 12, CancellationToken.None).Result; 415[], new TextChange(new TextSpan(4, 4), "bar quux"), triggerLocation: 12, CancellationToken.None).Result; 492var textChange = new TextChange(new TextSpan(stringSpan.Start, 0), text.Substring(stringSpan.Start, stringSpan.Length));
ValueTracking\AbstractBaseValueTrackingTests.cs (1)
30var textSpan = new TextSpan(cursorDocument.CursorPosition!.Value, 0);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (9)
CodeDefinitionWindow\CrossLanguageCodeDefinitionWindowTests.vb (1)
66Return New TextSpan(5, 2)
Diagnostics\DiagnosticServiceTests.vb (1)
1358Dim spanAtCaret = New TextSpan(diagnostic.DataLocation.UnmappedFileSpan.GetClampedTextSpan(text).Start, 0)
FindReferences\FindReferencesTests.vb (2)
409builder.Append(text.GetSubText(New TextSpan(position, span.Start - position))) 416builder.Append(text.GetSubText(New TextSpan(position, text.Length - position)))
IntelliSense\CSharpCompletionCommandHandlerTests.vb (1)
8239New TextChange(New TextSpan(0, _caretPosition), newText))
IntelliSense\IntellisenseQuickInfoBuilderTests.vb (3)
26New TextSpan(0, 0), 118New TextSpan(0, 0), 203New TextSpan(0, 0),
NavigationBar\TestHelpers.vb (1)
97Dim contextLocation = (Await document.GetSyntaxTreeAsync()).GetLocation(New TextSpan(0, 0))
Microsoft.CodeAnalysis.Features (49)
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\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(
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (1)
716[new TextSpan(0, text.Length)],
Common\TaggedText.cs (1)
191yield 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)
259return CompletionChange.Create(new TextChange(new TextSpan(), ""));
Completion\Providers\AbstractAwaitCompletionProvider.cs (2)
191var asyncChange = new TextChange(new TextSpan(GetAsyncKeywordInsertionPosition(declaration), 0), syntaxFacts.GetText(syntaxKinds.AsyncKeyword) + " "); 220builder.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\ICopilotChangeAnalysisService.cs (1)
109newSpans.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);
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (2)
103var replaceSpan = new TextSpan(token.Span.Start, spanToReplaceLength); 362var 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\JsonLexer.cs (1)
189var chars = this.Text.GetSubSequence(new TextSpan(Position, 1));
EmbeddedLanguages\Json\JsonParser.cs (1)
397literalToken.VirtualChars.GetSubSequence(new TextSpan(0, 1)),
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\RegexLexer.cs (1)
66return CreateToken(GetKind(ch), trivia, Text.GetSubSequence(new TextSpan(Position - 1, 1)));
EmbeddedLanguages\StackFrame\StackFrameLexer.cs (1)
131return CreateToken(GetKind(ch), Text.GetSubSequence(new TextSpan(Position, 1)));
GenerateType\AbstractGenerateTypeService.Editor.cs (1)
296new CodeGenerationContext(newSemanticModel.SyntaxTree.GetLocation(new TextSpan()))),
Highlighting\Keywords\AbstractKeywordHighlighter.cs (1)
81=> new(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);
Shared\Utilities\ExtractTypeHelpers.cs (1)
68contextLocation: newSemanticModel.SyntaxTree.GetLocation(new TextSpan()),
Snippets\SnippetFunctionService.cs (1)
41var updatedTextSpan = new TextSpan(fieldSpan.Start, fullyQualifiedTypeName.Length);
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\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\Analyzers\Core\Analyzers\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (1)
78Location.Create(badTrivia.SyntaxTree!, new TextSpan(badTrivia.SpanStart, 0)),
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
354new Text.TextSpan(
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.Features.Test.Utilities (3)
EditAndContinue\EditAndContinueWorkspaceTestBase.cs (1)
459=> new TextSpan(str.IndexOf(substr), substr.Length);
EditAndContinue\SourceMarkers.cs (2)
103result.Add((id, new TextSpan(span.Index, span.Length))); 133result[activeStatementId][exceptionRegionId] = new TextSpan(exceptionRegion.Index + start, length);
Microsoft.CodeAnalysis.LanguageServer.Protocol (13)
Handler\Breakpoints\ValidateBreakableRangeHandler.cs (3)
78var breakpointSpan = result.IsLineBreakpoint ? new TextSpan(span.Start, length: 0) : result.TextSpan; 99var secondResult = await breakpointService.ResolveBreakpointAsync(document, new TextSpan(span.End, length: 0), cancellationToken).ConfigureAwait(false); 102breakpointSpan = secondResult.IsLineBreakpoint ? new TextSpan(span.Start, length: 0) : secondResult.TextSpan;
Handler\Completion\CompletionHandler.cs (1)
156var defaultSpan = new TextSpan(completionList.Span.Start, length: position - completionList.Span.Start);
Handler\InlineCompletions\InlineCompletionsHandler.cs (6)
204snippetEndPosition = GetAdjustedSpan(formattingChanges, new TextSpan(snippetEndPosition, 0)).Start; 238return new TextSpan(originalSpan.Start + amountToAdjust, originalSpan.Length); 243var offsetInSnippet = new TextSpan(positionInFullText - snippetPositionInFullText, length); 286part = await functionPart.WithSnippetFunctionResultAsync(documentWithDefaultSnippet, new TextSpan(locationInDefaultSnippet, part.DefaultText.Length), simplifierOptions, cancellationToken).ConfigureAwait(false); 292var fieldSpan = new TextSpan(locationInFinalSnippet, part.DefaultText.Length); 297caretSpan = new TextSpan(locationInFinalSnippet, cursorPart.DefaultText.Length);
Handler\OnAutoInsert\OnAutoInsertHandler.cs (1)
220var indentedText = textToIndent.WithChanges(new TextChange(new TextSpan(lineToIndent.End, 0), indentText));
Handler\SemanticTokens\SemanticTokensHelpers.cs (2)
39ranges ??= [ProtocolConversions.TextSpanToRange(new TextSpan(0, text.Length), text)]; 219textSpan = new TextSpan(line.Start, endOffSet);
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (8)
Completion\CompletionResolveTests.cs (1)
502var textChange = new TextChange(span: new TextSpan(start: 77, length: 9), newText: @"public override void M()
Diagnostics\AbstractPullDiagnosticTestsBase.cs (1)
225var lineInfo = sourceText.Lines.GetLinePositionSpan(new TextSpan(position, 0));
Diagnostics\PullDiagnosticTests.cs (4)
738return Location.Create(context.Compilation.SyntaxTrees.Single(), new TextSpan(0, 10)); 1369var generator = new DiagnosticProducingGenerator(context => Location.Create(context.Compilation.SyntaxTrees.Single(), new TextSpan(0, 10))); 1391new TextSpan(0, 10))); 2232text = text.WithChanges(new TextChange(new TextSpan(position.Value, 0), textToInsert));
SpellCheck\SpellCheckTests.cs (1)
630var lineInfo = sourceText.Lines.GetLinePositionSpan(new TextSpan(position, 0));
Workspaces\LspWorkspaceManagerTests.cs (1)
657(ProtocolConversions.TextSpanToRange(new TextSpan(initialContents.IndexOf("C3"), 1), originalSourceText), "D"));
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (36)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
38span = new TextSpan(offset + index, 2); 167result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 206result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 213result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 220result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 1)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
51return new TextSpan(wordStart, 1); 69return new TextSpan(wordStart, 1); 97return new TextSpan(wordStart, 1); 128return new TextSpan(wordStart, end - wordStart); 134return new TextSpan(wordStart, current - wordStart); 146return new TextSpan(wordStart, 1); 158return new TextSpan(wordStart, current - wordStart);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
112=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
79textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
Microsoft.CodeAnalysis.PublicApiAnalyzers (34)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
38span = new TextSpan(offset + index, 2); 167result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 206result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 213result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 220result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 1)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
51return new TextSpan(wordStart, 1); 69return new TextSpan(wordStart, 1); 97return new TextSpan(wordStart, 1); 128return new TextSpan(wordStart, end - wordStart); 134return new TextSpan(wordStart, current - wordStart); 146return new TextSpan(wordStart, 1); 158return new TextSpan(wordStart, current - wordStart);
Microsoft.CodeAnalysis.PublicApiAnalyzers.CodeFixes (5)
AnnotatePublicApiFix.cs (1)
99SourceText newSourceText = sourceText.Replace(new TextSpan(0, sourceText.Length), string.Join(endOfLine, lines) + sourceText.GetEndOfFileText(endOfLine));
DeclarePublicApiFix.cs (2)
146return sourceText?.Replace(new TextSpan(0, sourceText.Length), newText) ?? SourceText.From(newText); 175SourceText newSourceText = sourceText.Replace(new TextSpan(0, sourceText.Length), string.Join(endOfLine, newLines) + sourceText.GetEndOfFileText(endOfLine));
NullableEnablePublicApiFix.cs (1)
67SourceText newSourceText = sourceText.WithChanges(new TextChange(new TextSpan(0, 0), extraLine));
PublicApiFixHelpers.cs (1)
90return sourceText.ToString(new TextSpan(firstLine.End, firstLine.EndIncludingLineBreak - firstLine.End));
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Services\SemanticClassification\RemoteSemanticClassificationService.Caching.cs (1)
331classifiedSpans.Add(new ClassifiedSpan(classificationTypes[typeIndex], new TextSpan(start, length)));
Microsoft.CodeAnalysis.ResxSourceGenerator (34)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
38span = new TextSpan(offset + index, 2); 167result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 206result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 213result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 220result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 1)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
51return new TextSpan(wordStart, 1); 69return new TextSpan(wordStart, 1); 97return new TextSpan(wordStart, 1); 128return new TextSpan(wordStart, end - wordStart); 134return new TextSpan(wordStart, current - wordStart); 146return new TextSpan(wordStart, 1); 158return new TextSpan(wordStart, current - wordStart);
Microsoft.CodeAnalysis.Test.Utilities (3)
Diagnostics\DiagnosticsHelper.cs (1)
22return new TextSpan(match.Index, match.Length);
MarkedSource\SourceWithMarkedNodes.cs (2)
66yield return new MarkedSpan(new TextSpan(absoluteOffset, markedSyntax.Length), new TextSpan(match.Index, match.Length), tagName.Value, parsedKind, id, parentId);
Microsoft.CodeAnalysis.UnitTests (304)
Diagnostics\SarifErrorLoggerTests.cs (1)
35var span = new TextSpan(0, 0);
Text\SourceTextTests.cs (2)
191var span = new TextSpan(0, 1); 436select new object[] { new TextSpan(start, length) };
Text\StringText_LineTest.cs (11)
20var span = new TextSpan(0, 3); 53var line = TextLine.FromSpan(text, new TextSpan(0, 3)); 62Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(0, 0))); 69Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(0, 3))); 76Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(1, 5))); 84var line = TextLine.FromSpan(text, new TextSpan(start, 0)); 98var line = TextLine.FromSpan(text, new TextSpan(0, 0)); 107Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(1, 10))); 114Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(-1, 2))); 121Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(7, 0))); 128Assert.Throws<ArgumentNullException>(() => TextLine.FromSpan(null, new TextSpan(0, 2)));
Text\TextChangeRangeTest.cs (8)
20() => { var notUsed = new TextChangeRange(new TextSpan(), -1); }); 26var span = new TextSpan(2, 50); 39EqualityUnit.Create(new TextChangeRange(new TextSpan(42, 2), 13)).WithEqualValues(new TextChangeRange(new TextSpan(42, 2), 13)), 40EqualityUnit.Create(new TextChangeRange(new TextSpan(42, 2), 13)).WithNotEqualValues(new TextChangeRange(new TextSpan(42, 2), 5)), 41EqualityUnit.Create(new TextChangeRange(new TextSpan(42, 2), 13)).WithNotEqualValues(new TextChangeRange(new TextSpan(42, 4), 13)));
Text\TextChangeTests.cs (195)
41var subText = text.GetSubText(new TextSpan(0, 5)); 49var subText = text.GetSubText(new TextSpan(6, 5)); 57var subText = text.GetSubText(new TextSpan(4, 3)); 65var subText = text.GetSubText(new TextSpan(0, 5)); 66var subSubText = subText.GetSubText(new TextSpan(0, 0)); 111new TextChange(new TextSpan(0, 5), "Halo"), 112new TextChange(new TextSpan(6, 5), "Universe")); 123new TextChange(new TextSpan(0, 5), "Halo"), 124new TextChange(new TextSpan(3, 5), "Universe") 136new TextChange(new TextSpan(6, 5), "Universe"), 137new TextChange(new TextSpan(0, 5), "Halo") 150new TextChange(new TextSpan(6, 7), "Universe"), 151new TextChange(new TextSpan(0, 5), "Halo") 165new TextChange(new TextSpan(6, 0), "Super "), 166new TextChange(new TextSpan(6, 0), "Spectacular ")); 177new TextChange(new TextSpan(6, 0), "Super "), 178new TextChange(new TextSpan(6, 2), "Vu")); 189new TextChange(new TextSpan(6, 2), "Vu"), 190new TextChange(new TextSpan(6, 0), "Super ") 203new TextChange(new TextSpan(4, 1), string.Empty), 204new TextChange(new TextSpan(5, 1), string.Empty)); 214new TextChange(new TextSpan(4, 1), string.Empty), 215new TextChange(new TextSpan(6, 5), "Universe")); 217var subText = newText.GetSubText(new TextSpan(3, 4)); 229new TextChange(new TextSpan(4, 1), string.Empty)); 239new TextChange(new TextSpan(6, 5), "Universe")); 256new TextChange(new TextSpan(0, 1), "[1]"), 257new TextChange(new TextSpan(1, 1), "[2]"), 258new TextChange(new TextSpan(5, 0), "[3]"), 259new TextChange(new TextSpan(25, 2), "[4]") 301new TextChange(new TextSpan(8, 2), "IN"), 302new TextChange(new TextSpan(15, 2), "IN")); 309new TextChange(new TextSpan(8, 2), new string('a', 10)), 310new TextChange(new TextSpan(15, 2), new string('a', 10))); 317new TextChange(new TextSpan(8, 2), "\r\n"), 318new TextChange(new TextSpan(15, 2), "\r\n")); 325new TextChange(new TextSpan(6, 0), "aa\r"), 326new TextChange(new TextSpan(11, 0), "aa\r")); 333new TextChange(new TextSpan(6, 0), "aa\n"), 334new TextChange(new TextSpan(11, 0), "aa\n")); 341new TextChange(new TextSpan(4, 4), "aaaaaa"), 342new TextChange(new TextSpan(15, 4), "aaaaaa")); 349new TextChange(new TextSpan(5, 0), "aaaaaa")); 356new TextChange(new TextSpan(5, 0), "\naaaaaa\r")); 363new TextChange(new TextSpan(21, 0), "Line4\r\n"), 364new TextChange(new TextSpan(21, 0), "Line5\r\n")); 415var subtext = text.GetSubText(new TextSpan(5, 10)); 426var newText = text.Replace(new TextSpan(0, 20), ""); 437var newText = text.Replace(new TextSpan(10, 6), ""); 449var newText = text.Replace(new TextSpan(10, 1), ""); 465var textWithSegments = text.Replace(new TextSpan(10, 0), "*"); 482var textWithSegments = text.Replace(new TextSpan(10, 0), "*"); 486var textWithFewerSegments = textWithSegments.Replace(new TextSpan(9, 3), ""); 502var textWithSegments = text.Replace(new TextSpan(0, text.Length), ""); 659var change1 = original.WithChanges(new TextChange(new TextSpan(5, 6), string.Empty)); // prepare a ChangedText instance 670var change1 = original.WithChanges(new TextChange(new TextSpan(5, 6), string.Empty)); // prepare a ChangedText instance 671var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 0), string.Empty)); // this should not cause exception 680var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 681var change2 = change1.WithChanges(new TextChange(new TextSpan(7, 3), "oo")); 686Assert.Equal(new TextSpan(6, 0), changes[0].Span); 695var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 696var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 0), "bb")); 701Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "abba") }, changes); 709var change1 = original.WithChanges(new TextChange(new TextSpan(1, 1), "aaa")); 710var change2 = change1.WithChanges(new TextChange(new TextSpan(3, 0), "bb")); 715Assert.Equal(new[] { new TextChange(new TextSpan(1, 1), "aabba") }, changes); 723var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 724var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 1), "bb")); 729Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "abb") }, changes); 736var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 737var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 14), "ar")); 742Assert.Equal(new TextSpan(2, 8), changes[0].Span); 750var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 751var change2 = change1.WithChanges(new TextChange(new TextSpan(4, 6), " Bel")); 756Assert.Equal(new TextSpan(4, 2), changes[0].Span); 764var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 765var change2 = change1.WithChanges(new TextChange(new TextSpan(7, 6), "wazy V")); 770Assert.Equal(new TextSpan(6, 1), changes[0].Span); 778var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 779var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 0), "bb")); 784Assert.Equal(new[] { new TextChange(new TextSpan(1, 0), "bbaa") }, changes); 791var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 792var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 0), "bb")); 797Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "bbaa") }, changes); 804var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 805var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 1), "bb")); 810Assert.Equal(new[] { new TextChange(new TextSpan(1, 0), "bba") }, changes); 817var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 818var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 2), "bb")); 823Assert.Equal(new[] { new TextChange(new TextSpan(1, 0), "bb") }, changes); 830var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 831var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 3), "bb")); 836Assert.Equal(new[] { new TextChange(new TextSpan(1, 1), "bb") }, changes); 844var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 845var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 1), "bb")); 850Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "bba") }, changes); 858var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 859var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 3), "bb")); 870var change1 = original.WithChanges(new TextChange(new TextSpan(4, 0), "o ")); 871var change2 = change1.WithChanges(new TextChange(new TextSpan(6, 0), "World")); 876Assert.Equal(new TextSpan(4, 0), changes[0].Span); 884var change1 = original.WithChanges(new TextChange(new TextSpan(4, 0), "o")); 885var change2 = change1.WithChanges(new TextChange(new TextSpan(6, 0), "World")); 890Assert.Equal(new TextSpan(4, 0), changes[0].Span); 892Assert.Equal(new TextSpan(5, 0), changes[1].Span); 900var change1 = original.WithChanges(new TextChange(new TextSpan(8, 0), "l")); 901var change2 = change1.WithChanges(new TextChange(new TextSpan(4, 0), "o")); 906Assert.Equal(new TextSpan(4, 0), changes[0].Span); 908Assert.Equal(new TextSpan(8, 0), changes[1].Span); 916var change1 = original.WithChanges(new TextChange(new TextSpan(4, 0), " World")); 918var change2 = change1.WithChanges(new TextChange(new TextSpan(4, 0), "o")); 923Assert.Equal(new TextSpan(4, 0), changes[0].Span); 934c => c.WithChanges(new TextChange(new TextSpan(4, 0), "o ")), 935c => c.WithChanges(new TextChange(new TextSpan(6, 0), "World"))); 941Assert.Equal(new TextSpan(4, 0), changes[0].Span); 949new TextChangeRange(new TextSpan(919, 10), 466), 950new TextChangeRange(new TextSpan(936, 33), 29), 951new TextChangeRange(new TextSpan(1098, 0), 70), 952new TextChangeRange(new TextSpan(1125, 4), 34), 953new TextChangeRange(new TextSpan(1138, 0), 47)); 955new TextChangeRange(new TextSpan(997, 0), 2), 956new TextChangeRange(new TextSpan(1414, 0), 2), 957new TextChangeRange(new TextSpan(1419, 0), 2), 958new TextChangeRange(new TextSpan(1671, 5), 5), 959new TextChangeRange(new TextSpan(1681, 0), 4)); 964new TextChangeRange(new TextSpan(919, 10), 468), 965new TextChangeRange(new TextSpan(936, 33), 33), 966new TextChangeRange(new TextSpan(1098, 0), 70), 967new TextChangeRange(new TextSpan(1125, 4), 38), 968new TextChangeRange(new TextSpan(1138, 0), 47)); 977Assert.Equal("new TextChange(new TextSpan(0, 1), \"abc\")", new TextChange(new TextSpan(0, 1), "abc").GetDebuggerDisplay()); 978Assert.Equal("new TextChange(new TextSpan(0, 1), (NewLength = 10))", new TextChange(new TextSpan(0, 1), "0123456789").GetDebuggerDisplay()); 1002var newChange = new TextChange(new TextSpan(i, length: random.Next(originalText.Length - i)), newText); 1022var newChange = new TextChange(new TextSpan(i, length: random.Next(editedLength - i)), newText); 1070var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 2), "a")); 1071var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 2), "bb")); 1084var change1 = original.WithChanges(new TextChange(new TextSpan(0, 0), "aa"), new TextChange(new TextSpan(1, 1), "aa")); 1085var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), "b"), new TextChange(new TextSpan(2, 2), "")); 1098var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 0), "a")); 1099var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 2), ""), new TextChange(new TextSpan(2, 0), "bb")); 1112var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "aa"), new TextChange(new TextSpan(3, 1), "aa")); 1113var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), "bbb")); 1125var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 3), "a"), new TextChange(new TextSpan(5, 0), "aaa")); 1126var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 2), ""), new TextChange(new TextSpan(3, 1), "bb")); 1139var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "aaaaa"), new TextChange(new TextSpan(3, 1), "aaaa"), new TextChange(new TextSpan(6, 1), "aaaaa")); 1140var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), "b"), new TextChange(new TextSpan(2, 0), "b"), new TextChange(new TextSpan(3, 4), "bbbbb"), new TextChange(new TextSpan(9, 5), "bbbbb"), new TextChange(new TextSpan(15, 3), "")); 1153var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "a")); 1154var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), "b"), new TextChange(new TextSpan(2, 2), "b")); 1167var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "aa")); 1168var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), "b"), new TextChange(new TextSpan(1, 2), "b")); 1181var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 2), "a"), new TextChange(new TextSpan(3, 2), "a")); 1182var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 3), "bbb")); 1195var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 4), ""), new TextChange(new TextSpan(5, 1), "")); 1196var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), ""), new TextChange(new TextSpan(1, 0), "")); 1209var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 2), ""), new TextChange(new TextSpan(3, 1), ""), new TextChange(new TextSpan(4, 0), ""), new TextChange(new TextSpan(4, 0), ""), new TextChange(new TextSpan(4, 0), "")); 1210var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), ""), new TextChange(new TextSpan(1, 1), ""), new TextChange(new TextSpan(2, 0), "")); 1223var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), ""), new TextChange(new TextSpan(2, 1), "")); 1224var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), ""), new TextChange(new TextSpan(1, 1), "")); 1249new TextChange(new TextSpan(39, 0), " "), 1250new TextChange(new TextSpan(42, 0), " "), 1251new TextChange(new TextSpan(57, 0), " "), 1252new TextChange(new TextSpan(58, 0), "\r\n"), 1253new TextChange(new TextSpan(64, 2), " "), 1254new TextChange(new TextSpan(69, 0), " "), 1260new TextChange(new TextSpan(35, 4), string.Empty), 1261new TextChange(new TextSpan(46, 4), string.Empty), 1262new TextChange(new TextSpan(73, 4), string.Empty), 1263new TextChange(new TextSpan(88, 0), " "), 1264new TextChange(new TextSpan(90, 4), string.Empty), 1265new TextChange(new TextSpan(105, 4), string.Empty),
Text\TextSpanTest.cs (87)
21var span = new TextSpan(0, 42); 30var span = new TextSpan(1, 40); 42var span = new TextSpan(0, 0); 50var s1 = new TextSpan(1, 40); 51var s2 = new TextSpan(1, 40); 64var s1 = new TextSpan(1, 40); 65var s2 = new TextSpan(2, 40); 78var s1 = new TextSpan(1, 5); 79var s2 = new TextSpan(1, 40); 89TextSpan span = new TextSpan(0, 0); 100TextSpan span = new TextSpan(0, 1); 112TextSpan span = new TextSpan(15, 1485); 122TextSpan span = new TextSpan(0, int.MaxValue - 1); 131TextSpan span = new TextSpan(0, 10); 141TextSpan span_05_15 = new TextSpan(5, 10); 142TextSpan span_03_10 = new TextSpan(3, 7); 143TextSpan span_10_11 = new TextSpan(10, 1); 144TextSpan span_00_03 = new TextSpan(0, 3); 165Assert.False(new TextSpan(2, 5).Contains(new TextSpan(0, 0))); 166Assert.False(new TextSpan(2, 5).Contains(new TextSpan(10, 0))); 169Assert.True(new TextSpan(2, 5).Contains(new TextSpan(3, 0))); 172Assert.True(new TextSpan(2, 5).Contains(new TextSpan(2, 0))); 175Assert.True(new TextSpan(2, 5).Contains(new TextSpan(7, 0))); 178Assert.True(new TextSpan(2, 0).Contains(new TextSpan(2, 0))); 185Assert.False(new TextSpan(0, 0).Contains(new TextSpan(2, 5))); 186Assert.False(new TextSpan(10, 0).Contains(new TextSpan(2, 5))); 189Assert.False(new TextSpan(3, 0).Contains(new TextSpan(2, 5))); 192Assert.False(new TextSpan(2, 0).Contains(new TextSpan(2, 5))); 195Assert.False(new TextSpan(7, 0).Contains(new TextSpan(2, 5))); 201TextSpan span1 = new TextSpan(0, 10); 202TextSpan span2 = new TextSpan(0, 10); 218TextSpan span1 = new TextSpan(0, 10); 219TextSpan span2 = new TextSpan(0, 11); 220TextSpan span3 = new TextSpan(1, 11); 236TextSpan span1 = new TextSpan(10, 10); // 10..20 237TextSpan span2 = new TextSpan(5, 5); // 5..10 248TextSpan span1 = new TextSpan(10, 10); // 10..20 249TextSpan span2 = new TextSpan(5, 2); // 5..7 260TextSpan span1 = new TextSpan(10, 10); // 10..20 261TextSpan span2 = new TextSpan(5, 10); // 5..15 265Assert.Equal(span1.Overlap(span2), new TextSpan(10, 5)); 266Assert.Equal(span2.Overlap(span1), new TextSpan(10, 5)); 272TextSpan span1 = new TextSpan(10, 0); // [10, 10) 273TextSpan span2 = new TextSpan(10, 0); // [10, 10) 284TextSpan span1 = new TextSpan(10, 0); // [10, 10) 285TextSpan span2 = new TextSpan(5, 10); // [5, 15) 296TextSpan span1 = new TextSpan(10, 10); // 10..20 297TextSpan span2 = new TextSpan(5, 5); // 5..10 301Assert.Equal(span1.Intersection(span2), new TextSpan(10, 0)); 302Assert.Equal(span2.Intersection(span1), new TextSpan(10, 0)); 308TextSpan span1 = new TextSpan(10, 10); // 10..20 309TextSpan span2 = new TextSpan(5, 2); // 5..7 320TextSpan span1 = new TextSpan(10, 10); // 10..20 321TextSpan span2 = new TextSpan(5, 10); // 5..15 325Assert.Equal(span1.Intersection(span2), new TextSpan(10, 5)); 326Assert.Equal(span2.Intersection(span1), new TextSpan(10, 5)); 332TextSpan span1 = new TextSpan(10, 0); // [10, 10) 333TextSpan span2 = new TextSpan(10, 0); // [10, 10) 337Assert.Equal(span1.Intersection(span2), new TextSpan(10, 0)); 338Assert.Equal(span2.Intersection(span1), new TextSpan(10, 0)); 344TextSpan span1 = new TextSpan(2, 5); // [2, 7) 345TextSpan span2 = new TextSpan(7, 5); // [7, 12) 349Assert.Equal(span1.Intersection(span2), new TextSpan(7, 0)); 350Assert.Equal(span2.Intersection(span1), new TextSpan(7, 0)); 356TextSpan span1 = new TextSpan(2, 5); // [2, 7) 357TextSpan span2 = new TextSpan(3, 0); // [3, 3) 361Assert.Equal(span1.Intersection(span2), new TextSpan(3, 0)); 362Assert.Equal(span2.Intersection(span1), new TextSpan(3, 0)); 368TextSpan span1 = new TextSpan(2, 5); // [2, 7) 369TextSpan span2 = new TextSpan(2, 0); // [2, 2) 373Assert.Equal(span1.Intersection(span2), new TextSpan(2, 0)); 374Assert.Equal(span2.Intersection(span1), new TextSpan(2, 0)); 380TextSpan span1 = new TextSpan(2, 5); // [2, 7) 381TextSpan span2 = new TextSpan(7, 0); // [7, 0) 385Assert.Equal(span1.Intersection(span2), new TextSpan(7, 0)); 386Assert.Equal(span2.Intersection(span1), new TextSpan(7, 0));
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.CommandLine.UnitTests (3)
CommandLineTests.vb (3)
10412Dim diagnosticSpan = New TextSpan(2, 2) 11110ReportDiagnostic(context.Options.AdditionalFiles.First().Path, context, New TextSpan(0, 1000000)) ' Overflow span 11121span = New TextSpan(0, 11)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (3)
EndConstructGeneration\SpitLinesResult.vb (1)
51subjectBuffer.ApplyChange(New TextChange(New TextSpan(caretPosition, 0), joinedLines))
EndConstructGeneration\VisualBasicEndConstructGenerationService.vb (1)
342subjectBuffer.ApplyChange(New TextChange(New TextSpan(insertPosition, 0), endText))
NavigationBar\VisualBasicEditorNavigationBarItemService_CodeGeneration.vb (1)
55Dim contextLocation = syntaxTree.GetLocation(New TextSpan(0, 0))
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (5)
CodeGen\CodeGenTuples.vb (5)
6872Dim loc1 = Location.Create(tree, New TextSpan(0, 1)) 6921Dim loc1 = Location.Create(tree, New TextSpan(0, 1)) 6922Dim loc2 = Location.Create(tree, New TextSpan(1, 1)) 7270Dim loc1 = Location.Create(tree, New TextSpan(0, 1)) 7271Dim loc2 = Location.Create(tree, New TextSpan(1, 1))
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.Features.UnitTests (2)
EditAndContinue\VisualBasicEditAndContinueAnalyzerTests.vb (2)
83span = New TextSpan(start, length) 476Dim oldStatementTextSpan = New TextSpan(oldStatementPosition, oldStatementSource.Length)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (4)
Compilation\CompilationAPITests.vb (2)
1604Dim loc1 = Location.Create(tree, New TextSpan(0, 1)) 1605Dim loc2 = Location.Create(tree, New TextSpan(1, 1))
Diagnostics\DiagnosticAnalyzerTests.vb (1)
1656Dim diagnosticSpan = New TextSpan(2, 2)
SourceGeneration\GeneratorDriverTests.vb (1)
234gen001, New TextSpan(0, 0),
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (2)
DocumentationComments\DocCommentTests.vb (2)
12550filterSpanWithinTree:=New Text.TextSpan(0, 0)) 12600filterSpanWithinTree:=New Text.TextSpan(0, 0))
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (93)
IncrementalParser\IncrementalParser.vb (35)
87Dim span = New TextSpan(i, 10) 109Dim newText = text.WithChanges(New TextChange(New TextSpan(text.Length, 0), _s.Substring(i, 1))) 126Dim newText = oldText.WithChanges(New TextChange(New TextSpan(pos, 0), "'")) 135Dim anotherText = newText.WithChanges(New TextChange(New TextSpan(pos, 1), "")) 168.changeSpan = New TextSpan(code.Length, 0), 190.changeSpan = New TextSpan(code.Length, 0), 213.changeSpan = New TextSpan(code.Length, 0), 229.changeSpan = New TextSpan(code.Length, 0), 248.changeSpan = New TextSpan(code.Length, 0), 263.changeSpan = New TextSpan(code.Length, 0), 281.changeSpan = New TextSpan(0, 0), 300.changeSpan = New TextSpan(0, 0), 314.changeSpan = New TextSpan(0, 0), 326.changeSpan = New TextSpan(0, 0), 381.changeSpan = New TextSpan(0, 0), 394.changeSpan = New TextSpan(0, 0), 414.changeSpan = New TextSpan(0, 0), 429.changeSpan = New TextSpan(0, 0), 442.changeSpan = New TextSpan(0, 0), 456.changeSpan = New TextSpan(0, 0), 638.changeSpan = New TextSpan(0, 0), 650.changeSpan = New TextSpan(0, 10), 686.changeSpan = New TextSpan(0, 0), 702Dim newText = oldText.WithChanges(New TextChange(New TextSpan(22, 0), " Sub ")) 741Dim newText = oldText.WithChanges(New TextChange(New TextSpan(103, 0), " ")) 767Dim newText = oldText.WithChanges(New TextChange(New TextSpan(insertionPoint, 0), " ")) 792Dim newText = oldText.WithChanges(New TextChange(New TextSpan(insertionPoint, replace.Length), "{")) 827Dim newText = oldText.WithChanges(New TextChange(New TextSpan(pos, 0), "'")) 849.changeSpan = New TextSpan(15, 0), 1157Dim span = New TextSpan(oldIText.Length, 0) 1163span = New TextSpan(0, code1.Length) 1203Dim span = New TextSpan(code.IndexOf("="c), 0) 1222Dim change = New TextChange(New TextSpan(position, 2), "End" + vbCrLf) 1240Dim change = New TextChange(New TextSpan(position, 0), " Select c" + vbCrLf) 1674Dim change = New TextChange(New TextSpan(position, 2), "71")
IncrementalParser\IPEndBlockStatements.vb (5)
27.changeSpan = New TextSpan(code.Length, 0), 156.changeSpan = New TextSpan(code.Length, 0), 294.changeSpan = New TextSpan(code.Length, 0), 440.changeSpan = New TextSpan(code.Length, 0), 542.changeSpan = New TextSpan(code.Length, 0),
LocationTests.vb (5)
59Return New TextSpan(index, textToFind.Length) 275Dim loc1 As SourceLocation = New SourceLocation(tree, New TextSpan(3, 4)) 276Dim loc2 As SourceLocation = New SourceLocation(tree, New TextSpan(3, 4)) 277Dim loc3 As SourceLocation = New SourceLocation(tree, New TextSpan(3, 7)) 278Dim loc4 As SourceLocation = New SourceLocation(tree2, New TextSpan(3, 4))
Scanner\ScanConditionalTests.vb (1)
37Dim disabled = s.GetDisabledTextAt(New TextSpan(0, Str.Length))
TestSyntaxNodes.vb (47)
337VerifyListSpans(precedingTrivia, New TextSpan(tree.FullSpan.Start, (tree.SpanStart - tree.FullSpan.Start))) 343VerifyListSpans(followingTrivia, New TextSpan(tree.Span.End, (tree.FullSpan.End - tree.Span.End))) 362VerifyListSpans(precedingTrivia, New TextSpan(tree.FullSpan.Start, (tree.SpanStart - tree.FullSpan.Start))) 368VerifyListSpans(followingTrivia, New TextSpan(tree.Span.End, (tree.FullSpan.End - tree.Span.End))) 376Assert.Equal(New TextSpan(0, 1), dig1.Span) 377Assert.Equal(New TextSpan(0, 1), dig1.FullSpan) 382Assert.Equal(New TextSpan(0, 4), binop.Span) 383Assert.Equal(New TextSpan(1, 1), binop.OperatorToken.Span) 384Assert.Equal(New TextSpan(1, 2), binop.OperatorToken.FullSpan) 385Assert.Equal(New TextSpan(3, 1), binop.Right.Span) 386Assert.Equal(New TextSpan(3, 1), binop.Right.FullSpan) 389Assert.Equal(New TextSpan(0, 17), simpleTree.Span) 390Assert.Equal(New TextSpan(0, 18), simpleTree.FullSpan) 391Assert.Equal(New TextSpan(3, 14), DirectCast(simpleTree, BinaryExpressionSyntax).Right.Span) 394Assert.Equal(New TextSpan(6, 1), argList.Arguments(0).Span) 395Assert.Equal(New TextSpan(7, 1), argList.Arguments.GetWithSeparators(1).Span) 396Assert.Equal(New TextSpan(9, 4), argList.Arguments(1).Span) 397Assert.Equal(New TextSpan(13, 1), argList.Arguments.GetWithSeparators(3).Span) 398Assert.Equal(New TextSpan(15, 1), argList.Arguments(2).Span) 442Dim x As New TextSpan(-1, 0) 446Dim x As New TextSpan(0, -1) 450Dim x As New TextSpan(-1, -1) 454Dim x As New TextSpan(2, -4) 489VerifyListSpans(l, New TextSpan(0, 6)) 528VerifyListSpans(l, New TextSpan(0, 21)) 996CheckErrorList(kwModule, {17}, {New TextSpan(0, 6)}) 1002CheckErrorList(kwModule, {17, 42}, {New TextSpan(0, 6), New TextSpan(0, 6)}) 1008CheckErrorList(endModule, {101, 17, 42}, {New TextSpan(3, 3), New TextSpan(6, 6), New TextSpan(6, 6)}) 1013CheckErrorList(endModule, {1, 101, 17, 42}, {New TextSpan(0, 12), New TextSpan(3, 3), New TextSpan(6, 6), New TextSpan(6, 6)}) 1049{New TextSpan(26, 5), New TextSpan(26, 5), New TextSpan(71, 22), New TextSpan(94, 1), New TextSpan(96, 5)}) 1826Dim resultList = identExpr.DescendantTokens(New TextSpan(3, 18)) 2274Dim EOFSpan = New TextSpan(root.FullSpan.End, 0) 2284Dim nodeEndPositionSpan = New TextSpan(classDecl.FullSpan.End, 0) 2295Dim invalidSpan = New TextSpan(100, 100) 2297invalidSpan = New TextSpan(root.FullSpan.End - 1, 2) 2299invalidSpan = New TextSpan(classDecl2.FullSpan.Start - 1, root.FullSpan.End) 2301invalidSpan = New TextSpan(classDecl.FullSpan.End, root.FullSpan.End)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (2)
ParserTestUtilities.vb (1)
258newText = oldText.WithChanges(New TextChange(New TextSpan(0, 0), node.changeText))
SyntaxTreeExtensions.vb (1)
12Dim newFullText = oldFullText.WithChanges(New TextChange(New TextSpan(offset, length), newText))
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.VisualBasic.Workspaces.UnitTests (2)
CaseCorrection\VisualBasicCaseCorrectionTestBase.vb (1)
19Dim newNode = Await CaseCorrector.CaseCorrectAsync(document, New TextSpan(0, code.Length))
Formatting\VisualBasicFormattingTestBase.vb (1)
97Return AssertFormatAsync(expected, code, SpecializedCollections.SingletonEnumerable(New TextSpan(0, code.Length)), changedOptionSet, testWithTransformation, experimental:=experimental)
Microsoft.CodeAnalysis.Workspaces (55)
Classification\ClassifierHelper.cs (1)
92var 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)
205var 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)
308=> _includeMatchedSpans ? new TextSpan(start, length) : null; 451=> PartStartsWith(candidate, candidatePart, pattern, new TextSpan(0, pattern.Length), compareOptions); 588matchSpans.Add(new TextSpan(candidateHump.Start, patternChunkCharacterSpan.Length)); 598candidateHump = new TextSpan(candidateHump.Start + patternChunkCharacterSpan.Length, candidateHump.Length - patternChunkCharacterSpan.Length);
Rename\ConflictEngine\ConflictResolver.Session.cs (1)
903var subSpan = new TextSpan(offset, length);
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (1)
426var matchTextSpan = new TextSpan(start, renameText.Length);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
38span = new TextSpan(offset + index, 2); 167result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 206result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 213result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 220result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 1)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
51return new TextSpan(wordStart, 1); 69return new TextSpan(wordStart, 1); 97return new TextSpan(wordStart, 1); 128return new TextSpan(wordStart, end - wordStart); 134return new TextSpan(wordStart, current - wordStart); 146return new TextSpan(wordStart, 1); 158return new TextSpan(wordStart, current - wordStart);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
112=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
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.CodeAnalysis.Workspaces.Test.Utilities (1)
Formatting\FormattingTestBase.cs (1)
30return AssertFormatAsync(expected, code, [new TextSpan(0, code.Length)], language, changedOptionSet, testWithTransformation);
Microsoft.CodeAnalysis.Workspaces.UnitTests (20)
Differencing\TestTreeComparer.cs (1)
53=> new TextSpan(0, 10);
SolutionTests\ProjectSemanticVersionTests.cs (4)
114var span = new TextSpan(text.ToString().IndexOf("20"), length: 2); 142var span = new TextSpan(text.ToString().IndexOf("20"), length: 2); 226var span = new TextSpan(text.ToString().IndexOf("20"), length: 2); 254var span = new TextSpan(text.ToString().IndexOf("20"), length: 2);
SolutionTests\SolutionWithSourceGeneratorTests.cs (1)
567var newText = existingText.WithChanges(new TextChange(new TextSpan(existingText.Length, length: 0), " With Change"));
SymbolKeyTests.cs (3)
874var updated = sourceText.WithChanges(new TextChange(new TextSpan(position, 0), "insertion")); 921var updated = sourceText.WithChanges(new TextChange(new TextSpan(position, 0), "insertion")); 1419var newTree = syntaxTree.WithChangedText(text.WithChanges(new TextChange(new TextSpan(0, text.Length), text.ToString().Replace(" ", " "))));
SyntaxPathTests.cs (4)
95var newText = text.WithChanges(new TextChange(new TextSpan(0, 0), "class C {}")); 109var newText = text.WithChanges(new TextChange(new TextSpan(0, text.Length), "")); 414var span = new TextSpan(offset, length); 430var newFullText = oldFullText.WithChanges(new TextChange(new TextSpan(offset, length), newText));
UtilityTest\IntervalTreeTests.cs (7)
21=> new(value.Item1, value.Item2); 262=> new(value, 0); 319var span = new TextSpan(start, length); 324return span.OverlapsWith(new TextSpan(t.Item1, t.Item2)); 331return span.IntersectsWith(new TextSpan(t.Item1, t.Item2)); 397=> new(value, 0); 403=> new(value, 0);
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;
Microsoft.VisualStudio.LanguageServices (6)
CodeLens\RemoteCodeLensReferencesService.cs (1)
160var span = new TextSpan(descriptor.SpanStart, descriptor.SpanLength);
Snippets\SnippetFunctions\SnippetFunctionSimpleTypeName.cs (1)
73fieldSpan = new TextSpan(subjectBufferFieldSpan.Start, subjectBufferFieldSpan.Length);
ValueTracking\TreeItemViewModel.cs (1)
116var highlightSpan = new TextSpan(spanStartPosition, TextSpan.Length);
Venus\ContainedDocument.cs (2)
416var spanInOriginalText = new TextSpan(offsetInOriginalText + spanInLeftText.Start, spanInLeftText.Length); 431groups.Add(new TextSpan(0, 0));
Venus\ContainedDocument.DocumentServiceProvider.cs (1)
318=> new(targetSpan.Start - excerptSpan.Start, targetSpan.Length);
Microsoft.VisualStudio.LanguageServices.UnitTests (5)
Preview\PreviewChangesTests.vb (2)
275Dim textChange1 = New TextChange(New TextSpan(19, 1), "N") 278Dim textChange2 = New TextChange(New TextSpan(47, 1), "Y")
Venus\DocumentService_IntegrationTests.vb (2)
327Return New ExcerptResult(mappedSource.GetSubText(line.Span), New TextSpan(mappedSpan.Start - line.Start, mappedSpan.Length), ImmutableArray.Create(New ClassifiedSpan(New TextSpan(0, line.Span.Length), ClassificationTypeNames.Text)), document, span)
Venus\DocumentServiceTests.vb (1)
64Dim spans = Await spanMapper.MapSpansAsync(workspace.CurrentSolution.GetDocument(subjectDocument.Id), {New TextSpan(position, length:=0), New TextSpan(start:=1, length:=0), New TextSpan(position + 1, length:=0)}, CancellationToken.None)
Microsoft.VisualStudio.LanguageServices.Xaml (1)
Implementation\LanguageServer\Handler\Diagnostics\AbstractPullDiagnosticHandler.cs (1)
134Range = ProtocolConversions.TextSpanToRange(new TextSpan(d.Offset, d.Length), text),
Roslyn.Diagnostics.Analyzers (36)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
38span = new TextSpan(offset + index, 2); 167result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 206result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 213result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 220result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 1)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
51return new TextSpan(wordStart, 1); 69return new TextSpan(wordStart, 1); 97return new TextSpan(wordStart, 1); 128return new TextSpan(wordStart, end - wordStart); 134return new TextSpan(wordStart, current - wordStart); 146return new TextSpan(wordStart, 1); 158return new TextSpan(wordStart, current - wordStart);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
112=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
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 (6)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (6)
277charResults.Add((ch, new TextSpan(offset + index, 1))); 381result.Add((ch, new TextSpan(offset + index, 2))); 448result.Add(((char)uintChar, new TextSpan(startIndex + offset, 2 + 8))); 459result.Add(((char)highSurrogate, new TextSpan(pos, 0))); 460result.Add(((char)lowSurrogate, new TextSpan(pos, 2 + 8))); 488result.Add((character, new TextSpan(startIndex + offset, 2 + 4)));
Roslyn.VisualStudio.Next.UnitTests (2)
Remote\RemoteHostClientServiceFactoryTests.cs (1)
51var newText = oldText.WithChanges([new TextChange(new TextSpan(0, 1), "abc")]);
Services\ServiceHubServicesTests.cs (1)
1613document, [new TextChange(new TextSpan(listIndex, 1), """
System.Text.RegularExpressions.Generator (1)
UpgradeToGeneratedRegexCodeFixer.cs (1)
140nodeToFix = root.FindNode(new TextSpan(nodeToFix.Span.Start + (typesModified * "partial".Length), nodeToFix.Span.Length), getInnermostNodeForTie: true);
Test.Utilities (34)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
38span = new TextSpan(offset + index, 2); 167result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 206result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 213result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 220result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 1)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
51return new TextSpan(wordStart, 1); 69return new TextSpan(wordStart, 1); 97return new TextSpan(wordStart, 1); 128return new TextSpan(wordStart, end - wordStart); 134return new TextSpan(wordStart, current - wordStart); 146return new TextSpan(wordStart, 1); 158return new TextSpan(wordStart, current - wordStart);
Text.Analyzers (36)
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
29var fullSpan = new TextSpan(0, text.Length);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
38span = new TextSpan(offset + index, 2); 167result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 206result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 213result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 220result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 1)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (2)
424DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 475DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
285if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
260span = new TextSpan(span.Start + i, span.Length - i);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
25Current = new TextSpan(nameSpan.Start, 0); 52Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (1)
679return Location.Create(syntaxTree, new TextSpan(start, length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
107_wordSpans[i] = new TextSpan(characterIndex, value.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Node.cs (1)
38new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (7)
51return new TextSpan(wordStart, 1); 69return new TextSpan(wordStart, 1); 97return new TextSpan(wordStart, 1); 128return new TextSpan(wordStart, end - wordStart); 134return new TextSpan(wordStart, current - wordStart); 146return new TextSpan(wordStart, 1); 158return new TextSpan(wordStart, current - wordStart);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
112=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
79textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
10215 references to TextSpan
ConfigurationSchemaGenerator (1)
RuntimeSource\Configuration.Binder\Specs\InterceptorInfo.cs (1)
180TextSpan memberNameSpan = memberAccessExprSyntax.Name.Span;
GenerateDocumentationAndConfigFiles (408)
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\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
29string tokenText, int index, int offset, out TextSpan span) 173if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 241return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (5)
17/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 47public readonly TextSpan Span; 53public static VirtualChar Create(Rune rune, TextSpan span) 61public static VirtualChar Create(char surrogateChar, TextSpan span) 69private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 86public VirtualCharSequence GetSubSequence(TextSpan span) 165=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 178return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
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\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\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) 784public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 962var fullSpan = node.FullSpan;
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
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) 289internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 304return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 307internal static TextSpan GetElasticSpan(SyntaxToken token) 310private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 312var aggregateSpans = new List<TextSpan>(); 314var last = default(TextSpan); 315foreach (var span in spans) 323last = TextSpan.FromBounds(last.Start, span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
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\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\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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
424TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 427/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 428/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 430/// an empty <see cref="TextSpan"/> at position 0. 433TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 477bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
16public static void AddWordParts(string identifier, ref TemporaryArray<TextSpan> parts) 19public static void AddCharacterParts(string identifier, ref TemporaryArray<TextSpan> parts) 22public static void AddParts(string text, bool word, ref TemporaryArray<TextSpan> parts) 26var span = StringBreaker.GenerateSpan(text, start, word); 40public static TextSpan GenerateSpan(string identifier, int wordStart, bool word) 80private static TextSpan ScanCharacterRun(string identifier, int length, int wordStart) 101private static TextSpan ScanWordRun(string identifier, int length, int wordStart) 150private static TextSpan ScanLowerCaseRun(string identifier, int length, int wordStart) 161private static TextSpan ScanNumber(string identifier, int length, int wordStart) 169return TextSpan.FromBounds(wordStart, current);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (3)
47protected static TextSpan GetSpan(SyntaxNode node) 52return TextSpan.FromBounds(start.SpanStart, end.Span.End); 98var span = GetSpan(destination);
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\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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (1)
38public static bool IsNodeUnderselected(SyntaxNode? node, TextSpan selection)
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
32IEnumerable<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
128public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (2)
368using var parts = TemporaryArray<TextSpan>.Empty; 372var p = parts[i];
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (1)
17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
39return document.Text.ToString(TextSpan.FromBounds(tokenLine.Start, token.SpanStart));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (2)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxFactsService\ISyntaxFactsService.cs (1)
18Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameActionAnnotation.cs (2)
15TextSpan originalSpan, 28public readonly TextSpan OriginalSpan = originalSpan;
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameNodeSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameTokenSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (2)
56ImmutableArray<TextSpan> spans, 88ImmutableArray<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\ISimplificationService.cs (1)
32ImmutableArray<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractSimplifier.cs (1)
21out TextSpan issueSpan,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
56TextSpan span,
IdeBenchmarks (2)
RegexClassifierBenchmarks.cs (2)
67protected Task<ImmutableArray<ClassifiedSpan>> GetClassificationSpansAsync(string code, TextSpan span, ParseOptions parseOptions) 76protected static async Task<ImmutableArray<ClassifiedSpan>> GetSemanticClassificationsAsync(Document document, TextSpan span)
IdeCoreBenchmarks (2)
ClassificationBenchmarks.cs (2)
83protected static async Task<ImmutableArray<ClassifiedSpan>> GetSemanticClassificationsAsync(Document document, TextSpan span) 98var span = new TextSpan(0, text.Length);
Metrics (368)
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\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
29string tokenText, int index, int offset, out TextSpan span) 173if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 241return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (5)
17/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 47public readonly TextSpan Span; 53public static VirtualChar Create(Rune rune, TextSpan span) 61public static VirtualChar Create(char surrogateChar, TextSpan span) 69private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 86public VirtualCharSequence GetSubSequence(TextSpan span) 165=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 178return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
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\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\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) 784public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 962var fullSpan = node.FullSpan;
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
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) 289internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 304return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 307internal static TextSpan GetElasticSpan(SyntaxToken token) 310private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 312var aggregateSpans = new List<TextSpan>(); 314var last = default(TextSpan); 315foreach (var span in spans) 323last = TextSpan.FromBounds(last.Start, span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
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\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\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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
424TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 427/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 428/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 430/// an empty <see cref="TextSpan"/> at position 0. 433TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 477bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
16public static void AddWordParts(string identifier, ref TemporaryArray<TextSpan> parts) 19public static void AddCharacterParts(string identifier, ref TemporaryArray<TextSpan> parts) 22public static void AddParts(string text, bool word, ref TemporaryArray<TextSpan> parts) 26var span = StringBreaker.GenerateSpan(text, start, word); 40public static TextSpan GenerateSpan(string identifier, int wordStart, bool word) 80private static TextSpan ScanCharacterRun(string identifier, int length, int wordStart) 101private static TextSpan ScanWordRun(string identifier, int length, int wordStart) 150private static TextSpan ScanLowerCaseRun(string identifier, int length, int wordStart) 161private static TextSpan ScanNumber(string identifier, int length, int wordStart) 169return TextSpan.FromBounds(wordStart, current);
Metrics.Legacy (368)
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\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
29string tokenText, int index, int offset, out TextSpan span) 173if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 241return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (5)
17/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 47public readonly TextSpan Span; 53public static VirtualChar Create(Rune rune, TextSpan span) 61public static VirtualChar Create(char surrogateChar, TextSpan span) 69private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 86public VirtualCharSequence GetSubSequence(TextSpan span) 165=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 178return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
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\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\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) 784public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 962var fullSpan = node.FullSpan;
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
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) 289internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 304return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 307internal static TextSpan GetElasticSpan(SyntaxToken token) 310private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 312var aggregateSpans = new List<TextSpan>(); 314var last = default(TextSpan); 315foreach (var span in spans) 323last = TextSpan.FromBounds(last.Start, span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
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\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\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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
424TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 427/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 428/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 430/// an empty <see cref="TextSpan"/> at position 0. 433TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 477bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
16public static void AddWordParts(string identifier, ref TemporaryArray<TextSpan> parts) 19public static void AddCharacterParts(string identifier, ref TemporaryArray<TextSpan> parts) 22public static void AddParts(string text, bool word, ref TemporaryArray<TextSpan> parts) 26var span = StringBreaker.GenerateSpan(text, start, word); 40public static TextSpan GenerateSpan(string identifier, int wordStart, bool word) 80private static TextSpan ScanCharacterRun(string identifier, int length, int wordStart) 101private static TextSpan ScanWordRun(string identifier, int length, int wordStart) 150private static TextSpan ScanLowerCaseRun(string identifier, int length, int wordStart) 161private static TextSpan ScanNumber(string identifier, int length, int wordStart) 169return TextSpan.FromBounds(wordStart, current);
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.Analyzers.Test (23)
RouteEmbeddedLanguage\Infrastructure\MarkupTestFile.cs (18)
53string input, out string output, out int? position, out IDictionary<string, List<TextSpan>> spans) 56var tempSpans = new Dictionary<string, List<TextSpan>>(); 191IDictionary<string, List<TextSpan>> spans, 196var span = TextSpan.FromBounds(matchIndex, finalIndex); 197GetOrAdd(spans, name, _ => new List<TextSpan>()).Add(span); 210string input, out string output, out int? cursorPositionOpt, out ImmutableArray<TextSpan> spans) 214var builder = GetOrAdd(dictionary, string.Empty, _ => new List<TextSpan>()); 220string input, out string output, out int? cursorPositionOpt, out IDictionary<string, ImmutableArray<TextSpan>> spans) 226public static void GetSpans(string input, out string output, out IDictionary<string, ImmutableArray<TextSpan>> spans) 229public static void GetPositionAndSpans(string input, out string output, out int cursorPosition, out ImmutableArray<TextSpan> spans) 236=> GetPositionAndSpans(input, out output, out cursorPosition, out ImmutableArray<TextSpan> spans); 241public static void GetPositionAndSpan(string input, out string output, out int? cursorPosition, out TextSpan? textSpan) 243GetPositionAndSpans(input, out output, out cursorPosition, out ImmutableArray<TextSpan> spans); 247public static void GetPositionAndSpan(string input, out string output, out int cursorPosition, out TextSpan textSpan) 253public static void GetSpans(string input, out string output, out ImmutableArray<TextSpan> spans) 258public static void GetSpan(string input, out string output, out TextSpan textSpan) 260GetSpans(input, out output, out ImmutableArray<TextSpan> spans);
RouteEmbeddedLanguage\RoutePatternClassifierTests.cs (1)
28MarkupTestFile.GetSpans(code, out var rewrittenCode, out ImmutableArray<TextSpan> spans);
RouteEmbeddedLanguage\RoutePatternParserTests.cs (1)
290private static XAttribute GetTextAttribute(SourceText text, TextSpan span)
TestDiagnosticAnalyzer.cs (3)
29public async Task<ClassifiedSpan[]> GetClassificationSpansAsync(TextSpan textSpan, params string[] sources) 58var completionSpan = completionService.GetDefaultCompletionListSpan(originalText, caretPosition); 177public record CompletionResult(Document Document, CompletionService Service, CompletionList Completions, TextSpan CompletionListSpan, bool ShouldTriggerCompletion);
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.Http.RequestDelegateGenerator (1)
StaticRouteHandlerModel\Endpoint.cs (1)
162var invocationNameSpan = memberAccessorExpression.Name.Span;
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
ApiActionsDoNotRequireExplicitModelValidationCodeFixProvider.cs (2)
40private readonly TextSpan _ifBlockSpan; 42public MyCodeAction(Document document, TextSpan ifBlockSpan)
Microsoft.CodeAnalysis (279)
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; } 118public static AnalysisScope Create(ImmutableArray<DiagnosticAnalyzer> analyzers, SourceOrAdditionalFile filterFile, TextSpan? filterSpan, bool isSyntacticSingleFileAnalysis, CompilationWithAnalyzers compilationWithAnalyzers) 121public static AnalysisScope Create(ImmutableArray<DiagnosticAnalyzer> analyzers, SourceOrAdditionalFile filterFile, TextSpan? filterSpan, SourceOrAdditionalFile originalFilterFile, TextSpan? originalFilterSpan, bool isSyntacticSingleFileAnalysis, CompilationWithAnalyzers compilationWithAnalyzers) 136TextSpan? filterSpanOpt, 138TextSpan? originalFilterSpan, 158private static TextSpan? GetEffectiveFilterSpan(TextSpan? filterSpan, SourceOrAdditionalFile? filterFile) 210public AnalysisScope WithFilterSpan(TextSpan? filterSpan) 282public bool ShouldInclude(TextSpan filterSpan) 287public bool ContainsSpan(TextSpan filterSpan)
DiagnosticAnalyzer\AnalyzerDriver.cs (7)
1325var span = root.FullSpan; 2139TextSpan? filterSpan, 2165async ValueTask<IGroupedAnalyzerActions> getAllActionsAsync(AnalyzerDriver driver, ISymbol symbol, DiagnosticAnalyzer analyzer, SyntaxTree? filterTree, TextSpan? filterSpan, CancellationToken cancellationToken) 2181async ValueTask<IGroupedAnalyzerActions> getInheritedActionsAsync(AnalyzerDriver driver, ISymbol symbol, DiagnosticAnalyzer analyzer, SyntaxTree? filterTree, TextSpan? filterSpan, CancellationToken cancellationToken) 2205static async ValueTask<AnalyzerActions> getSymbolActionsCoreAsync(AnalyzerDriver driver, ISymbol symbol, DiagnosticAnalyzer analyzer, SyntaxTree? filterTree, TextSpan? filterSpan, CancellationToken cancellationToken) 2329protected bool IsGeneratedOrHiddenCodeLocation(SyntaxTree syntaxTree, TextSpan span, CancellationToken cancellationToken) 2332protected bool IsHiddenSourceLocation(SyntaxTree syntaxTree, TextSpan span)
DiagnosticAnalyzer\AnalyzerExecutor.AnalyzerDiagnosticReporter.cs (2)
29TextSpan? span, 85public TextSpan? FilterSpanForLocalDiagnostics;
DiagnosticAnalyzer\AnalyzerExecutor.cs (20)
45private readonly Func<SyntaxTree, TextSpan, CancellationToken, bool> _isGeneratedCodeLocation; 108Func<SyntaxTree, TextSpan, CancellationToken, bool> isGeneratedCodeLocation, 140Func<SyntaxTree, TextSpan, CancellationToken, bool> isGeneratedCodeLocation, 251TextSpan? filterSpan, 370TextSpan? filterSpan, 430TextSpan? filterSpan, 467TextSpan? filterSpan, 484TextSpan? filterSpan, 532TextSpan? filterSpan, 582TextSpan? filterSpan, 634TextSpan? filterSpan, 719TextSpan? filterSpan, 725public readonly TextSpan? FilterSpan = filterSpan; 742TextSpan? filterSpan, 845TextSpan? filterSpan, 1001TextSpan spanForContainingTopmostNodeForAnalysis, 1003TextSpan? filterSpan, 1101TextSpan spanForContainingOperationBlock, 1103TextSpan? filterSpan, 1497private AnalyzerDiagnosticReporter GetAddSemanticDiagnostic(SyntaxTree tree, TextSpan? span, DiagnosticAnalyzer analyzer, CancellationToken cancellationToken)
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)
411public async Task<ImmutableArray<Diagnostic>> GetAnalyzerSyntaxDiagnosticsAsync(SyntaxTree tree, TextSpan? filterSpan, CancellationToken cancellationToken) 445public async Task<ImmutableArray<Diagnostic>> GetAnalyzerSyntaxDiagnosticsAsync(SyntaxTree tree, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 474public Task<AnalysisResult> GetAnalysisResultAsync(SyntaxTree tree, TextSpan? filterSpan, CancellationToken cancellationToken) 505public Task<AnalysisResult> GetAnalysisResultAsync(SyntaxTree tree, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 552public async Task<AnalysisResult> GetAnalysisResultAsync(AdditionalText file, TextSpan? filterSpan, CancellationToken cancellationToken) 569public async Task<AnalysisResult> GetAnalysisResultAsync(AdditionalText file, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 577private async Task<AnalysisResult> GetAnalysisResultCoreAsync(SourceOrAdditionalFile file, ImmutableArray<DiagnosticAnalyzer> analyzers, TextSpan? filterSpan, CancellationToken cancellationToken) 584private async Task<ImmutableArray<Diagnostic>> GetAnalyzerSyntaxDiagnosticsCoreAsync(SyntaxTree tree, ImmutableArray<DiagnosticAnalyzer> analyzers, TextSpan? filterSpan, CancellationToken cancellationToken) 598public async Task<ImmutableArray<Diagnostic>> GetAnalyzerSemanticDiagnosticsAsync(SemanticModel model, TextSpan? filterSpan, CancellationToken cancellationToken) 613public async Task<ImmutableArray<Diagnostic>> GetAnalyzerSemanticDiagnosticsAsync(SemanticModel model, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 628public Task<AnalysisResult> GetAnalysisResultAsync(SemanticModel model, TextSpan? filterSpan, CancellationToken cancellationToken) 643public Task<AnalysisResult> GetAnalysisResultAsync(SemanticModel model, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 651private async Task<AnalysisResult> GetAnalysisResultCoreAsync(SemanticModel model, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 658private async Task<ImmutableArray<Diagnostic>> GetAnalyzerSemanticDiagnosticsCoreAsync(SemanticModel model, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 877TextSpan? originalSpan,
DiagnosticAnalyzer\DiagnosticAnalysisContext.cs (23)
714public TextSpan? FilterSpan { get; } 732TextSpan? filterSpan, 800public TextSpan? FilterSpan { get; } 828TextSpan? filterSpan, 896public TextSpan? FilterSpan { get; } 909internal SymbolStartAnalysisContext(ISymbol symbol, Compilation compilation, AnalyzerOptions options, bool isGeneratedCode, SyntaxTree? filterTree, TextSpan? filterSpan, CancellationToken cancellationToken) 1056public TextSpan? FilterSpan { get; } 1079TextSpan? filterSpan, 1166public TextSpan? FilterSpan { get; } 1191TextSpan? filterSpan, 1276public TextSpan? FilterSpan { get; } 1307TextSpan? filterSpan, 1418public TextSpan? FilterSpan { get; } 1453TextSpan? filterSpan, 1531public TextSpan? FilterSpan { get; } 1557TextSpan? filterSpan, 1609public TextSpan? FilterSpan { get; } 1627TextSpan? filterSpan, 1642/// which can be created using <see cref="Location.Create(string, TextSpan, LinePositionSpan)"/> API. 1703public TextSpan? FilterSpan { get; } 1734TextSpan? filterSpan, 1809public TextSpan? FilterSpan { get; } 1842TextSpan? filterSpan,
DiagnosticAnalyzer\DiagnosticStartAnalysisScope.cs (3)
234TextSpan? filterSpan, 297TextSpan? filterSpan, 333TextSpan? filterSpan,
Symbols\ISymbolInternal.cs (1)
174bool 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 (12)
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"/>. 885public IEnumerable<SyntaxNode> DescendantNodes(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 906public IEnumerable<SyntaxNode> DescendantNodesAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 927public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 948public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 963public SyntaxNode FindNode(TextSpan span, bool findInsideTrivia = false, bool getInnermostNodeForTie = false) 972!.FirstAncestorOrSelf<SyntaxNode, TextSpan>((a, span) => a.FullSpan.Contains(span), span); 1053public IEnumerable<SyntaxToken> DescendantTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 1190public IEnumerable<SyntaxTrivia> DescendantTrivia(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 1534var span = token.Span;
Syntax\SyntaxNode.Iterators.cs (14)
17private IEnumerable<SyntaxNode> DescendantNodesImpl(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool descendIntoTrivia, bool includeSelf) 24private IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensImpl(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool descendIntoTrivia, bool includeSelf) 31private IEnumerable<SyntaxTrivia> DescendantTriviaImpl(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 38private static bool IsInSpan(in TextSpan span, TextSpan childSpan) 69public bool TryGetNextInSpan(in TextSpan span, out SyntaxNodeOrToken value) 84public SyntaxNode? TryGetNextAsNodeInSpan(in TextSpan span) 222public bool TryGetNextInSpan(in TextSpan span, out SyntaxNodeOrToken value) 317public bool TryGetNextInSpan(in TextSpan span, out SyntaxNodeOrToken value) 390private IEnumerable<SyntaxNode> DescendantNodesOnly(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool includeSelf) 415private IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensOnly(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool includeSelf) 444private IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensIntoTrivia(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool includeSelf) 532private IEnumerable<SyntaxTrivia> DescendantTriviaOnly(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren) 570private IEnumerable<SyntaxTrivia> DescendantTriviaIntoTrivia(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren)
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)
91public TextSpan Span 97: default(TextSpan); 102/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 121public TextSpan FullSpan 123get { 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)
182public override void Write(TextWriter writer, TextSpan span, CancellationToken cancellationToken = default(CancellationToken))
Text\SourceText.cs (8)
486internal void CheckSubSpan(TextSpan span) 499public virtual SourceText GetSubText(TextSpan span) 549public virtual void Write(TextWriter writer, TextSpan span, CancellationToken cancellationToken = default(CancellationToken)) 717public virtual string ToString(TextSpan span) 859public SourceText Replace(TextSpan span, string newText) 914var span = new TextSpan(newPos, range.NewLength); 988return TextLine.FromSpanUnsafe(_text, TextSpan.FromBounds(start, _text.Length)); 993return TextLine.FromSpanUnsafe(_text, TextSpan.FromBounds(start, end));
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)
34public static TextLine FromSpan(SourceText text, TextSpan span) 88internal static TextLine FromSpanUnsafe(SourceText text, TextSpan span) 158public TextSpan Span 160get { return TextSpan.FromBounds(this.Start, this.End); } 166public TextSpan SpanIncludingLineBreak 168get { 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 (423)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer.cs (2)
682var span = fixLocation.SourceSpan; 692[NotNullWhen(returnValue: true)] out TextSpan? fileSpan)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_ResourceStringsFormat.cs (1)
99var span = new TextSpan(indexOfValue, valueLength);
MetaAnalyzers\Fixers\CompareSymbolsCorrectlyFix.cs (2)
64private async Task<Document> ConvertToEqualsAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken) 79private async Task<Document> CallOverloadWithEqualityComparerAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken)
MetaAnalyzers\Fixers\ConfigureGeneratedCodeAnalysisFix.cs (1)
42private async Task<Document> ConfigureGeneratedCodeAnalysisAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken)
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.cs (2)
89public FixInfo(string fixValue, TextDocument additionalDocumentToFix, TextSpan additionalDocumentSpanToFix) 99public 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)
41private 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\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\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\RoslynAnalyzers\Microsoft.CodeAnalysis.BannedApiAnalyzers\Core\SymbolIsBannedAnalyzerBase.cs (2)
407public TextSpan Span { get; } 416public BanFileEntry(Compilation compilation, string text, TextSpan span, SourceText sourceText, string path)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
29string tokenText, int index, int offset, out TextSpan span) 173if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 241return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (5)
17/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 47public readonly TextSpan Span; 53public static VirtualChar Create(Rune rune, TextSpan span) 61public static VirtualChar Create(char surrogateChar, TextSpan span) 69private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 86public VirtualCharSequence GetSubSequence(TextSpan span) 165=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 178return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
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\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\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) 784public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 962var fullSpan = node.FullSpan;
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
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) 289internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 304return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 307internal static TextSpan GetElasticSpan(SyntaxToken token) 310private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 312var aggregateSpans = new List<TextSpan>(); 314var last = default(TextSpan); 315foreach (var span in spans) 323last = TextSpan.FromBounds(last.Start, span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
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\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\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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
424TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 427/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 428/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 430/// an empty <see cref="TextSpan"/> at position 0. 433TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 477bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
16public static void AddWordParts(string identifier, ref TemporaryArray<TextSpan> parts) 19public static void AddCharacterParts(string identifier, ref TemporaryArray<TextSpan> parts) 22public static void AddParts(string text, bool word, ref TemporaryArray<TextSpan> parts) 26var span = StringBreaker.GenerateSpan(text, start, word); 40public static TextSpan GenerateSpan(string identifier, int wordStart, bool word) 80private static TextSpan ScanCharacterRun(string identifier, int length, int wordStart) 101private static TextSpan ScanWordRun(string identifier, int length, int wordStart) 150private static TextSpan ScanLowerCaseRun(string identifier, int length, int wordStart) 161private static TextSpan ScanNumber(string identifier, int length, int wordStart) 169return TextSpan.FromBounds(wordStart, current);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (3)
47protected static TextSpan GetSpan(SyntaxNode node) 52return TextSpan.FromBounds(start.SpanStart, end.Span.End); 98var span = GetSpan(destination);
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\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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (1)
38public static bool IsNodeUnderselected(SyntaxNode? node, TextSpan selection)
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
32IEnumerable<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
128public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (2)
368using var parts = TemporaryArray<TextSpan>.Empty; 372var p = parts[i];
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (1)
17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
39return document.Text.ToString(TextSpan.FromBounds(tokenLine.Start, token.SpanStart));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (2)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxFactsService\ISyntaxFactsService.cs (1)
18Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameActionAnnotation.cs (2)
15TextSpan originalSpan, 28public readonly TextSpan OriginalSpan = originalSpan;
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameNodeSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameTokenSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (2)
56ImmutableArray<TextSpan> spans, 88ImmutableArray<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\ISimplificationService.cs (1)
32ImmutableArray<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractSimplifier.cs (1)
21out TextSpan issueSpan,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
56TextSpan span,
Microsoft.CodeAnalysis.AnalyzerUtilities (368)
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\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
29string tokenText, int index, int offset, out TextSpan span) 173if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 241return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (5)
17/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 47public readonly TextSpan Span; 53public static VirtualChar Create(Rune rune, TextSpan span) 61public static VirtualChar Create(char surrogateChar, TextSpan span) 69private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 86public VirtualCharSequence GetSubSequence(TextSpan span) 165=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 178return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
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\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\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) 784public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 962var fullSpan = node.FullSpan;
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
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) 289internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 304return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 307internal static TextSpan GetElasticSpan(SyntaxToken token) 310private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 312var aggregateSpans = new List<TextSpan>(); 314var last = default(TextSpan); 315foreach (var span in spans) 323last = TextSpan.FromBounds(last.Start, span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
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\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\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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
424TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 427/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 428/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 430/// an empty <see cref="TextSpan"/> at position 0. 433TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 477bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
16public static void AddWordParts(string identifier, ref TemporaryArray<TextSpan> parts) 19public static void AddCharacterParts(string identifier, ref TemporaryArray<TextSpan> parts) 22public static void AddParts(string text, bool word, ref TemporaryArray<TextSpan> parts) 26var span = StringBreaker.GenerateSpan(text, start, word); 40public static TextSpan GenerateSpan(string identifier, int wordStart, bool word) 80private static TextSpan ScanCharacterRun(string identifier, int length, int wordStart) 101private static TextSpan ScanWordRun(string identifier, int length, int wordStart) 150private static TextSpan ScanLowerCaseRun(string identifier, int length, int wordStart) 161private static TextSpan ScanNumber(string identifier, int length, int wordStart) 169return TextSpan.FromBounds(wordStart, current);
Microsoft.CodeAnalysis.BannedApiAnalyzers (405)
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\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
29string tokenText, int index, int offset, out TextSpan span) 173if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 241return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (5)
17/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 47public readonly TextSpan Span; 53public static VirtualChar Create(Rune rune, TextSpan span) 61public static VirtualChar Create(char surrogateChar, TextSpan span) 69private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 86public VirtualCharSequence GetSubSequence(TextSpan span) 165=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 178return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
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\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\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) 784public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 962var fullSpan = node.FullSpan;
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
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) 289internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 304return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 307internal static TextSpan GetElasticSpan(SyntaxToken token) 310private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 312var aggregateSpans = new List<TextSpan>(); 314var last = default(TextSpan); 315foreach (var span in spans) 323last = TextSpan.FromBounds(last.Start, span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
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\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\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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
424TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 427/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 428/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 430/// an empty <see cref="TextSpan"/> at position 0. 433TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 477bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
16public static void AddWordParts(string identifier, ref TemporaryArray<TextSpan> parts) 19public static void AddCharacterParts(string identifier, ref TemporaryArray<TextSpan> parts) 22public static void AddParts(string text, bool word, ref TemporaryArray<TextSpan> parts) 26var span = StringBreaker.GenerateSpan(text, start, word); 40public static TextSpan GenerateSpan(string identifier, int wordStart, bool word) 80private static TextSpan ScanCharacterRun(string identifier, int length, int wordStart) 101private static TextSpan ScanWordRun(string identifier, int length, int wordStart) 150private static TextSpan ScanLowerCaseRun(string identifier, int length, int wordStart) 161private static TextSpan ScanNumber(string identifier, int length, int wordStart) 169return TextSpan.FromBounds(wordStart, current);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (3)
47protected static TextSpan GetSpan(SyntaxNode node) 52return TextSpan.FromBounds(start.SpanStart, end.Span.End); 98var span = GetSpan(destination);
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\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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (1)
38public static bool IsNodeUnderselected(SyntaxNode? node, TextSpan selection)
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
32IEnumerable<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
128public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (2)
368using var parts = TemporaryArray<TextSpan>.Empty; 372var p = parts[i];
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (1)
17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
39return document.Text.ToString(TextSpan.FromBounds(tokenLine.Start, token.SpanStart));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (2)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxFactsService\ISyntaxFactsService.cs (1)
18Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameActionAnnotation.cs (2)
15TextSpan originalSpan, 28public readonly TextSpan OriginalSpan = originalSpan;
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameNodeSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameTokenSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (2)
56ImmutableArray<TextSpan> spans, 88ImmutableArray<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\ISimplificationService.cs (1)
32ImmutableArray<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractSimplifier.cs (1)
21out TextSpan issueSpan,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
56TextSpan span,
SymbolIsBannedAnalyzerBase.cs (2)
407public TextSpan Span { get; } 416public BanFileEntry(Compilation compilation, string text, TextSpan span, SourceText sourceText, string path)
Microsoft.CodeAnalysis.CodeStyle (401)
src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (1)
51var span = context.FilterSpan.HasValue ? context.FilterSpan.GetValueOrDefault() : root.FullSpan;
src\Analyzers\Core\Analyzers\OrderModifiers\AbstractOrderModifiersDiagnosticAnalyzer.cs (1)
82context.Tree.GetLocation(TextSpan.FromBounds(modifiers.First().SpanStart, modifiers.Last().Span.End)),
src\Analyzers\Core\Analyzers\RemoveUnnecessaryCast\AbstractRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
31protected abstract TextSpan GetFadeSpan(TCastExpression node);
src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (10)
141private IEnumerable<TextSpan> GetContiguousSpans(ImmutableArray<SyntaxNode> nodes) 144(SyntaxNode node, TextSpan textSpan)? previous = null; 149TextSpan textSpan; 153textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 161textSpan = TextSpan.FromBounds(previous.Value.textSpan.Start, nodeEnd); 167textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 194IEnumerable<TextSpan> contiguousSpans, SyntaxTree tree, 197foreach (var span in contiguousSpans) 208protected abstract IEnumerable<TextSpan> GetFixableDiagnosticSpans( 216foreach (var span in spans)
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
135return Location.Create(parenthesizedExpression.SyntaxTree, TextSpan.FromBounds(parenthesizedExpressionLocation.SourceSpan.Start, textSpanEndPosition));
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (3)
86TextSpan? span, 227TextSpan? span, 735TextSpan? span,
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (5)
45using var _ = ArrayBuilder<TextSpan>.GetInstance(out var unnecessarySpans); 89ArrayBuilder<TextSpan> unnecessarySpans) 195private static TextSpan GetSpanWithinLiteralQuotes(IVirtualCharService virtualCharService, SyntaxToken formatToken) 200: TextSpan.FromBounds(sequence.First().Span.Start, sequence.Last().Span.End); 208ArrayBuilder<TextSpan> unnecessarySpans)
src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (5)
81out TextSpan issueSpan, out string diagnosticId, out bool inDeclaration, 118out var issueSpan, out var diagnosticId, out var inDeclaration, 135internal static Diagnostic CreateDiagnostic(SemanticModel model, TSimplifierOptions options, AnalyzerOptions analyzerOptions, TextSpan issueSpan, string diagnosticId, bool inDeclaration) 206/// indicate that <c>intervalTree</c> may be updated by adding a new non-overlapping <see cref="TextSpan"/> 249static bool TryProceedWithInterval(bool addIfAvailable, TextSpan span, StrongBox<bool> completed, TextSpanMutableIntervalTree intervalTree)
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\Analyzers\Core\Analyzers\UseObjectInitializer\AbstractUseObjectInitializerDiagnosticAnalyzer.cs (2)
152var location1 = Location.Create(syntaxTree, TextSpan.FromBounds( 158locations.Add(syntaxTree.GetLocation(TextSpan.FromBounds(match.Initializer.FullSpan.End, match.Statement.Span.End)));
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\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
29string tokenText, int index, int offset, out TextSpan span) 173if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 241return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (5)
17/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 47public readonly TextSpan Span; 53public static VirtualChar Create(Rune rune, TextSpan span) 61public static VirtualChar Create(char surrogateChar, TextSpan span) 69private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 86public VirtualCharSequence GetSubSequence(TextSpan span) 165=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 178return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
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\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\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) 784public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 962var fullSpan = node.FullSpan;
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
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) 289internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 304return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 307internal static TextSpan GetElasticSpan(SyntaxToken token) 310private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 312var aggregateSpans = new List<TextSpan>(); 314var last = default(TextSpan); 315foreach (var span in spans) 323last = TextSpan.FromBounds(last.Start, span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
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\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\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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
424TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 427/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 428/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 430/// an empty <see cref="TextSpan"/> at position 0. 433TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 477bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
16public static void AddWordParts(string identifier, ref TemporaryArray<TextSpan> parts) 19public static void AddCharacterParts(string identifier, ref TemporaryArray<TextSpan> parts) 22public static void AddParts(string text, bool word, ref TemporaryArray<TextSpan> parts) 26var span = StringBreaker.GenerateSpan(text, start, word); 40public static TextSpan GenerateSpan(string identifier, int wordStart, bool word) 80private static TextSpan ScanCharacterRun(string identifier, int length, int wordStart) 101private static TextSpan ScanWordRun(string identifier, int length, int wordStart) 150private static TextSpan ScanLowerCaseRun(string identifier, int length, int wordStart) 161private static TextSpan ScanNumber(string identifier, int length, int wordStart) 169return TextSpan.FromBounds(wordStart, current);
Microsoft.CodeAnalysis.CodeStyle.Fixes (58)
src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
55var span = diagnostic.Location.SourceSpan;
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\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (1)
38SyntaxNode root, TextSpan span, [NotNullWhen(true)] out SyntaxNode? node)
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
48private static TXmlElementSyntax? GetParamNode(SyntaxNode root, TextSpan span)
src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (3)
76var diagnosticSpan = diagnostic.Location.SourceSpan; 78var spanToFormat = TextSpan.FromBounds(
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.cs (2)
22SemanticDocument document, TextSpan textSpan, CancellationToken cancellationToken, 27TextSpan textSpan,
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (2)
30TextSpan textSpan, 46TextSpan textSpan,
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\IGenerateDefaultConstructorsService.cs (1)
17Document document, TextSpan textSpan, bool forRefactoring, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (1)
61TextSpan span, Diagnostic diagnostic)
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (1)
33var span = context.Span;
src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (1)
35SyntaxNode root, TextSpan span, [NotNullWhen(true)] out SyntaxNode? node)
src\Analyzers\Core\CodeFixes\MakeFieldReadonly\AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
47var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
55var span = context.Span;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (3)
47protected static TextSpan GetSpan(SyntaxNode node) 52return TextSpan.FromBounds(start.SpanStart, end.Span.End); 98var span = GetSpan(destination);
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\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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (1)
38public static bool IsNodeUnderselected(SyntaxNode? node, TextSpan selection)
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
32IEnumerable<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
128public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
368using var parts = TemporaryArray<TextSpan>.Empty;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (1)
17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
39return document.Text.ToString(TextSpan.FromBounds(tokenLine.Start, token.SpanStart));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (2)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxFactsService\ISyntaxFactsService.cs (1)
18Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameActionAnnotation.cs (2)
15TextSpan originalSpan, 28public readonly TextSpan OriginalSpan = originalSpan;
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameNodeSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameTokenSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (2)
56ImmutableArray<TextSpan> spans, 88ImmutableArray<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\ISimplificationService.cs (1)
32ImmutableArray<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractSimplifier.cs (1)
21out TextSpan issueSpan,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
56TextSpan span,
Microsoft.CodeAnalysis.CSharp (184)
Binder\Binder_Expressions.cs (2)
5361var errorSpan = new TextSpan(start, end - start); 9525location = expr.Syntax.SyntaxTree.GetLocation(TextSpan.FromBounds(expr.Syntax.SpanStart, conditional.OperatorToken.Span.End));
Binder\Binder_Statements.cs (2)
3421Text.TextSpan.FromBounds(lambdaSyntax.SpanStart, lambdaSyntax.ArrowToken.Span.End)); 3425Text.TextSpan.FromBounds(anonymousMethodSyntax.SpanStart,
Binder\Binder_Symbols.cs (1)
464diagnostics.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) 1065TextSpan containingSpan = containingNode.Span;
BoundTree\BoundSequencePoint.cs (1)
11public static BoundStatement Create(SyntaxNode? syntax, TextSpan? part, BoundStatement statement, bool hasErrors = false)
CodeGen\CodeGenerator.cs (8)
65private PooledDictionary<object, TextSpan> _savedSequencePoints; 398TextSpan span = node.Span; 399if (span != default(TextSpan) && _emitPdbSequencePoints) 411if (instructionsEmitted == 0 && span != default(TextSpan) && _ilEmitStyle == ILEmitStyle.Debug) 435_savedSequencePoints ??= PooledDictionary<object, TextSpan>.GetInstance(); 455private void EmitStepThroughSequencePoint(SyntaxNode syntaxNode, TextSpan span) 496private TextSpan EmitSequencePoint(SyntaxTree syntaxTree, TextSpan span)
CodeGen\EmitStatement.cs (2)
1067TextSpan spSpan; 1076spSpan = TextSpan.FromBounds(syntax.SpanStart, syntax.Declaration.Span.End);
CommandLine\CSharpCompiler.cs (1)
216tree.GetMappedLineSpanAndVisibility(default(TextSpan), out isHiddenDummy);
Compilation\CSharpCompilation.cs (14)
254internal bool IsNullableAnalysisEnabledIn(CSharpSyntaxTree tree, TextSpan span) 268/// from <see cref="IsNullableAnalysisEnabledIn(CSharpSyntaxTree, TextSpan)"/>. 2687TextSpan infoSpan = info.Span; 2814public readonly TextSpan Span; 2816public ImportInfo(SyntaxTree tree, SyntaxKind kind, TextSpan span) 3001var location = syntaxTree.GetLocation(TextSpan.FromBounds(0, 0)); 3095private static bool IsDefinedOrImplementedInSourceTree(Symbol symbol, SyntaxTree tree, TextSpan? span) 3111private ImmutableArray<Diagnostic> GetDiagnosticsForMethodBodiesInTree(SyntaxTree tree, TextSpan? span, CancellationToken cancellationToken) 3192void compileMethodBodiesAndDocComments(SyntaxTree? filterTree, TextSpan? filterSpan, BindingDiagnosticBag bindingDiagnostics, CancellationToken cancellationToken) 3243private 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) 3292private ReadOnlyBindingDiagnostic<AssemblySymbol> GetClsComplianceDiagnostics(SyntaxTree? syntaxTree, TextSpan? filterSpanWithinTree, CancellationToken cancellationToken) 3315private static IEnumerable<Diagnostic> FilterDiagnosticsByLocation(IEnumerable<Diagnostic> diagnostics, SyntaxTree tree, TextSpan? filterSpanWithinTree) 3329TextSpan? filterSpanWithinTree,
Compilation\CSharpSemanticModel.cs (2)
1317var fullSpan = this.Root.FullSpan; 5252internal 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)) 1835TextSpan resultSpan = default(TextSpan); 1841var 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 (10)
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)) 849var span = node.Span; 1006private MemberSemanticModel GetOrAddModelForParameter(ParameterSyntax paramDecl, TextSpan span) 1047private MemberSemanticModel GetOrAddModelIfContains(CSharpSyntaxNode node, TextSpan span) 1750private NamespaceSymbol GetDeclaredNamespace(NamespaceOrTypeSymbol container, TextSpan declarationSpan, NameSyntax name) 1781private 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)
38private readonly TextSpan? _filterSpanWithinTree; //if filterTree and filterSpanWithinTree is not null, limit analysis to types residing within this span in the filterTree. 56TextSpan? filterSpanWithinTree, 86public 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)
583/// <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)
3160public BoundSequencePointWithSpan(SyntaxNode syntax, BoundStatement? statementOpt, TextSpan span, bool hasErrors = false) 3168public TextSpan Span { get; } 3173public BoundSequencePointWithSpan Update(BoundStatement? statementOpt, TextSpan span) 3261public BoundStepThroughSequencePoint(SyntaxNode syntax, TextSpan span, bool hasErrors) 3267public BoundStepThroughSequencePoint(SyntaxNode syntax, TextSpan span) 3273public TextSpan Span { get; } 3278public BoundStepThroughSequencePoint Update(TextSpan span)
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (4)
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;
Lowering\Instrumentation\DebugInfoInjector.cs (17)
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( 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)
1215public 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)
735info.Text = TextWindow.Text.ToString(TextSpan.FromBounds(startingPosition, end)); 2010var text = TextWindow.Text.GetSubText(TextSpan.FromBounds(savePosition, TextWindow.Position));
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
25TextSpan span,
Symbols\Source\GlobalExpressionVariable.cs (3)
35TextSpan locationSpan) 48TextSpan locationSpan, 174TextSpan locationSpan,
Symbols\Source\SourceConstructorSymbolBase.cs (1)
180TextSpan 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)
1019public override bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken)
Symbols\Source\SourceMemberFieldSymbol.cs (2)
30TextSpan locationSpan) 644public 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) 459public override bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken = default(CancellationToken))
Symbols\Source\SourceOrdinaryMethodSymbol.cs (1)
453TextSpan? definedWithinSpan,
Symbols\Symbol.cs (4)
439public virtual bool HasLocationContainedWithin(SyntaxTree tree, TextSpan declarationSpan, out bool wasZeroWidthMatch) 451protected static bool IsLocationContainedWithin(Location loc, SyntaxTree tree, TextSpan declarationSpan, out bool wasZeroWidthMatch) 933public virtual bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken = default(CancellationToken)) 954protected 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)
254public override bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken) 264var 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) 334private readonly TextSpan _elementSpan; 341TextSpan elementSpan, 360private bool ShouldVisit(TextSpan span)
Microsoft.CodeAnalysis.CSharp.Analyzers (1)
MetaAnalyzers\Fixers\CSharpPreferIsKindFix.cs (1)
22protected override SyntaxNode? TryGetNodeToFix(SyntaxNode root, TextSpan span)
Microsoft.CodeAnalysis.CSharp.CodeStyle (98)
src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (2)
132var ifStatementSpanWithoutElse = TextSpan.FromBounds(statement.Span.Start, embeddedStatement.Span.End);
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
54: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.SemicolonToken.Span.End));
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
57: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.Name.Span.End));
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_ProgramMain.cs (1)
71TextSpan.FromBounds(start, root.Members.OfType<GlobalStatementSyntax>().Last().FullSpan.End));
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\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\Analyzers\CSharp\Analyzers\RemoveUnnecessaryImports\CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (1)
50protected override IEnumerable<TextSpan> GetFixableDiagnosticSpans(
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (4)
230var startReportSpan = TextSpan.FromBounds(anonymousFunction.SpanStart, invokedExpression.SpanStart); 231var endReportSpan = TextSpan.FromBounds(invokedExpression.Span.End, anonymousFunction.Span.End);
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (8)
82private static ImmutableArray<TextSpan> AnalyzeCodeBlock(CodeBlockAnalysisContext context, int positionOfFirstReducingNullableDirective) 97foreach (var interval in simplifier.Spans) 217public bool TryProceedWithInterval(TextSpan span) 221public bool TryReportNullableImpactingSpans(TextSpan span, ImmutableArray<TextSpan> nullableImpactingSpans) 225private bool TryProceedOrReportNullableImpactingSpans(TextSpan span, ImmutableArray<TextSpan>? nullableImpactingSpans) 240foreach (var nullableImpactingSpan in spans)
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\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (3)
80SemanticModelAnalysisContext context, SyntaxNode root, TextSpan sourceSpan) 133var span = TextSpan.FromBounds(section[0].FullSpan.Start, section.Last().FullSpan.End);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
218syntaxTree.GetLocation(TextSpan.FromBounds(
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (1)
60syntaxTree.GetLocation(TextSpan.FromBounds(
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (1)
102syntaxTree.GetLocation(TextSpan.FromBounds(
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (2)
70syntaxTree.GetLocation(TextSpan.FromBounds( 110syntaxTree.GetLocation(TextSpan.FromBounds(
src\Analyzers\CSharp\Analyzers\UseDefaultLiteral\CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (2)
46var fadeSpan = TextSpan.FromBounds(defaultExpression.OpenParenToken.SpanStart, defaultExpression.CloseParenToken.Span.End);
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (1)
105TextSpan.FromBounds(declaration.SpanStart, declaration.ArrowToken.Span.End));
src\Analyzers\CSharp\Analyzers\UseImplicitOrExplicitType\CSharpTypeStyleDiagnosticAnalyzerBase.cs (1)
58private static Diagnostic CreateDiagnostic(DiagnosticDescriptor descriptor, SyntaxNode declaration, TextSpan diagnosticSpan, NotificationOption2 notificationOption, AnalyzerOptions analyzerOptions)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
321TextSpan.FromBounds(arguments.First().SpanStart, arguments.Last().Span.End));
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\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
354var scopeSpan = scope.Span;
src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (1)
81TextSpan.FromBounds(typeArgumentList.LessThanToken.Span.End, typeArgumentList.GreaterThanToken.Span.Start))]));
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (2)
123var span = TextSpan.FromBounds(elements[0].Syntax.SpanStart, elements[^1].Syntax.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (10)
206var lineSpan = currentLine.Span; 253using var _ = ArrayBuilder<(char ch, TextSpan span)>.GetInstance(out var charResults); 286string tokenText, int offset, int startIndexInclusive, int endIndexExclusive, ArrayBuilder<(char ch, TextSpan span)> charResults) 305private static void ConvertCharactersToRunes(ArrayBuilder<(char ch, TextSpan span)> charResults, ImmutableSegmentedList<VirtualChar>.Builder runeResults) 325runeResults.Add(VirtualChar.Create(rune, TextSpan.FromBounds(span.Start, nextSpan.End))); 339ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 352ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 386ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 405ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index, char character) 518result.Add((character, TextSpan.FromBounds(startIndex + offset, endIndex + offset)));
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (1)
238var name = SyntaxFactory.ParseName(syntaxTree.GetText(cancellationToken).ToString(TextSpan.FromBounds(genericIdentifier.SpanStart, lastToken.Span.End)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (4)
201var fullSpan = trivia.FullSpan; 230var span = trivia.FullSpan; 411var span = token.Span; 457var span = token.Span;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (1)
156var span = trivia.FullSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\FormattingResult.cs (1)
19internal FormattingResult(TreeData treeInfo, TokenStream tokenStream, TextSpan spanToFormat)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs (1)
57public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (1)
102public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (3)
21TextSpan textSpan, 53list.Add(FormattingOperations.CreateIndentBlockOperation(startToken, endToken, TextSpan.FromBounds(startPosition, endPosition), indentationDelta: -1, option: option)); 89TextSpan textSpan,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (5)
120TextSpan.FromBounds(lastTokenOfLabel.FullSpan.End, nextToken.SpanStart) : TextSpan.FromBounds(lastTokenOfLabel.FullSpan.End, lastTokenOfLabel.FullSpan.End)); 128var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 129span = lastSection ? span : TextSpan.FromBounds(span.Start, endToken.FullSpan.End); 369AddIndentBlockOperation(list, firstToken, lastToken, TextSpan.FromBounds(firstToken.FullSpan.Start, lastToken.FullSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (2)
335var textSpan = TextSpan.FromBounds(startToken.Span.End, endToken.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (2)
184var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (5)
917public TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node) 928return TextSpan.FromBounds(method.Body.OpenBraceToken.Span.End, method.Body.CloseBraceToken.SpanStart); 1032public TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) 1061return !branch.IsActive || !branch.BranchTaken ? TextSpan.FromBounds(branch.FullSpan.Start, position) : default; 1311public bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (35)
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (1)
48private static (SyntaxNode container, SyntaxNode exprOrStatement) GetContainer(SyntaxNode root, TextSpan span)
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
37var diagnosticSpan = diagnostic.Location.SourceSpan;
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\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
53using var _ = ArrayBuilder<TextSpan>.GetInstance(diagnostics.Length, out var spans);
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\CSharpConvertToRecordCodeFixProvider.cs (1)
32var span = context.Span;
src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
60var span = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (1)
26SemanticDocument semanticDocument, TextSpan textSpan, CancellationToken cancellationToken,
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (1)
42var span = context.Span;
src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (1)
33var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
211SyntaxNode root, TextSpan span, [NotNullWhen(true)] out SyntaxNode? node)
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
130var referenceSpan = location.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
34var span = context.Span;
src\Analyzers\CSharp\CodeFixes\MakeRefStruct\MakeRefStructCodeFixProvider.cs (1)
39var span = context.Span;
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
92edits.Add(new TextChange(TextSpan.FromBounds(start, end), ""));
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
94edits.Add(new TextChange(TextSpan.FromBounds(start, end), ""));
src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (1)
38var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\RemoveNewModifier\RemoveNewModifierCodeFixProvider.cs (1)
36var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
65Document document, TextSpan span, SyntaxNode newExpression, CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
842var lineBreakSpan = TextSpan.FromBounds(lineToConsider.End, lineToConsider.EndIncludingLineBreak);
src\Analyzers\CSharp\CodeFixes\UseExplicitTypeForConst\UseExplicitTypeForConstCodeFixProvider.cs (1)
62Document document, TextSpan span, ITypeSymbol type, CancellationToken cancellationToken)
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (1)
116public Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (1)
CommandLineTests.cs (1)
15233var diagnosticSpan = new TextSpan(2, 2);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (85)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (3)
110private static TextSpan? GetFormattedTextSpan(SyntaxNode root, SyntaxToken endToken) 129return CommonFormattingHelpers.GetFormattingSpan(root, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)); 209var endingString = text.ToString(TextSpan.FromBounds(lastToken.Span.End, line.End));
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (1)
742return TextSpan.FromBounds(openBrace.SpanStart, closeBrace.Span.End).Contains(caretPosition);
BlockCommentEditing\BlockCommentEditingCommandHandler.cs (1)
290var span = trivia.FullSpan;
CommentSelection\CSharpToggleBlockCommentCommandHandler.cs (2)
41protected override ImmutableArray<TextSpan> GetBlockCommentsInDocument(Document document, ITextSnapshot snapshot, 42TextSpan linesContainingSelections, CommentSelectionInfo commentInfo, CancellationToken cancellationToken)
ConvertNamespace\ConvertNamespaceCommandHandler.cs (1)
98private (SourceText? convertedText, TextSpan semicolonSpan) ConvertNamespace(
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (2)
177var renameSpan = solutionAndRenameSpan.Value.renameSpan; 189private static async Task<(Solution solution, TextSpan renameSpan)?> TryGetNewSolutionWithAddedMethodAsync(
Formatting\CSharpFormattingInteractionService.cs (3)
79TextSpan? textSpan, 86var formattingSpan = CommonFormattingHelpers.GetFormattingSpan(parsedDocument.Root, span); 91public Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken)
InlineRename\CSharpEditorInlineRenameService.cs (4)
40using var _1 = PooledHashSet<TextSpan>.GetInstance(out var seen); 56var textSpan = inlineRenameInfo.TriggerSpan; 109void AddSpanOfInterest(SourceText documentText, string filePath, TextSpan fallbackSpan, TextSpan? surroundingSpanOfInterest, ArrayBuilder<(string filePath, string content)> resultBuilder)
Interactive\CSharpSendToInteractiveSubmissionProvider.cs (5)
36protected override IEnumerable<TextSpan> GetExecutableSyntaxTreeNodeSelection(TextSpan selectionSpan, SyntaxNode root) 41: Array.Empty<TextSpan>(); 49private static SyntaxNode? GetSyntaxNodeForSubmission(TextSpan selectionSpan, SyntaxNode root) 119TextSpan selectionSpan,
StringCopyPaste\AbstractPasteProcessor.cs (6)
68/// mapped forward (<see cref="MapSpanForward(TextSpan)"/>) to <see cref="SnapshotAfterPaste"/> in an inclusive 74protected readonly ImmutableArray<TextSpan> TextContentsSpansAfterPaste; 129protected TextSpan MapSpanForward(TextSpan span) 137SourceText textAfterChange, ImmutableArray<TextSpan> textContentSpansAfterChange) 152SourceText textAfterChange, ImmutableArray<TextSpan> textContentSpansAfterChange)
StringCopyPaste\KnownSourcePasteProcessor.cs (3)
33TextSpan selectionSpanBeforePaste, 40private readonly TextSpan _selectionSpanBeforePaste = selectionSpanBeforePaste; 157out SourceText textAfterBasicPaste, out ImmutableArray<TextSpan> contentSpansAfterBasicPaste)
StringCopyPaste\StringCopyPasteCommandHandler.cs (4)
251return textBeforePaste.ToString(TextSpan.FromBounds(lastLine.Span.Start, quotePosition)); 281var spanAfterPaste = MapSpan(stringExpressionBeforePaste.Span, snapshotBeforePaste, snapshotAfterPaste); 302var spanAfterPaste = MapSpan(stringExpressionBeforePaste.Span, snapshotBeforePaste, snapshotAfterPaste); 345static int FindIndex(TextSpan span, int position)
StringCopyPaste\StringCopyPasteData.cs (6)
67public static StringCopyPasteData? TryCreate(IVirtualCharLanguageService virtualCharService, ExpressionSyntax stringExpression, TextSpan selectionSpan) 75private static StringCopyPasteData? TryCreateForLiteral(IVirtualCharLanguageService virtualCharService, LiteralExpressionSyntax literal, TextSpan span) 89TextSpan selectionSpan, 117var subsequence = virtualChars.GetSubSequence(TextSpan.FromBounds(firstCharIndexInclusive, lastCharIndexInclusive + 1)); 125TextSpan selectionSpan, 143TextSpan selectionSpan)
StringCopyPaste\StringCopyPasteHelpers.cs (10)
182public static int GetLongestQuoteSequence(SourceText text, TextSpan span) 185public static int GetLongestOpenBraceSequence(SourceText text, TextSpan span) 188public static int GetLongestCloseBraceSequence(SourceText text, TextSpan span) 196private static int GetLongestCharacterSequence(SourceText text, TextSpan span, char character) 513commonIndentPrefix = GetCommonIndentationPrefix(commonIndentPrefix, text, TextSpan.FromBounds(line.Start, nonWhitespaceIndex)); 520private static string? GetCommonIndentationPrefix(string? commonIndentPrefix, SourceText text, TextSpan lineWhitespaceSpan) 538public static TextSpan MapSpan(TextSpan span, ITextSnapshot from, ITextSnapshot to) 541public static bool RawContentMustBeMultiLine(SourceText text, ImmutableArray<TextSpan> spans) 557foreach (var span in spans)
StringCopyPaste\StringInfo.cs (26)
19TextSpan startDelimiterSpan, 20TextSpan endDelimiterSpan, 21TextSpan endDelimiterSpanWithoutSuffix, 22ImmutableArray<TextSpan> contentSpans) 40public readonly TextSpan StartDelimiterSpan = startDelimiterSpan; 45public readonly TextSpan EndDelimiterSpan = endDelimiterSpan; 50public readonly TextSpan EndDelimiterSpanWithoutSuffix = endDelimiterSpanWithoutSuffix; 60public readonly ImmutableArray<TextSpan> ContentSpans = contentSpans; 98var contentSpans = ImmutableArray.Create(TextSpan.FromBounds(start, end)); 104startDelimiterSpan: TextSpan.FromBounds(literal.SpanStart, start), 105endDelimiterSpan: TextSpan.FromBounds(end, literal.Span.End), 106endDelimiterSpanWithoutSuffix: TextSpan.FromBounds(end, endBeforeU8Suffix), 145TextSpan.FromBounds(literal.SpanStart, rawStart), 146TextSpan.FromBounds(rawEnd, literal.Span.End), 147TextSpan.FromBounds(rawEnd, endBeforeU8Suffix), 148contentSpans: [TextSpan.FromBounds(start, end)]); 175startDelimiterSpan: TextSpan.FromBounds(literal.SpanStart, start), 176endDelimiterSpan: TextSpan.FromBounds(end, literal.Span.End), 177endDelimiterSpanWithoutSuffix: TextSpan.FromBounds(end, endBeforeU8Suffix), 178[TextSpan.FromBounds(start, end)]); 202using var result = TemporaryArray<TextSpan>.Empty; 209result.Add(TextSpan.FromBounds(currentPosition, content.SpanStart)); 215result.Add(TextSpan.FromBounds(currentPosition, end)); 219startDelimiterSpan: TextSpan.FromBounds(interpolatedString.SpanStart, interpolatedString.StringStartToken.Span.End), 220endDelimiterSpan: TextSpan.FromBounds(interpolatedString.StringEndToken.SpanStart, interpolatedString.Span.End), 221endDelimiterSpanWithoutSuffix: TextSpan.FromBounds(interpolatedString.StringEndToken.SpanStart, endBeforeU8Suffix),
StringCopyPaste\UnknownSourcePasteProcessor.cs (2)
145/// <inheritdoc cref="AbstractPasteProcessor.GetQuotesToAddToRawString(SourceText, ImmutableArray{TextSpan})" /> 149/// <inheritdoc cref="AbstractPasteProcessor.GetDollarSignsToAddToRawString(SourceText, ImmutableArray{TextSpan})" />
TextStructureNavigation\CSharpTextStructureNavigatorProvider.cs (6)
83(TextSpan startSpan, TextSpan contentSpan, TextSpan endSpan) GetStringLiteralParts() 120return (TextSpan.FromBounds(start, contentStart), TextSpan.FromBounds(contentStart, contentEnd), TextSpan.FromBounds(contentEnd, end));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (68)
AddMissingImports\CSharpAddMissingImportsRefactoringProviderTests.cs (1)
33var pastedTextSpan = hostDocument.SelectedSpans.FirstOrDefault();
Classification\SemanticClassifierTests.cs (1)
32string code, ImmutableArray<TextSpan> spans, ParseOptions? options, TestHost testHost)
Classification\SemanticClassifierTests_TestMarkup.cs (2)
80ImmutableArray<TextSpan> spans, 97foreach (var current in remainder)
Classification\SyntacticClassifierTests.cs (1)
22protected override async Task<ImmutableArray<ClassifiedSpan>> GetClassificationSpansAsync(string code, ImmutableArray<TextSpan> spans, ParseOptions? options, TestHost testHost)
Classification\TotalClassifierTests.cs (1)
34protected override async Task<ImmutableArray<ClassifiedSpan>> GetClassificationSpansAsync(string code, ImmutableArray<TextSpan> spans, ParseOptions? options, TestHost testHost)
CodeActions\MoveType\MoveTypeTests.MoveScope.cs (1)
917var textSpan = workspace.Documents[0].SelectedSpans[0];
CodeActions\PreviewExceptionTests.cs (1)
109var span = document.GetSyntaxRootAsync().Result.Span;
CodeActions\PreviewTests.cs (1)
95var span = document.GetSyntaxRootAsync().Result.Span;
Completion\CompletionProviders\OverrideCompletionProviderTests.cs (1)
3858Assert.Equal(change.Span, TextSpan.FromBounds(136, 145));
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (1)
357=> context.ReportDiagnostic(Diagnostic.Create(Descriptor, Location.Create(context.Tree, TextSpan.FromBounds(1000, 2000))));
ExtractMethod\ExtractMethodBase.cs (2)
42var textSpan = testDocument.SelectedSpans.Single(); 158bool expectedFail = false, CSharpParseOptions parseOptions = null, TextSpan? textSpanOverride = null)
ExtractMethod\ExtractMethodMiscellaneousTests.cs (2)
41MarkupTestFile.GetSpan(markupCode, out var code, out var span); 86MarkupTestFile.GetSpan(markupCode, out var code, out var span);
ExtractMethod\SelectionValidatorTests.cs (1)
1874var span = new TextSpan(12, 1);
Formatting\Indentation\CSharpFormatterTestsBase.cs (1)
107TextSpan span = default)
Formatting\Indentation\SmartTokenFormatterFormatTokenTests.cs (6)
561out var code, out var position, out TextSpan span); 577TextSpan span = default) 589TextSpan span) 628out var code, out var position, out TextSpan span); 644TextSpan span = default) 656TextSpan span)
NavigateTo\NavigateToSearcherTests.cs (3)
540private sealed class TestNavigateToSearchResult(EditorTestWorkspace workspace, TextSpan sourceSpan) 544public TextSpan SourceSpan => sourceSpan; 551public ImmutableArray<TextSpan> NameMatchSpans => throw new NotImplementedException();
PdbSourceDocument\AbstractPdbSourceDocumentTests.cs (3)
85MarkupTestFile.GetSpan(metadataSource, out var source, out var expectedSpan); 105Text.TextSpan expectedSpan, 120protected static async Task<(SourceText?, TextSpan)> GetGeneratedSourceTextAsync(
PdbSourceDocument\ImplementationAssemblyLookupServiceTests.cs (10)
35MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 73MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 113MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 158MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 218MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 279MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 334MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 385MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 450MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 508MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan);
PdbSourceDocument\PdbFileLocatorServiceTests.cs (3)
30MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 59MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 90MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan);
PdbSourceDocument\PdbSourceDocumentLoaderServiceTests.cs (2)
33MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 68MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan);
PdbSourceDocument\PdbSourceDocumentTests.cs (13)
401MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 431MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 468MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 515MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 572MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 595MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 617MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 639MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 660MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 683MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 715MarkupTestFile.GetSpan(source1, out var metadataSource, out var expectedSpan); 753MarkupTestFile.GetSpan(source1, out var metadataSource, out var expectedSpan); 924MarkupTestFile.GetSpan(source2, out source2, out var expectedSpan);
QuickInfo\DiagnosticAnalyzerQuickInfoSourceTests.cs (5)
179ImmutableArray<TextSpan> relatedSpans) 186[.. info.RelatedSpans.Select(actualSpan => new Action<TextSpan>(expectedSpan => Assert.Equal(expectedSpan, actualSpan)))]); 206ImmutableArray<TextSpan> relatedSpans, 238private static Task TestInClassAsync(string code, string expectedDescription, params TextSpan[] relatedSpans) 247private static Task TestInMethodAsync(string code, string expectedDescription, params TextSpan[] relatedSpans)
StringCopyPaste\StringCopyPasteCommandHandlerTests.cs (3)
70expectedCode, out var massaged, out int? caretPosition, out ImmutableDictionary<string, ImmutableArray<TextSpan>> spans); 162TestFileMarkupParser.GetSpan(expectedMarkup, out expected, out var caretSpan); 180ImmutableArray<TextSpan> copySpans, out IWpfTextView textView, out ITextBuffer2 textBuffer2)
TypeInferrer\TypeInferrerTests.cs (2)
25protected override async Task TestWorkerAsync(Document document, TextSpan textSpan, string expectedType, TestMode mode) 72private static ExpressionSyntax FindExpressionSyntaxFromSpan(SyntaxNode root, TextSpan textSpan)
TypeInferrer\TypeInferrerTests.Delegate.cs (1)
24MarkupTestFile.GetSpan(text, out text, out var textSpan);
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (1)
EmbeddedLanguages\RegularExpressions\CSharpRegexParserTests.cs (1)
184private static XAttribute GetTextAttribute(SourceText text, TextSpan span)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (2)
PDB\CSharpPDBTestBase.cs (2)
23TextSpan? expectedSpan; 36public static bool CheckIfSpanWithinSequencePoints(TextSpan span, string source, string pdb)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (9)
Diagnostics\DiagnosticAnalyzerTests.cs (7)
1104var badSpan = new Text.TextSpan(100000, 10000); 3885var diagnosticSpan = new TextSpan(2, 2); 3926var diagnosticSpan = new TextSpan(2, 2); 3959TextSpan diagnosticSpan, 4000TextSpan diagnosticSpan, 4324var filterSpan = analysisKind == FilterSpanTestAnalyzer.AnalysisKind.AdditionalFile 4330async Task verifyCallbackSpanAsync(TextSpan? filterSpan)
Diagnostics\GetDiagnosticsTests.cs (2)
908var span = localDecl.Span; 1187var span = localDecl.Span;
Microsoft.CodeAnalysis.CSharp.Features (443)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (2)
253var spanToFormat = TextSpan.FromBounds(Math.Max(startPoint, 0), endPoint);
BraceMatching\BlockCommentBraceMatcher.cs (4)
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\CrefCompletionProvider.cs (2)
77var span = GetCompletionItemSpan(text, position); 227private static TextSpan GetCompletionItemSpan(SourceText text, int position)
Completion\CompletionProviders\CSharpSuggestionModeCompletionProvider.cs (1)
32Document document, int position, TextSpan itemSpan, CompletionTrigger trigger, CancellationToken cancellationToken = default)
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.NameGenerator.cs (6)
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)
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)
64protected override TextSpan GetTargetSelectionSpan(SyntaxNode caretTarget)
Completion\CSharpCompletionService.cs (1)
40public 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>> fixAllSpans) 60SyntaxNode root, Optional<ImmutableArray<TextSpan>> fixAllSpans)
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (17)
316builder.Append(text.ToString(TextSpan.FromBounds(line.End, line.EndIncludingLineBreak))); 336builder.Append(text.ToString(TextSpan.FromBounds(firstNonWhitespacePos, line.EndIncludingLineBreak))); 484private static (ImmutableIntervalTree<TextSpan> interpolationInteriorSpans, ImmutableIntervalTree<TextSpan> restrictedSpans) GetInterpolationSpans( 487var interpolationInteriorSpans = new SegmentedList<TextSpan>(); 488var restrictedSpans = new SegmentedList<TextSpan>(); 495interpolationInteriorSpans.Add(TextSpan.FromBounds(interpolation.OpenBraceToken.Span.End, interpolation.CloseBraceToken.Span.Start)); 505var descendantSpan = descendant.Span; 516restrictedSpans.Add(TextSpan.FromBounds(start, descendantSpan.End)); 524ImmutableIntervalTree<TextSpan>.CreateFromUnsorted(new TextSpanIntervalIntrospector(), interpolationInteriorSpans), 525ImmutableIntervalTree<TextSpan>.CreateFromUnsorted(new TextSpanIntervalIntrospector(), restrictedSpans)); 581builder.Append(text.ToString(TextSpan.FromBounds(line.End, line.EndIncludingLineBreak))); 593var currentLineLeadingWhitespace = line.Text!.ToString(TextSpan.FromBounds(line.Start, pos)); 596builder.Append(text.ToString(TextSpan.FromBounds(line.Start + commonWhitespacePrefix.Length, line.EndIncludingLineBreak))); 614builder.Append(text.ToString(TextSpan.FromBounds(line.Start + commonWhitespacePrefix.Length, line.EndIncludingLineBreak))); 639ImmutableIntervalTree<TextSpan> interpolationInteriorSpans) 668var currentLineLeadingWhitespace = line.Text!.ToString(TextSpan.FromBounds(line.Start, pos));
ConvertToRawString\ConvertRegularStringToRawStringCodeRefactoringProvider.cs (3)
328return leadingWhitespace1.GetSubSequence(TextSpan.FromBounds(0, current)); 337return line.GetSubSequence(TextSpan.FromBounds(0, current)); 359var result = characters.GetSubSequence(TextSpan.FromBounds(index, end));
ConvertToRawString\ConvertStringToRawStringCodeRefactoringProvider.cs (2)
139ImmutableArray<TextSpan> fixAllSpans, 151foreach (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 (1)
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)
28TextSpan 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( 796return default(TextSpan); 803return default(TextSpan); 817return default(TextSpan); 828internal static TextSpan CreateSpanForVariableDeclarator( 916private static TextSpan CreateSpanForCatchClause(CatchClauseSyntax catchClause) 976private static TextSpan? CreateSpanForAccessors(SyntaxList<AccessorDeclarationSyntax> accessors, int position)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (40)
70internal override bool TryFindMemberDeclaration(SyntaxNode? root, SyntaxNode node, TextSpan activeSpan, out OneOrMany<SyntaxNode> declarations) 183TextSpan span, 310private static TextSpan GetActiveSpan(BlockSyntax node, BlockPart part) 324private static TextSpan GetActiveSpan(ForEachStatementSyntax node, ForEachPart part) 328ForEachPart.VariableDeclaration => TextSpan.FromBounds(node.Type.SpanStart, node.Identifier.Span.End), 334private static TextSpan GetActiveSpan(ForEachVariableStatementSyntax node, ForEachPart part) 338ForEachPart.VariableDeclaration => TextSpan.FromBounds(node.Variable.SpanStart, node.Variable.Span.End), 344private static TextSpan GetActiveSpan(SwitchExpressionSyntax node, SwitchExpressionPart part) 348SwitchExpressionPart.SwitchBody => TextSpan.FromBounds(node.SwitchKeyword.SpanStart, node.CloseBraceToken.Span.End), 577protected override bool TryGetEnclosingBreakpointSpan(SyntaxToken token, out TextSpan span) 580protected override bool TryGetActiveSpan(SyntaxNode node, int statementPart, int minLength, out TextSpan span) 1596protected override TextSpan? TryGetDiagnosticSpan(SyntaxNode node, EditKind editKind) 1599internal static new TextSpan GetDiagnosticSpan(SyntaxNode node, EditKind editKind) 1602private static TextSpan? TryGetDiagnosticSpanImpl(SyntaxNode node, EditKind editKind) 1606internal static TextSpan? TryGetDiagnosticSpanImpl(SyntaxKind kind, SyntaxNode node, EditKind editKind) 1636return TextSpan.FromBounds(ns.NamespaceKeyword.SpanStart, ns.Name.Span.End); 1719return TextSpan.FromBounds(constraint.WhereKeyword.SpanStart, constraint.Constraints.Last().Span.End); 1760return TextSpan.FromBounds(usingStatement.UsingKeyword.SpanStart, usingStatement.CloseParenToken.Span.End); 1764return TextSpan.FromBounds(fixedStatement.FixedKeyword.SpanStart, fixedStatement.CloseParenToken.Span.End); 1768return TextSpan.FromBounds(lockStatement.LockKeyword.SpanStart, lockStatement.CloseParenToken.Span.End); 1791return TextSpan.FromBounds(ifStatement.IfKeyword.SpanStart, ifStatement.CloseParenToken.Span.End); 1798return TextSpan.FromBounds(switchStatement.SwitchKeyword.SpanStart, 1806return TextSpan.FromBounds(whileStatement.WhileKeyword.SpanStart, whileStatement.CloseParenToken.Span.End); 1813return TextSpan.FromBounds(forStatement.ForKeyword.SpanStart, forStatement.CloseParenToken.Span.End); 1818return TextSpan.FromBounds( 1931private static TextSpan GetDiagnosticSpan(SyntaxTokenList modifiers, SyntaxNodeOrToken start, SyntaxNodeOrToken end) 1932=> TextSpan.FromBounds((modifiers.Count != 0) ? modifiers.First().SpanStart : start.SpanStart, end.Span.End); 1934private static TextSpan CombineSpans(TextSpan first, TextSpan second, TextSpan defaultSpan) 1935=> (first.Length > 0 && second.Length > 0) ? TextSpan.FromBounds(first.Start, second.End) : (first.Length > 0) ? first : (second.Length > 0) ? second : defaultSpan; 1937internal override TextSpan GetLambdaParameterDiagnosticSpan(SyntaxNode lambda, int ordinal) 2286private readonly TextSpan? _span; 2295TextSpan? span = null) 2313var span = (spanNode != null) ? GetDiagnosticSpan(spanNode, _kind) : GetSpan(); 2320private TextSpan GetSpan() 2625TextSpan newStatementSpan) 2672protected override TextSpan GetExceptionHandlingRegion(SyntaxNode node, out bool coversAllChildren) 2687return 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 (6)
27private static TextSpan FromBounds(VirtualChar vc1, VirtualChar vc2) 28=> TextSpan.FromBounds(vc1.Span.Start, vc2.Span.End); 55using var _ = ArrayBuilder<TextSpan>.GetInstance(out var markdownSpans); 83TextSpan.FromBounds( 93TextSpan.FromBounds( 137VirtualCharSequence virtualChars, ArrayBuilder<TextSpan> markdownSpans, CancellationToken cancellationToken)
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 (1)
26TextSpan 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)
132string errorCode, TextSpan location) 146private static QuickInfoItem CreateQuickInfo(TextSpan location, DiagnosticDescriptor descriptor, 147params ReadOnlySpan<TextSpan> relatedSpans)
QuickInfo\CSharpSyntacticQuickInfoProvider.cs (1)
92var spans = ImmutableArray.Create(TextSpan.FromBounds(spanStart, spanEnd));
QuickInfo\OnTheFlyDocsUtilities.cs (1)
39var typeSpan = typeSyntaxReference.Span;
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)
105var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(constructorInitializer.ArgumentList); 118Document 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\GenericNamePartiallyWrittenSignatureHelpProvider.cs (2)
28protected override TextSpan GetTextSpan(SyntaxToken genericIdentifier, SyntaxToken lessThanToken) 33return TextSpan.FromBounds(genericIdentifier.SpanStart, nextToken.SpanStart);
SignatureHelp\GenericNameSignatureHelpProvider.cs (2)
132var textSpan = GetTextSpan(genericIdentifier, lessThanToken); 161protected virtual TextSpan GetTextSpan(SyntaxToken genericIdentifier, SyntaxToken lessThanToken)
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)
112var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(invocationExpression.ArgumentList); 158var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(invocationExpression.ArgumentList); 167TextSpan currentSpan,
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.cs (3)
104var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(objectCreationExpression.ArgumentList); 128var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(objectCreationExpression.ArgumentList); 135Document 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)
Snippets\AbstractCSharpAutoPropertySnippetProvider.cs (1)
92var node = root.FindNode(TextSpan.FromBounds(position, position));
Snippets\AbstractCSharpTypeSnippetProvider.cs (3)
79return new TextChange(TextSpan.FromBounds(targetPosition, targetPosition), SyntaxFacts.GetText(SyntaxKind.PublicKeyword) + " "); 84var triviaSpan = typeDeclaration.CloseBraceToken.LeadingTrivia.Span; 92var 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;
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\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (2)
132var ifStatementSpanWithoutElse = TextSpan.FromBounds(statement.Span.Start, embeddedStatement.Span.End);
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
54: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.SemicolonToken.Span.End));
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
57: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.Name.Span.End));
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_ProgramMain.cs (1)
71TextSpan.FromBounds(start, root.Members.OfType<GlobalStatementSyntax>().Last().FullSpan.End));
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\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\Analyzers\CSharp\Analyzers\RemoveUnnecessaryImports\CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (1)
50protected override IEnumerable<TextSpan> GetFixableDiagnosticSpans(
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (4)
230var startReportSpan = TextSpan.FromBounds(anonymousFunction.SpanStart, invokedExpression.SpanStart); 231var endReportSpan = TextSpan.FromBounds(invokedExpression.Span.End, anonymousFunction.Span.End);
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (8)
82private static ImmutableArray<TextSpan> AnalyzeCodeBlock(CodeBlockAnalysisContext context, int positionOfFirstReducingNullableDirective) 97foreach (var interval in simplifier.Spans) 217public bool TryProceedWithInterval(TextSpan span) 221public bool TryReportNullableImpactingSpans(TextSpan span, ImmutableArray<TextSpan> nullableImpactingSpans) 225private bool TryProceedOrReportNullableImpactingSpans(TextSpan span, ImmutableArray<TextSpan>? nullableImpactingSpans) 240foreach (var nullableImpactingSpan in spans)
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\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (3)
80SemanticModelAnalysisContext context, SyntaxNode root, TextSpan sourceSpan) 133var span = TextSpan.FromBounds(section[0].FullSpan.Start, section.Last().FullSpan.End);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
218syntaxTree.GetLocation(TextSpan.FromBounds(
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (1)
60syntaxTree.GetLocation(TextSpan.FromBounds(
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (1)
102syntaxTree.GetLocation(TextSpan.FromBounds(
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (2)
70syntaxTree.GetLocation(TextSpan.FromBounds( 110syntaxTree.GetLocation(TextSpan.FromBounds(
src\Analyzers\CSharp\Analyzers\UseDefaultLiteral\CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (2)
46var fadeSpan = TextSpan.FromBounds(defaultExpression.OpenParenToken.SpanStart, defaultExpression.CloseParenToken.Span.End);
src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (1)
105TextSpan.FromBounds(declaration.SpanStart, declaration.ArrowToken.Span.End));
src\Analyzers\CSharp\Analyzers\UseImplicitOrExplicitType\CSharpTypeStyleDiagnosticAnalyzerBase.cs (1)
58private static Diagnostic CreateDiagnostic(DiagnosticDescriptor descriptor, SyntaxNode declaration, TextSpan diagnosticSpan, NotificationOption2 notificationOption, AnalyzerOptions analyzerOptions)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
321TextSpan.FromBounds(arguments.First().SpanStart, arguments.Last().Span.End));
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\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
354var scopeSpan = scope.Span;
src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (1)
81TextSpan.FromBounds(typeArgumentList.LessThanToken.Span.End, typeArgumentList.GreaterThanToken.Span.Start))]));
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (2)
123var span = TextSpan.FromBounds(elements[0].Syntax.SpanStart, elements[^1].Syntax.Span.End);
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (1)
48private static (SyntaxNode container, SyntaxNode exprOrStatement) GetContainer(SyntaxNode root, TextSpan span)
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
37var diagnosticSpan = diagnostic.Location.SourceSpan;
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\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
53using var _ = ArrayBuilder<TextSpan>.GetInstance(diagnostics.Length, out var spans);
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\CSharpConvertToRecordCodeFixProvider.cs (1)
32var span = context.Span;
src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
60var span = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (1)
26SemanticDocument semanticDocument, TextSpan textSpan, CancellationToken cancellationToken,
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (1)
42var span = context.Span;
src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (1)
33var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
211SyntaxNode root, TextSpan span, [NotNullWhen(true)] out SyntaxNode? node)
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
130var referenceSpan = location.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
34var span = context.Span;
src\Analyzers\CSharp\CodeFixes\MakeRefStruct\MakeRefStructCodeFixProvider.cs (1)
39var span = context.Span;
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
92edits.Add(new TextChange(TextSpan.FromBounds(start, end), ""));
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
94edits.Add(new TextChange(TextSpan.FromBounds(start, end), ""));
src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (1)
38var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\RemoveNewModifier\RemoveNewModifierCodeFixProvider.cs (1)
36var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
65Document document, TextSpan span, SyntaxNode newExpression, CancellationToken cancellationToken)
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (2)
842var lineBreakSpan = TextSpan.FromBounds(lineToConsider.End, lineToConsider.EndIncludingLineBreak);
src\Analyzers\CSharp\CodeFixes\UseExplicitTypeForConst\UseExplicitTypeForConstCodeFixProvider.cs (1)
62Document document, TextSpan span, ITypeSymbol type, CancellationToken cancellationToken)
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
25TextSpan span,
StringIndentation\CSharpStringIndentationService.cs (7)
29Document document, TextSpan textSpan, CancellationToken cancellationToken) 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), 296TextSpan textSpan, string bannerText, bool autoCollapse, 304TextSpan textSpan, TextSpan hintSpan, 355var span = TextSpan.FromBounds(GetCollapsibleStart(startToken), spanEndPos); 356var hintSpan = GetHintSpan(node, hintEndPos); 368private static TextSpan GetHintSpan(SyntaxNode node, int endPos) 378return TextSpan.FromBounds(child.SpanStart, endPos); 382return TextSpan.FromBounds(node.SpanStart, endPos); 460textSpan: TextSpan.FromBounds(spanStart, spanEnd), 461hintSpan: 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 (3)
46textSpan: TextSpan.FromBounds(node.SpanStart, end), 47hintSpan: TextSpan.FromBounds(node.SpanStart, end), 64textSpan: TextSpan.FromBounds(previousToken.Span.End, 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),
UseExpressionBody\UseExpressionBodyCodeRefactoringProvider.cs (3)
187ImmutableArray<TextSpan> fixAllSpans, 203ImmutableArray<TextSpan> fixAllSpans, 211foreach (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)
91var 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.Features.UnitTests (20)
Copilot\CSharpImplementNotImplementedExceptionFixProviderTests.cs (2)
648public Task AnalyzeDocumentAsync(Document document, TextSpan? span, string promptTitle, CancellationToken cancellationToken) 654public Task<ImmutableArray<Diagnostic>> GetCachedDocumentDiagnosticsAsync(Document document, TextSpan? span, ImmutableArray<string> promptTitles, CancellationToken cancellationToken)
Diagnostics\Suppression\SuppressionTests.cs (1)
458var document = GetDocumentAndSelectSpan(workspace, out var span);
EditAndContinue\BreakpointSpansTests.cs (7)
38markup, out var source, out var position, out TextSpan? expectedSpan); 42tree, position.Value, CancellationToken.None, out var breakpointSpan); 85var expectedEnvelope = expectedSpans.IsEmpty ? default : TextSpan.FromBounds(expectedSpans[0].Start, expectedSpans[^1].End); 92public static IEnumerable<TextSpan> GetBreakpointSequence(SyntaxNode root, int position) 94TextSpan lastSpan = default; 98if (BreakpointSpans.TryGetClosestBreakpointSpan(root, p, minLength: 0, out var span) && span.Start > lastSpan.Start)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (6)
47foreach (var expected in GetExpectedSpans(source)) 57var actual = CSharpEditAndContinueAnalyzer.GetDiagnosticSpan(node, EditKind.Update); 66private static IEnumerable<TextSpan> GetExpectedSpans(string source) 92TextSpan? span; 310var oldStatementTextSpan = new TextSpan(oldStatementPosition, oldStatementSource.Length); 334var newStatementTextSpan = newText.Lines.GetTextSpan(newStatementSpan);
EditAndContinue\Helpers\EditingTestBase.cs (2)
116internal static SemanticEditDescription SemanticEdit(SemanticEditKind kind, Func<Compilation, ISymbol> symbolProvider, IEnumerable<(TextSpan, TextSpan)>? syntaxMap, IEnumerable<RuntimeRudeEditDescription>? rudeEdits = null, string? partialType = null)
Testing\CSharpTestMethodFinderTests.cs (2)
555var span = testDocument.CursorPosition != null ? new TextSpan(testDocument.CursorPosition.Value, 0) : testDocument.SelectedSpans.Single(); 569var span = testDocument.CursorPosition != null ? new TextSpan(testDocument.CursorPosition.Value, 0) : testDocument.SelectedSpans.Single();
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (26)
Semantics\BindingAwaitTests.cs (1)
28TextSpan span = new TextSpan(text.Length, 0);
Semantics\GlobalUsingDirectiveTests.cs (3)
3256comp2.GetSemanticModel(comp2.SyntaxTrees[0]).GetDiagnostics(TextSpan.FromBounds(20, comp2.SyntaxTrees[0].Length - 1)).Verify( 3264comp2.GetSemanticModel(comp2.SyntaxTrees[1]).GetDiagnostics(TextSpan.FromBounds(20, comp2.SyntaxTrees[1].Length - 1)).Verify( 3272comp2.GetSemanticModel(comp2.SyntaxTrees[2]).GetDiagnostics(TextSpan.FromBounds(20, comp2.SyntaxTrees[2].Length - 1)).Verify(
SourceGeneration\GeneratorDriverTests.cs (22)
1219new[] { (gen001, TextSpan.FromBounds(2, 5)) }, 1226new[] { (gen001, TextSpan.FromBounds(27, 30)) }, 1240new[] { (gen001, TextSpan.FromBounds(34, 37)) }, 1249new[] { (gen001, TextSpan.FromBounds(34, 37)), (gen001, TextSpan.FromBounds(77, 80)) }, 1253void verifyDiagnosticsWithSource(string source, (Diagnostic, TextSpan)[] reportDiagnostics, params DiagnosticDescription[] expected) 1263foreach ((var d, var l) in reportDiagnostics) 1360return x.Diagnostic.WithLocation(Location.Create(syntaxTree, TextSpan.FromBounds(start, end))); 3756location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2)))); 3789location: Location.Create(validSyntaxTree, TextSpan.FromBounds(0, 2)), 3790additionalLocations: new[] { Location.Create(invalidSyntaxTree, TextSpan.FromBounds(0, 2)) })); 3820location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2)))); 3850location: Location.Create(validSyntaxTree, TextSpan.FromBounds(0, 2)), 3851additionalLocations: new[] { Location.Create(invalidSyntaxTree, TextSpan.FromBounds(0, 2)) })); 3882location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 100)))); 3914location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2)), 3915additionalLocations: new[] { Location.Create(syntaxTree, TextSpan.FromBounds(0, 100)) })); 3945location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 100)))); 3974location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2)), 3975additionalLocations: new[] { Location.Create(syntaxTree, TextSpan.FromBounds(0, 100)) })); 4006location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2)))); 4036location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2))));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (9)
DeclarationTests.cs (1)
906public override TextSpan Span
Symbols\AnonymousTypesSemanticsTests.cs (7)
1983private CompilationUtils.SemanticInfoSummary GetAnonymousTypeInfoSummary(TestData data, int node, TextSpan typeSpan, params int[] fields) 2017var span = node.Span; 2051foreach (var span in intervals) 2088private static List<TextSpan> ExtractTextIntervals(ref string source) 2093List<TextSpan> intervals = new List<TextSpan>(); 2109intervals.Add(TextSpan.FromBounds(all[i - 1].offset, all[i].offset));
Symbols\Metadata\MetadataTypeTests.cs (1)
364var span = new TextSpan(oldIText.Length, 0);
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (66)
Diagnostics\DiagnosticTest.cs (1)
2410private TextSpan GetSpanIn(SyntaxTree syntaxTree, string textToFind)
Diagnostics\LineSpanDirectiveTests.cs (3)
487var span = getTextSpan(mappedText.Lines, mappedLineAndPositionSpan.Span); 491static TextSpan getTextSpan(TextLineCollection lines, LinePositionSpan span) 493return TextSpan.FromBounds(getTextPosition(lines, span.Start), getTextPosition(lines, span.End));
Diagnostics\LocationsTests.cs (9)
45var span = GetSpanIn(syntaxTree, sourceText); 66private TextSpan GetSpanIn(SyntaxTree syntaxTree, string textToFind) 89TextSpan xSpan = new TextSpan(sampleProgram.IndexOf("x;", StringComparison.Ordinal), 2); 90TextSpan xToCloseBraceSpan = new TextSpan(xSpan.Start, sampleProgram.IndexOf('}') - xSpan.Start + 1); 490TextSpan span1 = new TextSpan(sampleProgram.IndexOf("i;", StringComparison.Ordinal), 2); 491TextSpan span2 = new TextSpan(sampleProgram.IndexOf("c;", StringComparison.Ordinal), 2); 514var sourceSpan = new TextSpan(); 561var treeSpan = tree.GetRoot().FullSpan; 589var treeSpan = tree.GetRoot().FullSpan;
IncrementalParsing\IncrementalParsingTests.cs (29)
495var span = new TextSpan(source.IndexOf("]") + 1, length: 1); 527var span = new TextSpan(source.IndexOf("."), length: 1); 572var prefixSpan = new TextSpan(source.IndexOf(prefix), length: prefix.Length); 573var suffixSpan = new TextSpan(source.IndexOf(suffix), length: suffix.Length); 3330var span = new TextSpan(oldIText.Length, 0); 3413var span = new TextSpan(currLen, 0); 3450var span = new TextSpan(text.LastIndexOf('x'), 0); 3628var span = new TextSpan(source.IndexOf(" A[]?"), 0); 3649var span = new TextSpan(src.IndexOf(":"), 1); 3670var span = new TextSpan(source.IndexOf(";"), 0); 3691var span = new TextSpan(source.IndexOf(";") + 1, 0); 3712var span = new TextSpan(source.IndexOf(";") + 1, 0); 3734var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3758var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3782var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3806var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3830var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3854var span = new TextSpan(source.IndexOf(substring) + substring.Length, 1); 3880var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3905var span = new TextSpan(source.IndexOf(substring), 0); 3931var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3957var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3975var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3993var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 4011var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 4025var span = new TextSpan(start: 0, length: 1); // delete first character 4039var span = new TextSpan(start: 0, length: 0); 4054var span = new TextSpan(start: source.IndexOf(substring), length: 3); // Goo[Goo] -> [Goo] 4091var span = new TextSpan(start: source.IndexOf(":") + 1, length: 0);
LexicalAndXml\RawStringLiteralLexingTests.cs (1)
183MarkupTestFile.GetSpans(markup, out var input, out IDictionary<string, ImmutableArray<TextSpan>> spans);
LexicalAndXml\SyntaxTokenParserTests.cs (1)
407private static void AssertToken(SyntaxKind expectedKind, SyntaxKind expectedContextualKind, TextSpan expectedFullSpan, string expectedText, SyntaxTokenParser.Result result)
ParentChecker.cs (3)
20var span = nodeOrToken.Span; 27var tspan = trivia.Span; 40var tspan = trivia.Span;
Parsing\ParserRegressionTests.cs (2)
165var textSpan = Text.TextSpan.FromBounds(0, tree.Length);
Parsing\RoundTrippingTests.cs (2)
62var prevSpan = nodes[0].FullSpan; 65var span = nodes[i].FullSpan;
Syntax\LambdaUtilitiesTests.cs (1)
36TextSpan? span;
Syntax\SyntaxDiffingTests.cs (2)
307var span = new TextSpan(index, 4); 372var span = new TextSpan(index, 6);
Syntax\SyntaxFactoryTests.cs (2)
452var expectedLocation = Location.Create(expression.Token.SyntaxTree, TextSpan.FromBounds(0, 2)); 466var expectedLocation = Location.Create(expression.Token.SyntaxTree, TextSpan.FromBounds(0, 2));
Syntax\SyntaxNodeTests.cs (4)
745var EOFSpan = new TextSpan(root.FullSpan.End, 0); 754var nodeEndPositionSpan = new TextSpan(classDecl.FullSpan.End, 0); 764var invalidSpan = new TextSpan(100, 100); 2092var textSpan = new TextSpan(5, 10);
Syntax\SyntaxTests.cs (2)
164var span = section.Span; 165Assert.Equal(default(TextSpan), span);
TextExtensions.cs (4)
25var span = new TextSpan(offset, length); 35var span = new TextSpan(offset, length); 45var span = new TextSpan(offset, length); 59var span = new TextSpan(offset, 0);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CSharpTestBase.cs (1)
2288internal static string GetDocumentationCommentText(CSharpCompilation compilation, string? outputName = null, SyntaxTree? filterTree = null, TextSpan? filterSpanWithinTree = null, bool ensureEnglishUICulture = false, params DiagnosticDescription[] expectedDiagnostics)
Microsoft.CodeAnalysis.CSharp.Workspaces (130)
CaseCorrection\CSharpCaseCorrectionService.cs (1)
29ImmutableArray<TextSpan> spans,
Classification\ClassificationHelpers.cs (2)
501internal static void AddLexicalClassifications(SourceText text, TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 527var span = classifiedSpan.TextSpan;
Classification\CSharpClassificationService.cs (1)
21public override void AddLexicalClassifications(SourceText text, TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken)
Classification\SyntaxClassification\CSharpSyntaxClassificationService.cs (3)
36public override void AddLexicalClassifications(SourceText text, TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 39public override void AddSyntacticClassifications(SyntaxNode root, ImmutableArray<TextSpan> textSpans, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 41foreach (var textSpan in textSpans)
Classification\SyntaxClassification\DiscardSyntaxClassifier.cs (1)
22TextSpan textSpan,
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 (9)
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 void AddClassification(TextSpan span, string type) 60private bool ShouldAddSpan(TextSpan span) 122var span = token.Span; 135AddClassification(TextSpan.FromBounds(token.Span.Start, token.Span.End - "u8".Length), type); 136AddClassification(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);
Classification\Worker_Preprocesser.cs (3)
340var keywordSpan = new TextSpan(node.Content.SpanStart, firstSpaceIndex); 341var stringLiteralSpan = TextSpan.FromBounds(node.Content.SpanStart + firstSpaceIndex, node.Content.FullSpan.End);
CodeCleanup\CSharpCodeCleanerService.cs (1)
19protected override ImmutableArray<TextSpan> GetSpansToAvoid(SyntaxNode root)
Formatting\CSharpSyntaxFormattingService.cs (2)
292public ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken) 294var formattingSpan = CommonFormattingHelpers.GetFormattingSpan(document.Root, textSpan);
LanguageServices\FixAllSpanMappingService\CSharpFixAllSpanMappingService.cs (5)
28protected override async Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansIfWithinGlobalStatementAsync( 29Document document, TextSpan span, CancellationToken cancellationToken) 34return ImmutableDictionary<Document, ImmutableArray<TextSpan>>.Empty; 47return ImmutableDictionary<Document, ImmutableArray<TextSpan>>.Empty; 52return ImmutableDictionary<Document, ImmutableArray<TextSpan>>.Empty
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, 409out 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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (10)
206var lineSpan = currentLine.Span; 253using var _ = ArrayBuilder<(char ch, TextSpan span)>.GetInstance(out var charResults); 286string tokenText, int offset, int startIndexInclusive, int endIndexExclusive, ArrayBuilder<(char ch, TextSpan span)> charResults) 305private static void ConvertCharactersToRunes(ArrayBuilder<(char ch, TextSpan span)> charResults, ImmutableSegmentedList<VirtualChar>.Builder runeResults) 325runeResults.Add(VirtualChar.Create(rune, TextSpan.FromBounds(span.Start, nextSpan.End))); 339ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 352ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 386ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 405ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index, char character) 518result.Add((character, TextSpan.FromBounds(startIndex + offset, endIndex + offset)));
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (1)
238var name = SyntaxFactory.ParseName(syntaxTree.GetText(cancellationToken).ToString(TextSpan.FromBounds(genericIdentifier.SpanStart, lastToken.Span.End)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (4)
201var fullSpan = trivia.FullSpan; 230var span = trivia.FullSpan; 411var span = token.Span; 457var span = token.Span;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (1)
156var span = trivia.FullSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\FormattingResult.cs (1)
19internal FormattingResult(TreeData treeInfo, TokenStream tokenStream, TextSpan spanToFormat)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs (1)
57public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (1)
102public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (3)
21TextSpan textSpan, 53list.Add(FormattingOperations.CreateIndentBlockOperation(startToken, endToken, TextSpan.FromBounds(startPosition, endPosition), indentationDelta: -1, option: option)); 89TextSpan textSpan,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (5)
120TextSpan.FromBounds(lastTokenOfLabel.FullSpan.End, nextToken.SpanStart) : TextSpan.FromBounds(lastTokenOfLabel.FullSpan.End, lastTokenOfLabel.FullSpan.End)); 128var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 129span = lastSection ? span : TextSpan.FromBounds(span.Start, endToken.FullSpan.End); 369AddIndentBlockOperation(list, firstToken, lastToken, TextSpan.FromBounds(firstToken.FullSpan.Start, lastToken.FullSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (2)
335var textSpan = TextSpan.FromBounds(startToken.Span.End, endToken.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (2)
184var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (5)
917public TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node) 928return TextSpan.FromBounds(method.Body.OpenBraceToken.Span.End, method.Body.CloseBraceToken.SpanStart); 1032public TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) 1061return !branch.IsActive || !branch.BranchTaken ? TextSpan.FromBounds(branch.FullSpan.Start, position) : default; 1311public bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken)
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\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\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\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.CSharp.Workspaces.UnitTests (6)
CodeGeneration\SyntaxGeneratorTests.cs (1)
5068MarkupTestFile.GetSpan(markup, out var code, out var span);
Formatting\CSharpFormattingTestBase.cs (1)
46IEnumerable<TextSpan> spans,
Formatting\FormattingMultipleSpanTests.cs (4)
169var result = Formatter.Format(root, TextSpan.FromBounds(0, 0), workspace.Services.SolutionServices, CSharpSyntaxFormattingOptions.Default, CancellationToken.None); 179private static Tuple<string, List<TextSpan>> PreprocessMarkers(string codeWithMarker) 182var spans = new List<TextSpan>(); 199spans.Add(TextSpan.FromBounds(startPosition, endPosition));
Microsoft.CodeAnalysis.EditorFeatures (204)
AddImports\AbstractAddImportsPasteCommandHandler.cs (1)
153var textSpan = snapshotSpan.Span.ToTextSpan();
AutomaticCompletion\AbstractAutomaticLineEnderCommandHandler.cs (1)
177if (string.IsNullOrWhiteSpace(text.ToString(TextSpan.FromBounds(token.Span.End, line.End))))
BracePairs\BracePairsTaggerProvider.cs (1)
75static SnapshotSpan? CreateSnapshotSpan(TextSpan span, ITextSnapshot snapshot)
Classification\CopyPasteAndPrintingClassificationBufferTaggerProvider.Tagger.cs (2)
180bool requireSingleSpan, Func<TextSpan, SegmentedList<ClassifiedSpan>, Task> addTagsAsync) 189Func<TextSpan, SegmentedList<ClassifiedSpan>, Task> addAsync)
Classification\Semantic\AbstractSemanticOrEmbeddedClassificationViewTaggerProvider.cs (1)
173var changedSpan = new TextSpan(collapsedRange.Span.Start, collapsedRange.NewLength);
Classification\TotalClassificationTaggerProvider.cs (1)
270public TextSpan GetSpan(TagSpan<IClassificationTag> value)
CommentSelection\AbstractCommentSelectionBase.cs (2)
82protected static void DeleteText(ArrayBuilder<TextChange> textChanges, TextSpan span) 170internal static ITrackingSpan CreateTrackingSpan(Operation operation, ITextSnapshot snapshot, TextSpan textSpan)
CommentSelection\AbstractToggleBlockCommentBase.cs (39)
55protected abstract ImmutableArray<TextSpan> GetBlockCommentsInDocument(Document document, ITextSnapshot snapshot, 56TextSpan linesContainingSelections, CommentSelectionInfo commentInfo, CancellationToken cancellationToken); 96var linesContainingSelection = TextSpan.FromBounds(firstLineAroundSelection, lastLineAroundSelection); 130private static bool TryUncommentBlockComment(ImmutableArray<TextSpan> blockCommentedSpans, 136&& blockCommentSelection.TryGetBlockCommentOnSameLine(blockCommentedSpans, out var blockCommentOnSameLine)) 146foreach (var spanToRemove in intersectingBlockComments) 151var trackingSpan = TextSpan.FromBounds(intersectingBlockComments.First().Start, intersectingBlockComments.Last().End); 172var spanToAdd = blockCommentSelection.SelectedSpan; 176spanToAdd = TextSpan.FromBounds(caretLocation, caretLocation); 203if (blockCommentSelection.IsSpanWhitespace(TextSpan.FromBounds(extent.Span.Start, extent.Span.End))) 218var selectedSpan = blockCommentSelection.SelectedSpan; 224foreach (var uncommentedSpan in blockCommentSelection.UncommentedSpansInSelection) 252private static void AddBlockComment(CommentSelectionInfo commentInfo, TextSpan span, ArrayBuilder<TextChange> textChanges) 258private static void DeleteBlockComment(BlockCommentSelectionHelper blockCommentSelection, TextSpan spanToRemove, 280public TextSpan SelectedSpan { get; } 282public ImmutableArray<TextSpan> IntersectingBlockComments { get; } 284public ImmutableArray<TextSpan> UncommentedSpansInSelection { get; } 286public BlockCommentSelectionHelper(ImmutableArray<TextSpan> allBlockComments, SnapshotSpan selectedSnapshotSpan) 291SelectedSpan = TextSpan.FromBounds(selectedSnapshotSpan.Start, selectedSnapshotSpan.End); 299public bool IsSpanWhitespace(TextSpan span) 358public bool TryGetBlockCommentOnSameLine(ImmutableArray<TextSpan> allBlockComments, out TextSpan commentedSpanOnSameLine) 362var lineStartToCaretIsWhitespace = IsSpanWhitespace(TextSpan.FromBounds(selectedLine.Start, SelectedSpan.Start)); 363var caretToLineEndIsWhitespace = IsSpanWhitespace(TextSpan.FromBounds(SelectedSpan.Start, selectedLine.End)); 364foreach (var blockComment in allBlockComments) 370if (IsSpanWhitespace(TextSpan.FromBounds(SelectedSpan.Start, blockComment.Start))) 380if (IsSpanWhitespace(TextSpan.FromBounds(blockComment.End, SelectedSpan.Start))) 396private static ImmutableArray<TextSpan> GetIntersectingBlockComments(ImmutableArray<TextSpan> allBlockComments, TextSpan span) 402private ImmutableArray<TextSpan> GetUncommentedSpansInSelection() 404var uncommentedSpans = new List<TextSpan>(); 408foreach (var commentedSpan in IntersectingBlockComments) 413var possibleUncommentedSpan = TextSpan.FromBounds(spanStart, commentedSpan.Start); 427var uncommentedSpan = TextSpan.FromBounds(spanStart, SelectedSpan.End);
CommentSelection\CommentTrackingSpan.cs (3)
14public TextSpan TrackingTextSpan { get; } 24public CommentTrackingSpan(TextSpan trackingTextSpan) 31public CommentTrackingSpan(TextSpan trackingTextSpan, int amountToAddToStart, int amountToAddToEnd)
CommentSelection\CommentUncommentSelectionCommandHandler.cs (4)
166trackingSpans.Add(new CommentTrackingSpan(TextSpan.FromBounds(firstLine.Start.Position, lastLine.End.Position))); 173trackingSpans.Add(new CommentTrackingSpan(TextSpan.FromBounds(span.Start, span.End))); 265spansToSelect.Add(new CommentTrackingSpan(TextSpan.FromBounds(positionOfStart, positionOfEnd + info.BlockCommentEndString.Length))); 294spansToSelect.Add(new CommentTrackingSpan(TextSpan.FromBounds(firstLine.Start.Position, lastLine.End.Position)));
CommentSelection\ToggleBlockCommentCommandHandler.cs (4)
36protected override ImmutableArray<TextSpan> GetBlockCommentsInDocument(Document document, ITextSnapshot snapshot, 37TextSpan linesContainingSelections, CommentSelectionInfo commentInfo, CancellationToken cancellationToken) 40var commentedSpans = ArrayBuilder<TextSpan>.GetInstance(); 53var blockCommentSpan = new TextSpan(openIdx, closeIdx + commentInfo.BlockCommentEndString.Length - openIdx);
CommentSelection\ToggleLineCommentCommandHandler.cs (2)
127var spanToRemove = TextSpan.FromBounds(commentIndex, commentIndex + commentInfo.SingleLineCommentString.Length);
EditorConfigSettings\Updater\NamingStyles\NamingStyleSettingsUpdater.cs (4)
43var endOfSection = new TextSpan(parseResult.Section.Span.End, 0); 90static SourceText UpdateDocument(SourceText sourceText, string newLine, TextSpan? potentialSpan, TextSpan backupSpan) 99var span = potentialSpan ?? backupSpan;
EditorConfigSettings\Updater\NamingStyles\SourceTextExtensions.cs (3)
40var span = new TextSpan(existingSection.Span.End, 0); 46var span = new TextSpan(sourceText.Length, 0); 56static SourceText WithChanges(SourceText sourceText, TextSpan span, string newText)
Extensibility\NavigationBar\AbstractEditorNavigationBarItemService.cs (1)
81var navigationSpan = item.GetCurrentItemSpan(textVersion, symbolItem.Location.InDocumentInfo.Value.navigationSpan);
Extensibility\NavigationBar\NavigationBarItem.cs (4)
20ImmutableArray<TextSpan> spans, 39public ImmutableArray<TextSpan> Spans { get; } = spans; 61public static TextSpan GetCurrentItemSpan(this NavigationBarItem item, ITextVersion toVersion, TextSpan span)
Extensibility\NavigationBar\SimpleNavigationBarItem.cs (1)
12internal sealed class SimpleNavigationBarItem(ITextVersion textVersion, string text, Glyph glyph, ImmutableArray<TextSpan> spans, ImmutableArray<NavigationBarItem> childItems, int indent, bool bolded, bool grayed) : NavigationBarItem(textVersion, text, glyph, spans, childItems, indent, bolded, grayed), IEquatable<SimpleNavigationBarItem>
Extensibility\NavigationBar\WrappedNavigationBarItem.cs (4)
37private static ImmutableArray<TextSpan> GetSpans(RoslynNavigationBarItem underlyingItem) 39using var _ = ArrayBuilder<TextSpan>.GetInstance(out var spans); 41spans.SortAndRemoveDuplicates(Comparer<TextSpan>.Default); 44static void AddSpans(RoslynNavigationBarItem underlyingItem, ArrayBuilder<TextSpan> spans)
ExternalAccess\IntelliCode\Api\IIntentSourceProvider.cs (2)
27internal readonly struct IntentRequestContext(string intentName, SnapshotSpan currentSnapshotSpan, ImmutableArray<TextChange> textEditsToPrior, TextSpan priorSelection, string? intentData) 55public TextSpan PriorSelection { get; } = priorSelection;
ExternalAccess\UnitTestGenerator\Api\UnitTestGeneratorAddMissingImportsFeatureServiceAccessor.cs (2)
23internal async Task<Document> AddMissingImportsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) 33internal async Task<WrappedMissingImportsAnalysisResult> AnalyzeAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken)
ExternalAccess\VSTypeScript\Api\IVSTypeScriptBreakpointResolutionServiceImplementation.cs (1)
14Task<VSTypeScriptBreakpointResolutionResultWrapper> ResolveBreakpointAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken = default);
ExternalAccess\VSTypeScript\Api\IVSTypeScriptFormattingInteractionService.cs (2)
31Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, TextSpan? textSpan, DocumentOptionSet? documentOptions, CancellationToken cancellationToken); 36Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, TextSpan textSpan, DocumentOptionSet? documentOptions, CancellationToken cancellationToken);
ExternalAccess\VSTypeScript\Api\VSTypeScriptBlockSpan.cs (4)
10string? type, bool isCollapsible, TextSpan textSpan, TextSpan hintSpan, string bannerText = VSTypeScriptBlockSpan.Ellipses, bool autoCollapse = false, bool isDefaultCollapsed = false) 15public TextSpan TextSpan { get; } = textSpan; 16public TextSpan HintSpan { get; } = hintSpan;
ExternalAccess\VSTypeScript\Api\VSTypeScriptBreakpointResolutionResultWrapper.cs (2)
18public TextSpan TextSpan => UnderlyingObject.TextSpan; 22public static VSTypeScriptBreakpointResolutionResultWrapper CreateSpanResult(Document document, TextSpan textSpan, string? locationNameOpt = null)
ExternalAccess\VSTypeScript\Api\VSTypeScriptDebugDataTipInfoWrapper.cs (2)
10internal readonly struct VSTypeScriptDebugDataTipInfoWrapper(TextSpan span, string text) 14public readonly TextSpan Span => UnderlyingObject.Span;
ExternalAccess\VSTypeScript\Api\VSTypeScriptDocumentSpan.cs (2)
9internal readonly struct VSTypeScriptDocumentSpan(Document document, TextSpan sourceSpan) 12public TextSpan SourceSpan { get; } = sourceSpan;
ExternalAccess\VSTypeScript\Api\VSTypeScriptGoToSymbolContext.cs (1)
26public TextSpan Span { get; set; }
ExternalAccess\VSTypeScript\Api\VSTypeScriptInlineRenameInfo.cs (5)
24public abstract TextSpan TriggerSpan { get; } 27public abstract TextSpan? GetConflictEditSpan(VSTypeScriptInlineRenameLocationWrapper location, string replacementText, CancellationToken cancellationToken); 29public abstract TextSpan GetReferenceEditSpan(VSTypeScriptInlineRenameLocationWrapper location, CancellationToken cancellationToken); 43TextSpan? IInlineRenameInfo.GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken) 47TextSpan IInlineRenameInfo.GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken)
ExternalAccess\VSTypeScript\Api\VSTypeScriptInlineRenameLocationWrapper.cs (1)
15public TextSpan TextSpan => _underlyingObject.TextSpan;
ExternalAccess\VSTypeScript\Api\VSTypeScriptInlineRenameReplacementWrapper.cs (2)
15public TextSpan OriginalSpan => UnderlyingObject.OriginalSpan; 16public TextSpan NewSpan => UnderlyingObject.NewSpan;
ExternalAccess\VSTypeScript\Api\VSTypescriptNavigationBarItem.cs (2)
13ImmutableArray<TextSpan> spans, 25public ImmutableArray<TextSpan> Spans { get; } = spans.NullToEmpty();
ExternalAccess\VSTypeScript\VSTypeScriptBreakpointResolutionService.cs (1)
26public async Task<BreakpointResolutionResult?> ResolveBreakpointAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken = default)
ExternalAccess\VSTypeScript\VSTypeScriptFormattingInteractionService.cs (2)
33public Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, TextSpan? textSpan, CancellationToken cancellationToken) 36public Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken)
ExternalAccess\VSTypeScript\VSTypeScriptNavigationBarItemService.cs (1)
56var navigationSpan = item.GetCurrentItemSpan(textVersion, item.Spans.First());
ExtractMethod\ExtractMethodCommandHandler.cs (1)
131TextSpan span,
Formatting\FormatCommandHandler.cs (2)
57private void Format(ITextView textView, ITextBuffer textBuffer, Document document, TextSpan? selectionOpt, CancellationToken cancellationToken) 71ITextBuffer textBuffer, Document document, TextSpan? selectionOpt, CancellationToken cancellationToken)
Formatting\FormatCommandHandler.FormatSelection.cs (1)
53var formattingSpan = selection[0].Span.ToTextSpan();
Formatting\FormatCommandHandler.Paste.cs (1)
76var span = trackingSpan.GetSpan(subjectBuffer.CurrentSnapshot).Span.ToTextSpan();
Formatting\IFormattingInteractionService.cs (2)
31Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, TextSpan? textSpan, CancellationToken cancellationToken); 36Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken);
IInlineRenameService.cs (1)
23InlineRenameSessionInfo StartInlineSession(Document document, TextSpan triggerSpan, CancellationToken cancellationToken);
InlineRename\AbstractEditorInlineRenameService.cs (3)
41/// Returns the <see cref="TextSpan"/> of the nearest encompassing <see cref="SyntaxNode"/> of type 45protected static async Task<TextSpan?> TryGetSurroundingNodeSpanAsync<T>( 47TextSpan textSpan,
InlineRename\AbstractEditorInlineRenameService.FailureInlineRenameInfo.cs (3)
30public TextSpan TriggerSpan => default; 42public TextSpan GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken) => default; 44public TextSpan? GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken) => null;
InlineRename\AbstractEditorInlineRenameService.SymbolRenameInfo.cs (3)
43public TextSpan TriggerSpan { get; } 83public TextSpan GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken) 105public TextSpan? GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken)
InlineRename\IEditorInlineRenameService.cs (10)
20public TextSpan TextSpan { get; } 22public InlineRenameLocation(Document document, TextSpan textSpan) : this() 67public TextSpan OriginalSpan { get; } 68public TextSpan NewSpan { get; } 70public InlineRenameReplacement(InlineRenameReplacementKind kind, TextSpan originalSpan, TextSpan newSpan) : this() 77internal InlineRenameReplacement(RelatedLocation location, TextSpan newSpan) 168TextSpan TriggerSpan { get; } 212TextSpan GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken); 218TextSpan? GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken);
InlineRename\InlineRenameService.cs (2)
56TextSpan textSpan, 64TextSpan textSpan,
InlineRename\InlineRenameSession.OpenTextBufferManager.cs (11)
47private readonly Dictionary<TextSpan, RenameTrackingSpan> _referenceSpanToLinkedRenameSpanMap = []; 54private TextSpan? _activeSpan; 169internal void SetReferenceSpans(IEnumerable<TextSpan> spans) 185foreach (var span in spans) 188var renameableSpan = _session.RenameInfo.GetReferenceEditSpan( 212private static string GetTriggerText(Document document, TextSpan span) 660private readonly TextSpan _anchorSpan; 661private readonly TextSpan _activeSpan; 725var anchorSpan = _anchorSpan; 731var activeSpan = _activeSpan; 741private SnapshotPoint GetNewEndpoint(TextSpan span)
InlineRename\TrackingSpanIntrospector.cs (1)
14public TextSpan GetSpan(ITrackingSpan value)
InlineRename\UI\Adornment\RenameFlyoutViewModel.cs (2)
42TextSpan selectionSpan, 215public TextSpan StartingSelection { get; }
InlineRename\UI\InlineRenameAdornmentManager.cs (1)
133var identifierSelection = new TextSpan(start, length);
IntelliSense\AsyncCompletion\CommitManager.cs (1)
190TextSpan completionListSpan,
IntelliSense\AsyncCompletion\CompletionSessionData.cs (1)
26public TextSpan? CompletionListSpan { get; set; }
IntelliSense\AsyncCompletion\CompletionSource.cs (1)
195buffer.ApplyChange(new TextChange(TextSpan.FromBounds(caretPoint - 2, caretPoint), string.Empty));
IntelliSense\AsyncCompletion\ItemManager.CompletionListUpdater.cs (1)
624static Span GetOffsetSpan(TextSpan span, RoslynCompletionItem item)
IntelliSense\QuickInfo\Model.cs (1)
30internal SnapshotSpan GetCurrentSpanInSnapshot(TextSpan originalSpan, ITextSnapshot textSnapshot)
IntelliSense\ViewTextSpan.cs (3)
23internal readonly struct ViewTextSpan(TextSpan textSpan) 25public readonly TextSpan TextSpan = textSpan; 45public ViewTextSpan GetSubjectBufferTextSpanInViewBuffer(TextSpan textSpan)
Interactive\InteractiveDocumentNavigationService.cs (2)
27public override Task<bool> CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) 30public override async Task<INavigableLocation?> GetLocationForSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken)
Interactive\SendToInteractiveSubmissionProvider.cs (3)
30protected abstract IEnumerable<TextSpan> GetExecutableSyntaxTreeNodeSelection(TextSpan selectedSpan, SyntaxNode node); 71var newSpans = GetExecutableSyntaxTreeNodeSelection(TextSpan.FromBounds(selectedSpansStart, selectedSpansEnd), root).
KeywordHighlighting\HighlighterViewTaggerProvider.cs (1)
39private static readonly PooledObjects.ObjectPool<List<TextSpan>> s_listPool = new(() => []);
NavigateTo\NavigateToItemDisplay.cs (1)
82var span = NavigateToUtilities.GetBoundedSpan(_searchResult.NavigableItem, sourceText);
Navigation\AbstractDefinitionLocationService.cs (1)
114Solution solution, Document document, TextSpan span, CancellationToken cancellationToken)
Navigation\IDocumentNavigationServiceExtensions.cs (3)
31this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, TextSpan textSpan, NavigationOptions options, bool allowInvalidSpan, CancellationToken cancellationToken) 38this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, TextSpan textSpan, NavigationOptions options, CancellationToken cancellationToken) 45this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken)
NavigationBar\NavigationBarController_ModelComputation.cs (1)
223foreach (var span in item.Spans)
PasteTracking\PasteTrackingPasteCommandHandler.cs (2)
60var textSpan = TextSpan.FromBounds(snapshotSpan.Start, snapshotSpan.End);
PasteTracking\PasteTrackingService.cs (2)
26public bool TryGetPastedTextSpan(SourceTextContainer sourceTextContainer, out TextSpan textSpan) 39internal void RegisterPastedTextSpan(ITextBuffer textBuffer, TextSpan textSpan)
Preview\PreviewStaticClassificationTaggerProvider.cs (1)
77var requestSpan = span.Span.ToTextSpan();
RenameTracking\RenameTrackingTaggerProvider.cs (2)
99public static (CodeAction action, TextSpan renameSpan) TryGetCodeAction( 100Document document, TextSpan textSpan,
RenameTracking\RenameTrackingTaggerProvider.StateMachine.cs (2)
283internal (CodeAction action, TextSpan renameSpan) TryGetCodeAction( 286TextSpan userSpan,
Shared\Extensions\ITextSnapshotExtensions.cs (1)
27TextSpan span,
Shared\Extensions\SnapshotSpanExtensions.cs (1)
33public static bool IntersectsWith(this SnapshotSpan snapshotSpan, TextSpan textSpan)
Shared\Extensions\SpanExtensions.cs (1)
19public static TextSpan ToTextSpan(this Span span)
Shared\Tagging\Utilities\TagSpanIntervalTree.IntervalIntrospector.cs (1)
20public TextSpan GetSpan(TagSpan<TTag> value)
Shared\Utilities\CommonFormattingHelpers.cs (5)
15public static TextSpan GetFormattingSpan(SyntaxNode root, TextSpan span) 18public static TextSpan GetFormattingSpan(ITextSnapshot snapshot, SnapshotSpan selectedSpan) 27return TextSpan.FromBounds(currentLine.Start, endPosition); 31return TextSpan.FromBounds(lastNonNoisyCharPosition, endPosition);
SignatureHelp\Model.cs (2)
19public TextSpan TextSpan { get; } 37TextSpan textSpan,
SpellCheck\RoslynSpellCheckFixerProvider.cs (1)
96var subSpanBeingRenamed = span.Span.ToTextSpan();
Structure\StructureTag.cs (4)
52private static SubHeadingStructureData CreateSubHeading((TextSpan textSpan, TextSpan hintSpan, string type) subHeading, ITextSnapshot snapshot) 55private static Span DetermineHeaderSpan(TextSpan textSpan, TextSpan hintSpan, ITextSnapshot snapshot)
Suggestions\SuggestedActionsSource.cs (2)
106private TextSpan? TryGetCodeRefactoringSelection(ReferenceCountedDisposable<State> state, SnapshotSpan range) 244TextSpan? selection,
Suggestions\SuggestedActionsSource_Async.cs (1)
200TextSpan? selection,
Tagging\AbstractAsynchronousTaggerProvider.cs (2)
266public bool SpanEquals(ITextSnapshot snapshot1, TextSpan? span1, ITextSnapshot snapshot2, TextSpan? span2)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (70)
AbstractCommandHandlerTestState.cs (2)
87var firstSpan = selectionSpanList.First(); 88var lastSpan = selectionSpanList.Last();
BracePairs\AbstractBracePairsTests.cs (1)
49private static bool FindMatch(IDictionary<string, ImmutableArray<TextSpan>> expected, BracePairData bracePair)
Classification\AbstractClassifierTests.cs (6)
28protected abstract Task<ImmutableArray<ClassifiedSpan>> GetClassificationSpansAsync(string text, ImmutableArray<TextSpan> spans, ParseOptions? parseOptions, TestHost testHost); 44ImmutableArray<TextSpan> spans; 269protected static async Task<ImmutableArray<ClassifiedSpan>> GetSemanticClassificationsAsync(Document document, ImmutableArray<TextSpan> spans) 280protected static async Task<ImmutableArray<ClassifiedSpan>> GetSyntacticClassificationsAsync(Document document, ImmutableArray<TextSpan> spans) 290protected static async Task<ImmutableArray<ClassifiedSpan>> GetAllClassificationsAsync(Document document, ImmutableArray<TextSpan> spans) 295var classificationsSpans = new HashSet<TextSpan>();
CodeLens\AbstractCodeLensTest.cs (4)
32foreach (var span in annotatedSpan.Value) 59foreach (var span in annotatedSpan.Value) 85foreach (var span in annotatedSpan.Value) 111foreach (var span in annotatedSpan.Value)
CommentSelection\AbstractToggleCommentTestBase.cs (1)
76AssertEx.Equal(expectedSpans, textView.Selection.SelectedSpans.Select(snapshotSpan => TextSpan.FromBounds(snapshotSpan.Start, snapshotSpan.End)));
CompleteStatement\AbstractCompleteStatementTests.cs (2)
56foreach (var span in spans[""]) 110var selectedSpan = testDocument.SelectedSpans[0];
Completion\AbstractCompletionProviderTests.cs (1)
640MarkupTestFile.GetPositionAndSpan(expectedCodeAfterCommit, out var actualExpectedCode, out var expectedCaretPosition, out TextSpan? expectedSelectionSpan);
Debugging\AbstractDataTipInfoGetterTests.cs (2)
60private async Task TestSpanGetterAsync(string markup, Func<EditorTestWorkspace, Document, int, TextSpan?, Task> continuation) 67: (TextSpan?)null;
DocumentationComments\AbstractDocumentationCommentTests.cs (1)
150var selectedSpan = testDocument.SelectedSpans[0];
Formatting\CoreFormatterTestsBase.cs (4)
176private protected async Task AssertFormatAsync(string expected, string code, IEnumerable<TextSpan> spans, OptionsCollection options = null, int? baseIndentation = null) 212internal void AssertFormatWithTransformation(Workspace workspace, string expected, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, SyntaxNode root, IEnumerable<TextSpan> spans) 225internal void AssertFormat(Workspace workspace, string expected, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, ITextBuffer clonedBuffer, SyntaxNode root, IEnumerable<TextSpan> spans) 275TestFileMarkupParser.GetSpans(markupCode, out var code, out ImmutableArray<TextSpan> spans);
KeywordHighlighting\AbstractKeywordHighlighterTests.cs (6)
48var cursorSpan = testDocument.AnnotatedSpans["Cursor"].Single(); 61var highlightSpans = new List<TextSpan>(); 68private static void CheckSpans(SyntaxTree tree, IList<TextSpan> expectedHighlightSpans, List<TextSpan> highlightSpans) 85var expected = expectedHighlightSpans[j]; 86var actual = highlightSpans[j];
NavigateTo\AbstractNavigateToTests.cs (1)
204Assert.Equal<TextSpan>(
RefactoringHelpers\RefactoringHelpersTestBase.cs (12)
34text = GetSelectionAndResultSpans(text, out var selection, out var result); 43text = GetSelectionSpan(text, out var selection); 52text = GetSelectionAndResultSpans(text, out var selection, out var result); 65text = GetSelectionSpan(text, out var selection); 71private static string GetSelectionSpan(string text, out TextSpan selection) 73MarkupTestFile.GetSpans(text, out text, out IDictionary<string, ImmutableArray<TextSpan>> spans); 85private static string GetSelectionAndResultSpans(string text, out TextSpan selection, out TextSpan result) 87MarkupTestFile.GetSpans(text, out text, out IDictionary<string, ImmutableArray<TextSpan>> spans); 102private async Task<TNode?> GetNodeForSelectionAsync<TNode>(string text, TextSpan selection, Func<TNode, bool> predicate, bool allowEmptyNodes = false) where TNode : SyntaxNode
SignatureHelp\AbstractSignatureHelpProviderTests.cs (6)
79TextSpan? textSpan = null; 355IList<TextSpan> textSpans = null; 363TextSpan? textSpan = null; 378TextSpan? textSpan, 472IList<TextSpan> textSpans = null; 480TextSpan? textSpan = null;
SpellCheck\AbstractSpellCheckSpanTests.cs (1)
40private static ImmutableArray<SpellCheckSpan> Flatten(IDictionary<string, ImmutableArray<TextSpan>> annotations)
Squiggles\TestDiagnosticTagProducer.cs (1)
26internal static DiagnosticData CreateDiagnosticData(EditorTestHostDocument document, TextSpan span)
Structure\AbstractSyntaxStructureProviderTests.cs (3)
84IDictionary<string, ImmutableArray<TextSpan>> spans) 91var textSpan = spans[textSpanName][0]; 92var hintSpan = spans[hintSpanName][0];
TaskList\AbstractTaskListTests.cs (1)
50var span = expectedLists[i];
TypeInferrer\TypeInferrerTestBase.cs (2)
55MarkupTestFile.GetSpan(text.NormalizeLineEndings(), out text, out var textSpan); 67protected abstract Task TestWorkerAsync(Document document, TextSpan textSpan, string expectedType, TestMode mode);
Workspaces\EditorTestHostDocument.cs (2)
53IDictionary<string, ImmutableArray<TextSpan>> spans, 136var span = this.SelectedSpans.Single();
Workspaces\EditorTestWorkspace.cs (9)
71IDictionary<string, ImmutableArray<TextSpan>> spans, 290foreach (var span in document.SelectedSpans) 338out Dictionary<string, ImmutableArray<TextSpan>> mappedMarkupSpans, out int? mappedCaretLocation) 392var matchingSpan = documentWithSpan.AnnotatedSpans[spanName].Single(); 433IDictionary<string, ImmutableArray<TextSpan>> markupSpans, 434out Dictionary<string, ImmutableArray<TextSpan>> mappedMarkupSpans, 437var tempMappedMarkupSpans = new Dictionary<string, PooledObjects.ArrayBuilder<TextSpan>>(); 441tempMappedMarkupSpans[key] = PooledObjects.ArrayBuilder<TextSpan>.GetInstance(); 442foreach (var markupSpan in markupSpans[key])
Workspaces\TestFormattingRuleFactoryServiceFactory.cs (2)
35public TextSpan TextSpan = default; 54public IEnumerable<TextChange> FilterFormattedChanges(DocumentId document, TextSpan span, IList<TextChange> changes)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities2 (8)
Utilities\GoToHelpers\GoToTestHelpers.vb (2)
19Public ReadOnly Property Span As TextSpan 21Public Sub New(filePath As String, span As TextSpan)
Utilities\GoToHelpers\MockDocumentNavigationService.vb (3)
23Public _span As TextSpan = Nothing 31Public Function CanNavigateToSpanAsync(workspace As Workspace, documentId As DocumentId, textSpan As TextSpan, allowInvalidSpan As Boolean, cancellationToken As CancellationToken) As Task(Of Boolean) Implements IDocumentNavigationService.CanNavigateToSpanAsync 46Public Function GetLocationForSpanAsync(workspace As Workspace, documentId As DocumentId, textSpan As TextSpan, allowInvalidSpan As Boolean, cancellationToken As CancellationToken) As Task(Of INavigableLocation) Implements IDocumentNavigationService.GetLocationForSpanAsync
Utilities\MockDocumentNavigationServiceProvider.vb (3)
35Public ProvidedTextSpan As TextSpan 53Public Function CanNavigateToSpanAsync(workspace As Workspace, documentId As DocumentId, textSpan As TextSpan, allowInvalidSpan As Boolean, cancellationToken As CancellationToken) As Task(Of Boolean) Implements IDocumentNavigationService.CanNavigateToSpanAsync 68Public Function GetLocationForSpanAsync(workspace As Workspace, documentId As DocumentId, textSpan As TextSpan, allowInvalidSpans As Boolean, cancellationToken As CancellationToken) As Task(Of INavigableLocation) Implements IDocumentNavigationService.GetLocationForSpanAsync
Microsoft.CodeAnalysis.EditorFeatures.Text (14)
Extensions.SnapshotSourceText.cs (3)
156return TextLine.FromSpan(_text, TextSpan.FromBounds(line.Start, line.End)); 177public override string ToString(TextSpan textSpan) 312public override void Write(TextWriter textWriter, TextSpan span, CancellationToken cancellationToken)
Shared\Extensions\ITextSnapshotExtensions.cs (3)
30/// Convert a <see cref="LinePositionSpan"/> to <see cref="TextSpan"/>. 32public static TextSpan GetTextSpan(this ITextSnapshot snapshot, LinePositionSpan span) 34return TextSpan.FromBounds(
Shared\Extensions\TextSpanExtensions.cs (8)
13/// Convert a <see cref="TextSpan"/> instance to a <see cref="TextSpan"/>. 15public static Span ToSpan(this TextSpan textSpan) 19/// Add an offset to a <see cref="TextSpan"/>. 21public static TextSpan MoveTo(this TextSpan textSpan, int offset) 25/// Convert a <see cref="TextSpan"/> to a <see cref="SnapshotSpan"/> on the given <see cref="ITextSnapshot"/> instance 27public static SnapshotSpan ToSnapshotSpan(this TextSpan textSpan, ITextSnapshot snapshot)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (78)
CodeFixes\CodeFixServiceTests.cs (15)
60document, TextSpan.FromBounds(0, 0), new DefaultCodeActionRequestPriorityProvider(), CancellationToken.None); 85_ = await tuple.codeFixService.GetFixesAsync(document, TextSpan.FromBounds(0, 0), CancellationToken.None); 112var fixCollections = await tuple.codeFixService.GetFixesAsync(document, TextSpan.FromBounds(0, 0), CancellationToken.None); 143_ = await tuple.codeFixService.GetFixesAsync(document, TextSpan.FromBounds(0, 0), 150_ = await tuple.codeFixService.GetFixesAsync(document, TextSpan.FromBounds(0, 0), 179_ = await tuple.codeFixService.GetFixesAsync(document, TextSpan.FromBounds(0, 0), 209var fixCollectionSet = await tuple.codeFixService.GetFixesAsync(document, TextSpan.FromBounds(0, 0), 296var fixes = await tuple.codeFixService.GetFixesAsync(document, TextSpan.FromBounds(0, 0), CancellationToken.None); 321document, TextSpan.FromBounds(0, 0), new DefaultCodeActionRequestPriorityProvider(), CancellationToken.None); 549c.ReportDiagnostic(Diagnostic.Create(descriptor, c.Tree.GetLocation(TextSpan.FromBounds(0, 0)))); 768return await fixService.GetFixesAsync(document, TextSpan.FromBounds(0, 0), CancellationToken.None); 869var txtDocumentCodeFixes = await tuple.codeFixService.GetFixesAsync(txtDocument, TextSpan.FromBounds(0, 1), CancellationToken.None); 886var logDocumentCodeFixes = await tuple.codeFixService.GetFixesAsync(logDocument, TextSpan.FromBounds(0, 1), CancellationToken.None); 911var span = new TextSpan(line.Start, line.End); 1142TextSpan testSpan,
CodeGeneration\CodeGenerationTests.cs (6)
643var destSpan = new TextSpan(); 902var destSpan = Workspace.Documents.Single().SelectedSpans.Single(); 908var destSpan = Workspace.Documents.Single().SelectedSpans.Single(); 915foreach (var span in annotatedSpans) 921public static T GetSelectedSymbol<T>(TextSpan selection, SemanticModel semanticModel) 935var destSpan = Workspace.Documents.Single().SelectedSpans.Single();
CodeRefactorings\CodeRefactoringServiceTest.cs (7)
51var refactorings = await refactoringService.GetRefactoringsAsync(document, TextSpan.FromBounds(0, 0), CancellationToken.None); 89var refactorings = await refactoringService.GetRefactoringsAsync(document, TextSpan.FromBounds(0, 0), CancellationToken.None); 110var result = await refactoringService.GetRefactoringsAsync(document, TextSpan.FromBounds(0, 0), CancellationToken.None); 173var txtRefactorings = await refactoringService.GetRefactoringsAsync(txtAdditionalDocument, TextSpan.FromBounds(0, 0), CancellationToken.None); 188var logRefactorings = await refactoringService.GetRefactoringsAsync(logAdditionalDocument, TextSpan.FromBounds(0, 0), CancellationToken.None); 212var editorConfigRefactorings = await refactoringService.GetRefactoringsAsync(editorConfig, TextSpan.FromBounds(0, 0), CancellationToken.None); 227var globalConfigRefactorings = await refactoringService.GetRefactoringsAsync(globalConfig, TextSpan.FromBounds(0, 0), CancellationToken.None);
CommentSelection\CommentUncommentSelectionCommandHandlerTests.cs (3)
87CommentSelection(code, new[] { new TextChange(TextSpan.FromBounds(0, 0), "//") }, supportBlockComments: true); 127CommentSelection(code, new[] { new TextChange(TextSpan.FromBounds(0, 0), "//") }, supportBlockComments: false); 423CommentSelection(code, new[] { new TextChange(TextSpan.FromBounds(0, 0), "//") }, new[] { new Span(0, 15) }, supportBlockComments: true);
Completion\CompletionServiceTests.cs (3)
129private static async Task<TextSpan> GetTextChangeSpanAsync(Document document, TextSpan startSpan, CancellationToken cancellationToken) 131var result = startSpan;
Diagnostics\DiagnosticAnalyzerServiceTests.cs (3)
367var diagnosticSpan = new TextSpan(2, 2); 421public AdditionalFileAnalyzer2(bool registerFromInitialize, TextSpan diagnosticSpan, string id) 701async Task VerifyCallbackSpanAsync(TextSpan? filterSpan)
Diagnostics\DiagnosticDataTests.cs (1)
109private static async Task VerifyTextSpanAsync(string code, int startLine, int startColumn, int endLine, int endColumn, TextSpan span)
Diagnostics\SuppressMessageAttributeWorkspaceTests.cs (1)
66var span = (await document.GetSyntaxRootAsync()).FullSpan;
EditAndContinue\EditAndContinueLanguageServiceTests.cs (8)
173var documentDiagnostic = CodeAnalysis.Diagnostic.Create(errorReadingFileDescriptor, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2)), ["doc", "error 1"]); 176var syntaxError = CodeAnalysis.Diagnostic.Create(syntaxErrorDescriptor, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2))); 177var compilerDocHidden = CodeAnalysis.Diagnostic.Create(compilerHiddenDescriptor, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2))); 178var compilerDocInfo = CodeAnalysis.Diagnostic.Create(compilerInfoDescriptor, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2))); 179var compilerDocWarning = CodeAnalysis.Diagnostic.Create(compilerWarningDescriptor, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2))); 180var compilerDocError = CodeAnalysis.Diagnostic.Create(compilerErrorDescriptor, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2))); 185var rudeEditDiagnostic = new RudeEditDiagnostic(RudeEditKind.Delete, TextSpan.FromBounds(2, 3), arguments: ["x"]).ToDiagnostic(syntaxTree); 186var deletedDocumentRudeEdit = new RudeEditDiagnostic(RudeEditKind.Delete, TextSpan.FromBounds(2, 3), arguments: ["<deleted>"]).ToDiagnostic(tree: null);
EditorAdapter\TextSpanExtensionsTest.cs (3)
23var textSpan = new TextSpan(start, length); 38var textSpan = new TextSpan(0, 5); 50var textSpan = new TextSpan(0, 10);
MetadataAsSource\AbstractMetadataAsSourceTests.TestContext.cs (1)
144MarkupTestFile.GetSpan(expected, out expected, out var expectedSpan);
RenameTracking\RenameTrackingTaggerProviderTests.cs (5)
380var textSpan = state.HostDocument.SelectedSpans.Single(); 394var textSpan = state.HostDocument.SelectedSpans.Single(); 408var textSpan = state.HostDocument.SelectedSpans.Single(); 428var textSpan = state.HostDocument.SelectedSpans.Single(); 852var textSpan = state.HostDocument.SelectedSpans.Single();
RenameTracking\RenameTrackingTestState.cs (2)
164public async Task<CodeAction> TryGetCodeActionAsync(TextSpan? textSpan = null) 166var span = textSpan ?? new TextSpan(_view.Caret.Position.BufferPosition, 0);
Snippets\RoslynLSPSnippetConvertTests.cs (3)
490MarkupTestFile.GetPositionAndSpans(markup, out var text, out var cursorPosition, out IDictionary<string, ImmutableArray<TextSpan>> placeholderDictionary); 491var stringSpan = placeholderDictionary[""].First(); 501private static ImmutableArray<SnippetPlaceholder> GetSnippetPlaceholders(string text, IDictionary<string, ImmutableArray<TextSpan>> placeholderDictionary)
StackTraceExplorer\StackTraceExplorerTests.cs (1)
45var selectedSpan = cursorDoc.SelectedSpans.Single();
Structure\BlockSpanTests.cs (10)
18var span = TextSpan.FromBounds(0, 1); 19var hintSpan = TextSpan.FromBounds(2, 3); 36var span = TextSpan.FromBounds(0, 1); 37var hintSpan = TextSpan.FromBounds(2, 3); 51var span = TextSpan.FromBounds(0, 1);
Utilities\PatternMatcherTests.cs (5)
435private static ImmutableArray<string> PartListToSubstrings(string identifier, in TemporaryArray<TextSpan> parts) 446using var parts = TemporaryArray<TextSpan>.Empty; 453using var parts = TemporaryArray<TextSpan>.Empty; 471Assert.Equal<TextSpan>(match.Value.MatchedSpans, spans); 491var flattened = new List<TextSpan>();
ValueTracking\AbstractBaseValueTrackingTests.cs (1)
30var textSpan = new TextSpan(cursorDocument.CursorPosition!.Value, 0);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (44)
Classification\ClassificationTests.vb (5)
341Public Sub AddLexicalClassifications(text As SourceText, textSpan As TextSpan, result As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken) Implements IClassificationService.AddLexicalClassifications 344Public Sub AddSyntacticClassifications(services As SolutionServices, root As SyntaxNode, textSpans As ImmutableArray(Of TextSpan), result As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken) Implements IClassificationService.AddSyntacticClassifications 347Public Function AddSemanticClassificationsAsync(document As Document, textSpans As ImmutableArray(Of TextSpan), options As ClassificationOptions, result As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken) As Task Implements IClassificationService.AddSemanticClassificationsAsync 351Public Function AddSyntacticClassificationsAsync(document As Document, textSpans As ImmutableArray(Of TextSpan), result As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken) As Task Implements IClassificationService.AddSyntacticClassificationsAsync 366Public Function AddEmbeddedLanguageClassificationsAsync(document As Document, textSpans As ImmutableArray(Of TextSpan), options As ClassificationOptions, result As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken) As Task Implements IClassificationService.AddEmbeddedLanguageClassificationsAsync
CodeDefinitionWindow\CrossLanguageCodeDefinitionWindowTests.vb (1)
64Public ReadOnly Property SourceSpan As TextSpan Implements INavigableItem.SourceSpan
CodeFixes\CodeFixServiceTests.vb (3)
296document, Text.TextSpan.FromBounds(0, 0), New DefaultCodeActionRequestPriorityProvider(), CancellationToken.None) 349Public Function AnalyzeDocumentAsync(document As Document, span As TextSpan?, promptTitle As String, cancellationToken As CancellationToken) As Task Implements ICopilotCodeAnalysisService.AnalyzeDocumentAsync 353Public Function GetCachedDocumentDiagnosticsAsync(document As Document, span As TextSpan?, promptTitles As ImmutableArray(Of String), cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of Diagnostic)) Implements ICopilotCodeAnalysisService.GetCachedDocumentDiagnosticsAsync
Diagnostics\DiagnosticServiceTests.vb (3)
60Private Shared Async Function GetDiagnosticsForSpanAsync(diagnosticService As IDiagnosticAnalyzerService, document As Document, range As TextSpan) As Task(Of ImmutableArray(Of DiagnosticData)) 64Private Shared Async Function GetDiagnosticsForSpanAsync(diagnosticService As IDiagnosticAnalyzerService, document As Document, range As TextSpan, diagnosticKind As DiagnosticKind) As Task(Of ImmutableArray(Of DiagnosticData)) 920Dim documentDiagnostics = Await DiagnosticProviderTestUtilities.GetDocumentDiagnosticsAsync(workspace, document, TextSpan.FromBounds(0, 0))
Expansion\AbstractExpansionTest.vb (1)
32Dim spans As ImmutableArray(Of TextSpan) = Nothing
FindReferences\FindReferencesTests.vb (11)
201Public ReadOnly Spans As List(Of TextSpan) 203Public Sub New(fileName As String, spans As List(Of TextSpan)) 279Dim spans As ImmutableArray(Of TextSpan) = Nothing 280Dim expected = If(doc.AnnotatedSpans.TryGetValue(DefinitionKey, spans), spans, ImmutableArray(Of TextSpan).Empty).Order() 375Optional locationFilterOpt As Func(Of ReferenceLocation, Boolean) = Nothing) As Dictionary(Of String, List(Of TextSpan)) 391Private Shared Function PrintSpans(expected As IOrderedEnumerable(Of TextSpan), actual As IOrderedEnumerable(Of TextSpan), doc As Document, prefix As String, suffix As String, Optional messageOnly As Boolean = False) As String 421Private Shared Function TextSpansMatch(expected As IOrderedEnumerable(Of TextSpan), actual As IOrderedEnumerable(Of TextSpan)) As Boolean 425Dim enumeratorExpected As IEnumerator(Of TextSpan) = Nothing 426Dim enumeratorActual As IEnumerator(Of TextSpan) = Nothing
IntelliSense\CompletionRulesTests.vb (1)
62Dim wordMatchSpan As TextSpan = Nothing
IntelliSense\SignatureHelpControllerTests.vb (2)
68.Returns(Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 0), selectedItem:=0, semanticParameterIndex:=0, syntacticArgumentCount:=0, argumentName:=Nothing))) 215New SignatureHelpItems(_items, TextSpan.FromBounds(position, position), selectedItem:=0, semanticParameterIndex:=0, syntacticArgumentCount:=0, argumentName:=Nothing),
LanguageServices\SyntaxFactsServiceTests.vb (1)
214Dim spans As ImmutableArray(Of TextSpan) = Nothing
NavigableSymbols\NavigableSymbolsTest.vb (8)
35Dim spans As IDictionary(Of String, ImmutableArray(Of TextSpan)) = Nothing 48Dim spans As IDictionary(Of String, ImmutableArray(Of TextSpan)) = Nothing 61Dim spans As IDictionary(Of String, ImmutableArray(Of TextSpan)) = Nothing 77Dim spans As IDictionary(Of String, ImmutableArray(Of TextSpan)) = Nothing 90Dim spans As IDictionary(Of String, ImmutableArray(Of TextSpan)) = Nothing 103Dim spans As IDictionary(Of String, ImmutableArray(Of TextSpan)) = Nothing 122Private Shared Async Function TestNavigated(workspace As EditorTestWorkspace, position As Integer, spans As IDictionary(Of String, ImmutableArray(Of TextSpan))) As Task 138Dim value As ImmutableArray(Of TextSpan) = Nothing
PasteTracking\PasteTrackingTestState.vb (4)
59Public Function SendPaste(hostDocument As EditorTestHostDocument, pastedText As String) As TextSpan 81Public Async Function AssertHasPastedTextSpanAsync(hostDocument As TestHostDocument, Optional textSpan As TextSpan = Nothing) As Task 85Dim pastedTextSpan As TextSpan 96Dim textSpan As TextSpan
Rename\RenameEngineResult.vb (1)
205Dim spans As ImmutableArray(Of TextSpan) = Nothing
Rename\RenameTestHelpers.vb (1)
27Private Function GetSessionInfo(workspace As EditorTestWorkspace) As (document As Document, textSpan As TextSpan)
Simplification\AbstractSimplificationTests.vb (2)
64listOfLabelToAddSimplifierAnnotationSpans As IEnumerable(Of KeyValuePair(Of String, ImmutableArray(Of TextSpan))), 65explicitSpansToSimplifyWithin As ImmutableArray(Of TextSpan),
Microsoft.CodeAnalysis.ExternalAccess.AspNetCore (7)
EmbeddedLanguages\AspNetCoreVirtualChar.cs (1)
34public TextSpan Span => VirtualChar.Span;
EmbeddedLanguages\AspNetCoreVirtualCharSequence.cs (1)
35public AspNetCoreVirtualCharSequence GetSubSequence(TextSpan span) => new(_virtualCharSequence.GetSubSequence(span));
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.Copilot (11)
Analyzer\IExternalCSharpCopilotCodeAnalysisService.cs (1)
17Task<ImmutableArray<Diagnostic>> AnalyzeDocumentAsync(Document document, TextSpan? span, string promptTitle, CancellationToken cancellationToken);
CodeMapper\ICSharpCopilotMapCodeService.cs (1)
18ImmutableArray<(Document document, TextSpan textSpan)> prioritizedFocusLocations,
GenerateDocumentation\CopilotDocumentationCommentProposedEditWrapper.cs (1)
20public TextSpan SpanToReplace => _documentationCommentProposedEdit.SpanToReplace;
Internal\Analyzer\AbstractCopilotCodeAnalysisService.cs (4)
42protected abstract Task<ImmutableArray<Diagnostic>> AnalyzeDocumentCoreAsync(Document document, TextSpan? span, string promptTitle, CancellationToken cancellationToken); 80public async Task AnalyzeDocumentAsync(Document document, TextSpan? span, string promptTitle, CancellationToken cancellationToken) 135public async Task<ImmutableArray<Diagnostic>> GetCachedDocumentDiagnosticsAsync(Document document, TextSpan? span, ImmutableArray<string> promptTitles, CancellationToken cancellationToken) 169protected virtual Task<ImmutableArray<Diagnostic>> GetDiagnosticsIntersectWithSpanAsync(Document document, IReadOnlyList<Diagnostic> diagnostics, TextSpan span, CancellationToken cancellationToken)
Internal\Analyzer\CSharp\CSharpCopilotCodeAnalysisService.cs (2)
62protected override Task<ImmutableArray<Diagnostic>> AnalyzeDocumentCoreAsync(Document document, TextSpan? span, string promptTitle, CancellationToken cancellationToken) 119Document document, IReadOnlyList<Diagnostic> diagnostics, TextSpan span, CancellationToken cancellationToken)
Internal\CodeMapper\CopilotCSharpMapCodeService.cs (1)
30public Task<ImmutableArray<TextChange>?> MapCodeAsync(Document document, ImmutableArray<string> contents, ImmutableArray<(Document, TextSpan)> focusLocations, CancellationToken cancellationToken)
OnTheFlyDocs\CopilotOnTheFlyDocsRelevantFileInfoWrapper.cs (1)
15public TextSpan TextSpan => _onTheFlyDocsRelevantFileInfo.TextSpan;
Microsoft.CodeAnalysis.ExternalAccess.FSharp (70)
Classification\IFSharpClassificationService.cs (3)
28void AddLexicalClassifications(SourceText text, TextSpan textSpan, List<ClassifiedSpan> result, CancellationToken cancellationToken); 36Task AddSyntacticClassificationsAsync(Document document, TextSpan textSpan, List<ClassifiedSpan> result, CancellationToken cancellationToken); 44Task AddSemanticClassificationsAsync(Document document, TextSpan textSpan, List<ClassifiedSpan> result, CancellationToken cancellationToken);
DocumentHighlighting\IFSharpDocumentHighlightsService.cs (2)
24public TextSpan TextSpan { get; } 27public FSharpHighlightSpan(TextSpan textSpan, FSharpHighlightSpanKind kind) : this()
Editor\FSharpNavigationBarItem.cs (2)
23public IList<TextSpan> Spans { get; internal set; } 29IList<TextSpan> spans,
Editor\IFSharpBraceMatcher.cs (4)
15public TextSpan LeftSpan { get; } 16public TextSpan RightSpan { get; } 18public FSharpBraceMatchingResult(TextSpan leftSpan, TextSpan rightSpan)
Editor\IFSharpEditorFormattingService.cs (2)
29Task<IList<TextChange>> GetFormattingChangesAsync(Document document, TextSpan? textSpan, CancellationToken cancellationToken); 34Task<IList<TextChange>> GetFormattingChangesOnPasteAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken);
Editor\IFSharpEditorInlineRenameService.cs (3)
76TextSpan TriggerSpan { get; } 115TextSpan GetReferenceEditSpan(FSharpInlineRenameLocation location, CancellationToken cancellationToken); 121TextSpan? GetConflictEditSpan(FSharpInlineRenameLocation location, string replacementText, CancellationToken cancellationToken);
Editor\Implementation\Debugging\FSharpBreakpointResolutionResult.cs (2)
19public TextSpan TextSpan => UnderlyingObject.TextSpan; 23public static FSharpBreakpointResolutionResult CreateSpanResult(Document document, TextSpan textSpan, string? locationNameOpt = null)
Editor\Implementation\Debugging\FSharpDebugDataTipInfo.cs (2)
10internal readonly struct FSharpDebugDataTipInfo(TextSpan span, string text) 14public readonly TextSpan Span => UnderlyingObject.Span;
Editor\Implementation\Debugging\IFSharpBreakpointResolutionService.cs (1)
14Task<FSharpBreakpointResolutionResult?> ResolveBreakpointAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken = default);
Editor\InlineRename\FSharpInlineRenameInfo.cs (5)
27public abstract TextSpan TriggerSpan { get; } 30public abstract TextSpan? GetConflictEditSpan(FSharpInlineRenameLocation location, string replacementText, CancellationToken cancellationToken); 32public abstract TextSpan GetReferenceEditSpan(FSharpInlineRenameLocation location, CancellationToken cancellationToken); 49TextSpan? IInlineRenameInfo.GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken) 52TextSpan IInlineRenameInfo.GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken)
Editor\InlineRename\FSharpInlineRenameLocation.cs (2)
14public TextSpan TextSpan { get; } 16public FSharpInlineRenameLocation(Document document, TextSpan textSpan)
Editor\InlineRename\FSharpInlineRenameReplacement.cs (4)
14public TextSpan OriginalSpan { get; } 15public TextSpan NewSpan { get; } 17public FSharpInlineRenameReplacement(FSharpInlineRenameReplacementKind kind, TextSpan originalSpan, TextSpan newSpan)
FSharpDocumentSpan.cs (3)
15/// Represents a <see cref="TextSpan"/> location in a <see cref="Document"/>. 20public TextSpan SourceSpan { get; } 27public FSharpDocumentSpan(Document document, TextSpan sourceSpan)
InlineHints\FSharpInlineHint.cs (2)
18public readonly TextSpan Span; 23TextSpan span,
InlineHints\IFSharpInlineHintsService.cs (1)
17Task<ImmutableArray<FSharpInlineHint>> GetInlineHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken);
Internal\Classification\FSharpClassificationService.cs (7)
35public void AddLexicalClassifications(SourceText text, TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 42public async Task AddSemanticClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 44foreach (var textSpan in textSpans) 52public async Task AddSyntacticClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 54foreach (var textSpan in textSpans) 67public void AddSyntacticClassifications(SolutionServices services, SyntaxNode? root, ImmutableArray<TextSpan> textSpans, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 84public Task AddEmbeddedLanguageClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken)
Internal\Editor\FSharpEditorFormattingService.cs (4)
44public Task<IList<TextChange>> GetFormattingChangesAsync(Document document, TextSpan? textSpan, CancellationToken cancellationToken) 54public Task<IList<TextChange>> GetFormattingChangesOnPasteAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) 79async Task<ImmutableArray<TextChange>> IFormattingInteractionService.GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, TextSpan? textSpan, CancellationToken cancellationToken) 91async Task<ImmutableArray<TextChange>> IFormattingInteractionService.GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken)
Internal\Editor\FSharpEditorInlineRenameService.cs (3)
126public TextSpan TriggerSpan => _info.TriggerSpan; 154public TextSpan? GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken) 164public TextSpan GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken)
Internal\Editor\Implementation\Debugging\FSharpBreakpointResolutionService.cs (1)
31public async Task<BreakpointResolutionResult?> ResolveBreakpointAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken = default)
Internal\InlineHints\FSharpInlineHintsService.cs (1)
31Document document, TextSpan textSpan, InlineHintsOptions options, bool displayAllOverride, CancellationToken cancellationToken)
Internal\NavigateTo\InternalFSharpNavigateToSearchResult.cs (1)
36public ImmutableArray<TextSpan> NameMatchSpans => [];
Internal\Navigation\InternalFSharpNavigableItem.cs (1)
39public TextSpan SourceSpan { get; }
Navigation\FSharpDocumentNavigationService.cs (2)
23public bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) 37public bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken)
Navigation\FSharpNavigableItem.cs (2)
14public FSharpNavigableItem(FSharpGlyph glyph, ImmutableArray<TaggedText> displayTaggedParts, Document document, TextSpan sourceSpan) 28public TextSpan SourceSpan { get; }
Navigation\IFSharpDocumentNavigationService.cs (2)
17bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken); 22bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken);
SignatureHelp\FSharpSignatureHelpItems.cs (2)
28public TextSpan ApplicableSpan { get; } 61TextSpan applicableSpan,
Structure\FSharpBlockSpan.cs (5)
23public TextSpan TextSpan { get; } 28public TextSpan HintSpan { get; } 50string type, bool isCollapsible, TextSpan textSpan, string bannerText = Ellipses, bool autoCollapse = false, bool isDefaultCollapsed = false) 58string type, bool isCollapsible, TextSpan textSpan, TextSpan hintSpan, string bannerText = Ellipses, bool autoCollapse = false, bool isDefaultCollapsed = false)
TaskList\FSharpTaskListItem.cs (1)
9internal readonly record struct FSharpTaskListItem(FSharpTaskListDescriptor TaskDescriptor, string Message, Document Document, TextSpan Span);
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.ExternalAccess.Razor.Features (15)
IRazorDocumentExcerptService.cs (1)
13Task<RazorExcerptResult?> TryExcerptAsync(Document document, TextSpan span, RazorExcerptMode mode, RazorClassificationOptionsWrapper options, CancellationToken cancellationToken);
IRazorMappingService.cs (1)
15Task<ImmutableArray<RazorMappedSpanResult>> MapSpansAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken);
IRazorSpanMappingService.cs (1)
15Task<ImmutableArray<RazorMappedSpanResult>> MapSpansAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken);
RazorBreakpointSpans.cs (1)
13public static bool TryGetBreakpointSpan(SyntaxTree tree, int position, CancellationToken cancellationToken, out TextSpan breakpointSpan)
RazorClassifierAccessor.cs (1)
16public static async Task<IEnumerable<ClassifiedSpan>> GetClassifiedSpansAsync(Document document, TextSpan textSpan, RazorClassificationOptionsWrapper options, CancellationToken cancellationToken)
RazorCSharpFormattingInteractionService.cs (2)
83TextSpan span, 97TextSpan span,
RazorDocumentExcerptServiceWrapper.cs (1)
20public async Task<ExcerptResult?> TryExcerptAsync(Document document, TextSpan span, ExcerptMode mode, ClassificationOptions classificationOptions, CancellationToken cancellationToken)
RazorExcerptResult.cs (4)
15public readonly TextSpan MappedSpan; 21public readonly TextSpan Span; 23public RazorExcerptResult(SourceText content, TextSpan mappedSpan, ImmutableArray<ClassifiedSpan> classifiedSpans, Document document, TextSpan span)
RazorMappedSpanResult.cs (2)
16public readonly TextSpan Span; 18public RazorMappedSpanResult(string filePath, LinePositionSpan linePositionSpan, TextSpan span)
RazorMappingServiceWrapper.cs (1)
52IEnumerable<TextSpan> spans,
Microsoft.CodeAnalysis.ExternalAccess.Xaml (2)
External\ILocationService.cs (1)
24Task<FileLinePositionSpan?> GetLocationAsync(TextDocument document, TextSpan textSpan, CancellationToken cancellationToken);
Internal\LocationService.cs (1)
33public async Task<FileLinePositionSpan?> GetLocationAsync(TextDocument document, TextSpan textSpan, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Features (740)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.cs (1)
52Document document, TextSpan textSpan, CancellationToken cancellationToken)
AddFileBanner\AbstractAddFileBannerCodeRefactoringProvider.cs (1)
150ImmutableArray<TextSpan> fixAllSpans,
AddImport\AbstractAddImportCodeFixProvider.cs (1)
53var span = context.Span;
AddImport\AbstractAddImportFeatureService.cs (5)
65Document document, TextSpan span, string diagnosticId, int maxResults, 89Document document, TextSpan span, string diagnosticId, int maxResults, 515Document document, TextSpan span, ImmutableArray<Diagnostic> diagnostics, int maxResultsPerDiagnostic, 538Document document, TextSpan span, ImmutableArray<string> diagnosticIds, 563TextSpan 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)
16TextSpan span, 23public 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 (19)
99TextDocument document, TextSpan range, ICodeActionRequestPriorityProvider priorityProvider, CancellationToken cancellationToken) 128var spanToErrorDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>>(); 129var spanToOtherDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>>(); 155SortedDictionary<TextSpan, List<DiagnosticData>> spanToDiagnostics, 175TextSpan range, 253TextSpan range, 263private static SortedDictionary<TextSpan, List<DiagnosticData>> ConvertToMap( 270var spanToDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>>(); 288TextDocument document, TextSpan range, string diagnosticId, CancellationToken cancellationToken) 292TextDocument document, TextSpan range, string diagnosticId, DiagnosticSeverity minimumSeverity, CancellationToken cancellationToken) 318var spanToDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>> 349var textSpan = new TextSpan(0, text.Length); 448SortedDictionary<TextSpan, List<DiagnosticData>> spanToDiagnostics, 467using var _1 = PooledDictionary<CodeFixProvider, List<(TextSpan range, List<DiagnosticData> diagnostics)>>.GetInstance(out var fixerToRangesAndDiagnostics); 595TextSpan range, 598PooledDictionary<CodeFixProvider, List<(TextSpan range, List<DiagnosticData> diagnostics)>> fixerToRangesAndDiagnostics) 630TextDocument document, TextSpan span, CodeFixProvider fixer, CodeChangeProviderMetadata? fixerMetadata, 711TextSpan diagnosticsSpan, 746TextSpan fixesSpan,
CodeFixes\Service\CodeFixService.FixAllDiagnosticProvider.cs (1)
53public override async Task<IEnumerable<Diagnostic>> GetDocumentSpanDiagnosticsAsync(Document document, TextSpan fixAllSpan, CancellationToken cancellationToken)
CodeFixes\Service\ICodeFixService.cs (6)
18IAsyncEnumerable<CodeFixCollection> StreamFixesAsync(TextDocument document, TextSpan textSpan, ICodeActionRequestPriorityProvider priorityProvider, CancellationToken cancellationToken); 25Task<CodeFixCollection?> GetMostSevereFixAsync(TextDocument document, TextSpan range, ICodeActionRequestPriorityProvider priorityProvider, CancellationToken cancellationToken); 27Task<CodeFixCollection?> GetDocumentFixAllForIdInSpanAsync(TextDocument document, TextSpan textSpan, string diagnosticId, DiagnosticSeverity severity, CancellationToken cancellationToken); 35public static IAsyncEnumerable<CodeFixCollection> StreamFixesAsync(this ICodeFixService service, TextDocument document, TextSpan range, CancellationToken cancellationToken) 38public static Task<ImmutableArray<CodeFixCollection>> GetFixesAsync(this ICodeFixService service, TextDocument document, TextSpan range, CancellationToken cancellationToken) 41public static Task<ImmutableArray<CodeFixCollection>> GetFixesAsync(this ICodeFixService service, TextDocument document, TextSpan textSpan, ICodeActionRequestPriorityProvider priorityProvider, CancellationToken cancellationToken)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.cs (5)
141TextDocument textDocument, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) 149internal async Task<ImmutableArray<PragmaWarningCodeAction>> GetPragmaSuppressionsAsync(Document document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) 156Document document, TextSpan span, IEnumerable<Diagnostic> diagnostics, bool skipSuppressMessage, bool skipUnsuppress, CancellationToken cancellationToken) 262private async Task<SuppressionTargetInfo> GetSuppressionTargetInfoAsync(Document document, TextSpan span, CancellationToken cancellationToken) 319TextSpan? minContainingSpan = null;
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 (1)
143var referenceSpan = new TextSpan(spanStart, token.Span.Length);
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<ReferenceLocationDescriptor>?> 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)
35Document document, TextSpan textSpan, 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\IAddMissingImportsFeatureService.cs (2)
20Task<ImmutableArray<AddImportFixData>> AnalyzeAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); 36this IAddMissingImportsFeatureService service, Document document, TextSpan textSpan, 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)
53public TextSpan DefaultItemSpan { get; } 66public TextSpan CompletionListSpan { get; set; } 116TextSpan defaultSpan, 143TextSpan 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)
175public virtual TextSpan GetDefaultItemSpan(SourceText text, int caretPosition) 178public virtual TextSpan GetDefaultCompletionListSpan(SourceText text, int caretPosition) 418var defaultItemSpan = _completionServiceWithProviders.GetDefaultCompletionListSpan(text, position);
Completion\CompletionService_GetCompletions.cs (3)
76var completionListSpan = GetDefaultCompletionListSpan(text, caretPosition); 233CompletionOptions options, TextSpan completionListSpan, 325TextSpan defaultSpan,
Completion\PatternMatchHelper.cs (1)
42public ImmutableArray<TextSpan> GetHighlightedSpans(string text, CultureInfo culture)
Completion\Providers\AbstractAwaitCompletionProvider.cs (1)
227builder.Add(new TextChange(TextSpan.FromBounds(dotToken.Value.SpanStart, item.Span.End), replacementText));
Completion\Providers\AbstractDocCommentCompletionProvider.cs (3)
280var itemSpan = item.Span; 281var replacementSpan = TextSpan.FromBounds(text[itemSpan.Start - 1] == '<' && beforeCaretText[0] == '<' ? itemSpan.Start - 1 : itemSpan.Start, itemSpan.End);
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 (2)
83Document document, int position, TextSpan span, DeclarationModifiers modifiers, SyntaxToken token, CancellationToken cancellationToken) 105private 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 (2)
55var textSpan = TextSpan.FromBounds(item.Span.Start, change.Span.End);
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)
181ImmutableArray<TextSpan> fixAllSpans,
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
38var ifSpan = ifStatement.Span;
ConvertToInterpolatedString\AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (1)
256ImmutableArray<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\Extensions.cs (1)
16public static async Task<ImmutableArray<DiagnosticData>> GetCachedCopilotDiagnosticsAsync(this TextDocument document, TextSpan? span, CancellationToken cancellationToken)
Copilot\ICopilotChangeAnalysisService.cs (5)
103using var _ = ArrayBuilder<TextSpan>.GetInstance(out var newSpans); 176ArrayBuilder<TextSpan> newSpans, 216ArrayBuilder<TextSpan> newSpans, 247ArrayBuilder<TextSpan> newSpans, 384public 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);
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\IAnalyzerDriverService.cs (1)
23void ComputeDeclarationsInSpan(SemanticModel model, TextSpan span, bool getSymbol, ArrayBuilder<DeclarationInfo> builder, CancellationToken cancellationToken);
Diagnostics\IDiagnosticAnalyzerService.cs (3)
81TextDocument document, TextSpan? range, Func<string, bool>? shouldIncludeDiagnostic, 97TextDocument document, TextSpan? range, DiagnosticKind diagnosticKind, CancellationToken cancellationToken) 114TextDocument document, TextSpan? range, string? diagnosticId,
Diagnostics\Service\DiagnosticAnalyzerService.cs (1)
103TextSpan? range,
Diagnostics\Service\DocumentAnalysisExecutor.cs (3)
169private async Task<ImmutableArray<DiagnosticData>> GetCompilerAnalyzerDiagnosticsAsync(DiagnosticAnalyzer analyzer, TextSpan? span, CancellationToken cancellationToken) 258async Task<TextSpan?> GetAdjustedSpanForCompilerAnalyzerAsync() 290return TextSpan.FromBounds(Math.Min(startSpan.Start, endSpan.Start), Math.Max(startSpan.End, endSpan.End));
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer.cs (6)
128ImmutableArray<TextSpan> oldMemberSpans, 135var span = spanBased ? changedMember.FullSpan : (TextSpan?)null; 143ImmutableArray<TextSpan> oldMemberSpans, 155ImmutableArray<TextSpan> oldMemberSpans, 168ImmutableArray<TextSpan> oldMemberSpans, 184private async Task<(SyntaxNode changedMember, int changedMemberId, ImmutableArray<TextSpan> memberSpans, Document lastDocument)?> TryGetChangedMemberAsync(
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer_MemberSpans.cs (4)
24private readonly record struct MemberSpans(DocumentId DocumentId, VersionStamp Version, ImmutableArray<TextSpan> Spans); 29private async Task<ImmutableArray<TextSpan>> GetOrCreateMemberSpansAsync(Document document, VersionStamp version, CancellationToken cancellationToken) 46static async Task<ImmutableArray<TextSpan>> CreateMemberSpansAsync(Document document, VersionStamp version, CancellationToken cancellationToken) 59private void SaveMemberSpans(DocumentId documentId, VersionStamp version, ImmutableArray<TextSpan> memberSpans)
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs (3)
53TextSpan? range, 198TextSpan? span, 264DiagnosticAnalyzer analyzer, AnalysisKind kind, TextSpan? span)
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (5)
103var replaceSpan = new TextSpan(token.Span.Start, spanToReplaceLength); 316var replaceSpan = token.Span; 362var replaceSpan = new TextSpan(token.Span.Start, 0); 436var replaceSpan = firstNonWhitespaceOffset != null 437? 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 (2)
10/// Represents a <see cref="TextSpan"/> location in a <see cref="Document"/>. 12internal readonly record struct 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); 610using var _3 = ArrayBuilder<(SyntaxNode OldNode, SyntaxNode NewNode, TextSpan DiagnosticSpan)>.GetInstance(out var triviaEdits); 711lineText = text.ToString(TextSpan.FromBounds(diagnostic.Span.Start, Math.Min(diagnostic.Span.Start + 120, line.End))); 849var oldStatementSpan = oldActiveStatements[i].UnmappedSpan; 921var newStatementSpan = FindClosestActiveSpan(newStatement, statementPart); 1058var newSpan = GetDeletedDeclarationActiveSpan(topMatch.Matches, oldDeclaration); 1070var oldStatementSpan = oldActiveStatements[activeStatementIndex].UnmappedSpan; 1247TextSpan newSpan; 1377var trackedSpan = text.Lines.GetTextSpan(trackedLineSpan); 1392private ActiveStatement GetActiveStatementWithSpan(UnmappedActiveStatement oldStatement, SyntaxTree newTree, TextSpan newSpan, RudeEditDiagnosticsBuilder diagnostics, CancellationToken cancellationToken) 1415TextSpan newStatementSyntaxSpan, 1633public ActiveStatementExceptionRegions GetExceptionRegions(SyntaxNode root, TextSpan unmappedActiveStatementSpan, bool isNonLeaf, CancellationToken cancellationToken) 1654var span = GetExceptionHandlingRegion(exceptionHandlingAncestors[i], out var coversAllChildren); 1673private TextSpan GetDeletedNodeDiagnosticSpan( 1698private TextSpan FindClosestActiveSpan(SyntaxNode statement, int statementPart) 1700if (TryGetActiveSpan(statement, statementPart, minLength: statement.Span.Length, out var span)) 1725internal TextSpan GetDeletedNodeActiveSpan(IReadOnlyDictionary<SyntaxNode, SyntaxNode> forwardMap, SyntaxNode deletedNode) 1743internal TextSpan GetDeletedDeclarationActiveSpan(IReadOnlyDictionary<SyntaxNode, SyntaxNode> forwardMap, SyntaxNode deletedDeclaration) 1765internal TextSpan GetDeletedNodeDiagnosticSpan(IReadOnlyDictionary<SyntaxNode, SyntaxNode> forwardMap, SyntaxNode deletedNode) 1825protected void AddAroundActiveStatementRudeDiagnostic(RudeEditDiagnosticsBuilder diagnostics, SyntaxNode? oldNode, SyntaxNode? newNode, TextSpan newActiveStatementSpan) 1870protected void AddRudeDeleteAroundActiveStatement(RudeEditDiagnosticsBuilder diagnostics, SyntaxNode oldNode, TextSpan newActiveStatementSpan) 2099[Out] ArrayBuilder<(SyntaxNode OldNode, SyntaxNode NewNode, TextSpan DiagnosticSpan)> triviaEdits, 2152var rudeEditSpan = default(TextSpan); 2165if (!TryGetEnclosingBreakpointSpan(oldToken, out var oldBreakpointSpan) || 2166!TryGetEnclosingBreakpointSpan(newToken, out var newBreakpointSpan)) 2225var oldSpan = oldTokensEnum.Current.Span; 2226var newSpan = newTokensEnum.Current.Span; 2285rudeEditSpan = TextSpan.FromBounds(newTokensEnum.Current.FullSpan.Start, newTokensEnum.Current.SpanStart); 2291rudeEditSpan = TextSpan.FromBounds(lastNewToken.Span.End, newTokensEnum.Current.SpanStart); 2559IReadOnlyList<(SyntaxNode OldNode, SyntaxNode NewNode, TextSpan DiagnosticSpan)> triviaEdits, 2789var diagnosticSpan = GetDeletedNodeDiagnosticSpan(editScript.Match.Matches, oldDeclaration); 3150TextSpan? newActiveStatementSpan = null; 4921TextSpan diagnosticSpan) 5022public void Report(RudeEditKind kind, TextSpan span) 5049public void Report(RudeEditKind kind, CancellationToken cancellationToken, TextSpan? span = null, string?[]? arguments = null, RudeEditReportingCondition? condition = null) 5052public RudeEditDiagnostic CreateRudeEdit(RudeEditKind kind, CancellationToken cancellationToken, TextSpan? span = null, string?[]? arguments = null) 5128TextSpan diagnosticSpan = default) 6192private TextSpan GetSymbolLocationSpan(ISymbol symbol, CancellationToken cancellationToken) 6644var span = node.FullSpan;
EditAndContinue\AbstractSimpleMemberBody.cs (1)
25public sealed override TextSpan Envelope
EditAndContinue\ActiveStatementsMap.cs (3)
200if (TryGetTextSpan(oldText.Lines, unmappedLineSpan, out var unmappedSpan) && 272private static bool TryGetTextSpan(TextLineCollection lines, LinePositionSpan lineSpan, out TextSpan span) 282span = TextSpan.FromBounds(start, end);
EditAndContinue\EditSession.cs (4)
209private static TextSpan GetFirstLineDifferenceSpan(SourceText oldText, SourceText newText) 216var oldLineSpan = oldText.Lines[i].Span; 217var newLineSpan = newText.Lines[i].Span; 226TextSpan.FromBounds(newText.Lines[newLineCount - 1].End, newText.Lines[newLineCount - 1].EndIncludingLineBreak);
EditAndContinue\IEditAndContinueAnalyzer.cs (1)
26ActiveStatementExceptionRegions GetExceptionRegions(SyntaxNode syntaxRoot, TextSpan unmappedActiveStatementSpan, bool isNonLeaf, CancellationToken cancellationToken);
EditAndContinue\MemberBody.cs (7)
17public abstract TextSpan Envelope { get; } 22public bool ContainsActiveStatementSpan(TextSpan span) 28public virtual bool IsExcludedActiveStatementSpanWithinEnvelope(TextSpan span) 49public abstract SyntaxNode FindStatementAndPartner(TextSpan span, MemberBody? partnerDeclarationBody, out SyntaxNode? partnerStatement, out int statementPart); 51public SyntaxNode FindStatement(TextSpan span, out int statementPart) 56var envelope = Envelope; 66var 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)
22private readonly TextSpan _spanToClassify; 46TextSpan spanToClassify, 63public 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 (3)
37=> Text.GetSubSequence(TextSpan.FromBounds(start, end)); 316private readonly TextSpan GetTextSpan(int startInclusive, int endExclusive) 317=> TextSpan.FromBounds(Text[startInclusive].Span.Start, Text[endExclusive - 1].Span.End);
EmbeddedLanguages\Json\JsonParser.cs (2)
402literalToken.VirtualChars.GetSubSequence(TextSpan.FromBounds(1, literalToken.VirtualChars.Length)), 589private readonly TextSpan GetTokenStartPositionSpan(JsonToken token)
EmbeddedLanguages\Json\JsonParser.StrictSyntaxChecker.cs (1)
242return 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 (3)
53=> Text.GetSubSequence(TextSpan.FromBounds(start, end)); 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(); 703private readonly TextSpan GetTokenSpanIncludingEOF(RegexToken token) 708private 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;
EmbeddedLanguages\StackFrame\StackFrameLexer.cs (1)
66=> Text.GetSubSequence(TextSpan.FromBounds(start, end));
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)
34public 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)
301var sourceSpan = location.SourceSpan;
FindUsages\IRemoteFindUsagesService.cs (4)
162internal readonly struct SerializableDocumentSpan(DocumentId documentId, TextSpan sourceSpan) 168public readonly TextSpan SourceSpan = sourceSpan; 252SerializableClassifiedSpans classifiedSpans, TextSpan highlightSpan) 258public 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 (5)
78TextSpan textSpan, 79Action<CodeAction, TextSpan> registerSingleAction, 115private async Task<(CodeAction CodeAction, TextSpan ApplicableToSpan)?> HandleNonSelectionAsync( 117TextSpan textSpan, 191Document 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; } 39TextSpan textSpan, 55TextSpan textSpan,
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.cs (1)
171TextSpan 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 (4)
23private static readonly PooledObjects.ObjectPool<List<TextSpan>> s_listPool = new(() => []); 26SyntaxNode root, int position, List<TextSpan> highlights, CancellationToken cancellationToken) 37var lastSpan = default(TextSpan);
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)
31TextSpan spanToSearch,
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (3)
78TextSpan spanToSearch, 127TextSpan spanToSearch, 159TextSpan 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)
42TextSpan parameterSpan,
InlineHints\AbstractInlineHintsService.cs (1)
18Document document, TextSpan textSpan, InlineHintsOptions options, bool displayAllOverride, CancellationToken cancellationToken)
InlineHints\AbstractInlineParameterNameHintsService.cs (2)
37TextSpan textSpan, 108var 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)
IntroduceVariable\AbstractIntroduceLocalForExpressionCodeRefactoringProvider.cs (1)
26protected abstract bool IsValid(TExpressionStatementSyntax expressionStatement, TextSpan span);
IntroduceVariable\AbstractIntroduceVariableService.cs (1)
64TextSpan textSpan,
IntroduceVariable\AbstractIntroduceVariableService.State.cs (2)
48TextSpan textSpan, 62TextSpan 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)
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)
58var 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)
142using var matchedSpans = TemporaryArray<TextSpan>.Empty;
NavigateTo\AbstractNavigateToSearchService.NormalSearch.cs (1)
118var 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\RoslynNavigateToItem.cs (4)
35ImmutableArray<TextSpan> nameMatchSpans, 63public readonly ImmutableArray<TextSpan> NameMatchSpans = nameMatchSpans; 205ImmutableArray<TextSpan> INavigateToSearchResult.NameMatchSpans => _item.NameMatchSpans; 299TextSpan 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 (2)
44Solution solution, ISymbol symbol, SyntaxTree tree, Func<SyntaxReference, TextSpan> computeFullSpan) 51Func<SyntaxReference, TextSpan> computeFullSpan,
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)
26public static Task<QuickInfoItem> CreateQuickInfoItemAsync(SolutionServices services, SemanticModel semanticModel, TextSpan span, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, CancellationToken cancellationToken) 32TextSpan 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\ISemanticSearchResultsObserver.cs (2)
28[property: DataMember(Order = 4)] TextSpan Span); 34[property: DataMember(Order = 2)] TextSpan Span);
SemanticSearch\QueryExecutionContext.cs (1)
191var span = queryText.Lines.GetTextSpan(new LinePositionSpan(position, position));
SignatureHelp\AbstractSignatureHelpProvider.cs (2)
41IList<SignatureHelpItem> items, TextSpan applicableSpan, SignatureHelpState? state, int? selectedItemIndex, int parameterIndexOverride) 73IList<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)
45SyntaxNode root, SemanticModel model, TextSpan span, 78var span = context.Span; 124private bool CanSimplifyTypeNameExpression(SemanticModel model, SyntaxNode node, TSimplifierOptions options, TextSpan span, out string diagnosticId, CancellationToken cancellationToken) 129model, 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)
38public static async Task<string?> GetSimplifiedTypeNameAsync(Document document, TextSpan fieldSpan, string fullyQualifiedTypeName, SimplifierOptions simplifierOptions, CancellationToken cancellationToken) 41var updatedTextSpan = new TextSpan(fieldSpan.Start, fullyQualifiedTypeName.Length); 56public async Task<string?> GetSwitchExpansionAsync(Document document, TextSpan caseGenerationLocation, TextSpan switchExpressionLocation, SimplifierOptions simplifierOptions, CancellationToken cancellationToken) 120protected abstract Task<ITypeSymbol?> GetEnumSymbolAsync(Document document, TextSpan switchExpressionSpan, CancellationToken cancellationToken); 122protected abstract Task<(Document, TextSpan)> GetDocumentWithEnumCaseAsync(Document document, string fullyQualifiedTypeName, string firstEnumMemberName, TextSpan caseGenerationLocation, CancellationToken cancellationToken); 128TextSpan caseGenerationLocation, 140private 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()); 94var closestNode = root.FindNode(TextSpan.FromBounds(position, position));
Snippets\SnippetProviders\AbstractInlineStatementSnippetProvider.cs (2)
71return new TextChange(TextSpan.FromBounds(inlineExpressionInfo?.Node.SpanStart ?? position, position), statement.ToFullString()); 76var 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)
36return 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)
220=> root.FindNode(TextSpan.FromBounds(position, position), getInnermostNodeForTie: true) as TSnippetSyntax;
Snippets\SnippetProviders\AbstractTypeSnippetProvider.cs (1)
25var 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)
12public static bool TryGetWordOnLeft(int position, SourceText currentText, ISyntaxFactsService syntaxFactsService, [NotNullWhen(true)] out TextSpan? wordSpan) 35wordSpan = 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 (2)
60private async Task<Document> RefactorAsync(Document document, TextSpan tokenSpan, TextSpan ifOrElseIfSpan, CancellationToken cancellationToken)
src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (1)
51var span = context.FilterSpan.HasValue ? context.FilterSpan.GetValueOrDefault() : root.FullSpan;
src\Analyzers\Core\Analyzers\OrderModifiers\AbstractOrderModifiersDiagnosticAnalyzer.cs (1)
82context.Tree.GetLocation(TextSpan.FromBounds(modifiers.First().SpanStart, modifiers.Last().Span.End)),
src\Analyzers\Core\Analyzers\RemoveUnnecessaryCast\AbstractRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
31protected abstract TextSpan GetFadeSpan(TCastExpression node);
src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (10)
141private IEnumerable<TextSpan> GetContiguousSpans(ImmutableArray<SyntaxNode> nodes) 144(SyntaxNode node, TextSpan textSpan)? previous = null; 149TextSpan textSpan; 153textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 161textSpan = TextSpan.FromBounds(previous.Value.textSpan.Start, nodeEnd); 167textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 194IEnumerable<TextSpan> contiguousSpans, SyntaxTree tree, 197foreach (var span in contiguousSpans) 208protected abstract IEnumerable<TextSpan> GetFixableDiagnosticSpans( 216foreach (var span in spans)
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
135return Location.Create(parenthesizedExpression.SyntaxTree, TextSpan.FromBounds(parenthesizedExpressionLocation.SourceSpan.Start, textSpanEndPosition));
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (3)
86TextSpan? span, 227TextSpan? span, 735TextSpan? span,
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (5)
45using var _ = ArrayBuilder<TextSpan>.GetInstance(out var unnecessarySpans); 89ArrayBuilder<TextSpan> unnecessarySpans) 195private static TextSpan GetSpanWithinLiteralQuotes(IVirtualCharService virtualCharService, SyntaxToken formatToken) 200: TextSpan.FromBounds(sequence.First().Span.Start, sequence.Last().Span.End); 208ArrayBuilder<TextSpan> unnecessarySpans)
src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (5)
81out TextSpan issueSpan, out string diagnosticId, out bool inDeclaration, 118out var issueSpan, out var diagnosticId, out var inDeclaration, 135internal static Diagnostic CreateDiagnostic(SemanticModel model, TSimplifierOptions options, AnalyzerOptions analyzerOptions, TextSpan issueSpan, string diagnosticId, bool inDeclaration) 206/// indicate that <c>intervalTree</c> may be updated by adding a new non-overlapping <see cref="TextSpan"/> 249static bool TryProceedWithInterval(bool addIfAvailable, TextSpan span, StrongBox<bool> completed, TextSpanMutableIntervalTree intervalTree)
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\Analyzers\Core\Analyzers\UseObjectInitializer\AbstractUseObjectInitializerDiagnosticAnalyzer.cs (2)
152var location1 = Location.Create(syntaxTree, TextSpan.FromBounds( 158locations.Add(syntaxTree.GetLocation(TextSpan.FromBounds(match.Initializer.FullSpan.End, match.Statement.Span.End)));
src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
55var span = diagnostic.Location.SourceSpan;
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\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (1)
38SyntaxNode root, TextSpan span, [NotNullWhen(true)] out SyntaxNode? node)
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
48private static TXmlElementSyntax? GetParamNode(SyntaxNode root, TextSpan span)
src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (3)
76var diagnosticSpan = diagnostic.Location.SourceSpan; 78var spanToFormat = TextSpan.FromBounds(
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.cs (2)
22SemanticDocument document, TextSpan textSpan, CancellationToken cancellationToken, 27TextSpan textSpan,
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (2)
30TextSpan textSpan, 46TextSpan textSpan,
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\IGenerateDefaultConstructorsService.cs (1)
17Document document, TextSpan textSpan, bool forRefactoring, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (1)
61TextSpan span, Diagnostic diagnostic)
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (1)
33var span = context.Span;
src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (1)
35SyntaxNode root, TextSpan span, [NotNullWhen(true)] out SyntaxNode? node)
src\Analyzers\Core\CodeFixes\MakeFieldReadonly\AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
47var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
55var span = context.Span;
StackTraceExplorer\StackTraceAnalyzer.cs (3)
79yield return callstack.GetSubSequence(TextSpan.FromBounds(position, i)); 88yield return callstack.GetSubSequence(TextSpan.FromBounds(position, callstack.Length)); 112return virtualChars.GetSubSequence(TextSpan.FromBounds(start, end + 1));
StackTraceExplorer\VSDebugCallstackParser.cs (1)
38var textToParse = line.GetSubSequence(TextSpan.FromBounds(startPoint, line.Length));
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);
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
412ISet<(string filePath, TextSpan span)> constructorSpans,
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.Features.Test.Utilities (34)
EditAndContinue\EditAndContinueTestVerifier.cs (3)
413public static SyntaxNode FindNode(SyntaxNode root, TextSpan span) 432IEnumerable<(TextSpan oldSpan, TextSpan newSpan, RuntimeRudeEditDescription? runtimeRudeEdit)> expectedMapping,
EditAndContinue\EditAndContinueWorkspaceTestBase.cs (1)
458internal static TextSpan GetSpan(string str, string substr)
EditAndContinue\SemanticEditDescription.cs (8)
17IEnumerable<(TextSpan, TextSpan)>? syntaxMap, 30public IEnumerable<(TextSpan oldSpan, TextSpan newSpan, RuntimeRudeEditDescription? runtimeRudeEdit)>? GetSyntaxMap() 35private static IEnumerable<(TextSpan oldSpan, TextSpan newSpan, RuntimeRudeEditDescription? runtimeRudeEdit)> GetSyntaxMapWithRudeEdits(IEnumerable<(TextSpan, TextSpan)>? syntaxMap, IEnumerable<RuntimeRudeEditDescription>? rudeEdits)
EditAndContinue\SourceMarkers.cs (11)
45private static IEnumerable<((int major, int minor) id, TextSpan span)> ParseSpans(string markedSource, string tagName) 81yield return (id, TextSpan.FromBounds(start, end)); 85public static IEnumerable<(TextSpan Span, int Id)> GetActiveSpans(string markedSource) 88public static (int id, TextSpan span)[] GetTrackingSpans(string src) 96var result = new List<(int id, TextSpan span)>(); 112public static ImmutableArray<ImmutableArray<TextSpan>> GetExceptionRegions(string markedSource) 117var result = new List<List<TextSpan>>(); 140public static ImmutableArray<ImmutableArray<TextSpan>> GetNodeSpans(string markedSource) 142var result = new List<List<TextSpan>>(); 157public static ImmutableArray<TextSpan> GetSpans(string markedSource, string tagName) 159var result = new List<TextSpan>();
EditAndContinue\SyntaxMapDescription.cs (8)
15public readonly struct Mapping(ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)> nodeSpans, ImmutableArray<TextSpan> newSpans, Match<SyntaxNode>? match) 17public readonly ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)> Spans = nodeSpans; 38public readonly ImmutableArray<ImmutableArray<TextSpan>> OldNodeSpans; 39public readonly ImmutableArray<ImmutableArray<TextSpan>> NewNodeSpans; 42public readonly ImmutableArray<TextSpan> NewSpans;
Snippets\AbstractSnippetProviderTests.cs (3)
75TestFileMarkupParser.GetPositionAndSpans(markupAfterCommit, out markupAfterCommit, out int finalCaretPosition, out ImmutableDictionary<string, ImmutableArray<TextSpan>> placeholderLocations); 78var placeholderLocationsArray = new ImmutableArray<TextSpan>[placeholderLocations.Count]; 110var expectedSpan = expectedSpans[j];
Microsoft.CodeAnalysis.Features.UnitTests (27)
EditAndContinue\ActiveStatementsMapTests.cs (9)
48var span = TextSpan.FromBounds(8, 11); 51TextSpan.FromBounds(1, 6), // does not overlap 52TextSpan.FromBounds(3, 9), // overlaps 53TextSpan.FromBounds(4, 5), // does not overlap 54TextSpan.FromBounds(6, 7), // does not overlap 55TextSpan.FromBounds(7, 9), // overlaps 56TextSpan.FromBounds(10, 12), // overlaps 57TextSpan.FromBounds(13, 15)); // does not overlap
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (9)
2500var activeSpan1 = GetSpan(source1, "System.Console.WriteLine(1);"); 3896var activeSpan11 = GetSpan(sourceV1, "G(1);"); 3897var activeSpan12 = GetSpan(sourceV1, "System.Console.WriteLine(1)"); 3898var activeSpan21 = GetSpan(sourceV2, "G(2); G(1);"); 3899var activeSpan22 = GetSpan(sourceV2, "System.Console.WriteLine(2)"); 3900var adjustedActiveSpan1 = GetSpan(sourceV2, "G(2);"); 3901var adjustedActiveSpan2 = GetSpan(sourceV2, "System.Console.WriteLine(2)"); 3980var activeSpan11 = GetSpan(sourceV1, "G(1)"); 3981var activeSpan12 = GetSpan(sourceV1, "System.Console.WriteLine(1)");
EditAndContinue\EmitSolutionUpdateResultsTests.cs (2)
135new RudeEditDiagnostic(RudeEditKind.Insert, TextSpan.FromBounds(1, 10), 123, ["a"]).ToDiagnostic(tree), 136new RudeEditDiagnostic(RudeEditKind.Delete, TextSpan.FromBounds(1, 10), 123, ["b"]).ToDiagnostic(tree)
EditAndContinue\RemoteEditAndContinueServiceTests.cs (3)
121var diagnostic = Diagnostic.Create(diagnosticDescriptor, Location.Create(syntaxTree, TextSpan.FromBounds(1, 1))); 203var documentDiagnostic = Diagnostic.Create(diagnosticDescriptor1, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2)), new[] { "doc", "some error" }); 205var syntaxError = Diagnostic.Create(diagnosticDescriptor1, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2)), new[] { "doc", "syntax error" });
EditAndContinue\RudeEditDiagnosticTests.cs (4)
85var re = new RudeEditDiagnostic(kind, TextSpan.FromBounds(1, 2)); 91var re = new RudeEditDiagnostic(kind, TextSpan.FromBounds(1, 2), syntaxNode, ["<1>", "<2>"]); 99var re = new RudeEditDiagnostic(kind, TextSpan.FromBounds(1, 2), syntaxNode, ["<1>", "<2>", "<3>"]); 108var re = new RudeEditDiagnostic(kind, TextSpan.FromBounds(1, 2), syntaxNode, ["<1>"]);
Microsoft.CodeAnalysis.LanguageServer (1)
Testing\TestDiscoverer.cs (1)
82var textSpan = ProtocolConversions.RangeToTextSpan(range, text);
Microsoft.CodeAnalysis.LanguageServer.Protocol (74)
Extensions\ProtocolConversions.cs (8)
313public static TextSpan RangeToTextSpan(LSP.Range range, SourceText text) 364public static LSP.Range TextSpanToRange(TextSpan textSpan, SourceText text) 458TextSpan textSpan, 467TextSpan textSpan, 506TextSpan span, 518span = TextSpan.FromBounds( 526static LSP.Location ConvertTextSpanWithTextToLocation(TextSpan span, SourceText text, DocumentUri documentUri) 1010private static async Task<ImmutableArray<MappedSpanResult>?> GetMappedSpanResultAsync(TextDocument textDocument, ImmutableArray<TextSpan> textSpans, CancellationToken cancellationToken)
Features\CodeCleanup\AbstractCodeCleanupService.cs (2)
172var textSpan = new TextSpan(0, tree.Length); 194var range = new TextSpan(0, tree.Length);
Features\UnifiedSuggestions\UnifiedSuggestedActionSet.cs (2)
27public TextSpan? ApplicableToSpan { get; } 35TextSpan? applicableToSpan)
Features\UnifiedSuggestions\UnifiedSuggestedActionSetComparer.cs (6)
15private readonly TextSpan? _targetSpan; 17public UnifiedSuggestedActionSetComparer(TextSpan? targetSpan) 20private static int Distance(TextSpan? maybeA, TextSpan? maybeB) 28var a = maybeA.Value; 29var b = maybeB.Value;
Features\UnifiedSuggestions\UnifiedSuggestedActionsSource.cs (15)
39TextSpan selection, 344static (TextSpan? span, string category) CombineSpansAndCategory(ArrayBuilder<UnifiedSuggestedActionSet> sets) 381var combinedSpan = minStart >= 0 ? TextSpan.FromBounds(minStart, maxEnd) : (TextSpan?)null; 437TextSpan selection, 463TextSpan selection, 469TextSpan selection, 479bool IsActionAndSpanApplicable((CodeAction action, TextSpan? applicableSpan) actionAndSpan) 507TextSpan selection, 539async Task<IUnifiedSuggestedAction> GetUnifiedSuggestedActionSetAsync(CodeAction codeAction, TextSpan? applicableToSpan, TextSpan selection, CancellationToken cancellationToken) 581TextSpan selection, 642TextSpan? selectionOpt, 661TextSpan? selectionOpt, 705ImmutableArray<UnifiedSuggestedActionSet> actionSets, TextSpan? selectionOpt)
Handler\Breakpoints\ValidateBreakableRangeHandler.cs (1)
37var span = ProtocolConversions.RangeToTextSpan(range, text);
Handler\CodeActions\CodeActionHelpers.cs (1)
396var textSpan = ProtocolConversions.RangeToTextSpan(selection, text);
Handler\Completion\CompletionHandler.cs (1)
156var defaultSpan = new TextSpan(completionList.Span.Start, length: position - completionList.Span.Start);
Handler\Completion\CompletionResultFactory.cs (7)
74var defaultSpan = list.Span; 322TextSpan defaultSpan, 371TextSpan defaultSpan, 483TextSpan completionChangeSpan, 487TextSpan defaultSpan) 509TextSpan defaultSpan, 683var completionChangeSpan = completionChange.TextChange.Span;
Handler\Formatting\AbstractFormatDocumentHandlerBase.cs (2)
37var rangeSpan = (range != null) ? ProtocolConversions.RangeToTextSpan(range, text) : new TextSpan(0, root.FullSpan.Length); 38var formattingSpan = CommonFormattingHelpers.GetFormattingSpan(root, rangeSpan);
Handler\Highlights\DocumentHighlightHandler.cs (1)
80var keywordSpans = new List<TextSpan>();
Handler\InlayHint\InlayHintHandler.cs (1)
100var textSpan = ProtocolConversions.RangeToTextSpan(range, text);
Handler\InlineCompletions\InlineCompletionsHandler.cs (20)
174TextSpan snippetShortcut, 192var spanToFormat = TextSpan.FromBounds(textChange.Span.Start, snippetEndPosition); 205var spanContainingFormattedSnippet = TextSpan.FromBounds(snippetShortcut.Start, snippetEndPosition); 212foreach (var span in spans) 215var fieldInFormattedText = GetAdjustedSpan(formattingChanges, span); 216var fieldInSnippetContext = GetTextSpanInContextOfSnippet(fieldInFormattedText.Start, spanContainingFormattedSnippet.Start, fieldInFormattedText.Length); 224var caretInFormattedText = GetAdjustedSpan(formattingChanges, caretSpan.Value); 225var caretInSnippetContext = GetTextSpanInContextOfSnippet(caretInFormattedText.Start, spanContainingFormattedSnippet.Start, caretInFormattedText.Length); 234static TextSpan GetAdjustedSpan(ImmutableArray<TextChange> textChanges, TextSpan originalSpan) 241static TextSpan GetTextSpanInContextOfSnippet(int positionInFullText, int snippetPositionInFullText, int length) 243var offsetInSnippet = new TextSpan(positionInFullText - snippetPositionInFullText, length); 252private static async Task<(string ReplacedSnippetText, ImmutableDictionary<SnippetFieldPart, ImmutableArray<TextSpan>> Fields, TextSpan? CaretSpan)> GetReplacedSnippetTextAsync( 255TextSpan snippetSpan, 267var fieldOffsets = new Dictionary<SnippetFieldPart, ImmutableArray<TextSpan>>(); 269TextSpan? caretSpan = null; 292var fieldSpan = new TextSpan(locationInFinalSnippet, part.DefaultText.Length);
Handler\InlineCompletions\XmlSnippetParser.ParsedXmlSnippet.cs (1)
44public async Task<SnippetFunctionPart> WithSnippetFunctionResultAsync(Document documentWithSnippet, TextSpan fieldSpan, SimplifierOptions simplifierOptions, CancellationToken cancellationToken)
Handler\MapCode\MapCodeHandler.cs (2)
115async Task<ImmutableArray<(Document, TextSpan)>> ConvertFocusLocationsToDocumentAndSpansAsync( 122using var _ = ArrayBuilder<(Document, TextSpan)>.GetInstance(out var builder);
Handler\References\FindUsagesLSPContext.cs (1)
66private readonly HashSet<(string? filePath, TextSpan span)> _referenceLocations = [];
Handler\SemanticTokens\SemanticTokensHelpers.cs (3)
117ImmutableArray<TextSpan> textSpans, 198TextSpan textSpan; 209textSpan = TextSpan.FromBounds(Math.Min(absoluteStart, line.End), line.End);
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (15)
Completion\CompletionFeaturesTests.cs (2)
598var defaultItemSpan = GetDefaultCompletionListSpan(text, caretPosition); 891var defaultItemSpan = GetDefaultCompletionListSpan(text, caretPosition);
Diagnostics\AdditionalFileDiagnosticsTests.cs (1)
137location: Location.Create(context.AdditionalFile.Path, Text.TextSpan.FromBounds(0, 0), new Text.LinePositionSpan(new Text.LinePosition(0, 0), new Text.LinePosition(0, 0))), "args"));
InlayHint\AbstractInlayHintTests.cs (2)
28var span = TextSpan.FromBounds(0, text.Length);
InlayHint\CSharpInlayHintTests.cs (2)
123var span = TextSpan.FromBounds(0, sourceText.Length);
MapCode\MapCodeTests.cs (1)
35Document document, ImmutableArray<string> contents, ImmutableArray<(Document, TextSpan)> focusLocations, CancellationToken cancellationToken)
ProtocolConversionsTests.cs (4)
194var textSpan = ProtocolConversions.RangeToTextSpan(range, sourceText); 209var textSpan = ProtocolConversions.RangeToTextSpan(range, sourceText); 222var textSpan = ProtocolConversions.RangeToTextSpan(range, sourceText); 241var textSpan = ProtocolConversions.RangeToTextSpan(range, sourceText);
SpellCheck\SpellCheckTests.cs (3)
209{|Comment:// comment|}", out _, out IDictionary<string, ImmutableArray<TextSpan>> annotatedSpans); 494{|Comment:// comment|}", out _, out IDictionary<string, ImmutableArray<TextSpan>> annotatedSpans); 541private static int[] GetRanges(IDictionary<string, ImmutableArray<TextSpan>> annotatedSpans)
Microsoft.CodeAnalysis.LanguageServer.UnitTests (3)
Utilities\AbstractLanguageServerClientTests.cs (3)
40ImmutableDictionary<string, ImmutableArray<TextSpan>> spans; 95private protected static Dictionary<string, IList<LSP.Location>> GetAnnotatedLocations(DocumentUri codeUri, SourceText text, ImmutableDictionary<string, ImmutableArray<TextSpan>> spanMap) 110static LSP.Location ConvertTextSpanWithTextToLocation(TextSpan span, SourceText text, DocumentUri documentUri)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (403)
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\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
29string tokenText, int index, int offset, out TextSpan span) 173if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 241return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (5)
17/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 47public readonly TextSpan Span; 53public static VirtualChar Create(Rune rune, TextSpan span) 61public static VirtualChar Create(char surrogateChar, TextSpan span) 69private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 86public VirtualCharSequence GetSubSequence(TextSpan span) 165=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 178return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
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\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\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) 784public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 962var fullSpan = node.FullSpan;
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
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) 289internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 304return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 307internal static TextSpan GetElasticSpan(SyntaxToken token) 310private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 312var aggregateSpans = new List<TextSpan>(); 314var last = default(TextSpan); 315foreach (var span in spans) 323last = TextSpan.FromBounds(last.Start, span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
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\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\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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
424TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 427/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 428/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 430/// an empty <see cref="TextSpan"/> at position 0. 433TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 477bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
16public static void AddWordParts(string identifier, ref TemporaryArray<TextSpan> parts) 19public static void AddCharacterParts(string identifier, ref TemporaryArray<TextSpan> parts) 22public static void AddParts(string text, bool word, ref TemporaryArray<TextSpan> parts) 26var span = StringBreaker.GenerateSpan(text, start, word); 40public static TextSpan GenerateSpan(string identifier, int wordStart, bool word) 80private static TextSpan ScanCharacterRun(string identifier, int length, int wordStart) 101private static TextSpan ScanWordRun(string identifier, int length, int wordStart) 150private static TextSpan ScanLowerCaseRun(string identifier, int length, int wordStart) 161private static TextSpan ScanNumber(string identifier, int length, int wordStart) 169return TextSpan.FromBounds(wordStart, current);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (3)
47protected static TextSpan GetSpan(SyntaxNode node) 52return TextSpan.FromBounds(start.SpanStart, end.Span.End); 98var span = GetSpan(destination);
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\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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (1)
38public static bool IsNodeUnderselected(SyntaxNode? node, TextSpan selection)
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
32IEnumerable<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
128public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (2)
368using var parts = TemporaryArray<TextSpan>.Empty; 372var p = parts[i];
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (1)
17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
39return document.Text.ToString(TextSpan.FromBounds(tokenLine.Start, token.SpanStart));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (2)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxFactsService\ISyntaxFactsService.cs (1)
18Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameActionAnnotation.cs (2)
15TextSpan originalSpan, 28public readonly TextSpan OriginalSpan = originalSpan;
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameNodeSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameTokenSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (2)
56ImmutableArray<TextSpan> spans, 88ImmutableArray<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\ISimplificationService.cs (1)
32ImmutableArray<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractSimplifier.cs (1)
21out TextSpan issueSpan,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
56TextSpan span,
Microsoft.CodeAnalysis.PublicApiAnalyzers (369)
DeclarePublicApiAnalyzer.Impl.cs (1)
42private readonly record struct ApiLine(string Text, TextSpan Span, AdditionalFileInfo FileInfo)
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\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
29string tokenText, int index, int offset, out TextSpan span) 173if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 241return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (5)
17/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 47public readonly TextSpan Span; 53public static VirtualChar Create(Rune rune, TextSpan span) 61public static VirtualChar Create(char surrogateChar, TextSpan span) 69private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 86public VirtualCharSequence GetSubSequence(TextSpan span) 165=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 178return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
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\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\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) 784public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 962var fullSpan = node.FullSpan;
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
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) 289internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 304return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 307internal static TextSpan GetElasticSpan(SyntaxToken token) 310private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 312var aggregateSpans = new List<TextSpan>(); 314var last = default(TextSpan); 315foreach (var span in spans) 323last = TextSpan.FromBounds(last.Start, span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
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\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\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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
424TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 427/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 428/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 430/// an empty <see cref="TextSpan"/> at position 0. 433TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 477bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
16public static void AddWordParts(string identifier, ref TemporaryArray<TextSpan> parts) 19public static void AddCharacterParts(string identifier, ref TemporaryArray<TextSpan> parts) 22public static void AddParts(string text, bool word, ref TemporaryArray<TextSpan> parts) 26var span = StringBreaker.GenerateSpan(text, start, word); 40public static TextSpan GenerateSpan(string identifier, int wordStart, bool word) 80private static TextSpan ScanCharacterRun(string identifier, int length, int wordStart) 101private static TextSpan ScanWordRun(string identifier, int length, int wordStart) 150private static TextSpan ScanLowerCaseRun(string identifier, int length, int wordStart) 161private static TextSpan ScanNumber(string identifier, int length, int wordStart) 169return TextSpan.FromBounds(wordStart, current);
Microsoft.CodeAnalysis.Remote.ServiceHub (19)
Services\CodeLensReferences\RemoteCodeLensReferencesService.cs (5)
28private static async ValueTask<SyntaxNode?> TryFindNodeAsync(Solution solution, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) 43public async ValueTask<ReferenceCount?> GetReferenceCountAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, int maxResultCount, CancellationToken cancellationToken) 66public async ValueTask<ImmutableArray<ReferenceLocationDescriptor>?> FindReferenceLocationsAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) 84public async ValueTask<ImmutableArray<ReferenceMethodDescriptor>?> FindReferenceMethodsAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) 102public ValueTask<string?> GetFullyQualifiedNameAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken)
Services\ConvertTupleToStructCodeRefactoringProvider\RemoteConvertTupleToStructCodeRefactoringService.cs (2)
30TextSpan span, 54private static async Task<(DocumentId, TextSpan)> GetRenamedTokenAsync(
Services\DiagnosticAnalyzer\DiagnosticComputer.cs (3)
57private readonly TextSpan? _span; 67TextSpan? span, 86TextSpan? span,
Services\FullyQualify\RemoteFullyQualifyService.cs (1)
26public ValueTask<FullyQualifyFixData?> GetFixDataAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan span, CancellationToken cancellationToken)
Services\InheritanceMargin\RemoteInheritanceMarginService.cs (1)
31TextSpan spanToSearch,
Services\MissingImportDiscovery\RemoteMissingImportDiscoveryService.cs (2)
33TextSpan span, 63TextSpan span,
Services\SemanticClassification\RemoteSemanticClassificationService.Caching.cs (2)
85DocumentKey documentKey, ImmutableArray<TextSpan> textSpans, ClassificationType type, Checksum checksum, CancellationToken cancellationToken) 153var fullSpan = new TextSpan(0, text.Length);
Services\SemanticClassification\RemoteSemanticClassificationService.cs (1)
25ImmutableArray<TextSpan> spans,
Services\SymbolFinder\RemoteSymbolFinderService.cs (1)
187public ValueTask OnReferenceFoundAsync(Document document, TextSpan span, CancellationToken cancellationToken)
Services\ValueTracking\RemoteValueTrackingService.cs (1)
28public ValueTask<ImmutableArray<SerializableValueTrackedItem>> TrackValueSourceAsync(Checksum solutionChecksum, TextSpan selection, DocumentId documentId, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.ResxSourceGenerator (368)
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\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
29string tokenText, int index, int offset, out TextSpan span) 173if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 241return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (5)
17/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 47public readonly TextSpan Span; 53public static VirtualChar Create(Rune rune, TextSpan span) 61public static VirtualChar Create(char surrogateChar, TextSpan span) 69private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 86public VirtualCharSequence GetSubSequence(TextSpan span) 165=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 178return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
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\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\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) 784public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 962var fullSpan = node.FullSpan;
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
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) 289internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 304return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 307internal static TextSpan GetElasticSpan(SyntaxToken token) 310private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 312var aggregateSpans = new List<TextSpan>(); 314var last = default(TextSpan); 315foreach (var span in spans) 323last = TextSpan.FromBounds(last.Start, span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
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\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\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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
424TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 427/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 428/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 430/// an empty <see cref="TextSpan"/> at position 0. 433TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 477bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
16public static void AddWordParts(string identifier, ref TemporaryArray<TextSpan> parts) 19public static void AddCharacterParts(string identifier, ref TemporaryArray<TextSpan> parts) 22public static void AddParts(string text, bool word, ref TemporaryArray<TextSpan> parts) 26var span = StringBreaker.GenerateSpan(text, start, word); 40public static TextSpan GenerateSpan(string identifier, int wordStart, bool word) 80private static TextSpan ScanCharacterRun(string identifier, int length, int wordStart) 101private static TextSpan ScanWordRun(string identifier, int length, int wordStart) 150private static TextSpan ScanLowerCaseRun(string identifier, int length, int wordStart) 161private static TextSpan ScanNumber(string identifier, int length, int wordStart) 169return TextSpan.FromBounds(wordStart, current);
Microsoft.CodeAnalysis.Test.Utilities (33)
Diagnostics\CommonDiagnosticAnalyzers.cs (5)
884private readonly TextSpan _badSpan; 894public AnalyzerWithInvalidDiagnosticSpan(TextSpan badSpan) => _badSpan = badSpan; 2620private readonly TextSpan _diagnosticSpan; 2622public AdditionalFileAnalyzer(bool registerFromInitialize, TextSpan diagnosticSpan, string id = "ID0001") 3092public TextSpan? CallbackFilterSpan { get; private set; }
Diagnostics\DiagnosticsHelper.cs (1)
18private static TextSpan FindSpan(string source, string pattern)
Diagnostics\SuppressMessageAttributeTests.cs (1)
1395MarkupTestFile.GetSpans(markup, out var source, out ImmutableArray<TextSpan> spans);
Diagnostics\SuppressMessageAttributeTests.DiagnosticAnalyzers.cs (2)
224private readonly IList<TextSpan> _spans; 226public WarningOnTokenAnalyzer(IList<TextSpan> spans)
MarkedSource\MarkupTestFile.cs (19)
53string input, bool treatPositionIndicatorsAsCode, out string output, out int? position, out IDictionary<string, ArrayBuilder<TextSpan>> spans) 56var tempSpans = new Dictionary<string, ArrayBuilder<TextSpan>>(); 193IDictionary<string, ArrayBuilder<TextSpan>> spans, 198var span = TextSpan.FromBounds(matchIndex, finalIndex); 199GetOrAdd(spans, name, _ => ArrayBuilder<TextSpan>.GetInstance()).Add(span); 212string input, out string output, out int? cursorPositionOpt, out ImmutableArray<TextSpan> spans, 217var builder = GetOrAdd(dictionary, string.Empty, _ => ArrayBuilder<TextSpan>.GetInstance()); 223string input, out string output, out int? cursorPositionOpt, out IDictionary<string, ImmutableArray<TextSpan>> spans, 230public static void GetSpans(string input, out string output, out IDictionary<string, ImmutableArray<TextSpan>> spans, 234public static void GetPositionAndSpans(string input, out string output, out int cursorPosition, out ImmutableArray<TextSpan> spans) 241=> GetPositionAndSpans(input, out output, out cursorPosition, out ImmutableArray<TextSpan> spans); 246public static void GetPositionAndSpan(string input, out string output, out int? cursorPosition, out TextSpan? textSpan) 248GetPositionAndSpans(input, out output, out cursorPosition, out ImmutableArray<TextSpan> spans); 249textSpan = spans.Length == 0 ? null : (TextSpan?)spans.Single(); 252public static void GetPositionAndSpan(string input, out string output, out int cursorPosition, out TextSpan textSpan) 258public static void GetSpans(string input, out string output, out ImmutableArray<TextSpan> spans) 263public static void GetSpan(string input, out string output, out TextSpan textSpan) 265GetSpans(input, out output, out ImmutableArray<TextSpan> spans);
MarkedSource\SourceWithMarkedNodes.MarkedSpan.cs (4)
13public readonly TextSpan MarkedSyntax; 14public readonly TextSpan MatchedSpan; 20public MarkedSpan(TextSpan markedSyntax, TextSpan matchedSpan, string tagName, int syntaxKind, int id, int parentId)
Metadata\ILValidation.cs (1)
472var span = text.Lines.GetTextSpan(lineSpan);
Microsoft.CodeAnalysis.UnitTests (69)
CommonSyntaxTests.cs (6)
53Assert.Equal(default(TextSpan), d.FullSpan); 54Assert.Equal(default(TextSpan), d.Span); 70Assert.Equal(default(TextSpan), d.FullSpan); 71Assert.Equal(default(TextSpan), d.Span); 119var correctSpan = csharpTrivia.Span; 156var correctSpan = vbTrivia.Span;
Diagnostics\SarifErrorLoggerTests.cs (1)
35var span = new TextSpan(0, 0);
Diagnostics\SuppressMessageTargetSymbolResolverTests.cs (2)
1339out var source, out var pos, out IDictionary<string, ImmutableArray<TextSpan>> spans); 1356foreach (var span in spans.Values.First())
Text\SourceTextTests.cs (5)
191var span = new TextSpan(0, 1); 428sourceText.Write(writer, TextSpan.FromBounds(1, sourceText.Length)); 441public void WriteWithAllRanges(TextSpan span) 456SourceText.From("ABC").Write(TextWriter.Null, TextSpan.FromBounds(4, 4))); 465SourceText.From("ABC").Write(TextWriter.Null, TextSpan.FromBounds(2, 4)));
Text\StringText_LineTest.cs (5)
20var span = new TextSpan(0, 3); 31var span = TextSpan.FromBounds(0, text.Length); 42var span = TextSpan.FromBounds(0, text.Length);
Text\TextChangeRangeTest.cs (1)
26var span = new TextSpan(2, 50);
Text\TextSpanTest.cs (49)
21var span = new TextSpan(0, 42); 30var span = new TextSpan(1, 40); 42var span = new TextSpan(0, 0); 50var s1 = new TextSpan(1, 40); 51var s2 = new TextSpan(1, 40); 64var s1 = new TextSpan(1, 40); 65var s2 = new TextSpan(2, 40); 78var s1 = new TextSpan(1, 5); 79var s2 = new TextSpan(1, 40); 89TextSpan span = new TextSpan(0, 0); 100TextSpan span = new TextSpan(0, 1); 112TextSpan span = new TextSpan(15, 1485); 122TextSpan span = new TextSpan(0, int.MaxValue - 1); 131TextSpan span = new TextSpan(0, 10); 141TextSpan span_05_15 = new TextSpan(5, 10); 142TextSpan span_03_10 = new TextSpan(3, 7); 143TextSpan span_10_11 = new TextSpan(10, 1); 144TextSpan span_00_03 = new TextSpan(0, 3); 201TextSpan span1 = new TextSpan(0, 10); 202TextSpan span2 = new TextSpan(0, 10); 218TextSpan span1 = new TextSpan(0, 10); 219TextSpan span2 = new TextSpan(0, 11); 220TextSpan span3 = new TextSpan(1, 11); 236TextSpan span1 = new TextSpan(10, 10); // 10..20 237TextSpan span2 = new TextSpan(5, 5); // 5..10 248TextSpan span1 = new TextSpan(10, 10); // 10..20 249TextSpan span2 = new TextSpan(5, 2); // 5..7 260TextSpan span1 = new TextSpan(10, 10); // 10..20 261TextSpan span2 = new TextSpan(5, 10); // 5..15 272TextSpan span1 = new TextSpan(10, 0); // [10, 10) 273TextSpan span2 = new TextSpan(10, 0); // [10, 10) 284TextSpan span1 = new TextSpan(10, 0); // [10, 10) 285TextSpan span2 = new TextSpan(5, 10); // [5, 15) 296TextSpan span1 = new TextSpan(10, 10); // 10..20 297TextSpan span2 = new TextSpan(5, 5); // 5..10 308TextSpan span1 = new TextSpan(10, 10); // 10..20 309TextSpan span2 = new TextSpan(5, 2); // 5..7 320TextSpan span1 = new TextSpan(10, 10); // 10..20 321TextSpan span2 = new TextSpan(5, 10); // 5..15 332TextSpan span1 = new TextSpan(10, 0); // [10, 10) 333TextSpan span2 = new TextSpan(10, 0); // [10, 10) 344TextSpan span1 = new TextSpan(2, 5); // [2, 7) 345TextSpan span2 = new TextSpan(7, 5); // [7, 12) 356TextSpan span1 = new TextSpan(2, 5); // [2, 7) 357TextSpan span2 = new TextSpan(3, 0); // [3, 3) 368TextSpan span1 = new TextSpan(2, 5); // [2, 7) 369TextSpan span2 = new TextSpan(2, 0); // [2, 2) 380TextSpan span1 = new TextSpan(2, 5); // [2, 7) 381TextSpan span2 = new TextSpan(7, 0); // [7, 0)
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)
3519Friend 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)
1707Dim unusedBuilder As ArrayBuilder(Of TextSpan) = Nothing 1732unusedBuilder = ArrayBuilder(Of TextSpan).GetInstance() 1761Private Sub AddImportsDependencies(diagnostics As BindingDiagnosticBag, infoTree As SyntaxTree, clauseSpan As TextSpan) 1833Public ReadOnly StatementSpan As TextSpan 1834Public ReadOnly ClauseSpans As ImmutableArray(Of TextSpan) 1844Dim builder = ArrayBuilder(Of TextSpan).GetInstance() 2180Dim location = tree.GetLocation(TextSpan.FromBounds(0, 0)) 2213Private Sub AddClsComplianceDiagnostics(diagnostics As BindingDiagnosticBag, cancellationToken As CancellationToken, Optional filterTree As SyntaxTree = Nothing, Optional filterSpanWithinTree As TextSpan? = Nothing) 2234Private Shared Iterator Function FilterDiagnosticsByLocation(diagnostics As IEnumerable(Of Diagnostic), tree As SyntaxTree, filterSpanWithinTree As TextSpan?) As IEnumerable(Of Diagnostic) 2244filterSpanWithinTree As TextSpan?, 2301Private 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)
2566Public Sub New(syntax As SyntaxNode, statementOpt As BoundStatement, span As TextSpan, Optional hasErrors As Boolean = False) 2580Private ReadOnly _Span As TextSpan 2581Public ReadOnly Property Span As TextSpan 2592Public 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\Compilers\VisualBasic\BasicAnalyzerDriver\VisualBasicDeclarationComputer.vb (1)
17span 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)
898Friend Overridable Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean Implements ISymbolInternal.IsDefinedInSourceTree 918Friend 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 234Private ReadOnly _elementSpan As TextSpan 240elementSpan As TextSpan, 256Private 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\Analyzers\VisualBasic\Analyzers\RemoveUnnecessaryCast\VisualBasicRemoveUnnecessaryCastDiagnosticAnalyzer.vb (1)
35Protected Overrides Function GetFadeSpan(node As ExpressionSyntax) As TextSpan
src\Analyzers\VisualBasic\Analyzers\RemoveUnnecessaryImports\VisualBasicRemoveUnnecessaryImportsDiagnosticAnalyzer.vb (1)
56nodes As IEnumerable(Of SyntaxNode), tree As SyntaxTree, cancellationToken As CancellationToken) As IEnumerable(Of TextSpan)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\FormattingResult.vb (1)
21Friend Sub New(treeInfo As TreeData, tokenStream As TokenStream, spanToFormat As TextSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
96Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.vb (1)
58Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
89Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Indentation\VisualBasicSmartTokenFormatter.vb (1)
41Dim spans = SpecializedCollections.SingletonEnumerable(TextSpan.FromBounds(previousToken.SpanStart, token.Span.End))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (4)
807Public Function GetMemberBodySpanForSpeculativeBinding(node As SyntaxNode) As TextSpan Implements ISyntaxFacts.GetMemberBodySpanForSpeculativeBinding 830Return TextSpan.FromBounds(spanStart, method.EndBlockStatement.SpanStart) 1089Public Function GetInactiveRegionSpanAroundPosition(tree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As TextSpan Implements ISyntaxFacts.GetInactiveRegionSpanAroundPosition 1420Public Function ContainsInterleavedDirective(span As TextSpan, token As SyntaxToken, cancellationToken As CancellationToken) As Boolean Implements ISyntaxFacts.ContainsInterleavedDirective
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (13)
src\Analyzers\VisualBasic\CodeFixes\GenerateDefaultConstructors\VisualBasicGenerateDefaultConstructorsService.vb (1)
24semanticDocument As SemanticDocument, textSpan As TextSpan, cancellationToken As CancellationToken,
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\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\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (1)
221Public Function GetImplicitMemberAccessExpressions(expression As SyntaxNode, span As TextSpan) As IEnumerable(Of ExpressionSyntax)
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSymbolDeclarationService.vb (1)
51Public Overrides ReadOnly Property Span As TextSpan
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.CommandLine.UnitTests (1)
CommandLineTests.vb (1)
11119Private Sub ReportDiagnostic(path As String, context As CompilationAnalysisContext, Optional span As TextSpan = Nothing)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (7)
AutomaticCompletion\AutomaticLineEnderCommandHandler.vb (1)
91Dim endingString = text.ToString(TextSpan.FromBounds(nonMissingToken.Span.End, line.End))
EndConstructGeneration\EndConstructCommandHandler.vb (2)
173Private Shared Function GetSpanToCleanup(statement As StatementSyntax) As TextSpan 180Return TextSpan.FromBounds(If(previousToken.Kind <> SyntaxKind.None, previousToken, firstToken).SpanStart,
EndConstructGeneration\VisualBasicEndConstructGenerationService.vb (1)
274Dim span = TextSpan.FromBounds(asSingleLine.IfKeyword.SpanStart, asSingleLine.ThenKeyword.Span.End)
LineCommit\ContainingStatementInfo.vb (3)
13Public ReadOnly TextSpan As TextSpan 20Public Sub New(node As SyntaxNode, span As TextSpan) 186Return New ContainingStatementInfo(node, TextSpan.FromBounds(attributes.Last.Span.End, node.Span.End))
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)
23span 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\Analyzers\VisualBasic\Analyzers\RemoveUnnecessaryCast\VisualBasicRemoveUnnecessaryCastDiagnosticAnalyzer.vb (1)
35Protected Overrides Function GetFadeSpan(node As ExpressionSyntax) As TextSpan
src\Analyzers\VisualBasic\Analyzers\RemoveUnnecessaryImports\VisualBasicRemoveUnnecessaryImportsDiagnosticAnalyzer.vb (1)
56nodes As IEnumerable(Of SyntaxNode), tree As SyntaxTree, cancellationToken As CancellationToken) As IEnumerable(Of TextSpan)
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\Analyzers\VisualBasic\CodeFixes\GenerateDefaultConstructors\VisualBasicGenerateDefaultConstructorsService.vb (1)
24semanticDocument As SemanticDocument, textSpan As TextSpan, cancellationToken As CancellationToken,
src\Compilers\VisualBasic\BasicAnalyzerDriver\VisualBasicDeclarationComputer.vb (1)
17span 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.Features.UnitTests (11)
EditAndContinue\BreakpointSpansTests.vb (5)
38Dim expectedSpan As TextSpan? = Nothing 44Dim breakpointSpan As TextSpan 68Dim expectedSpans As ImmutableArray(Of TextSpan) = Nothing 83Public Shared Iterator Function GetBreakpointSequence(root As SyntaxNode, position As Integer) As IEnumerable(Of TextSpan) 87Dim span As TextSpan = Nothing
EditAndContinue\Helpers\EditingTestBase.vb (2)
150syntaxMap As IEnumerable(Of (TextSpan, TextSpan)),
EditAndContinue\VisualBasicEditAndContinueAnalyzerTests.vb (4)
65Private Shared Iterator Function GetExpectedPositionsAndSpans(source As String) As IEnumerable(Of KeyValuePair(Of Integer, TextSpan)) 80Dim span As TextSpan 86span = TextSpan.FromBounds(source.IndexOf(s_startSpanMark, start, length, StringComparison.Ordinal) + s_startSpanMark.Length, 99Dim span As TextSpan?
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (23)
Diagnostics\DiagnosticAnalyzerTests.vb (1)
1673expectedDiagnosticSpan As TextSpan,
FlowAnalysis\FlowTestBase.vb (2)
83Dim spans As IEnumerable(Of IEnumerable(Of TextSpan)) = Nothing 163Private Sub FindRegionNodes(tree As SyntaxTree, region As TextSpan,
SourceGeneration\GeneratorDriverTests.vb (20)
224gen001, TextSpan.FromBounds(1, 4), 229gen001, TextSpan.FromBounds(19, 22), 239gen001, TextSpan.FromBounds(26, 29), 246gen001, TextSpan.FromBounds(60, 63), 312location:=Location.Create(syntaxTree, TextSpan.FromBounds(2, 4)))) 343location:=Location.Create(validSyntaxTree, TextSpan.FromBounds(2, 4)), 344additionalLocations:={Location.Create(invalidSyntaxTree, TextSpan.FromBounds(2, 4))})) 374location:=Location.Create(syntaxTree, TextSpan.FromBounds(2, 4)))) 404location:=Location.Create(validSyntaxTree, TextSpan.FromBounds(2, 4)), 405additionalLocations:={Location.Create(invalidSyntaxTree, TextSpan.FromBounds(2, 4))})) 434location:=Location.Create(syntaxTree, TextSpan.FromBounds(2, 100)))) 464location:=Location.Create(syntaxTree, TextSpan.FromBounds(2, 4)), 465additionalLocations:={Location.Create(syntaxTree, TextSpan.FromBounds(2, 100))})) 495location:=Location.Create(syntaxTree, TextSpan.FromBounds(2, 100)))) 524location:=Location.Create(syntaxTree, TextSpan.FromBounds(2, 4)), 525additionalLocations:={Location.Create(syntaxTree, TextSpan.FromBounds(2, 100))})) 554location:=Location.Create(syntaxTree, TextSpan.FromBounds(2, 4)))) 584location:=Location.Create(syntaxTree, TextSpan.FromBounds(2, 4)))) 742Shared Sub VerifyDiagnosticsWithSource(source As String, diag As Diagnostic, location As TextSpan, ParamArray expected As DiagnosticDescription()) 783Return x.Diagnostic.WithLocation(Location.Create(syntaxTree, TextSpan.FromBounds(start, endpoint)))
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (8)
SymbolsTests\AnonymousTypes\AnonymousTypesSemanticsTests.vb (3)
1923Dim span As TextSpan = node.Span 1965Dim spans As New List(Of TextSpan) 1998Private Shared Sub ExtractTextIntervals(text As XElement, nodes As List(Of TextSpan))
SymbolsTests\MyBaseMyClassSemanticsTests.vb (3)
78Dim span As TextSpan = node.Span 109Dim spans As New List(Of TextSpan) 142Private Shared Sub ExtractTextIntervals(text As XElement, nodes As List(Of TextSpan))
SymbolsTests\WithStatementSymbolsTests.vb (2)
264Dim spans As New List(Of TextSpan) 297Private Shared Sub ExtractTextIntervals(text As XElement, nodes As List(Of TextSpan))
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (12)
IncrementalParser\IncrementalParser.vb (3)
1520New TextChange(TextSpan.FromBounds(8, 8), "System" + vbCrLf + "Imports "), 1521New TextChange(TextSpan.FromBounds(29, 45), "")) 1554Dim newText = oldText.Replace(TextSpan.FromBounds(startOfOld, endOfOld), newSource.Substring(startOfNew, endOfNew - startOfNew + 1))
LocationTests.vb (1)
55Private Function GetSpanIn(tree As SyntaxTree, textToFind As String) As TextSpan
TestSyntaxNodes.vb (8)
220Private Sub VerifyListSpans(Of T As VisualBasicSyntaxNode)(list As SyntaxList(Of T), expectedFullSpan As TextSpan) 242Private Sub VerifyListSpans(list As ChildSyntaxList, expectedFullSpan As TextSpan) 264Private Sub VerifyListSpans(list As SyntaxNodeOrTokenList, expectedFullSpan As TextSpan) 288Private Sub VerifyListSpans(list As SyntaxTokenList, expectedFullSpan As TextSpan) 307Private Sub VerifyListSpans(list As SyntaxTriviaList, expectedFullSpan As TextSpan) 412VerifyListSpans(statements, TextSpan.FromBounds(statements(0).FullSpan.Start, statements(statements.Count - 1).FullSpan.End)) 943Private Sub CheckErrorList(node As VisualBasicSyntaxNode, expectedErrorCodes As Integer(), expectedSpans As TextSpan()) 965Private Sub CheckErrorList(node As SyntaxToken, expectedErrorCodes As Integer(), expectedSpans As TextSpan())
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (7)
BasicTestSource.vb (1)
30Optional ByRef spans As IEnumerable(Of IEnumerable(Of TextSpan)) = Nothing) As SyntaxTree()
CompilationTestUtils.vb (4)
300Optional ByRef spans As IEnumerable(Of IEnumerable(Of TextSpan)) = Nothing) As IEnumerable(Of SyntaxTree) 375Optional ByRef spans As IEnumerable(Of IEnumerable(Of TextSpan)) = Nothing, 646Public Function CreateParseTreeAndSpans(programElement As XElement, Optional parseOptions As VisualBasicParseOptions = Nothing) As (tree As SyntaxTree, spans As IList(Of TextSpan)) 649Dim spans As ImmutableArray(Of TextSpan) = Nothing
DiagnosticExtensions.vb (1)
23Friend Function GetDiagnosticsForSyntaxTree(c As VisualBasicCompilation, stage As CompilationStage, tree As SyntaxTree, Optional filterSpan As TextSpan? = Nothing) As ImmutableArray(Of Diagnostic)
ParserTestUtilities.vb (1)
213Public changeSpan As TextSpan
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
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
LanguageServices\FixAllSpanMappingService\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)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\FormattingResult.vb (1)
21Friend Sub New(treeInfo As TreeData, tokenStream As TokenStream, spanToFormat As TextSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
96Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.vb (1)
58Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
89Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Indentation\VisualBasicSmartTokenFormatter.vb (1)
41Dim spans = SpecializedCollections.SingletonEnumerable(TextSpan.FromBounds(previousToken.SpanStart, token.Span.End))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (4)
807Public Function GetMemberBodySpanForSpeculativeBinding(node As SyntaxNode) As TextSpan Implements ISyntaxFacts.GetMemberBodySpanForSpeculativeBinding 830Return TextSpan.FromBounds(spanStart, method.EndBlockStatement.SpanStart) 1089Public Function GetInactiveRegionSpanAroundPosition(tree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As TextSpan Implements ISyntaxFacts.GetInactiveRegionSpanAroundPosition 1420Public Function ContainsInterleavedDirective(span As TextSpan, token As SyntaxToken, cancellationToken As CancellationToken) As Boolean Implements ISyntaxFacts.ContainsInterleavedDirective
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\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\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (1)
221Public Function GetImplicitMemberAccessExpressions(expression As SyntaxNode, span As TextSpan) As IEnumerable(Of ExpressionSyntax)
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSymbolDeclarationService.vb (1)
51Public Overrides ReadOnly Property Span As TextSpan
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.VisualBasic.Workspaces.UnitTests (5)
Formatting\VisualBasicFormattingTestBase.vb (4)
63Dim spans = New List(Of TextSpan)() 72spans = New List(Of TextSpan)() 85Dim spans As ImmutableArray(Of TextSpan) = Nothing 103spans As IEnumerable(Of TextSpan),
VisualBasicSyntaxFactsServiceTests.vb (1)
507Dim span As TextSpan
Microsoft.CodeAnalysis.Workspaces (816)
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)
11public readonly struct ClassifiedSpan(TextSpan textSpan, string classificationType) : IEquatable<ClassifiedSpan> 14public TextSpan TextSpan { get; } = textSpan; 16public 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, 54ImmutableArray<TextSpan> spans, 92var widenedSpan = new TextSpan(spans[0].Start, spans[^1].End); 110TextSpan widenedSpan) 155private static void AdjustSpans(SegmentedList<ClassifiedSpan> spans, TextSpan widenedSpan) 203TextSpan.FromBounds( 236Func<TClassifiedSpan, TextSpan> getSpan, 237Func<TClassifiedSpan, TextSpan, TClassifiedSpan> createSpan) 262var syntacticPartSpan = getSpan(syntacticPart); 286var firstSemanticPartSpan = getSpan(firstSemanticPart); 287var lastSemanticPartSpan = getSpan(lastSemanticPart); 294finalParts.Add(createSpan(syntacticPart, TextSpan.FromBounds( 304var semanticPart1Span = getSpan(semanticPart1); 305var semanticPart2Span = getSpan(semanticPart2); 312finalParts.Add(createSpan(syntacticPart, TextSpan.FromBounds( 320finalParts.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 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\FixAllContextHelper.cs (2)
110IEnumerable<KeyValuePair<Document, ImmutableArray<TextSpan>>> documentsAndSpans) 115foreach (var span in spans)
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\DocumentBasedFixAllProvider.cs (2)
25/// <see cref="FixAllAsync(FixAllContext, Document, Optional{ImmutableArray{TextSpan}})"/> is invoked for each document for implementors to process. 59protected abstract Task<Document?> FixAllAsync(FixAllContext fixAllContext, Document document, Optional<ImmutableArray<TextSpan>> fixAllSpans);
CodeRefactorings\FixAllOccurences\FixAllContext.cs (1)
94public Task<ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>> GetFixAllSpansAsync(CancellationToken cancellationToken)
CodeRefactorings\FixAllOccurences\FixAllProvider.cs (5)
53public static FixAllProvider Create(Func<FixAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> fixAllAsync) 73Func<FixAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> fixAllAsync, 80Func<FixAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> fixAllAsync, 97Func<FixAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> fixAllAsync, 103protected override Task<Document?> FixAllAsync(FixAllContext context, Document document, Optional<ImmutableArray<TextSpan>> fixAllSpans)
CodeRefactorings\FixAllOccurences\FixAllState.cs (9)
28private readonly TextSpan _selectionSpan; 37TextSpan selectionSpan, 49TextSpan selectionSpan, 62TextSpan selectionSpan, 90internal async Task<ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>> GetFixAllSpansAsync(CancellationToken cancellationToken) 99return ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>.Empty; 103return spansByDocument.Select(kvp => KeyValuePair.Create(kvp.Key, new Optional<ImmutableArray<TextSpan>>(kvp.Value))) 120return ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>.Empty; 123return documentsToFix.ToImmutableDictionary(d => d, _ => default(Optional<ImmutableArray<TextSpan>>));
CodeRefactorings\SyntaxEditorBasedCodeRefactoringProvider.cs (3)
39TextSpan fixAllSpan, 50Optional<ImmutableArray<TextSpan>> fixAllSpans, 81ImmutableArray<TextSpan> fixAllSpans,
Diagnostics\CompilationWithAnalyzersPair.cs (3)
78public async Task<AnalysisResultPair?> GetAnalysisResultAsync(SyntaxTree tree, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> projectAnalyzers, ImmutableArray<DiagnosticAnalyzer> hostAnalyzers, CancellationToken cancellationToken) 90public async Task<AnalysisResultPair?> GetAnalysisResultAsync(AdditionalText file, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> projectAnalyzers, ImmutableArray<DiagnosticAnalyzer> hostAnalyzers, CancellationToken cancellationToken) 102public async Task<AnalysisResultPair?> GetAnalysisResultAsync(SemanticModel model, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> projectAnalyzers, ImmutableArray<DiagnosticAnalyzer> hostAnalyzers, CancellationToken cancellationToken)
Diagnostics\DiagnosticArguments.cs (2)
44public TextSpan? DocumentSpan; 76TextSpan? documentSpan,
Diagnostics\DiagnosticDataLocation.cs (1)
104public DiagnosticDataLocation WithSpan(TextSpan newSourceSpan, SyntaxTree tree)
Diagnostics\DocumentAnalysisScope.cs (3)
23TextSpan? span, 43public TextSpan? Span { get; } 62public DocumentAnalysisScope WithSpan(TextSpan? span)
Diagnostics\Extensions.cs (6)
61var span = dataLocation.UnmappedFileSpan.GetClampedTextSpan(text); 246TextSpan? span, 262TextSpan? span, 308TextSpan? filterSpan = null) 428TextSpan? span, 530public static IEnumerable<DiagnosticData> ConvertToLocalDiagnostics(IEnumerable<Diagnostic> diagnostics, TextDocument targetTextDocument, TextSpan? span = null)
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)
201var 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; 259ref Dictionary<InterceptsLocationData, TextSpan>? interceptsLocationInfo,
FindSymbols\SyntaxTree\SyntaxTreeIndex_Forwarders.cs (1)
74public bool TryGetInterceptsLocation(InterceptsLocationData data, out TextSpan span)
FindSymbols\SyntaxTree\SyntaxTreeIndex_Persistence.cs (1)
84Dictionary<InterceptsLocationData, TextSpan>? interceptsLocationInfo = null;
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (4)
48TextSpan span, 85public readonly TextSpan Span = span; 119TextSpan span, 205var span = new TextSpan(spanStart, spanLength);
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) 203public static SyntaxNode Format(SyntaxNode node, TextSpan span, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 206internal static SyntaxNode Format(SyntaxNode node, TextSpan span, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken) 218public static SyntaxNode Format(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 221private static SyntaxNode Format(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 227internal static SyntaxNode Format(SyntaxNode node, IEnumerable<TextSpan>? spans, SolutionServices services, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 230private static IFormattingResult? GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 254internal static IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SolutionServices services, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 283public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, TextSpan span, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 286internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, TextSpan span, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken = default) 298public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 301internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken = default) 304private static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken) 312internal 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);
LanguageServices\FixAllSpanMappingService\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,
LanguageServices\FixAllSpanMappingService\IFixAllSpanMappingService.cs (2)
30Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 31Document document, TextSpan triggerSpan, FixAllScope fixAllScope, CancellationToken cancellationToken);
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)
167using var candidateHumps = TemporaryArray<TextSpan>.Empty; 257var hump = TextSpan.FromBounds(candidateHumps[i].Start, candidateLength); 307private TextSpan? GetMatchedSpan(int start, int length) 429private bool PartStartsWith(string candidate, TextSpan candidatePart, string pattern, TextSpan patternPart, CompareOptions compareOptions) 450private bool PartStartsWith(string candidate, TextSpan candidatePart, string pattern, CompareOptions compareOptions) 458in TemporaryArray<TextSpan> candidateHumps) 505in TemporaryArray<TextSpan> candidateHumps, 507out ImmutableArray<TextSpan> matchedSpans) 515in TemporaryArray<TextSpan> candidateHumps, 518out ImmutableArray<TextSpan> matchedSpans) 535using var matchSpans = TemporaryArray<TextSpan>.Empty; 560var candidateHump = candidateHumps[currentCandidateHump]; 569var patternChunkCharacterSpan = patternHumps[currentPatternHump];
PatternMatching\PatternMatcher.TextChunk.cs (2)
32public TemporaryArray<TextSpan> PatternHumps; 45PatternHumps = 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)
76public readonly TextSpan ComplexifiedSpan; 80public readonly TextSpan OriginalIdentifierSpan; 369var originalLocation = conflictAnnotation.OriginalSpan; 884private static ImmutableSortedSet<TextSpan>? GetSubSpansToRenameInStringAndCommentTextSpans( 885TextSpan containingLocationForStringOrComment, 888var builder = ImmutableSortedSet.CreateBuilder<TextSpan>(); 903var 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; 183var oldSpan = annotationAndNode.Item1.OriginalTextSpan; 189var modifiedSubSpans = new List<(TextSpan oldSpan, TextSpan newSpan)>(); 224public ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> GetDocumentToModifiedSpansMap() 226var 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; 211ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> documentToModifiedSpansMap, 231public readonly ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> DocumentToModifiedSpansMap = documentToModifiedSpansMap;
Rename\LightweightRenameLocations.cs (1)
120public 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)
246ImmutableSortedSet<TextSpan>? subSpansToReplace = null) 262foreach (var subSpan in subSpansToReplace)
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (3)
407IEnumerable<Tuple<string, int, TextSpan>> renameStringsAndPositions, 415var containingSpan = renameStringAndPosition.Item3; 426var 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\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\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
29string tokenText, int index, int offset, out TextSpan span) 173if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 241return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (5)
17/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 47public readonly TextSpan Span; 53public static VirtualChar Create(Rune rune, TextSpan span) 61public static VirtualChar Create(char surrogateChar, TextSpan span) 69private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 86public VirtualCharSequence GetSubSequence(TextSpan span) 165=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 178return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
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\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\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) 784public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 962var fullSpan = node.FullSpan;
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
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) 289internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 304return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 307internal static TextSpan GetElasticSpan(SyntaxToken token) 310private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 312var aggregateSpans = new List<TextSpan>(); 314var last = default(TextSpan); 315foreach (var span in spans) 323last = TextSpan.FromBounds(last.Start, span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
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\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\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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
424TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 427/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 428/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 430/// an empty <see cref="TextSpan"/> at position 0. 433TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 477bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
16public static void AddWordParts(string identifier, ref TemporaryArray<TextSpan> parts) 19public static void AddCharacterParts(string identifier, ref TemporaryArray<TextSpan> parts) 22public static void AddParts(string text, bool word, ref TemporaryArray<TextSpan> parts) 26var span = StringBreaker.GenerateSpan(text, start, word); 40public static TextSpan GenerateSpan(string identifier, int wordStart, bool word) 80private static TextSpan ScanCharacterRun(string identifier, int length, int wordStart) 101private static TextSpan ScanWordRun(string identifier, int length, int wordStart) 150private static TextSpan ScanLowerCaseRun(string identifier, int length, int wordStart) 161private static TextSpan ScanNumber(string identifier, int length, int wordStart) 169return TextSpan.FromBounds(wordStart, current);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (3)
47protected static TextSpan GetSpan(SyntaxNode node) 52return TextSpan.FromBounds(start.SpanStart, end.Span.End); 98var span = GetSpan(destination);
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\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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (1)
38public static bool IsNodeUnderselected(SyntaxNode? node, TextSpan selection)
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
32IEnumerable<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
128public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (2)
368using var parts = TemporaryArray<TextSpan>.Empty; 372var p = parts[i];
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (1)
17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
39return document.Text.ToString(TextSpan.FromBounds(tokenLine.Start, token.SpanStart));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (2)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxFactsService\ISyntaxFactsService.cs (1)
18Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameActionAnnotation.cs (2)
15TextSpan originalSpan, 28public readonly TextSpan OriginalSpan = originalSpan;
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameNodeSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameTokenSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (2)
56ImmutableArray<TextSpan> spans, 88ImmutableArray<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\ISimplificationService.cs (1)
32ImmutableArray<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractSimplifier.cs (1)
21out TextSpan issueSpan,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
56TextSpan span,
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (1)
25IEnumerable<TextSpan> spans,
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\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)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (19)
Formatting\FormattingTestBase.cs (8)
36IEnumerable<TextSpan> spans, 67SolutionServices services, string expected, SyntaxNode root, IEnumerable<TextSpan> spans, SyntaxFormattingOptions options, bool treeCompare = true, ParseOptions? parseOptions = null) 83private static async Task AssertFormatAsync(SolutionServices services, string expected, SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SourceText sourceText) 99private static bool TryAdjustSpans(SourceText inputText, IList<TextChange> changes, SourceText outputText, ImmutableArray<TextSpan> inputSpans, out ImmutableArray<TextSpan> outputSpans) 107var outputBuilder = ImmutableArray.CreateBuilder<TextSpan>(inputSpans.Length); 110var span = inputSpans[i]; 114outputBuilder.Add(TextSpan.FromBounds(0, outputText.Length));
TestDocumentServiceProvider.cs (1)
73public Task<ImmutableArray<MappedSpanResult>> MapSpansAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken)
Workspaces\TestHostDocument.cs (4)
68public IList<TextSpan> SelectedSpans { get; } = []; 69public IDictionary<string, ImmutableArray<TextSpan>> AnnotatedSpans { get; } = new Dictionary<string, ImmutableArray<TextSpan>>(); 95IDictionary<string, ImmutableArray<TextSpan>> spans,
Workspaces\TestWorkspace.cs (1)
53IDictionary<string, ImmutableArray<TextSpan>> spans,
Workspaces\TestWorkspace_XmlConsumption.cs (3)
195out var code, out var cursorPosition, out IDictionary<string, ImmutableArray<TextSpan>> spans); 635ImmutableDictionary<string, ImmutableArray<TextSpan>> spans; 661spans = ImmutableDictionary<string, ImmutableArray<TextSpan>>.Empty;
Workspaces\TestWorkspace`1.cs (2)
187IDictionary<string, ImmutableArray<TextSpan>> spans, 719out var code, out var cursorPosition, out IDictionary<string, ImmutableArray<TextSpan>> spans);
Microsoft.CodeAnalysis.Workspaces.UnitTests (220)
BatchFixAllProviderTests.cs (1)
118private static async Task<Document> CreateChangedDocument(Document document, TextSpan sourceSpan, int replacement, CancellationToken cancellationToken)
CodeCleanup\CodeCleanupTests.cs (4)
371out var codeWithoutMarker, out IDictionary<string, ImmutableArray<TextSpan>> namedSpans); 373var expectedResult = namedSpans.TryGetValue("r", out var spans) ? spans : SpecializedCollections.EmptyEnumerable<TextSpan>(); 383out var codeWithoutMarker, out IDictionary<string, ImmutableArray<TextSpan>> namedSpans); 388private static async Task VerifyRange(string code, ImmutableArray<ICodeCleanupProvider> codeCleanups, ImmutableArray<TextSpan> spans, MockCodeCleanupProvider transformer, string language)
CodeCleanup\Extensions.cs (2)
18public static TextSpan GetCodeCleanupSpan(this SyntaxNode node) 23return TextSpan.FromBounds(previousToken.SpanStart, endToken.Span.End);
CodeCleanup\MockCodeCleanupProvider.cs (5)
20public IEnumerable<TextSpan> ExpectedResult = null!; 22public Func<MockCodeCleanupProvider, Document, ImmutableArray<TextSpan>, SyntaxFormattingOptions, CancellationToken, Task<Document>>? CleanupDocumentAsyncImpl { get; set; } 23public Func<SyntaxNode, ImmutableArray<TextSpan>, SyntaxFormattingOptions, SolutionServices, SyntaxNode>? CleanupNodeImpl { get; set; } 27public Task<Document> CleanupAsync(Document document, ImmutableArray<TextSpan> spans, CodeCleanupOptions options, CancellationToken cancellationToken) 30public Task<SyntaxNode> CleanupAsync(SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SolutionServices services, CancellationToken cancellationToken)
Differencing\TestTreeComparer.cs (1)
52protected internal override TextSpan GetSpan(TestNode node)
EditorConfigParsing\EditorConfigFileParserTests.cs (72)
15internal static EditorConfigFile<EditorConfigOption> CreateParseResults(string editorconfigFilePath, params (string headerText, TextSpan span, bool isGlobal)[] sections) 32(string.Empty, TextSpan.FromBounds(0, 9), true), 33("*.cs", TextSpan.FromBounds(10, 19), false), 34("*.vb", TextSpan.FromBounds(20, 29), false), 35("*.{cs,vb}", TextSpan.FromBounds(30, 39), false), 36("*.{cs,csx,vb,vbx}", TextSpan.FromBounds(40, 49), false)); 55(string.Empty, TextSpan.FromBounds(0, 9), true), 56("*.vb", TextSpan.FromBounds(20, 29), false), 57("*.{cs,vb}", TextSpan.FromBounds(30, 39), false), 58("*.{cs,csx,vb,vbx}", TextSpan.FromBounds(40, 49), false), 59("*s", TextSpan.FromBounds(50, 59), false), 60("*", TextSpan.FromBounds(60, 69), false), 61("*.{cs,csx}", TextSpan.FromBounds(70, 79), false)); 70(string.Empty, TextSpan.FromBounds(0, 9), true), 71("*.vb", TextSpan.FromBounds(20, 29), false), 72("*.{cs,vb}", TextSpan.FromBounds(30, 39), false), 73("*.{cs,csx,vb,vbx}", TextSpan.FromBounds(40, 49), false), 74("*s", TextSpan.FromBounds(50, 59), false), 75("*", TextSpan.FromBounds(60, 69), false), 76("*.{cs,csx}", TextSpan.FromBounds(70, 79), false)); 87(string.Empty, TextSpan.FromBounds(0, 9), true), 88("*.vb", TextSpan.FromBounds(20, 29), false), 89("*.{cs,csx,vb,vbx}", TextSpan.FromBounds(40, 49), false), 90("*s", TextSpan.FromBounds(50, 59), false), 91("*", TextSpan.FromBounds(60, 69), false), 92("*.{cs,csx}", TextSpan.FromBounds(70, 79), false)); 111(string.Empty, TextSpan.FromBounds(0, 9), true), 112("*.cs", TextSpan.FromBounds(10, 19), false), 113("*.vb", TextSpan.FromBounds(20, 29), false), 114("*.{cs,vb}", TextSpan.FromBounds(30, 39), false), 115("*.{cs,csx,vb,vbx}", TextSpan.FromBounds(40, 49), false), 116("*s", TextSpan.FromBounds(50, 59), false), 117("*", TextSpan.FromBounds(60, 69), false), 118("*.{cs,csx}", TextSpan.FromBounds(70, 79), false)); 133(string.Empty, TextSpan.FromBounds(0, 9), true), 134("sources/**/*.cs", TextSpan.FromBounds(10, 19), false), 135("sources/**/*.vb", TextSpan.FromBounds(20, 29), false), 136("*.{cs,vb}", TextSpan.FromBounds(30, 39), false), 137("*.{cs,csx,vb,vbx}", TextSpan.FromBounds(40, 49), false), 138("*s", TextSpan.FromBounds(50, 59), false), 139("*", TextSpan.FromBounds(60, 69), false), 140("*.{cs,csx}", TextSpan.FromBounds(70, 79), false)); 150(string.Empty, TextSpan.FromBounds(0, 9), true), 151("sources/**/*.cs", TextSpan.FromBounds(10, 19), false), 152("sources/**/*.vb", TextSpan.FromBounds(20, 29), false), 153("*.{cs,vb}", TextSpan.FromBounds(30, 39), false), 154("*.{cs,csx,vb,vbx}", TextSpan.FromBounds(40, 49), false), 155("*s", TextSpan.FromBounds(50, 59), false), 156("*", TextSpan.FromBounds(60, 69), false), 157("*.{cs,csx}", TextSpan.FromBounds(70, 79), false)); 172(string.Empty, TextSpan.FromBounds(0, 9), true), 173("*.{cs,csx,vbx}", TextSpan.FromBounds(30, 39), false), 174("*.{cs,csx,vb,vbx}", TextSpan.FromBounds(40, 49), false), 175("*s", TextSpan.FromBounds(50, 59), false), 176("*", TextSpan.FromBounds(60, 69), false)); 191(string.Empty, TextSpan.FromBounds(0, 9), true), 192("*.*b", TextSpan.FromBounds(30, 39), false), 193("*.*b", TextSpan.FromBounds(80, 89), false), 194("*.*b", TextSpan.FromBounds(130, 139), false), 195("*.*s", TextSpan.FromBounds(40, 49), false), 196("*.*s", TextSpan.FromBounds(90, 99), false), 197("*.*s", TextSpan.FromBounds(120, 129), false), 198("*s", TextSpan.FromBounds(50, 59), false), 199("*s", TextSpan.FromBounds(100, 109), false), 200("*", TextSpan.FromBounds(60, 69), false), 201("*b", TextSpan.FromBounds(70, 79), false), 202("*b", TextSpan.FromBounds(110, 119), false)); 217(string.Empty, TextSpan.FromBounds(0, 9), true), 218("*s", TextSpan.FromBounds(100, 109), false), 219("*", TextSpan.FromBounds(60, 69), false)); 234(string.Empty, TextSpan.FromBounds(0, 9), true), 235("*s", TextSpan.FromBounds(100, 109), false));
EditorConfigParsing\NamingStyleParserTests.cs (48)
59Assert.Equal(TextSpan.FromBounds(2155, 2260), rule0.NamingScheme.OptionName.Span); 67Assert.Equal(TextSpan.FromBounds(2562, 2641), rule0.NamingScheme.Capitalization.Span); 70Assert.Equal(TextSpan.FromBounds(2338, 2481), rule0.ApplicableSymbolInfo.Accessibilities.Span); 77Assert.Equal(TextSpan.FromBounds(2338, 2481), rule0.ApplicableSymbolInfo.Accessibilities.Span); 80Assert.Equal(TextSpan.FromBounds(2483, 2558), rule0.ApplicableSymbolInfo.Modifiers.Span); 83Assert.Equal(TextSpan.FromBounds(2338, 2481), rule0.ApplicableSymbolInfo.Accessibilities.Span); 86Assert.Equal(TextSpan.FromBounds(1961, 2049), rule0.Severity.Span); 94Assert.Equal(TextSpan.FromBounds(5078, 5149), rule1.NamingScheme.OptionName.Span); 102Assert.Equal(TextSpan.FromBounds(5236, 5300), rule1.NamingScheme.Capitalization.Span); 105Assert.Equal(TextSpan.FromBounds(4998, 5076), rule1.ApplicableSymbolInfo.OptionName.Span); 120Assert.Equal(TextSpan.FromBounds(5153, 5232), rule1.ApplicableSymbolInfo.SymbolKinds.Span); 123Assert.Equal(TextSpan.FromBounds(4928, 4996), rule1.Severity.Span); 132Assert.Equal(TextSpan.FromBounds(5925, 5999), rule2.NamingScheme.OptionName.Span); 140Assert.Equal(TextSpan.FromBounds(6061, 6127), rule2.NamingScheme.Capitalization.Span); 143Assert.Equal(TextSpan.FromBounds(5853, 5923), rule2.ApplicableSymbolInfo.OptionName.Span); 170Assert.Equal(TextSpan.FromBounds(6003, 6057), rule2.ApplicableSymbolInfo.SymbolKinds.Span); 173Assert.Equal(TextSpan.FromBounds(5781, 5851), rule2.Severity.Span); 181Assert.Equal(TextSpan.FromBounds(2891, 3000), rule3.NamingScheme.OptionName.Span); 189Assert.Equal(TextSpan.FromBounds(3310, 3391), rule3.NamingScheme.Capitalization.Span); 192Assert.Equal(TextSpan.FromBounds(2783, 2889), rule3.ApplicableSymbolInfo.OptionName.Span); 199Assert.Equal(TextSpan.FromBounds(3080, 3225), rule3.ApplicableSymbolInfo.Accessibilities.Span); 202Assert.Equal(TextSpan.FromBounds(3227, 3306), rule3.ApplicableSymbolInfo.Modifiers.Span); 205Assert.Equal(TextSpan.FromBounds(3004, 3078), rule3.ApplicableSymbolInfo.SymbolKinds.Span); 208Assert.Equal(TextSpan.FromBounds(2691, 2781), rule3.Severity.Span); 216Assert.Equal(TextSpan.FromBounds(5502, 5587), rule4.NamingScheme.OptionName.Span); 224Assert.Equal(TextSpan.FromBounds(5666, 5735), rule4.NamingScheme.Capitalization.Span); 227Assert.Equal(TextSpan.FromBounds(5418, 5500), rule4.ApplicableSymbolInfo.OptionName.Span); 241Assert.Equal(TextSpan.FromBounds(5591, 5662), rule4.ApplicableSymbolInfo.SymbolKinds.Span); 244Assert.Equal(TextSpan.FromBounds(5338, 5416), rule4.Severity.Span); 252Assert.Equal(TextSpan.FromBounds(3569, 3642), rule5.NamingScheme.OptionName.Span); 260Assert.Equal(TextSpan.FromBounds(3773, 3836), rule5.NamingScheme.Capitalization.Span); 263Assert.Equal(TextSpan.FromBounds(3497, 3567), rule5.ApplicableSymbolInfo.OptionName.Span); 275Assert.Equal(TextSpan.FromBounds(3711, 3769), rule5.ApplicableSymbolInfo.Modifiers.Span); 279Assert.Equal(TextSpan.FromBounds(3646, 3709), rule5.ApplicableSymbolInfo.SymbolKinds.Span); 282Assert.Equal(TextSpan.FromBounds(3423, 3495), rule5.Severity.Span); 290Assert.Equal(TextSpan.FromBounds(4601, 4685), rule6.NamingScheme.OptionName.Span); 292Assert.Equal(TextSpan.FromBounds(4825, 4885), rule6.NamingScheme.Prefix.Span); 298Assert.Equal(TextSpan.FromBounds(4755, 4823), rule6.NamingScheme.Capitalization.Span); 301Assert.Equal(TextSpan.FromBounds(4518, 4599), rule6.ApplicableSymbolInfo.OptionName.Span); 315Assert.Equal(TextSpan.FromBounds(4689, 4751), rule6.ApplicableSymbolInfo.SymbolKinds.Span); 318Assert.Equal(TextSpan.FromBounds(4439, 4516), rule6.Severity.Span); 326Assert.Equal(TextSpan.FromBounds(4045, 4125), rule7.NamingScheme.OptionName.Span); 328Assert.Equal(TextSpan.FromBounds(4326, 4385), rule7.NamingScheme.Prefix.Span); 334Assert.Equal(TextSpan.FromBounds(4258, 4324), rule7.NamingScheme.Capitalization.Span); 337Assert.Equal(TextSpan.FromBounds(3966, 4043), rule7.ApplicableSymbolInfo.OptionName.Span); 349Assert.Equal(TextSpan.FromBounds(4191, 4254), rule7.ApplicableSymbolInfo.Modifiers.Span); 352Assert.Equal(TextSpan.FromBounds(4129, 4189), rule7.ApplicableSymbolInfo.SymbolKinds.Span); 355Assert.Equal(TextSpan.FromBounds(3889, 3964), rule7.Severity.Span);
EditorConfigParsing\SectionParserTests.cs (17)
20var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 30var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 39var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 49var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 59var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 69var section = new Section(null, true, default(TextSpan), headerText, $"[{headerText}]"); 79var section = new Section(null, true, default(TextSpan), string.Empty, string.Empty); 92var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 103var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 112var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 121var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 135var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 152var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 187var section = new Section(editorconfigFilePath, false, default(TextSpan), headerText, $"[{headerText}]"); 210var section = new Section(editorconfigFilePath, false, default(TextSpan), headerText, $"[{headerText}]"); 219var section = new Section(editorconfigFilePath, false, default(TextSpan), headerText, $"[{headerText}]"); 230var section = new Section(editorconfigFilePath, false, default(TextSpan), headerText, $"[{headerText}]");
Formatter\FormatterTests.cs (1)
41public Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, LineFormattingOptions lineFormattingOptions, SyntaxFormattingOptions? syntaxFormattingOptions, CancellationToken cancellationToken)
Shared\Extensions\TextSpanExtensions\SubtractTests.cs (59)
26private static TextSpan LongSpan { get; } = TextSpan.FromBounds(10, 20); 27private static TextSpan UnitSpan { get; } = TextSpan.FromBounds(10, 11); 28private static TextSpan EmptySpan { get; } = TextSpan.FromBounds(10, 10); 30private static int RightBeforeStart(TextSpan span) => span.Start - 1; 31private static int AtStart(TextSpan span) => span.Start; 32private static int RightAfterStart(TextSpan span) => span.Start + 1; 33private static int RightBeforeEnd(TextSpan span) => span.End - 1; 34private static int AtEnd(TextSpan span) => span.End; 35private static int RightAfterEnd(TextSpan span) => span.End + 1; 42LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), RightBeforeStart(LongSpan)))); 50LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), AtStart(LongSpan)))); 57[TextSpan.FromBounds(RightAfterStart(LongSpan), AtEnd(LongSpan))], 58LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), RightAfterStart(LongSpan)))); 65[TextSpan.FromBounds(RightBeforeEnd(LongSpan), AtEnd(LongSpan))], 66LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), RightBeforeEnd(LongSpan)))); 73LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), AtEnd(LongSpan)))); 80LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), RightAfterEnd(LongSpan)))); 88LongSpan.Subtract(TextSpan.FromBounds(AtStart(LongSpan), AtStart(LongSpan)))); 95[TextSpan.FromBounds(RightAfterStart(LongSpan), AtEnd(LongSpan))], 96LongSpan.Subtract(TextSpan.FromBounds(AtStart(LongSpan), RightAfterStart(LongSpan)))); 103[TextSpan.FromBounds(RightBeforeEnd(LongSpan), AtEnd(LongSpan))], 104LongSpan.Subtract(TextSpan.FromBounds(AtStart(LongSpan), RightBeforeEnd(LongSpan)))); 111LongSpan.Subtract(TextSpan.FromBounds(AtStart(LongSpan), AtEnd(LongSpan)))); 118LongSpan.Subtract(TextSpan.FromBounds(AtStart(LongSpan), RightAfterEnd(LongSpan)))); 126LongSpan.Subtract(TextSpan.FromBounds(RightAfterStart(LongSpan), RightAfterStart(LongSpan)))); 134TextSpan.FromBounds(AtStart(LongSpan), RightAfterStart(LongSpan)), 135TextSpan.FromBounds(RightBeforeEnd(LongSpan), AtEnd(LongSpan)) 137LongSpan.Subtract(TextSpan.FromBounds(RightAfterStart(LongSpan), RightBeforeEnd(LongSpan)))); 144[TextSpan.FromBounds(AtStart(LongSpan), RightAfterStart(LongSpan))], 145LongSpan.Subtract(TextSpan.FromBounds(RightAfterStart(LongSpan), AtEnd(LongSpan)))); 152[TextSpan.FromBounds(AtStart(LongSpan), RightAfterStart(LongSpan))], 153LongSpan.Subtract(TextSpan.FromBounds(RightAfterStart(LongSpan), RightAfterEnd(LongSpan)))); 161LongSpan.Subtract(TextSpan.FromBounds(RightBeforeEnd(LongSpan), RightBeforeEnd(LongSpan)))); 168[TextSpan.FromBounds(AtStart(LongSpan), RightBeforeEnd(LongSpan))], 169LongSpan.Subtract(TextSpan.FromBounds(RightBeforeEnd(LongSpan), AtEnd(LongSpan)))); 176[TextSpan.FromBounds(AtStart(LongSpan), RightBeforeEnd(LongSpan))], 177LongSpan.Subtract(TextSpan.FromBounds(RightBeforeEnd(LongSpan), RightAfterEnd(LongSpan)))); 185LongSpan.Subtract(TextSpan.FromBounds(AtEnd(LongSpan), AtEnd(LongSpan)))); 193LongSpan.Subtract(TextSpan.FromBounds(AtEnd(LongSpan), RightAfterEnd(LongSpan)))); 201LongSpan.Subtract(TextSpan.FromBounds(RightAfterEnd(LongSpan), RightAfterEnd(LongSpan)))); 209UnitSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(UnitSpan), RightBeforeStart(UnitSpan)))); 217UnitSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(UnitSpan), AtStart(UnitSpan)))); 224UnitSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(UnitSpan), AtEnd(UnitSpan)))); 231UnitSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(UnitSpan), RightAfterEnd(UnitSpan)))); 239UnitSpan.Subtract(TextSpan.FromBounds(AtStart(UnitSpan), AtStart(UnitSpan)))); 246UnitSpan.Subtract(TextSpan.FromBounds(AtStart(UnitSpan), AtEnd(UnitSpan)))); 253UnitSpan.Subtract(TextSpan.FromBounds(AtStart(UnitSpan), RightAfterEnd(UnitSpan)))); 261UnitSpan.Subtract(TextSpan.FromBounds(AtEnd(UnitSpan), AtEnd(UnitSpan)))); 269UnitSpan.Subtract(TextSpan.FromBounds(AtEnd(UnitSpan), RightAfterEnd(UnitSpan)))); 277UnitSpan.Subtract(TextSpan.FromBounds(RightAfterEnd(UnitSpan), RightAfterEnd(UnitSpan)))); 285EmptySpan.Subtract(TextSpan.FromBounds(RightBeforeStart(EmptySpan), RightBeforeStart(EmptySpan)))); 292EmptySpan.Subtract(TextSpan.FromBounds(RightBeforeStart(EmptySpan), EmptySpan.Start))); 299EmptySpan.Subtract(TextSpan.FromBounds(RightBeforeStart(EmptySpan), RightAfterEnd(EmptySpan)))); 306EmptySpan.Subtract(TextSpan.FromBounds(EmptySpan.Start, EmptySpan.Start))); 313EmptySpan.Subtract(TextSpan.FromBounds(EmptySpan.Start, RightAfterEnd(EmptySpan)))); 321EmptySpan.Subtract(TextSpan.FromBounds(RightAfterEnd(EmptySpan), RightAfterEnd(EmptySpan))));
SolutionTests\ProjectSemanticVersionTests.cs (4)
114var span = new TextSpan(text.ToString().IndexOf("20"), length: 2); 142var span = new TextSpan(text.ToString().IndexOf("20"), length: 2); 226var span = new TextSpan(text.ToString().IndexOf("20"), length: 2); 254var span = new TextSpan(text.ToString().IndexOf("20"), length: 2);
SyntaxPathTests.cs (1)
414var span = new TextSpan(offset, length);
UtilityTest\IntervalTreeTests.cs (5)
20public TextSpan GetSpan(Tuple<int, int, T> value) 261public TextSpan GetSpan(int value) 319var span = new TextSpan(start, length); 396public TextSpan GetSpan(int value) 402public TextSpan GetSpan(char value)
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;
Microsoft.VisualStudio.LanguageServices (124)
CallHierarchy\CallHierarchyDetail.cs (2)
20private readonly TextSpan _span; 46return location.SourceTree.GetText().GetSubText(TextSpan.FromBounds(start, end)).ToString();
CodeLens\CodeLensCallbackListener.cs (2)
157Guid projectGuid, string filePath, TextSpan span, DocumentId? sourceGeneratorDocumentId, CancellationToken cancellationToken) 172Solution solution, Guid projectGuid, string filePath, TextSpan textSpan, DocumentId? sourceGeneratorDocumentId, CancellationToken cancellationToken)
CodeLens\RemoteCodeLensReferencesService.cs (1)
160var span = new TextSpan(descriptor.SpanStart, descriptor.SpanLength);
Diagnostics\VisualStudioVenusSpanMappingService.cs (2)
31out TextSpan sourceSpan, out FileLinePositionSpan originalLineInfo, out FileLinePositionSpan mappedLineInfo) 60sourceSpan = TextSpan.FromBounds(startPos, Math.Max(startPos, endPos));
DocumentOutline\DocumentOutlineViewModel.IntervalIntrospector.cs (1)
19public TextSpan GetSpan(DocumentSymbolDataViewModel value)
Extensions\DocumentExtensions.cs (3)
19public static IList<Tuple<TextSpan, uint>> GetVisibleCodeBlocks(this Document document, CancellationToken cancellationToken) 21var codeBlocks = new List<Tuple<TextSpan, uint>>(); 56codeBlocks.Add(Tuple.Create(TextSpan.FromBounds(start, end), cookie));
Extensions\SourceTextExtensions.cs (1)
13public static VsTextSpan GetVsTextSpanForSpan(this SourceText text, TextSpan textSpan)
F1Help\AbstractHelpContextService.cs (1)
44public abstract Task<string> GetHelpTermAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken);
F1Help\IHelpContextService.cs (1)
18Task<string> GetHelpTermAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken);
FindReferences\Contexts\AbstractTableDataSourceFindUsagesContext.cs (1)
472var sourceSpan = documentSpan.SourceSpan;
FindReferences\Contexts\WithReferencesFindUsagesContext.cs (1)
76using var _2 = PooledHashSet<(string? filePath, TextSpan span)>.GetInstance(out var seenLocations);
FindReferences\Entries\AbstractDocumentSpanEntry.cs (1)
44protected virtual TextSpan NavigateToTargetSpan
FindReferences\Entries\DefinitionItemEntry.cs (1)
35protected override TextSpan NavigateToTargetSpan
FindReferences\Entries\DocumentSpanEntry.cs (6)
68protected override TextSpan NavigateToTargetSpan 77TextSpan sourceSpan, 179private DisposableToolTip CreateDisposableToolTip(Document document, TextSpan sourceSpan) 217private static void SetHighlightSpan(HighlightSpanKind spanKind, ITextBuffer textBuffer, TextSpan span) 230private static Span GetRegionSpanForReference(SourceText sourceText, TextSpan sourceSpan) 234var referenceSpan = sourceSpan;
FindReferences\RoslynDefinitionBucket.cs (2)
37private readonly Dictionary<(string? filePath, TextSpan span), DocumentSpanEntry> _locationToEntry = []; 132public DocumentSpanEntry GetOrAddEntry(string? filePath, TextSpan sourceSpan, DocumentSpanEntry entry)
Implementation\AbstractEditorFactory.cs (3)
357var originalNewLine = originalText.ToString(CodeAnalysis.Text.TextSpan.FromBounds(originalLine.End, originalLine.EndIncludingLineBreak)); 363var currentSpan = CodeAnalysis.Text.TextSpan.FromBounds(currentLine.End, currentLine.EndIncludingLineBreak);
InheritanceMargin\InheritanceGlyphManager_IntervalTreeData.cs (1)
35public TextSpan GetSpan(GlyphData data)
LanguageService\AbstractLanguageService`2.IVsLanguageBlock.cs (2)
41(string description, TextSpan span)? foundBlock = null; 68public static (string description, TextSpan span)? GetCurrentBlock(
LanguageService\AbstractLanguageService`2.IVsLanguageContextProvider.cs (2)
32var span = Microsoft.CodeAnalysis.Text.TextSpan.FromBounds(start, end);
LanguageService\AbstractLanguageService`2.IVsLanguageTextOps.cs (6)
19using RoslynTextSpan = Microsoft.CodeAnalysis.Text.TextSpan; 64var adjustedSpan = GetFormattingSpan(root, start, end); 77var originalSpan = RoslynTextSpan.FromBounds(start, end); 89private static RoslynTextSpan GetFormattingSpan(SyntaxNode root, int start, int end) 106return RoslynTextSpan.FromBounds(start, end);
Snippets\SnippetExpansionClient.cs (1)
218var formattingSpan = CommonFormattingHelpers.GetFormattingSpan(SubjectBuffer.CurrentSnapshot, snippetTrackingSpan.GetSpan(SubjectBuffer.CurrentSnapshot));
Snippets\SnippetFunctions\SnippetFunctionGenerateSwitchCases.cs (1)
67private bool TryGetSpan(string fieldName, [NotNullWhen(true)] out TextSpan? switchExpressionSpan)
Snippets\SnippetFunctions\SnippetFunctionSimpleTypeName.cs (2)
12using TextSpan = Microsoft.CodeAnalysis.Text.TextSpan; 54private bool TryGetFieldSpan([NotNullWhen(true)] out TextSpan? fieldSpan)
ValueTracking\TreeItemViewModel.cs (3)
26protected TextSpan TextSpan { get; } 45TextSpan textSpan, 116var highlightSpan = new TextSpan(spanStartPosition, TextSpan.Length);
ValueTracking\ValueTrackingCommandHandler.cs (1)
91var textSpan = new TextSpan(caretPosition.Value.Position, 0);
Venus\ContainedDocument.cs (47)
238var editorVisibleSpansInOriginal = SharedPools.Default<List<TextSpan>>().AllocateAndClear(); 257SharedPools.Default<List<TextSpan>>().ClearAndFree(editorVisibleSpansInOriginal); 261private IEnumerable<TextChange> FilterTextChanges(SourceText originalText, List<TextSpan> editorVisibleSpansInOriginal, IEnumerable<TextChange> changes) 279var visibleSpan = editorVisibleSpansInOriginal[spanIndex]; 280var visibleTextSpan = GetVisibleTextSpan(originalText, visibleSpan, uptoFirstAndLastLine: true); 328private static bool WhitespaceOnEdges(TextSpan visibleTextSpan, TextChange change) 348private IEnumerable<TextChange> GetSubTextChanges(SourceText originalText, TextChange changeInOriginalText, TextSpan visibleSpanInOriginalText) 365SourceText originalText, TextSpan visibleSpanInOriginalText, string leftText, string rightText, int offsetInOriginalText, List<TextChange> changes) 368using var leftPool = SharedPools.Default<List<TextSpan>>().GetPooledObject(); 369using var rightPool = SharedPools.Default<List<TextSpan>>().GetPooledObject(); 385var spanInOriginalText = new TextSpan(offsetInOriginalText + spanInLeftText.Start, spanInLeftText.Length); 399SourceText originalText, TextSpan visibleSpanInOriginalText, string leftText, string rightText, int offsetInOriginalText) 416var spanInOriginalText = new TextSpan(offsetInOriginalText + spanInLeftText.Start, spanInLeftText.Length); 424private static bool TryGetWhitespaceOnlyChanges(string leftText, string rightText, List<TextSpan> spansInLeftText, List<TextSpan> spansInRightText) 427private static bool TryGetWhitespaceGroup(string text, List<TextSpan> groups) 454groups.Add(TextSpan.FromBounds(0, 0)); 458groups.Add(TextSpan.FromBounds(start, i)); 462groups.Add(TextSpan.FromBounds(start, i)); 475groups.Add(TextSpan.FromBounds(start, text.Length)); 503SourceText originalText, TextSpan visibleSpanInOriginalText, 504string rightText, TextSpan spanInOriginalText, TextSpan spanInRightText, out TextChange textChange) 548TextSpan.FromBounds(visibleFirstLineInOriginalText.EndIncludingLineBreak, visibleLastLineInOriginalText.Start), 569TextSpan.FromBounds(visibleFirstLineInOriginalText.EndIncludingLineBreak, spanInOriginalText.End), 586TextSpan.FromBounds(spanInOriginalText.Start, visibleLastLineInOriginalText.Start), 700public IEnumerable<TextSpan> GetEditorVisibleSpans() 721IList<TextSpan> visibleSpansInOriginal, 775using var pooledObject = SharedPools.Default<List<TextSpan>>().GetPooledObject(); 794Document document, ITextEdit edit, TextSpan visibleSpan, AbstractFormattingRule baseIndentationRule, SyntaxFormattingOptions options) 799using var spanPool = SharedPools.Default<List<TextSpan>>().GetPooledObject(); 824public BaseIndentationFormattingRule GetBaseIndentationRule(SyntaxNode root, SourceText text, List<TextSpan> spans, int spanIndex) 829GetVisibleAndTextSpan(text, spans, currentSpanIndex, out var visibleSpan, out var visibleTextSpan); 841return new BaseIndentationFormattingRule(root, TextSpan.FromBounds(visibleSpan.Start, end), baseIndentation, _vbHelperFormattingRule); 851return new BaseIndentationFormattingRule(root, TextSpan.FromBounds(visibleSpan.Start, end), baseIndentation, _vbHelperFormattingRule); 867var span = spans[spanIndex]; 872private static void GetVisibleAndTextSpan(SourceText text, List<TextSpan> spans, int spanIndex, out TextSpan visibleSpan, out TextSpan visibleTextSpan) 884private int GetBaseIndentation(SyntaxNode root, SourceText text, TextSpan span) 911private static TextSpan GetVisibleTextSpan(SourceText text, TextSpan visibleSpan, bool uptoFirstAndLastLine = false) 946return (start <= end) ? TextSpan.FromBounds(start, end + 1) : default; 949private int GetAdditionalIndentation(SyntaxNode root, SourceText text, TextSpan span, int hostIndentationSize) 969var textSpan = GetVisibleTextSpan(text, span); 988var textSpan = GetVisibleTextSpan(text, span);
Venus\ContainedDocument.DocumentServiceProvider.cs (9)
85IEnumerable<TextSpan> spans, 102foreach (var span in spans) 135public async Task<ExcerptResult?> TryExcerptAsync(Document document, TextSpan span, ExcerptMode mode, ClassificationOptions classificationOptions, CancellationToken cancellationToken) 214var spanOnContentSpan = GetSpanOnContent(mappedSpan.Value.Span.ToTextSpan(), contentSpan); 264private static SnapshotSpan? MapRoslynSpanToPrimarySpan(IProjectionSnapshot primarySnapshot, ITextSnapshot roslynSnapshot, TextSpan span) 276private static (SourceText, TextSpan) GetContentAndMappedSpan(ExcerptMode mode, SnapshotSpan primarySpan, SnapshotSpan contentSpan) 317private static TextSpan GetSpanOnContent(TextSpan targetSpan, TextSpan excerptSpan)
Workspace\SourceGeneratedFileManager.cs (2)
106public Func<CancellationToken, Task<bool>> GetNavigationCallback(SourceGeneratedDocument document, TextSpan sourceSpan) 530public Task<bool> NavigateToSpanAsync(TextSpan sourceSpan, CancellationToken cancellationToken)
Workspace\VisualStudioDocumentNavigationService.cs (15)
28using TextSpan = Microsoft.CodeAnalysis.Text.TextSpan; 51public async Task<bool> CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) 100Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) 126static async Task<TextSpan> GetTextSpanFromPositionAsync(Document document, int position, int virtualSpace, CancellationToken cancellationToken) 158Func<Document, Task<TextSpan>> getTextSpanForMappingAsync, 160Func<SourceText, TextSpan, VsTextSpan> getVsTextSpanForMapping, 182Func<Document, Task<TextSpan>> getTextSpanForMappingAsync, 184Func<SourceText, TextSpan, VsTextSpan> getVsTextSpanForMapping, 317ISpanMappingService spanMappingService, Document generatedDocument, TextSpan textSpan, CancellationToken cancellationToken) 345private static VsTextSpan GetVsTextSpan(SourceText text, TextSpan textSpan, bool allowInvalidSpan) 347var boundedTextSpan = GetSpanWithinDocumentBounds(textSpan, text.Length); 363/// It is unclear why, but we are sometimes asked to navigate to a <see cref="TextSpan"/> 370private static TextSpan GetSpanWithinDocumentBounds(TextSpan span, int documentLength) 371=> TextSpan.FromBounds(GetPositionWithinDocumentBounds(span.Start, documentLength), GetPositionWithinDocumentBounds(span.End, documentLength));
Workspace\VisualStudioFormattingRuleFactoryServiceFactory.cs (3)
50using var pooledObject = SharedPools.Default<List<TextSpan>>().GetPooledObject(); 90public IEnumerable<TextChange> FilterFormattedChanges(DocumentId documentId, TextSpan span, IList<TextChange> changes) 101foreach (var visibleSpan in containedDocument.GetEditorVisibleSpans())
Microsoft.VisualStudio.LanguageServices.CSharp (12)
CodeModel\CSharpCodeModelService.cs (4)
2802text = text.Replace(TextSpan.FromBounds(deletionStart, deletionEnd), string.Empty); 2877text = text.Replace(TextSpan.FromBounds(deletionStart, deletionEnd), string.Empty); 3196protected override TextSpan GetSpanToFormat(SyntaxNode root, TextSpan span)
CodeModel\CSharpCodeModelService.NodeLocator.cs (2)
140var textAfterBrace = text.ToString(TextSpan.FromBounds(openBrace.Span.End, openBraceLine.End)); 214var textBeforeBrace = text.ToString(TextSpan.FromBounds(closeBraceLine.Start, closeBrace.SpanStart));
LanguageService\CSharpHelpContextService.cs (2)
42public override async Task<string> GetHelpTermAsync(Document document, TextSpan span, CancellationToken cancellationToken) 85return text.GetSubText(TextSpan.FromBounds(start, end)).ToString();
SemanticSearch\SemanticSearchDocumentNavigationService.cs (2)
25public override Task<bool> CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) 28public override Task<INavigableLocation?> GetLocationForSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken)
SemanticSearch\SemanticSearchToolWindowImpl.cs (2)
42using TextSpan = Microsoft.CodeAnalysis.Text.TextSpan; 420public NavigableLocation GetNavigableLocation(TextSpan textSpan)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
EditorConfigSettings\DataProvider\DataProviderTests.MockAnalyzerReference.cs (1)
111c.ReportDiagnostic(Diagnostic.Create(descriptor, c.Tree.GetLocation(TextSpan.FromBounds(0, 0))));
Microsoft.VisualStudio.LanguageServices.LiveShare (1)
Client\RemoteLanguageServiceWorkspace.cs (1)
311var textSpan = ProtocolConversions.RangeToTextSpan(location.Range, text);
Microsoft.VisualStudio.LanguageServices.UnitTests (7)
CodeModel\CSharp\FileCodeModelTests.vb (1)
1225span:=TextSpan.FromBounds(0, textAfterOperation.Length),
Debugging\VisualBasicBreakpointResolutionServiceTests.vb (1)
20Dim expectedSpan As TextSpan? = Nothing
Diagnostics\ExternalDiagnosticUpdateSourceTests.vb (1)
315Public Function GetDiagnosticsForSpanAsync(document As TextDocument, range As TextSpan?, shouldIncludeDiagnostic As Func(Of String, Boolean), priority As ICodeActionRequestPriorityProvider, diagnosticKinds As DiagnosticKind, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of DiagnosticData)) Implements IDiagnosticAnalyzerService.GetDiagnosticsForSpanAsync
Venus\DocumentService_IntegrationTests.vb (3)
271Public Async Function MapSpansAsync(document As Document, spans As IEnumerable(Of TextSpan), cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of MappedSpanResult)) Implements ISpanMappingService.MapSpansAsync 309Public Async Function TryExcerptAsync(document As Document, span As TextSpan, mode As ExcerptMode, classificationOptions As ClassificationOptions, cancellationToken As CancellationToken) As Task(Of ExcerptResult?) Implements IDocumentExcerptService.TryExcerptAsync 317Dim mappedSpan As TextSpan
Venus\DocumentServiceTests.vb (1)
298Private Shared Function GetNamedSpan(document As TestHostDocument, Optional spanName As String = "Document") As TextSpan
Microsoft.VisualStudio.LanguageServices.VisualBasic (9)
CodeModel\VisualBasicCodeModelService.vb (6)
1301text = text.Replace(TextSpan.FromBounds(deletionStart, deletionEnd), String.Empty) 1360text = text.Replace(TextSpan.FromBounds(spanStart, spanEnd), String.Empty) 3731Protected Overrides Function GetSpanToFormat(root As SyntaxNode, span As TextSpan) As TextSpan 4133text = text.Replace(TextSpan.FromBounds(clauseItemToRemove.SpanStart, methodStatement.HandlesClause.Events.GetSeparator(0).Span.End), String.Empty) 4135text = text.Replace(TextSpan.FromBounds(methodStatement.HandlesClause.Events.GetSeparator(index - 1).SpanStart, clauseItemToRemove.Span.End), String.Empty)
Help\VisualBasicHelpContextService.vb (1)
39Public Overrides Async Function GetHelpTermAsync(document As Document, span As TextSpan, cancellationToken As CancellationToken) As Task(Of String)
Help\VisualBasicHelpContextService.Visitor.vb (2)
19Private ReadOnly _span As TextSpan 25Public Sub New(span As TextSpan, semanticModel As SemanticModel, isNotMetadata As Boolean, service As VisualBasicHelpContextService, cancellationToken As CancellationToken)
Microsoft.VisualStudio.LanguageServices.Xaml (17)
Features\Completion\XamlCompletionItem.cs (1)
23public TextSpan? Span { get; set; }
Features\Completion\XamlCompletionResult.cs (1)
15public TextSpan? ApplicableToSpan { get; set; }
Features\Definitions\XamlSourceDefinition.cs (2)
16public XamlSourceDefinition(string filePath, TextSpan span) 34public TextSpan? Span { get; }
Features\DocumentSpan.cs (2)
16public TextSpan TextSpan { get; } 18public DocumentSpan(Document document, TextSpan textSpan) : this()
Features\Formatting\IXamlFormattingService.cs (1)
18Task<IList<TextChange>> GetFormattingChangesAsync(TextDocument document, XamlFormattingOptions options, TextSpan? textSpan, CancellationToken cancellationToken);
Features\InlineRename\IXamlRenameInfo.cs (1)
30TextSpan TriggerSpan { get; }
Features\InlineRename\XamlEditorInlineRenameService.cs (3)
72public TextSpan TriggerSpan => _renameInfo.TriggerSpan; 94public TextSpan? GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken) 104public TextSpan GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken)
Features\QuickInfo\XamlQuickInfo.cs (3)
15public TextSpan Span { get; } 22TextSpan span, 32TextSpan span,
Features\Structure\XamlStructureTag.cs (1)
14public TextSpan TextSpan { get; set; }
Features\TypeRename\XamlTypeRenameResult.cs (1)
12public ImmutableArray<TextSpan> Ranges { get; set; }
Implementation\LanguageServer\Handler\Formatting\AbstractFormatDocumentHandlerBase.cs (1)
36TextSpan? textSpan = null;
Roslyn.Diagnostics.Analyzers (417)
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)
87private static async Task<Document> AddObsoleteAttributeAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken) 119private static async Task<Document> AddDescriptionAndErrorAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken) 140private static async Task<Document> UpdateDescriptionAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken) 165private static async Task<Document> AddErrorAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken) 184private static async Task<Document> SetErrorToTrueAsync(Document document, TextSpan sourceSpan, CancellationToken cancellationToken)
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\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\RoslynAnalyzers\Utilities\Refactoring\CodeRefactoringContextExtensions.cs (3)
29TextSpan span, 40TextSpan span, 53TextSpan span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
29string tokenText, int index, int offset, out TextSpan span) 173if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 241return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (5)
17/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 47public readonly TextSpan Span; 53public static VirtualChar Create(Rune rune, TextSpan span) 61public static VirtualChar Create(char surrogateChar, TextSpan span) 69private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 86public VirtualCharSequence GetSubSequence(TextSpan span) 165=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 178return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
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\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\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) 784public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 962var fullSpan = node.FullSpan;
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
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) 289internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 304return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 307internal static TextSpan GetElasticSpan(SyntaxToken token) 310private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 312var aggregateSpans = new List<TextSpan>(); 314var last = default(TextSpan); 315foreach (var span in spans) 323last = TextSpan.FromBounds(last.Start, span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
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\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\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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
424TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 427/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 428/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 430/// an empty <see cref="TextSpan"/> at position 0. 433TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 477bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
16public static void AddWordParts(string identifier, ref TemporaryArray<TextSpan> parts) 19public static void AddCharacterParts(string identifier, ref TemporaryArray<TextSpan> parts) 22public static void AddParts(string text, bool word, ref TemporaryArray<TextSpan> parts) 26var span = StringBreaker.GenerateSpan(text, start, word); 40public static TextSpan GenerateSpan(string identifier, int wordStart, bool word) 80private static TextSpan ScanCharacterRun(string identifier, int length, int wordStart) 101private static TextSpan ScanWordRun(string identifier, int length, int wordStart) 150private static TextSpan ScanLowerCaseRun(string identifier, int length, int wordStart) 161private static TextSpan ScanNumber(string identifier, int length, int wordStart) 169return TextSpan.FromBounds(wordStart, current);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (3)
47protected static TextSpan GetSpan(SyntaxNode node) 52return TextSpan.FromBounds(start.SpanStart, end.Span.End); 98var span = GetSpan(destination);
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\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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (1)
38public static bool IsNodeUnderselected(SyntaxNode? node, TextSpan selection)
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
32IEnumerable<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
128public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (2)
368using var parts = TemporaryArray<TextSpan>.Empty; 372var p = parts[i];
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (1)
17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
39return document.Text.ToString(TextSpan.FromBounds(tokenLine.Start, token.SpanStart));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (2)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxFactsService\ISyntaxFactsService.cs (1)
18Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameActionAnnotation.cs (2)
15TextSpan originalSpan, 28public readonly TextSpan OriginalSpan = originalSpan;
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameNodeSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameTokenSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (2)
56ImmutableArray<TextSpan> spans, 88ImmutableArray<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\ISimplificationService.cs (1)
32ImmutableArray<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractSimplifier.cs (1)
21out TextSpan issueSpan,
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 (61)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (10)
206var lineSpan = currentLine.Span; 253using var _ = ArrayBuilder<(char ch, TextSpan span)>.GetInstance(out var charResults); 286string tokenText, int offset, int startIndexInclusive, int endIndexExclusive, ArrayBuilder<(char ch, TextSpan span)> charResults) 305private static void ConvertCharactersToRunes(ArrayBuilder<(char ch, TextSpan span)> charResults, ImmutableSegmentedList<VirtualChar>.Builder runeResults) 325runeResults.Add(VirtualChar.Create(rune, TextSpan.FromBounds(span.Start, nextSpan.End))); 339ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 352ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 386ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 405ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index, char character) 518result.Add((character, TextSpan.FromBounds(startIndex + offset, endIndex + offset)));
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (1)
238var name = SyntaxFactory.ParseName(syntaxTree.GetText(cancellationToken).ToString(TextSpan.FromBounds(genericIdentifier.SpanStart, lastToken.Span.End)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (4)
201var fullSpan = trivia.FullSpan; 230var span = trivia.FullSpan; 411var span = token.Span; 457var span = token.Span;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (1)
156var span = trivia.FullSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\FormattingResult.cs (1)
19internal FormattingResult(TreeData treeInfo, TokenStream tokenStream, TextSpan spanToFormat)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs (1)
57public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (1)
102public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (3)
21TextSpan textSpan, 53list.Add(FormattingOperations.CreateIndentBlockOperation(startToken, endToken, TextSpan.FromBounds(startPosition, endPosition), indentationDelta: -1, option: option)); 89TextSpan textSpan,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (4)
120TextSpan.FromBounds(lastTokenOfLabel.FullSpan.End, nextToken.SpanStart) : TextSpan.FromBounds(lastTokenOfLabel.FullSpan.End, lastTokenOfLabel.FullSpan.End)); 129span = lastSection ? span : TextSpan.FromBounds(span.Start, endToken.FullSpan.End); 369AddIndentBlockOperation(list, firstToken, lastToken, TextSpan.FromBounds(firstToken.FullSpan.Start, lastToken.FullSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (2)
335var textSpan = TextSpan.FromBounds(startToken.Span.End, endToken.SpanStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (2)
184var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (5)
917public TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node) 928return TextSpan.FromBounds(method.Body.OpenBraceToken.Span.End, method.Body.CloseBraceToken.SpanStart); 1032public TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) 1061return !branch.IsActive || !branch.BranchTaken ? TextSpan.FromBounds(branch.FullSpan.Start, position) : default; 1311public bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken)
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\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\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\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 (43)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\FormattingResult.vb (1)
21Friend Sub New(treeInfo As TreeData, tokenStream As TokenStream, spanToFormat As TextSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
96Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.vb (1)
58Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
89Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Indentation\VisualBasicSmartTokenFormatter.vb (1)
41Dim spans = SpecializedCollections.SingletonEnumerable(TextSpan.FromBounds(previousToken.SpanStart, token.Span.End))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (4)
807Public Function GetMemberBodySpanForSpeculativeBinding(node As SyntaxNode) As TextSpan Implements ISyntaxFacts.GetMemberBodySpanForSpeculativeBinding 830Return TextSpan.FromBounds(spanStart, method.EndBlockStatement.SpanStart) 1089Public Function GetInactiveRegionSpanAroundPosition(tree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As TextSpan Implements ISyntaxFacts.GetInactiveRegionSpanAroundPosition 1420Public Function ContainsInterleavedDirective(span As TextSpan, token As SyntaxToken, cancellationToken As CancellationToken) As Boolean Implements ISyntaxFacts.ContainsInterleavedDirective
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\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\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb (1)
221Public Function GetImplicitMemberAccessExpressions(expression As SyntaxNode, span As TextSpan) As IEnumerable(Of ExpressionSyntax)
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicSymbolDeclarationService.vb (1)
51Public Overrides ReadOnly Property Span As TextSpan
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
Roslyn.VisualStudio.Next.UnitTests (3)
Services\ServiceHubServicesTests.cs (1)
105var newText = oldText.WithChanges(new TextChange(TextSpan.FromBounds(0, 0), "/* test */"));
Services\VisualStudioDiagnosticAnalyzerExecutorTests.cs (2)
284c.ReportDiagnostic(Diagnostic.Create(_supportedDiagnostics[0], c.Tree.GetLocation(TextSpan.FromBounds(0, 1)))); 302c.ReportDiagnostic(Diagnostic.Create(_supportedDiagnostics[0], c.Tree.GetLocation(TextSpan.FromBounds(0, 1))));
System.Windows.Forms.Analyzers.CodeFixes.CSharp (1)
System\Windows\Forms\CSharp\CodeFixes\AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.cs (1)
39TextSpan diagnosticSpan = diagnostic.Location.SourceSpan;
System.Windows.Forms.Analyzers.CodeFixes.VisualBasic (1)
AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.vb (1)
45Dim diagnosticSpan As TextSpan = diagnostic.Location.SourceSpan
Test.Utilities (368)
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\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
29string tokenText, int index, int offset, out TextSpan span) 173if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 241return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (5)
17/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 47public readonly TextSpan Span; 53public static VirtualChar Create(Rune rune, TextSpan span) 61public static VirtualChar Create(char surrogateChar, TextSpan span) 69private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 86public VirtualCharSequence GetSubSequence(TextSpan span) 165=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 178return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
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\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\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) 784public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 962var fullSpan = node.FullSpan;
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
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) 289internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 304return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 307internal static TextSpan GetElasticSpan(SyntaxToken token) 310private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 312var aggregateSpans = new List<TextSpan>(); 314var last = default(TextSpan); 315foreach (var span in spans) 323last = TextSpan.FromBounds(last.Start, span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
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\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\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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
424TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 427/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 428/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 430/// an empty <see cref="TextSpan"/> at position 0. 433TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 477bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
16public static void AddWordParts(string identifier, ref TemporaryArray<TextSpan> parts) 19public static void AddCharacterParts(string identifier, ref TemporaryArray<TextSpan> parts) 22public static void AddParts(string text, bool word, ref TemporaryArray<TextSpan> parts) 26var span = StringBreaker.GenerateSpan(text, start, word); 40public static TextSpan GenerateSpan(string identifier, int wordStart, bool word) 80private static TextSpan ScanCharacterRun(string identifier, int length, int wordStart) 101private static TextSpan ScanWordRun(string identifier, int length, int wordStart) 150private static TextSpan ScanLowerCaseRun(string identifier, int length, int wordStart) 161private static TextSpan ScanNumber(string identifier, int length, int wordStart) 169return TextSpan.FromBounds(wordStart, current);
Text.Analyzers (403)
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\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
100return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IIntervalIntrospector.cs (1)
11TextSpan GetSpan(T value);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.Enumerator.cs (1)
23public TextSpan GetSpan(T value) => throw new System.NotImplementedException();
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal abstract record class EditorConfigOption(Section Section, TextSpan? Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (1)
12internal sealed record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
118var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (1)
16internal readonly record struct EmbeddedDiagnostic(string Message, TextSpan Span);
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (3)
76public TextSpan GetSpan() 79public TextSpan? GetFullSpan() 94return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (3)
29string tokenText, int index, int offset, out TextSpan span) 173if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 241return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (5)
17/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 47public readonly TextSpan Span; 53public static VirtualChar Create(Rune rune, TextSpan span) 61public static VirtualChar Create(char surrogateChar, TextSpan span) 69private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
109var span = new TextSpan(firstVirtualCharPosition + index, length: 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 86public VirtualCharSequence GetSubSequence(TextSpan span) 165=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 178return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
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\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\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) 784public static SyntaxNode FindNode(this SyntaxNode root, TextSpan? span, bool findInTrivia, bool getInnermostNodeForTie) 962var fullSpan = node.FullSpan;
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (2)
68var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressIntervalIntrospector.cs (2)
14TextSpan IIntervalIntrospector<SuppressSpacingData>.GetSpan(SuppressSpacingData value) 17TextSpan IIntervalIntrospector<SuppressWrappingData>.GetSpan(SuppressWrappingData value)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressSpacingData.cs (2)
12internal sealed class SuppressSpacingData(TextSpan textSpan) 14public TextSpan TextSpan { get; } = textSpan;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\SuppressWrappingData.cs (2)
12internal sealed class SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 14public TextSpan TextSpan { get; } = textSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (2)
337var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
51public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
86public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
49public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
68public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
35public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
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) 289internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 304return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 307internal static TextSpan GetElasticSpan(SyntaxToken token) 310private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 312var aggregateSpans = new List<TextSpan>(); 314var last = default(TextSpan); 315foreach (var span in spans) 323last = TextSpan.FromBounds(last.Start, span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ISyntaxFormatting.cs (1)
20IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, CancellationToken cancellationToken);
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (2)
15internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 29public TextSpan TextSpan { get; }
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\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\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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\IUnnecessaryImportsProvider.cs (2)
15ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken); 19TextSpan? span,
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\EditorConfig\EditorConfigNamingStyleParser.cs (1)
121public TextSpan? GetSpan(IReadOnlyDictionary<string, TextLine> lines)
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
11private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
52var headerSpan = TextSpan.FromBounds(startAfterAttributes, lastTokenOrNodeOfHeader.FullSpan.End);
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\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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (6)
424TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 427/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 428/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 430/// an empty <see cref="TextSpan"/> at position 0. 433TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 477bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (5)
164var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
109var characterSpan = currentNode.WordSpan;
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\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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (10)
16public static void AddWordParts(string identifier, ref TemporaryArray<TextSpan> parts) 19public static void AddCharacterParts(string identifier, ref TemporaryArray<TextSpan> parts) 22public static void AddParts(string text, bool word, ref TemporaryArray<TextSpan> parts) 26var span = StringBreaker.GenerateSpan(text, start, word); 40public static TextSpan GenerateSpan(string identifier, int wordStart, bool word) 80private static TextSpan ScanCharacterRun(string identifier, int length, int wordStart) 101private static TextSpan ScanWordRun(string identifier, int length, int wordStart) 150private static TextSpan ScanLowerCaseRun(string identifier, int length, int wordStart) 161private static TextSpan ScanNumber(string identifier, int length, int wordStart) 169return TextSpan.FromBounds(wordStart, current);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractCodeGenerationService_FindDeclaration.cs (3)
47protected static TextSpan GetSpan(SyntaxNode node) 52return TextSpan.FromBounds(start.SpanStart, end.Span.End); 98var span = GetSpan(destination);
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\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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (1)
38public static bool IsNodeUnderselected(SyntaxNode? node, TextSpan selection)
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
32IEnumerable<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
128public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (2)
368using var parts = TemporaryArray<TextSpan>.Empty; 372var p = parts[i];
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Formatting\ISyntaxFormattingService.cs (1)
17ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
39return document.Text.ToString(TextSpan.FromBounds(tokenLine.Start, token.SpanStart));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\MoveDeclarationNearReference\AbstractMoveDeclarationNearReferenceService.State.cs (2)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\SyntaxFactsService\ISyntaxFactsService.cs (1)
18Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameActionAnnotation.cs (2)
15TextSpan originalSpan, 28public readonly TextSpan OriginalSpan = originalSpan;
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\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameNodeSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameTokenSimplificationAnnotation.cs (1)
11public TextSpan OriginalTextSpan { get; set; }
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (2)
56ImmutableArray<TextSpan> spans, 88ImmutableArray<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\ISimplificationService.cs (1)
32ImmutableArray<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\Simplifiers\AbstractSimplifier.cs (1)
21out TextSpan issueSpan,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\NullableHelpers.cs (1)
56TextSpan span,