1150 references to TextSpan
AnalyzerRunner (1)
CodeRefactoringRunner.cs (1)
89var context = new CodeRefactoringContext(document, new TextSpan(node.SpanStart, 0), codeActions.Add, cancellationToken);
CSharpSyntaxGenerator (1)
SourceGenerator.cs (1)
86var span = new TextSpan(position, 0);
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)
285if (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)
1615return 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)
15240var diagnosticSpan = new TextSpan(2, 2);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (7)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (1)
650var insertChange = new TextChange(new TextSpan(insertionPosition, 0), bracePair);
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (1)
262var textChange = new TextChange(new TextSpan(position, 0), textToInsert);
InlineRename\CSharpEditorInlineRenameService.cs (1)
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 (43)
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))
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)
1801var 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 (25)
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 (1)
565? semanticModel.SyntaxTree.GetLocation(new TextSpan(lastMember.Span.End, 0))
InlineHints\CSharpInlineTypeHintsService.cs (5)
60: new(type, new TextSpan(variableDesignation.Identifier.SpanStart, 0), textChange: null, trailingSpace: true); 76var span = new TextSpan(parameterNode.Identifier.SpanStart, 0); 95var span = new TextSpan(implicitNew.NewKeyword.Span.End, 0); 108var span = new TextSpan(collectionExpression.OpenBracketToken.SpanStart, 0); 144return 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 (155)
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); 2412return new TextSpan(index, textToFind.Length);
Diagnostics\LocationsTests.cs (9)
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);
IncrementalParsing\IncrementalParsingTests.cs (46)
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); 3688new TextChange(new TextSpan(position1, 0), "n"), 3689new TextChange(new TextSpan(position2, 0), "n"), 3690new TextChange(new TextSpan(position3, 0), "n")); 3728new TextChange(new TextSpan(locationOfChange, 0), "/*"), 3729new TextChange(new TextSpan(locationOfChange + widthOfChange, 0), "*/") 3738var newText = oldText.WithChanges(new TextChange(new TextSpan(locationOfChange, widthOfChange), "")); 3764var newText = oldText.WithChanges(new TextChange(new TextSpan(oldText.Length, 0), newChar.ToString()));
LexicalAndXml\SyntaxTokenParserTests.cs (50)
39AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 22), """ 44AssertToken(expectedKind: SyntaxKind.IdentifierToken, expectedContextualKind: SyntaxKind.None, new TextSpan(22, 3), """ 49AssertToken(expectedKind: SyntaxKind.OpenBraceToken, expectedContextualKind: SyntaxKind.None, new TextSpan(25, 3), """ 54AssertToken(expectedKind: SyntaxKind.CloseBraceToken, expectedContextualKind: SyntaxKind.None, new TextSpan(28, 3), """ 59AssertToken(expectedKind: SyntaxKind.EndOfFileToken, expectedContextualKind: SyntaxKind.None, new TextSpan(31, 0), "", parser.ParseNextToken()); 60AssertToken(expectedKind: SyntaxKind.EndOfFileToken, expectedContextualKind: SyntaxKind.None, new TextSpan(31, 0), "", parser.ParseNextToken()); 78AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 54), """ 89AssertToken(expectedKind: SyntaxKind.IdentifierToken, expectedContextualKind: SyntaxKind.None, new TextSpan(54, 3), """ 94AssertToken(expectedKind: SyntaxKind.OpenBraceToken, expectedContextualKind: SyntaxKind.None, new TextSpan(57, 3), """ 99AssertToken(expectedKind: SyntaxKind.CloseBraceToken, expectedContextualKind: SyntaxKind.None, new TextSpan(60, 3), """ 104AssertToken(expectedKind: SyntaxKind.EndOfFileToken, expectedContextualKind: SyntaxKind.None, new TextSpan(63, 0), "", parser.ParseNextToken()); 121AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 16), """ 126AssertToken(expectedKind: SyntaxKind.IdentifierToken, expectedContextualKind: SyntaxKind.None, new TextSpan(16, 3), """ 131AssertToken(expectedKind: SyntaxKind.OpenBraceToken, expectedContextualKind: SyntaxKind.None, new TextSpan(19, 3), """ 136AssertToken(expectedKind: SyntaxKind.EndOfFileToken, expectedContextualKind: SyntaxKind.None, new TextSpan(22, 18), """ 143AssertToken(expectedKind: SyntaxKind.EndOfFileToken, expectedContextualKind: SyntaxKind.None, new TextSpan(40, 0), "", parser.ParseNextToken()); 162AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(18, 22), """ 169AssertToken(expectedKind: SyntaxKind.OpenBraceToken, expectedContextualKind: SyntaxKind.None, new TextSpan(43, 3), """ 174AssertToken(expectedKind: SyntaxKind.CloseBraceToken, expectedContextualKind: SyntaxKind.None, new TextSpan(46, 3), """ 187AssertToken(expectedKind: SyntaxKind.IdentifierToken, expectedContextualKind: SyntaxKind.None, new TextSpan(1, 4), """lass""", parser.ParseNextToken()); 196AssertToken(expectedKind: SyntaxKind.EndOfFileToken, expectedContextualKind: SyntaxKind.None, new TextSpan(100, 0), "", parser.ParseNextToken()); 205AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 6), "class ", parser.ParseNextToken()); 223AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 16), """ 229AssertToken(expectedKind: SyntaxKind.IdentifierToken, expectedContextualKind: SyntaxKind.None, new TextSpan(16, 3), """ 244AssertToken(expectedKind: SyntaxKind.OpenBraceToken, expectedContextualKind: SyntaxKind.None, new TextSpan(19, 3), """ 249AssertToken(expectedKind: SyntaxKind.EndOfFileToken, expectedContextualKind: SyntaxKind.None, new TextSpan(22, 18), """ 264AssertToken(expectedKind: SyntaxKind.IdentifierToken, expectedContextualKind: SyntaxKind.WhenKeyword, new TextSpan(0, 5), "when ", parser.ParseNextToken()); 265AssertToken(expectedKind: SyntaxKind.IdentifierToken, expectedContextualKind: SyntaxKind.None, new TextSpan(5, 11), "identifier ", parser.ParseNextToken()); 266AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(16, 5), "class", parser.ParseNextToken()); 276AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 0), "", result); 281AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 0), "", result); 285AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 6), "class ", parser.ParseNextToken()); 295AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 11), "/* test */ ", result); 302AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(11, 0), "", intermediateResult); 307AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(11, 0), "", intermediateResult); 311AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(11, 6), "class ", parser.ParseNextToken()); 314AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 17), "/* test */ class ", parser.ParseNextToken()); 328AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 14), $"/* test */\r\n\r\n", result); 336AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(14, 0), "", intermediateResult); 341AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(14, 0), "", intermediateResult); 345AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(14, 6), "class ", parser.ParseNextToken()); 348AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 20), "/* test */\r\n\r\nclass ", parser.ParseNextToken()); 358AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 0), "", result); 362AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 6), "class ", parser.ParseNextToken()); 372AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 11), "/* test */ ", result); 378AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(11, 6), "class ", parser.ParseNextToken()); 381AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 17), "/* test */ class ", parser.ParseNextToken()); 395AssertToken(expectedKind: SyntaxKind.None, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 12), $"/* test */\r\n", result); 401AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(12, 8), "\r\nclass ", parser.ParseNextToken()); 404AssertToken(expectedKind: SyntaxKind.ClassKeyword, expectedContextualKind: SyntaxKind.None, new TextSpan(0, 20), "/* test */\r\n\r\nclass ", parser.ParseNextToken());
LexicalAndXml\XmlDocCommentTests.cs (2)
3228filterSpanWithinTree: new TextSpan(0, 0)); 3276filterSpanWithinTree: new TextSpan(0, 0));
Syntax\StructuredTriviaTests.cs (1)
93var resultList = identExpr.DescendantTokens(t => t.FullSpan.OverlapsWith(new TextSpan(3, 18)));
Syntax\SyntaxDiffingTests.cs (23)
33Assert.Equal(new TextSpan(0, 0), changes[0].Span); 53Assert.Equal(new TextSpan(6, 1), changes[0].Span); 75Assert.Equal(new TextSpan(6, 1), changes[0].Span); 77Assert.Equal(new TextSpan(18, 1), changes[1].Span); 90Assert.Equal(new TextSpan(0, 6), spans[0]); 95Assert.Equal(new TextSpan(0, 0), changes[0].Span); 108Assert.Equal(new TextSpan(0, 8), spans[0]); 113Assert.Equal(new TextSpan(0, 0), changes[0].Span); 127Assert.Equal(new TextSpan(11, 11), spans[0]); // its going to pick one of the two spans. 132Assert.Equal(new TextSpan(11, 0), changes[0].Span); 147Assert.Equal(new TextSpan(10, 12), spans[0]); 152Assert.Equal(new TextSpan(10, 0), changes[0].Span); 165Assert.Equal(new TextSpan(0, 14), spans[0]); 170Assert.Equal(new TextSpan(0, 0), changes[0].Span); 183Assert.Equal(new TextSpan(10, 7), spans[0]); // int X; 188Assert.Equal(new TextSpan(10, 0), changes[0].Span); 205Assert.Equal(new TextSpan(10, 7), changes[0].Span); 222Assert.Equal(new TextSpan(24, 7), changes[0].Span); 239Assert.Equal(new TextSpan(14, 1), changes[0].Span); 252Assert.Equal(new TextSpan(14, 6), spans[0]); // 'struct' 257Assert.Equal(new TextSpan(14, 5), changes[0].Span); 307var span = new TextSpan(index, 4); 372var span = new TextSpan(index, 6);
Syntax\SyntaxNodeTests.cs (13)
578var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(0, 16)).ToList(); 590var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(1, 14)).ToList(); 602var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(7, 17)).ToList(); 615var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(8, 15)).ToList(); 664var node = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(6, 3)).First(); 745var EOFSpan = new TextSpan(root.FullSpan.End, 0); 754var nodeEndPositionSpan = new TextSpan(classDecl.FullSpan.End, 0); 764var invalidSpan = new TextSpan(100, 100); 766invalidSpan = new TextSpan(root.FullSpan.End - 1, 2); 768invalidSpan = new TextSpan(classDecl2.FullSpan.Start - 1, root.FullSpan.End); 770invalidSpan = new TextSpan(classDecl.FullSpan.End, root.FullSpan.End); 920var tree2 = tree1.WithChangedText(tree1.GetText().WithChanges(new TextChange(new TextSpan(22, 0), " return; "))); 2092var textSpan = new TextSpan(5, 10);
TextExtensions.cs (4)
25var span = new TextSpan(offset, length); 35var span = new TextSpan(offset, length); 45var span = new TextSpan(offset, length); 59var span = new TextSpan(offset, 0);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
CompilationTestUtils.cs (1)
454Assert.True(compilation.IsNullableAnalysisEnabledIn((CSharpSyntaxTree)tree, new TextSpan(0, tree.Length)));
SyntaxTreeExtensions.cs (1)
20var newFullText = oldFullText.WithChanges(new TextChange(new TextSpan(offset, length), newText));
Microsoft.CodeAnalysis.CSharp.Workspaces (9)
Rename\CSharpRenameRewriterLanguageService.cs (2)
111newSpan = new TextSpan(oldSpan.Start, newSpan.Length); 316_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)
29return AssertFormatAsync(code, code, [new TextSpan(0, code.Length)], changedOptionSet, testWithTransformation, parseOptions); 39return AssertFormatAsync(expected, code, [new TextSpan(0, code.Length)], changedOptionSet, testWithTransformation, parseOptions);
Microsoft.CodeAnalysis.EditorFeatures (12)
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));
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)
763var textChange = new TextChange(new TextSpan(firstItem.Span.End, 0), commitChar.ToString()); 1290var assertText = "'" + text.ToString(new TextSpan(position, 1)) + "' expected to be textual trigger character"; 1295var assertText = "'" + text.ToString(new TextSpan(position, 1)) + "' expected to NOT be textual trigger character";
ExtractInterface\ExtractInterfaceTestState.cs (1)
103new 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 (105)
CodeFixes\CodeFixServiceTests.cs (2)
615context.ReportDiagnostic(Diagnostic.Create(s_descriptor, tree.GetLocation(new TextSpan(0, 1)))); 926var span = new TextSpan(line.Start, line.End);
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)
410builder.Append(text.GetSubText(New TextSpan(position, span.Start - position))) 417builder.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 (39)
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\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);
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (2)
103var replaceSpan = new TextSpan(token.Span.Start, spanToReplaceLength); 359var 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)));
Highlighting\Keywords\AbstractKeywordHighlighter.cs (1)
80=> new(position, 0);
MetadataAsSource\MetadataAsSourceHelpers.cs (1)
83location = Location.Create(tree, new TextSpan(0, 0));
MoveToNamespace\AbstractMoveToNamespaceService.cs (1)
232var 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);
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)
345=> 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 (1)
HostWorkspace\Razor\ServerTextSpan.cs (1)
19=> new(Start, Length);
Microsoft.CodeAnalysis.LanguageServer.Protocol (12)
Handler\Breakpoints\ValidateBreakableRangeHandler.cs (3)
77var breakpointSpan = result.IsLineBreakpoint ? new TextSpan(span.Start, length: 0) : result.TextSpan; 98var secondResult = await breakpointService.ResolveBreakpointAsync(document, new TextSpan(span.End, length: 0), cancellationToken).ConfigureAwait(false); 101breakpointSpan = 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)
204snippetEndPosition = GetAdjustedSpan(formattingChanges, new TextSpan(snippetEndPosition, 0)).Start; 238return new TextSpan(originalSpan.Start + amountToAdjust, originalSpan.Length); 243var offsetInSnippet = new TextSpan(positionInFullText - snippetPositionInFullText, length); 286part = await functionPart.WithSnippetFunctionResultAsync(documentWithDefaultSnippet, new TextSpan(locationInDefaultSnippet, part.DefaultText.Length), simplifierOptions, cancellationToken).ConfigureAwait(false); 292var fieldSpan = new TextSpan(locationInFinalSnippet, part.DefaultText.Length); 297caretSpan = new TextSpan(locationInFinalSnippet, cursorPart.DefaultText.Length);
Handler\OnAutoInsert\OnAutoInsertHandler.cs (1)
220var indentedText = textToIndent.WithChanges(new TextChange(new TextSpan(lineToIndent.End, 0), indentText));
Handler\SemanticTokens\SemanticTokensHelpers.cs (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)
330classifiedSpans.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 (301)
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 (7)
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)
60Return 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)
10426Dim diagnosticSpan = New TextSpan(2, 2) 11124ReportDiagnostic(context.Options.AdditionalFiles.First().Path, context, New TextSpan(0, 1000000)) ' Overflow span 11135span = 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)
341subjectBuffer.ApplyChange(New TextChange(New TextSpan(insertPosition, 0), endText))
NavigationBar\VisualBasicEditorNavigationBarItemService_CodeGeneration.vb (1)
54Dim 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 (8)
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),
GenerateType\VisualBasicGenerateTypeService.vb (1)
446semanticModel.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)
96newSpan = New TextSpan(oldSpan.Start, newSpan.Length) 236Me._renameSpansTracker.AddComplexifiedSpan(Me._documentId, oldSpan, New TextSpan(oldSpan.Start, newSpan.Length), Me._modifiedSubSpans) 294AddModifiedSpan(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)
285if (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)
467if (textChanges.Length > 1 || (textChanges.Length == 1 && textChanges[0].Span != new TextSpan(0, oldText.Length)))
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (1)
Formatting\FormattingTestBase.cs (1)
30return AssertFormatAsync(expected, code, [new TextSpan(0, code.Length)], language, changedOptionSet, testWithTransformation);
Microsoft.CodeAnalysis.Workspaces.UnitTests (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)
566var 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);