1161 instantiations of TextSpan
AnalyzerRunner (1)
CodeRefactoringRunner.cs (1)
89var context = new CodeRefactoringContext(document, new TextSpan(node.SpanStart, 0), codeActions.Add, cancellationToken);
IdeBenchmarks (2)
RegexClassifierBenchmarks.cs (2)
45return GetClassificationSpansAsync(code, new TextSpan(0, code.Length), parseOptions: null).Result; 52return GetClassificationSpansAsync(code, new TextSpan(0, code.Length), parseOptions: null).Result;
IdeCoreBenchmarks (5)
ClassificationBenchmarks.cs (1)
100var 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));
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)
45return new[] { new TextChange(new TextSpan(0, 0), after.GetText().ToString()) }; 81return new[] { new TextSpan(0, after!.GetText().Length) }; 112newSpans.Add(new TextSpan(start, change.Range.NewLength)); 569RecordChange(new ChangeRecord(new TextChangeRange(new TextSpan(start, 0), newSpan.Length), null, insertedNodes)); 581new TextChangeRange(new TextSpan(last.Range.Span.Start, last.Range.Span.Length + change.Range.Span.Length), last.Range.NewLength + change.Range.NewLength), 604new TextChangeRange(new TextSpan(last.Range.Span.Start, last.Range.Span.Length + textChangeRange.Span.Length), last.Range.NewLength + textChangeRange.NewLength), 763new TextSpan(range.Span.Start + commonLeadingCount, range.Span.Length - (commonLeadingCount + commonTrailingCount)),
Syntax\SyntaxNode.cs (2)
84public TextSpan FullSpan => new TextSpan(this.Position, this.Green.FullWidth); 108return new TextSpan(start, width);
Syntax\SyntaxNodeOrToken.cs (1)
278return new TextSpan(Position, _token.FullWidth);
Syntax\SyntaxToken.cs (2)
109return Node != null ? new TextSpan(Position + Node.GetLeadingTriviaWidth(), Node.Width) : default(TextSpan); 132public TextSpan FullSpan => new TextSpan(Position, FullWidth);
Syntax\SyntaxTokenList.cs (1)
160return new TextSpan(this.Position, Node.FullWidth);
Syntax\SyntaxTreeExtensions.cs (1)
24var fullSpan = new TextSpan(0, text.Length);
Syntax\SyntaxTrivia.cs (2)
95? new TextSpan(Position + UnderlyingNode.GetLeadingTriviaWidth(), UnderlyingNode.Width) 122get { return UnderlyingNode != null ? new TextSpan(Position, UnderlyingNode.FullWidth) : default(TextSpan); }
Syntax\SyntaxTriviaList.cs (1)
158return 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.CodeStyle (39)
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)
79Location.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)
24var 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)
122var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
39span = new TextSpan(offset + index, 2); 168result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 207result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 214result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 221result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 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)
425DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 476DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
280if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
261span = new TextSpan(span.Start + i, span.Length - i);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (3)
738return new TextSpan(this.StartPosition, 0); 746return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0); 752return new TextSpan(this.EndPosition, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
27Current = new TextSpan(nameSpan.Start, 0); 54Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
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)
117=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
83textChanges.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)
206this.RegionSpan = new TextSpan(startLocation, length);
FlowAnalysis\NullableWalker.cs (1)
1554return 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)
550return this.WithChanges(newText, new[] { new TextChangeRange(new TextSpan(0, this.Length), newText.Length) }); 564if (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)
153return 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)
278charResults.Add((ch, new TextSpan(offset + index, 1))); 382result.Add((ch, new TextSpan(offset + index, 2))); 449result.Add(((char)uintChar, new TextSpan(startIndex + offset, 2 + 8))); 460result.Add(((char)highSurrogate, new TextSpan(pos, 0))); 461result.Add(((char)lowSurrogate, new TextSpan(pos, 2 + 8))); 489result.Add((character, new TextSpan(startIndex + offset, 2 + 4)));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (5)
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
69var 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)
94edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
96edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (1)
CommandLineTests.cs (1)
15189var diagnosticSpan = new TextSpan(2, 2);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (7)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (1)
653var insertChange = new TextChange(new TextSpan(insertionPosition, 0), bracePair);
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (1)
285var textChange = new TextChange(new TextSpan(position, 0), textToInsert);
InlineRename\CSharpEditorInlineRenameService.cs (1)
161surroundingSpanOfInterest = new TextSpan(startPosition, length);
RawStringLiteral\RawStringLiteralCommandHandler_TypeChar.cs (2)
121return new TextChange(new TextSpan(position + 1, 0), "\"\"\""); 178return new TextChange(new TextSpan(position + 1, 0), "\"");
StringCopyPaste\KnownSourcePasteProcessor.cs (2)
238edits.Add(new TextChange(new TextSpan(interpolation.OpenBraceToken.Span.End, 0), new string('{', dollarSignsToAdd))); 239edits.Add(new TextChange(new TextSpan(interpolation.CloseBraceToken.Span.Start, 0), new string('}', dollarSignsToAdd)));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (44)
Classification\SemanticClassifierTests_TestMarkup.cs (3)
52var spans = ImmutableArray.Create(new TextSpan(start, length)); 120new TextSpan(allCode.IndexOf(code1, StringComparison.Ordinal), code1.Length), 121new TextSpan(allCode.IndexOf(code2, StringComparison.Ordinal), code2.Length)
Classification\SyntacticClassifierTests.cs (29)
6052var classifications = await GetSyntacticClassificationsAsync(document, [new TextSpan(0, source.Length)]); 6055new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(0, 3)), 6056new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentText, new TextSpan(3, 1)), 6057new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(4, 1)), 6058new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentName, new TextSpan(5, 5)), 6059new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeName, new TextSpan(11, 4)), 6060new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(15, 1)), 6061new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeQuotes, new TextSpan(16, 1)), 6062new ClassifiedSpan(ClassificationTypeNames.Identifier, new TextSpan(17, 5)), 6063new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeQuotes, new TextSpan(22, 1)), 6064new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(23, 1)), 6065new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(24, 2)), 6066new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentName, new TextSpan(26, 5)), 6067new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(31, 1)) 6082var classifications = await GetSyntacticClassificationsAsync(document, [new TextSpan(0, source.Length)]); 6085new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(2, 3)), 6086new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentText, new TextSpan(5, 1)), 6087new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(6, 1)), 6088new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentName, new TextSpan(7, 5)), 6089new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(14, 3)), 6090new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeName, new TextSpan(18, 4)), 6091new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(22, 1)), 6092new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeQuotes, new TextSpan(23, 1)), 6093new ClassifiedSpan(ClassificationTypeNames.Identifier, new TextSpan(24, 5)), 6094new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeQuotes, new TextSpan(29, 1)), 6095new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(30, 1)), 6096new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(31, 2)), 6097new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentName, new TextSpan(33, 5)), 6098new 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 (5)
65await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, document, new TextSpan(0, document.GetTextAsync().Result.Length)); 93await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(ideEngineWorkspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length)); 175await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, sourceDocument, new TextSpan(0, sourceDocument.GetTextAsync().Result.Length)); 205var diagnostics = await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length)); 261var diagnostics = await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(ideEngineWorkspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length));
ExtractMethod\SelectionValidatorTests.cs (1)
1605var span = new TextSpan(12, 1);
NavigateTo\NavigateToSearcherTests.cs (5)
124var results = ImmutableArray.Create<INavigateToSearchResult>(new TestNavigateToSearchResult(workspace, new TextSpan(0, 0))); 159var results = ImmutableArray.Create<INavigateToSearchResult>(new TestNavigateToSearchResult(workspace, new TextSpan(0, 0))); 236var results = ImmutableArray.Create<INavigateToSearchResult>(new TestNavigateToSearchResult(workspace, new TextSpan(0, 0))); 272var results = ImmutableArray.Create<INavigateToSearchResult>(new TestNavigateToSearchResult(workspace, new TextSpan(0, 0))); 320var results = ImmutableArray.Create<INavigateToSearchResult>(new TestNavigateToSearchResult(workspace, new TextSpan(0, 0)));
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 (26)
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\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)
126new TextSpan(0, virtualCharsWithoutMarkup.Length),
ExtractInterface\CSharpExtractInterfaceService.cs (1)
34var span = new TextSpan(position, 0);
GenerateType\CSharpGenerateTypeService.cs (2)
589? semanticModel.SyntaxTree.GetLocation(new TextSpan(lastMember.Span.End, 0)) 590: semanticModel.SyntaxTree.GetLocation(new TextSpan());
InlineHints\CSharpInlineTypeHintsService.cs (5)
64: new(type, new TextSpan(variableDesignation.Identifier.SpanStart, 0), textChange: null, trailingSpace: true); 80var span = new TextSpan(parameterNode.Identifier.SpanStart, 0); 99var span = new TextSpan(implicitNew.NewKeyword.Span.End, 0); 112var span = new TextSpan(collectionExpression.OpenBracketToken.SpanStart, 0); 143return 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)
69var 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)
94edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
96edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (2)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (2)
87yield return new TextSpan(start, end - start); 314var oldStatementTextSpan = new TextSpan(oldStatementPosition, oldStatementSource.Length);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (3)
Semantics\BindingAwaitTests.cs (1)
28TextSpan span = new TextSpan(text.Length, 0);
Semantics\TopLevelStatementsTests.cs (1)
8791(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)
2622var loc1 = Location.Create(tree, new TextSpan(0, 1)); 2623var loc2 = Location.Create(tree, new TextSpan(1, 1));
Compilation\SemanticModelAPITests.cs (1)
3614var 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 (154)
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); 2409return 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 (43)
496var span = new TextSpan(source.IndexOf("]") + 1, length: 1); 528var span = new TextSpan(source.IndexOf("."), length: 1); 573var prefixSpan = new TextSpan(source.IndexOf(prefix), length: prefix.Length); 574var suffixSpan = new TextSpan(source.IndexOf(suffix), length: suffix.Length); 965var newText = text.WithChanges(new TextChange(new TextSpan(0, 8), "")); 979var newText = text.WithChanges(new TextChange(new TextSpan(0, 8), "")); 2748new TextChange(new TextSpan(str.IndexOf(" abc", StringComparison.Ordinal), 0), "//"), 2749new TextChange(new TextSpan(str.IndexOf(" 123", StringComparison.Ordinal), 0), "//"), 2750new TextChange(new TextSpan(str.IndexOf(" def", StringComparison.Ordinal), 0), "//")); 2770var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), "{")); 2786var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), @"System.Console.WriteLine(false) 2845var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), @"if (false) 2900var span = new TextSpan(oldIText.Length, 0); 2914span = new TextSpan(oldIText.Length, 0); 2983var span = new TextSpan(currLen, 0); 3020var span = new TextSpan(text.LastIndexOf('x'), 0); 3100var change = new TextChange(new TextSpan(0, 0), items[1]); // Prepend 3198var span = new TextSpan(source.IndexOf(" A[]?"), 0); 3219var span = new TextSpan(src.IndexOf(":"), 1); 3240var span = new TextSpan(source.IndexOf(";"), 0); 3261var span = new TextSpan(source.IndexOf(";") + 1, 0); 3282var span = new TextSpan(source.IndexOf(";") + 1, 0); 3304var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3328var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3352var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3376var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3400var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3424var span = new TextSpan(source.IndexOf(substring) + substring.Length, 1); 3450var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3475var span = new TextSpan(source.IndexOf(substring), 0); 3501var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3527var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3545var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3563var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3581var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3595var span = new TextSpan(start: 0, length: 1); // delete first character 3609var span = new TextSpan(start: 0, length: 0); 3624var span = new TextSpan(start: source.IndexOf(substring), length: 3); // Goo[Goo] -> [Goo] 3661var span = new TextSpan(start: source.IndexOf(":") + 1, length: 0); 3691new TextChange(new TextSpan(locationOfChange, 0), "/*"), 3692new TextChange(new TextSpan(locationOfChange + widthOfChange, 0), "*/") 3701var newText = oldText.WithChanges(new TextChange(new TextSpan(locationOfChange, widthOfChange), "")); 3727var 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)
555var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(0, 16)).ToList(); 567var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(1, 14)).ToList(); 579var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(7, 17)).ToList(); 592var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(8, 15)).ToList(); 641var node = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(6, 3)).First(); 722var EOFSpan = new TextSpan(root.FullSpan.End, 0); 731var nodeEndPositionSpan = new TextSpan(classDecl.FullSpan.End, 0); 741var invalidSpan = new TextSpan(100, 100); 743invalidSpan = new TextSpan(root.FullSpan.End - 1, 2); 745invalidSpan = new TextSpan(classDecl2.FullSpan.Start - 1, root.FullSpan.End); 747invalidSpan = new TextSpan(classDecl.FullSpan.End, root.FullSpan.End); 897var tree2 = tree1.WithChangedText(tree1.GetText().WithChanges(new TextChange(new TextSpan(22, 0), " return; "))); 2069var 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 (9)
Rename\CSharpRenameRewriterLanguageService.cs (2)
111newSpan = new TextSpan(oldSpan.Start, newSpan.Length); 317_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)
278charResults.Add((ch, new TextSpan(offset + index, 1))); 382result.Add((ch, new TextSpan(offset + index, 2))); 449result.Add(((char)uintChar, new TextSpan(startIndex + offset, 2 + 8))); 460result.Add(((char)highSurrogate, new TextSpan(pos, 0))); 461result.Add(((char)lowSurrogate, new TextSpan(pos, 2 + 8))); 489result.Add((character, new TextSpan(startIndex + offset, 2 + 4)));
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (2)
Formatting\CSharpFormattingTestBase.cs (2)
31return AssertFormatAsync(code, code, [new TextSpan(0, code.Length)], changedOptionSet, testWithTransformation, parseOptions); 41return AssertFormatAsync(expected, code, [new TextSpan(0, code.Length)], changedOptionSet, testWithTransformation, parseOptions);
Microsoft.CodeAnalysis.EditorFeatures (13)
AutomaticCompletion\AbstractAutomaticLineEnderCommandHandler.cs (1)
207var insertChange = new TextChange(new TextSpan(insertPosition, 0), endingString);
Classification\Semantic\AbstractSemanticOrEmbeddedClassificationViewTaggerProvider.cs (1)
174var 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)
390commentedSpanOnSameLine = new TextSpan();
EditorConfigSettings\Updater\NamingStyles\SourceTextExtensions.cs (1)
47var 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)
103return new TextSpan(location.TextSpan.Start + index, searchName.Length); 123return new TextSpan(location.TextSpan.Start + position, replacementText.Length);
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (1)
187var textChange = new TextChange(new TextSpan(_snapshotSpan.Start, _snapshotSpan.Length), _stateMachine.TrackingSession.OriginalName);
Shared\Extensions\SpanExtensions.cs (1)
21=> new(span.Start, span.Length);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (19)
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)
48spans = ImmutableArray.Create(new TextSpan(start, length)); 59spans = ImmutableArray.Create(new TextSpan(0, allCode.Length));
Completion\AbstractCompletionProviderTests.cs (3)
618var textChange = new TextChange(new TextSpan(firstItem.Span.End, 0), commitChar.ToString()); 1062var assertText = "'" + text.ToString(new TextSpan(position, 1)) + "' expected to be textual trigger character"; 1067var assertText = "'" + text.ToString(new TextSpan(position, 1)) + "' expected to NOT be textual trigger character";
ExtractInterface\ExtractInterfaceTestState.cs (1)
100new TextSpan(_testDocument.CursorPosition.Value, 1),
LanguageServer\AbstractLanguageServerProtocolTests.cs (1)
90mappedResult = spans.Select(span => new MappedSpanResult(s_mappedFilePath, s_mappedLinePosition, new TextSpan(0, 5))).ToImmutableArray();
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)
453tempMappedMarkupSpans[key].Add(new TextSpan(spanStartLocation!.Value, spanEndLocationExclusive!.Value - spanStartLocation.Value));
Microsoft.CodeAnalysis.EditorFeatures.Text (6)
Extensions.SnapshotSourceText.cs (2)
303return [new TextChangeRange(new TextSpan(0, oldText.Length), this.Length)]; 354return ImmutableArray.Create(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)
109return new TextChangeRange(new TextSpan(change.OldSpan.Start, change.OldSpan.Length), change.NewLength); 113return 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)
615context.ReportDiagnostic(Diagnostic.Create(s_descriptor, tree.GetLocation(new TextSpan(0, 1)))); 926var span = new TextSpan(line.Start, line.End);
CodeGeneration\CodeGenerationTests.cs (1)
626var 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)
427var diagnosticSpan = new TextSpan(2, 2); 758? new TextSpan(0, 1) 858var 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)); 189await 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)
168var span = textSpan ?? new TextSpan(_view.Caret.Position.BufferPosition, 0);
Snippets\RoslynLSPSnippetConvertTests.cs (3)
404ImmutableArray<SnippetPlaceholder>.Empty, new TextChange(new TextSpan(8, 0), "quux"), triggerLocation: 12, CancellationToken.None).Result; 415ImmutableArray<SnippetPlaceholder>.Empty, 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)
69Return New TextSpan(5, 2)
Diagnostics\DiagnosticServiceTests.vb (1)
1355Dim 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)
99Dim contextLocation = (Await document.GetSyntaxTreeAsync()).GetLocation(New TextSpan(0, 0))
Microsoft.CodeAnalysis.Features (44)
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\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (1)
142.Select(changes => new TextSpan(changes.Key.Start, changes.Sum(change => change.NewText!.Length)));
Common\TaggedText.cs (1)
191yield return new ClassifiedSpan(new TextSpan(index, text.Length), classificationTypeName);
Completion\CompletionService.cs (1)
259return CompletionChange.Create(new TextChange(new TextSpan(), ""));
Completion\Utilities.cs (2)
22return new TextChange(new TextSpan(0, 0), ""); 40var totalNewSpan = new TextSpan(totalOldSpan.Start, totalOldSpan.Length + sumOfDeltas);
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)
79var replaceSpan = new TextSpan(token.Span.Start, spanToReplaceLength); 321var 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)
190var chars = this.Text.GetSubSequence(new TextSpan(Position, 1));
EmbeddedLanguages\Json\JsonParser.cs (1)
398literalToken.VirtualChars.GetSubSequence(new TextSpan(0, 1)),
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexEmbeddedCompletionProvider.cs (1)
456new TextChange(new TextSpan(int.Parse(startString), int.Parse(lengthString)), newText),
EmbeddedLanguages\RegularExpressions\RegexLexer.cs (1)
68return 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)
297new CodeGenerationContext(newSemanticModel.SyntaxTree.GetLocation(new TextSpan()))),
Highlighting\Keywords\AbstractKeywordHighlighter.cs (1)
80=> new(position, 0);
MetadataAsSource\AbstractMetadataAsSourceService.cs (1)
37contextLocation: newSemanticModel.SyntaxTree.GetLocation(new TextSpan()),
MetadataAsSource\MetadataAsSourceHelpers.cs (1)
83location = Location.Create(tree, new TextSpan(0, 0));
MoveToNamespace\AbstractMoveToNamespaceService.cs (1)
248var 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)
79Location.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)
114var location = document.SyntaxTree.GetLocation(new TextSpan(position, 0)); 160var endMessage = text.ToString(new TextSpan(endLine.Start, length));
Microsoft.CodeAnalysis.Features.Test.Utilities (3)
EditAndContinue\EditAndContinueWorkspaceTestBase.cs (1)
324=> 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 (12)
Handler\Breakpoints\ValidateBreakableRangeHandler.cs (3)
81var breakpointSpan = result.IsLineBreakpoint ? new TextSpan(span.Start, length: 0) : result.TextSpan; 102var secondResult = await breakpointService.ResolveBreakpointAsync(document, new TextSpan(span.End, length: 0), cancellationToken).ConfigureAwait(false); 105breakpointSpan = secondResult.IsLineBreakpoint ? new TextSpan(span.Start, length: 0) : secondResult.TextSpan;
Handler\Completion\CompletionHandler.cs (1)
158var defaultSpan = new TextSpan(completionList.Span.Start, length: position - completionList.Span.Start);
Handler\InlineCompletions\InlineCompletionsHandler.cs (6)
197snippetEndPosition = GetAdjustedSpan(formattingChanges, new TextSpan(snippetEndPosition, 0)).Start; 231return new TextSpan(originalSpan.Start + amountToAdjust, originalSpan.Length); 236var offsetInSnippet = new TextSpan(positionInFullText - snippetPositionInFullText, length); 279part = await functionPart.WithSnippetFunctionResultAsync(documentWithDefaultSnippet, new TextSpan(locationInDefaultSnippet, part.DefaultText.Length), simplifierOptions, cancellationToken).ConfigureAwait(false); 285var fieldSpan = new TextSpan(locationInFinalSnippet, part.DefaultText.Length); 290caretSpan = new TextSpan(locationInFinalSnippet, cursorPart.DefaultText.Length);
Handler\OnAutoInsert\OnAutoInsertHandler.cs (1)
218var indentedText = textToIndent.WithChanges(new TextChange(new TextSpan(lineToIndent.End, 0), indentText));
Handler\SemanticTokens\SemanticTokensHelpers.cs (1)
209textSpan = new TextSpan(line.Start, endOffSet);
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (7)
Completion\CompletionResolveTests.cs (1)
503var textChange = new TextChange(span: new TextSpan(start: 77, length: 9), newText: @"public override void M()
Diagnostics\AbstractPullDiagnosticTestsBase.cs (1)
224var lineInfo = sourceText.Lines.GetLinePositionSpan(new TextSpan(position, 0));
Diagnostics\PullDiagnosticTests.cs (3)
678var generator = new DiagnosticProducingGenerator(context => Location.Create(context.Compilation.SyntaxTrees.Single(), new TextSpan(0, 10))); 1324var generator = new DiagnosticProducingGenerator(context => Location.Create(context.Compilation.SyntaxTrees.Single(), new TextSpan(0, 10))); 1346new TextSpan(0, 10)));
SpellCheck\SpellCheckTests.cs (1)
651var lineInfo = sourceText.Lines.GetLinePositionSpan(new TextSpan(position, 0));
Workspaces\LspWorkspaceManagerTests.cs (1)
656(ProtocolConversions.TextSpanToRange(new TextSpan(initialContents.IndexOf("C3"), 1), originalSourceText), "D"));
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Services\SemanticClassification\RemoteSemanticClassificationService.Caching.cs (1)
321classifiedSpans.Add(new ClassifiedSpan(classificationTypes[typeIndex], new TextSpan(start, length)));
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 (302)
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 (193)
41var subText = text.GetSubText(new TextSpan(0, 5)); 49var subText = text.GetSubText(new TextSpan(6, 5)); 57var subText = text.GetSubText(new TextSpan(4, 3)); 88new TextChange(new TextSpan(0, 5), "Halo"), 89new TextChange(new TextSpan(6, 5), "Universe")); 100new TextChange(new TextSpan(0, 5), "Halo"), 101new TextChange(new TextSpan(3, 5), "Universe") 113new TextChange(new TextSpan(6, 5), "Universe"), 114new TextChange(new TextSpan(0, 5), "Halo") 127new TextChange(new TextSpan(6, 7), "Universe"), 128new TextChange(new TextSpan(0, 5), "Halo") 142new TextChange(new TextSpan(6, 0), "Super "), 143new TextChange(new TextSpan(6, 0), "Spectacular ")); 154new TextChange(new TextSpan(6, 0), "Super "), 155new TextChange(new TextSpan(6, 2), "Vu")); 166new TextChange(new TextSpan(6, 2), "Vu"), 167new TextChange(new TextSpan(6, 0), "Super ") 180new TextChange(new TextSpan(4, 1), string.Empty), 181new TextChange(new TextSpan(5, 1), string.Empty)); 191new TextChange(new TextSpan(4, 1), string.Empty), 192new TextChange(new TextSpan(6, 5), "Universe")); 194var subText = newText.GetSubText(new TextSpan(3, 4)); 206new TextChange(new TextSpan(4, 1), string.Empty)); 216new TextChange(new TextSpan(6, 5), "Universe")); 233new TextChange(new TextSpan(0, 1), "[1]"), 234new TextChange(new TextSpan(1, 1), "[2]"), 235new TextChange(new TextSpan(5, 0), "[3]"), 236new TextChange(new TextSpan(25, 2), "[4]") 278new TextChange(new TextSpan(8, 2), "IN"), 279new TextChange(new TextSpan(15, 2), "IN")); 286new TextChange(new TextSpan(8, 2), new string('a', 10)), 287new TextChange(new TextSpan(15, 2), new string('a', 10))); 294new TextChange(new TextSpan(8, 2), "\r\n"), 295new TextChange(new TextSpan(15, 2), "\r\n")); 302new TextChange(new TextSpan(6, 0), "aa\r"), 303new TextChange(new TextSpan(11, 0), "aa\r")); 310new TextChange(new TextSpan(6, 0), "aa\n"), 311new TextChange(new TextSpan(11, 0), "aa\n")); 318new TextChange(new TextSpan(4, 4), "aaaaaa"), 319new TextChange(new TextSpan(15, 4), "aaaaaa")); 326new TextChange(new TextSpan(5, 0), "aaaaaa")); 333new TextChange(new TextSpan(5, 0), "\naaaaaa\r")); 340new TextChange(new TextSpan(21, 0), "Line4\r\n"), 341new TextChange(new TextSpan(21, 0), "Line5\r\n")); 392var subtext = text.GetSubText(new TextSpan(5, 10)); 403var newText = text.Replace(new TextSpan(0, 20), ""); 414var newText = text.Replace(new TextSpan(10, 6), ""); 426var newText = text.Replace(new TextSpan(10, 1), ""); 442var textWithSegments = text.Replace(new TextSpan(10, 0), "*"); 459var textWithSegments = text.Replace(new TextSpan(10, 0), "*"); 463var textWithFewerSegments = textWithSegments.Replace(new TextSpan(9, 3), ""); 479var textWithSegments = text.Replace(new TextSpan(0, text.Length), ""); 636var change1 = original.WithChanges(new TextChange(new TextSpan(5, 6), string.Empty)); // prepare a ChangedText instance 647var change1 = original.WithChanges(new TextChange(new TextSpan(5, 6), string.Empty)); // prepare a ChangedText instance 648var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 0), string.Empty)); // this should not cause exception 657var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 658var change2 = change1.WithChanges(new TextChange(new TextSpan(7, 3), "oo")); 663Assert.Equal(new TextSpan(6, 0), changes[0].Span); 672var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 673var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 0), "bb")); 678Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "abba") }, changes); 686var change1 = original.WithChanges(new TextChange(new TextSpan(1, 1), "aaa")); 687var change2 = change1.WithChanges(new TextChange(new TextSpan(3, 0), "bb")); 692Assert.Equal(new[] { new TextChange(new TextSpan(1, 1), "aabba") }, changes); 700var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 701var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 1), "bb")); 706Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "abb") }, changes); 713var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 714var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 14), "ar")); 719Assert.Equal(new TextSpan(2, 8), changes[0].Span); 727var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 728var change2 = change1.WithChanges(new TextChange(new TextSpan(4, 6), " Bel")); 733Assert.Equal(new TextSpan(4, 2), changes[0].Span); 741var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 742var change2 = change1.WithChanges(new TextChange(new TextSpan(7, 6), "wazy V")); 747Assert.Equal(new TextSpan(6, 1), changes[0].Span); 755var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 756var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 0), "bb")); 761Assert.Equal(new[] { new TextChange(new TextSpan(1, 0), "bbaa") }, changes); 768var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 769var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 0), "bb")); 774Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "bbaa") }, changes); 781var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 782var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 1), "bb")); 787Assert.Equal(new[] { new TextChange(new TextSpan(1, 0), "bba") }, changes); 794var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 795var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 2), "bb")); 800Assert.Equal(new[] { new TextChange(new TextSpan(1, 0), "bb") }, changes); 807var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 808var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 3), "bb")); 813Assert.Equal(new[] { new TextChange(new TextSpan(1, 1), "bb") }, changes); 821var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 822var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 1), "bb")); 827Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "bba") }, changes); 835var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 836var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 3), "bb")); 847var change1 = original.WithChanges(new TextChange(new TextSpan(4, 0), "o ")); 848var change2 = change1.WithChanges(new TextChange(new TextSpan(6, 0), "World")); 853Assert.Equal(new TextSpan(4, 0), changes[0].Span); 861var change1 = original.WithChanges(new TextChange(new TextSpan(4, 0), "o")); 862var change2 = change1.WithChanges(new TextChange(new TextSpan(6, 0), "World")); 867Assert.Equal(new TextSpan(4, 0), changes[0].Span); 869Assert.Equal(new TextSpan(5, 0), changes[1].Span); 877var change1 = original.WithChanges(new TextChange(new TextSpan(8, 0), "l")); 878var change2 = change1.WithChanges(new TextChange(new TextSpan(4, 0), "o")); 883Assert.Equal(new TextSpan(4, 0), changes[0].Span); 885Assert.Equal(new TextSpan(8, 0), changes[1].Span); 893var change1 = original.WithChanges(new TextChange(new TextSpan(4, 0), " World")); 895var change2 = change1.WithChanges(new TextChange(new TextSpan(4, 0), "o")); 900Assert.Equal(new TextSpan(4, 0), changes[0].Span); 911c => c.WithChanges(new TextChange(new TextSpan(4, 0), "o ")), 912c => c.WithChanges(new TextChange(new TextSpan(6, 0), "World"))); 918Assert.Equal(new TextSpan(4, 0), changes[0].Span); 926new TextChangeRange(new TextSpan(919, 10), 466), 927new TextChangeRange(new TextSpan(936, 33), 29), 928new TextChangeRange(new TextSpan(1098, 0), 70), 929new TextChangeRange(new TextSpan(1125, 4), 34), 930new TextChangeRange(new TextSpan(1138, 0), 47)); 932new TextChangeRange(new TextSpan(997, 0), 2), 933new TextChangeRange(new TextSpan(1414, 0), 2), 934new TextChangeRange(new TextSpan(1419, 0), 2), 935new TextChangeRange(new TextSpan(1671, 5), 5), 936new TextChangeRange(new TextSpan(1681, 0), 4)); 941new TextChangeRange(new TextSpan(919, 10), 468), 942new TextChangeRange(new TextSpan(936, 33), 33), 943new TextChangeRange(new TextSpan(1098, 0), 70), 944new TextChangeRange(new TextSpan(1125, 4), 38), 945new TextChangeRange(new TextSpan(1138, 0), 47)); 954Assert.Equal("new TextChange(new TextSpan(0, 1), \"abc\")", new TextChange(new TextSpan(0, 1), "abc").GetDebuggerDisplay()); 955Assert.Equal("new TextChange(new TextSpan(0, 1), (NewLength = 10))", new TextChange(new TextSpan(0, 1), "0123456789").GetDebuggerDisplay()); 979var newChange = new TextChange(new TextSpan(i, length: random.Next(originalText.Length - i)), newText); 999var newChange = new TextChange(new TextSpan(i, length: random.Next(editedLength - i)), newText); 1047var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 2), "a")); 1048var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 2), "bb")); 1061var change1 = original.WithChanges(new TextChange(new TextSpan(0, 0), "aa"), new TextChange(new TextSpan(1, 1), "aa")); 1062var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), "b"), new TextChange(new TextSpan(2, 2), "")); 1075var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 0), "a")); 1076var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 2), ""), new TextChange(new TextSpan(2, 0), "bb")); 1089var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "aa"), new TextChange(new TextSpan(3, 1), "aa")); 1090var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), "bbb")); 1102var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 3), "a"), new TextChange(new TextSpan(5, 0), "aaa")); 1103var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 2), ""), new TextChange(new TextSpan(3, 1), "bb")); 1116var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "aaaaa"), new TextChange(new TextSpan(3, 1), "aaaa"), new TextChange(new TextSpan(6, 1), "aaaaa")); 1117var 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), "")); 1130var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "a")); 1131var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), "b"), new TextChange(new TextSpan(2, 2), "b")); 1144var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "aa")); 1145var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), "b"), new TextChange(new TextSpan(1, 2), "b")); 1158var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 2), "a"), new TextChange(new TextSpan(3, 2), "a")); 1159var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 3), "bbb")); 1172var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 4), ""), new TextChange(new TextSpan(5, 1), "")); 1173var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), ""), new TextChange(new TextSpan(1, 0), "")); 1186var 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), "")); 1187var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), ""), new TextChange(new TextSpan(1, 1), ""), new TextChange(new TextSpan(2, 0), "")); 1200var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), ""), new TextChange(new TextSpan(2, 1), "")); 1201var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), ""), new TextChange(new TextSpan(1, 1), "")); 1226new TextChange(new TextSpan(39, 0), " "), 1227new TextChange(new TextSpan(42, 0), " "), 1228new TextChange(new TextSpan(57, 0), " "), 1229new TextChange(new TextSpan(58, 0), "\r\n"), 1230new TextChange(new TextSpan(64, 2), " "), 1231new TextChange(new TextSpan(69, 0), " "), 1237new TextChange(new TextSpan(35, 4), string.Empty), 1238new TextChange(new TextSpan(46, 4), string.Empty), 1239new TextChange(new TextSpan(73, 4), string.Empty), 1240new TextChange(new TextSpan(88, 0), " "), 1241new TextChange(new TextSpan(90, 4), string.Empty), 1242new 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)
180Dim location = binder.SyntaxTree.GetLocation(New TextSpan(startLoc, endLoc - startLoc))
Syntax\SyntaxNodeRemover.vb (1)
65Return New TextSpan(start, [end] - start)
Syntax\SyntaxReplacer.vb (1)
128Return New TextSpan(start, [end] - start)
Syntax\VisualBasicSyntaxTree.vb (2)
108Return Me.WithChanges(newText, {New TextChangeRange(New TextSpan(0, Me.Length), newText.Length)}) 120If 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)
10399Dim diagnosticSpan = New TextSpan(2, 2) 11049ReportDiagnostic(context.Options.AdditionalFiles.First().Path, context, New TextSpan(0, 1000000)) ' Overflow span 11060span = New TextSpan(0, 11)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (3)
EndConstructGeneration\SpitLinesResult.vb (1)
52subjectBuffer.ApplyChange(New TextChange(New TextSpan(caretPosition, 0), joinedLines))
EndConstructGeneration\VisualBasicEndConstructGenerationService.vb (1)
337subjectBuffer.ApplyChange(New TextChange(New TextSpan(insertPosition, 0), endText))
NavigationBar\VisualBasicEditorNavigationBarItemService_CodeGeneration.vb (1)
53Dim 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 (12)
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),
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)
451semanticModel.SyntaxTree.GetLocation(New TextSpan()), 452semanticModel.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)
87span = New TextSpan(start, length) 479Dim oldStatementTextSpan = New TextSpan(oldStatementPosition, oldStatementSource.Length)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (4)
Compilation\CompilationAPITests.vb (2)
1603Dim loc1 = Location.Create(tree, New TextSpan(0, 1)) 1604Dim loc2 = Location.Create(tree, New TextSpan(1, 1))
Diagnostics\DiagnosticAnalyzerTests.vb (1)
1657Dim diagnosticSpan = New TextSpan(2, 2)
SourceGeneration\GeneratorDriverTests.vb (1)
234gen001, New TextSpan(0, 0),
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (5)
DocumentationComments\DocCommentTests.vb (2)
12549filterSpanWithinTree:=New Text.TextSpan(0, 0)) 12599filterSpanWithinTree:=New Text.TextSpan(0, 0))
SymbolsTests\AnonymousTypes\AnonymousTypesSemanticsTests.vb (1)
2019nodes.Add(New TextSpan(start, [end] - start + 3))
SymbolsTests\MyBaseMyClassSemanticsTests.vb (1)
168nodes.Add(New TextSpan(start, [end] - start + 3))
SymbolsTests\WithStatementSymbolsTests.vb (1)
321nodes.Add(New TextSpan(start, [end] - start + 3))
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (93)
IncrementalParser\IncrementalParser.vb (35)
90Dim span = New TextSpan(i, 10) 112Dim newText = text.WithChanges(New TextChange(New TextSpan(text.Length, 0), _s.Substring(i, 1))) 129Dim newText = oldText.WithChanges(New TextChange(New TextSpan(pos, 0), "'")) 138Dim anotherText = newText.WithChanges(New TextChange(New TextSpan(pos, 1), "")) 171.changeSpan = New TextSpan(code.Length, 0), 193.changeSpan = New TextSpan(code.Length, 0), 216.changeSpan = New TextSpan(code.Length, 0), 232.changeSpan = New TextSpan(code.Length, 0), 251.changeSpan = New TextSpan(code.Length, 0), 266.changeSpan = New TextSpan(code.Length, 0), 284.changeSpan = New TextSpan(0, 0), 303.changeSpan = New TextSpan(0, 0), 317.changeSpan = New TextSpan(0, 0), 329.changeSpan = New TextSpan(0, 0), 384.changeSpan = New TextSpan(0, 0), 397.changeSpan = New TextSpan(0, 0), 417.changeSpan = New TextSpan(0, 0), 432.changeSpan = New TextSpan(0, 0), 445.changeSpan = New TextSpan(0, 0), 459.changeSpan = New TextSpan(0, 0), 641.changeSpan = New TextSpan(0, 0), 653.changeSpan = New TextSpan(0, 10), 689.changeSpan = New TextSpan(0, 0), 705Dim newText = oldText.WithChanges(New TextChange(New TextSpan(22, 0), " Sub ")) 744Dim newText = oldText.WithChanges(New TextChange(New TextSpan(103, 0), " ")) 770Dim newText = oldText.WithChanges(New TextChange(New TextSpan(insertionPoint, 0), " ")) 795Dim newText = oldText.WithChanges(New TextChange(New TextSpan(insertionPoint, replace.Length), "{")) 830Dim newText = oldText.WithChanges(New TextChange(New TextSpan(pos, 0), "'")) 852.changeSpan = New TextSpan(15, 0), 1160Dim span = New TextSpan(oldIText.Length, 0) 1166span = New TextSpan(0, code1.Length) 1206Dim span = New TextSpan(code.IndexOf("="c), 0) 1225Dim change = New TextChange(New TextSpan(position, 2), "End" + vbCrLf) 1243Dim change = New TextChange(New TextSpan(position, 0), " Select c" + vbCrLf) 1677Dim change = New TextChange(New TextSpan(position, 2), "71")
IncrementalParser\IPEndBlockStatements.vb (5)
35.changeSpan = New TextSpan(code.Length, 0), 164.changeSpan = New TextSpan(code.Length, 0), 302.changeSpan = New TextSpan(code.Length, 0), 448.changeSpan = New TextSpan(code.Length, 0), 550.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)
40Dim disabled = s.GetDisabledTextAt(New TextSpan(0, Str.Length))
TestSyntaxNodes.vb (47)
336VerifyListSpans(precedingTrivia, New TextSpan(tree.FullSpan.Start, (tree.SpanStart - tree.FullSpan.Start))) 342VerifyListSpans(followingTrivia, New TextSpan(tree.Span.End, (tree.FullSpan.End - tree.Span.End))) 361VerifyListSpans(precedingTrivia, New TextSpan(tree.FullSpan.Start, (tree.SpanStart - tree.FullSpan.Start))) 367VerifyListSpans(followingTrivia, New TextSpan(tree.Span.End, (tree.FullSpan.End - tree.Span.End))) 375Assert.Equal(New TextSpan(0, 1), dig1.Span) 376Assert.Equal(New TextSpan(0, 1), dig1.FullSpan) 381Assert.Equal(New TextSpan(0, 4), binop.Span) 382Assert.Equal(New TextSpan(1, 1), binop.OperatorToken.Span) 383Assert.Equal(New TextSpan(1, 2), binop.OperatorToken.FullSpan) 384Assert.Equal(New TextSpan(3, 1), binop.Right.Span) 385Assert.Equal(New TextSpan(3, 1), binop.Right.FullSpan) 388Assert.Equal(New TextSpan(0, 17), simpleTree.Span) 389Assert.Equal(New TextSpan(0, 18), simpleTree.FullSpan) 390Assert.Equal(New TextSpan(3, 14), DirectCast(simpleTree, BinaryExpressionSyntax).Right.Span) 393Assert.Equal(New TextSpan(6, 1), argList.Arguments(0).Span) 394Assert.Equal(New TextSpan(7, 1), argList.Arguments.GetWithSeparators(1).Span) 395Assert.Equal(New TextSpan(9, 4), argList.Arguments(1).Span) 396Assert.Equal(New TextSpan(13, 1), argList.Arguments.GetWithSeparators(3).Span) 397Assert.Equal(New TextSpan(15, 1), argList.Arguments(2).Span) 441Dim x As New TextSpan(-1, 0) 445Dim x As New TextSpan(0, -1) 449Dim x As New TextSpan(-1, -1) 453Dim x As New TextSpan(2, -4) 488VerifyListSpans(l, New TextSpan(0, 6)) 527VerifyListSpans(l, New TextSpan(0, 21)) 995CheckErrorList(kwModule, {17}, {New TextSpan(0, 6)}) 1001CheckErrorList(kwModule, {17, 42}, {New TextSpan(0, 6), New TextSpan(0, 6)}) 1007CheckErrorList(endModule, {101, 17, 42}, {New TextSpan(3, 3), New TextSpan(6, 6), New TextSpan(6, 6)}) 1012CheckErrorList(endModule, {1, 101, 17, 42}, {New TextSpan(0, 12), New TextSpan(3, 3), New TextSpan(6, 6), New TextSpan(6, 6)}) 1048{New TextSpan(26, 5), New TextSpan(26, 5), New TextSpan(71, 22), New TextSpan(94, 1), New TextSpan(96, 5)}) 1825Dim resultList = identExpr.DescendantTokens(New TextSpan(3, 18)) 2273Dim EOFSpan = New TextSpan(root.FullSpan.End, 0) 2283Dim nodeEndPositionSpan = New TextSpan(classDecl.FullSpan.End, 0) 2294Dim invalidSpan = New TextSpan(100, 100) 2296invalidSpan = New TextSpan(root.FullSpan.End - 1, 2) 2298invalidSpan = New TextSpan(classDecl2.FullSpan.Start - 1, root.FullSpan.End) 2300invalidSpan = New TextSpan(classDecl.FullSpan.End, root.FullSpan.End)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (2)
ParserTestUtilities.vb (1)
261newText = oldText.WithChanges(New TextChange(New TextSpan(0, 0), node.changeText))
SyntaxTreeExtensions.vb (1)
18Dim newFullText = oldFullText.WithChanges(New TextChange(New TextSpan(offset, length), newText))
Microsoft.CodeAnalysis.VisualBasic.Workspaces (5)
Classification\Worker.vb (1)
147AddClassification(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)
376issueSpan = 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)
98Return AssertFormatAsync(expected, code, SpecializedCollections.SingletonEnumerable(New TextSpan(0, code.Length)), changedOptionSet, testWithTransformation, experimental:=experimental)
Microsoft.CodeAnalysis.Workspaces (46)
Classification\ClassifierHelper.cs (1)
92var widenedSpan = new TextSpan(spans[0].Start, spans[^1].End);
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)
203var span = new TextSpan(spanStart, spanLength);
PatternMatching\AllLowerCamelCaseMatcher.cs (1)
191var matchSpanToAdd = new TextSpan(candidateHump.Start, possibleHumpMatchLength);
PatternMatching\PatternMatcher.cs (4)
307=> _includeMatchedSpans ? new TextSpan(start, length) : null; 450=> PartStartsWith(candidate, candidatePart, pattern, new TextSpan(0, pattern.Length), compareOptions); 587matchSpans.Add(new TextSpan(candidateHump.Start, patternChunkCharacterSpan.Length)); 597candidateHump = new TextSpan(candidateHump.Start + patternChunkCharacterSpan.Length, candidateHump.Length - patternChunkCharacterSpan.Length);
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (1)
422var matchTextSpan = new TextSpan(start, renameText.Length);
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (1)
24var 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)
122var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
39span = new TextSpan(offset + index, 2); 168result.Add(VirtualChar.Create(new Rune('"'), new TextSpan(offset + index, 2))); 207result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 1))); 214result.Add(VirtualChar.Create(rune, new TextSpan(offset + index, 2))); 221result.Add(VirtualChar.Create(ch, new TextSpan(offset + index, 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)
425DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 476DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
280if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
261span = new TextSpan(span.Start + i, span.Length - i);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (3)
738return new TextSpan(this.StartPosition, 0); 746return new TextSpan(Math.Min(this.StartPosition + i + 1, this.EndPosition), 0); 752return new TextSpan(this.EndPosition, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (2)
27Current = new TextSpan(nameSpan.Start, 0); 54Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
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)
117=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
83textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
Workspace\Solution\Document.cs (1)
449if (textChanges.Count > 1 || (textChanges.Count == 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 (17)
Differencing\TestTreeComparer.cs (1)
55=> 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)
561var 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 (4)
23=> new(value.Item1, value.Item2); 264=> new(value, 0); 399=> new(value, 0); 405=> 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.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.VisualStudio.LanguageServices (6)
CodeLens\RemoteCodeLensReferencesService.cs (1)
161var 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)
276Dim textChange1 = New TextChange(New TextSpan(19, 1), "N") 279Dim textChange2 = New TextChange(New TextSpan(47, 1), "Y")
Venus\DocumentService_IntegrationTests.vb (2)
328Return 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)
65Dim 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.VisualStudio.Next.UnitTests (1)
Remote\RemoteHostClientServiceFactoryTests.cs (1)
51var newText = oldText.WithChanges([new TextChange(new TextSpan(0, 1), "abc")]);
System.Text.RegularExpressions.Generator (1)
UpgradeToGeneratedRegexCodeFixer.cs (1)
140nodeToFix = root.FindNode(new TextSpan(nodeToFix.Span.Start + (typesModified * "partial".Length), nodeToFix.Span.Length), getInnermostNodeForTie: true);
5376 references to TextSpan
ConfigurationSchemaGenerator (1)
RuntimeSource\Configuration.Binder\Specs\InterceptorInfo.cs (1)
180TextSpan memberNameSpan = memberAccessExprSyntax.Name.Span;
IdeBenchmarks (2)
RegexClassifierBenchmarks.cs (2)
69protected Task<ImmutableArray<ClassifiedSpan>> GetClassificationSpansAsync(string code, TextSpan span, ParseOptions parseOptions) 78protected static async Task<ImmutableArray<ClassifiedSpan>> GetSemanticClassificationsAsync(Document document, TextSpan span)
IdeCoreBenchmarks (2)
ClassificationBenchmarks.cs (2)
85protected static async Task<ImmutableArray<ClassifiedSpan>> GetSemanticClassificationsAsync(Document document, TextSpan span) 100var span = new TextSpan(0, text.Length);
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 (283)
CodeGen\ILBuilder.cs (1)
1017internal 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)
493internal bool HasIntersectingLocation(SyntaxTree tree, TextSpan? filterSpanWithinTree = null) 516static 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)
1327var span = root.FullSpan; 2141TextSpan? filterSpan, 2167async ValueTask<IGroupedAnalyzerActions> getAllActionsAsync(AnalyzerDriver driver, ISymbol symbol, DiagnosticAnalyzer analyzer, SyntaxTree? filterTree, TextSpan? filterSpan, CancellationToken cancellationToken) 2183async ValueTask<IGroupedAnalyzerActions> getInheritedActionsAsync(AnalyzerDriver driver, ISymbol symbol, DiagnosticAnalyzer analyzer, SyntaxTree? filterTree, TextSpan? filterSpan, CancellationToken cancellationToken) 2207static async ValueTask<AnalyzerActions> getSymbolActionsCoreAsync(AnalyzerDriver driver, ISymbol symbol, DiagnosticAnalyzer analyzer, SyntaxTree? filterTree, TextSpan? filterSpan, CancellationToken cancellationToken) 2331protected bool IsGeneratedOrHiddenCodeLocation(SyntaxTree syntaxTree, TextSpan span, CancellationToken cancellationToken) 2334protected bool IsHiddenSourceLocation(SyntaxTree syntaxTree, TextSpan span)
DiagnosticAnalyzer\AnalyzerExecutor.AnalyzerDiagnosticReporter.cs (2)
29TextSpan? span, 85public TextSpan? FilterSpanForLocalDiagnostics;
DiagnosticAnalyzer\AnalyzerExecutor.cs (24)
45private readonly Func<SyntaxTree, TextSpan, CancellationToken, bool> _isGeneratedCodeLocation; 108Func<SyntaxTree, TextSpan, CancellationToken, bool> isGeneratedCodeLocation, 140Func<SyntaxTree, TextSpan, CancellationToken, bool> isGeneratedCodeLocation, 251TextSpan? filterSpan, 360TextSpan? filterSpan, 415TextSpan? filterSpan, 452TextSpan? filterSpan, 469TextSpan? filterSpan, 515TextSpan? filterSpan, 561TextSpan? filterSpan, 608TextSpan? filterSpan, 642TextSpan? filterSpan, 668TextSpan? filterSpan, 698TextSpan? filterSpan, 735TextSpan? filterSpan, 756TextSpan? filterSpan, 880TextSpan? filterSpan, 959TextSpan spanForContainingTopmostNodeForAnalysis, 961TextSpan? filterSpan, 989TextSpan? filterSpan, 1061TextSpan spanForContainingOperationBlock, 1063TextSpan? filterSpan, 1089TextSpan? filterSpan, 1451private AnalyzerDiagnosticReporter GetAddSemanticDiagnostic(SyntaxTree tree, TextSpan? span, DiagnosticAnalyzer analyzer, CancellationToken cancellationToken)
DiagnosticAnalyzer\AnalyzerManager.AnalyzerExecutionContext.cs (1)
143TextSpan? filterSpan,
DiagnosticAnalyzer\AnalyzerManager.cs (3)
95TextSpan? filterSpan, 109TextSpan? filterSpan, 189TextSpan? 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)
172public TextSpan FullSpan 180public TextSpan Span
Syntax\SyntaxDiffer.cs (17)
22private readonly TextSpan _oldSpan; 71internal static IList<TextSpan> GetPossiblyDifferentTextSpans(SyntaxTree? before, SyntaxTree? after) 76return SpecializedCollections.EmptyList<TextSpan>(); 94internal static IList<TextSpan> GetPossiblyDifferentTextSpans(SyntaxNode oldNode, SyntaxNode newNode) 99private IList<TextSpan> ComputeSpansInNew() 105var newSpans = new List<TextSpan>(); 532var oldSpan = GetSpan(_oldNodes, 0, oldNodeCount); 544var oldSpan = removedNode.FullSpan; 547var newSpan = insertedNode.FullSpan; 553var oldSpan = GetSpan(_oldNodes, 0, oldNodeCount); 556var newSpan = GetSpan(_newNodes, 0, newNodeCount); 565var newSpan = GetSpan(_newNodes, 0, newNodeCount); 624private static TextSpan GetSpan(Stack<SyntaxNodeOrToken> stack, int first, int length) 646return TextSpan.FromBounds(start, end); 649private static TextSpan GetSpan(Queue<SyntaxNodeOrToken> queue, int first, int length) 671return TextSpan.FromBounds(start, end); 826var span = GetSpan(queue, 0, queue.Count);
Syntax\SyntaxList`1.cs (6)
157public TextSpan FullSpan 163return default(TextSpan); 167return TextSpan.FromBounds(this[0].FullSpan.Start, this[this.Count - 1].FullSpan.End); 175public TextSpan Span 181return default(TextSpan); 185return TextSpan.FromBounds(this[0].Span.Start, this[this.Count - 1].Span.End);
Syntax\SyntaxNode.cs (12)
84public TextSpan FullSpan => new TextSpan(this.Position, this.Green.FullWidth); 91public TextSpan Span 113/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 884public IEnumerable<SyntaxNode> DescendantNodes(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 905public IEnumerable<SyntaxNode> DescendantNodesAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 926public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 947public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 962public SyntaxNode FindNode(TextSpan span, bool findInsideTrivia = false, bool getInnermostNodeForTie = false) 971!.FirstAncestorOrSelf<SyntaxNode, TextSpan>((a, span) => a.FullSpan.Contains(span), span); 1052public IEnumerable<SyntaxToken> DescendantTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 1189public IEnumerable<SyntaxTrivia> DescendantTrivia(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 1533var 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)
226public TextSpan Span 240return default(TextSpan); 245/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 272public TextSpan FullSpan 286return default(TextSpan);
Syntax\SyntaxNodeOrTokenList.cs (4)
167public TextSpan FullSpan => _node?.FullSpan ?? default(TextSpan); 172public TextSpan Span => _node?.Span ?? default(TextSpan);
Syntax\SyntaxReference.cs (1)
24public abstract TextSpan Span { get; }
Syntax\SyntaxToken.cs (4)
105public TextSpan Span 109return Node != null ? new TextSpan(Position + Node.GetLeadingTriviaWidth(), Node.Width) : default(TextSpan); 119/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 132public TextSpan FullSpan => new TextSpan(Position, FullWidth);
Syntax\SyntaxTokenList.cs (5)
151public TextSpan FullSpan 157return default(TextSpan); 167public TextSpan Span 173return default(TextSpan); 176return TextSpan.FromBounds(Position + Node.GetLeadingTriviaWidth(),
Syntax\SyntaxTree.cs (7)
218public abstract FileLinePositionSpan GetLineSpan(TextSpan span, CancellationToken cancellationToken = default); 235public abstract FileLinePositionSpan GetMappedLineSpan(TextSpan span, CancellationToken cancellationToken = default); 268internal virtual FileLinePositionSpan GetMappedLineSpanAndVisibility(TextSpan span, out bool isHiddenPosition) 284internal string GetDisplayPath(TextSpan span, SourceReferenceResolver? resolver) 319internal int GetDisplayLineNumber(TextSpan span) 335public abstract IList<TextSpan> GetChangedSpans(SyntaxTree syntaxTree); 340public abstract Location GetLocation(TextSpan span);
Syntax\SyntaxTreeExtensions.cs (3)
24var fullSpan = new TextSpan(0, text.Length); 31var change = TextChangeRange.Collapse(changes).Span; 44var span = node.FullSpan;
Syntax\SyntaxTrivia.cs (5)
90public TextSpan Span 96: default(TextSpan); 101/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 120public TextSpan FullSpan 122get { return UnderlyingNode != null ? new TextSpan(Position, UnderlyingNode.FullWidth) : default(TextSpan); }
Syntax\SyntaxTriviaList.cs (5)
149public TextSpan FullSpan 155return default(TextSpan); 165public TextSpan Span 171return default(TextSpan); 174return 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)
24public TextSpan Span { get; } 37public TextChange(TextSpan span, string newText) 65EqualityComparer<TextSpan>.Default.Equals(this.Span, other.Span) &&
Text\TextChangeRange.cs (4)
21public TextSpan Span { get; } 35public TextChangeRange(TextSpan span, int newLength) 126var 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.CodeStyle (380)
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)
143private IEnumerable<TextSpan> GetContiguousSpans(ImmutableArray<SyntaxNode> nodes) 146(SyntaxNode node, TextSpan textSpan)? previous = null; 151TextSpan textSpan; 155textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 163textSpan = TextSpan.FromBounds(previous.Value.textSpan.Start, nodeEnd); 169textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 196IEnumerable<TextSpan> contiguousSpans, SyntaxTree tree, 199foreach (var span in contiguousSpans) 210protected abstract IEnumerable<TextSpan> GetFixableDiagnosticSpans( 218foreach (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)
37var unnecessarySpans = new List<TextSpan>(); 77out string? formatString, List<TextSpan> unnecessarySpans) 183private static TextSpan GetSpanWithinLiteralQuotes(IVirtualCharService virtualCharService, SyntaxToken formatToken) 188: TextSpan.FromBounds(sequence.First().Span.Start, sequence.Last().Span.End); 193out TExpressionSyntax? alignment, out bool negate, List<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)
151var location1 = Location.Create(syntaxTree, TextSpan.FromBounds( 157locations.Add(syntaxTree.GetLocation(TextSpan.FromBounds(match.Initializer.FullSpan.End, match.Statement.Span.End)));
src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs (3)
24var fullSpan = new TextSpan(0, text.Length); 31var change = TextChangeRange.Collapse(changes).Span; 44var 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)
104var thisSpan = introspector.GetSpan(value); 124var thisSpan = introspector.GetSpan(value); 137var 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 (42)
14internal sealed class NormalizedTextSpanCollection : ReadOnlyCollection<TextSpan> 21: base(new List<TextSpan>(0)) 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 = new List<TextSpan>(1) 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 (8)
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)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal record class EditorConfigOption(Section Section, TextSpan? Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (2)
12internal record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value) 16public static implicit operator EditorConfigOption<T>((Section section, TextSpan? span, T value) tuple)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
122var 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 (3)
23public readonly TextSpan Span; 25public EmbeddedDiagnostic(string message, TextSpan span) 49hashCode = hashCode * -1521134295 + EqualityComparer<TextSpan>.Default.GetHashCode(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)
73public TextSpan GetSpan() 76public TextSpan? GetFullSpan() 91return 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)
30string tokenText, int index, int offset, out TextSpan span) 174if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 242return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (5)
18/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 48public readonly TextSpan Span; 54public static VirtualChar Create(Rune rune, TextSpan span) 62public static VirtualChar Create(char surrogateChar, TextSpan span) 70private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
108var 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)
14private static bool ShouldAnalyze(TextSpan? contextFilterSpan, TextSpan span) 24public static bool ShouldAnalyzeSpan(this SyntaxTreeAnalysisContext context, TextSpan span) 34public static bool ShouldAnalyzeSpan(this SemanticModelAnalysisContext context, TextSpan span) 44public static bool ShouldAnalyzeSpan(this SymbolStartAnalysisContext context, TextSpan span, SyntaxTree tree) 64public static bool ShouldAnalyzeSpan(this SymbolAnalysisContext context, TextSpan span, SyntaxTree tree) 84public static bool ShouldAnalyzeSpan(this AdditionalFileAnalysisContext context, TextSpan span) 94public static bool ShouldAnalyzeSpan(this OperationBlockStartAnalysisContext context, TextSpan span) 104public static bool ShouldAnalyzeSpan(this OperationBlockAnalysisContext context, TextSpan span) 114public static bool ShouldAnalyzeSpan(this OperationAnalysisContext context, TextSpan span) 124public static bool ShouldAnalyzeSpan(this SyntaxNodeAnalysisContext context, TextSpan span) 134public static bool ShouldAnalyzeSpan<TSytnaxKind>(this CodeBlockStartAnalysisContext<TSytnaxKind> context, TextSpan span) where TSytnaxKind : struct 144public static bool ShouldAnalyzeSpan(this CodeBlockAnalysisContext context, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (2)
33this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden, CancellationToken cancellationToken) 45this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (11)
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)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (3)
18public static bool OverlapsHiddenPosition([NotNullWhen(returnValue: true)] this SyntaxTree? tree, TextSpan span, CancellationToken cancellationToken) 95public static bool IsEntirelyHidden(this SyntaxTree tree, TextSpan span, CancellationToken cancellationToken) 249public 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 (14)
46private readonly HashSet<TextSpan> _indentationMap = []; 47private readonly HashSet<TextSpan> _suppressWrappingMap = []; 48private readonly HashSet<TextSpan> _suppressSpacingMap = []; 49private readonly HashSet<TextSpan> _suppressFormattingMap = []; 50private readonly HashSet<TextSpan> _anchorMap = []; 141var baseSpan = _initialIndentBlockOperations[0].TextSpan; 160var operationSpan = operations[i].TextSpan; 181var intervalTreeSpan = operation.TextSpan; 410private static void DebugCheckEmpty<T, TIntrospector>(ContextMutableIntervalTree<T, TIntrospector> tree, TextSpan textSpan) 449var span = token.Span; 470var span = token.Span; 593public bool IsWrappingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 615public bool IsSpacingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 651public bool IsFormattingDisabled(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.IndentationData.cs (14)
18private abstract class IndentationData(TextSpan textSpan) 20public TextSpan TextSpan { get; } = textSpan; 23public IndentationData WithTextSpan(TextSpan span) 26protected abstract IndentationData WithTextSpanCore(TextSpan span); 29private sealed class SimpleIndentationData(TextSpan textSpan, int indentation) : IndentationData(textSpan) 33protected override IndentationData WithTextSpanCore(TextSpan span) 57public 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) 68this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 71private 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) 82this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 85public TextSpan InseparableRegionSpan { get; } 107protected override IndentationData WithTextSpanCore(TextSpan span) 119public AdjustedIndentationData(TextSpan textSpan, IndentationData baseIndentationData, int adjustment) 142protected override IndentationData WithTextSpanCore(TextSpan span)
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)
47var thisSpan = Introspector.GetSpan(value); 59var thisSpan = Introspector.GetSpan(value); 129var resultSpan = Introspector.GetSpan(result!); 130var currentNodeSpan = Introspector.GetSpan(currentNode.Value);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (5)
44protected readonly TextSpan SpanToFormat; 331private TextSpan GetSpanToFormat() 336return TextSpan.FromBounds(startPosition, endPosition); 453var 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)
53public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
88public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
51public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
69public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.NodeAndText.cs (3)
38return _text.ToString(TextSpan.FromBounds(token2.FullSpan.Start, token2.SpanStart)); 44return _text.ToString(TextSpan.FromBounds(token1.Span.End, token1.FullSpan.End)); 47return _text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
37public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (13)
240var span = textChange.Span; 268internal static IEnumerable<TextSpan> GetAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 278static IEnumerable<TextSpan> EnumerateAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 290internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 305return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 308internal static TextSpan GetElasticSpan(SyntaxToken token) 311private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 313var aggregateSpans = new List<TextSpan>(); 315var last = default(TextSpan); 316foreach (var span in spans) 324last = 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)
16internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 30public TextSpan TextSpan { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\FormattingOperations.cs (8)
31=> CreateAnchorIndentationOperation(anchorToken, endToken, TextSpan.FromBounds(anchorToken.Span.End, endToken.Span.End)); 36public static AnchorIndentationOperation CreateAnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 43=> CreateSuppressOperation(startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End), option); 48private static SuppressOperation CreateSuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option) 56var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 63public static IndentBlockOperation CreateIndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 71var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 79public 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)
15internal IndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 34internal IndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 57public TextSpan TextSpan { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\SuppressOperation.cs (2)
15public readonly TextSpan TextSpan; 20internal SuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (13)
46private delegate void WhitespaceAppender<T>(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<T> changes); 388var span = GetTextSpan(trivia1, trivia2); 500var span = TextSpan.FromBounds(start, end); 716var insertionPoint = GetInsertionSpan(changes); 731private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 766TextSpan notUsed, 823private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 826private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes) 832private TextSpan GetTextSpan(SyntaxTrivia trivia1, SyntaxTrivia trivia2) 836return TextSpan.FromBounds(this.StartPosition, trivia2.FullSpan.Start); 841return TextSpan.FromBounds(trivia1.FullSpan.End, this.EndPosition); 844return TextSpan.FromBounds(trivia1.FullSpan.End, trivia2.FullSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\AbstractUnnecessaryImportsProvider.cs (2)
23public ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken) 27SemanticModel model, TextSpan? span, Func<SyntaxNode, bool>? predicate, CancellationToken cancellationToken)
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)
238private TextSpan GetNormalizedSpan(int position) 242return TextSpan.FromBounds(LineToBeIndented.Start, position); 245return TextSpan.FromBounds(position, LineToBeIndented.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (19)
159var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 173private WordSpanEnumerable GetWordSpans(string name, TextSpan nameSpan) 176private static string Substring(string name, TextSpan wordSpan) 179private static readonly Func<string, TextSpan, bool> s_firstCharIsLowerCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsLower(val[span.Start]); 180private static readonly Func<string, TextSpan, bool> s_firstCharIsUpperCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsUpper(val[span.Start]); 182private static readonly Func<string, TextSpan, bool> s_wordIsAllUpperCase = (val, span) => 195private static readonly Func<string, TextSpan, bool> s_wordIsAllLowerCase = (val, span) => 209string name, TextSpan nameSpan, Func<string, TextSpan, bool> wordCheck, 231private bool CheckPascalCase(string name, TextSpan nameSpan, out string reason) 236private bool CheckAllUpper(string name, TextSpan nameSpan, out string reason) 241private bool CheckAllLower(string name, TextSpan nameSpan, out string reason) 247string name, TextSpan nameSpan, 248Func<string, TextSpan, bool> firstWordCheck, 249Func<string, TextSpan, bool> restWordCheck, 290private bool CheckCamelCase(string name, TextSpan nameSpan, out string reason) 297private bool CheckFirstUpper(string name, TextSpan nameSpan, out string reason) 405using var parts = TemporaryArray<TextSpan>.Empty;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
13private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (4)
18private readonly TextSpan _nameSpan; 21public WordSpanEnumerator(string name, TextSpan nameSpan, string wordSeparator) 30public TextSpan Current { get; private set; } 72Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
46var headerSpan = TextSpan.FromBounds(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (4)
35SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 39SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 43SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, 78SyntaxNode root, SourceText text, TextSpan textSpan,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (7)
413bool ContainsInMemberBody([NotNullWhen(true)] SyntaxNode? node, TextSpan span); 415TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 418/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 419/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 421/// an empty <see cref="TextSpan"/> at position 0. 424TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 468bool 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.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)
46public static IEnumerable<(SyntaxToken, SyntaxToken)> ConvertToTokenPairs(this SyntaxNode root, IReadOnlyList<TextSpan> spans) 82public static ValueTuple<SyntaxToken, SyntaxToken> ConvertToTokenPair(this SyntaxNode root, TextSpan textSpan) 158=> (token1.RawKind == 0) ? text.ToString(TextSpan.FromBounds(0, token2.SpanStart)) : text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart)); 260public static TextSpan GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(SyntaxToken startToken, SyntaxToken endToken) 267return TextSpan.FromBounds(startPosition, endPosition); 325var fullSpan = node.FullSpan; 358public static TextSpan GetFormattingSpan(SyntaxNode root, TextSpan span) 368return 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 (55)
src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
56var span = diagnostic.Location.SourceSpan;
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (8)
333edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 337edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, bottomEnd), "")); 346edits.Add(new TextChange(TextSpan.FromBounds(startPos, equalsEnd), "")); 350edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), "")); 359edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 365edits.Add(new TextChange(TextSpan.FromBounds(secondMiddlePos, equalsEnd), "")); 371edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, equalsEnd), "")); 376edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), ""));
src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (1)
48private static bool TryGetNode(SyntaxNode root, TextSpan span, out SyntaxNode node)
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
49private static TXmlElementSyntax? GetParamNode(SyntaxNode root, TextSpan span)
src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (3)
68var diagnosticSpan = diagnostic.Location.SourceSpan; 70var spanToFormat = TextSpan.FromBounds(
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.cs (2)
21SemanticDocument document, TextSpan textSpan, CancellationToken cancellationToken, 26TextSpan textSpan,
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (2)
30TextSpan textSpan, 46TextSpan textSpan,
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\IGenerateDefaultConstructorsService.cs (1)
18Document document, TextSpan textSpan, bool forRefactoring, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (1)
63TextSpan span, Diagnostic diagnostic)
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (1)
32var span = context.Span;
src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (1)
44protected virtual bool TryGetNode(SyntaxNode root, TextSpan span, out SyntaxNode node)
src\Analyzers\Core\CodeFixes\MakeFieldReadonly\AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
48var 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)
46protected static TextSpan GetSpan(SyntaxNode node) 51return TextSpan.FromBounds(start.SpanStart, end.Span.End); 93var span = GetSpan(destination);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (3)
35ParsedDocument document, TextSpan selectionRaw, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 46var selectionTrimmed = CodeRefactoringHelpers.GetTrimmedTextSpan(document, selectionRaw); 348TextSpan selectionTrimmed,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (6)
41public static bool IsNodeUnderselected(SyntaxNode? node, TextSpan selection) 103/// Returns unchanged <paramref name="span"/> in case <see cref="TextSpan.IsEmpty"/>. 104/// Returns empty Span with original <see cref="TextSpan.Start"/> in case it contains only whitespace. 106public static TextSpan GetTrimmedTextSpan(ParsedDocument document, TextSpan span) 121return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\IRefactoringHelpersService.cs (1)
57ParsedDocument 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)
34IEnumerable<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
133public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (1)
373using 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)
40return 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)
20Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameActionAnnotation.cs (2)
17TextSpan originalSpan, 30public 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)
55ImmutableArray<TextSpan> spans, 100ImmutableArray<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,
Microsoft.CodeAnalysis.CSharp (185)
Binder\Binder_Expressions.cs (2)
5307var errorSpan = new TextSpan(start, end - start); 9137location = expr.Syntax.SyntaxTree.GetLocation(TextSpan.FromBounds(expr.Syntax.SpanStart, conditional.OperatorToken.Span.End));
Binder\Binder_Statements.cs (2)
3404Text.TextSpan.FromBounds(lambdaSyntax.SpanStart, lambdaSyntax.ArrowToken.Span.End)); 3408Text.TextSpan.FromBounds(anonymousMethodSyntax.SpanStart,
Binder\Binder_Symbols.cs (1)
456diagnostics.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) 640private static bool InSpan(Location location, SyntaxTree syntaxTree, TextSpan span) 649private static bool InSpan(ImmutableArray<Location> locations, SyntaxTree syntaxTree, TextSpan span) 1066TextSpan 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(SyntaxTree syntaxTree, 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)"/>. 2638TextSpan infoSpan = info.Span; 2765public readonly TextSpan Span; 2767public ImportInfo(SyntaxTree tree, SyntaxKind kind, TextSpan span) 2952var location = syntaxTree.GetLocation(TextSpan.FromBounds(0, 0)); 3046private static bool IsDefinedOrImplementedInSourceTree(Symbol symbol, SyntaxTree tree, TextSpan? span) 3062private ImmutableArray<Diagnostic> GetDiagnosticsForMethodBodiesInTree(SyntaxTree tree, TextSpan? span, CancellationToken cancellationToken) 3143void compileMethodBodiesAndDocComments(SyntaxTree? filterTree, TextSpan? filterSpan, BindingDiagnosticBag bindingDiagnostics, CancellationToken cancellationToken) 3194private 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) 3243private ReadOnlyBindingDiagnostic<AssemblySymbol> GetClsComplianceDiagnostics(SyntaxTree? syntaxTree, TextSpan? filterSpanWithinTree, CancellationToken cancellationToken) 3266private static IEnumerable<Diagnostic> FilterDiagnosticsByLocation(IEnumerable<Diagnostic> diagnostics, SyntaxTree tree, TextSpan? filterSpanWithinTree) 3280TextSpan? filterSpanWithinTree,
Compilation\CSharpSemanticModel.cs (2)
1314var fullSpan = this.Root.FullSpan; 5241internal override void ComputeDeclarationsInSpan(TextSpan span, bool getSymbol, ArrayBuilder<DeclarationInfo> builder, CancellationToken cancellationToken)
Compilation\MemberSemanticModel.cs (7)
571public sealed override ImmutableArray<Diagnostic> GetSyntaxDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 576public sealed override ImmutableArray<Diagnostic> GetDeclarationDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 581public sealed override ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 586public sealed override ImmutableArray<Diagnostic> GetDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 1834TextSpan resultSpan = default(TextSpan); 1840var 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)) 848var span = node.Span; 1004private MemberSemanticModel GetOrAddModelForParameter(ParameterSyntax paramDecl, TextSpan span) 1045private MemberSemanticModel GetOrAddModelIfContains(CSharpSyntaxNode node, TextSpan span) 1720private NamespaceSymbol GetDeclaredNamespace(NamespaceOrTypeSymbol container, TextSpan declarationSpan, NameSyntax name) 1751private 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)
577/// <see cref="SemanticModel.GetDiagnostics(Text.TextSpan?, System.Threading.CancellationToken)"/> API.
FlowAnalysis\AbstractFlowPass.cs (2)
294protected readonly TextSpan RegionSpan; 296protected bool RegionContains(TextSpan span)
Generated\BoundNodes.xml.Generated.cs (7)
3172public BoundSequencePointWithSpan(SyntaxNode syntax, BoundStatement? statementOpt, TextSpan span, bool hasErrors = false) 3180public TextSpan Span { get; } 3185public BoundSequencePointWithSpan Update(BoundStatement? statementOpt, TextSpan span) 3273public BoundStepThroughSequencePoint(SyntaxNode syntax, TextSpan span, bool hasErrors) 3279public BoundStepThroughSequencePoint(SyntaxNode syntax, TextSpan span) 3285public TextSpan Span { get; } 3290public 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)
1197public 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 (1)
736info.Text = TextWindow.Text.ToString(TextSpan.FromBounds(startingPosition, end));
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
24TextSpan span,
Symbols\Source\GlobalExpressionVariable.cs (3)
34TextSpan locationSpan) 47TextSpan locationSpan, 173TextSpan locationSpan,
Symbols\Source\SourceConstructorSymbolBase.cs (1)
172TextSpan 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)
1011public override bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken)
Symbols\Source\SourceMemberFieldSymbol.cs (2)
29TextSpan locationSpan) 633public 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) 456public override bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken = default(CancellationToken))
Symbols\Source\SourceOrdinaryMethodSymbol.cs (1)
443TextSpan? definedWithinSpan,
Symbols\Symbol.cs (4)
440public virtual bool HasLocationContainedWithin(SyntaxTree tree, TextSpan declarationSpan, out bool wasZeroWidthMatch) 452protected static bool IsLocationContainedWithin(Location loc, SyntaxTree tree, TextSpan declarationSpan, out bool wasZeroWidthMatch) 932public virtual bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken = default(CancellationToken)) 953protected static bool IsDefinedInSourceTree(SyntaxReference syntaxRef, SyntaxTree tree, TextSpan? definedWithinSpan)
Symbols\SymbolDistinguisher.cs (1)
169var 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)
597public override IList<TextSpan> GetChangedSpans(SyntaxTree oldTree) 646public override FileLinePositionSpan GetLineSpan(TextSpan span, CancellationToken cancellationToken = default) 665public override FileLinePositionSpan GetMappedLineSpan(TextSpan span, CancellationToken cancellationToken = default) 681/// Gets a <see cref="FileLinePositionSpan"/> for a <see cref="TextSpan"/>. FileLinePositionSpans are used 684/// <param name="span">The source <see cref="TextSpan" /> to convert.</param> 687internal override FileLinePositionSpan GetMappedLineSpanAndVisibility(TextSpan span, out bool isHiddenPosition) 720internal bool? IsNullableAnalysisEnabled(TextSpan span) => GetNullableContextStateMap().IsNullableAnalysisEnabled(span); 758public 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 (11)
75private readonly HashSet<TextSpan> _spanSet; 77private readonly TextSpan _totalSpan; 97_spanSet = new HashSet<TextSpan>( 132private static TextSpan ComputeTotalSpan(IEnumerable<TextSpan> spans) 138foreach (var span in spans) 156private bool ShouldVisit(TextSpan span) 166foreach (var s in _spanSet) 289private readonly TextSpan _elementSpan; 296TextSpan elementSpan, 315private bool ShouldVisit(TextSpan span)
Microsoft.CodeAnalysis.CSharp.CodeStyle (97)
src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (2)
133var ifStatementSpanWithoutElse = TextSpan.FromBounds(statement.Span.Start, embeddedStatement.Span.End);
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
55: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.SemicolonToken.Span.End));
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
58: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.Name.Span.End));
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_ProgramMain.cs (1)
72TextSpan.FromBounds(start, root.Members.OfType<GlobalStatementSyntax>().Last().FullSpan.End));
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (2)
182var fadeLocation = Location.Create(tree, TextSpan.FromBounds(firstStatement.SpanStart, previousToken.Span.End)); 203fadeLocation = Location.Create(tree, TextSpan.FromBounds(nextToken.Span.Start, ifStatement.Span.End));
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastDiagnosticAnalyzer.cs (3)
29protected override TextSpan GetFadeSpan(ExpressionSyntax node) 32CastExpressionSyntax cast => TextSpan.FromBounds(cast.OpenParenToken.SpanStart, cast.CloseParenToken.Span.End), 33BinaryExpressionSyntax 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)
228var startReportSpan = TextSpan.FromBounds(anonymousFunction.SpanStart, invokedExpression.SpanStart); 229var endReportSpan = TextSpan.FromBounds(invokedExpression.Span.End, anonymousFunction.Span.End);
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (7)
82private static ImmutableArray<TextSpan> AnalyzeCodeBlock(CodeBlockAnalysisContext context, int positionOfFirstReducingNullableDirective) 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)
81SemanticModelAnalysisContext context, SyntaxNode root, TextSpan sourceSpan) 134var 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)
68syntaxTree.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)
47var 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)
67private static Diagnostic CreateDiagnostic(DiagnosticDescriptor descriptor, SyntaxNode declaration, TextSpan diagnosticSpan, NotificationOption2 notificationOption, AnalyzerOptions analyzerOptions)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
259TextSpan.FromBounds(arguments.First().SpanStart, arguments.Last().Span.End));
src\Analyzers\CSharp\Analyzers\UseInferredMemberName\CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (4)
55var fadeSpan = TextSpan.FromBounds(nameColon.Name.SpanStart, nameColon.ColonToken.Span.End); 81var fadeSpan = TextSpan.FromBounds(nameEquals.Name.SpanStart, nameEquals.EqualsToken.Span.End);
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
314var scopeSpan = scope.Span;
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (2)
124var span = TextSpan.FromBounds(elements[0].Syntax.SpanStart, elements[^1].Syntax.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (10)
207var lineSpan = currentLine.Span; 254using var _ = ArrayBuilder<(char ch, TextSpan span)>.GetInstance(out var charResults); 287string tokenText, int offset, int startIndexInclusive, int endIndexExclusive, ArrayBuilder<(char ch, TextSpan span)> charResults) 306private static void ConvertCharactersToRunes(ArrayBuilder<(char ch, TextSpan span)> charResults, ImmutableSegmentedList<VirtualChar>.Builder runeResults) 326runeResults.Add(VirtualChar.Create(rune, TextSpan.FromBounds(span.Start, nextSpan.End))); 340ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 353ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 387ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 406ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index, char character) 519result.Add((character, TextSpan.FromBounds(startIndex + offset, endIndex + offset)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (5)
514public static bool ContainsInterleavedDirective(this SyntaxNode syntaxNode, TextSpan span, CancellationToken cancellationToken) 519TextSpan textSpan, 528TextSpan textSpan, 547TextSpan textSpan, 559var matchSpan = match.Span;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (1)
239var name = SyntaxFactory.ParseName(syntaxTree.GetText(cancellationToken).ToString(TextSpan.FromBounds(genericIdentifier.SpanStart, lastToken.Span.End)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (4)
197var fullSpan = trivia.FullSpan; 226var span = trivia.FullSpan; 407var span = token.Span; 453var 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)
56var span = TextSpan.FromBounds(commonToken1.Span.End, formatSpanEnd); 106public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs (1)
58public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (1)
104public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (4)
99private TextSpan GetTextSpan(ValueTuple<SyntaxToken, SyntaxToken> pair) 103return TextSpan.FromBounds(_node.FullSpan.Start, pair.Item2.SpanStart); 108return TextSpan.FromBounds(pair.Item1.Span.End, _node.FullSpan.End); 111return 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); 363AddIndentBlockOperation(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)
188var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (2)
67_root, [TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)], _options.FormattingOptions, smartTokenformattingRules, cancellationToken); 121_root, [TextSpan.FromBounds(adjustedStartPosition, adjustedEndPosition)], _options.FormattingOptions, smartTokenFormattingRules, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (7)
946public TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node) 973public bool ContainsInMemberBody([NotNullWhen(true)] SyntaxNode? node, TextSpan span) 993private static TextSpan GetBlockBodySpan(BlockSyntax body) 994=> TextSpan.FromBounds(body.OpenBraceToken.Span.End, body.CloseBraceToken.SpanStart); 1106public TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) 1135return !branch.IsActive || !branch.BranchTaken ? TextSpan.FromBounds(branch.FullSpan.Start, position) : default; 1372public bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (37)
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (1)
49private static (SyntaxNode container, SyntaxNode exprOrStatement) GetContainer(SyntaxNode root, TextSpan span)
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
39var 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)
55using 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)
52var span = context.Span;
src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (1)
33var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
210SyntaxNode root, TextSpan span, [NotNullWhen(true)] out SyntaxNode? node)
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
132var referenceSpan = location.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
35var span = context.Span;
src\Analyzers\CSharp\CodeFixes\MakeRefStruct\MakeRefStructCodeFixProvider.cs (1)
39var span = context.Span;
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
93edits.Add(new TextChange(TextSpan.FromBounds(start, end), ""));
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
95edits.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)
846var 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)
34var span = GetUsingsSpan(root, namespaceDeclaration); 50private static TextSpan GetUsingsSpan(CompilationUnitSyntax root, BaseNamespaceDeclarationSyntax? namespaceDeclaration) 57return TextSpan.FromBounds(start, end); 66return TextSpan.FromBounds(start, end); 74return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (3)
31indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken)); 37indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken)); 49indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.cs (5)
62var spansToFormat = new List<TextSpan>(); 74List<TextSpan> spans, 78spans.Add(TextSpan.FromBounds(0, GetEndPosition(compilationUnit, compilationUnit.Members))); 86List<TextSpan> spans, 90spans.Add(TextSpan.FromBounds(namespaceMember.SpanStart, GetEndPosition(namespaceMember, namespaceMember.Members)));
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)
15189var diagnosticSpan = new TextSpan(2, 2);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (79)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (3)
113private static TextSpan? GetFormattedTextSpan(SyntaxNode root, SyntaxToken endToken) 132return CommonFormattingHelpers.GetFormattingSpan(root, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)); 212var 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)
200var renameSpan = solutionAndRenameSpan.Value.renameSpan; 212private static async Task<(Solution solution, TextSpan renameSpan)?> TryGetNewSolutionWithAddedMethodAsync(
Formatting\CSharpFormattingInteractionService.cs (3)
85TextSpan? textSpan, 92var formattingSpan = CommonFormattingHelpers.GetFormattingSpan(parsedDocument.Root, span); 97public Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken)
InlineRename\CSharpEditorInlineRenameService.cs (4)
39using var _1 = PooledHashSet<TextSpan>.GetInstance(out var seen); 55var textSpan = inlineRenameInfo.TriggerSpan; 108void 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)
69/// mapped forward (<see cref="MapSpanForward(TextSpan)"/>) to <see cref="SnapshotAfterPaste"/> in an inclusive 75protected readonly ImmutableArray<TextSpan> TextContentsSpansAfterPaste; 130protected TextSpan MapSpanForward(TextSpan span) 138SourceText textAfterChange, ImmutableArray<TextSpan> textContentSpansAfterChange) 153SourceText textAfterChange, ImmutableArray<TextSpan> textContentSpansAfterChange)
StringCopyPaste\KnownSourcePasteProcessor.cs (3)
34TextSpan selectionSpanBeforePaste, 41private readonly TextSpan _selectionSpanBeforePaste = selectionSpanBeforePaste; 158out SourceText textAfterBasicPaste, out ImmutableArray<TextSpan> contentSpansAfterBasicPaste)
StringCopyPaste\StringCopyPasteCommandHandler.cs (4)
252return textBeforePaste.ToString(TextSpan.FromBounds(lastLine.Span.Start, quotePosition)); 282var spanAfterPaste = MapSpan(stringExpressionBeforePaste.Span, snapshotBeforePaste, snapshotAfterPaste); 303var spanAfterPaste = MapSpan(stringExpressionBeforePaste.Span, snapshotBeforePaste, snapshotAfterPaste); 346static 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)
183public static int GetLongestQuoteSequence(SourceText text, TextSpan span) 186public static int GetLongestOpenBraceSequence(SourceText text, TextSpan span) 189public static int GetLongestCloseBraceSequence(SourceText text, TextSpan span) 197private static int GetLongestCharacterSequence(SourceText text, TextSpan span, char character) 514commonIndentPrefix = GetCommonIndentationPrefix(commonIndentPrefix, text, TextSpan.FromBounds(line.Start, nonWhitespaceIndex)); 521private static string? GetCommonIndentationPrefix(string? commonIndentPrefix, SourceText text, TextSpan lineWhitespaceSpan) 539public static TextSpan MapSpan(TextSpan span, ITextSnapshot from, ITextSnapshot to) 542public static bool RawContentMustBeMultiLine(SourceText text, ImmutableArray<TextSpan> spans) 558foreach (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})" />
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (77)
AddMissingImports\CSharpAddMissingImportsRefactoringProviderTests.cs (1)
32var pastedTextSpan = hostDocument.SelectedSpans.FirstOrDefault();
Classification\SemanticClassifierTests.cs (1)
34protected override async Task<ImmutableArray<ClassifiedSpan>> GetClassificationSpansAsync(string code, ImmutableArray<TextSpan> spans, ParseOptions? options, TestHost testHost)
Classification\SemanticClassifierTests_TestMarkup.cs (2)
59ImmutableArray<TextSpan> spans, 76foreach (var current in remainder)
Classification\SyntacticClassifierTests.cs (1)
21protected override async Task<ImmutableArray<ClassifiedSpan>> GetClassificationSpansAsync(string code, ImmutableArray<TextSpan> spans, ParseOptions? options, TestHost testHost)
Classification\TotalClassifierTests.cs (1)
32protected override async Task<ImmutableArray<ClassifiedSpan>> GetClassificationSpansAsync(string code, ImmutableArray<TextSpan> spans, ParseOptions? options, TestHost testHost)
CodeActions\MoveType\MoveTypeTests.MoveScope.cs (1)
918var textSpan = workspace.Documents[0].SelectedSpans[0];
CodeActions\PreviewExceptionTests.cs (1)
110var span = document.GetSyntaxRootAsync().Result.Span;
CodeActions\PreviewTests.cs (1)
95var span = document.GetSyntaxRootAsync().Result.Span;
CodeActions\SyncNamespace\CSharpSyncNamespaceTestsBase.cs (4)
124conflictSpans: ImmutableArray<TextSpan>.Empty, 125renameSpans: ImmutableArray<TextSpan>.Empty, 126warningSpans: ImmutableArray<TextSpan>.Empty, 127navigationSpans: ImmutableArray<TextSpan>.Empty,
Completion\CompletionProviders\OverrideCompletionProviderTests.cs (1)
3074Assert.Equal(change.Span, TextSpan.FromBounds(136, 145));
Debugging\DataTipInfoGetterTests.cs (2)
45private static async Task TestSpanGetterAsync(string markup, Func<Document, int, TextSpan?, Task> continuation) 52: (TextSpan?)null;
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (1)
355=> context.ReportDiagnostic(Diagnostic.Create(Descriptor, Location.Create(context.Tree, TextSpan.FromBounds(1000, 2000))));
ExtractMethod\ExtractMethodBase.cs (2)
38var textSpan = testDocument.SelectedSpans.Single(); 161protected static async Task TestSelectionAsync(string codeWithMarker, bool expectedFail = false, CSharpParseOptions parseOptions = null, TextSpan? textSpanOverride = null)
ExtractMethod\MiscTests.cs (2)
41MarkupTestFile.GetSpan(markupCode, out var code, out var span); 86MarkupTestFile.GetSpan(markupCode, out var code, out var span);
ExtractMethod\SelectionValidatorTests.cs (1)
1605var 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)
Intents\IntentTestsBase.cs (1)
109var priorSelection = testDocument.AnnotatedSpans["priorSelection"].Single();
NavigateTo\NavigateToSearcherTests.cs (3)
393private sealed class TestNavigateToSearchResult(EditorTestWorkspace workspace, TextSpan sourceSpan) 397public TextSpan SourceSpan => sourceSpan; 404public ImmutableArray<TextSpan> NameMatchSpans => throw new NotImplementedException();
PdbSourceDocument\AbstractPdbSourceDocumentTests.cs (3)
86MarkupTestFile.GetSpan(metadataSource, out var source, out var expectedSpan); 106Text.TextSpan expectedSpan, 121protected static async Task<(SourceText?, TextSpan)> GetGeneratedSourceTextAsync(
PdbSourceDocument\ImplementationAssemblyLookupServiceTests.cs (10)
36MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 74MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 114MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 159MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 219MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 280MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 335MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 386MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 451MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 509MarkupTestFile.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)
34MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 69MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan);
PdbSourceDocument\PdbSourceDocumentTests.cs (13)
402MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 432MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 469MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 516MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 573MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 596MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 618MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 640MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 661MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 684MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 716MarkupTestFile.GetSpan(source1, out var metadataSource, out var expectedSpan); 754MarkupTestFile.GetSpan(source1, out var metadataSource, out var expectedSpan); 925MarkupTestFile.GetSpan(source2, out source2, out var expectedSpan);
QuickInfo\DiagnosticAnalyzerQuickInfoSourceTests.cs (7)
130""", GetFormattedIDEAnalyzerTitle(51, nameof(AnalyzersResources.Remove_unused_private_members)), ImmutableArray<TextSpan>.Empty); 175", description, ImmutableArray<TextSpan>.Empty); 179ImmutableArray<TextSpan> relatedSpans) 186info.RelatedSpans.Select(actualSpan => new Action<TextSpan>(expectedSpan => Assert.Equal(expectedSpan, actualSpan))).ToArray()); 206ImmutableArray<TextSpan> relatedSpans, 240protected static Task TestInClassAsync(string code, string expectedDescription, params TextSpan[] relatedSpans) 247protected 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)
225private 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)
783var span = localDecl.Span; 1062var span = localDecl.Span;
Microsoft.CodeAnalysis.CSharp.Features (432)
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)
50TextSpan containerSpan; 338protected override async Task<SyntaxNode?> TryGetApplicableContainerFromSpanAsync(Document document, TextSpan span, CancellationToken cancellationToken)
CodeRefactorings\SyncNamespace\CSharpSyncNamespaceCodeRefactoringProvider.cs (1)
29protected override async Task<SyntaxNode?> TryGetApplicableInvocationNodeAsync(Document document, TextSpan span, CancellationToken cancellationToken)
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (1)
584ImmutableArray<TextSpan> fixAllSpans,
Completion\CompletionProviders\CompletionUtilities.cs (1)
20internal static TextSpan GetCompletionItemSpan(SourceText text, int position)
Completion\CompletionProviders\CrefCompletionProvider.cs (1)
227private static TextSpan GetCompletionItemSpan(SourceText text, int position)
Completion\CompletionProviders\CSharpSuggestionModeCompletionProvider.cs (1)
36Document document, int position, TextSpan itemSpan, CompletionTrigger trigger, CancellationToken cancellationToken = default)
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.NameGenerator.cs (6)
25using var parts = TemporaryArray<TextSpan>.Empty; 42using var breaks = TemporaryArray<TextSpan>.Empty; 49in TemporaryArray<TextSpan> breaks, string baseName, bool pluralize) 67private static Words GetLongestBackwardSubsequence(int length, in TemporaryArray<TextSpan> breaks, string baseName, bool pluralize) 74private static Words GetLongestForwardSubsequence(int length, in TemporaryArray<TextSpan> breaks, string baseName, bool pluralize) 77private static Words GetWords(int start, int end, in TemporaryArray<TextSpan> breaks, string baseName, bool pluralize)
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider.cs (1)
201new 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\CSharpCompletionService.cs (1)
40public override TextSpan GetDefaultCompletionListSpan(SourceText text, int caretPosition)
ConvertNamespace\ConvertNamespaceCodeRefactoringProvider.cs (1)
89ImmutableArray<TextSpan> fixAllSpans,
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs (2)
54var triggerSpan = TextSpan.FromBounds(typeDeclaration.SpanStart, typeDeclaration.ParameterList.FullSpan.End);
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (17)
310builder.Append(text.ToString(TextSpan.FromBounds(line.End, line.EndIncludingLineBreak))); 330builder.Append(text.ToString(TextSpan.FromBounds(firstNonWhitespacePos, line.EndIncludingLineBreak))); 478private static (ImmutableIntervalTree<TextSpan> interpolationInteriorSpans, ImmutableIntervalTree<TextSpan> restrictedSpans) GetInterpolationSpans( 481var interpolationInteriorSpans = new SegmentedList<TextSpan>(); 482var restrictedSpans = new SegmentedList<TextSpan>(); 489interpolationInteriorSpans.Add(TextSpan.FromBounds(interpolation.OpenBraceToken.Span.End, interpolation.CloseBraceToken.Span.Start)); 499var descendantSpan = descendant.Span; 510restrictedSpans.Add(TextSpan.FromBounds(start, descendantSpan.End)); 518ImmutableIntervalTree<TextSpan>.CreateFromUnsorted(new TextSpanIntervalIntrospector(), interpolationInteriorSpans), 519ImmutableIntervalTree<TextSpan>.CreateFromUnsorted(new TextSpanIntervalIntrospector(), restrictedSpans)); 575builder.Append(text.ToString(TextSpan.FromBounds(line.End, line.EndIncludingLineBreak))); 587var currentLineLeadingWhitespace = line.Text!.ToString(TextSpan.FromBounds(line.Start, pos)); 590builder.Append(text.ToString(TextSpan.FromBounds(line.Start + commonWhitespacePrefix.Length, line.EndIncludingLineBreak))); 608builder.Append(text.ToString(TextSpan.FromBounds(line.Start + commonWhitespacePrefix.Length, line.EndIncludingLineBreak))); 633ImmutableIntervalTree<TextSpan> interpolationInteriorSpans) 662var 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)
137ImmutableArray<TextSpan> fixAllSpans, 149foreach (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)
64return new DebugDataTipInfo(TextSpan.FromBounds(curr.SpanStart, expression.Span.End), text: null);
Diagnostics\Analyzers\CSharpSimplifyTypeNamesDiagnosticAnalyzer.cs (1)
83out TextSpan issueSpan, out string diagnosticId, out bool inDeclaration,
Diagnostics\CSharpAnalyzerDriverService.cs (1)
28TextSpan span,
EditAndContinue\BreakpointSpans.cs (35)
18public static bool TryGetBreakpointSpan(SyntaxTree tree, int position, CancellationToken cancellationToken, out TextSpan breakpointSpan) 69public static bool TryGetClosestBreakpointSpan(SyntaxNode root, int position, int minLength, out TextSpan span) 72var candidate = (TextSpan?)null; 109private static TextSpan CreateSpan(SyntaxToken startToken, SyntaxToken endToken) 110=> TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End); 112private static TextSpan CreateSpan(SyntaxNode node) 115private static TextSpan CreateSpan(SyntaxNode node, SyntaxToken token) 116=> TextSpan.FromBounds(node.SpanStart, token.Span.End); 118private static TextSpan CreateSpan(SyntaxToken token) 119=> TextSpan.FromBounds(token.SpanStart, token.Span.End); 121private static TextSpan CreateSpan(SyntaxTokenList startOpt, SyntaxNodeOrToken startFallbackOpt, SyntaxNodeOrToken endOpt) 149return TextSpan.FromBounds(startPos, endPos); 164private static TextSpan? TryCreateSpanForNode(SyntaxNode node, int position) 299TextSpan createSpanForSwitchArm(SwitchExpressionArmSyntax switchArm) 439internal static TextSpan? CreateSpanForConstructorDeclaration(ConstructorDeclarationSyntax constructorSyntax, int position) 471internal static TextSpan CreateSpanForImplicitConstructorInitializer(ConstructorDeclarationSyntax constructor) 477internal static TextSpan CreateSpanForExplicitConstructorInitializer(ConstructorInitializerSyntax constructorInitializer) 483internal static TextSpan CreateSpanForImplicitPrimaryConstructorInitializer(TypeDeclarationSyntax typeDeclaration) 486return TextSpan.FromBounds(typeDeclaration.Identifier.SpanStart, typeDeclaration.ParameterList.Span.End); 505internal static TextSpan CreateSpanForExplicitPrimaryConstructorInitializer(PrimaryConstructorBaseTypeSyntax baseTypeSyntax) 511internal static TextSpan CreateSpanForCopyConstructor(RecordDeclarationSyntax recordDeclaration) 527internal static TextSpan CreateSpanForRecordParameter(ParameterSyntax parameter) 544internal static TextSpan CreateSpanForAutoPropertyAccessor(AccessorDeclarationSyntax accessor) 550private static TextSpan? TryCreateSpanForFieldDeclaration(BaseFieldDeclarationSyntax fieldDeclaration, int position) 553private static TextSpan? TryCreateSpanForSwitchLabel(SwitchLabelSyntax switchLabel, int position) 563private static TextSpan CreateSpanForBlock(BlockSyntax block, int position) 577private static TextSpan? TryCreateSpanForStatement(StatementSyntax statement, int position) 772private static TextSpan? TryCreateSpanForVariableDeclaration(VariableDeclarationSyntax declaration, int position) 781private static TextSpan? TryCreateSpanForVariableDeclaration( 795return default(TextSpan); 802return default(TextSpan); 816return default(TextSpan); 827internal static TextSpan CreateSpanForVariableDeclarator( 914private static TextSpan CreateSpanForCatchClause(CatchClauseSyntax catchClause) 974private static TextSpan? CreateSpanForAccessors(SyntaxList<AccessorDeclarationSyntax> accessors, int position)
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (39)
77internal override bool TryFindMemberDeclaration(SyntaxNode? root, SyntaxNode node, TextSpan activeSpan, out OneOrMany<SyntaxNode> declarations) 206TextSpan span, 333private static TextSpan GetActiveSpan(BlockSyntax node, BlockPart part) 347private static TextSpan GetActiveSpan(ForEachStatementSyntax node, ForEachPart part) 351ForEachPart.VariableDeclaration => TextSpan.FromBounds(node.Type.SpanStart, node.Identifier.Span.End), 357private static TextSpan GetActiveSpan(ForEachVariableStatementSyntax node, ForEachPart part) 361ForEachPart.VariableDeclaration => TextSpan.FromBounds(node.Variable.SpanStart, node.Variable.Span.End), 367private static TextSpan GetActiveSpan(SwitchExpressionSyntax node, SwitchExpressionPart part) 371SwitchExpressionPart.SwitchBody => TextSpan.FromBounds(node.SwitchKeyword.SpanStart, node.CloseBraceToken.Span.End), 600protected override bool TryGetEnclosingBreakpointSpan(SyntaxToken token, out TextSpan span) 603protected override bool TryGetActiveSpan(SyntaxNode node, int statementPart, int minLength, out TextSpan span) 1604protected override TextSpan? TryGetDiagnosticSpan(SyntaxNode node, EditKind editKind) 1607internal static new TextSpan GetDiagnosticSpan(SyntaxNode node, EditKind editKind) 1610private static TextSpan? TryGetDiagnosticSpanImpl(SyntaxNode node, EditKind editKind) 1614internal static TextSpan? TryGetDiagnosticSpanImpl(SyntaxKind kind, SyntaxNode node, EditKind editKind) 1644return TextSpan.FromBounds(ns.NamespaceKeyword.SpanStart, ns.Name.Span.End); 1727return TextSpan.FromBounds(constraint.WhereKeyword.SpanStart, constraint.Constraints.Last().Span.End); 1768return TextSpan.FromBounds(usingStatement.UsingKeyword.SpanStart, usingStatement.CloseParenToken.Span.End); 1772return TextSpan.FromBounds(fixedStatement.FixedKeyword.SpanStart, fixedStatement.CloseParenToken.Span.End); 1776return TextSpan.FromBounds(lockStatement.LockKeyword.SpanStart, lockStatement.CloseParenToken.Span.End); 1799return TextSpan.FromBounds(ifStatement.IfKeyword.SpanStart, ifStatement.CloseParenToken.Span.End); 1806return TextSpan.FromBounds(switchStatement.SwitchKeyword.SpanStart, 1814return TextSpan.FromBounds(whileStatement.WhileKeyword.SpanStart, whileStatement.CloseParenToken.Span.End); 1821return TextSpan.FromBounds(forStatement.ForKeyword.SpanStart, forStatement.CloseParenToken.Span.End); 1826return TextSpan.FromBounds( 1939private static TextSpan GetDiagnosticSpan(SyntaxTokenList modifiers, SyntaxNodeOrToken start, SyntaxNodeOrToken end) 1940=> TextSpan.FromBounds((modifiers.Count != 0) ? modifiers.First().SpanStart : start.SpanStart, end.Span.End); 1942private static TextSpan CombineSpans(TextSpan first, TextSpan second, TextSpan defaultSpan) 1943=> (first.Length > 0 && second.Length > 0) ? TextSpan.FromBounds(first.Start, second.End) : (first.Length > 0) ? first : (second.Length > 0) ? second : defaultSpan; 1945internal override TextSpan GetLambdaParameterDiagnosticSpan(SyntaxNode lambda, int ordinal) 2294private readonly TextSpan? _span; 2303TextSpan? span = null) 2328private TextSpan GetSpan() 2633TextSpan newStatementSpan) 2680protected override TextSpan GetExceptionHandlingRegion(SyntaxNode node, out bool coversAllChildren) 2695return TextSpan.FromBounds(
EditAndContinue\DeclarationBody\CopyConstructorDeclarationBody.cs (2)
33public override TextSpan InitializerActiveStatementSpan 42public override TextSpan Envelope
EditAndContinue\DeclarationBody\ExplicitAutoPropertyAccessorDeclarationBody.cs (1)
25public override TextSpan HeaderActiveStatementSpan
EditAndContinue\DeclarationBody\FieldWithInitializerDeclarationBody.cs (2)
36public override TextSpan Envelope 75public 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)
26public override TextSpan InitializerActiveStatementSpan 32public override TextSpan Envelope 33=> TextSpan.FromBounds(InitializerActiveStatementSpan.Start, Body.Span.End);
EditAndContinue\DeclarationBody\OrdinaryInstanceConstructorWithImplicitInitializerDeclarationBody.cs (3)
23public override TextSpan InitializerActiveStatementSpan 29public override TextSpan Envelope 30=> TextSpan.FromBounds(InitializerActiveStatementSpan.Start, Body.Span.End);
EditAndContinue\DeclarationBody\PrimaryConstructorDeclarationBody.cs (1)
30public sealed override TextSpan Envelope
EditAndContinue\DeclarationBody\PrimaryConstructorWithExplicitInitializerDeclarationBody.cs (1)
29public override TextSpan InitializerActiveStatementSpan
EditAndContinue\DeclarationBody\PrimaryConstructorWithImplicitInitializerDeclarationBody.cs (2)
29public override TextSpan InitializerActiveStatementSpan 46public override bool IsExcludedActiveStatementSpanWithinEnvelope(TextSpan span)
EditAndContinue\DeclarationBody\PropertyOrIndexerAccessorDeclarationBody.cs (3)
54public abstract TextSpan HeaderActiveStatementSpan { get; } 64public sealed override TextSpan Envelope 79public sealed override SyntaxNode FindStatementAndPartner(TextSpan span, MemberBody? partnerDeclarationBody, out SyntaxNode? partnerStatement, out int statementPart)
EditAndContinue\DeclarationBody\PropertyOrIndexerAccessorWithExplicitBodyDeclarationBody.cs (1)
35public override TextSpan HeaderActiveStatementSpan
EditAndContinue\DeclarationBody\PropertyOrIndexerWithExplicitBodyDeclarationBody.cs (1)
30public override TextSpan HeaderActiveStatementSpan
EditAndContinue\DeclarationBody\RecordParameterDeclarationBody.cs (1)
22public 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)
32public override TextSpan Envelope 33=> TextSpan.FromBounds(unit.Members[0].SpanStart, GlobalStatements.Last().Span.End); 53public override SyntaxNode FindStatementAndPartner(TextSpan span, MemberBody? partnerDeclarationBody, out SyntaxNode? partnerStatement, out int statementPart)
EmbeddedLanguages\CSharpTestEmbeddedLanguageClassifier.cs (6)
31private static TextSpan FromBounds(VirtualChar vc1, VirtualChar vc2) 32=> TextSpan.FromBounds(vc1.Span.Start, vc2.Span.End); 59using var _ = ArrayBuilder<TextSpan>.GetInstance(out var markdownSpans); 87TextSpan.FromBounds( 97TextSpan.FromBounds( 141VirtualCharSequence 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)
25protected override CSharpSelectionValidator CreateSelectionValidator(SemanticDocument document, TextSpan textSpan, bool localFunction)
ExtractMethod\CSharpSelectionResult.cs (4)
25TextSpan originalSpan, 26TextSpan finalSpan, 62TextSpan originalSpan, 63TextSpan finalSpan,
ExtractMethod\CSharpSelectionResult.ExpressionResult.cs (2)
19TextSpan originalSpan, 20TextSpan finalSpan,
ExtractMethod\CSharpSelectionResult.StatementResult.cs (2)
19TextSpan originalSpan, 20TextSpan finalSpan,
ExtractMethod\CSharpSelectionValidator.cs (17)
25TextSpan textSpan, 143private static TextSpan GetControlFlowSpan(SelectionInfo selectionInfo) 144=> TextSpan.FromBounds(selectionInfo.FirstTokenInFinalSpan.SpanStart, selectionInfo.LastTokenInFinalSpan.Span.End); 270private static bool CheckTopLevel(SyntaxNode node, TextSpan span) 300private static bool ContainsInBlockBody(BlockSyntax block, TextSpan textSpan) 307var blockSpan = TextSpan.FromBounds(block.OpenBraceToken.Span.End, block.CloseBraceToken.SpanStart); 311private static bool ContainsInExpressionBodiedMemberBody(ArrowExpressionClauseSyntax expressionBodiedMember, TextSpan textSpan) 318var expressionBodiedMemberBody = TextSpan.FromBounds(expressionBodiedMember.Expression.SpanStart, expressionBodiedMember.Expression.Span.End); 395root, TextSpan.FromBounds(selectionInfo.FirstTokenInOriginalSpan.SpanStart, selectionInfo.LastTokenInOriginalSpan.Span.End), 442return selectionInfo.With(s => s.FinalSpan = GetAdjustedSpan(text, TextSpan.FromBounds(start, end))); 464SyntaxNode root, TextSpan textSpan, 517private static TextSpan GetAdjustedSpan(SourceText text, TextSpan textSpan) 540return TextSpan.FromBounds(textSpan.Start, previousLine.EndIncludingLineBreak); 543return 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)
35protected override void AddHighlightsForNode(SyntaxNode node, List<TextSpan> highlights, CancellationToken cancellationToken) 69private static bool HighlightRelatedKeywords(SyntaxNode node, List<TextSpan> spans) 83private static bool TryAddAsyncModifier(SyntaxTokenList modifiers, List<TextSpan> spans) 96private static bool TryAddAsyncOrAwaitKeyword(SyntaxToken mod, List<TextSpan> spans) 106var lastSpan = spans[^1]; 109spans[^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)
31IfStatementSyntax ifStatement, List<TextSpan> highlights, CancellationToken cancellationToken) 40IfStatementSyntax ifStatement, List<TextSpan> highlights) 55highlights.Add(TextSpan.FromBounds(
Highlighting\KeywordHighlighters\LockStatementHighlighter.cs (1)
27protected override void AddHighlights(LockStatementSyntax lockStatement, List<TextSpan> highlights, CancellationToken cancellationToken)
Highlighting\KeywordHighlighters\LoopHighlighter.cs (6)
38SyntaxNode node, List<TextSpan> spans, CancellationToken cancellationToken) 59private static void HighlightDoStatement(DoStatementSyntax statement, List<TextSpan> spans) 66private static void HighlightForStatement(ForStatementSyntax statement, List<TextSpan> spans) 69private static void HighlightForEachStatement(CommonForEachStatementSyntax statement, List<TextSpan> spans) 72private static void HighlightWhileStatement(WhileStatementSyntax statement, List<TextSpan> spans) 78private 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)
36SwitchStatementSyntax switchStatement, List<TextSpan> spans, CancellationToken cancellationToken) 56private static void HighlightRelatedKeywords(SyntaxNode node, List<TextSpan> spans, 79spans.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)
145var applicableSpan = explicitName == null 147: TextSpan.FromBounds(explicitName.FullSpan.Start, identifier.FullSpan.End);
InlineHints\CSharpInlineTypeHintsService.cs (5)
80var span = new TextSpan(parameterNode.Identifier.SpanStart, 0); 99var span = new TextSpan(implicitNew.NewKeyword.Span.End, 0); 112var span = new TextSpan(collectionExpression.OpenBracketToken.SpanStart, 0); 128var span = GetSpan(displayAllOverride, normalOption, displayAllSpan, normalSpan); 135private static TextSpan GetSpan(
IntroduceVariable\CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs (1)
42protected override bool IsValid(ExpressionStatementSyntax expressionStatement, TextSpan span)
LineSeparators\CSharpLineSeparatorService.cs (9)
34public async Task<ImmutableArray<TextSpan>> GetLineSeparatorsAsync( 36TextSpan textSpan, 41using var _ = ArrayBuilder<TextSpan>.GetInstance(out var spans); 244private static void ProcessUsings(SyntaxList<UsingDirectiveSyntax> usings, ArrayBuilder<TextSpan> spans, CancellationToken cancellationToken) 259private static void ProcessNodeList<T>(SyntaxList<T> children, ArrayBuilder<TextSpan> spans, CancellationToken cancellationToken) where T : SyntaxNode 312private static void AddLineSeparatorSpanForNode(SyntaxNode node, ArrayBuilder<TextSpan> spans, CancellationToken cancellationToken) 319var span = GetLineSeparatorSpanForNode(node); 327private static bool IsLegalSpanForLineSeparator(SyntaxTree syntaxTree, TextSpan textSpan, CancellationToken cancellationToken) 346private static TextSpan GetLineSeparatorSpanForNode(SyntaxNode node)
NavigationBar\CSharpNavigationBarItemService.cs (4)
223private static TextSpan GetFieldReferenceSpan(SyntaxReference reference) 242return TextSpan.FromBounds(spanStart, spanEnd); 245private static TextSpan GetEnumMemberSpan(SyntaxReference reference) 261return TextSpan.FromBounds(start, end);
QuickInfo\CSharpDiagnosticAnalyzerQuickInfoProvider.cs (3)
132string errorCode, TextSpan location) 146private static QuickInfoItem CreateQuickInfo(TextSpan location, DiagnosticDescriptor descriptor, 147params TextSpan[] relatedSpans)
QuickInfo\CSharpSyntacticQuickInfoProvider.cs (1)
92var spans = ImmutableArray.Create(TextSpan.FromBounds(spanStart, spanEnd));
SignatureHelp\AttributeSignatureHelpProvider.cs (2)
106var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(attribute.ArgumentList!); 117private SignatureHelpState? GetCurrentArgumentState(SyntaxNode root, int position, ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken)
SignatureHelp\ConstructorInitializerSignatureHelpProvider.cs (2)
106var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(constructorInitializer.ArgumentList); 119Document document, int position, TextSpan currentSpan, CancellationToken cancellationToken)
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (7)
107var textSpan = GetTextSpan(expression, openBrace); 115private static TextSpan GetTextSpan(ExpressionSyntax expression, SyntaxToken openBracket) 121return TextSpan.FromBounds(conditional.Span.Start, openBracket.FullSpan.End); 136private static SignatureHelpState? GetCurrentArgumentState(SyntaxNode root, int position, ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken) 299internal static TextSpan GetTextSpan(SyntaxToken openBracket) 341internal static TextSpan GetTextSpan(SyntaxNode expression, SyntaxToken openBracket) 344return TextSpan.FromBounds(expression.SpanStart, openBracket.Parent.Span.End);
SignatureHelp\GenericNamePartiallyWrittenSignatureHelpProvider.cs (2)
29protected override TextSpan GetTextSpan(SyntaxToken genericIdentifier, SyntaxToken lessThanToken) 34return TextSpan.FromBounds(genericIdentifier.SpanStart, nextToken.SpanStart);
SignatureHelp\GenericNameSignatureHelpProvider.cs (2)
133var textSpan = GetTextSpan(genericIdentifier, lessThanToken); 162protected virtual TextSpan GetTextSpan(SyntaxToken genericIdentifier, SyntaxToken lessThanToken)
SignatureHelp\InitializerExpressionSignatureHelpProvider.cs (2)
69var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(initializerExpression); 78private SignatureHelpState? GetCurrentArgumentState(SyntaxNode root, int position, ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken)
SignatureHelp\InvocationExpressionSignatureHelpProvider.cs (3)
114var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(invocationExpression.ArgumentList); 160var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(invocationExpression.ArgumentList); 169TextSpan currentSpan,
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.cs (3)
105var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(objectCreationExpression.ArgumentList); 129var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(objectCreationExpression.ArgumentList); 136Document document, int position, TextSpan currentSpan, CancellationToken cancellationToken)
SignatureHelp\PrimaryConstructorBaseTypeSignatureHelpProvider.cs (2)
100var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(baseTypeSyntax.ArgumentList); 109private SignatureHelpState? GetCurrentArgumentState(SyntaxNode root, int position, ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken)
SignatureHelp\SignatureHelpUtilities.cs (4)
87internal static TextSpan GetSignatureHelpSpan(BaseArgumentListSyntax argumentList) 90internal static TextSpan GetSignatureHelpSpan(TypeArgumentListSyntax argumentList) 93internal static TextSpan GetSignatureHelpSpan(InitializerExpressionSyntax initializer) 96internal static TextSpan GetSignatureHelpSpan(AttributeArgumentListSyntax argumentList)
SignatureHelp\TupleConstructionSignatureHelpProvider.cs (3)
37private SignatureHelpState? GetCurrentArgumentState(SyntaxNode root, int position, ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken) 64ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken, [NotNullWhen(true)] out TupleExpressionSyntax? result) 83ISyntaxFactsService 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;
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)
133var ifStatementSpanWithoutElse = TextSpan.FromBounds(statement.Span.Start, embeddedStatement.Span.End);
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
55: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.SemicolonToken.Span.End));
src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
58: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.Name.Span.End));
src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_ProgramMain.cs (1)
72TextSpan.FromBounds(start, root.Members.OfType<GlobalStatementSyntax>().Last().FullSpan.End));
src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (2)
182var fadeLocation = Location.Create(tree, TextSpan.FromBounds(firstStatement.SpanStart, previousToken.Span.End)); 203fadeLocation = Location.Create(tree, TextSpan.FromBounds(nextToken.Span.Start, ifStatement.Span.End));
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastDiagnosticAnalyzer.cs (3)
29protected override TextSpan GetFadeSpan(ExpressionSyntax node) 32CastExpressionSyntax cast => TextSpan.FromBounds(cast.OpenParenToken.SpanStart, cast.CloseParenToken.Span.End), 33BinaryExpressionSyntax 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)
228var startReportSpan = TextSpan.FromBounds(anonymousFunction.SpanStart, invokedExpression.SpanStart); 229var endReportSpan = TextSpan.FromBounds(invokedExpression.Span.End, anonymousFunction.Span.End);
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (7)
82private static ImmutableArray<TextSpan> AnalyzeCodeBlock(CodeBlockAnalysisContext context, int positionOfFirstReducingNullableDirective) 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)
81SemanticModelAnalysisContext context, SyntaxNode root, TextSpan sourceSpan) 134var 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)
68syntaxTree.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)
47var 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)
67private static Diagnostic CreateDiagnostic(DiagnosticDescriptor descriptor, SyntaxNode declaration, TextSpan diagnosticSpan, NotificationOption2 notificationOption, AnalyzerOptions analyzerOptions)
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
259TextSpan.FromBounds(arguments.First().SpanStart, arguments.Last().Span.End));
src\Analyzers\CSharp\Analyzers\UseInferredMemberName\CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (4)
55var fadeSpan = TextSpan.FromBounds(nameColon.Name.SpanStart, nameColon.ColonToken.Span.End); 81var fadeSpan = TextSpan.FromBounds(nameEquals.Name.SpanStart, nameEquals.EqualsToken.Span.End);
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
314var scopeSpan = scope.Span;
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (2)
124var span = TextSpan.FromBounds(elements[0].Syntax.SpanStart, elements[^1].Syntax.Span.End);
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (1)
49private static (SyntaxNode container, SyntaxNode exprOrStatement) GetContainer(SyntaxNode root, TextSpan span)
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
39var 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)
55using 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)
52var span = context.Span;
src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (1)
33var diagnosticSpan = diagnostic.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
210SyntaxNode root, TextSpan span, [NotNullWhen(true)] out SyntaxNode? node)
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
132var referenceSpan = location.Location.SourceSpan;
src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
35var span = context.Span;
src\Analyzers\CSharp\CodeFixes\MakeRefStruct\MakeRefStructCodeFixProvider.cs (1)
39var span = context.Span;
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
93edits.Add(new TextChange(TextSpan.FromBounds(start, end), ""));
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
95edits.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)
846var 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)
24TextSpan span,
StringIndentation\CSharpStringIndentationService.cs (5)
28Document document, TextSpan textSpan, CancellationToken cancellationToken) 111using var _ = ArrayBuilder<TextSpan>.GetInstance(out var builder); 125private static bool IsInHole(InterpolatedStringExpressionSyntax interpolatedString, TextSpan sourceSpan) 157private static bool TryGetIndentSpan(SourceText text, ExpressionSyntax expression, out int offset, out TextSpan indentSpan) 178indentSpan = TextSpan.FromBounds(firstLine.Start, lastLine.Start + offset);
Structure\CSharpStructureHelpers.cs (15)
153var span = TextSpan.FromBounds(startComment.SpanStart, endComment.Span.End); 256textSpan: TextSpan.FromBounds(startPosition, endPosition), 257hintSpan: TextSpan.FromBounds(startPosition, hintTextEndToken.Span.End), 297TextSpan textSpan, string bannerText, bool autoCollapse, 305TextSpan textSpan, TextSpan hintSpan, 356var span = TextSpan.FromBounds(GetCollapsibleStart(startToken), spanEndPos); 357var hintSpan = GetHintSpan(node, hintEndPos); 369private static TextSpan GetHintSpan(SyntaxNode node, int endPos) 379return TextSpan.FromBounds(child.SpanStart, endPos); 383return TextSpan.FromBounds(node.SpanStart, endPos); 461textSpan: TextSpan.FromBounds(spanStart, spanEnd), 462hintSpan: TextSpan.FromBounds(hintSpanStart, hintSpanEnd),
Structure\Providers\AnonymousObjectCreationExpressionStructureProvider.cs (1)
38textSpan: TextSpan.FromBounds(node.NewKeyword.Span.End, node.Span.End),
Structure\Providers\ArrowExpressionClauseStructureProvider.cs (1)
27textSpan: TextSpan.FromBounds(previousToken.Span.End, node.Parent.Span.End),
Structure\Providers\BlockSyntaxStructureProvider.cs (8)
41using var subHeadings = TemporaryArray<(TextSpan textSpan, TextSpan hintSpan, string type)>.Empty; 71using var subHeadings = TemporaryArray<(TextSpan textSpan, TextSpan hintSpan, string type)>.Empty; 150private static TextSpan GetHintSpan(BlockSyntax node) 160return TextSpan.FromBounds(start, end); 163private static TextSpan GetTextSpan(BlockSyntax node) 171return 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)
59var 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)
43var span = node.Span;
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)
189ImmutableArray<TextSpan> fixAllSpans, 205ImmutableArray<TextSpan> fixAllSpans, 213foreach (var span in fixAllSpans)
UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeRefactoringProvider.cs (4)
79var span = context.Span; 91Document document, TextSpan span, ExpressionBodyPreference option, CancellationToken cancellationToken) 147Document document, TextSpan span, CancellationToken cancellationToken) 163Document document, TextSpan span, ExpressionBodyPreference option, CancellationToken cancellationToken)
Wrapping\SeparatedSyntaxList\CSharpArgumentWrapper.cs (2)
91var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
Wrapping\SeparatedSyntaxList\CSharpParameterWrapper.cs (2)
69var headerSpan = TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End);
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (16)
Diagnostics\Suppression\SuppressionTests.cs (1)
459var 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)
52foreach (var expected in GetExpectedSpans(source)) 62var actual = CSharpEditAndContinueAnalyzer.GetDiagnosticSpan(node, EditKind.Update); 71private static IEnumerable<TextSpan> GetExpectedSpans(string source) 97TextSpan? span; 314var oldStatementTextSpan = new TextSpan(oldStatementPosition, oldStatementSource.Length); 338var newStatementTextSpan = newText.Lines.GetTextSpan(newStatementSpan);
EditAndContinue\Helpers\EditingTestBase.cs (2)
111internal static SemanticEditDescription SemanticEdit(SemanticEditKind kind, Func<Compilation, ISymbol> symbolProvider, IEnumerable<(TextSpan, TextSpan)>? syntaxMap, IEnumerable<RuntimeRudeEditDescription>? rudeEdits = null, string? partialType = null)
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))); 3626location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2)))); 3659location: Location.Create(validSyntaxTree, TextSpan.FromBounds(0, 2)), 3660additionalLocations: new[] { Location.Create(invalidSyntaxTree, TextSpan.FromBounds(0, 2)) })); 3690location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2)))); 3720location: Location.Create(validSyntaxTree, TextSpan.FromBounds(0, 2)), 3721additionalLocations: new[] { Location.Create(invalidSyntaxTree, TextSpan.FromBounds(0, 2)) })); 3752location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 100)))); 3784location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2)), 3785additionalLocations: new[] { Location.Create(syntaxTree, TextSpan.FromBounds(0, 100)) })); 3815location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 100)))); 3844location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2)), 3845additionalLocations: new[] { Location.Create(syntaxTree, TextSpan.FromBounds(0, 100)) })); 3876location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2)))); 3906location: 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)
2404private 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)
496var span = new TextSpan(source.IndexOf("]") + 1, length: 1); 528var span = new TextSpan(source.IndexOf("."), length: 1); 573var prefixSpan = new TextSpan(source.IndexOf(prefix), length: prefix.Length); 574var suffixSpan = new TextSpan(source.IndexOf(suffix), length: suffix.Length); 2900var span = new TextSpan(oldIText.Length, 0); 2983var span = new TextSpan(currLen, 0); 3020var span = new TextSpan(text.LastIndexOf('x'), 0); 3198var span = new TextSpan(source.IndexOf(" A[]?"), 0); 3219var span = new TextSpan(src.IndexOf(":"), 1); 3240var span = new TextSpan(source.IndexOf(";"), 0); 3261var span = new TextSpan(source.IndexOf(";") + 1, 0); 3282var span = new TextSpan(source.IndexOf(";") + 1, 0); 3304var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3328var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3352var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3376var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3400var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3424var span = new TextSpan(source.IndexOf(substring) + substring.Length, 1); 3450var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3475var span = new TextSpan(source.IndexOf(substring), 0); 3501var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3527var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3545var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3563var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3581var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3595var span = new TextSpan(start: 0, length: 1); // delete first character 3609var span = new TextSpan(start: 0, length: 0); 3624var span = new TextSpan(start: source.IndexOf(substring), length: 3); // Goo[Goo] -> [Goo] 3661var 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)
722var EOFSpan = new TextSpan(root.FullSpan.End, 0); 731var nodeEndPositionSpan = new TextSpan(classDecl.FullSpan.End, 0); 741var invalidSpan = new TextSpan(100, 100); 2069var 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)
1819internal static string GetDocumentationCommentText(CSharpCompilation compilation, string outputName = null, SyntaxTree filterTree = null, TextSpan? filterSpanWithinTree = null, bool ensureEnglishUICulture = false, params DiagnosticDescription[] expectedDiagnostics)
Microsoft.CodeAnalysis.CSharp.Workspaces (133)
CaseCorrection\CSharpCaseCorrectionService.cs (1)
29ImmutableArray<TextSpan> spans,
Classification\ClassificationHelpers.cs (2)
498internal static void AddLexicalClassifications(SourceText text, TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 524var 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)
23TextSpan textSpan,
Classification\SyntaxClassification\NameSyntaxClassifier.cs (1)
26TextSpan 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);
CodeCleanup\CSharpCodeCleanerService.cs (1)
19protected override ImmutableArray<TextSpan> GetSpansToAvoid(SyntaxNode root)
Formatting\CSharpSyntaxFormattingService.cs (2)
327public ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken) 329var 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
OrganizeImports\CSharpOrganizeImportsService.Rewriter.cs (2)
87private static TextSpan GetTextSpan<TSyntax>(SyntaxList<TSyntax> list) where TSyntax : SyntaxNode 88=> TextSpan.FromBounds(list.First().FullSpan.Start, list.Last().FullSpan.End);
Rename\CSharpRenameRewriterLanguageService.cs (15)
56private readonly ImmutableDictionary<TextSpan, RenameLocation> _renameLocations; 57private readonly ImmutableHashSet<TextSpan> _conflictLocations; 93private readonly ImmutableDictionary<TextSpan, ImmutableSortedSet<TextSpan>?> _stringAndCommentTextSpans; 105private List<(TextSpan oldSpan, TextSpan newSpan)>? _modifiedSubSpans; 109private void AddModifiedSpan(TextSpan oldSpan, TextSpan newSpan) 297var oldSpan = originalNode.Span; 312var newSpan = newNode.Span; 389var oldSpan = token.Span; 640private SyntaxToken RenameInStringLiteral(SyntaxToken oldToken, SyntaxToken newToken, ImmutableSortedSet<TextSpan>? subSpansToReplace, Func<SyntaxTriviaList, string, string, SyntaxTriviaList, SyntaxToken> createNewStringLiteral) 646var oldSpan = oldToken.Span; 674var oldSpan = trivia.Span; 685ImmutableSortedSet<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)
207var lineSpan = currentLine.Span; 254using var _ = ArrayBuilder<(char ch, TextSpan span)>.GetInstance(out var charResults); 287string tokenText, int offset, int startIndexInclusive, int endIndexExclusive, ArrayBuilder<(char ch, TextSpan span)> charResults) 306private static void ConvertCharactersToRunes(ArrayBuilder<(char ch, TextSpan span)> charResults, ImmutableSegmentedList<VirtualChar>.Builder runeResults) 326runeResults.Add(VirtualChar.Create(rune, TextSpan.FromBounds(span.Start, nextSpan.End))); 340ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 353ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 387ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 406ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index, char character) 519result.Add((character, TextSpan.FromBounds(startIndex + offset, endIndex + offset)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (5)
514public static bool ContainsInterleavedDirective(this SyntaxNode syntaxNode, TextSpan span, CancellationToken cancellationToken) 519TextSpan textSpan, 528TextSpan textSpan, 547TextSpan textSpan, 559var matchSpan = match.Span;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (1)
239var name = SyntaxFactory.ParseName(syntaxTree.GetText(cancellationToken).ToString(TextSpan.FromBounds(genericIdentifier.SpanStart, lastToken.Span.End)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (4)
197var fullSpan = trivia.FullSpan; 226var span = trivia.FullSpan; 407var span = token.Span; 453var 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)
56var span = TextSpan.FromBounds(commonToken1.Span.End, formatSpanEnd); 106public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs (1)
58public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (1)
104public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (4)
99private TextSpan GetTextSpan(ValueTuple<SyntaxToken, SyntaxToken> pair) 103return TextSpan.FromBounds(_node.FullSpan.Start, pair.Item2.SpanStart); 108return TextSpan.FromBounds(pair.Item1.Span.End, _node.FullSpan.End); 111return 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); 363AddIndentBlockOperation(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)
188var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (2)
67_root, [TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)], _options.FormattingOptions, smartTokenformattingRules, cancellationToken); 121_root, [TextSpan.FromBounds(adjustedStartPosition, adjustedEndPosition)], _options.FormattingOptions, smartTokenFormattingRules, cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (7)
946public TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node) 973public bool ContainsInMemberBody([NotNullWhen(true)] SyntaxNode? node, TextSpan span) 993private static TextSpan GetBlockBodySpan(BlockSyntax body) 994=> TextSpan.FromBounds(body.OpenBraceToken.Span.End, body.CloseBraceToken.SpanStart); 1106public TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) 1135return !branch.IsActive || !branch.BranchTaken ? TextSpan.FromBounds(branch.FullSpan.Start, position) : default; 1372public bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (5)
34var span = GetUsingsSpan(root, namespaceDeclaration); 50private static TextSpan GetUsingsSpan(CompilationUnitSyntax root, BaseNamespaceDeclarationSyntax? namespaceDeclaration) 57return TextSpan.FromBounds(start, end); 66return TextSpan.FromBounds(start, end); 74return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (3)
31indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken)); 37indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken)); 49indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.cs (5)
62var spansToFormat = new List<TextSpan>(); 74List<TextSpan> spans, 78spans.Add(TextSpan.FromBounds(0, GetEndPosition(compilationUnit, compilationUnit.Members))); 86List<TextSpan> spans, 90spans.Add(TextSpan.FromBounds(namespaceMember.SpanStart, GetEndPosition(namespaceMember, namespaceMember.Members)));
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)
4986MarkupTestFile.GetSpan(markup, out var code, out var span);
Formatting\CSharpFormattingTestBase.cs (1)
47IEnumerable<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 (193)
AddImports\AbstractAddImportsPasteCommandHandler.cs (1)
154var 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)
172bool requireSingleSpan, Func<TextSpan, SegmentedList<ClassifiedSpan>, Task> addTagsAsync) 181Func<TextSpan, SegmentedList<ClassifiedSpan>, Task> addAsync)
Classification\Semantic\AbstractSemanticOrEmbeddedClassificationViewTaggerProvider.cs (1)
174var 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)
57protected abstract ImmutableArray<TextSpan> GetBlockCommentsInDocument(Document document, ITextSnapshot snapshot, 58TextSpan linesContainingSelections, CommentSelectionInfo commentInfo, CancellationToken cancellationToken); 98var linesContainingSelection = TextSpan.FromBounds(firstLineAroundSelection, lastLineAroundSelection); 132private static bool TryUncommentBlockComment(ImmutableArray<TextSpan> blockCommentedSpans, 138&& blockCommentSelection.TryGetBlockCommentOnSameLine(blockCommentedSpans, out var blockCommentOnSameLine)) 148foreach (var spanToRemove in intersectingBlockComments) 153var trackingSpan = TextSpan.FromBounds(intersectingBlockComments.First().Start, intersectingBlockComments.Last().End); 174var spanToAdd = blockCommentSelection.SelectedSpan; 178spanToAdd = TextSpan.FromBounds(caretLocation, caretLocation); 205if (blockCommentSelection.IsSpanWhitespace(TextSpan.FromBounds(extent.Span.Start, extent.Span.End))) 220var selectedSpan = blockCommentSelection.SelectedSpan; 226foreach (var uncommentedSpan in blockCommentSelection.UncommentedSpansInSelection) 254private static void AddBlockComment(CommentSelectionInfo commentInfo, TextSpan span, ArrayBuilder<TextChange> textChanges) 260private static void DeleteBlockComment(BlockCommentSelectionHelper blockCommentSelection, TextSpan spanToRemove, 282public TextSpan SelectedSpan { get; } 284public ImmutableArray<TextSpan> IntersectingBlockComments { get; } 286public ImmutableArray<TextSpan> UncommentedSpansInSelection { get; } 288public BlockCommentSelectionHelper(ImmutableArray<TextSpan> allBlockComments, SnapshotSpan selectedSnapshotSpan) 293SelectedSpan = TextSpan.FromBounds(selectedSnapshotSpan.Start, selectedSnapshotSpan.End); 301public bool IsSpanWhitespace(TextSpan span) 360public bool TryGetBlockCommentOnSameLine(ImmutableArray<TextSpan> allBlockComments, out TextSpan commentedSpanOnSameLine) 364var lineStartToCaretIsWhitespace = IsSpanWhitespace(TextSpan.FromBounds(selectedLine.Start, SelectedSpan.Start)); 365var caretToLineEndIsWhitespace = IsSpanWhitespace(TextSpan.FromBounds(SelectedSpan.Start, selectedLine.End)); 366foreach (var blockComment in allBlockComments) 372if (IsSpanWhitespace(TextSpan.FromBounds(SelectedSpan.Start, blockComment.Start))) 382if (IsSpanWhitespace(TextSpan.FromBounds(blockComment.End, SelectedSpan.Start))) 398private static ImmutableArray<TextSpan> GetIntersectingBlockComments(ImmutableArray<TextSpan> allBlockComments, TextSpan span) 404private ImmutableArray<TextSpan> GetUncommentedSpansInSelection() 406var uncommentedSpans = new List<TextSpan>(); 410foreach (var commentedSpan in IntersectingBlockComments) 415var possibleUncommentedSpan = TextSpan.FromBounds(spanStart, commentedSpan.Start); 429var uncommentedSpan = TextSpan.FromBounds(spanStart, SelectedSpan.End);
CommentSelection\CommentTrackingSpan.cs (3)
16public TextSpan TrackingTextSpan { get; } 26public CommentTrackingSpan(TextSpan trackingTextSpan) 33public 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)
38protected override ImmutableArray<TextSpan> GetBlockCommentsInDocument(Document document, ITextSnapshot snapshot, 39TextSpan linesContainingSelections, CommentSelectionInfo commentInfo, CancellationToken cancellationToken) 42var commentedSpans = ArrayBuilder<TextSpan>.GetInstance(); 55var blockCommentSpan = new TextSpan(openIdx, closeIdx + commentInfo.BlockCommentEndString.Length - openIdx);
CommentSelection\ToggleLineCommentCommandHandler.cs (2)
126var 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)
41var span = new TextSpan(existingSection.Span.End, 0); 47var span = new TextSpan(sourceText.Length, 0); 57static SourceText WithChanges(SourceText sourceText, TextSpan span, string newText)
Extensibility\NavigationBar\AbstractEditorNavigationBarItemService.cs (1)
82var 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\NavigationBarProjectItem.cs (1)
17spans: ImmutableArray<TextSpan>.Empty,
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)
28internal readonly struct IntentRequestContext(string intentName, SnapshotSpan currentSnapshotSpan, ImmutableArray<TextChange> textEditsToPrior, TextSpan priorSelection, string? intentData) 56public 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)
11internal readonly struct VSTypeScriptDocumentSpan(Document document, TextSpan sourceSpan) 14public TextSpan SourceSpan { get; } = sourceSpan;
ExternalAccess\VSTypeScript\Api\VSTypeScriptGoToSymbolContext.cs (1)
26public TextSpan Span { get; set; }
ExternalAccess\VSTypeScript\Api\VSTypeScriptInlineRenameInfo.cs (5)
26public abstract TextSpan TriggerSpan { get; } 29public abstract TextSpan? GetConflictEditSpan(VSTypeScriptInlineRenameLocationWrapper location, string replacementText, CancellationToken cancellationToken); 31public abstract TextSpan GetReferenceEditSpan(VSTypeScriptInlineRenameLocationWrapper location, CancellationToken cancellationToken); 45TextSpan? IInlineRenameInfo.GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken) 49TextSpan IInlineRenameInfo.GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken)
ExternalAccess\VSTypeScript\Api\VSTypeScriptInlineRenameLocationWrapper.cs (1)
17public TextSpan TextSpan => _underlyingObject.TextSpan;
ExternalAccess\VSTypeScript\Api\VSTypeScriptInlineRenameReplacementWrapper.cs (2)
17public TextSpan OriginalSpan => UnderlyingObject.OriginalSpan; 18public 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)
57var navigationSpan = item.GetCurrentItemSpan(textVersion, item.Spans.First());
ExtractMethod\ExtractMethodCommandHandler.cs (1)
131TextSpan span,
Formatting\FormatCommandHandler.cs (1)
56private void Format(ITextView textView, ITextBuffer textBuffer, Document document, TextSpan? selectionOpt, CancellationToken cancellationToken)
Formatting\FormatCommandHandler.FormatSelection.cs (1)
53var formattingSpan = selection[0].Span.ToTextSpan();
Formatting\FormatCommandHandler.Paste.cs (1)
78var 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)
44public TextSpan TriggerSpan { get; } 84public TextSpan GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken) 106public TextSpan? GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken)
InlineRename\IEditorInlineRenameService.cs (10)
24public TextSpan TextSpan { get; } 26public InlineRenameLocation(Document document, TextSpan textSpan) : this() 71public TextSpan OriginalSpan { get; } 72public TextSpan NewSpan { get; } 74public InlineRenameReplacement(InlineRenameReplacementKind kind, TextSpan originalSpan, TextSpan newSpan) : this() 81internal InlineRenameReplacement(RelatedLocation location, TextSpan newSpan) 172TextSpan TriggerSpan { get; } 216TextSpan GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken); 222TextSpan? GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken);
InlineRename\InlineRenameService.cs (2)
57TextSpan textSpan, 65TextSpan 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) 654private readonly TextSpan _anchorSpan; 655private readonly TextSpan _activeSpan; 719var anchorSpan = _anchorSpan; 725var activeSpan = _activeSpan; 735private SnapshotPoint GetNewEndpoint(TextSpan span)
InlineRename\TrackingSpanIntrospector.cs (1)
14public TextSpan GetSpan(ITrackingSpan value)
IntelliSense\AsyncCompletion\CommitManager.cs (1)
190TextSpan completionListSpan,
IntelliSense\AsyncCompletion\CompletionSessionData.cs (1)
26public TextSpan? CompletionListSpan { get; set; }
IntelliSense\AsyncCompletion\CompletionSource.cs (1)
194buffer.ApplyChange(new TextChange(TextSpan.FromBounds(caretPoint - 2, caretPoint), string.Empty));
IntelliSense\AsyncCompletion\ItemManager.CompletionListUpdater.cs (1)
623static Span GetOffsetSpan(TextSpan span, RoslynCompletionItem item)
IntelliSense\QuickInfo\Model.cs (1)
33internal SnapshotSpan GetCurrentSpanInSnapshot(TextSpan originalSpan, ITextSnapshot textSnapshot)
IntelliSense\ViewTextSpan.cs (3)
24internal readonly struct ViewTextSpan(TextSpan textSpan) 26public readonly TextSpan TextSpan = textSpan; 46public ViewTextSpan GetSubjectBufferTextSpanInViewBuffer(TextSpan textSpan)
Intents\DeleteParameterIntentProvider.cs (1)
27TextSpan priorSelection,
Intents\RenameIntentProvider.cs (1)
33TextSpan priorSelection,
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)
41private static readonly PooledObjects.ObjectPool<List<TextSpan>> s_listPool = new(() => []);
Navigation\AbstractDefinitionLocationService.cs (1)
109Solution 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)
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)
RenameTracking\RenameTrackingTaggerProvider.cs (2)
104public static (CodeAction action, TextSpan renameSpan) TryGetCodeAction( 105Document document, TextSpan textSpan,
RenameTracking\RenameTrackingTaggerProvider.StateMachine.cs (2)
286internal (CodeAction action, TextSpan renameSpan) TryGetCodeAction( 287Document document, SourceText text, TextSpan 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)
20public 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);
SpellCheck\RoslynSpellCheckFixerProvider.cs (1)
96var subSpanBeingRenamed = span.Span.ToTextSpan();
Structure\StructureTag.cs (4)
46private static SubHeadingStructureData CreateSubHeading((TextSpan textSpan, TextSpan hintSpan, string type) subHeading, ITextSnapshot snapshot) 49private static Span DetermineHeaderSpan(TextSpan textSpan, TextSpan hintSpan, ITextSnapshot snapshot)
Tagging\AbstractAsynchronousTaggerProvider.cs (2)
256public bool SpanEquals(ITextSnapshot snapshot1, TextSpan? span1, ITextSnapshot snapshot2, TextSpan? span2)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (73)
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)
27protected abstract Task<ImmutableArray<ClassifiedSpan>> GetClassificationSpansAsync(string text, ImmutableArray<TextSpan> spans, ParseOptions? parseOptions, TestHost testHost); 43ImmutableArray<TextSpan> spans; 268protected static async Task<ImmutableArray<ClassifiedSpan>> GetSemanticClassificationsAsync(Document document, ImmutableArray<TextSpan> spans) 279protected static async Task<ImmutableArray<ClassifiedSpan>> GetSyntacticClassificationsAsync(Document document, ImmutableArray<TextSpan> spans) 289protected static async Task<ImmutableArray<ClassifiedSpan>> GetAllClassificationsAsync(Document document, ImmutableArray<TextSpan> spans) 294var 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];
Diagnostics\MockDiagnosticAnalyzerService.cs (1)
67public Task<ImmutableArray<DiagnosticData>> GetDiagnosticsForSpanAsync(TextDocument document, TextSpan? range, Func<string, bool>? shouldIncludeDiagnostic, bool includeCompilerDiagnostics, bool includeSuppressedDiagnostics, ICodeActionRequestPriorityProvider priorityProvider, DiagnosticKind diagnosticKind, bool isExplicit, CancellationToken cancellationToken)
DocumentationComments\AbstractDocumentationCommentTests.cs (1)
150var selectedSpan = testDocument.SelectedSpans[0];
Formatting\CoreFormatterTestsBase.cs (4)
177private protected async Task AssertFormatAsync(string expected, string code, IEnumerable<TextSpan> spans, OptionsCollection options = null, int? baseIndentation = null) 213internal void AssertFormatWithTransformation(Workspace workspace, string expected, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, SyntaxNode root, IEnumerable<TextSpan> spans) 226internal void AssertFormat(Workspace workspace, string expected, SyntaxFormattingOptions options, ImmutableArray<AbstractFormattingRule> rules, ITextBuffer clonedBuffer, SyntaxNode root, IEnumerable<TextSpan> spans) 276TestFileMarkupParser.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];
LanguageServer\AbstractLanguageServerProtocolTests.cs (3)
85public Task<ImmutableArray<MappedSpanResult>> MapSpansAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken) 173var textSpan = lines.GetTextSpan(new LinePositionSpan(startPosition, endPosition)); 468static LSP.Location ConvertTextSpanWithTextToLocation(TextSpan span, SourceText text, Uri documentUri)
NavigateTo\AbstractNavigateToTests.cs (1)
205Assert.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)
80TextSpan? textSpan = null; 356IList<TextSpan> textSpans = null; 364TextSpan? textSpan = null; 379TextSpan? textSpan, 473IList<TextSpan> textSpans = null; 481TextSpan? textSpan = null;
SpellCheck\AbstractSpellCheckSpanTests.cs (1)
40private static ImmutableArray<SpellCheckSpan> Flatten(IDictionary<string, ImmutableArray<TextSpan>> annotations)
Squiggles\TestDiagnosticTagProducer.cs (1)
27internal static DiagnosticData CreateDiagnosticData(EditorTestHostDocument document, TextSpan span)
Structure\AbstractSyntaxStructureProviderTests.cs (3)
85IDictionary<string, ImmutableArray<TextSpan>> spans) 92var textSpan = spans[textSpanName][0]; 93var 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)
51IDictionary<string, ImmutableArray<TextSpan>> spans, 134var span = this.SelectedSpans.Single();
Workspaces\EditorTestWorkspace.cs (11)
67IDictionary<string, ImmutableArray<TextSpan>> spans, 265: ImmutableArray<TextSpan>.Empty; 266foreach (var span in document.SelectedSpans) 279mappedSpans[key] = mappedSpans.TryGetValue(key, out var textSpans) ? textSpans : ImmutableArray<TextSpan>.Empty; 314out Dictionary<string, ImmutableArray<TextSpan>> mappedMarkupSpans, out int? mappedCaretLocation) 368var matchingSpan = documentWithSpan.AnnotatedSpans[spanName].Single(); 409IDictionary<string, ImmutableArray<TextSpan>> markupSpans, 410out Dictionary<string, ImmutableArray<TextSpan>> mappedMarkupSpans, 413var tempMappedMarkupSpans = new Dictionary<string, PooledObjects.ArrayBuilder<TextSpan>>(); 417tempMappedMarkupSpans[key] = PooledObjects.ArrayBuilder<TextSpan>.GetInstance(); 418foreach (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)
24Public _span As TextSpan = Nothing 32Public Function CanNavigateToSpanAsync(workspace As Workspace, documentId As DocumentId, textSpan As TextSpan, allowInvalidSpan As Boolean, cancellationToken As CancellationToken) As Task(Of Boolean) Implements IDocumentNavigationService.CanNavigateToSpanAsync 47Public 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)
157return TextLine.FromSpan(_text, TextSpan.FromBounds(line.Start, line.End)); 178public override string ToString(TextSpan textSpan) 313public override void Write(TextWriter textWriter, TextSpan span, CancellationToken cancellationToken)
Shared\Extensions\ITextSnapshotExtensions.cs (3)
31/// Convert a <see cref="LinePositionSpan"/> to <see cref="TextSpan"/>. 33public static TextSpan GetTextSpan(this ITextSnapshot snapshot, LinePositionSpan span) 35return 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 (74)
CodeFixes\CodeFixServiceTests.cs (15)
59document, TextSpan.FromBounds(0, 0), new DefaultCodeActionRequestPriorityProvider(), CancellationToken.None); 86_ = 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); 563c.ReportDiagnostic(Diagnostic.Create(descriptor, c.Tree.GetLocation(TextSpan.FromBounds(0, 0)))); 783return await fixService.GetFixesAsync(document, TextSpan.FromBounds(0, 0), CancellationToken.None); 884var txtDocumentCodeFixes = await tuple.codeFixService.GetFixesAsync(txtDocument, TextSpan.FromBounds(0, 1), CancellationToken.None); 901var logDocumentCodeFixes = await tuple.codeFixService.GetFixesAsync(logDocument, TextSpan.FromBounds(0, 1), CancellationToken.None); 926var span = new TextSpan(line.Start, line.End); 1143static async Task VerifyCachedDiagnosticsAsync(Document sourceDocument, bool expectedCachedDiagnostic, TextSpan testSpan, DiagnosticIncrementalAnalyzer diagnosticIncrementalAnalyzer)
CodeGeneration\CodeGenerationTests.cs (6)
626var destSpan = new TextSpan(); 885var destSpan = Workspace.Documents.Single().SelectedSpans.Single(); 891var destSpan = Workspace.Documents.Single().SelectedSpans.Single(); 898foreach (var span in annotatedSpans) 904public static T GetSelectedSymbol<T>(TextSpan selection, SemanticModel semanticModel) 918var destSpan = Workspace.Documents.Single().SelectedSpans.Single();
CodeRefactorings\CodeRefactoringServiceTest.cs (7)
50var refactorings = await refactoringService.GetRefactoringsAsync(document, TextSpan.FromBounds(0, 0), CancellationToken.None); 88var refactorings = await refactoringService.GetRefactoringsAsync(document, TextSpan.FromBounds(0, 0), CancellationToken.None); 109var result = await refactoringService.GetRefactoringsAsync(document, TextSpan.FromBounds(0, 0), CancellationToken.None); 172var txtRefactorings = await refactoringService.GetRefactoringsAsync(txtAdditionalDocument, TextSpan.FromBounds(0, 0), CancellationToken.None); 187var logRefactorings = await refactoringService.GetRefactoringsAsync(logAdditionalDocument, TextSpan.FromBounds(0, 0), CancellationToken.None); 211var editorConfigRefactorings = await refactoringService.GetRefactoringsAsync(editorConfig, TextSpan.FromBounds(0, 0), CancellationToken.None); 226var 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 (4)
427var diagnosticSpan = new TextSpan(2, 2); 482public AdditionalFileAnalyzer2(bool registerFromInitialize, TextSpan diagnosticSpan, string id) 767async Task VerifyCallbackSpanAsync(TextSpan? filterSpan) 952=> Task.FromResult(ImmutableArray.Create(Diagnostic.Create(s_syntaxRule, Location.Create(document.FilePath, TextSpan.FromBounds(0, 0), new LinePositionSpan(new LinePosition(0, 0), new LinePosition(0, 0))))));
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)
67var span = (await document.GetSyntaxRootAsync()).FullSpan;
EditAndContinue\EditAndContinueLanguageServiceTests.cs (3)
163var documentDiagnostic = CodeAnalysis.Diagnostic.Create(diagnosticDescriptor1, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2)), ["doc", "error 1"]); 165var syntaxError = CodeAnalysis.Diagnostic.Create(diagnosticDescriptor1, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2)), ["doc", "syntax error 3"]); 166var rudeEditDiagnostic = new RudeEditDiagnostic(RudeEditKind.Delete, TextSpan.FromBounds(2, 3), arguments: ["x"]).ToDiagnostic(syntaxTree);
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)
381var textSpan = state.HostDocument.SelectedSpans.Single(); 395var textSpan = state.HostDocument.SelectedSpans.Single(); 409var textSpan = state.HostDocument.SelectedSpans.Single(); 429var textSpan = state.HostDocument.SelectedSpans.Single(); 853var textSpan = state.HostDocument.SelectedSpans.Single();
RenameTracking\RenameTrackingTestState.cs (2)
166public async Task<CodeAction> TryGetCodeActionAsync(TextSpan? textSpan = null) 168var 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)
46var 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)
434private static ImmutableArray<string> PartListToSubstrings(string identifier, in TemporaryArray<TextSpan> parts) 445using var parts = TemporaryArray<TextSpan>.Empty; 452using var parts = TemporaryArray<TextSpan>.Empty; 470Assert.Equal<TextSpan>(match.Value.MatchedSpans, spans); 490var flattened = new List<TextSpan>();
ValueTracking\AbstractBaseValueTrackingTests.cs (1)
30var textSpan = new TextSpan(cursorDocument.CursorPosition!.Value, 0);
Microsoft.CodeAnalysis.EditorFeatures.Wpf (11)
InlineRename\UI\Adornment\RenameFlyoutViewModel.cs (2)
42TextSpan selectionSpan, 215public TextSpan StartingSelection { get; }
InlineRename\UI\InlineRenameAdornmentManager.cs (1)
144var identifierSelection = new TextSpan(start, length);
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)
NavigateTo\NavigateToItemDisplay.cs (1)
82var span = NavigateToUtilities.GetBoundedSpan(_searchResult.NavigableItem, sourceText);
SignatureHelp\Model.cs (2)
20public TextSpan TextSpan { get; } 38TextSpan textSpan,
Suggestions\SuggestedActionsSource.cs (2)
131private TextSpan? TryGetCodeRefactoringSelection(ReferenceCountedDisposable<State> state, SnapshotSpan range) 275TextSpan? selection,
Suggestions\SuggestedActionsSource_Async.cs (1)
203TextSpan? selection,
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (48)
Classification\ClassificationTests.vb (5)
342Public Sub AddLexicalClassifications(text As SourceText, textSpan As TextSpan, result As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken) Implements IClassificationService.AddLexicalClassifications 345Public Sub AddSyntacticClassifications(services As SolutionServices, root As SyntaxNode, textSpans As ImmutableArray(Of TextSpan), result As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken) Implements IClassificationService.AddSyntacticClassifications 348Public 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 352Public Function AddSyntacticClassificationsAsync(document As Document, textSpans As ImmutableArray(Of TextSpan), result As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken) As Task Implements IClassificationService.AddSyntacticClassificationsAsync 367Public 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)
67Public ReadOnly Property SourceSpan As TextSpan Implements INavigableItem.SourceSpan
CodeFixes\CodeFixServiceTests.vb (3)
297document, Text.TextSpan.FromBounds(0, 0), New DefaultCodeActionRequestPriorityProvider(), CancellationToken.None) 342Public Function AnalyzeDocumentAsync(document As Document, span As TextSpan?, promptTitle As String, cancellationToken As CancellationToken) As Task Implements ICopilotCodeAnalysisService.AnalyzeDocumentAsync 346Public 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)
63Private Shared Async Function GetDiagnosticsForSpanAsync(diagnosticService As IDiagnosticAnalyzerService, document As Document, range As TextSpan) As Task(Of ImmutableArray(Of DiagnosticData)) 67Private Shared Async Function GetDiagnosticsForSpanAsync(diagnosticService As IDiagnosticAnalyzerService, document As Document, range As TextSpan, diagnosticKind As DiagnosticKind) As Task(Of ImmutableArray(Of DiagnosticData)) 917Dim documentDiagnostics = Await DiagnosticProviderTestUtilities.GetDocumentDiagnosticsAsync(workspace, document, TextSpan.FromBounds(0, 0))
Expansion\AbstractExpansionTest.vb (1)
33Dim spans As ImmutableArray(Of TextSpan) = Nothing
FindReferences\FindReferencesTests.vb (11)
202Public ReadOnly Spans As List(Of TextSpan) 204Public 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)
63Dim wordMatchSpan As TextSpan = Nothing
IntelliSense\SignatureHelpControllerTests.vb (6)
90.Returns(Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 0), selectedItem:=0, semanticParameterIndex:=0, syntacticArgumentCount:=0, argumentName:=Nothing))) 118Return Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 0), selectedItem:=0, semanticParameterIndex:=0, syntacticArgumentCount:=0, argumentName:=Nothing)) 138Return Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 0), selectedItem:=0, semanticParameterIndex:=0, syntacticArgumentCount:=0, argumentName:=Nothing)) 160.Returns(Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 0), selectedItem:=0, semanticParameterIndex:=0, syntacticArgumentCount:=0, argumentName:=Nothing))) 171Return Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 2), selectedItem:=0, semanticParameterIndex:=0, syntacticArgumentCount:=0, argumentName:=Nothing)) 358New SignatureHelpItems(_items, TextSpan.FromBounds(position, position), selectedItem:=0, semanticParameterIndex:=0, syntacticArgumentCount:=0, argumentName:=Nothing),
LanguageServices\SyntaxFactsServiceTests.vb (1)
216Dim 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)
60Public Function SendPaste(hostDocument As EditorTestHostDocument, pastedText As String) As TextSpan 82Public Async Function AssertHasPastedTextSpanAsync(hostDocument As TestHostDocument, Optional textSpan As TextSpan = Nothing) As Task 86Dim pastedTextSpan As TextSpan 97Dim textSpan As TextSpan
Rename\RenameEngineResult.vb (1)
206Dim spans As ImmutableArray(Of TextSpan) = Nothing
Rename\RenameTestHelpers.vb (1)
28Private Function GetSessionInfo(workspace As EditorTestWorkspace) As (document As Document, textSpan As TextSpan)
Simplification\AbstractSimplificationTests.vb (2)
66listOfLabelToAddSimplifierAnnotationSpans As IEnumerable(Of KeyValuePair(Of String, ImmutableArray(Of TextSpan))), 67explicitSpansToSimplifyWithin As ImmutableArray(Of TextSpan),
Microsoft.CodeAnalysis.ExternalAccess.AspNetCore (7)
EmbeddedLanguages\AspNetCoreVirtualChar.cs (1)
35public TextSpan Span => VirtualChar.Span;
EmbeddedLanguages\AspNetCoreVirtualCharSequence.cs (1)
37public AspNetCoreVirtualCharSequence GetSubSequence(TextSpan span) => new(_virtualCharSequence.GetSubSequence(span));
EmbeddedLanguages\BraceMatching\AspNetCoreBraceMatchingResult.cs (2)
13TextSpan LeftSpan, 14TextSpan 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 (12)
Analyzer\IExternalCSharpCopilotCodeAnalysisService.cs (1)
18Task<ImmutableArray<Diagnostic>> AnalyzeDocumentAsync(Document document, TextSpan? span, string promptTitle, CancellationToken cancellationToken);
CodeMapper\ICSharpCopilotMapCodeService.cs (1)
18ImmutableArray<(Document document, TextSpan textSpan)> prioritizedFocusLocations,
Internal\Analyzer\AbstractCopilotCodeAnalysisService.cs (4)
39protected abstract Task<ImmutableArray<Diagnostic>> AnalyzeDocumentCoreAsync(Document document, TextSpan? span, string promptTitle, CancellationToken cancellationToken); 73public async Task AnalyzeDocumentAsync(Document document, TextSpan? span, string promptTitle, CancellationToken cancellationToken) 128public async Task<ImmutableArray<Diagnostic>> GetCachedDocumentDiagnosticsAsync(Document document, TextSpan? span, ImmutableArray<string> promptTitles, CancellationToken cancellationToken) 162protected virtual Task<ImmutableArray<Diagnostic>> GetDiagnosticsIntersectWithSpanAsync(Document document, IReadOnlyList<Diagnostic> diagnostics, TextSpan span, CancellationToken cancellationToken)
Internal\Analyzer\CSharp\CSharpCopilotCodeAnalysisService.cs (2)
45protected override Task<ImmutableArray<Diagnostic>> AnalyzeDocumentCoreAsync(Document document, TextSpan? span, string promptTitle, CancellationToken cancellationToken) 64Document document, IReadOnlyList<Diagnostic> diagnostics, TextSpan span, CancellationToken cancellationToken)
Internal\Analyzer\CSharp\CSharpCopilotCodeAnalysisService.ReflectionWrapper.cs (3)
17using AnalyzeDocumentAsyncDelegateType = Func<Document, TextSpan?, string, CancellationToken, Task<ImmutableArray<Diagnostic>>>; 108=> CreateDelegate<AnalyzeDocumentAsyncDelegateType>(AnalyzeDocumentAsyncMethodName, [typeof(Document), typeof(TextSpan?), typeof(string), typeof(CancellationToken)]); 138public async Task<ImmutableArray<Diagnostic>> AnalyzeDocumentAsync(Document document, TextSpan? span, string promptTitle, CancellationToken cancellationToken)
Internal\CodeMapper\CopilotCSharpMapCodeService.cs (1)
30public Task<ImmutableArray<TextChange>?> MapCodeAsync(Document document, ImmutableArray<string> contents, ImmutableArray<(Document, TextSpan)> focusLocations, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.ExternalAccess.FSharp (71)
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)
30Task<IList<TextChange>> GetFormattingChangesAsync(Document document, TextSpan? textSpan, CancellationToken cancellationToken); 35Task<IList<TextChange>> GetFormattingChangesOnPasteAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken);
Editor\IFSharpEditorInlineRenameService.cs (3)
77TextSpan TriggerSpan { get; } 116TextSpan GetReferenceEditSpan(FSharpInlineRenameLocation location, CancellationToken cancellationToken); 122TextSpan? 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)
14public FSharpDebugDataTipInfo(TextSpan span, string text) 17public 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)
29public abstract TextSpan TriggerSpan { get; } 32public abstract TextSpan? GetConflictEditSpan(FSharpInlineRenameLocation location, string replacementText, CancellationToken cancellationToken); 34public abstract TextSpan GetReferenceEditSpan(FSharpInlineRenameLocation location, CancellationToken cancellationToken); 51TextSpan? IInlineRenameInfo.GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken) 54TextSpan 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)
127public TextSpan TriggerSpan => _info.TriggerSpan; 155public TextSpan? GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken) 165public 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 (2)
36public ImmutableArray<TextSpan> NameMatchSpans => ImmutableArray<TextSpan>.Empty;
Internal\Navigation\InternalFSharpNavigableItem.cs (1)
40public 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, 30TextSpan span, 31Action<CodeAction, TextSpan?> registerRefactoring, 40TextSpan? 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)
20ImmutableArray<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 (15)
IRazorDocumentExcerptService.cs (1)
14Task<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 (1)
63TextSpan span,
RazorDocumentExcerptServiceWrapper.cs (1)
21public 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)
53IEnumerable<TextSpan> spans,
RazorSpanMappingServiceWrapper.cs (1)
49IEnumerable<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 (667)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.cs (2)
56Document document, TextSpan textSpan, CancellationToken cancellationToken) 165TextSpan priorSelection,
AddFileBanner\AbstractAddFileBannerCodeRefactoringProvider.cs (1)
188ImmutableArray<TextSpan> fixAllSpans,
AddImport\AbstractAddImportCodeFixProvider.cs (1)
54var span = context.Span;
AddImport\AbstractAddImportFeatureService.cs (5)
64Document document, TextSpan span, string diagnosticId, int maxResults, 88Document document, TextSpan span, string diagnosticId, int maxResults, 508Document document, TextSpan span, ImmutableArray<Diagnostic> diagnostics, int maxResultsPerDiagnostic, 531Document document, TextSpan span, ImmutableArray<string> diagnosticIds, 556TextSpan span,
AddImport\IAddImportFeatureService.cs (4)
25Document document, TextSpan span, string diagnosticId, int maxResults, 34Document document, TextSpan span, ImmutableArray<Diagnostic> diagnostics, int maxResultsPerDiagnostic, 48/// Similar to <see cref="GetFixesAsync(Document, TextSpan, string, int, ISymbolSearchService, AddImportOptions, ImmutableArray{PackageSource}, CancellationToken)"/> 52Document document, TextSpan span, ImmutableArray<string> diagnosticIds,
AddImport\Remote\IRemoteMissingImportDiscoveryService.cs (2)
27Checksum solutionChecksum, RemoteServiceCallbackId callbackId, DocumentId documentId, TextSpan span, string diagnosticId, int maxResults, 31Checksum solutionChecksum, RemoteServiceCallbackId callbackId, DocumentId id, TextSpan span, ImmutableArray<string> diagnosticIds,
BraceCompletion\AbstractBraceCompletionService.cs (1)
64var 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)
93public async Task<ImmutableArray<ChangeSignatureCodeAction>> GetChangeSignatureCodeActionAsync(Document document, TextSpan span, CancellationToken cancellationToken)
ClassifiedSpansAndHighlightSpan.cs (2)
14TextSpan highlightSpan) 19public 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)
18TextSpan span, 25public TextSpan TextSpan { get; } = span;
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.cs (1)
56public 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\Suppression\AbstractSuppressionCodeFixProvider.cs (5)
142TextDocument textDocument, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) 150internal async Task<ImmutableArray<PragmaWarningCodeAction>> GetPragmaSuppressionsAsync(Document document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) 159Document document, TextSpan span, IEnumerable<Diagnostic> diagnostics, bool skipSuppressMessage, bool skipUnsuppress, CancellationToken cancellationToken) 265private async Task<SuppressionTargetInfo> GetSuppressionTargetInfoAsync(Document document, TextSpan span, CancellationToken cancellationToken) 322TextSpan? 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)
16ValueTask<ReferenceCount?> GetReferenceCountAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, int maxResultCount, CancellationToken cancellationToken); 17ValueTask<ImmutableArray<ReferenceLocationDescriptor>?> FindReferenceLocationsAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken); 18ValueTask<ImmutableArray<ReferenceMethodDescriptor>?> FindReferenceMethodsAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken); 19ValueTask<string> GetFullyQualifiedNameAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken);
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (5)
32public async Task<Document> AddMissingImportsAsync(Document document, TextSpan textSpan, IProgress<CodeAnalysisProgress> progressTracker, CancellationToken cancellationToken) 57public async Task<AddMissingImportsAnalysisResult> AnalyzeAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) 155private async Task<Document> CleanUpNewLinesAsync(Document document, IEnumerable<TextSpan> insertSpans, SyntaxFormattingOptions formattingOptions, CancellationToken cancellationToken) 162foreach (var insertSpan in insertSpans) 170private async Task<Document> CleanUpNewLinesAsync(Document document, TextSpan insertSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken)
CodeRefactorings\AddMissingImports\IAddMissingImportsFeatureService.cs (3)
21Task<Document> AddMissingImportsAsync(Document document, TextSpan textSpan, IProgress<CodeAnalysisProgress> progressTracker, CancellationToken cancellationToken); 26Task<AddMissingImportsAnalysisResult> AnalyzeAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); 29/// Performs the same action as <see cref="AddMissingImportsAsync(Document, TextSpan, IProgress{CodeAnalysisProgress}, CancellationToken)"/> but with a predetermined analysis of the input
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\CodeRefactoringContextExtensions.cs (9)
21this CodeRefactoringContext context, ImmutableArray<TCodeAction> actions, TextSpan? applicableToSpan = null) 58public static async Task<TSyntaxNode?> TryGetRelevantNodeAsync<TSyntaxNode>(this Document document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 64public static TSyntaxNode? TryGetRelevantNode<TSyntaxNode>(this ParsedDocument document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 67public static TSyntaxNode? TryGetRelevantNode<TSyntaxNode>(this ParsedDocument document, TextSpan span, bool allowEmptyNode, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 75this Document document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 81this Document document, TextSpan span, bool allowEmptyNodes, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 88this ParsedDocument document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 92this ParsedDocument document, TextSpan span, bool allowEmptyNodes, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 101this ParsedDocument document, TextSpan span, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
CodeRefactorings\CodeRefactoringService.cs (4)
92TextSpan state, 151TextSpan state, 207TextSpan state, 220using var _ = ArrayBuilder<(CodeAction action, TextSpan? applicableToSpan)>.GetInstance(out var actions);
CodeRefactorings\ExtractMethod\AbstractExtractMethodCodeRefactoringProvider.cs (3)
58TextSpan textSpan, 73Document document, TextSpan textSpan, ExtractMethodGenerationOptions extractOptions, CancellationToken cancellationToken) 98Document 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)
32public abstract Task<Solution> GetModifiedSolutionAsync(Document document, TextSpan textSpan, MoveTypeOperationKind operationKind, CancellationToken cancellationToken); 33public abstract Task<ImmutableArray<CodeAction>> GetRefactoringAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); 45Document document, TextSpan textSpan, CancellationToken cancellationToken) 58public override async Task<Solution> GetModifiedSolutionAsync(Document document, TextSpan textSpan, MoveTypeOperationKind operationKind, CancellationToken cancellationToken) 80protected abstract Task<TTypeDeclarationSyntax> GetRelevantNodeAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); 82private async Task<State> CreateStateAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken)
CodeRefactorings\MoveType\IMoveTypeService.cs (2)
19Task<ImmutableArray<CodeAction>> GetRefactoringAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); 21Task<Solution> GetModifiedSolutionAsync(Document document, TextSpan textSpan, MoveTypeOperationKind operationKind, CancellationToken cancellationToken);
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (3)
82protected abstract Task<SyntaxNode?> TryGetApplicableContainerFromSpanAsync(Document document, TextSpan span, CancellationToken cancellationToken); 270TextSpan span, 280using var _2 = PooledHashSet<TextSpan>.GetInstance(out var spanForContainers);
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.cs (1)
93protected 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\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, 321TextSpan span, 345Optional<TextSpan> span = default, 358var newSpan = span.HasValue ? span.Value : Span; 412public CompletionItem WithSpan(TextSpan span)
Completion\CompletionList.cs (9)
40public TextSpan DefaultSpan { get; } 53public TextSpan Span { get; } 75TextSpan defaultSpan, 104TextSpan defaultSpan, 113TextSpan defaultSpan, 123Optional<TextSpan> span = default, 128var newSpan = span.HasValue ? span.Value : Span; 150public CompletionList WithDefaultSpan(TextSpan span) 153public 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)
218builder.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 (4)
102var destinationSpan = ComputeDestinationSpan(insertionRoot); 143contextLocation: semanticModel.SyntaxTree.GetLocation(TextSpan.FromBounds(line.Start, line.Start)))); 165private TextSpan ComputeDestinationSpan(SyntaxNode insertionRoot) 190return TextSpan.FromBounds(firstToken.SpanStart, line.End);
Completion\Providers\AbstractPartialMethodCompletionProvider.cs (2)
82Document document, int position, TextSpan span, DeclarationModifiers modifiers, SyntaxToken token, CancellationToken cancellationToken) 104private 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)
39var ifSpan = ifStatement.Span;
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)
16Document 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\ICopilotCodeAnalysisService.cs (2)
43Task AnalyzeDocumentAsync(Document document, TextSpan? span, string promptTitle, CancellationToken cancellationToken); 54Task<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\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 (2)
9internal readonly struct DebugDataTipInfo(TextSpan span, string text) 11public readonly TextSpan Span = span;
Debugging\IBreakpointResolutionService.cs (1)
15Task<BreakpointResolutionResult?> ResolveBreakpointAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken = default);
Diagnostics\DiagnosticArguments.cs (2)
50public TextSpan? DocumentSpan; 90TextSpan? documentSpan,
Diagnostics\IAnalyzerDriverService.cs (1)
25void ComputeDeclarationsInSpan(SemanticModel model, TextSpan span, bool getSymbol, ArrayBuilder<DeclarationInfo> builder, CancellationToken cancellationToken);
Diagnostics\IDiagnosticAnalyzerService.cs (4)
109TextDocument document, TextSpan? range, Func<string, bool>? shouldIncludeDiagnostic, 127TextDocument document, TextSpan? range, CancellationToken cancellationToken) 138TextDocument document, TextSpan? range, DiagnosticKind diagnosticKind, bool includeSuppressedDiagnostics, CancellationToken cancellationToken) 153TextDocument document, TextSpan? range, string? diagnosticId,
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (4)
79var replaceSpan = new TextSpan(token.Span.Start, spanToReplaceLength); 277var replaceSpan = token.Span; 321var replaceSpan = new TextSpan(token.Span.Start, 0); 389? TextSpan.FromBounds(currentLine.Start, currentLine.Start + firstNonWhitespaceOffset.Value)
DocumentationComments\DocumentationCommentSnippet.cs (2)
14public TextSpan SpanToReplace { get; } 26internal DocumentationCommentSnippet(TextSpan spanToReplace, string snippetText, int caretOffset)
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 (36)
95internal abstract bool TryFindMemberDeclaration(SyntaxNode? root, SyntaxNode node, TextSpan activeSpan, out OneOrMany<SyntaxNode> declarations); 128protected abstract bool TryGetEnclosingBreakpointSpan(SyntaxToken token, out TextSpan span); 145protected abstract bool TryGetActiveSpan(SyntaxNode node, int statementPart, int minLength, out TextSpan span); 269protected abstract TextSpan? TryGetDiagnosticSpan(SyntaxNode node, EditKind editKind); 271internal TextSpan GetDiagnosticSpan(SyntaxNode node, EditKind editKind) 274protected virtual TextSpan GetBodyDiagnosticSpan(SyntaxNode node, EditKind editKind) 294internal abstract TextSpan GetLambdaParameterDiagnosticSpan(SyntaxNode lambda, int ordinal); 406protected abstract TextSpan GetExceptionHandlingRegion(SyntaxNode node, out bool coversAllChildren); 409internal abstract void ReportEnclosingExceptionHandlingRudeEdits(ArrayBuilder<RudeEditDiagnostic> diagnostics, IEnumerable<Edit<SyntaxNode>> exceptionHandlingEdits, SyntaxNode oldStatement, TextSpan newStatementSpan); 630using var _3 = ArrayBuilder<(SyntaxNode OldNode, SyntaxNode NewNode, TextSpan DiagnosticSpan)>.GetInstance(out var triviaEdits); 723lineText = text.ToString(TextSpan.FromBounds(diagnostic.Span.Start, Math.Min(diagnostic.Span.Start + 120, line.End))); 1188TextSpan newSpan; 1319var trackedSpan = text.Lines.GetTextSpan(trackedLineSpan); 1334private ActiveStatement GetActiveStatementWithSpan(UnmappedActiveStatement oldStatement, SyntaxTree newTree, TextSpan newSpan, ArrayBuilder<RudeEditDiagnostic> diagnostics, CancellationToken cancellationToken) 1357TextSpan newStatementSyntaxSpan, 1575public ActiveStatementExceptionRegions GetExceptionRegions(SyntaxNode root, TextSpan unmappedActiveStatementSpan, bool isNonLeaf, CancellationToken cancellationToken) 1615private TextSpan GetDeletedNodeDiagnosticSpan( 1640private TextSpan FindClosestActiveSpan(SyntaxNode statement, int statementPart) 1667internal TextSpan GetDeletedNodeActiveSpan(IReadOnlyDictionary<SyntaxNode, SyntaxNode> forwardMap, SyntaxNode deletedNode) 1685internal TextSpan GetDeletedDeclarationActiveSpan(IReadOnlyDictionary<SyntaxNode, SyntaxNode> forwardMap, SyntaxNode deletedDeclaration) 1707internal TextSpan GetDeletedNodeDiagnosticSpan(IReadOnlyDictionary<SyntaxNode, SyntaxNode> forwardMap, SyntaxNode deletedNode) 1767protected void AddAroundActiveStatementRudeDiagnostic(ArrayBuilder<RudeEditDiagnostic> diagnostics, SyntaxNode? oldNode, SyntaxNode? newNode, TextSpan newActiveStatementSpan) 1812protected void AddRudeDeleteAroundActiveStatement(ArrayBuilder<RudeEditDiagnostic> diagnostics, SyntaxNode oldNode, TextSpan newActiveStatementSpan) 2041[Out] ArrayBuilder<(SyntaxNode OldNode, SyntaxNode NewNode, TextSpan DiagnosticSpan)> triviaEdits, 2094var rudeEditSpan = default(TextSpan); 2227rudeEditSpan = TextSpan.FromBounds(newTokensEnum.Current.FullSpan.Start, newTokensEnum.Current.SpanStart); 2233rudeEditSpan = TextSpan.FromBounds(lastNewToken.Span.End, newTokensEnum.Current.SpanStart); 2501IReadOnlyList<(SyntaxNode OldNode, SyntaxNode NewNode, TextSpan DiagnosticSpan)> triviaEdits, 3101TextSpan? newActiveStatementSpan = null; 4828TextSpan diagnosticSpan) 4929public void Report(RudeEditKind kind, TextSpan span) 4956public void Report(RudeEditKind kind, CancellationToken cancellationToken, TextSpan? span = null, string?[]? arguments = null) 4959public RudeEditDiagnostic CreateRudeEdit(RudeEditKind kind, CancellationToken cancellationToken, TextSpan? span = null, string?[]? arguments = null) 5019private DiagnosticContext CreateDiagnosticContext(ArrayBuilder<RudeEditDiagnostic> diagnostics, ISymbol? oldSymbol, ISymbol? newSymbol, SyntaxNode? newNode, SemanticModel newModel, Match<SyntaxNode>? topMatch, TextSpan diagnosticSpan = default) 6052private TextSpan GetSymbolLocationSpan(ISymbol symbol, CancellationToken cancellationToken)
EditAndContinue\AbstractSimpleMemberBody.cs (1)
23public 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)
212private static TextSpan GetFirstLineDifferenceSpan(SourceText oldText, SourceText newText) 219var oldLineSpan = oldText.Lines[i].Span; 220var newLineSpan = newText.Lines[i].Span; 229TextSpan.FromBounds(newText.Lines[newLineCount - 1].End, newText.Lines[newLineCount - 1].EndIncludingLineBreak);
EditAndContinue\IEditAndContinueAnalyzer.cs (1)
24ActiveStatementExceptionRegions GetExceptionRegions(SyntaxNode syntaxRoot, TextSpan unmappedActiveStatementSpan, bool isNonLeaf, CancellationToken cancellationToken);
EditAndContinue\MemberBody.cs (6)
16public abstract TextSpan Envelope { get; } 21public bool ContainsActiveStatementSpan(TextSpan span) 27public virtual bool IsExcludedActiveStatementSpanWithinEnvelope(TextSpan span) 40public abstract SyntaxNode FindStatementAndPartner(TextSpan span, MemberBody? partnerDeclarationBody, out SyntaxNode? partnerStatement, out int statementPart); 42public SyntaxNode FindStatement(TextSpan span, out int statementPart) 47var envelope = Envelope;
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)
38=> Text.GetSubSequence(TextSpan.FromBounds(start, end)); 317private readonly TextSpan GetTextSpan(int startInclusive, int endExclusive) 318=> TextSpan.FromBounds(Text[startInclusive].Span.Start, Text[endExclusive - 1].Span.End);
EmbeddedLanguages\Json\JsonParser.cs (2)
403literalToken.VirtualChars.GetSubSequence(TextSpan.FromBounds(1, literalToken.VirtualChars.Length)), 590private 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 (2)
109RegexEscapeNode node, TextSpan captureSpan) 114private static HighlightSpan CreateHighlightSpan(TextSpan textSpan)
EmbeddedLanguages\RegularExpressions\RegexLexer.cs (3)
55=> Text.GetSubSequence(TextSpan.FromBounds(start, end)); 178public readonly TextSpan GetTextSpan(int startInclusive, int endExclusive) 179=> 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)
82private readonly ImmutableDictionary<string, TextSpan> _captureNamesToSpan; 83private readonly ImmutableDictionary<int, TextSpan> _captureNumbersToSpan; 92ImmutableDictionary<string, TextSpan> captureNamesToSpan, 93ImmutableDictionary<int, TextSpan> captureNumbersToSpan) : this() 145ImmutableDictionary<string, TextSpan>.Empty, 146ImmutableDictionary<int, TextSpan>.Empty).ParseTree(); 704private readonly TextSpan GetTokenSpanIncludingEOF(RegexToken token) 709private readonly TextSpan GetTokenStartPositionSpan(RegexToken token)
EmbeddedLanguages\RegularExpressions\RegexTree.cs (4)
18ImmutableDictionary<string, TextSpan> captureNamesToSpan, 19ImmutableDictionary<int, TextSpan> captureNumbersToSpan) : EmbeddedSyntaxTree<RegexKind, RegexNode, RegexCompilationUnit>(text, root, diagnostics) 21public readonly ImmutableDictionary<string, TextSpan> CaptureNamesToSpan = captureNamesToSpan; 22public readonly ImmutableDictionary<int, TextSpan> CaptureNumbersToSpan = captureNumbersToSpan;
EmbeddedLanguages\StackFrame\StackFrameLexer.cs (1)
66=> Text.GetSubSequence(TextSpan.FromBounds(start, end));
EncapsulateField\AbstractEncapsulateFieldService.cs (7)
41protected abstract Task<ImmutableArray<IFieldSymbol>> GetFieldsAsync(Document document, TextSpan span, CancellationToken cancellationToken); 44public async Task<EncapsulateFieldResult?> EncapsulateFieldsInSpanAsync(Document document, TextSpan span, bool useDefaultBehavior, CancellationToken cancellationToken) 57public async Task<ImmutableArray<CodeAction>> GetEncapsulateFieldCodeActionsAsync(Document document, TextSpan span, CancellationToken cancellationToken) 279Func<DocumentId, TextSpan, bool> filter, 296private static bool IntersectsWithAny(DocumentId documentId, TextSpan span, ISet<(DocumentId documentId, TextSpan span)> constructorLocations) 310private 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\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\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)
86var memberSpan = TextSpan.FromBounds(
ExtractClass\ExtractClassWithDialogCodeAction.cs (2)
27TextSpan span, 44public TextSpan Span { get; } = span;
ExtractInterface\AbstractExtractInterfaceService.cs (1)
51public async Task<ImmutableArray<ExtractInterfaceCodeAction>> GetExtractInterfaceCodeActionAsync(Document document, TextSpan span, CancellationToken cancellationToken)
ExtractMethod\AbstractExtractMethodService.cs (2)
23protected abstract TValidator CreateSelectionValidator(SemanticDocument document, TextSpan textSpan, bool localFunction); 28TextSpan textSpan,
ExtractMethod\AbstractSyntaxTriviaService.cs (3)
27public ITriviaSavedResult SaveTriviaAroundSelection(SyntaxNode root, TextSpan textSpan) 93private static Dictionary<TriviaLocation, IEnumerable<SyntaxTrivia>> GetTriviaAtEdges(Dictionary<TriviaLocation, SyntaxToken> tokens, TextSpan textSpan) 109private 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.SymbolMapBuilder.cs (3)
24private readonly TextSpan _span; 32TextSpan span, 48TextSpan span,
ExtractMethod\MethodExtractor.VariableSymbol.cs (1)
248var span = _localSymbol.Locations[0].SourceSpan;
ExtractMethod\SelectionResult.cs (6)
25TextSpan originalSpan, 26TextSpan finalSpan, 66public TextSpan OriginalSpan { get; } 67public TextSpan FinalSpan { get; } 172var span = TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End);
ExtractMethod\SelectionValidator.cs (8)
24TextSpan textSpan) 29protected readonly TextSpan OriginalSpan = textSpan; 35public abstract bool IsFinalSpanSemanticallyValidSpan(SyntaxNode node, TextSpan textSpan, IEnumerable<SyntaxNode> returnStatements, CancellationToken cancellationToken); 39SemanticModel semanticModel, TextSpan textSpan, (SyntaxNode, SyntaxNode) range, CancellationToken cancellationToken) 85SyntaxNode root, TextSpan textSpan, CancellationToken cancellationToken) where T : SyntaxNode 145SyntaxNode root, TextSpan textSpan, CancellationToken cancellationToken) where T : SyntaxNode 184public TextSpan OriginalSpan { get; set; } 185public TextSpan FinalSpan { get; set; }
FindUsages\AbstractFindUsagesService.ProgressAdapter.cs (1)
36public async ValueTask OnReferenceFoundAsync(Document document, TextSpan span, CancellationToken cancellationToken)
FindUsages\AbstractFindUsagesService_FindImplementations.cs (2)
109var seenLocations = new HashSet<(string filePath, TextSpan span)>(); 124static bool AddedAllLocations(ISymbol implementation, HashSet<(string filePath, TextSpan span)> seenLocations)
FindUsages\DefinitionItemFactory.cs (1)
300var sourceSpan = location.SourceSpan;
FindUsages\IRemoteFindUsagesService.cs (4)
163internal readonly struct SerializableDocumentSpan(DocumentId documentId, TextSpan sourceSpan) 169public readonly TextSpan SourceSpan = sourceSpan; 253SerializableClassifiedSpans classifiedSpans, TextSpan highlightSpan) 259public readonly TextSpan HighlightSpan = highlightSpan;
Formatting\FormattingRuleUtilities.cs (1)
14ParsedDocument document, TextSpan span, IEnumerable<AbstractFormattingRule>? additionalRules)
FullyQualify\AbstractFullyQualifyService.cs (2)
41Document document, TextSpan span, CancellationToken cancellationToken) 61Document 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);
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.cs (6)
75Document priorDocument, TextSpan priorSelection, Document currentDocument, IntentDataProvider intentDataProvider, CancellationToken cancellationToken) 150TextSpan textSpan, 151Action<CodeAction, TextSpan> registerSingleAction, 178private async Task<(CodeAction CodeAction, TextSpan ApplicableToSpan)?> HandleNonSelectionAsync( 180TextSpan textSpan, 254Document document, TextSpan textSpan, bool addNullChecks, Accessibility? desiredAccessibility, CancellationToken cancellationToken)
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.GenerateConstructorWithDialogCodeAction.cs (2)
27TextSpan textSpan, 37private readonly TextSpan _textSpan = textSpan;
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.State.cs (3)
23public TextSpan TextSpan { get; private set; } 37TextSpan textSpan, 53TextSpan textSpan,
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.cs (1)
169TextSpan textSpan,
GenerateFromMembers\AbstractGenerateFromMembersCodeRefactoringProvider.cs (1)
28Document 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(Document document, int position, CancellationToken cancellationToken) 65public async Task<(int? targetPosition, TextSpan tokenSpan)> GetTargetIfControlFlowAsync(Document document, int position, CancellationToken cancellationToken)
GoToDefinition\IGoToDefinitionSymbolService.cs (2)
14Task<(ISymbol? symbol, Project project, TextSpan boundSpan)> GetSymbolProjectAndBoundSpanAsync(Document document, int position, CancellationToken cancellationToken); 20Task<(int? targetPosition, TextSpan tokenSpan)> GetTargetIfControlFlowAsync(Document document, int position, CancellationToken cancellationToken);
Highlighting\HighlightingService.cs (4)
25private static readonly PooledObjects.ObjectPool<List<TextSpan>> s_listPool = new(() => []); 28SyntaxNode root, int position, List<TextSpan> highlights, CancellationToken cancellationToken) 39var lastSpan = default(TextSpan);
Highlighting\IHighlighter.cs (1)
15void AddHighlights(SyntaxNode root, int position, List<TextSpan> highlights, CancellationToken cancellationToken);
Highlighting\IHighlightingService.cs (1)
21void AddHighlights(SyntaxNode root, int position, List<TextSpan> highlights, CancellationToken cancellationToken);
Highlighting\Keywords\AbstractKeywordHighlighter.cs (8)
20protected sealed override void AddHighlightsForNode(SyntaxNode node, List<TextSpan> highlights, CancellationToken cancellationToken) 23protected abstract void AddHighlights(TNode node, List<TextSpan> highlights, CancellationToken cancellationToken); 30private static readonly ObjectPool<List<TextSpan>> s_textSpanListPool = new(() => []); 38SyntaxNode root, int position, List<TextSpan> highlights, CancellationToken cancellationToken) 66private static bool AnyIntersects(int position, List<TextSpan> highlights) 68foreach (var highlight in highlights) 77protected abstract void AddHighlightsForNode(SyntaxNode node, List<TextSpan> highlights, CancellationToken cancellationToken); 79protected 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)
57TextSpan parameterSpan, 128TextSpan parameterSpan,
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (1)
54ImmutableArray<SyntaxNode> listOfParameterNodes, TextSpan parameterSpan,
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (1)
44TextSpan parameterSpan,
InlineHints\AbstractInlineHintsService.cs (1)
17Document document, TextSpan textSpan, InlineHintsOptions options, bool displayAllOverride, CancellationToken cancellationToken)
InlineHints\AbstractInlineParameterNameHintsService.cs (2)
38TextSpan textSpan, 102var textSpan = new TextSpan(position, 0);
InlineHints\AbstractInlineTypeHintsService.cs (1)
33TextSpan textSpan,
InlineHints\IInlineHintsService.cs (1)
16Document document, TextSpan textSpan, InlineHintsOptions options, bool displayAllOverride, CancellationToken cancellationToken);
InlineHints\IInlineParameterNameHintsService.cs (1)
22TextSpan textSpan,
InlineHints\IInlineTypeHintsService.cs (1)
22TextSpan textSpan,
InlineHints\InlineHint.cs (4)
16public readonly TextSpan Span; 23TextSpan span, 31TextSpan span, 40TextSpan span,
InlineHints\TypeHint.cs (3)
10internal readonly struct TypeHint(ITypeSymbol type, TextSpan span, TextChange? textChange, bool leadingSpace = false, bool trailingSpace = false) 15public TextSpan Span { get; } = span; 23public void Deconstruct(out ITypeSymbol type, out TextSpan span, out TextChange? textChange, out ImmutableArray<SymbolDisplayPart> prefix, out ImmutableArray<SymbolDisplayPart> suffix)
Intents\IIntentProvider.cs (1)
16TextSpan priorSelection,
IntroduceUsingStatement\AbstractIntroduceUsingStatementCodeRefactoringProvider.cs (1)
62private async Task<(TLocalDeclarationSyntax? declaration, string? variableName)> FindDisposableLocalDeclarationAsync(Document document, TextSpan selection, CancellationToken cancellationToken)
IntroduceVariable\AbstractIntroduceLocalForExpressionCodeRefactoringProvider.cs (1)
27protected abstract bool IsValid(TExpressionStatementSyntax expressionStatement, TextSpan span);
IntroduceVariable\AbstractIntroduceVariableService.cs (1)
64TextSpan textSpan,
IntroduceVariable\AbstractIntroduceVariableService.State.cs (2)
47TextSpan textSpan, 61TextSpan textSpan,
IntroduceVariable\IIntroduceVariableService.cs (1)
18Task<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)
28Task<ImmutableArray<AbstractMoveToNamespaceCodeAction>> GetCodeActionsAsync(Document document, TextSpan span, CancellationToken cancellationToken); 52TextSpan span, 248var 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)
141using var matchedSpans = TemporaryArray<TextSpan>.Empty;
NavigateTo\INavigateToSearchResult.cs (1)
20ImmutableArray<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; 349TextSpan 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)
PasteTracking\IPasteTrackingService.cs (1)
13bool TryGetPastedTextSpan(SourceTextContainer sourceTextContainer, out TextSpan textSpan);
PullMemberUp\AbstractPullMemberUpRefactoringProvider.cs (1)
71TextSpan.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\Presentation\QuickInfoContentBuilder.cs (1)
137foreach (var relatedSpan in quickInfoItem.RelatedSpans)
QuickInfo\QuickInfoItem.cs (8)
15public TextSpan Span { get; } 31public ImmutableArray<TextSpan> RelatedSpans { get; } 36TextSpan span, 39ImmutableArray<TextSpan> relatedSpans, 50TextSpan span, 53ImmutableArray<TextSpan> relatedSpans = default) 59TextSpan span, 62ImmutableArray<TextSpan> relatedSpans,
QuickInfo\QuickInfoUtilities.cs (2)
21public static Task<QuickInfoItem> CreateQuickInfoItemAsync(SolutionServices services, SemanticModel semanticModel, TextSpan span, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, CancellationToken cancellationToken) 27TextSpan span,
ReplaceDocCommentTextWithTag\AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (8)
41var singleWordSpan = ExpandSpan(sourceText, span, fullyQualifiedName: false); 63var fullyQualifiedSpan = ExpandSpan(sourceText, span, fullyQualifiedName: true); 110CodeRefactoringContext context, SemanticModel semanticModel, SyntaxToken token, TextSpan replacementSpan, CancellationToken cancellationToken) 141CodeRefactoringContext context, TextSpan expandedSpan, string replacement) 152Document document, TextSpan span, string replacement, CancellationToken cancellationToken) 160private static TextSpan ExpandSpan(SourceText sourceText, TextSpan span, bool fullyQualifiedName) 181return TextSpan.FromBounds(startInclusive, endExclusive);
SemanticSearch\AbstractSemanticSearchService.cs (1)
205var span = queryText.Lines.GetTextSpan(new LinePositionSpan(position, position));
SemanticSearch\ISemanticSearchResultsObserver.cs (2)
29[property: DataMember(Order = 4)] TextSpan Span); 35[property: DataMember(Order = 2)] TextSpan Span);
Shared\Naming\IdentifierNameParts.cs (2)
25using var parts = TemporaryArray<TextSpan>.Empty; 69private static ImmutableArray<string> CreateWords(in TemporaryArray<TextSpan> parts, string name)
SignatureHelp\AbstractSignatureHelpProvider.cs (2)
40IList<SignatureHelpItem> items, TextSpan applicableSpan, SignatureHelpState? state, int? selectedItemIndex, int parameterIndexOverride) 72IList<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)
111var extendedSpan = GetUpdatedTextSpan(textChange, placeholders, caretPosition, triggerLocation); 124private static TextSpan GetUpdatedTextSpan(TextChange textChange, ImmutableArray<SnippetPlaceholder> placeholders, int caretPosition, int triggerLocation) 143return 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)
56var change = new TextChange(TextSpan.FromBounds(position, position), resultingNode.ToFullString()); 95var 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\SnippetUtilities.cs (2)
12public static bool TryGetWordOnLeft(int position, SourceText currentText, ISyntaxFactsService syntaxFactsService, [NotNullWhen(true)] out TextSpan? wordSpan) 35wordSpan = TextSpan.FromBounds(startPosition, endPosition);
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)
23protected abstract bool IsApplicableSpan(SyntaxNode node, TextSpan span, out SyntaxNode ifOrElseIf); 53void RegisterRefactoring(MergeDirection direction, TextSpan upperIfOrElseIfSpan, TextSpan lowerIfOrElseIfSpan) 60TextSpan.FromBounds(upperIfOrElseIfSpan.Start, lowerIfOrElseIfSpan.End)); 65private async Task<Document> RefactorAsync(Document document, TextSpan upperIfOrElseIfSpan, TextSpan lowerIfOrElseIfSpan, CancellationToken cancellationToken) 80static 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)
143private IEnumerable<TextSpan> GetContiguousSpans(ImmutableArray<SyntaxNode> nodes) 146(SyntaxNode node, TextSpan textSpan)? previous = null; 151TextSpan textSpan; 155textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 163textSpan = TextSpan.FromBounds(previous.Value.textSpan.Start, nodeEnd); 169textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 196IEnumerable<TextSpan> contiguousSpans, SyntaxTree tree, 199foreach (var span in contiguousSpans) 210protected abstract IEnumerable<TextSpan> GetFixableDiagnosticSpans( 218foreach (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)
37var unnecessarySpans = new List<TextSpan>(); 77out string? formatString, List<TextSpan> unnecessarySpans) 183private static TextSpan GetSpanWithinLiteralQuotes(IVirtualCharService virtualCharService, SyntaxToken formatToken) 188: TextSpan.FromBounds(sequence.First().Span.Start, sequence.Last().Span.End); 193out TExpressionSyntax? alignment, out bool negate, List<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)
151var location1 = Location.Create(syntaxTree, TextSpan.FromBounds( 157locations.Add(syntaxTree.GetLocation(TextSpan.FromBounds(match.Initializer.FullSpan.End, match.Statement.Span.End)));
src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
56var span = diagnostic.Location.SourceSpan;
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (8)
333edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 337edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, bottomEnd), "")); 346edits.Add(new TextChange(TextSpan.FromBounds(startPos, equalsEnd), "")); 350edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), "")); 359edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 365edits.Add(new TextChange(TextSpan.FromBounds(secondMiddlePos, equalsEnd), "")); 371edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, equalsEnd), "")); 376edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), ""));
src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (1)
48private static bool TryGetNode(SyntaxNode root, TextSpan span, out SyntaxNode node)
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
49private static TXmlElementSyntax? GetParamNode(SyntaxNode root, TextSpan span)
src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (3)
68var diagnosticSpan = diagnostic.Location.SourceSpan; 70var spanToFormat = TextSpan.FromBounds(
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.cs (2)
21SemanticDocument document, TextSpan textSpan, CancellationToken cancellationToken, 26TextSpan textSpan,
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (2)
30TextSpan textSpan, 46TextSpan textSpan,
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\IGenerateDefaultConstructorsService.cs (1)
18Document document, TextSpan textSpan, bool forRefactoring, CancellationToken cancellationToken);
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (1)
63TextSpan span, Diagnostic diagnostic)
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (1)
32var span = context.Span;
src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (1)
44protected virtual bool TryGetNode(SyntaxNode root, TextSpan span, out SyntaxNode node)
src\Analyzers\Core\CodeFixes\MakeFieldReadonly\AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
48var 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 (14)
13TextSpan textSpan, 14TextSpan hintSpan, 15ImmutableArray<(TextSpan textSpan, TextSpan hintSpan, string type)> subHeadings = default, 30public TextSpan TextSpan { get; } = textSpan; 35public TextSpan HintSpan { get; } = hintSpan; 50/// The primary span representing "else" statement block would be the same as the <see cref="TextSpan"/> of 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,
TaskList\AbstractTaskListService.cs (2)
130var fullSpan = trivia.FullSpan; 145var 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)
385ISet<(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)
17TextSpan textSpan, 25public TextSpan TextSpan { get; } = textSpan;
ValueTracking\ValueTrackedItem.cs (2)
19public TextSpan Span { get; } 26TextSpan 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)
146var span = referenceLocation.Location.SourceSpan; 169var span = referenceLocation.Location.SourceSpan;
ValueTracking\ValueTrackingService.cs (1)
28TextSpan selection,
Wrapping\AbstractCodeActionComputer.cs (6)
90new TextChange(TextSpan.FromBounds(nodeOrToken.Span.End, OriginalSourceText.Length), newLine)); 163SyntaxNode rewrittenRoot, TextSpan spanToFormat, CancellationToken cancellationToken) 171private async Task<(SyntaxNode root, SyntaxNode rewrittenRoot, TextSpan spanToFormat)> RewriteTreeAsync( 179var span = TextSpan.FromBounds(edit.Left.Span.End, edit.Right.Span.Start); 220private 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 (40)
Diagnostics\DiagnosticProviderTestUtilities.cs (2)
18TextSpan span, 29TextSpan span,
Diagnostics\TestDiagnosticAnalyzerDriver.cs (4)
41TextSpan? filterSpan, 80public Task<IEnumerable<Diagnostic>> GetAllDiagnosticsAsync(Document document, TextSpan? filterSpan) 88var span = (await document.GetSyntaxRootAsync()).FullSpan; 98public Task<IEnumerable<Diagnostic>> GetDocumentDiagnosticsAsync(Document document, TextSpan span)
EditAndContinue\EditAndContinueTestVerifier.cs (3)
384public static SyntaxNode FindNode(SyntaxNode root, TextSpan span) 403IEnumerable<(TextSpan oldSpan, TextSpan newSpan, RuntimeRudeEditDescription? runtimeRudeEdit)> expectedMapping,
EditAndContinue\EditAndContinueWorkspaceTestBase.cs (1)
323internal 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)
16public readonly struct Mapping(ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)> nodeSpans, ImmutableArray<TextSpan> newSpans, Match<SyntaxNode>? match) 18public readonly ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)> Spans = nodeSpans; 39public readonly ImmutableArray<ImmutableArray<TextSpan>> OldNodeSpans; 40public readonly ImmutableArray<ImmutableArray<TextSpan>> NewNodeSpans; 43public readonly ImmutableArray<TextSpan> NewSpans;
Snippets\AbstractSnippetProviderTests.cs (3)
66TestFileMarkupParser.GetPositionAndSpans(markupAfterCommit, out markupAfterCommit, out int finalCaretPosition, out ImmutableDictionary<string, ImmutableArray<TextSpan>> placeholderLocations); 69var placeholderLocationsArray = new ImmutableArray<TextSpan>[placeholderLocations.Count]; 101var expectedSpan = expectedSpans[j];
Microsoft.CodeAnalysis.Features.UnitTests (18)
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\EmitSolutionUpdateResultsTests.cs (2)
129new RudeEditDiagnostic(RudeEditKind.Insert, TextSpan.FromBounds(1, 10), 123, ["a"]).ToDiagnostic(tree), 130new 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))); 198var documentDiagnostic = Diagnostic.Create(diagnosticDescriptor1, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2)), new[] { "doc", "some error" }); 200var 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 (125)
Extensions\ProtocolConversions.cs (8)
298public static TextSpan RangeToTextSpan(LSP.Range range, SourceText text) 349public static LSP.Range TextSpanToRange(TextSpan textSpan, SourceText text) 443TextSpan textSpan, 452TextSpan textSpan, 491TextSpan span, 503span = TextSpan.FromBounds( 511static LSP.Location ConvertTextSpanWithTextToLocation(TextSpan span, SourceText text, Uri documentUri) 992private static async Task<ImmutableArray<MappedSpanResult>?> GetMappedSpanResultAsync(TextDocument textDocument, ImmutableArray<TextSpan> textSpans, CancellationToken cancellationToken)
Features\CodeCleanup\AbstractCodeCleanupService.cs (2)
179var textSpan = new TextSpan(0, tree.Length); 200var range = new TextSpan(0, tree.Length);
Features\CodeFixes\CodeFixService.cs (19)
102TextDocument document, TextSpan range, ICodeActionRequestPriorityProvider priorityProvider, CancellationToken cancellationToken) 124var spanToErrorDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>>(); 125var spanToOtherDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>>(); 151SortedDictionary<TextSpan, List<DiagnosticData>> spanToDiagnostics, 171TextSpan range, 246TextSpan range, 256private static SortedDictionary<TextSpan, List<DiagnosticData>> ConvertToMap( 263var spanToDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>>(); 281TextDocument document, TextSpan range, string diagnosticId, CancellationToken cancellationToken) 285TextDocument document, TextSpan range, string diagnosticId, DiagnosticSeverity minimumSeverity, CancellationToken cancellationToken) 304var spanToDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>> 338var textSpan = new TextSpan(0, text.Length); 437SortedDictionary<TextSpan, List<DiagnosticData>> spanToDiagnostics, 456using var _1 = PooledDictionary<CodeFixProvider, List<(TextSpan range, List<DiagnosticData> diagnostics)>>.GetInstance(out var fixerToRangesAndDiagnostics); 583TextSpan range, 586PooledDictionary<CodeFixProvider, List<(TextSpan range, List<DiagnosticData> diagnostics)>> fixerToRangesAndDiagnostics) 618TextDocument document, TextSpan span, CodeFixProvider fixer, CodeChangeProviderMetadata? fixerMetadata, 699TextSpan diagnosticsSpan, 734TextSpan fixesSpan,
Features\CodeFixes\CodeFixService.FixAllDiagnosticProvider.cs (1)
52public override async Task<IEnumerable<Diagnostic>> GetDocumentSpanDiagnosticsAsync(Document document, TextSpan fixAllSpan, CancellationToken cancellationToken)
Features\CodeFixes\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)
Features\Diagnostics\DiagnosticAnalyzerService.cs (1)
81TextSpan? range,
Features\Diagnostics\DocumentAnalysisExecutor.cs (3)
212private async Task<ImmutableArray<DiagnosticData>> GetCompilerAnalyzerDiagnosticsAsync(DiagnosticAnalyzer analyzer, TextSpan? span, CancellationToken cancellationToken) 301async Task<TextSpan?> GetAdjustedSpanForCompilerAnalyzerAsync() 333return TextSpan.FromBounds(Math.Min(startSpan.Start, endSpan.Start), Math.Max(startSpan.End, endSpan.End));
Features\Diagnostics\DocumentAnalysisExecutor_Helpers.cs (1)
401public static IEnumerable<DiagnosticData> ConvertToLocalDiagnostics(IEnumerable<Diagnostic> diagnostics, TextDocument targetTextDocument, TextSpan? span = null)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer.cs (10)
131ImmutableArray<TextSpan> oldMemberSpans, 138var span = spanBased ? changedMember.FullSpan : (TextSpan?)null; 146ImmutableArray<TextSpan> oldMemberSpans, 158ImmutableArray<TextSpan> oldMemberSpans, 171ImmutableArray<TextSpan> oldMemberSpans, 201private async Task<(SyntaxNode changedMember, int changedMemberId, ImmutableArray<TextSpan> memberSpans, Document lastDocument)?> TryGetChangedMemberAsync( 243ImmutableArray<TextSpan> oldMemberSpans, 290ImmutableArray<TextSpan> oldMemberSpans, 299var oldSpan = oldMemberSpans[memberId]; 393var newSpan = new TextSpan(start, end - start);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer_MemberSpans.cs (4)
23private readonly record struct MemberSpans(DocumentId DocumentId, VersionStamp Version, ImmutableArray<TextSpan> Spans); 28private async Task<ImmutableArray<TextSpan>> GetOrCreateMemberSpansAsync(Document document, VersionStamp version, CancellationToken cancellationToken) 45static async Task<ImmutableArray<TextSpan>> CreateMemberSpansAsync(Document document, VersionStamp version, CancellationToken cancellationToken) 57private void SaveMemberSpans(DocumentId documentId, VersionStamp version, ImmutableArray<TextSpan> memberSpans)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs (5)
27TextSpan? range, 63private readonly TextSpan? _range; 78TextSpan? range, 162TextSpan? range, 351TextSpan? span,
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)
40var span = ProtocolConversions.RangeToTextSpan(request.Range, text);
Handler\CodeActions\CodeActionHelpers.cs (1)
390var textSpan = ProtocolConversions.RangeToTextSpan(selection, text);
Handler\Completion\CompletionHandler.cs (1)
158var defaultSpan = new TextSpan(completionList.Span.Start, length: position - completionList.Span.Start);
Handler\Completion\CompletionResultFactory.cs (7)
73var defaultSpan = list.Span; 315TextSpan defaultSpan, 364TextSpan defaultSpan, 476TextSpan completionChangeSpan, 480TextSpan defaultSpan) 502TextSpan defaultSpan, 676var completionChangeSpan = completionChange.TextChange.Span;
Handler\Formatting\AbstractFormatDocumentHandlerBase.cs (1)
37var 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)
167TextSpan snippetShortcut, 185var spanToFormat = TextSpan.FromBounds(textChange.Span.Start, snippetEndPosition); 198var spanContainingFormattedSnippet = TextSpan.FromBounds(snippetShortcut.Start, snippetEndPosition); 205foreach (var span in spans) 208var fieldInFormattedText = GetAdjustedSpan(formattingChanges, span); 209var fieldInSnippetContext = GetTextSpanInContextOfSnippet(fieldInFormattedText.Start, spanContainingFormattedSnippet.Start, fieldInFormattedText.Length); 217var caretInFormattedText = GetAdjustedSpan(formattingChanges, caretSpan.Value); 218var caretInSnippetContext = GetTextSpanInContextOfSnippet(caretInFormattedText.Start, spanContainingFormattedSnippet.Start, caretInFormattedText.Length); 227static TextSpan GetAdjustedSpan(ImmutableArray<TextChange> textChanges, TextSpan originalSpan) 234static TextSpan GetTextSpanInContextOfSnippet(int positionInFullText, int snippetPositionInFullText, int length) 236var offsetInSnippet = new TextSpan(positionInFullText - snippetPositionInFullText, length); 245private static async Task<(string ReplacedSnippetText, ImmutableDictionary<SnippetFieldPart, ImmutableArray<TextSpan>> Fields, TextSpan? CaretSpan)> GetReplacedSnippetTextAsync( 248TextSpan snippetSpan, 260var fieldOffsets = new Dictionary<SnippetFieldPart, ImmutableArray<TextSpan>>(); 262TextSpan? caretSpan = null; 285var 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)
65private readonly HashSet<(string? filePath, TextSpan span)> _referenceLocations = [];
Handler\SemanticTokens\SemanticTokensHelpers.cs (5)
96ImmutableArray<TextSpan> textSpans; 103var textSpansBuilder = new FixedSizeArrayBuilder<TextSpan>(spans.Length); 128ImmutableArray<TextSpan> textSpans, 188TextSpan textSpan; 199textSpan = 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)
139location: 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)
124var 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)
220{|Comment:// comment|}", out _, out IDictionary<string, ImmutableArray<TextSpan>> annotatedSpans); 515{|Comment:// comment|}", out _, out IDictionary<string, ImmutableArray<TextSpan>> annotatedSpans); 562private static int[] GetRanges(IDictionary<string, ImmutableArray<TextSpan>> annotatedSpans)
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)
33TextSpan span, 57private static async Task<(DocumentId, TextSpan)> GetRenamedTokenAsync(
Services\DiagnosticAnalyzer\DiagnosticComputer.cs (3)
84private readonly TextSpan? _span; 94TextSpan? span, 113TextSpan? span,
Services\FullyQualify\RemoteFullyQualifyService.cs (1)
28public ValueTask<FullyQualifyFixData?> GetFixDataAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan span, CancellationToken cancellationToken)
Services\InheritanceMargin\RemoteInheritanceMarginService.cs (1)
31TextSpan spanToSearch,
Services\MissingImportDiscovery\RemoteMissingImportDiscoveryService.cs (2)
36TextSpan span, 64TextSpan span,
Services\SemanticClassification\RemoteSemanticClassificationService.Caching.cs (2)
84DocumentKey documentKey, ImmutableArray<TextSpan> textSpans, ClassificationType type, Checksum checksum, CancellationToken cancellationToken) 143var fullSpan = new TextSpan(0, text.Length);
Services\SemanticClassification\RemoteSemanticClassificationService.cs (1)
26ImmutableArray<TextSpan> spans,
Services\SymbolFinder\RemoteSymbolFinderService.cs (1)
190public 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.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)
422var 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)
830Dim operatorNameLocation As TextSpan 1146Dim operatorNameLocation As TextSpan 1838Private Shared Function GetGroupByOperatorNameSpan(groupBy As GroupByClauseSyntax) As TextSpan 2269Private Shared Function GetQueryOperatorNameSpan(ByRef left As SyntaxToken, ByRef right As SyntaxToken) As TextSpan 2270Dim operatorNameSpan As TextSpan = left.Span 2273operatorNameSpan = TextSpan.FromBounds(operatorNameSpan.Start, right.Span.End) 2305operatorNameLocation As TextSpan, 2582Dim operatorNameLocation As TextSpan 4592operatorNameLocation As TextSpan, 4610operatorNameLocation As TextSpan, 4631operatorNameLocation As TextSpan,
Binding\MemberSemanticModel.vb (4)
413Public NotOverridable Overrides Function GetSyntaxDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 428Public NotOverridable Overrides Function GetDeclarationDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 443Public NotOverridable Overrides Function GetMethodBodyDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 460Public 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)
122Private Shared Function IsDefinedOrImplementedInSourceTree(symbol As Symbol, tree As SyntaxTree, span As TextSpan?) As Boolean 160filterSpanWithinTree 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)
1706Dim unusedBuilder As ArrayBuilder(Of TextSpan) = Nothing 1731unusedBuilder = ArrayBuilder(Of TextSpan).GetInstance() 1760Private Sub AddImportsDependencies(diagnostics As BindingDiagnosticBag, infoTree As SyntaxTree, clauseSpan As TextSpan) 1832Public ReadOnly StatementSpan As TextSpan 1833Public ReadOnly ClauseSpans As ImmutableArray(Of TextSpan) 1843Dim builder = ArrayBuilder(Of TextSpan).GetInstance() 2179Dim location = tree.GetLocation(TextSpan.FromBounds(0, 0)) 2212Private Sub AddClsComplianceDiagnostics(diagnostics As BindingDiagnosticBag, cancellationToken As CancellationToken, Optional filterTree As SyntaxTree = Nothing, Optional filterSpanWithinTree As TextSpan? = Nothing) 2233Private Shared Iterator Function FilterDiagnosticsByLocation(diagnostics As IEnumerable(Of Diagnostic), tree As SyntaxTree, filterSpanWithinTree As TextSpan?) As IEnumerable(Of Diagnostic) 2243filterSpanWithinTree As TextSpan?, 2300Private 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)
2582Public Sub New(syntax As SyntaxNode, statementOpt As BoundStatement, span As TextSpan, Optional hasErrors As Boolean = False) 2596Private ReadOnly _Span As TextSpan 2597Public ReadOnly Property Span As TextSpan 2608Public 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)
16span As TextSpan,
Symbols\NamedTypeSymbolExtensions.vb (2)
24Friend Function FindMember(container As NamedTypeSymbol, symbolName As String, kind As SymbolKind, nameSpan As TextSpan, tree As SyntaxTree) As Symbol 55Friend Function FindFieldOrProperty(container As NamedTypeSymbol, symbolName As String, nameSpan As TextSpan, tree As SyntaxTree) As Symbol
Symbols\NamespaceSymbol.vb (1)
391Friend Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Symbols\Source\SourceComplexParameterSymbol.vb (1)
200Friend NotOverridable Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Symbols\Source\SourceEventSymbol.vb (1)
456Friend NotOverridable Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Symbols\Source\SourceFieldSymbol.vb (2)
873Private Shared Function GetFieldLocationFromSyntax(node As SyntaxToken) As TextSpan 884Dim 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)
51Friend NotOverridable Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Symbols\Source\SourceMethodSymbol.vb (3)
803Friend NotOverridable Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean 860Private Shared Function GetMethodLocationFromSyntax(node As VisualBasicSyntaxNode) As TextSpan 1203Dim 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)
463Friend Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Symbols\Symbol.vb (2)
897Friend Overridable Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean Implements ISymbolInternal.IsDefinedInSourceTree 917Friend 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)
40Private ReadOnly _searchSpan As TextSpan 52Private Shared Function ComputeTotalSpan(nodes As SyntaxNode()) As TextSpan 244Dim fullSpan = TextSpan.FromBounds(token.FullSpan.Start, node.FullSpan.End) 245Dim span = TextSpan.FromBounds(token.Span.Start, node.Span.End) 268Dim fullSpan = TextSpan.FromBounds(node.FullSpan.Start, token.FullSpan.End) 269Dim span = TextSpan.FromBounds(node.Span.Start, token.Span.End) 287Private Function GetRemovedSpan(span As TextSpan, fullSpan As TextSpan) As TextSpan 290removedSpan = TextSpan.FromBounds(span.Start, removedSpan.End) 293removedSpan = TextSpan.FromBounds(removedSpan.Start, span.End) 298Private 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)
146''' Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>.
Syntax\VisualBasicSyntaxTree.vb (5)
434Public Overrides Function GetLineSpan(span As TextSpan, Optional cancellationToken As CancellationToken = Nothing) As FileLinePositionSpan 448Public Overrides Function GetMappedLineSpan(span As TextSpan, Optional cancellationToken As CancellationToken = Nothing) As FileLinePositionSpan 457Friend Overrides Function GetMappedLineSpanAndVisibility(span As TextSpan, ByRef isHiddenPosition As Boolean) As FileLinePositionSpan 491Public Overrides Function GetLocation(span As TextSpan) As Location 519Public Overrides Function GetChangedSpans(oldTree As SyntaxTree) As IList(Of TextSpan)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (42)
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)
55nodes As IEnumerable(Of SyntaxNode), tree As SyntaxTree, cancellationToken As CancellationToken) As IEnumerable(Of TextSpan)
src\Analyzers\VisualBasic\Analyzers\UseInferredMemberName\VisualBasicUseInferredMemberNameDiagnosticAnalyzer.vb (2)
54Dim fadeSpan = TextSpan.FromBounds(nameColonEquals.Name.SpanStart, nameColonEquals.ColonEqualsToken.Span.End) 75Dim fadeSpan = TextSpan.FromBounds(fieldInitializer.Name.SpanStart, fieldInitializer.EqualsToken.Span.End)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (6)
380textSpan As TextSpan, 388textSpan As TextSpan, 404textSpan As TextSpan, 856Public Function CheckTopLevel(node As SyntaxNode, span As TextSpan) As Boolean 880Public Function ContainsInMethodBlockBody(block As MethodBlockBaseSyntax, textSpan As TextSpan) As Boolean 885Dim blockSpan = TextSpan.FromBounds(block.BlockStatement.Span.End, block.EndBlockStatement.SpanStart)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Indentation\VisualBasicSmartTokenFormatter.vb (1)
40Dim spans = SpecializedCollections.SingletonEnumerable(TextSpan.FromBounds(previousToken.SpanStart, token.Span.End))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (11)
820Public Function GetMemberBodySpanForSpeculativeBinding(node As SyntaxNode) As TextSpan Implements ISyntaxFacts.GetMemberBodySpanForSpeculativeBinding 843Return TextSpan.FromBounds(spanStart, method.EndBlockStatement.SpanStart) 849Public Function ContainsInMemberBody(node As SyntaxNode, span As TextSpan) As Boolean Implements ISyntaxFacts.ContainsInMemberBody 883Private Shared Function ContainsExclusively(outerSpan As TextSpan, innerSpan As TextSpan) As Boolean 891Private Shared Function GetSyntaxListSpan(Of T As SyntaxNode)(list As SyntaxList(Of T)) As TextSpan 893Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End) 896Private Shared Function GetSeparatedSyntaxListSpan(Of T As SyntaxNode)(list As SeparatedSyntaxList(Of T)) As TextSpan 898Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End) 1172Public Function GetInactiveRegionSpanAroundPosition(tree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As TextSpan Implements ISyntaxFacts.GetInactiveRegionSpanAroundPosition 1490Public Function ContainsInterleavedDirective(span As TextSpan, token As SyntaxToken, cancellationToken As CancellationToken) As Boolean Implements ISyntaxFacts.ContainsInterleavedDirective
src\Workspaces\VisualBasic\Portable\Formatting\Engine\FormattingResult.vb (1)
21Friend Sub New(treeInfo As TreeData, tokenStream As TokenStream, spanToFormat As TextSpan)
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
98Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.vb (1)
58Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\VisualBasic\Portable\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
89Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
src\Workspaces\VisualBasic\Portable\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\VisualBasic\Portable\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\VisualBasic\Portable\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))
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)
73indices.Add(Not destination.OverlapsHiddenPosition(TextSpan.FromBounds(0, destination.Members.First.SpanStart), cancellationToken)) 86TextSpan.FromBounds(destination.Members.Last.Span.End, destination.EndOfFileToken.SpanStart), cancellationToken))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\CompilationUnitSyntaxExtensions.vb (2)
33Return Not contextNode.SyntaxTree.OverlapsHiddenPosition(TextSpan.FromBounds(start, [end]), cancellationToken) 40Return 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)
72TextSpan.FromBounds(startToken.FullSpan.Start, node.FullSpan.End), indentationDelta:=1, [option]:=IndentBlockOption.RelativePosition)) 110baseToken, startToken, endToken, TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End), indentationDelta, IndentBlockOption.RelativePosition)) 148Dim span As TextSpan 156span = TextSpan.FromBounds(baseToken.Span.End, firstToken.SpanStart) 159span = 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)
39Public 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)
11058Private 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)
154Private Shared Function GetSpanToCleanup(statement As StatementSyntax) As TextSpan 161Return TextSpan.FromBounds(If(previousToken.Kind <> SyntaxKind.None, previousToken, firstToken).SpanStart,
EndConstructGeneration\VisualBasicEndConstructGenerationService.vb (1)
272Dim 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 (219)
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)
73Private 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)
23Protected 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)
75Protected Overrides Function TryGetApplicableContainerFromSpanAsync(document As Document, span As TextSpan, cancellationToken As CancellationToken) As Task(Of SyntaxNode)
Completion\CompletionProviders\CompletionUtilities.vb (1)
24Public Function GetCompletionItemSpan(text As SourceText, position As Integer) 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)
124Public Overrides Function GetDefaultCompletionListSpan(text As SourceText, caretPosition As Integer) As TextSpan
Debugging\DataTipInfoGetter.vb (1)
54span = 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)
76ByRef 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)
81span As TextSpan, partnerDeclarationBody As MemberBody, ByRef partnerStatement As SyntaxNode, ByRef statementPart As Integer) As SyntaxNode 120Public Overrides ReadOnly Property Envelope As TextSpan
EditAndContinue\DeclarationBody\FieldWithMultipleAsNewClauseDeclarationBody.vb (4)
35Public Overrides ReadOnly Property Envelope As TextSpan 37Return TextSpan.FromBounds(_modifedIdentifier.Span.Start, OtherActiveStatementContainer.Span.End) 41Public Overrides Function IsExcludedActiveStatementSpanWithinEnvelope(span As TextSpan) As Boolean 43Return TextSpan.FromBounds(_modifedIdentifier.Span.End, OtherActiveStatementContainer.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)
35Public Overrides ReadOnly Property Envelope As TextSpan 37Return TextSpan.FromBounds(PropertyStatement.Identifier.Span.Start, PropertyStatement.Initializer.Span.End)
EditAndContinue\DeclarationBody\PropertyWithNewClauseDeclarationBody.vb (2)
35Public Overrides ReadOnly Property Envelope As TextSpan 37Return TextSpan.FromBounds(PropertyStatement.Identifier.Span.Start, PropertyStatement.AsClause.Span.End)
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (31)
43Friend Overrides Function TryFindMemberDeclaration(rootOpt As SyntaxNode, node As SyntaxNode, activeSpan As TextSpan, <Out> ByRef declarations As OneOrMany(Of SyntaxNode)) As Boolean 130span As TextSpan, 331Protected Overrides Function TryGetEnclosingBreakpointSpan(token As SyntaxToken, <Out> ByRef span As TextSpan) As Boolean 335Protected Overrides Function TryGetActiveSpan(node As SyntaxNode, statementPart As Integer, minLength As Integer, <Out> ByRef span As TextSpan) As Boolean 1069Protected Overrides Function TryGetDiagnosticSpan(node As SyntaxNode, editKind As EditKind) As TextSpan? 1073Protected Overloads Shared Function GetDiagnosticSpan(node As SyntaxNode, editKind As EditKind) As TextSpan 1077Private Shared Function TryGetDiagnosticSpanImpl(node As SyntaxNode, editKind As EditKind) As TextSpan? 1081Protected Overrides Function GetBodyDiagnosticSpan(node As SyntaxNode, editKind As EditKind) As TextSpan 1086Friend Shared Function TryGetDiagnosticSpanImpl(kind As SyntaxKind, node As SyntaxNode, editKind As EditKind) As TextSpan? 1257Return TextSpan.FromBounds(newWith.NewKeyword.Span.Start, 1289Return TextSpan.FromBounds(groupJoin.GroupKeyword.SpanStart, groupJoin.JoinKeyword.Span.End) 1304Return TextSpan.FromBounds(partition.SkipOrTakeKeyword.SpanStart, partition.WhileKeyword.Span.End) 1318Private Overloads Shared Function GetDiagnosticSpan(ifKeyword As SyntaxToken, condition As SyntaxNode, thenKeywordOpt As SyntaxToken) As TextSpan 1319Return TextSpan.FromBounds(ifKeyword.Span.Start, 1323Private Overloads Shared Function GetDiagnosticSpan(node As NamespaceStatementSyntax) As TextSpan 1324Return TextSpan.FromBounds(node.NamespaceKeyword.SpanStart, node.Name.Span.End) 1327Private Overloads Shared Function GetDiagnosticSpan(node As TypeStatementSyntax) As TextSpan 1333Private Overloads Shared Function GetDiagnosticSpan(modifiers As SyntaxTokenList, start As SyntaxNodeOrToken, endNode As SyntaxNodeOrToken) As TextSpan 1334Return TextSpan.FromBounds(If(modifiers.Count <> 0, modifiers.First.SpanStart, start.SpanStart), 1338Private Overloads Shared Function GetDiagnosticSpan(header As MethodBaseSyntax) As TextSpan 1399Return TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End) 1402Private Overloads Shared Function GetDiagnosticSpan(lambda As LambdaHeaderSyntax) As TextSpan 1412Return TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End) 1415Friend Overrides Function GetLambdaParameterDiagnosticSpan(lambda As SyntaxNode, ordinal As Integer) As TextSpan 1709Private ReadOnly _span As TextSpan? 1717Optional span As TextSpan? = Nothing) 1736Private Function GetSpan() As TextSpan 2095newStatementSpan As TextSpan) 2127Protected Overrides Function GetExceptionHandlingRegion(node As SyntaxNode, <Out> ByRef coversAllChildren As Boolean) As TextSpan 2135Return TextSpan.FromBounds(tryBlock.FinallyBlock.SpanStart, tryBlock.EndTryStatement.Span.End) 2138Return TextSpan.FromBounds(tryBlock.CatchBlocks.First().SpanStart, tryBlock.EndTryStatement.Span.End)
EncapsulateField\VisualBasicEncapsulateFieldService.vb (1)
70Protected 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)
27textSpan As TextSpan,
ExtractMethod\VisualBasicSelectionResult.vb (5)
21originalSpan As TextSpan, 22finalSpan As TextSpan, 50originalSpan As TextSpan, 51finalSpan As TextSpan, 325TextSpan.FromBounds(first.SpanStart, last.Span.End)) _
ExtractMethod\VisualBasicSelectionValidator.vb (9)
19textSpan As TextSpan) 76Private Shared Function GetControlFlowSpan(selectionInfo As SelectionInfo) As TextSpan 77Return TextSpan.FromBounds(selectionInfo.FirstTokenInFinalSpan.SpanStart, selectionInfo.LastTokenInFinalSpan.Span.End) 248.FinalSpan = GetAdjustedSpan(root, TextSpan.FromBounds(start, [end])) 380root, TextSpan.FromBounds(selectionInfo.FirstTokenInOriginalSpan.SpanStart, selectionInfo.LastTokenInOriginalSpan.Span.End), 591textSpan As TextSpan, 634Private Shared Function GetAdjustedSpan(root As SyntaxNode, textSpan As TextSpan) As TextSpan 656Return TextSpan.FromBounds(textSpan.Start, previousLine.End)
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)
29Protected Overrides Function IsValid(expressionStatement As ExpressionStatementSyntax, span As TextSpan) As Boolean
IntroduceVariable\VisualBasicIntroduceVariableService.vb (1)
164Return 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)
104Private Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState
SignatureHelp\AttributeSignatureHelpProvider.vb (1)
95Private Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\CollectionInitializerSignatureHelpProvider.vb (1)
70Private Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\FunctionAggregationSignatureHelpProvider.vb (1)
33Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState
SignatureHelp\GenericNameSignatureHelpProvider.vb (1)
33Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\InvocationExpressionSignatureHelpProvider.vb (1)
34Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.vb (1)
33Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\RaiseEventStatementSignatureHelpProvider.vb (1)
32Private 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))
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)
55nodes As IEnumerable(Of SyntaxNode), tree As SyntaxTree, cancellationToken As CancellationToken) As IEnumerable(Of TextSpan)
src\Analyzers\VisualBasic\Analyzers\UseInferredMemberName\VisualBasicUseInferredMemberNameDiagnosticAnalyzer.vb (2)
54Dim fadeSpan = TextSpan.FromBounds(nameColonEquals.Name.SpanStart, nameColonEquals.ColonEqualsToken.Span.End) 75Dim 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)
16span As TextSpan,
Structure\Providers\CollectionInitializerStructureProvider.vb (2)
44textSpan:=TextSpan.FromBounds(node.SpanStart, endPos), 45hintSpan:=TextSpan.FromBounds(node.SpanStart, endPos),
Structure\Providers\CompilationUnitStructureProvider.vb (1)
27Dim span = TextSpan.FromBounds(startPos, endPos)
Structure\Providers\DisabledTextTriviaStructureProvider.vb (1)
25Dim span = TextSpan.FromBounds(startPos, endPos)
Structure\Providers\DocumentationCommentStructureProvider.vb (1)
34Dim fullSpan = TextSpan.FromBounds(startPos, endPos)
Structure\Providers\ObjectCreationInitializerStructureProvider.vb (1)
34textSpan:=TextSpan.FromBounds(previousToken.Span.End, node.Span.End),
Structure\Providers\RegionDirectiveStructureProvider.vb (1)
43Dim span = TextSpan.FromBounds(regionDirective.SpanStart, matchingDirective.Span.End)
Structure\VisualBasicStructureHelpers.vb (7)
29Dim span = TextSpan.FromBounds(startComment.SpanStart, endComment.Span.End) 115textSpan:=TextSpan.FromBounds(startPosition, endPosition), 116hintSpan:=TextSpan.FromBounds(startPosition, hintTextEndToken.Span.End), 168span As TextSpan, 169hintSpan As TextSpan, 209Private Function GetHintSpan(blockNode As SyntaxNode) As TextSpan 219Return 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)
39Dim expectedSpan As TextSpan? = Nothing 45Dim breakpointSpan As TextSpan 69Dim expectedSpans As ImmutableArray(Of TextSpan) = Nothing 84Public Shared Iterator Function GetBreakpointSequence(root As SyntaxNode, position As Integer) As IEnumerable(Of TextSpan) 88Dim span As TextSpan = Nothing
EditAndContinue\Helpers\EditingTestBase.vb (2)
159syntaxMap As IEnumerable(Of (TextSpan, TextSpan)),
EditAndContinue\VisualBasicEditAndContinueAnalyzerTests.vb (4)
69Private Shared Iterator Function GetExpectedPositionsAndSpans(source As String) As IEnumerable(Of KeyValuePair(Of Integer, TextSpan)) 84Dim span As TextSpan 90span = TextSpan.FromBounds(source.IndexOf(s_startSpanMark, start, length, StringComparison.Ordinal) + s_startSpanMark.Length, 103Dim span As TextSpan?
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (23)
Diagnostics\DiagnosticAnalyzerTests.vb (1)
1674expectedDiagnosticSpan As TextSpan,
FlowAnalysis\FlowTestBase.vb (2)
90Dim spans As IEnumerable(Of IEnumerable(Of TextSpan)) = Nothing 170Private 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)))) 662Shared Sub VerifyDiagnosticsWithSource(source As String, diag As Diagnostic, location As TextSpan, ParamArray expected As DiagnosticDescription()) 703Return x.Diagnostic.WithLocation(Location.Create(syntaxTree, TextSpan.FromBounds(start, endpoint)))
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (8)
SymbolsTests\AnonymousTypes\AnonymousTypesSemanticsTests.vb (3)
1926Dim span As TextSpan = node.Span 1968Dim spans As New List(Of TextSpan) 2001Private Shared Sub ExtractTextIntervals(text As XElement, nodes As List(Of TextSpan))
SymbolsTests\MyBaseMyClassSemanticsTests.vb (3)
86Dim span As TextSpan = node.Span 117Dim spans As New List(Of TextSpan) 150Private Shared Sub ExtractTextIntervals(text As XElement, nodes As List(Of TextSpan))
SymbolsTests\WithStatementSymbolsTests.vb (2)
270Dim spans As New List(Of TextSpan) 303Private Shared Sub ExtractTextIntervals(text As XElement, nodes As List(Of TextSpan))
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (12)
IncrementalParser\IncrementalParser.vb (3)
1523New TextChange(TextSpan.FromBounds(8, 8), "System" + vbCrLf + "Imports "), 1524New TextChange(TextSpan.FromBounds(29, 45), "")) 1557Dim 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)
219Private Sub VerifyListSpans(Of T As VisualBasicSyntaxNode)(list As SyntaxList(Of T), expectedFullSpan As TextSpan) 241Private Sub VerifyListSpans(list As ChildSyntaxList, expectedFullSpan As TextSpan) 263Private Sub VerifyListSpans(list As SyntaxNodeOrTokenList, expectedFullSpan As TextSpan) 287Private Sub VerifyListSpans(list As SyntaxTokenList, expectedFullSpan As TextSpan) 306Private Sub VerifyListSpans(list As SyntaxTriviaList, expectedFullSpan As TextSpan) 411VerifyListSpans(statements, TextSpan.FromBounds(statements(0).FullSpan.Start, statements(statements.Count - 1).FullSpan.End)) 942Private Sub CheckErrorList(node As VisualBasicSyntaxNode, expectedErrorCodes As Integer(), expectedSpans As TextSpan()) 964Private Sub CheckErrorList(node As SyntaxToken, expectedErrorCodes As Integer(), expectedSpans As TextSpan())
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (7)
BasicTestSource.vb (1)
32Optional ByRef spans As IEnumerable(Of IEnumerable(Of TextSpan)) = Nothing) As SyntaxTree()
CompilationTestUtils.vb (4)
301Optional ByRef spans As IEnumerable(Of IEnumerable(Of TextSpan)) = Nothing) As IEnumerable(Of SyntaxTree) 376Optional ByRef spans As IEnumerable(Of IEnumerable(Of TextSpan)) = Nothing, 647Public Function CreateParseTreeAndSpans(programElement As XElement, Optional parseOptions As VisualBasicParseOptions = Nothing) As (tree As SyntaxTree, spans As IList(Of TextSpan)) 650Dim 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)
216Public changeSpan As TextSpan
Microsoft.CodeAnalysis.VisualBasic.Workspaces (134)
CaseCorrection\VisualBasicCaseCorrectionService.vb (2)
29spans As ImmutableArray(Of TextSpan), 39span As TextSpan,
Classification\ClassificationHelpers.vb (1)
322Friend Sub AddLexicalClassifications(text As SourceText, textSpan As TextSpan, result As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken)
Classification\SyntaxClassification\IdentifierNameSyntaxClassifier.vb (1)
21Public 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\ImportAliasClauseSyntaxClassifier.vb (1)
20Public 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)
15Private ReadOnly _textSpan As TextSpan 20Private Sub New(textSpan As TextSpan, list As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken) 29tokens As IEnumerable(Of SyntaxToken), textSpan As TextSpan, list As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken) 38node As SyntaxNode, textSpan As TextSpan, list As SegmentedList(Of ClassifiedSpan), cancellationToken As CancellationToken) 43Private 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)
29Protected Overrides Async Function GetRewriterAsync(document As Document, root As SyntaxNode, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) As Task(Of Rewriter) 38Private Sub New(semanticModel As SemanticModel, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) 44Public 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)
38Protected Overrides Function GetRewriterAsync(document As Document, root As SyntaxNode, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) As Task(Of Rewriter) 48spans As ImmutableArray(Of TextSpan), 55Public 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\Engine\FormattingResult.vb (1)
21Friend Sub New(treeInfo As TreeData, tokenStream As TokenStream, spanToFormat As TextSpan)
Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
98Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.vb (1)
58Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
89Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
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
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)
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))
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()
OrganizeImports\VisualBasicOrganizeImportsService.Rewriter.vb (4)
74Private Shared Function GetTextSpan(Of TSyntax As SyntaxNode)(list As SyntaxList(Of TSyntax)) As TextSpan 75Return TextSpan.FromBounds(list.First().FullSpan.Start, list.Last().FullSpan.[End]) 78Private Shared Function GetTextSpan(Of TSyntax As SyntaxNode)(list As SeparatedSyntaxList(Of TSyntax)) As TextSpan 79Return TextSpan.FromBounds(list.First().FullSpan.Start, list.Last().FullSpan.[End])
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)
40Dim issueSpan As TextSpan
Simplification\Reducers\VisualBasicVariableDeclaratorReducer.vb (2)
38Dim issueSpan As TextSpan 53<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)
30<Out> ByRef issueSpan As TextSpan, 120Dim issueSpanWithoutAttributeSuffix As TextSpan = Nothing 324Private Shared Function TryOmitModuleName(name As QualifiedNameSyntax, semanticModel As SemanticModel, <Out()> ByRef replacementNode As ExpressionSyntax, <Out()> ByRef issueSpan As TextSpan, cancellationToken As CancellationToken) As Boolean 357<Out> ByRef issueSpan As TextSpan,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Extensions\SyntaxNodeExtensions.vb (6)
380textSpan As TextSpan, 388textSpan As TextSpan, 404textSpan As TextSpan, 856Public Function CheckTopLevel(node As SyntaxNode, span As TextSpan) As Boolean 880Public Function ContainsInMethodBlockBody(block As MethodBlockBaseSyntax, textSpan As TextSpan) As Boolean 885Dim blockSpan = TextSpan.FromBounds(block.BlockStatement.Span.End, block.EndBlockStatement.SpanStart)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Indentation\VisualBasicSmartTokenFormatter.vb (1)
40Dim spans = SpecializedCollections.SingletonEnumerable(TextSpan.FromBounds(previousToken.SpanStart, token.Span.End))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\Services\SyntaxFacts\VisualBasicSyntaxFacts.vb (11)
820Public Function GetMemberBodySpanForSpeculativeBinding(node As SyntaxNode) As TextSpan Implements ISyntaxFacts.GetMemberBodySpanForSpeculativeBinding 843Return TextSpan.FromBounds(spanStart, method.EndBlockStatement.SpanStart) 849Public Function ContainsInMemberBody(node As SyntaxNode, span As TextSpan) As Boolean Implements ISyntaxFacts.ContainsInMemberBody 883Private Shared Function ContainsExclusively(outerSpan As TextSpan, innerSpan As TextSpan) As Boolean 891Private Shared Function GetSyntaxListSpan(Of T As SyntaxNode)(list As SyntaxList(Of T)) As TextSpan 893Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End) 896Private Shared Function GetSeparatedSyntaxListSpan(Of T As SyntaxNode)(list As SeparatedSyntaxList(Of T)) As TextSpan 898Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End) 1172Public Function GetInactiveRegionSpanAroundPosition(tree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As TextSpan Implements ISyntaxFacts.GetInactiveRegionSpanAroundPosition 1490Public 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)
73indices.Add(Not destination.OverlapsHiddenPosition(TextSpan.FromBounds(0, destination.Members.First.SpanStart), cancellationToken)) 86TextSpan.FromBounds(destination.Members.Last.Span.End, destination.EndOfFileToken.SpanStart), cancellationToken))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\CompilationUnitSyntaxExtensions.vb (2)
33Return Not contextNode.SyntaxTree.OverlapsHiddenPosition(TextSpan.FromBounds(start, [end]), cancellationToken) 40Return 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)
72TextSpan.FromBounds(startToken.FullSpan.Start, node.FullSpan.End), indentationDelta:=1, [option]:=IndentBlockOption.RelativePosition)) 110baseToken, startToken, endToken, TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End), indentationDelta, IndentBlockOption.RelativePosition)) 148Dim span As TextSpan 156span = TextSpan.FromBounds(baseToken.Span.End, firstToken.SpanStart) 159span = 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)
39Public 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)
64Dim spans = New List(Of TextSpan)() 73spans = New List(Of TextSpan)() 86Dim spans As ImmutableArray(Of TextSpan) = Nothing 104spans As IEnumerable(Of TextSpan),
VisualBasicSyntaxFactsServiceTests.vb (1)
507Dim span As TextSpan
Microsoft.CodeAnalysis.Workspaces (789)
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)
31public abstract void AddLexicalClassifications(SourceText text, TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken); 35Document document, ImmutableArray<TextSpan> textSpans, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 41Document document, ImmutableArray<TextSpan> textSpans, ClassificationOptions options, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 48ImmutableArray<TextSpan> textSpans, 109ImmutableArray<TextSpan> textSpans, 139ImmutableArray<TextSpan> textSpans, 158foreach (var span in reassignedVariableSpans) 166foreach (var span in obsoleteSymbolSpans) 202public async Task AddSyntacticClassificationsAsync(Document document, ImmutableArray<TextSpan> textSpans, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken) 209SolutionServices 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 (2)
33ImmutableArray<TextSpan> textSpans, 52ImmutableArray<TextSpan> textSpans,
Classification\SyntaxClassification\AbstractNameSyntaxClassifier.cs (1)
31TextSpan span,
Classification\SyntaxClassification\AbstractSyntaxClassificationService.cs (4)
19public abstract void AddLexicalClassifications(SourceText text, TextSpan textSpan, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken); 20public abstract void AddSyntacticClassifications(SyntaxNode root, ImmutableArray<TextSpan> textSpans, SegmentedList<ClassifiedSpan> result, CancellationToken cancellationToken); 28ImmutableArray<TextSpan> textSpans, 50ImmutableArray<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)
151TextSpan? diagnosticSpan, 244TextSpan? filterSpan) 262internal 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)
25public TextSpan? DiagnosticSpan { get; } 29TextSpan? diagnosticSpan,
CodeFixes\FixAllOccurrences\TextChangeMerger.cs (1)
23public 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)
96public Task<ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>> GetFixAllSpansAsync(CancellationToken cancellationToken)
CodeRefactorings\FixAllOccurences\FixAllProvider.cs (4)
58public static FixAllProvider Create(Func<FixAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> fixAllAsync) 78Func<FixAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> fixAllAsync, 94Func<FixAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> fixAllAsync, 97protected 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 => KeyValuePairUtil.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)
81public async Task<(AnalysisResult? projectAnalysisResult, AnalysisResult? hostAnalysisResult)> GetAnalysisResultAsync(SyntaxTree tree, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> projectAnalyzers, ImmutableArray<DiagnosticAnalyzer> hostAnalyzers, CancellationToken cancellationToken) 93public async Task<(AnalysisResult? projectAnalysisResult, AnalysisResult? hostAnalysisResult)> GetAnalysisResultAsync(AdditionalText file, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> projectAnalyzers, ImmutableArray<DiagnosticAnalyzer> hostAnalyzers, CancellationToken cancellationToken) 105public async Task<(AnalysisResult? projectAnalysisResult, AnalysisResult? hostAnalysisResult)> GetAnalysisResultAsync(SemanticModel model, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> projectAnalyzers, ImmutableArray<DiagnosticAnalyzer> hostAnalyzers, CancellationToken cancellationToken)
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 (5)
56var span = dataLocation.UnmappedFileSpan.GetClampedTextSpan(text); 244TextSpan? span, 262TextSpan? span, 312TextSpan? filterSpan = null) 433TextSpan? span,
Diagnostics\IWorkspaceVenusSpanMappingService.cs (1)
20void 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)
19private static async ValueTask<IEnumerable<TextSpan>> GetSpansAsync(Document document, CancellationToken cancellationToken) 25private static async ValueTask<IEnumerable<TextSpan>> GetSpansAsync(Document document, SyntaxAnnotation annotation, CancellationToken cancellationToken) 40public static Task<Document> AddImportsAsync(Document document, TextSpan span, OptionSet? options = null, CancellationToken cancellationToken = default) 52public static Task<Document> AddImportsAsync(Document document, IEnumerable<TextSpan> spans, OptionSet? options = null, CancellationToken cancellationToken = default) 55private static async Task<Document> AddImportsFromSyntaxesAsync(Document document, IEnumerable<TextSpan> spans, OptionSet? _, CancellationToken cancellationToken) 83internal static Task<Document> AddImportsFromSyntaxesAsync(Document document, IEnumerable<TextSpan> spans, AddImportPlacementOptions options, CancellationToken cancellationToken) 98internal 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)
84ValueTask 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; 236ref Dictionary<InterceptsLocationData, TextSpan>? interceptsLocationInfo,
FindSymbols\SyntaxTree\SyntaxTreeIndex_Forwarders.cs (1)
70public bool TryGetInterceptsLocation(InterceptsLocationData data, out TextSpan span)
FindSymbols\SyntaxTree\SyntaxTreeIndex_Persistence.cs (1)
84Dictionary<InterceptsLocationData, TextSpan>? interceptsLocationInfo = null;
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (4)
46TextSpan span, 83public readonly TextSpan Span = span; 117TextSpan span, 203var span = new TextSpan(spanStart, spanLength);
Formatting\AbstractFormattingService.cs (1)
18public 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)
19protected abstract Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansIfWithinGlobalStatementAsync( 20Document document, TextSpan span, CancellationToken cancellationToken); 22public Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 23Document document, TextSpan triggerSpan, FixAllScope fixAllScope, CancellationToken cancellationToken) 31private async Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 32Document document, TextSpan span, bool fixAllInContainingMember, CancellationToken cancellationToken) 49var builder = PooledDictionary<Document, ArrayBuilder<TextSpan>>.GetInstance(); 74TextSpan span,
LanguageServices\FixAllSpanMappingService\IFixAllSpanMappingService.cs (2)
30Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 31Document document, TextSpan triggerSpan, FixAllScope fixAllScope, CancellationToken cancellationToken);
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (4)
79var oldText = oldDocumentText.GetSubText(TextSpan.FromBounds(startLineStartPosition, endLineEndPosition)); 80var adjustedChanges = changePartition.Select(c => new TextChange(TextSpan.FromBounds(c.Span.Start - startLineStartPosition, c.Span.End - startLineStartPosition), c.NewText)); 90commentChanges.Add(new TextChange(TextSpan.FromBounds(startLineStartPosition, startLineStartPosition), warningText)); 117? text.GetSubText(TextSpan.FromBounds(text.Lines[startLine].Start, text.Lines[endLine].End)).ToString()
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (4)
209private static (ImmutableArray<TextChange> mergeChanges, ImmutableArray<TextSpan> mergeConflictResolutionSpans) MergeChangesWithMergeFailComments( 217using var _2 = ArrayBuilder<TextSpan>.GetInstance(out var mergeConflictResolutionSpans); 243var conflictingCommentInsertionLocation = new TextSpan(mergedChange.Span.Start, 0); 284currentChange = 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 (9)
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) 49return ImmutableArray<TextSpan>.Empty; 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)
38in TemporaryArray<TextSpan> candidateHumps, out ImmutableArray<TextSpan> matchedSpans) 65private static PatternMatchKind GetKind(CamelCaseResult result, in TemporaryArray<TextSpan> candidateHumps) 69int patternIndex, int candidateHumpIndex, bool? contiguous, in TemporaryArray<TextSpan> candidateHumps) 75var matchedSpansInReverse = includeMatchedSpans ? ArrayBuilder<TextSpan>.GetInstance() : null; 95var candidateHump = candidateHumps[humpIndex]; 149int patternIndex, int humpIndex, bool contiguous, in TemporaryArray<TextSpan> candidateHumps) 153var candidateHump = candidateHumps[humpIndex]; 191var matchSpanToAdd = new TextSpan(candidateHump.Start, possibleHumpMatchLength); 211CamelCaseResult result, ref CamelCaseResult? bestResult, TextSpan? matchSpanToAdd, in TemporaryArray<TextSpan> candidateHumps) 240private static bool IsBetter(CamelCaseResult result, CamelCaseResult? currentBestResult, in TemporaryArray<TextSpan> candidateHumps)
PatternMatching\CamelCaseResult.cs (4)
21public readonly ArrayBuilder<TextSpan> MatchedSpansInReverse; 23public CamelCaseResult(bool fromStart, bool contiguous, int matchCount, ArrayBuilder<TextSpan> matchedSpansInReverse) 39public CamelCaseResult WithAddedMatchedSpan(TextSpan value) 46private 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)
166using var candidateHumps = TemporaryArray<TextSpan>.Empty; 256var hump = TextSpan.FromBounds(candidateHumps[i].Start, candidateLength); 306private TextSpan? GetMatchedSpan(int start, int length) 428private bool PartStartsWith(string candidate, TextSpan candidatePart, string pattern, TextSpan patternPart, CompareOptions compareOptions) 449private bool PartStartsWith(string candidate, TextSpan candidatePart, string pattern, CompareOptions compareOptions) 457in TemporaryArray<TextSpan> candidateHumps) 504in TemporaryArray<TextSpan> candidateHumps, 506out ImmutableArray<TextSpan> matchedSpans) 514in TemporaryArray<TextSpan> candidateHumps, 517out ImmutableArray<TextSpan> matchedSpans) 534using var matchSpans = TemporaryArray<TextSpan>.Empty; 559var candidateHump = candidateHumps[currentCandidateHump]; 568var patternChunkCharacterSpan = patternHumps[currentPatternHump];
PatternMatching\PatternMatcher.TextChunk.cs (2)
33public TemporaryArray<TextSpan> PatternHumps; 46PatternHumps = 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 (6)
77public readonly TextSpan ComplexifiedSpan; 81public readonly TextSpan OriginalIdentifierSpan; 886private static ImmutableSortedSet<TextSpan>? GetSubSpansToRenameInStringAndCommentTextSpans( 887TextSpan containingLocationForStringOrComment, 890var builder = ImmutableSortedSet.CreateBuilder<TextSpan>(); 905var 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 (23)
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; 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 (16)
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) 101: ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>.Empty; 103public ImmutableDictionary<TextSpan, TextSpan> GetModifiedSpanMap(DocumentId documentId) 105var result = ImmutableDictionary.CreateBuilder<TextSpan, TextSpan>(); 129internal TextSpan GetResolutionTextSpan(TextSpan originalSpan, DocumentId documentId)
Rename\IRemoteRenamerService.cs (8)
54TextSpan location, 59TextSpan containingLocationForStringOrComment, 63public readonly TextSpan Location = location; 78public readonly TextSpan ContainingLocationForStringOrComment = containingLocationForStringOrComment; 215ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> documentToModifiedSpansMap, 235public readonly ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> DocumentToModifiedSpansMap = documentToModifiedSpansMap;
Rename\LightweightRenameLocations.cs (1)
121public LightweightRenameLocations Filter(Func<DocumentId, TextSpan, bool> filter)
Rename\RenameLocation.cs (1)
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)
252ImmutableSortedSet<TextSpan>? subSpansToReplace = null) 268foreach (var subSpan in subSpansToReplace)
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (3)
403IEnumerable<Tuple<string, int, TextSpan>> renameStringsAndPositions, 411var containingSpan = renameStringAndPosition.Item3; 422var matchTextSpan = new TextSpan(start, renameText.Length);
Shared\Extensions\FileLinePositionSpanExtensions.cs (3)
14public static TextSpan GetClampedTextSpan(this FileLinePositionSpan span, SourceText text) 25/// Returns a new <see cref="TextSpan"/> based off of the positions in <paramref name="span"/>, but 28public static TextSpan GetClampedTextSpan(this LinePositionSpan span, SourceText text)
Shared\Extensions\SourceTextExtensions.cs (1)
51TextSpan textSpan,
Shared\Extensions\TokenSemanticInfo.cs (2)
20TextSpan span) 30public 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)
24var fullSpan = new TextSpan(0, text.Length); 31var change = TextChangeRange.Collapse(changes).Span; 44var 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)
104var thisSpan = introspector.GetSpan(value); 124var thisSpan = introspector.GetSpan(value); 137var 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 (42)
14internal sealed class NormalizedTextSpanCollection : ReadOnlyCollection<TextSpan> 21: base(new List<TextSpan>(0)) 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 = new List<TextSpan>(1) 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 (8)
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)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption.cs (1)
12internal record class EditorConfigOption(Section Section, TextSpan? Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigOption`1.cs (2)
12internal record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value) 16public static implicit operator EditorConfigOption<T>((Section section, TextSpan? span, T value) tuple)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (1)
122var 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 (3)
23public readonly TextSpan Span; 25public EmbeddedDiagnostic(string message, TextSpan span) 49hashCode = hashCode * -1521134295 + EqualityComparer<TextSpan>.Default.GetHashCode(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)
73public TextSpan GetSpan() 76public TextSpan? GetFullSpan() 91return 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)
30string tokenText, int index, int offset, out TextSpan span) 174if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 242return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (5)
18/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 48public readonly TextSpan Span; 54public static VirtualChar Create(Rune rune, TextSpan span) 62public static VirtualChar Create(char surrogateChar, TextSpan span) 70private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
108var 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)
14private static bool ShouldAnalyze(TextSpan? contextFilterSpan, TextSpan span) 24public static bool ShouldAnalyzeSpan(this SyntaxTreeAnalysisContext context, TextSpan span) 34public static bool ShouldAnalyzeSpan(this SemanticModelAnalysisContext context, TextSpan span) 44public static bool ShouldAnalyzeSpan(this SymbolStartAnalysisContext context, TextSpan span, SyntaxTree tree) 64public static bool ShouldAnalyzeSpan(this SymbolAnalysisContext context, TextSpan span, SyntaxTree tree) 84public static bool ShouldAnalyzeSpan(this AdditionalFileAnalysisContext context, TextSpan span) 94public static bool ShouldAnalyzeSpan(this OperationBlockStartAnalysisContext context, TextSpan span) 104public static bool ShouldAnalyzeSpan(this OperationBlockAnalysisContext context, TextSpan span) 114public static bool ShouldAnalyzeSpan(this OperationAnalysisContext context, TextSpan span) 124public static bool ShouldAnalyzeSpan(this SyntaxNodeAnalysisContext context, TextSpan span) 134public static bool ShouldAnalyzeSpan<TSytnaxKind>(this CodeBlockStartAnalysisContext<TSytnaxKind> context, TextSpan span) where TSytnaxKind : struct 144public static bool ShouldAnalyzeSpan(this CodeBlockAnalysisContext context, TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (2)
33this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden, CancellationToken cancellationToken) 45this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (11)
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)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (3)
18public static bool OverlapsHiddenPosition([NotNullWhen(returnValue: true)] this SyntaxTree? tree, TextSpan span, CancellationToken cancellationToken) 95public static bool IsEntirelyHidden(this SyntaxTree tree, TextSpan span, CancellationToken cancellationToken) 249public 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 (14)
46private readonly HashSet<TextSpan> _indentationMap = []; 47private readonly HashSet<TextSpan> _suppressWrappingMap = []; 48private readonly HashSet<TextSpan> _suppressSpacingMap = []; 49private readonly HashSet<TextSpan> _suppressFormattingMap = []; 50private readonly HashSet<TextSpan> _anchorMap = []; 141var baseSpan = _initialIndentBlockOperations[0].TextSpan; 160var operationSpan = operations[i].TextSpan; 181var intervalTreeSpan = operation.TextSpan; 410private static void DebugCheckEmpty<T, TIntrospector>(ContextMutableIntervalTree<T, TIntrospector> tree, TextSpan textSpan) 449var span = token.Span; 470var span = token.Span; 593public bool IsWrappingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 615public bool IsSpacingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 651public bool IsFormattingDisabled(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.IndentationData.cs (14)
18private abstract class IndentationData(TextSpan textSpan) 20public TextSpan TextSpan { get; } = textSpan; 23public IndentationData WithTextSpan(TextSpan span) 26protected abstract IndentationData WithTextSpanCore(TextSpan span); 29private sealed class SimpleIndentationData(TextSpan textSpan, int indentation) : IndentationData(textSpan) 33protected override IndentationData WithTextSpanCore(TextSpan span) 57public 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) 68this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 71private 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) 82this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 85public TextSpan InseparableRegionSpan { get; } 107protected override IndentationData WithTextSpanCore(TextSpan span) 119public AdjustedIndentationData(TextSpan textSpan, IndentationData baseIndentationData, int adjustment) 142protected override IndentationData WithTextSpanCore(TextSpan span)
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)
47var thisSpan = Introspector.GetSpan(value); 59var thisSpan = Introspector.GetSpan(value); 129var resultSpan = Introspector.GetSpan(result!); 130var currentNodeSpan = Introspector.GetSpan(currentNode.Value);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (5)
44protected readonly TextSpan SpanToFormat; 331private TextSpan GetSpanToFormat() 336return TextSpan.FromBounds(startPosition, endPosition); 453var 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)
53public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (1)
88public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (1)
51public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
69public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.NodeAndText.cs (3)
38return _text.ToString(TextSpan.FromBounds(token2.FullSpan.Start, token2.SpanStart)); 44return _text.ToString(TextSpan.FromBounds(token1.Span.End, token1.FullSpan.End)); 47return _text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TriviaData.cs (1)
37public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (13)
240var span = textChange.Span; 268internal static IEnumerable<TextSpan> GetAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 278static IEnumerable<TextSpan> EnumerateAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 290internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 305return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 308internal static TextSpan GetElasticSpan(SyntaxToken token) 311private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 313var aggregateSpans = new List<TextSpan>(); 315var last = default(TextSpan); 316foreach (var span in spans) 324last = 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)
16internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 30public TextSpan TextSpan { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\FormattingOperations.cs (8)
31=> CreateAnchorIndentationOperation(anchorToken, endToken, TextSpan.FromBounds(anchorToken.Span.End, endToken.Span.End)); 36public static AnchorIndentationOperation CreateAnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 43=> CreateSuppressOperation(startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End), option); 48private static SuppressOperation CreateSuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option) 56var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 63public static IndentBlockOperation CreateIndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 71var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 79public 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)
15internal IndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 34internal IndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 57public TextSpan TextSpan { get; }
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\SuppressOperation.cs (2)
15public readonly TextSpan TextSpan; 20internal SuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (13)
46private delegate void WhitespaceAppender<T>(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<T> changes); 388var span = GetTextSpan(trivia1, trivia2); 500var span = TextSpan.FromBounds(start, end); 716var insertionPoint = GetInsertionSpan(changes); 731private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 766TextSpan notUsed, 823private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 826private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes) 832private TextSpan GetTextSpan(SyntaxTrivia trivia1, SyntaxTrivia trivia2) 836return TextSpan.FromBounds(this.StartPosition, trivia2.FullSpan.Start); 841return TextSpan.FromBounds(trivia1.FullSpan.End, this.EndPosition); 844return TextSpan.FromBounds(trivia1.FullSpan.End, trivia2.FullSpan.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Helpers\RemoveUnnecessaryImports\AbstractUnnecessaryImportsProvider.cs (2)
23public ImmutableArray<TSyntaxNode> GetUnnecessaryImports(SemanticModel model, TextSpan? span, CancellationToken cancellationToken) 27SemanticModel model, TextSpan? span, Func<SyntaxNode, bool>? predicate, CancellationToken cancellationToken)
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)
238private TextSpan GetNormalizedSpan(int position) 242return TextSpan.FromBounds(LineToBeIndented.Start, position); 245return TextSpan.FromBounds(position, LineToBeIndented.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (19)
159var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 173private WordSpanEnumerable GetWordSpans(string name, TextSpan nameSpan) 176private static string Substring(string name, TextSpan wordSpan) 179private static readonly Func<string, TextSpan, bool> s_firstCharIsLowerCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsLower(val[span.Start]); 180private static readonly Func<string, TextSpan, bool> s_firstCharIsUpperCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsUpper(val[span.Start]); 182private static readonly Func<string, TextSpan, bool> s_wordIsAllUpperCase = (val, span) => 195private static readonly Func<string, TextSpan, bool> s_wordIsAllLowerCase = (val, span) => 209string name, TextSpan nameSpan, Func<string, TextSpan, bool> wordCheck, 231private bool CheckPascalCase(string name, TextSpan nameSpan, out string reason) 236private bool CheckAllUpper(string name, TextSpan nameSpan, out string reason) 241private bool CheckAllLower(string name, TextSpan nameSpan, out string reason) 247string name, TextSpan nameSpan, 248Func<string, TextSpan, bool> firstWordCheck, 249Func<string, TextSpan, bool> restWordCheck, 290private bool CheckCamelCase(string name, TextSpan nameSpan, out string reason) 297private bool CheckFirstUpper(string name, TextSpan nameSpan, out string reason) 405using var parts = TemporaryArray<TextSpan>.Empty;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerable.cs (1)
13private readonly struct WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (4)
18private readonly TextSpan _nameSpan; 21public WordSpanEnumerator(string name, TextSpan nameSpan, string wordSeparator) 30public TextSpan Current { get; private set; } 72Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (2)
46var headerSpan = TextSpan.FromBounds(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SelectedMembers\AbstractSelectedMembers.cs (4)
35SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 39SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 43SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, 78SyntaxNode root, SourceText text, TextSpan textSpan,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFacts.cs (7)
413bool ContainsInMemberBody([NotNullWhen(true)] SyntaxNode? node, TextSpan span); 415TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 418/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 419/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 421/// an empty <see cref="TextSpan"/> at position 0. 424TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 468bool 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.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)
46public static IEnumerable<(SyntaxToken, SyntaxToken)> ConvertToTokenPairs(this SyntaxNode root, IReadOnlyList<TextSpan> spans) 82public static ValueTuple<SyntaxToken, SyntaxToken> ConvertToTokenPair(this SyntaxNode root, TextSpan textSpan) 158=> (token1.RawKind == 0) ? text.ToString(TextSpan.FromBounds(0, token2.SpanStart)) : text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart)); 260public static TextSpan GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(SyntaxToken startToken, SyntaxToken endToken) 267return TextSpan.FromBounds(startPosition, endPosition); 325var fullSpan = node.FullSpan; 358public static TextSpan GetFormattingSpan(SyntaxNode root, TextSpan span) 368return 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)
46protected static TextSpan GetSpan(SyntaxNode node) 51return TextSpan.FromBounds(start.SpanStart, end.Span.End); 93var span = GetSpan(destination);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\AbstractRefactoringHelpersService.cs (5)
35ParsedDocument document, TextSpan selectionRaw, bool allowEmptyNodes, int maxCount, ref TemporaryArray<TSyntaxNode> result, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 46var selectionTrimmed = CodeRefactoringHelpers.GetTrimmedTextSpan(document, selectionRaw); 336var rightNodeSpanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, rightNode); 348TextSpan selectionTrimmed, 366var spanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, nonHiddenExtractedNode);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\CodeRefactoringHelpers.cs (6)
41public static bool IsNodeUnderselected(SyntaxNode? node, TextSpan selection) 103/// Returns unchanged <paramref name="span"/> in case <see cref="TextSpan.IsEmpty"/>. 104/// Returns empty Span with original <see cref="TextSpan.Start"/> in case it contains only whitespace. 106public static TextSpan GetTrimmedTextSpan(ParsedDocument document, TextSpan span) 121return TextSpan.FromBounds(start, end);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeRefactorings\IRefactoringHelpersService.cs (1)
57ParsedDocument 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)
34IEnumerable<TextSpan> spans,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
133public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (2)
373using var parts = TemporaryArray<TextSpan>.Empty; 377var 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)
40return 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)
20Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Rename\Annotations\RenameActionAnnotation.cs (2)
17TextSpan originalSpan, 30public 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)
55ImmutableArray<TextSpan> spans, 100ImmutableArray<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,
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (1)
26IEnumerable<TextSpan> spans,
Workspace\Host\DocumentService\IDocumentExcerptService.cs (8)
21/// return <see cref="ExcerptResult"/> of given <see cref="Document"/> and <see cref="TextSpan"/> 25Task<ExcerptResult?> TryExcerptAsync(Document document, TextSpan span, ExcerptMode mode, ClassificationOptions classificationOptions, CancellationToken cancellationToken); 40internal readonly struct ExcerptResult(SourceText content, TextSpan mappedSpan, ImmutableArray<ClassifiedSpan> classifiedSpans, Document document, TextSpan span) 50public readonly TextSpan MappedSpan = mappedSpan; 60/// should be same document in <see cref="IDocumentExcerptService.TryExcerptAsync(Document, TextSpan, ExcerptMode, ClassificationOptions, CancellationToken)" /> 67/// should be same text span in <see cref="IDocumentExcerptService.TryExcerptAsync(Document, TextSpan, ExcerptMode, ClassificationOptions, CancellationToken)" /> 69public readonly TextSpan Span = span;
Workspace\Host\DocumentService\ISpanMappingService.cs (3)
49Task<ImmutableArray<MappedSpanResult>> MapSpansAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken); 70public readonly TextSpan Span; 72public 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)
67public IList<TextSpan> SelectedSpans { get; } = []; 68public IDictionary<string, ImmutableArray<TextSpan>> AnnotatedSpans { get; } = new Dictionary<string, ImmutableArray<TextSpan>>(); 94IDictionary<string, ImmutableArray<TextSpan>> spans,
Workspaces\TestWorkspace.cs (1)
53IDictionary<string, ImmutableArray<TextSpan>> spans,
Workspaces\TestWorkspace_XmlConsumption.cs (3)
191out var code, out var cursorPosition, out IDictionary<string, ImmutableArray<TextSpan>> spans); 632ImmutableDictionary<string, ImmutableArray<TextSpan>> spans; 658spans = ImmutableDictionary<string, ImmutableArray<TextSpan>>.Empty;
Workspaces\TestWorkspace`1.cs (2)
194IDictionary<string, ImmutableArray<TextSpan>> spans, 746out var code, out var cursorPosition, out IDictionary<string, ImmutableArray<TextSpan>> spans);
Microsoft.CodeAnalysis.Workspaces.UnitTests (219)
BatchFixAllProviderTests.cs (1)
122private 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)
21public IEnumerable<TextSpan> ExpectedResult = null!; 23public Func<MockCodeCleanupProvider, Document, ImmutableArray<TextSpan>, SyntaxFormattingOptions, CancellationToken, Task<Document>>? CleanupDocumentAsyncImpl { get; set; } 24public Func<SyntaxNode, ImmutableArray<TextSpan>, SyntaxFormattingOptions, SolutionServices, SyntaxNode>? CleanupNodeImpl { get; set; } 28public Task<Document> CleanupAsync(Document document, ImmutableArray<TextSpan> spans, CodeCleanupOptions options, CancellationToken cancellationToken) 31public Task<SyntaxNode> CleanupAsync(SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SolutionServices services, CancellationToken cancellationToken)
Differencing\TestTreeComparer.cs (1)
54protected 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)
28private static TextSpan LongSpan { get; } = TextSpan.FromBounds(10, 20); 29private static TextSpan UnitSpan { get; } = TextSpan.FromBounds(10, 11); 30private static TextSpan EmptySpan { get; } = TextSpan.FromBounds(10, 10); 32private static int RightBeforeStart(TextSpan span) => span.Start - 1; 33private static int AtStart(TextSpan span) => span.Start; 34private static int RightAfterStart(TextSpan span) => span.Start + 1; 35private static int RightBeforeEnd(TextSpan span) => span.End - 1; 36private static int AtEnd(TextSpan span) => span.End; 37private static int RightAfterEnd(TextSpan span) => span.End + 1; 44LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), RightBeforeStart(LongSpan)))); 52LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), AtStart(LongSpan)))); 59[TextSpan.FromBounds(RightAfterStart(LongSpan), AtEnd(LongSpan))], 60LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), RightAfterStart(LongSpan)))); 67[TextSpan.FromBounds(RightBeforeEnd(LongSpan), AtEnd(LongSpan))], 68LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), RightBeforeEnd(LongSpan)))); 75LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), AtEnd(LongSpan)))); 82LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), RightAfterEnd(LongSpan)))); 90LongSpan.Subtract(TextSpan.FromBounds(AtStart(LongSpan), AtStart(LongSpan)))); 97[TextSpan.FromBounds(RightAfterStart(LongSpan), AtEnd(LongSpan))], 98LongSpan.Subtract(TextSpan.FromBounds(AtStart(LongSpan), RightAfterStart(LongSpan)))); 105[TextSpan.FromBounds(RightBeforeEnd(LongSpan), AtEnd(LongSpan))], 106LongSpan.Subtract(TextSpan.FromBounds(AtStart(LongSpan), RightBeforeEnd(LongSpan)))); 113LongSpan.Subtract(TextSpan.FromBounds(AtStart(LongSpan), AtEnd(LongSpan)))); 120LongSpan.Subtract(TextSpan.FromBounds(AtStart(LongSpan), RightAfterEnd(LongSpan)))); 128LongSpan.Subtract(TextSpan.FromBounds(RightAfterStart(LongSpan), RightAfterStart(LongSpan)))); 136TextSpan.FromBounds(AtStart(LongSpan), RightAfterStart(LongSpan)), 137TextSpan.FromBounds(RightBeforeEnd(LongSpan), AtEnd(LongSpan)) 139LongSpan.Subtract(TextSpan.FromBounds(RightAfterStart(LongSpan), RightBeforeEnd(LongSpan)))); 146[TextSpan.FromBounds(AtStart(LongSpan), RightAfterStart(LongSpan))], 147LongSpan.Subtract(TextSpan.FromBounds(RightAfterStart(LongSpan), AtEnd(LongSpan)))); 154[TextSpan.FromBounds(AtStart(LongSpan), RightAfterStart(LongSpan))], 155LongSpan.Subtract(TextSpan.FromBounds(RightAfterStart(LongSpan), RightAfterEnd(LongSpan)))); 163LongSpan.Subtract(TextSpan.FromBounds(RightBeforeEnd(LongSpan), RightBeforeEnd(LongSpan)))); 170[TextSpan.FromBounds(AtStart(LongSpan), RightBeforeEnd(LongSpan))], 171LongSpan.Subtract(TextSpan.FromBounds(RightBeforeEnd(LongSpan), AtEnd(LongSpan)))); 178[TextSpan.FromBounds(AtStart(LongSpan), RightBeforeEnd(LongSpan))], 179LongSpan.Subtract(TextSpan.FromBounds(RightBeforeEnd(LongSpan), RightAfterEnd(LongSpan)))); 187LongSpan.Subtract(TextSpan.FromBounds(AtEnd(LongSpan), AtEnd(LongSpan)))); 195LongSpan.Subtract(TextSpan.FromBounds(AtEnd(LongSpan), RightAfterEnd(LongSpan)))); 203LongSpan.Subtract(TextSpan.FromBounds(RightAfterEnd(LongSpan), RightAfterEnd(LongSpan)))); 211UnitSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(UnitSpan), RightBeforeStart(UnitSpan)))); 219UnitSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(UnitSpan), AtStart(UnitSpan)))); 226UnitSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(UnitSpan), AtEnd(UnitSpan)))); 233UnitSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(UnitSpan), RightAfterEnd(UnitSpan)))); 241UnitSpan.Subtract(TextSpan.FromBounds(AtStart(UnitSpan), AtStart(UnitSpan)))); 248UnitSpan.Subtract(TextSpan.FromBounds(AtStart(UnitSpan), AtEnd(UnitSpan)))); 255UnitSpan.Subtract(TextSpan.FromBounds(AtStart(UnitSpan), RightAfterEnd(UnitSpan)))); 263UnitSpan.Subtract(TextSpan.FromBounds(AtEnd(UnitSpan), AtEnd(UnitSpan)))); 271UnitSpan.Subtract(TextSpan.FromBounds(AtEnd(UnitSpan), RightAfterEnd(UnitSpan)))); 279UnitSpan.Subtract(TextSpan.FromBounds(RightAfterEnd(UnitSpan), RightAfterEnd(UnitSpan)))); 287EmptySpan.Subtract(TextSpan.FromBounds(RightBeforeStart(EmptySpan), RightBeforeStart(EmptySpan)))); 294EmptySpan.Subtract(TextSpan.FromBounds(RightBeforeStart(EmptySpan), EmptySpan.Start))); 301EmptySpan.Subtract(TextSpan.FromBounds(RightBeforeStart(EmptySpan), RightAfterEnd(EmptySpan)))); 308EmptySpan.Subtract(TextSpan.FromBounds(EmptySpan.Start, EmptySpan.Start))); 315EmptySpan.Subtract(TextSpan.FromBounds(EmptySpan.Start, RightAfterEnd(EmptySpan)))); 323EmptySpan.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 (4)
22public TextSpan GetSpan(Tuple<int, int, T> value) 263public TextSpan GetSpan(int value) 398public TextSpan GetSpan(int value) 404public 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.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.ML.InternalCodeAnalyzer (1)
ContractsCheckNameofFixProvider.cs (1)
41var diagnosticSpan = diagnostic.Location.SourceSpan;
Microsoft.VisualStudio.LanguageServices (121)
CallHierarchy\CallHierarchyDetail.cs (2)
20private readonly TextSpan _span; 46return location.SourceTree.GetText().GetSubText(TextSpan.FromBounds(start, end)).ToString();
CodeLens\RemoteCodeLensReferencesService.cs (1)
161var 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)
15public static VsTextSpan GetVsTextSpanForSpan(this SourceText text, TextSpan textSpan)
F1Help\AbstractHelpContextService.cs (1)
46public 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)
471var 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)
361var originalNewLine = originalText.ToString(CodeAnalysis.Text.TextSpan.FromBounds(originalLine.End, originalLine.EndIncludingLineBreak)); 367var 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)
37var 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)
219var 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)
92var 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)
105public Func<CancellationToken, Task<bool>> GetNavigationCallback(SourceGeneratedDocument document, TextSpan sourceSpan) 527public Task<bool> NavigateToSpanAsync(TextSpan sourceSpan, CancellationToken cancellationToken)
Workspace\VisualStudioDocumentNavigationService.cs (14)
29using TextSpan = Microsoft.CodeAnalysis.Text.TextSpan; 52public async Task<bool> CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) 101Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) 127static async Task<TextSpan> GetTextSpanFromPositionAsync(Document document, int position, int virtualSpace, CancellationToken cancellationToken) 159Func<Document, Task<TextSpan>> getTextSpanForMappingAsync, 161Func<SourceText, TextSpan, VsTextSpan> getVsTextSpanForMapping, 183Func<Document, Task<TextSpan>> getTextSpanForMappingAsync, 185Func<SourceText, TextSpan, VsTextSpan> getVsTextSpanForMapping, 321ISpanMappingService spanMappingService, Document generatedDocument, TextSpan textSpan, CancellationToken cancellationToken) 349private static VsTextSpan GetVsTextSpan(SourceText text, TextSpan textSpan, bool allowInvalidSpan) 367/// It is unclear why, but we are sometimes asked to navigate to a <see cref="TextSpan"/> 374private static TextSpan GetSpanWithinDocumentBounds(TextSpan span, int documentLength) 375=> TextSpan.FromBounds(GetPositionWithinDocumentBounds(span.Start, documentLength), GetPositionWithinDocumentBounds(span.End, documentLength));
Workspace\VisualStudioFormattingRuleFactoryServiceFactory.cs (3)
52using var pooledObject = SharedPools.Default<List<TextSpan>>().GetPooledObject(); 92public IEnumerable<TextChange> FilterFormattedChanges(DocumentId documentId, TextSpan span, IList<TextChange> changes) 103foreach (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)
46public override async Task<string> GetHelpTermAsync(Document document, TextSpan span, CancellationToken cancellationToken) 89return 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)
46using TextSpan = Microsoft.CodeAnalysis.Text.TextSpan; 461public 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)
1227span:=TextSpan.FromBounds(0, textAfterOperation.Length),
Debugging\VisualBasicBreakpointResolutionServiceTests.vb (1)
23Dim expectedSpan As TextSpan? = Nothing
Diagnostics\ExternalDiagnosticUpdateSourceTests.vb (1)
319Public Function GetDiagnosticsForSpanAsync(document As TextDocument, range As TextSpan?, shouldIncludeDiagnostic As Func(Of String, Boolean), includeCompilerDiagnostics As Boolean, includeSuppressedDiagnostics As Boolean, priority As ICodeActionRequestPriorityProvider, diagnosticKinds As DiagnosticKind, isExplicit As Boolean, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of DiagnosticData)) Implements IDiagnosticAnalyzerService.GetDiagnosticsForSpanAsync
Venus\DocumentService_IntegrationTests.vb (3)
272Public Async Function MapSpansAsync(document As Document, spans As IEnumerable(Of TextSpan), cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of MappedSpanResult)) Implements ISpanMappingService.MapSpansAsync 310Public 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 318Dim mappedSpan As TextSpan
Venus\DocumentServiceTests.vb (1)
299Private 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.VisualStudio.Next.UnitTests (3)
Services\ServiceHubServicesTests.cs (1)
90var newText = oldText.WithChanges(new TextChange(TextSpan.FromBounds(0, 0), "/* test */"));
Services\VisualStudioDiagnosticAnalyzerExecutorTests.cs (2)
276c.ReportDiagnostic(Diagnostic.Create(_supportedDiagnostics[0], c.Tree.GetLocation(TextSpan.FromBounds(0, 1)))); 294c.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