1245 instantiations of TextSpan
AnalyzerRunner (1)
CodeRefactoringRunner.cs (1)
90var context = new CodeRefactoringContext(document, new TextSpan(node.SpanStart, 0), codeActions.Add, cancellationToken);
IdeBenchmarks (2)
RegexClassifierBenchmarks.cs (2)
45return GetClassificationSpansAsync(code, new TextSpan(0, code.Length), parseOptions: null).Result; 52return GetClassificationSpansAsync(code, new TextSpan(0, code.Length), parseOptions: null).Result;
IdeCoreBenchmarks (3)
ClassificationBenchmarks.cs (1)
111var span = new TextSpan(0, text.Length);
SyntacticChangeRangeBenchmark.cs (2)
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 "));
Microsoft.CodeAnalysis (36)
CodeGen\RawSequencePoint.cs (1)
21internal static readonly TextSpan HiddenSequencePointSpan = new TextSpan(0x7FFFFFFF, 0);
InternalUtilities\TextChangeRangeExtensions.cs (4)
224addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion)); 225oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 379add(builder, new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, newChange.SpanLength), newChange.NewLength)); 390builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
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)
83public TextSpan FullSpan => new TextSpan(this.Position, this.Green.FullWidth); 107return new TextSpan(start, width);
Syntax\SyntaxNodeOrToken.cs (1)
278return new TextSpan(Position, _token.FullWidth);
Syntax\SyntaxToken.cs (2)
112return Node != null ? new TextSpan(Position + Node.GetLeadingTriviaWidth(), Node.Width) : default(TextSpan); 135public TextSpan FullSpan => new TextSpan(Position, FullWidth);
Syntax\SyntaxTokenList.cs (1)
150return 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)
140return new TextSpan(this.Position, Node.FullWidth);
Text\ChangedText.cs (2)
207return ImmutableArray.Create(new TextChangeRange(new TextSpan(0, oldText.Length), _newText.Length)); 325var text = GetSubText(new TextSpan(changeStart, change.NewLength));
Text\CompositeText.cs (1)
97AddSegments(newSegments, segment.GetSubText(new TextSpan(segOffset, copyLength)));
Text\SourceText.cs (8)
523return this.GetSubText(new TextSpan(start, this.Length - start)); 532this.Write(textWriter, new TextSpan(0, this.Length), cancellationToken); 603return ToString(new TextSpan(0, this.Length)); 688var subText = this.GetSubText(new TextSpan(position, change.Span.Start - position)); 711var subText = this.GetSubText(new TextSpan(position, this.Length - position)); 759return this.Replace(new TextSpan(start, length), newText); 780return ImmutableArray.Create(new TextChangeRange(new TextSpan(0, oldText.Length), this.Length)); 804var span = new TextSpan(newPos, range.NewLength);
Text\SubText.cs (1)
90return new TextSpan(compositeStart, compositeEnd - compositeStart);
Text\TextLine.cs (1)
66span = new TextSpan(span.Start, span.Length + lineBreakLen);
Text\TextSpan.cs (1)
197return new TextSpan(start, end - start);
Microsoft.CodeAnalysis.CodeStyle (42)
AbstractFormatEngine.cs (1)
266if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
AbstractFormatEngine.OperationApplier.cs (1)
218Debug.Assert(!_context.IsFormattingDisabled(new TextSpan(_context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0)));
AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (1)
78Location.Create(badTrivia.SyntaxTree!, new TextSpan(badTrivia.SpanStart, 0)),
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);
AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
354new Text.TextSpan(
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)));
BKTree.Builder.cs (1)
108_wordSpans[i] = new TextSpan(characterIndex, value.Length);
BKTree.Node.cs (1)
45new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
EditorConfigParser.cs (1)
122var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
FileHeader.cs (2)
102return Location.Create(syntaxTree, new TextSpan(_fileHeaderStart, 0)); 105return Location.Create(syntaxTree, new TextSpan(_fileHeaderStart, _commentPrefixLength));
FormattingAnalyzerHelper.cs (4)
41if (oldText.GetSubText(new TextSpan(change.Span.Start + offset, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 43change = new TextChange(new TextSpan(change.Span.Start, offset), ""); 50if (oldText.GetSubText(new TextSpan(change.Span.Start, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 52change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), "");
FormattingContext.cs (2)
448DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 499DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
FormattingExtensions.cs (1)
278span = new TextSpan(span.Start + i, span.Length - i);
J\s\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (1)
24var fullSpan = new TextSpan(0, text.Length);
NamingStyle.WordSpanEnumerator.cs (2)
27Current = new TextSpan(nameSpan.Start, 0); 54Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
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);
SymbolKey.SymbolKeyReader.cs (1)
696return Location.Create(syntaxTree, new TextSpan(start, length));
TextChangeRangeExtensions.cs (4)
224addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion)); 225oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 379add(builder, new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, newChange.SpanLength), newChange.NewLength)); 390builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
VirtualCharSequence.Chunks.cs (1)
123var span = new TextSpan(_firstVirtualCharPosition + index, length: 1);
VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
Microsoft.CodeAnalysis.CodeStyle.Fixes (2)
DocumentExtensions.cs (1)
98=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
ParsedDocument.cs (1)
84textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
Microsoft.CodeAnalysis.CodeStyle.LegacyTestFramework.UnitTestUtilities (1)
AbstractCodeActionOrUserDiagnosticTest.cs (1)
915span = new TextSpan(hostDocument.CursorPosition.Value, 0);
Microsoft.CodeAnalysis.CSharp (21)
Binder\Binder_Expressions.cs (3)
4510var errorSpan = new TextSpan(start, end - start); 6230diagnostics.Add(new CSDiagnosticInfo(ErrorCode.WRN_LowercaseEllSuffix), Location.Create(node.SyntaxTree, new TextSpan(token.Span.End - 1, 1))); 6234diagnostics.Add(new CSDiagnosticInfo(ErrorCode.WRN_LowercaseEllSuffix), Location.Create(node.SyntaxTree, new TextSpan(token.Span.End - 2, 1)));
Binder\Binder_Query.cs (1)
731SourceLocation errorLocation = new SourceLocation(let.SyntaxTree, new TextSpan(let.Identifier.SpanStart, let.Expression.Span.End - let.Identifier.SpanStart));
Compilation\SyntaxTreeSemanticModel.cs (1)
770Compilation.IsNullableAnalysisEnabledIn((CSharpSyntaxTree)SyntaxTree, new TextSpan(position, 0));
Compiler\DocumentationCommentCompiler.cs (1)
556Location location = new SourceLocation(trivia.SyntaxTree, new TextSpan(trivia.SpanStart, 0));
Compiler\UnprocessedDocumentationCommentFinder.cs (1)
104_diagnostics.Add(ErrorCode.WRN_UnprocessedXMLComment, new SourceLocation(trivia.SyntaxTree, new TextSpan(start, length)));
DocumentationComments\SourceDocumentationCommentUtils.cs (1)
81diagnostics.Add(ErrorCode.WRN_UnprocessedXMLComment, new SourceLocation(tree, new TextSpan(start, length)));
FlowAnalysis\AbstractFlowPass.cs (1)
206this.RegionSpan = new TextSpan(startLocation, length);
FlowAnalysis\NullableWalker.cs (2)
1506return compilation.SyntaxTrees.Any(static tree => ((CSharpSyntaxTree)tree).IsNullableAnalysisEnabled(new Text.TextSpan(0, tree.Length)) == true); 7828location = Location.Create(lambdaSyntax.SyntaxTree, new Text.TextSpan(start, lambdaSyntax.ArrowToken.Span.End - start));
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (1)
631return new TextSpan(startSpan.Start, originalSpan.Length - (startSpan.Start - originalSpan.Start));
Lowering\LocalRewriter\LocalRewriter_SwitchExpression.cs (1)
78var spanForSwitchBody = new TextSpan(spanStart, spanEnd - spanStart);
Parser\Blender.cs (1)
154var column = oldTree.SyntaxTree.GetLineSpan(new TextSpan(start, 0)).Span.Start.Character;
Parser\Lexer.cs (1)
920info.Text = TextWindow.Text.ToString(new TextSpan(startingPosition, width));
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)
CSharpVirtualCharService.cs (6)
276charResults.Add((ch, new TextSpan(offset + index, 1))); 370result.Add((ch, new TextSpan(offset + index, 2))); 437result.Add(((char)uintChar, new TextSpan(startIndex + offset, 2 + 8))); 448result.Add(((char)highSurrogate, new TextSpan(pos, 0))); 449result.Add(((char)lowSurrogate, new TextSpan(pos, 2 + 8))); 477result.Add((character, new TextSpan(startIndex + offset, 2 + 4)));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (4)
ArrowExpressionClausePlacementCodeFixProvider.cs (1)
99edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
ConditionalExpressionPlacementCodeFixProvider.cs (1)
101edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
ConvertNamespaceTransform.cs (1)
156return new TextChange(new TextSpan(textLine.Start, commonIndentation), newText: "");
CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
71var nodeAtInsertPosition = syntaxRoot.FindNode(new TextSpan(openParenthesisPosition, 0));
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (1)
CommandLineTests.cs (1)
14337var diagnosticSpan = new TextSpan(2, 2);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (20)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (1)
658var insertChange = new TextChange(new TextSpan(insertionPosition, 0), bracePair);
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (1)
208var textChange = new TextChange(new TextSpan(position, 0), textToInsert);
Formatting\CSharpFormattingInteractionService.cs (1)
97var span = textSpan ?? new TextSpan(0, parsedDocument.Root.FullSpan.Length);
RawStringLiteral\RawStringLiteralCommandHandler_TypeChar.cs (3)
121return new TextChange(new TextSpan(position + 1, 0), "\"\"\""); 178return new TextChange(new TextSpan(position + 1, 0), "\""); 235return new TextChange(new TextSpan(token.GetRequiredParent().Span.End, 0), "\"");
StringCopyPaste\KnownSourcePasteProcessor.cs (8)
201edits.Add(new TextChange(new TextSpan(StringExpressionBeforePaste.Span.Start, 0), dollarSignsToAdd)); 205edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.ContentSpans.First().Start, 0), quotesToAdd)); 210edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.StartDelimiterSpan.End, 0), NewLine + IndentationWhitespace)); 226edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpan.Start, 0), NewLine + IndentationWhitespace)); 230edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpanWithoutSuffix.End, 0), quotesToAdd)); 250edits.Add(new TextChange(new TextSpan(interpolation.OpenBraceToken.Span.End, 0), new string('{', dollarSignsToAdd))); 251edits.Add(new TextChange(new TextSpan(interpolation.CloseBraceToken.Span.Start, 0), new string('}', dollarSignsToAdd))); 354builder.Append(TextBeforePaste.ToString(new TextSpan(TextBeforePaste.Lines[line].Start, offset)));
StringCopyPaste\UnknownSourcePasteProcessor.cs (6)
133edits.Add(new TextChange(new TextSpan(StringExpressionBeforePaste.Span.Start, 0), dollarSignsToAdd)); 137edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.ContentSpans.First().Start, 0), quotesToAdd)); 148edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpanWithoutSuffix.End, 0), quotesToAdd)); 177edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.StartDelimiterSpan.End, 0), NewLine + IndentationWhitespace)); 221edits.Add(new TextChange(new TextSpan(StringExpressionBeforePasteInfo.EndDelimiterSpan.Start, 0), NewLine + IndentationWhitespace)); 334buffer.Append(TextBeforePaste.ToString(new TextSpan(TextBeforePaste.Lines[line].Start, offset)));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (47)
Classification\SyntacticClassifierTests.cs (29)
5647var classifications = await GetSyntacticClassificationsAsync(document, new TextSpan(0, source.Length)); 5650new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(0, 3)), 5651new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentText, new TextSpan(3, 1)), 5652new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(4, 1)), 5653new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentName, new TextSpan(5, 5)), 5654new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeName, new TextSpan(11, 4)), 5655new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(15, 1)), 5656new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeQuotes, new TextSpan(16, 1)), 5657new ClassifiedSpan(ClassificationTypeNames.Identifier, new TextSpan(17, 5)), 5658new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeQuotes, new TextSpan(22, 1)), 5659new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(23, 1)), 5660new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(24, 2)), 5661new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentName, new TextSpan(26, 5)), 5662new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(31, 1)) 5675var classifications = await GetSyntacticClassificationsAsync(document, new TextSpan(0, source.Length)); 5678new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(2, 3)), 5679new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentText, new TextSpan(5, 1)), 5680new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(6, 1)), 5681new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentName, new TextSpan(7, 5)), 5682new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(14, 3)), 5683new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeName, new TextSpan(18, 4)), 5684new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(22, 1)), 5685new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeQuotes, new TextSpan(23, 1)), 5686new ClassifiedSpan(ClassificationTypeNames.Identifier, new TextSpan(24, 5)), 5687new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentAttributeQuotes, new TextSpan(29, 1)), 5688new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(30, 1)), 5689new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(31, 2)), 5690new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentName, new TextSpan(33, 5)), 5691new ClassifiedSpan(ClassificationTypeNames.XmlDocCommentDelimiter, new TextSpan(38, 1))
CodeActions\ApplyChangesOperationTests.cs (1)
247var context = new CodeRefactoringContext(document, new TextSpan(), refactorings.Add, CancellationToken.None);
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (6)
64await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, document, new TextSpan(0, document.GetTextAsync().Result.Length)); 92await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(ideEngineWorkspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length)); 128return await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, document, new TextSpan(0, document.GetTextAsync().Result.Length)); 174await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, sourceDocument, new TextSpan(0, sourceDocument.GetTextAsync().Result.Length)); 206var diagnostics = await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length)); 262var diagnostics = await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(ideEngineWorkspace, ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length));
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (2)
89yield return new TextSpan(start, end - start); 315var oldStatementTextSpan = new TextSpan(oldStatementPosition, oldStatementSource.Length);
ExtractMethod\SelectionValidatorTests.cs (1)
1605var span = new TextSpan(12, 1);
NavigateTo\NavigateToSearcherTests.cs (3)
110var result = new TestNavigateToSearchResult(workspace, new TextSpan(0, 0)); 148var result = new TestNavigateToSearchResult(workspace, new TextSpan(0, 0)); 230var result = new TestNavigateToSearchResult(workspace, new TextSpan(0, 0));
Squiggles\ErrorSquiggleProducerTests.cs (4)
323TestDiagnosticTagProducer<DiagnosticsSquiggleTaggerProvider, IErrorTag>.CreateDiagnosticData(document, new TextSpan(0, 0)), 324TestDiagnosticTagProducer<DiagnosticsSquiggleTaggerProvider, IErrorTag>.CreateDiagnosticData(document, new TextSpan(0, 1)))); 367TestDiagnosticTagProducer<DiagnosticsSquiggleTaggerProvider, IErrorTag>.CreateDiagnosticData(document, new TextSpan(0, 0)), 368TestDiagnosticTagProducer<DiagnosticsSquiggleTaggerProvider, IErrorTag>.CreateDiagnosticData(document, new TextSpan(0, 1))));
StringIndentation\StringIndentationTests.cs (1)
58changes.Add(new TextChange(new TextSpan(lineStart + offset - 1, 1), "|"));
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (7)
CodeGen\CodeGenTupleTest.cs (7)
5794var loc1 = Location.Create(tree, new TextSpan(0, 1)); 5905var loc1 = Location.Create(tree, new TextSpan(0, 1)); 5906var loc2 = Location.Create(tree, new TextSpan(1, 1)); 6346var loc1 = Location.Create(syntaxTree, new TextSpan(0, 1)); 6382var loc1 = Location.Create(syntaxTree, new TextSpan(0, 1)); 6383var loc2 = Location.Create(syntaxTree, new TextSpan(1, 1)); 22649var newText = text.WithChanges(new TextChange(new TextSpan(pos, 0), " ")); // add space before closing-paren
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (3)
Diagnostics\DiagnosticAnalyzerTests.cs (3)
1103var badSpan = new Text.TextSpan(100000, 10000); 3793var diagnosticSpan = new TextSpan(2, 2); 3834var diagnosticSpan = new TextSpan(2, 2);
Microsoft.CodeAnalysis.CSharp.Features (24)
ArrowExpressionClausePlacementCodeFixProvider.cs (1)
99edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (2)
128newLineEdit = new TextChange(new TextSpan(annotatedNewline.SpanStart, 0), annotatedNewline.ToString()); 198var newTextChangeText = formattedText.GetSubText(new TextSpan(newRange.Span.Start + amountToShift, newRange.NewLength)).ToString();
BraceMatching\BlockCommentBraceMatcher.cs (2)
34return new BraceMatchingResult(new TextSpan(trivia.SpanStart, "/*".Length), TextSpan.FromBounds(trivia.Span.End - "*/".Length, trivia.Span.End)); 38var startBrace = new TextSpan(trivia.FullSpan.Start, "/**".Length);
BraceMatching\StringLiteralBraceMatcher.cs (4)
67new TextSpan(token.SpanStart, 2), 68new TextSpan(token.Span.End - endTokenLength, endTokenLength)); 73new TextSpan(token.SpanStart, 1), 74new TextSpan(token.Span.End - endTokenLength, endTokenLength));
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Conversions.cs (4)
91builder.Add(new TextChange(new TextSpan(expression.SpanStart, 0), castText)); 103builder.Add(new TextChange(new TextSpan(dotToken.SpanStart, 1), ")")); 108builder.Add(new TextChange(new TextSpan(questionToken.Value.SpanStart, 0), ")")); 110builder.Add(new TextChange(new TextSpan(dotToken.SpanStart, 1), ""));
ConditionalExpressionPlacementCodeFixProvider.cs (1)
101edits.Add(new TextChange(new TextSpan(nextExpression.SpanStart, 0), token.Text + " "));
ConvertNamespaceTransform.cs (1)
156return new TextChange(new TextSpan(textLine.Start, commonIndentation), newText: "");
CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
71var nodeAtInsertPosition = syntaxRoot.FindNode(new TextSpan(openParenthesisPosition, 0));
ExtractInterface\CSharpExtractInterfaceService.cs (1)
49var span = new TextSpan(spanStart, spanEnd - spanStart);
GenerateType\CSharpGenerateTypeService.cs (2)
589? semanticModel.SyntaxTree.GetLocation(new TextSpan(lastMember.Span.End, 0)) 590: semanticModel.SyntaxTree.GetLocation(new TextSpan());
InlineHints\CSharpInlineTypeHintsService.cs (4)
64: new(type, new TextSpan(variableDesignation.Identifier.SpanStart, 0), textChange: null, trailingSpace: true); 80var span = new TextSpan(parameterNode.Identifier.SpanStart, 0); 99var span = new TextSpan(implicitNew.NewKeyword.Span.End, 0); 130return new TextSpan(normalSpan.SpanStart, 0);
Snippets\CSharpSnippetFunctionService.cs (1)
60var typeSpan = new TextSpan(caseGenerationLocation.Start + "case ".Length, fullyQualifiedTypeName.Length);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (3)
Semantics\BindingAwaitTests.cs (1)
27TextSpan span = new TextSpan(text.Length, 0);
Semantics\TopLevelStatementsTests.cs (1)
8779(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)
2623var loc1 = Location.Create(tree, new TextSpan(0, 1)); 2624var 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)
363var span = new TextSpan(oldIText.Length, 0); 378span = new TextSpan(oldIText.Length, 0);
Symbols\Source\NullablePublicAPITests.cs (1)
1771return comp.IsNullableAnalysisEnabledIn(tree, new Text.TextSpan(0, tree.Length));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (100)
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); 2377return new TextSpan(index, textToFind.Length);
Diagnostics\LocationsTests.cs (11)
71return new TextSpan(index, textToFind.Length); 89TextSpan xSpan = new TextSpan(sampleProgram.IndexOf("x;", StringComparison.Ordinal), 2); 90TextSpan xToCloseBraceSpan = new TextSpan(xSpan.Start, sampleProgram.IndexOf('}') - xSpan.Start + 1); 429SourceLocation loc1 = new SourceLocation(syntaxTree, new TextSpan(3, 4)); 430SourceLocation loc2 = new SourceLocation(syntaxTree, new TextSpan(3, 4)); 431SourceLocation loc3 = new SourceLocation(syntaxTree, new TextSpan(3, 7)); 432SourceLocation loc4 = new SourceLocation(tree2, new TextSpan(3, 4)); 490TextSpan span1 = new TextSpan(sampleProgram.IndexOf("i;", StringComparison.Ordinal), 2); 491TextSpan span2 = new TextSpan(sampleProgram.IndexOf("c;", StringComparison.Ordinal), 2); 504Location location = Location.Create("test.txt", new TextSpan(), new LinePositionSpan(new LinePosition(2, 1), new LinePosition(3, 1))); 514var sourceSpan = new TextSpan();
IncrementalParsing\IncrementalParsingTests.cs (39)
590var newText = text.WithChanges(new TextChange(new TextSpan(0, 8), "")); 604var newText = text.WithChanges(new TextChange(new TextSpan(0, 8), "")); 2373new TextChange(new TextSpan(str.IndexOf(" abc", StringComparison.Ordinal), 0), "//"), 2374new TextChange(new TextSpan(str.IndexOf(" 123", StringComparison.Ordinal), 0), "//"), 2375new TextChange(new TextSpan(str.IndexOf(" def", StringComparison.Ordinal), 0), "//")); 2395var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), "{")); 2411var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), @"System.Console.WriteLine(false) 2470var newText = oldText.WithChanges(new TextChange(new TextSpan(0, 0), @"if (false) 2525var span = new TextSpan(oldIText.Length, 0); 2539span = new TextSpan(oldIText.Length, 0); 2608var span = new TextSpan(currLen, 0); 2645var span = new TextSpan(text.LastIndexOf('x'), 0); 2725var change = new TextChange(new TextSpan(0, 0), items[1]); // Prepend 2823var span = new TextSpan(source.IndexOf(" A[]?"), 0); 2844var span = new TextSpan(src.IndexOf(":"), 1); 2865var span = new TextSpan(source.IndexOf(";"), 0); 2886var span = new TextSpan(source.IndexOf(";") + 1, 0); 2907var span = new TextSpan(source.IndexOf(";") + 1, 0); 2929var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 2953var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 2977var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3001var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3025var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3049var span = new TextSpan(source.IndexOf(substring) + substring.Length, 1); 3075var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3100var span = new TextSpan(source.IndexOf(substring), 0); 3126var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3152var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3170var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3188var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3206var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3220var span = new TextSpan(start: 0, length: 1); // delete first character 3234var span = new TextSpan(start: 0, length: 0); 3249var span = new TextSpan(start: source.IndexOf(substring), length: 3); // Goo[Goo] -> [Goo] 3286var span = new TextSpan(start: source.IndexOf(":") + 1, length: 0); 3316new TextChange(new TextSpan(locationOfChange, 0), "/*"), 3317new TextChange(new TextSpan(locationOfChange + widthOfChange, 0), "*/") 3326var newText = oldText.WithChanges(new TextChange(new TextSpan(locationOfChange, widthOfChange), "")); 3352var newText = oldText.WithChanges(new TextChange(new TextSpan(oldText.Length, 0), newChar.ToString()));
LexicalAndXml\XmlDocCommentTests.cs (2)
3214filterSpanWithinTree: new TextSpan(0, 0)); 3262filterSpanWithinTree: new TextSpan(0, 0));
Syntax\StructuredTriviaTests.cs (1)
93var resultList = identExpr.DescendantTokens(t => t.FullSpan.OverlapsWith(new TextSpan(3, 18)));
Syntax\SyntaxDiffingTests.cs (23)
33Assert.Equal(new TextSpan(0, 0), changes[0].Span); 53Assert.Equal(new TextSpan(6, 1), changes[0].Span); 75Assert.Equal(new TextSpan(6, 1), changes[0].Span); 77Assert.Equal(new TextSpan(18, 1), changes[1].Span); 90Assert.Equal(new TextSpan(0, 6), spans[0]); 95Assert.Equal(new TextSpan(0, 0), changes[0].Span); 108Assert.Equal(new TextSpan(0, 8), spans[0]); 113Assert.Equal(new TextSpan(0, 0), changes[0].Span); 127Assert.Equal(new TextSpan(11, 11), spans[0]); // its going to pick one of the two spans. 132Assert.Equal(new TextSpan(11, 0), changes[0].Span); 147Assert.Equal(new TextSpan(10, 12), spans[0]); 152Assert.Equal(new TextSpan(10, 0), changes[0].Span); 165Assert.Equal(new TextSpan(0, 14), spans[0]); 170Assert.Equal(new TextSpan(0, 0), changes[0].Span); 183Assert.Equal(new TextSpan(10, 7), spans[0]); // int X; 188Assert.Equal(new TextSpan(10, 0), changes[0].Span); 205Assert.Equal(new TextSpan(10, 7), changes[0].Span); 222Assert.Equal(new TextSpan(24, 7), changes[0].Span); 239Assert.Equal(new TextSpan(14, 1), changes[0].Span); 252Assert.Equal(new TextSpan(14, 6), spans[0]); // 'struct' 257Assert.Equal(new TextSpan(14, 5), changes[0].Span); 307var span = new TextSpan(index, 4); 372var span = new TextSpan(index, 6);
Syntax\SyntaxNodeTests.cs (13)
555var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(0, 16)).ToList(); 567var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(1, 14)).ToList(); 579var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(7, 17)).ToList(); 592var tokens = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(8, 15)).ToList(); 641var node = t1.GetCompilationUnitRoot().DescendantTokens(new TextSpan(6, 3)).First(); 720var EOFSpan = new TextSpan(root.FullSpan.End, 0); 729var nodeEndPositionSpan = new TextSpan(classDecl.FullSpan.End, 0); 739var invalidSpan = new TextSpan(100, 100); 741invalidSpan = new TextSpan(root.FullSpan.End - 1, 2); 743invalidSpan = new TextSpan(classDecl2.FullSpan.Start - 1, root.FullSpan.End); 745invalidSpan = new TextSpan(classDecl.FullSpan.End, root.FullSpan.End); 895var tree2 = tree1.WithChangedText(tree1.GetText().WithChanges(new TextChange(new TextSpan(22, 0), " return; "))); 2058var textSpan = new TextSpan(5, 10);
TextExtensions.cs (4)
25var span = new TextSpan(offset, length); 35var span = new TextSpan(offset, length); 45var span = new TextSpan(offset, length); 59var span = new TextSpan(offset, 0);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
CompilationTestUtils.cs (1)
454Assert.True(compilation.IsNullableAnalysisEnabledIn((CSharpSyntaxTree)tree, new TextSpan(0, tree.Length)));
SyntaxTreeExtensions.cs (1)
20var newFullText = oldFullText.WithChanges(new TextChange(new TextSpan(offset, length), newText));
Microsoft.CodeAnalysis.CSharp.Workspaces (10)
CSharpVirtualCharService.cs (6)
276charResults.Add((ch, new TextSpan(offset + index, 1))); 370result.Add((ch, new TextSpan(offset + index, 2))); 437result.Add(((char)uintChar, new TextSpan(startIndex + offset, 2 + 8))); 448result.Add(((char)highSurrogate, new TextSpan(pos, 0))); 449result.Add(((char)lowSurrogate, new TextSpan(pos, 2 + 8))); 477result.Add((character, new TextSpan(startIndex + offset, 2 + 4)));
LanguageServices\FixAllSpanMappingService\CSharpFixAllSpanMappingService.cs (1)
49fixAllSpan = new TextSpan(root.FullSpan.Start, firstTypeOrNamespaceDecl.FullSpan.Start - 1);
Rename\CSharpRenameRewriterLanguageService.cs (2)
111newSpan = new TextSpan(oldSpan.Start, newSpan.Length); 320_renameSpansTracker.AddComplexifiedSpan(_documentId, oldSpan, new TextSpan(oldSpan.Start, newSpan.Length), _modifiedSubSpans);
Simplification\Simplifiers\NameSimplifier.cs (1)
515issueSpan = new TextSpan(identifierToken.Span.End - 9, 9);
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (2)
Formatting\CSharpFormattingTestBase.cs (2)
33return AssertFormatAsync(code, code, SpecializedCollections.SingletonEnumerable(new TextSpan(0, code.Length)), debugMode, changedOptionSet, testWithTransformation, parseOptions); 44return AssertFormatAsync(expected, code, SpecializedCollections.SingletonEnumerable(new TextSpan(0, code.Length)), debugMode, changedOptionSet, testWithTransformation, parseOptions);
Microsoft.CodeAnalysis.EditorFeatures (23)
AutomaticCompletion\AbstractAutomaticLineEnderCommandHandler.cs (1)
206var insertChange = new TextChange(new TextSpan(insertPosition, 0), endingString);
Classification\Semantic\ClassificationUtilities.cs (1)
126var changedSpan = new TextSpan(range.Value.Span.Start, range.Value.NewLength);
CommentSelection\AbstractCommentSelectionBase.cs (1)
83=> textChanges.Add(new TextChange(new TextSpan(position, 0), text));
CommentSelection\AbstractToggleBlockCommentBase.cs (3)
266DeleteText(textChanges, new TextSpan(spanToRemove.Start, commentInfo.BlockCommentStartString.Length)); 272DeleteText(textChanges, new TextSpan(endMarkerPosition, commentInfo.BlockCommentEndString.Length)); 393commentedSpanOnSameLine = new TextSpan();
CommentSelection\CommentUncommentSelectionCommandHandler.cs (3)
274DeleteText(textChanges, new TextSpan(positionOfStart, info.BlockCommentStartString.Length)); 275DeleteText(textChanges, new TextSpan(positionOfEnd, info.BlockCommentEndString.Length)); 291DeleteText(textChanges, new TextSpan(line.Start.Position + lineText.IndexOf(info.SingleLineCommentString, StringComparison.Ordinal), info.SingleLineCommentString.Length));
CommentSelection\ToggleBlockCommentCommandHandler.cs (1)
61var blockCommentSpan = new TextSpan(openIdx, closeIdx + commentInfo.BlockCommentEndString.Length - openIdx);
EditorConfigSettings\Updater\NamingStyles\NamingStyleSettingsUpdater.cs (1)
50var endOfSection = new TextSpan(parseResult.Section.Span.End, 0);
EditorConfigSettings\Updater\NamingStyles\SourceTextExtensions.cs (2)
40var span = new TextSpan(existingSection.Span.End, 0); 46var span = new TextSpan(sourceText.Length, 0);
EditorConfigSettings\Updater\SettingsUpdateHelper.cs (3)
306return (editorConfigText.WithChanges(new TextChange(new TextSpan(lastValidSpecificHeaderSpanEnd.Value.Span.End, 0), newEntry)), lastValidHeaderSpanEnd, lastValidSpecificHeaderSpanEnd); 315return (editorConfigText.WithChanges(new TextChange(new TextSpan(lastValidHeaderSpanEnd.Value.Span.End, 0), newEntry)), lastValidHeaderSpanEnd, lastValidSpecificHeaderSpanEnd); 349var result = editorConfigText.WithChanges(new TextChange(new TextSpan(editorConfigText.Length, 0), prefix + newEntry));
InlineRename\AbstractEditorInlineRenameService.SymbolRenameInfo.cs (2)
108return new TextSpan(location.TextSpan.Start + index, searchName.Length); 128return new TextSpan(location.TextSpan.Start + position, replacementText.Length);
InlineRename\InlineRenameSession.OpenTextBufferManager.cs (1)
568if (textChanges.Count != 1 || textChanges[0].Span != new TextSpan(0, oldText.Length))
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (1)
185var textChange = new TextChange(new TextSpan(_snapshotSpan.Start, _snapshotSpan.Length), _stateMachine.TrackingSession.OriginalName);
Shared\Extensions\SpanExtensions.cs (1)
21=> new(span.Start, span.Length);
Tagging\AbstractAsynchronousTaggerProvider.TagSource_ProduceTags.cs (2)
89var textChangeRange = new TextChangeRange(new TextSpan(c.OldSpan.Start, c.OldSpan.Length), c.NewLength); 101textChangeRanges.Add(new TextChangeRange(new TextSpan(c.OldSpan.Start, c.OldSpan.Length), c.NewLength));
Microsoft.CodeAnalysis.EditorFeatures.Cocoa (4)
Snippets\CSharpSnippets\SnippetFunctions\SnippetFunctionGenerateSwitchCases.cs (2)
82var textChange = new TextChange(new TextSpan(startPosition, endPosition - startPosition), str); 83var typeSpanToAnnotate = new TextSpan(startPosition + "case ".Length, fullyQualifiedTypeName.Length);
Snippets\SnippetFunctions\AbstractSnippetFunctionSimpleTypeName.cs (2)
66var originalTextSpan = new TextSpan(subjectBufferFieldSpan.Start, subjectBufferFieldSpan.Length); 67updatedTextSpan = new TextSpan(subjectBufferFieldSpan.Start, _fullyQualifiedName.Length);
Microsoft.CodeAnalysis.EditorFeatures.DiagnosticsTests.Utilities (1)
CodeActions\AbstractCodeActionOrUserDiagnosticTest.cs (1)
915span = new TextSpan(hostDocument.CursorPosition.Value, 0);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (23)
BraceHighlighting\MultiCharacterBraceHighlightingTests.cs (8)
60return new BraceMatchingResult(new TextSpan(position, 2), new TextSpan(secondAt, 2)); 69return new BraceMatchingResult(new TextSpan(position - 1, 2), new TextSpan(secondAt, 2)); 75return new BraceMatchingResult(new TextSpan(lessThan, 2), new TextSpan(position, 2)); 84return new BraceMatchingResult(new TextSpan(lessThan, 2), new TextSpan(position - 1, 2));
BracePairs\AbstractBracePairsTests.cs (1)
37await service.AddBracePairsAsync(document, new TextSpan(0, text.Length), bracePairs, CancellationToken.None);
Classification\AbstractClassifierTests.cs (2)
50span = new TextSpan(start, length); 63span = new TextSpan(0, allCode.Length);
Completion\AbstractCompletionProviderTests.cs (3)
613var textChange = new TextChange(new TextSpan(firstItem.Span.End, 0), commitChar.ToString()); 1064var assertText = "'" + text.ToString(new TextSpan(position, 1)) + "' expected to be textual trigger character"; 1069var assertText = "'" + text.ToString(new TextSpan(position, 1)) + "' expected to NOT be textual trigger character";
EditAndContinue\ActiveStatementsDescription.cs (4)
227var span = markedSyntax.Length != 0 ? new TextSpan(absoluteOffset, markedSyntax.Length) : new TextSpan(); 263result[id] = new TextSpan(span.Index, span.Length); 293result[activeStatementId][exceptionRegionId] = new TextSpan(exceptionRegion.Index + start, length);
EditAndContinue\DeclaratorMapDescription.cs (1)
59result[id0][id1] = new TextSpan(stmt.Index, stmt.Length);
ExtractInterface\ExtractInterfaceTestState.cs (1)
107new TextSpan(_testDocument.CursorPosition.Value, 1),
LanguageServer\AbstractLanguageServerProtocolTests.cs (1)
87mappedResult = spans.Select(span => new MappedSpanResult(s_mappedFilePath, s_mappedLinePosition, new TextSpan(0, 5))).ToImmutableArray();
ReassignedVariable\AbstractReassignedVariableTests.cs (1)
32var result = await service.GetLocationsAsync(document, new TextSpan(0, text.Length), CancellationToken.None);
Workspaces\TestWorkspace.cs (1)
672tempMappedMarkupSpans[key].Add(new TextSpan(spanStartLocation!.Value, spanEndLocationExclusive!.Value - spanStartLocation.Value));
Microsoft.CodeAnalysis.EditorFeatures.Text (6)
Extensions.SnapshotSourceText.cs (4)
304return new[] { new TextChangeRange(new TextSpan(0, oldText.Length), this.Length) }; 355return ImmutableArray.Create(new TextChangeRange(new TextSpan(0, oldTextLength), this.Length)); 441return new TextChangeRange(new TextSpan(change.OldSpan.Start, change.OldSpan.Length), change.NewLength); 445return new TextChangeRange(new TextSpan(change.NewSpan.Start, change.NewSpan.Length), change.OldLength);
Extensions.TextBufferContainer.cs (1)
113var changes = ImmutableArray.CreateRange(args.Changes.Select(c => new TextChangeRange(new TextSpan(c.OldSpan.Start, c.OldSpan.Length), c.NewLength)));
Shared\Extensions\TextSpanExtensions.cs (1)
22=> new TextSpan(textSpan.Start + offset, textSpan.Length);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (112)
CodeFixes\CodeFixServiceTests.cs (1)
858var span = new TextSpan(line.Start, line.End);
CodeGeneration\CodeGenerationTests.cs (1)
639var destSpan = new TextSpan();
CommentSelection\CommentUncommentSelectionCommandHandlerTests.cs (78)
103new TextChange(new TextSpan(8, 0), "/*"), 104new TextChange(new TextSpan(14, 0), "*/"), 117new TextChange(new TextSpan(0, 0), "//"), 118new TextChange(new TextSpan(16, 0), "//"), 145new TextChange(new TextSpan(20, 0), "//"), 146new TextChange(new TextSpan(34, 0), "//"), 147new TextChange(new TextSpan(41, 0), "//"), 171new TextChange(new TextSpan(0, 0), "//"), 172new TextChange(new TextSpan(9, 0), "//"), 173new TextChange(new TextSpan(12, 0), "//"), 174new TextChange(new TextSpan(30, 0), "//"), 185new TextChange(new TextSpan(0, 0), "//"), 186new TextChange(new TextSpan(11, 0), "//"), 187new TextChange(new TextSpan(16, 0), "//"), 188new TextChange(new TextSpan(36, 0), "//"), 211new TextChange(new TextSpan(20, 0), "//"), 212new TextChange(new TextSpan(34, 0), "//"), 213new TextChange(new TextSpan(41, 0), "//"), 232new TextChange(new TextSpan(20, 0), "//"), 233new TextChange(new TextSpan(34, 0), "//"), 234new TextChange(new TextSpan(41, 0), "//"), 254new TextChange(new TextSpan(20, 0), "//"), 255new TextChange(new TextSpan(34, 0), "//"), 256new TextChange(new TextSpan(41, 0), "//"), 277new TextChange(new TextSpan(20, 0), "/*"), 278new TextChange(new TextSpan(21, 0), "*/"), 279new TextChange(new TextSpan(34, 0), "//"), 280new TextChange(new TextSpan(41, 0), "/*"), 281new TextChange(new TextSpan(42, 0), "*/"), 282new TextChange(new TextSpan(52, 0), "//"), 302new TextChange(new TextSpan(20, 0), "//"), 303new TextChange(new TextSpan(34, 0), "//"), 304new TextChange(new TextSpan(41, 0), "//"), 313UncommentSelection(code, new[] { new TextChange(new TextSpan(0, 2), string.Empty) }, Span.FromBounds(0, 6), supportBlockComments: true); 322new TextChange(new TextSpan(7, 2), string.Empty), 323new TextChange(new TextSpan(30, 2), string.Empty), 335new TextChange(new TextSpan(11, 2), string.Empty), 336new TextChange(new TextSpan(34, 2), string.Empty), 359new TextChange(new TextSpan(18, 2), string.Empty), 360new TextChange(new TextSpan(34, 2), string.Empty), 361new TextChange(new TextSpan(47, 2), string.Empty), 362new TextChange(new TextSpan(68, 2), string.Empty), 363new TextChange(new TextSpan(119, 2), string.Empty), 364new TextChange(new TextSpan(128, 2), string.Empty), 385new TextChange(new TextSpan(20, 2), string.Empty), 386new TextChange(new TextSpan(23, 2), string.Empty), 387new TextChange(new TextSpan(38, 2), string.Empty), 388new TextChange(new TextSpan(49, 2), string.Empty), 389new TextChange(new TextSpan(52, 2), string.Empty), 390new TextChange(new TextSpan(64, 2), string.Empty), 411new TextChange(new TextSpan(2, 2), string.Empty), 412new TextChange(new TextSpan(19, 2), string.Empty), 413new TextChange(new TextSpan(26, 2), string.Empty), 433new TextChange(new TextSpan(6, 2), string.Empty), 434new TextChange(new TextSpan(16, 2), string.Empty) 447new TextChange(new TextSpan(19, 2), string.Empty), 448new TextChange(new TextSpan(29, 2), string.Empty) 461new TextChange(new TextSpan(0, 2), string.Empty), 462new TextChange(new TextSpan(15, 2), string.Empty) 475new TextChange(new TextSpan(0, 2), string.Empty), 476new TextChange(new TextSpan(15, 2), string.Empty) 513new TextChange(new TextSpan(18, 2), string.Empty), 514new TextChange(new TextSpan(112, 2), string.Empty), 544new TextChange(new TextSpan(20, 2), string.Empty), 545new TextChange(new TextSpan(114, 2), string.Empty), 573new TextChange(new TextSpan(18, 2), string.Empty), 574new TextChange(new TextSpan(112, 2), string.Empty), 602new TextChange(new TextSpan(18, 2), string.Empty), 603new TextChange(new TextSpan(112, 2), string.Empty), 631new TextChange(new TextSpan(55, 2), string.Empty), 659new TextChange(new TextSpan(55, 2), string.Empty), 687new TextChange(new TextSpan(18, 2), string.Empty), 688new TextChange(new TextSpan(28, 2), string.Empty), 689new TextChange(new TextSpan(44, 2), string.Empty), 690new TextChange(new TextSpan(53, 2), string.Empty), 691new TextChange(new TextSpan(78, 2), string.Empty), 692new TextChange(new TextSpan(109, 2), string.Empty), 693new TextChange(new TextSpan(118, 2), string.Empty),
Diagnostics\DiagnosticAnalyzerServiceTests.cs (2)
635var diagnosticSpan = new TextSpan(2, 2); 1151var generator = new DiagnosticProducingGenerator(c => Location.Create(c.Compilation.SyntaxTrees.Single(), new TextSpan(0, 10)));
Diagnostics\DiagnosticDataTests.cs (10)
31await VerifyTextSpanAsync(code, 10, 10, 20, 20, new TextSpan(0, 0)); 40await VerifyTextSpanAsync(code, 30, 30, 40, 40, new TextSpan(code.Length, 0)); 49await VerifyTextSpanAsync(code, 0, 30, 40, 40, new TextSpan(code.Length, 0)); 58await VerifyTextSpanAsync(code, 0, 30, 0, 40, new TextSpan(code.Length, 0)); 67await VerifyTextSpanAsync(code, 1, 30, 1, 40, new TextSpan(code.Length, 0)); 76await VerifyTextSpanAsync(code, 1, 30, 1, 40, new TextSpan(code.Length, 0)); 85await VerifyTextSpanAsync(code, 1, 30, 2, 40, new TextSpan(code.Length, 0)); 94await VerifyTextSpanAsync(code, 1, 0, 1, 2, new TextSpan(code.Length, 0)); 109await VerifyTextSpanAsync(code, 3, 10, 3, 11, new TextSpan(28, 1)); 192await VerifyTextSpanAsync(content, 3, 10, 3, 11, new TextSpan(28, 1));
Diagnostics\DiagnosticsClassificationTaggerProviderTests.cs (4)
94var primaryLocation = Location.Create(c.Tree, new TextSpan(0, 10)); 105var additionalLocations = ImmutableArray.Create(Location.Create(c.Tree, new TextSpan(0, 10))); 107Location.Create(c.Tree, new TextSpan(0, 1)), 108Location.Create(c.Tree, new TextSpan(9, 1)));
Diagnostics\DiagnosticsSquiggleTaggerProviderTests.cs (2)
68workspace.TryApplyChanges(document.WithText(text.WithChanges(new TextChange(new TextSpan(text.Length - 1, 1), string.Empty))).Project.Solution); 229c.ReportDiagnostic(Diagnostic.Create(_rule, Location.Create(c.Tree, new TextSpan(0, 1))));
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (1)
373=> new TextSpan(str.IndexOf(substr), substr.Length);
EditorAdapter\TextSnapshotImplementationTest.cs (4)
44Assert.Equal(new TextSpan(0, 3), line1.Span); 45Assert.Equal(new TextSpan(0, 5), line1.SpanIncludingLineBreak); 55Assert.Equal(new TextSpan(5, 3), line1.Span); 56Assert.Equal(new TextSpan(5, 3), line1.SpanIncludingLineBreak);
EditorAdapter\TextSpanExtensionsTest.cs (3)
24var textSpan = new TextSpan(start, length); 39var textSpan = new TextSpan(0, 5); 51var textSpan = new TextSpan(0, 10);
Preview\PreviewWorkspaceTests.cs (1)
173var newDocument = oldDocument.WithText(oldText.WithChanges(new TextChange(new TextSpan(0, oldText.Length), "class C { }")));
RenameTracking\RenameTrackingTestState.cs (1)
172var span = textSpan ?? new TextSpan(_view.Caret.Position.BufferPosition, 0);
Snippets\RoslynLSPSnippetConvertTests.cs (3)
407ImmutableArray<SnippetPlaceholder>.Empty, new TextChange(new TextSpan(8, 0), "quux"), triggerLocation: 12, CancellationToken.None).Result; 418ImmutableArray<SnippetPlaceholder>.Empty, new TextChange(new TextSpan(4, 4), "bar quux"), triggerLocation: 12, CancellationToken.None).Result; 495var textChange = new TextChange(new TextSpan(stringSpan.Start, 0), text.Substring(stringSpan.Start, stringSpan.Length));
ValueTracking\AbstractBaseValueTrackingTests.cs (1)
31var textSpan = new TextSpan(cursorDocument.CursorPosition!.Value, 0);
Microsoft.CodeAnalysis.EditorFeatures.Wpf (1)
InlineRename\UI\InlineRenameAdornmentManager.cs (1)
130var identifierSelection = new TextSpan(start, length);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (24)
Classification\ClassificationTests.vb (5)
73Assert.Equal(New TextSpan(0, referenceSpan.Length), spansAndHighlightSpan.HighlightSpan) 97document, New TextSpan(0, text.Length), ClassificationOptions.Default, includeAdditiveSpans:=False, CancellationToken.None) 158document, New TextSpan(0, text.Length), ClassificationOptions.Default, includeAdditiveSpans:=False, CancellationToken.None) 331Await classificationService.AddSyntacticClassificationsAsync(wrongDocument, New TextSpan(0, text.Length), result, CancellationToken.None) 332Await classificationService.AddSemanticClassificationsAsync(wrongDocument, New TextSpan(0, text.Length), options:=Nothing, result, CancellationToken.None)
CodeDefinitionWindow\CrossLanguageCodeDefinitionWindowTests.vb (1)
69Return New TextSpan(5, 2)
Diagnostics\DiagnosticServiceTests.vb (3)
351Dim diagnostics1 = diagnosticService.GetDiagnosticsForSpanAsync(p1.Documents.Single(), New TextSpan(0, p1.Documents.Single().GetTextAsync().Result.Length)).Result 356Dim diagnostics2 = diagnosticService.GetDiagnosticsForSpanAsync(p2.Documents.Single(), New TextSpan(0, p2.Documents.Single().GetTextAsync().Result.Length)).Result 1387Dim spanAtCaret = New TextSpan(diagnostic.DataLocation.UnmappedFileSpan.GetClampedTextSpan(text).Start, 0)
FindReferences\FindReferencesTests.vb (2)
443builder.Append(text.GetSubText(New TextSpan(position, span.Start - position))) 450builder.Append(text.GetSubText(New TextSpan(position, text.Length - position)))
GoToDefinition\GoToDefinitionCommandHandlerTests.vb (4)
70Assert.Equal(New TextSpan(78, 2), mockDocumentNavigationService._span) 78Assert.Equal(New TextSpan(121, 2), mockDocumentNavigationService._span) 112Assert.Equal(New TextSpan(4, 1), mockDocumentNavigationService._span) 162Assert.Equal(New TextSpan(22, 1), mockDocumentNavigationService._span)
InlineHints\AbstractInlineHintsTests.vb (2)
33Dim inlineHints = Await tagService.GetInlineHintsAsync(document, New Text.TextSpan(0, snapshot.Length), options, displayOptions, CancellationToken.None) 93Dim typeHints = Await tagService.GetInlineHintsAsync(document, New Text.TextSpan(0, snapshot.Length), options, displayOptions, CancellationToken.None)
IntelliSense\CSharpCompletionCommandHandlerTests.vb (1)
8218New TextChange(New TextSpan(0, _caretPosition), newText))
IntelliSense\IntellisenseQuickInfoBuilderTests.vb (3)
26New TextSpan(0, 0), 118New TextSpan(0, 0), 203New TextSpan(0, 0),
LanguageServices\SyntaxFactsServiceTests.vb (1)
212Dim node = root.FindNode(New TextSpan(cursorPosition, 0))
NavigationBar\TestHelpers.vb (1)
100Dim contextLocation = (Await document.GetSyntaxTreeAsync()).GetLocation(New TextSpan(0, 0))
PasteTracking\PasteTrackingTestState.vb (1)
76Return New TextSpan(snapshotSpan.Start, snapshotSpan.Length)
Microsoft.CodeAnalysis.Features (56)
AbstractMultipleBlankLinesDiagnosticAnalyzer.cs (1)
78Location.Create(badTrivia.SyntaxTree!, new TextSpan(badTrivia.SpanStart, 0)),
AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
354new Text.TextSpan(
AddFileBanner\AbstractAddFileBannerCodeRefactoringProvider.cs (1)
94new Text.TextSpan(position, length: 0));
ClassifiedSpansAndHighlightSpanFactory.cs (1)
74var highlightSpan = new TextSpan(
CodeFixes\Configuration\ConfigurationUpdater.cs (3)
737var textChange = new TextChange(new TextSpan(lastValidSpecificHeaderSpanEnd.Value.Span.End, 0), newEntry); 747var textChange = new TextChange(new TextSpan(lastValidHeaderSpanEnd.Value.Span.End, 0), newEntry); 785var textChange = new TextChange(new TextSpan(result.Length, 0), prefix + newEntry);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs (2)
162currentSpan = new TextSpan(newStart, currentSpan.Length); 169currentSpan = new TextSpan(currentSpan.Start, newLength);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaHelpers.cs (2)
46diagnosticSpan = new TextSpan(diagnosticSpan.Start + spanChange, diagnosticSpan.Length); 224var subtreeRoot = root.FindNode(new TextSpan(previousOfStart.FullSpan.Start, spanEnd - previousOfStart.FullSpan.Start));
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (1)
208var spanToCheck = new TextSpan(
CodeLens\CodeLensReferencesService.cs (1)
144var referenceSpan = new TextSpan(spanStart, token.Span.Length);
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (1)
134.Select(changes => new TextSpan(changes.Key.Start, changes.Sum(change => change.NewText!.Length)));
Common\TaggedText.cs (1)
263yield return new ClassifiedSpan(new TextSpan(index, text.Length), classificationTypeName);
Completion\Providers\AbstractAwaitCompletionProvider.cs (2)
186builder.Add(new TextChange(new TextSpan(GetSpanStart(declaration), 0), syntaxFacts.GetText(syntaxKinds.AsyncKeyword) + " ")); 203builder.Add(new TextChange(new TextSpan(expr.SpanStart, 0), _awaitKeyword + " "));
Completion\Utilities.cs (2)
22return new TextChange(new TextSpan(0, 0), ""); 40var totalNewSpan = new TextSpan(totalOldSpan.Start, totalOldSpan.Length + sumOfDeltas);
Debugging\AbstractBreakpointResolver.cs (1)
84var textSpan = new TextSpan(location.SourceSpan.Start, 0);
Debugging\BreakpointResolutionResult.cs (1)
28=> new(document, new TextSpan(), locationNameOpt, isLineBreakpoint: true);
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (3)
75var replaceSpan = new TextSpan(token.Span.Start, spanToReplaceLength); 243replaceSpan = new TextSpan(start, currentLinePosition.Value - start); 281var replaceSpan = new TextSpan(token.Span.Start, 0);
EmbeddedLanguages\DateAndTime\DateAndTimeEmbeddedCompletionProvider.cs (1)
226new 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 (3)
398literalToken.VirtualChars.GetSubSequence(new TextSpan(0, 1)), 592? new TextSpan(_lexer.Text.Last().Span.End, 0) 593: new TextSpan(token.VirtualChars[0].Span.Start, 0);
EmbeddedLanguages\Json\JsonParser.StrictSyntaxChecker.cs (1)
158return new EmbeddedDiagnostic(FeaturesResources.Value_required, new TextSpan(node.ColonToken.VirtualChars[0].Span.End, 0));
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexEmbeddedCompletionProvider.cs (2)
291new TextChange(new TextSpan(context.Position, 0), name), newPosition: null))); 459new 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\RegularExpressions\RegexParser.cs (2)
713? new TextSpan(_lexer.Text.Last().Span.End, 0) 714: new TextSpan(token.VirtualChars[0].Span.Start, 0);
EmbeddedLanguages\StackFrame\StackFrameLexer.cs (1)
125return CreateToken(GetKind(ch), Text.GetSubSequence(new TextSpan(Position, 1)));
ExternalAccess\VSTypeScript\VSTypeScriptTaskListService.cs (1)
45var textSpan = new TextSpan(Math.Min(text.Length, Math.Max(0, d.Position)), 0);
FileHeader.cs (2)
102return Location.Create(syntaxTree, new TextSpan(_fileHeaderStart, 0)); 105return Location.Create(syntaxTree, new TextSpan(_fileHeaderStart, _commentPrefixLength));
FormattingAnalyzerHelper.cs (4)
41if (oldText.GetSubText(new TextSpan(change.Span.Start + offset, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 43change = new TextChange(new TextSpan(change.Span.Start, offset), ""); 50if (oldText.GetSubText(new TextSpan(change.Span.Start, change.NewText.Length)).ContentEquals(SourceText.From(change.NewText))) 52change = new TextChange(new TextSpan(change.Span.Start + change.NewText.Length, offset), "");
GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (1)
40document, new TextSpan(typeName.Value.Span.Start, 0), context.Options, forRefactoring: false, cancellationToken).ConfigureAwait(false);
GenerateType\AbstractGenerateTypeService.Editor.cs (1)
302new CodeGenerationContext(newSemanticModel.SyntaxTree.GetLocation(new TextSpan())),
Highlighting\Keywords\AbstractKeywordHighlighter.cs (1)
75=> new(position, 0);
InlineHints\AbstractInlineParameterNameHintsService.cs (1)
108var textSpan = new TextSpan(position, 0);
MetadataAsSource\AbstractMetadataAsSourceService.cs (1)
46contextLocation: newSemanticModel.SyntaxTree.GetLocation(new TextSpan()),
MetadataAsSource\MetadataAsSourceHelpers.cs (1)
75location = Location.Create(tree, new TextSpan(0, 0));
MoveToNamespace\AbstractMoveToNamespaceService.cs (1)
254var moveSpan = new TextSpan(container.FullSpan.Start, 0);
Shared\Utilities\ExtractTypeHelpers.cs (1)
69contextLocation: newSemanticModel.SyntaxTree.GetLocation(new TextSpan()),
Snippets\SnippetFunctionService.cs (1)
41var updatedTextSpan = new TextSpan(fieldSpan.Start, fullyQualifiedTypeName.Length);
SplitOrMergeIfStatements\AbstractMergeIfStatementsCodeRefactoringProvider.cs (1)
60new TextSpan(upperIfOrElseIfSpan.Start, lowerIfOrElseIfSpan.End));
TaskList\AbstractTaskListService.cs (2)
114var location = document.SyntaxTree.GetLocation(new TextSpan(position, 0)); 160var endMessage = text.ToString(new TextSpan(endLine.Start, length));
Wrapping\AbstractCodeActionComputer.cs (1)
91var newSourceText = OriginalSourceText.WithChanges(new TextChange(new TextSpan(nodeOrToken.Span.End, 0), newLine));
Microsoft.CodeAnalysis.LanguageServer.Protocol (16)
Features\CodeCleanup\AbstractCodeCleanupService.cs (2)
176var textSpan = new TextSpan(0, tree.Length); 197var range = new TextSpan(0, tree.Length);
Features\CodeFixes\CodeFixService.cs (1)
302var textSpan = new TextSpan(0, text.Length);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer.cs (1)
385var newSpan = new TextSpan(start, start >= tree.Length ? 0 : diagnosticSpan.Length);
Handler\Breakpoints\ValidateBreakableRangeHandler.cs (3)
81var breakpointSpan = result.IsLineBreakpoint ? new TextSpan(span.Start, length: 0) : result.TextSpan; 102var secondResult = await breakpointService.ResolveBreakpointAsync(document, new TextSpan(span.End, length: 0), cancellationToken).ConfigureAwait(false); 105breakpointSpan = secondResult.IsLineBreakpoint ? new TextSpan(span.Start, length: 0) : secondResult.TextSpan;
Handler\Formatting\AbstractFormatDocumentHandlerBase.cs (1)
38var rangeSpan = (range != null) ? ProtocolConversions.RangeToTextSpan(range, text) : new TextSpan(0, root.FullSpan.Length);
Handler\InlineCompletions\InlineCompletionsHandler.cs (6)
160snippetEndPosition = GetAdjustedSpan(formattingChanges, new TextSpan(snippetEndPosition, 0)).Start; 194return new TextSpan(originalSpan.Start + amountToAdjust, originalSpan.Length); 199var offsetInSnippet = new TextSpan(positionInFullText - snippetPositionInFullText, length); 242part = await functionPart.WithSnippetFunctionResultAsync(documentWithDefaultSnippet, new TextSpan(locationInDefaultSnippet, part.DefaultText.Length), simplifierOptions, cancellationToken).ConfigureAwait(false); 248var fieldSpan = new TextSpan(locationInFinalSnippet, part.DefaultText.Length); 253caretSpan = new TextSpan(locationInFinalSnippet, cursorPart.DefaultText.Length);
Handler\OnAutoInsert\OnAutoInsertHandler.cs (1)
208var indentedText = textToIndent.WithChanges(new TextChange(new TextSpan(lineToIndent.End, 0), indentText));
Handler\SemanticTokens\SemanticTokensHelpers.cs (1)
208textSpan = new TextSpan(line.Start, endOffSet);
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (6)
Completion\CompletionResolveTests.cs (1)
456var textChange = new TextChange(span: new TextSpan(start: 77, length: 9), newText: @"public override void M()
Diagnostics\AbstractPullDiagnosticTestsBase.cs (1)
208var lineInfo = sourceText.Lines.GetLinePositionSpan(new TextSpan(position, 0));
Diagnostics\PullDiagnosticTests.cs (3)
676var generator = new DiagnosticProducingGenerator(context => Location.Create(context.Compilation.SyntaxTrees.Single(), new TextSpan(0, 10))); 1003var generator = new DiagnosticProducingGenerator(context => Location.Create(context.Compilation.SyntaxTrees.Single(), new TextSpan(0, 10))); 1024new TextSpan(0, 10)));
SpellCheck\SpellCheckTests.cs (1)
606var lineInfo = sourceText.Lines.GetLinePositionSpan(new TextSpan(position, 0));
Microsoft.CodeAnalysis.Remote.ServiceHub (2)
Services\SemanticClassification\RemoteSemanticClassificationService.Caching.cs (2)
139await classificationService.AddSemanticClassificationsAsync(document, new TextSpan(0, text.Length), options, classifiedSpans, cancellationToken).ConfigureAwait(false); 306classifiedSpans.Add(new ClassifiedSpan(classificationTypes[typeIndex], new TextSpan(start, length)));
Microsoft.CodeAnalysis.Test.Utilities (3)
Diagnostics\DiagnosticsHelper.cs (1)
22return new TextSpan(match.Index, match.Length);
MarkedSource\SourceWithMarkedNodes.cs (2)
66yield return new MarkedSpan(new TextSpan(absoluteOffset, markedSyntax.Length), new TextSpan(match.Index, match.Length), tagName.Value, parsedKind, id, parentId);
Microsoft.CodeAnalysis.UnitTests (302)
Diagnostics\SarifErrorLoggerTests.cs (1)
35var span = new TextSpan(0, 0);
Text\SourceTextTests.cs (2)
181var span = new TextSpan(0, 1); 333select new object[] { new TextSpan(start, length) };
Text\StringText_LineTest.cs (11)
20var span = new TextSpan(0, 3); 53var line = TextLine.FromSpan(text, new TextSpan(0, 3)); 62Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(0, 0))); 69Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(0, 3))); 76Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(1, 5))); 84var line = TextLine.FromSpan(text, new TextSpan(start, 0)); 98var line = TextLine.FromSpan(text, new TextSpan(0, 0)); 107Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(1, 10))); 114Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(-1, 2))); 121Assert.Throws<ArgumentOutOfRangeException>(() => TextLine.FromSpan(text, new TextSpan(7, 0))); 128Assert.Throws<ArgumentNullException>(() => TextLine.FromSpan(null, new TextSpan(0, 2)));
Text\TextChangeRangeTest.cs (8)
20() => { var notUsed = new TextChangeRange(new TextSpan(), -1); }); 26var span = new TextSpan(2, 50); 39EqualityUnit.Create(new TextChangeRange(new TextSpan(42, 2), 13)).WithEqualValues(new TextChangeRange(new TextSpan(42, 2), 13)), 40EqualityUnit.Create(new TextChangeRange(new TextSpan(42, 2), 13)).WithNotEqualValues(new TextChangeRange(new TextSpan(42, 2), 5)), 41EqualityUnit.Create(new TextChangeRange(new TextSpan(42, 2), 13)).WithNotEqualValues(new TextChangeRange(new TextSpan(42, 4), 13)));
Text\TextChangeTests.cs (193)
41var subText = text.GetSubText(new TextSpan(0, 5)); 49var subText = text.GetSubText(new TextSpan(6, 5)); 57var subText = text.GetSubText(new TextSpan(4, 3)); 88new TextChange(new TextSpan(0, 5), "Halo"), 89new TextChange(new TextSpan(6, 5), "Universe")); 100new TextChange(new TextSpan(0, 5), "Halo"), 101new TextChange(new TextSpan(3, 5), "Universe") 113new TextChange(new TextSpan(6, 5), "Universe"), 114new TextChange(new TextSpan(0, 5), "Halo") 127new TextChange(new TextSpan(6, 7), "Universe"), 128new TextChange(new TextSpan(0, 5), "Halo") 142new TextChange(new TextSpan(6, 0), "Super "), 143new TextChange(new TextSpan(6, 0), "Spectacular ")); 154new TextChange(new TextSpan(6, 0), "Super "), 155new TextChange(new TextSpan(6, 2), "Vu")); 166new TextChange(new TextSpan(6, 2), "Vu"), 167new TextChange(new TextSpan(6, 0), "Super ") 180new TextChange(new TextSpan(4, 1), string.Empty), 181new TextChange(new TextSpan(5, 1), string.Empty)); 191new TextChange(new TextSpan(4, 1), string.Empty), 192new TextChange(new TextSpan(6, 5), "Universe")); 194var subText = newText.GetSubText(new TextSpan(3, 4)); 206new TextChange(new TextSpan(4, 1), string.Empty)); 216new TextChange(new TextSpan(6, 5), "Universe")); 233new TextChange(new TextSpan(0, 1), "[1]"), 234new TextChange(new TextSpan(1, 1), "[2]"), 235new TextChange(new TextSpan(5, 0), "[3]"), 236new TextChange(new TextSpan(25, 2), "[4]") 278new TextChange(new TextSpan(8, 2), "IN"), 279new TextChange(new TextSpan(15, 2), "IN")); 286new TextChange(new TextSpan(8, 2), new string('a', 10)), 287new TextChange(new TextSpan(15, 2), new string('a', 10))); 294new TextChange(new TextSpan(8, 2), "\r\n"), 295new TextChange(new TextSpan(15, 2), "\r\n")); 302new TextChange(new TextSpan(6, 0), "aa\r"), 303new TextChange(new TextSpan(11, 0), "aa\r")); 310new TextChange(new TextSpan(6, 0), "aa\n"), 311new TextChange(new TextSpan(11, 0), "aa\n")); 318new TextChange(new TextSpan(4, 4), "aaaaaa"), 319new TextChange(new TextSpan(15, 4), "aaaaaa")); 326new TextChange(new TextSpan(5, 0), "aaaaaa")); 333new TextChange(new TextSpan(5, 0), "\naaaaaa\r")); 340new TextChange(new TextSpan(21, 0), "Line4\r\n"), 341new TextChange(new TextSpan(21, 0), "Line5\r\n")); 392var subtext = text.GetSubText(new TextSpan(5, 10)); 403var newText = text.Replace(new TextSpan(0, 20), ""); 414var newText = text.Replace(new TextSpan(10, 6), ""); 426var newText = text.Replace(new TextSpan(10, 1), ""); 442var textWithSegments = text.Replace(new TextSpan(10, 0), "*"); 459var textWithSegments = text.Replace(new TextSpan(10, 0), "*"); 463var textWithFewerSegments = textWithSegments.Replace(new TextSpan(9, 3), ""); 479var textWithSegments = text.Replace(new TextSpan(0, text.Length), ""); 636var change1 = original.WithChanges(new TextChange(new TextSpan(5, 6), string.Empty)); // prepare a ChangedText instance 647var change1 = original.WithChanges(new TextChange(new TextSpan(5, 6), string.Empty)); // prepare a ChangedText instance 648var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 0), string.Empty)); // this should not cause exception 657var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 658var change2 = change1.WithChanges(new TextChange(new TextSpan(7, 3), "oo")); 663Assert.Equal(new TextSpan(6, 0), changes[0].Span); 672var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 673var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 0), "bb")); 678Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "abba") }, changes); 686var change1 = original.WithChanges(new TextChange(new TextSpan(1, 1), "aaa")); 687var change2 = change1.WithChanges(new TextChange(new TextSpan(3, 0), "bb")); 692Assert.Equal(new[] { new TextChange(new TextSpan(1, 1), "aabba") }, changes); 700var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 701var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 1), "bb")); 706Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "abb") }, changes); 713var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 714var change2 = change1.WithChanges(new TextChange(new TextSpan(2, 14), "ar")); 719Assert.Equal(new TextSpan(2, 8), changes[0].Span); 727var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 728var change2 = change1.WithChanges(new TextChange(new TextSpan(4, 6), " Bel")); 733Assert.Equal(new TextSpan(4, 2), changes[0].Span); 741var change1 = original.WithChanges(new TextChange(new TextSpan(6, 0), "Cruel ")); 742var change2 = change1.WithChanges(new TextChange(new TextSpan(7, 6), "wazy V")); 747Assert.Equal(new TextSpan(6, 1), changes[0].Span); 755var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 756var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 0), "bb")); 761Assert.Equal(new[] { new TextChange(new TextSpan(1, 0), "bbaa") }, changes); 768var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 769var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 0), "bb")); 774Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "bbaa") }, changes); 781var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 782var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 1), "bb")); 787Assert.Equal(new[] { new TextChange(new TextSpan(1, 0), "bba") }, changes); 794var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 795var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 2), "bb")); 800Assert.Equal(new[] { new TextChange(new TextSpan(1, 0), "bb") }, changes); 807var change1 = original.WithChanges(new TextChange(new TextSpan(1, 0), "aa")); 808var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 3), "bb")); 813Assert.Equal(new[] { new TextChange(new TextSpan(1, 1), "bb") }, changes); 821var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 822var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 1), "bb")); 827Assert.Equal(new[] { new TextChange(new TextSpan(1, 3), "bba") }, changes); 835var change1 = original.WithChanges(new TextChange(new TextSpan(1, 3), "aa")); 836var change2 = change1.WithChanges(new TextChange(new TextSpan(1, 3), "bb")); 847var change1 = original.WithChanges(new TextChange(new TextSpan(4, 0), "o ")); 848var change2 = change1.WithChanges(new TextChange(new TextSpan(6, 0), "World")); 853Assert.Equal(new TextSpan(4, 0), changes[0].Span); 861var change1 = original.WithChanges(new TextChange(new TextSpan(4, 0), "o")); 862var change2 = change1.WithChanges(new TextChange(new TextSpan(6, 0), "World")); 867Assert.Equal(new TextSpan(4, 0), changes[0].Span); 869Assert.Equal(new TextSpan(5, 0), changes[1].Span); 877var change1 = original.WithChanges(new TextChange(new TextSpan(8, 0), "l")); 878var change2 = change1.WithChanges(new TextChange(new TextSpan(4, 0), "o")); 883Assert.Equal(new TextSpan(4, 0), changes[0].Span); 885Assert.Equal(new TextSpan(8, 0), changes[1].Span); 893var change1 = original.WithChanges(new TextChange(new TextSpan(4, 0), " World")); 895var change2 = change1.WithChanges(new TextChange(new TextSpan(4, 0), "o")); 900Assert.Equal(new TextSpan(4, 0), changes[0].Span); 911c => c.WithChanges(new TextChange(new TextSpan(4, 0), "o ")), 912c => c.WithChanges(new TextChange(new TextSpan(6, 0), "World"))); 918Assert.Equal(new TextSpan(4, 0), changes[0].Span); 926new TextChangeRange(new TextSpan(919, 10), 466), 927new TextChangeRange(new TextSpan(936, 33), 29), 928new TextChangeRange(new TextSpan(1098, 0), 70), 929new TextChangeRange(new TextSpan(1125, 4), 34), 930new TextChangeRange(new TextSpan(1138, 0), 47)); 932new TextChangeRange(new TextSpan(997, 0), 2), 933new TextChangeRange(new TextSpan(1414, 0), 2), 934new TextChangeRange(new TextSpan(1419, 0), 2), 935new TextChangeRange(new TextSpan(1671, 5), 5), 936new TextChangeRange(new TextSpan(1681, 0), 4)); 941new TextChangeRange(new TextSpan(919, 10), 468), 942new TextChangeRange(new TextSpan(936, 33), 33), 943new TextChangeRange(new TextSpan(1098, 0), 70), 944new TextChangeRange(new TextSpan(1125, 4), 38), 945new TextChangeRange(new TextSpan(1138, 0), 47)); 954Assert.Equal("new TextChange(new TextSpan(0, 1), \"abc\")", new TextChange(new TextSpan(0, 1), "abc").GetDebuggerDisplay()); 955Assert.Equal("new TextChange(new TextSpan(0, 1), (NewLength = 10))", new TextChange(new TextSpan(0, 1), "0123456789").GetDebuggerDisplay()); 979var newChange = new TextChange(new TextSpan(i, length: random.Next(originalText.Length - i)), newText); 999var newChange = new TextChange(new TextSpan(i, length: random.Next(editedLength - i)), newText); 1047var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 2), "a")); 1048var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 2), "bb")); 1061var change1 = original.WithChanges(new TextChange(new TextSpan(0, 0), "aa"), new TextChange(new TextSpan(1, 1), "aa")); 1062var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), "b"), new TextChange(new TextSpan(2, 2), "")); 1075var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 0), "a")); 1076var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 2), ""), new TextChange(new TextSpan(2, 0), "bb")); 1089var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "aa"), new TextChange(new TextSpan(3, 1), "aa")); 1090var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), "bbb")); 1102var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 3), "a"), new TextChange(new TextSpan(5, 0), "aaa")); 1103var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 2), ""), new TextChange(new TextSpan(3, 1), "bb")); 1116var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "aaaaa"), new TextChange(new TextSpan(3, 1), "aaaa"), new TextChange(new TextSpan(6, 1), "aaaaa")); 1117var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), "b"), new TextChange(new TextSpan(2, 0), "b"), new TextChange(new TextSpan(3, 4), "bbbbb"), new TextChange(new TextSpan(9, 5), "bbbbb"), new TextChange(new TextSpan(15, 3), "")); 1130var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "a")); 1131var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), "b"), new TextChange(new TextSpan(2, 2), "b")); 1144var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), "aa")); 1145var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), "b"), new TextChange(new TextSpan(1, 2), "b")); 1158var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 2), "a"), new TextChange(new TextSpan(3, 2), "a")); 1159var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 3), "bbb")); 1172var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 4), ""), new TextChange(new TextSpan(5, 1), "")); 1173var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), ""), new TextChange(new TextSpan(1, 0), "")); 1186var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 2), ""), new TextChange(new TextSpan(3, 1), ""), new TextChange(new TextSpan(4, 0), ""), new TextChange(new TextSpan(4, 0), ""), new TextChange(new TextSpan(4, 0), "")); 1187var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 1), ""), new TextChange(new TextSpan(1, 1), ""), new TextChange(new TextSpan(2, 0), "")); 1200var change1 = originalText.WithChanges(new TextChange(new TextSpan(0, 1), ""), new TextChange(new TextSpan(2, 1), "")); 1201var change2 = change1.WithChanges(new TextChange(new TextSpan(0, 0), ""), new TextChange(new TextSpan(1, 1), "")); 1226new TextChange(new TextSpan(39, 0), " "), 1227new TextChange(new TextSpan(42, 0), " "), 1228new TextChange(new TextSpan(57, 0), " "), 1229new TextChange(new TextSpan(58, 0), "\r\n"), 1230new TextChange(new TextSpan(64, 2), " "), 1231new TextChange(new TextSpan(69, 0), " "), 1237new TextChange(new TextSpan(35, 4), string.Empty), 1238new TextChange(new TextSpan(46, 4), string.Empty), 1239new TextChange(new TextSpan(73, 4), string.Empty), 1240new TextChange(new TextSpan(88, 0), " "), 1241new TextChange(new TextSpan(90, 4), string.Empty), 1242new TextChange(new TextSpan(105, 4), string.Empty),
Text\TextSpanTest.cs (87)
21var span = new TextSpan(0, 42); 30var span = new TextSpan(1, 40); 42var span = new TextSpan(0, 0); 50var s1 = new TextSpan(1, 40); 51var s2 = new TextSpan(1, 40); 64var s1 = new TextSpan(1, 40); 65var s2 = new TextSpan(2, 40); 78var s1 = new TextSpan(1, 5); 79var s2 = new TextSpan(1, 40); 89TextSpan span = new TextSpan(0, 0); 100TextSpan span = new TextSpan(0, 1); 112TextSpan span = new TextSpan(15, 1485); 122TextSpan span = new TextSpan(0, int.MaxValue - 1); 131TextSpan span = new TextSpan(0, 10); 141TextSpan span_05_15 = new TextSpan(5, 10); 142TextSpan span_03_10 = new TextSpan(3, 7); 143TextSpan span_10_11 = new TextSpan(10, 1); 144TextSpan span_00_03 = new TextSpan(0, 3); 165Assert.False(new TextSpan(2, 5).Contains(new TextSpan(0, 0))); 166Assert.False(new TextSpan(2, 5).Contains(new TextSpan(10, 0))); 169Assert.True(new TextSpan(2, 5).Contains(new TextSpan(3, 0))); 172Assert.True(new TextSpan(2, 5).Contains(new TextSpan(2, 0))); 175Assert.True(new TextSpan(2, 5).Contains(new TextSpan(7, 0))); 178Assert.True(new TextSpan(2, 0).Contains(new TextSpan(2, 0))); 185Assert.False(new TextSpan(0, 0).Contains(new TextSpan(2, 5))); 186Assert.False(new TextSpan(10, 0).Contains(new TextSpan(2, 5))); 189Assert.False(new TextSpan(3, 0).Contains(new TextSpan(2, 5))); 192Assert.False(new TextSpan(2, 0).Contains(new TextSpan(2, 5))); 195Assert.False(new TextSpan(7, 0).Contains(new TextSpan(2, 5))); 201TextSpan span1 = new TextSpan(0, 10); 202TextSpan span2 = new TextSpan(0, 10); 218TextSpan span1 = new TextSpan(0, 10); 219TextSpan span2 = new TextSpan(0, 11); 220TextSpan span3 = new TextSpan(1, 11); 236TextSpan span1 = new TextSpan(10, 10); // 10..20 237TextSpan span2 = new TextSpan(5, 5); // 5..10 248TextSpan span1 = new TextSpan(10, 10); // 10..20 249TextSpan span2 = new TextSpan(5, 2); // 5..7 260TextSpan span1 = new TextSpan(10, 10); // 10..20 261TextSpan span2 = new TextSpan(5, 10); // 5..15 265Assert.Equal(span1.Overlap(span2), new TextSpan(10, 5)); 266Assert.Equal(span2.Overlap(span1), new TextSpan(10, 5)); 272TextSpan span1 = new TextSpan(10, 0); // [10, 10) 273TextSpan span2 = new TextSpan(10, 0); // [10, 10) 284TextSpan span1 = new TextSpan(10, 0); // [10, 10) 285TextSpan span2 = new TextSpan(5, 10); // [5, 15) 296TextSpan span1 = new TextSpan(10, 10); // 10..20 297TextSpan span2 = new TextSpan(5, 5); // 5..10 301Assert.Equal(span1.Intersection(span2), new TextSpan(10, 0)); 302Assert.Equal(span2.Intersection(span1), new TextSpan(10, 0)); 308TextSpan span1 = new TextSpan(10, 10); // 10..20 309TextSpan span2 = new TextSpan(5, 2); // 5..7 320TextSpan span1 = new TextSpan(10, 10); // 10..20 321TextSpan span2 = new TextSpan(5, 10); // 5..15 325Assert.Equal(span1.Intersection(span2), new TextSpan(10, 5)); 326Assert.Equal(span2.Intersection(span1), new TextSpan(10, 5)); 332TextSpan span1 = new TextSpan(10, 0); // [10, 10) 333TextSpan span2 = new TextSpan(10, 0); // [10, 10) 337Assert.Equal(span1.Intersection(span2), new TextSpan(10, 0)); 338Assert.Equal(span2.Intersection(span1), new TextSpan(10, 0)); 344TextSpan span1 = new TextSpan(2, 5); // [2, 7) 345TextSpan span2 = new TextSpan(7, 5); // [7, 12) 349Assert.Equal(span1.Intersection(span2), new TextSpan(7, 0)); 350Assert.Equal(span2.Intersection(span1), new TextSpan(7, 0)); 356TextSpan span1 = new TextSpan(2, 5); // [2, 7) 357TextSpan span2 = new TextSpan(3, 0); // [3, 3) 361Assert.Equal(span1.Intersection(span2), new TextSpan(3, 0)); 362Assert.Equal(span2.Intersection(span1), new TextSpan(3, 0)); 368TextSpan span1 = new TextSpan(2, 5); // [2, 7) 369TextSpan span2 = new TextSpan(2, 0); // [2, 2) 373Assert.Equal(span1.Intersection(span2), new TextSpan(2, 0)); 374Assert.Equal(span2.Intersection(span1), new TextSpan(2, 0)); 380TextSpan span1 = new TextSpan(2, 5); // [2, 7) 381TextSpan span2 = new TextSpan(7, 0); // [7, 0) 385Assert.Equal(span1.Intersection(span2), new TextSpan(7, 0)); 386Assert.Equal(span2.Intersection(span1), new TextSpan(7, 0));
Microsoft.CodeAnalysis.VisualBasic (13)
Binding\Binder_Utils.vb (1)
72Dim location = Me.SyntaxTree.GetLocation(New TextSpan(startLoc, endLoc - startLoc))
Lowering\Instrumentation\CodeCoverageInstrumenter.vb (1)
550Return New Text.TextSpan(startSpan.Start, originalSpan.Length - (startSpan.Start - originalSpan.Start))
Scanner\Blender.vb (4)
93Dim fullSpan = New TextSpan(0, root.FullWidth) 115Return New TextSpan(position, 0) 389Dim range = New TextSpan(_affectedRange.Span.Start, _affectedRange.NewLength) 435Dim _curNodeSpan = New TextSpan(_curNodeStart, _curNodeLength)
Scanner\Directives.vb (1)
617Return New CodeAnalysis.Syntax.InternalSyntax.SyntaxList(Of VisualBasicSyntaxNode)(Me.GetDisabledTextAt(New TextSpan(startSkipped, lengthSkipped)))
Symbols\Source\SourceMethodSymbol.vb (1)
180Dim location = binder.SyntaxTree.GetLocation(New TextSpan(startLoc, endLoc - startLoc))
Syntax\SyntaxNodeRemover.vb (1)
65Return New TextSpan(start, [end] - start)
Syntax\SyntaxReplacer.vb (1)
128Return New TextSpan(start, [end] - start)
Syntax\SyntaxTreeDiagnosticEnumerator.vb (1)
69Me._current = New VBDiagnostic(di, Me._tree.GetLocation(New TextSpan(position, node.Width)))
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)
10272Dim diagnosticSpan = New TextSpan(2, 2) 10738ReportDiagnostic(context.Options.AdditionalFiles.First().Path, context, New TextSpan(0, 1000000)) ' Overflow span 10749span = New TextSpan(0, 11)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (3)
EndConstructGeneration\SpitLinesResult.vb (1)
52subjectBuffer.ApplyChange(New TextChange(New TextSpan(caretPosition, 0), joinedLines))
EndConstructGeneration\VisualBasicEndConstructGenerationService.vb (1)
337subjectBuffer.ApplyChange(New TextChange(New TextSpan(insertPosition, 0), endText))
NavigationBar\VisualBasicEditorNavigationBarItemService_CodeGeneration.vb (1)
54Dim contextLocation = syntaxTree.GetLocation(New TextSpan(0, 0))
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests (39)
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.vb (4)
33Await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, document, New TextSpan(0, document.GetTextAsync().Result.Length)) 58Await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(ideEngineWorkspace, ideEngineDocument, New TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length)) 88Return Await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, document, New TextSpan(0, document.GetTextAsync().Result.Length)) 121Await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync(workspace, sourceDocument, New TextSpan(0, sourceDocument.GetTextAsync().Result.Length))
EditAndContinue\VisualBasicEditAndContinueAnalyzerTests.vb (2)
93span = New TextSpan(start, length) 485Dim oldStatementTextSpan = New TextSpan(oldStatementPosition, oldStatementSource.Length)
LineSeparators\LineSeparatorTests.vb (33)
24Await AssertTagsAsync({New TextSpan(9, 9)}, 31Await AssertTagsAsync({New TextSpan(10, 10)}, 38Await AssertTagsAsync({New TextSpan(13, 13)}, 45Await AssertTagsAsync({New TextSpan(13, 13)}, 52Await AssertTagsAsync({New TextSpan(8, 8)}, 59Await AssertTagsAsync({New TextSpan(13, 13)}, 66Await AssertTagsAsync({New TextSpan(40, 9)}, 76New TextSpan(32, 7), 77New TextSpan(75, 9) 91New TextSpan(45, 7), 92New TextSpan(101, 9) 108New TextSpan(32, 7), 109New TextSpan(65, 9) 122New TextSpan(17, 12), 123New TextSpan(65, 9) 135Await AssertTagsAsync({New TextSpan(41, 13)}, 145New TextSpan(31, 9), 146New TextSpan(73, 13) 160New TextSpan(31, 9), 161New TextSpan(62, 9), 162New TextSpan(97, 13) 177Await AssertTagsAsync({New TextSpan(37, 9)}, 187New TextSpan(27, 9), 188New TextSpan(69, 9) 201Await AssertTagsAsync({New TextSpan(164, 9)}, 216New TextSpan(150, 12), 217New TextSpan(188, 9) 235New TextSpan(8, 6), 236New TextSpan(29, 9) 247New TextSpan(235, 9), 248New TextSpan(272, 9) 268New TextSpan(26, 7), 269New TextSpan(59, 9)
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (5)
CodeGen\CodeGenTuples.vb (5)
6873Dim loc1 = Location.Create(tree, New TextSpan(0, 1)) 6922Dim loc1 = Location.Create(tree, New TextSpan(0, 1)) 6923Dim loc2 = Location.Create(tree, New TextSpan(1, 1)) 7271Dim loc1 = Location.Create(tree, New TextSpan(0, 1)) 7272Dim loc2 = Location.Create(tree, New TextSpan(1, 1))
Microsoft.CodeAnalysis.VisualBasic.Features (14)
BraceMatching\InterpolatedStringBraceMatcher.vb (2)
38New TextSpan(interpolatedString.DollarSignDoubleQuoteToken.SpanStart, 2), 39New TextSpan(interpolatedString.DoubleQuoteToken.Span.End - 1, 1))
BraceMatching\StringLiteralBraceMatcher.vb (2)
31New TextSpan(token.SpanStart, 1), 32New TextSpan(token.Span.End - 1, 1))
ChangeSignature\ChangeSignatureFormattingRule.vb (1)
30New TextSpan(firstToken.SpanStart, lastToken.Span.End - firstToken.SpanStart),
Debugging\VisualBasicBreakpointService.vb (1)
52span:=New TextSpan(position, length),
EditAndContinue\BreakpointSpans.vb (3)
65If breakpointSpan.Value = New TextSpan() Then 266Return New TextSpan() 271Return New TextSpan()
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (1)
1519Return New TextSpan()
ExtractInterface\VisualBasicExtractInterfaceService.vb (1)
44Dim span = New TextSpan(spanStart, spanEnd - spanStart)
GenerateType\VisualBasicGenerateTypeService.vb (2)
451semanticModel.SyntaxTree.GetLocation(New TextSpan()), 452semanticModel.SyntaxTree.GetLocation(New TextSpan(lastMember.Span.End, 0)))
Snippets\VisualBasicSnippetFunctionService.vb (1)
47Dim typeSpan = New TextSpan(caseGenerationLocation.Start + "Case ".Length, fullyQualifiedTypeName.Length)
Microsoft.CodeAnalysis.VisualBasic.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)
239gen001, 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 (133)
IncrementalParser\IncrementalParser.vb (49)
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), 351.changeSpan = New TextSpan(code.IndexOf("Next roleName", StringComparison.Ordinal) + 15, 2), 373.changeSpan = New TextSpan(code.IndexOf("#Else", StringComparison.Ordinal), 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), 476.changeSpan = New TextSpan(code.IndexOf("Dim roleName As Object", StringComparison.Ordinal) + 22, 2), 494.changeSpan = New TextSpan(code.IndexOf("e2", StringComparison.Ordinal) + 2, 2), 512.changeSpan = New TextSpan(code.IndexOf("End ", StringComparison.Ordinal), 4), 528.changeSpan = New TextSpan(code.IndexOf("Do", StringComparison.Ordinal) + 2, 2), 546.changeSpan = New TextSpan(code.IndexOf("Class ", StringComparison.Ordinal), 6), 569.changeSpan = New TextSpan(code.IndexOf("x As Integer)", StringComparison.Ordinal) + 12, 1), 583.changeSpan = New TextSpan(code.IndexOf(" By key1", StringComparison.Ordinal), 3), 599.changeSpan = New TextSpan(code.IndexOf("End Sub", StringComparison.Ordinal) + 7, 2), 613.changeSpan = New TextSpan(code.IndexOf("If Command() <", StringComparison.Ordinal) + 14, 0), 627.changeSpan = New TextSpan(code.IndexOf("NewTextPI.DTE", StringComparison.Ordinal), 9), 641.changeSpan = New TextSpan(0, 0), 653.changeSpan = New TextSpan(0, 10), 676.changeSpan = New TextSpan(code.IndexOf(change, StringComparison.Ordinal), change.Length), 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), 1123Dim span = New TextSpan(0, code.IndexOf("j0", StringComparison.Ordinal)) 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 (27)
35.changeSpan = New TextSpan(code.Length, 0), 55.changeSpan = New TextSpan(code.IndexOf(" 1", StringComparison.Ordinal) + 4, 0), 77.changeSpan = New TextSpan(code.IndexOf(" Sub()", StringComparison.Ordinal) + 8, 0), 99.changeSpan = New TextSpan(code.IndexOf("End Function", StringComparison.Ordinal), change.Length), 121.changeSpan = New TextSpan(code.IndexOf(" 1", StringComparison.Ordinal) + 4, change.Length), 144.changeSpan = New TextSpan(code.IndexOf(" Sub()", StringComparison.Ordinal) + 8, change.Length), 164.changeSpan = New TextSpan(code.Length, 0), 185.changeSpan = New TextSpan(code.IndexOf(" 1", StringComparison.Ordinal) + 4, 0), 208.changeSpan = New TextSpan(code.IndexOf(" Function()", StringComparison.Ordinal) + 13, 0), 229.changeSpan = New TextSpan(code.IndexOf("End Sub", StringComparison.Ordinal), change.Length), 254.changeSpan = New TextSpan(code.IndexOf(" 1", StringComparison.Ordinal) + 4, change.Length), 280.changeSpan = New TextSpan(code.IndexOf("= Function()", StringComparison.Ordinal) + 14, change.Length), 302.changeSpan = New TextSpan(code.Length, 0), 326.changeSpan = New TextSpan(code.IndexOf(" True", StringComparison.Ordinal) + 7, 0), 350.changeSpan = New TextSpan(code.IndexOf(" Then", StringComparison.Ordinal) + 7, 0), 373.changeSpan = New TextSpan(code.IndexOf("End If", StringComparison.Ordinal), change.Length), 399.changeSpan = New TextSpan(code.IndexOf(" True", StringComparison.Ordinal) + 7, change.Length), 425.changeSpan = New TextSpan(code.IndexOf(" Then", StringComparison.Ordinal) + 7, change.Length), 448.changeSpan = New TextSpan(code.Length, 0), 474.changeSpan = New TextSpan(code.IndexOf("Select el ", StringComparison.Ordinal) + 12, 0), 499.changeSpan = New TextSpan(code.IndexOf("End Select", StringComparison.Ordinal), change.Length), 527.changeSpan = New TextSpan(code.IndexOf("Select el ", StringComparison.Ordinal) + 12, change.Length), 550.changeSpan = New TextSpan(code.Length, 0), 576.changeSpan = New TextSpan(code.IndexOf("New Integer ", StringComparison.Ordinal) + 14, 0), 603.changeSpan = New TextSpan(code.IndexOf("End With", StringComparison.Ordinal) + 4, 4), 626.changeSpan = New TextSpan(code.IndexOf("New", StringComparison.Ordinal), change.Length), 654.changeSpan = New TextSpan(code.IndexOf("Select el ", StringComparison.Ordinal) + 12, change.Length),
LocationTests.vb (9)
59Return New TextSpan(index, textToFind.Length) 72Dim xSpan As New TextSpan(sampleProgram.IndexOf("x As", StringComparison.Ordinal), 1) 73Dim xToEndClassSpan As New TextSpan(xSpan.Start, sampleProgram.IndexOf("End Class", StringComparison.Ordinal) - xSpan.Start + 3) 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)) 296Dim span1 As New TextSpan(sampleProgram.IndexOf("x As", StringComparison.Ordinal), 1) 297Dim span2 As New TextSpan(sampleProgram.IndexOf("y As", StringComparison.Ordinal), 1)
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)
146AddClassification(New TextSpan(trivia.SpanStart, 1), ClassificationTypeNames.Punctuation)
Rename\VisualBasicRenameRewriterLanguageService.vb (3)
97newSpan = New TextSpan(oldSpan.Start, newSpan.Length) 237Me._renameSpansTracker.AddComplexifiedSpan(Me._documentId, oldSpan, New TextSpan(oldSpan.Start, newSpan.Length), Me._modifiedSubSpans) 295AddModifiedSpan(annotation.OriginalSpan, New TextSpan(token.Span.Start, newToken.Span.Length))
Simplification\Simplifiers\NameSimplifier.vb (1)
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)
99Return AssertFormatAsync(expected, code, SpecializedCollections.SingletonEnumerable(New TextSpan(0, code.Length)), debugMode, changedOptionSet, testWithTransformation, experimental:=experimental)
Microsoft.CodeAnalysis.Workspaces (53)
AbstractFormatEngine.cs (1)
266if (context.IsFormattingDisabled(new TextSpan(context.TokenStream.LastTokenInStream.Token.SpanStart, 0)))
AbstractFormatEngine.OperationApplier.cs (1)
218Debug.Assert(!_context.IsFormattingDisabled(new TextSpan(_context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0)));
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);
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)));
BKTree.Builder.cs (1)
108_wordSpans[i] = new TextSpan(characterIndex, value.Length);
BKTree.Node.cs (1)
45new TextSpan(start: reader.ReadInt32(), length: reader.ReadInt32()),
Classification\IRemoteSemanticClassificationService.cs (1)
101new TextSpan(
CodeCleanup\CodeCleaner.cs (1)
55return await CleanupAsync(document, new TextSpan(0, text.Length), options, providers, cancellationToken: cancellationToken).ConfigureAwait(false);
DocumentExtensions.cs (1)
98=> ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken);
EditorConfigParser.cs (1)
122var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
FindSymbols\FindReferences\Finders\AbstractReferenceFinder_GlobalSuppressions.cs (1)
233var location = Location.Create(root.SyntaxTree, new TextSpan(positionOfReferenceInTree, length));
FindSymbols\FindReferences\Finders\PropertySymbolReferenceFinder.cs (1)
204var location = state.SyntaxTree.GetLocation(new TextSpan(indexerReference.SpanStart, 0));
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (1)
220var span = new TextSpan(spanStart, spanLength);
FormattingContext.cs (2)
448DebugCheckEmpty(_indentationTree, new TextSpan(position, 0)); 499DebugCheckEmpty(_anchorTree, new TextSpan(span.Start, 0));
FormattingExtensions.cs (1)
278span = new TextSpan(span.Start + i, span.Length - i);
J\s\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (1)
24var fullSpan = new TextSpan(0, text.Length);
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (4)
244mergeConflictResolutionSpans.Add(new TextSpan(commentChangesList[commentChangeIndex].Span.Start + currentPositionDelta, commentChangesList[commentChangeIndex].NewText.Length)); 258var conflictingCommentInsertionLocation = new TextSpan(mergedChange.Span.Start, 0); 262mergeConflictResolutionSpans.Add(new TextSpan(commentChangesList[commentChangeIndex].Span.Start + currentPositionDelta, commentChangesList[commentChangeIndex].NewText.Length)); 277mergeConflictResolutionSpans.Add(new TextSpan(commentChangesList[commentChangeIndex].Span.Start + currentPositionDelta, commentChangesList[commentChangeIndex].NewText.Length));
NamingStyle.WordSpanEnumerator.cs (2)
27Current = new TextSpan(nameSpan.Start, 0); 54Current = new TextSpan(Current.End + _wordSeparator.Length, 0);
ParsedDocument.cs (1)
84textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldDocument.Text.Length))
PatternMatching\AllLowerCamelCaseMatcher.cs (1)
202var matchSpanToAdd = new TextSpan(candidateHump.Start, possibleHumpMatchLength);
PatternMatching\PatternMatcher.cs (4)
273=> _includeMatchedSpans ? new TextSpan(start, length) : null; 416=> PartStartsWith(candidate, candidatePart, pattern, new TextSpan(0, pattern.Length), compareOptions); 549matchSpans.Add(new TextSpan(candidateHump.Start, patternChunkCharacterSpan.Length)); 559candidateHump = new TextSpan(candidateHump.Start + patternChunkCharacterSpan.Length, candidateHump.Length - patternChunkCharacterSpan.Length);
Rename\ConflictEngine\ConflictResolver.Session.cs (1)
898var subSpan = new TextSpan(offset, length);
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (1)
415var matchTextSpan = new TextSpan(start, renameText.Length);
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);
SymbolKey.SymbolKeyReader.cs (1)
696return Location.Create(syntaxTree, new TextSpan(start, length));
TextChangeRangeExtensions.cs (4)
224addAndAdjustOldDelta(builder, ref oldDelta, new TextChangeRange(new TextSpan(oldChange.Span.Start, oldChangeLeadingDeletion), oldChangeLeadingInsertion)); 225oldChange = new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, oldChange.Span.Length - oldChangeLeadingDeletion), oldChange.NewLength - oldChangeLeadingInsertion); 379add(builder, new TextChangeRange(new TextSpan(newChange.SpanStart - oldDelta, newChange.SpanLength), newChange.NewLength)); 390builder[^1] = new TextChangeRange(new TextSpan(last.Span.Start, last.Span.Length + change.Span.Length), last.NewLength + change.NewLength);
VirtualCharSequence.Chunks.cs (1)
123var span = new TextSpan(_firstVirtualCharPosition + index, length: 1);
VirtualCharSequence.cs (2)
50: this(sequence, new TextSpan(0, sequence.Length)) 87=> new(_leafCharacters, new TextSpan(_span.Start + span.Start, span.Length));
Workspace\Solution\Document.cs (1)
396if (textChanges.Count > 1 || (textChanges.Count == 1 && textChanges[0].Span != new TextSpan(0, oldText.Length)))
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (2)
Formatting\FormattingTestBase.cs (1)
31return AssertFormatAsync(expected, code, new[] { new TextSpan(0, code.Length) }, language, debugMode, changedOptionSet, testWithTransformation);
GenerateFileForEachAdditionalFileWithContentsCommented.cs (1)
32var changes = sourceText.Lines.SelectAsArray(l => new TextChange(new TextSpan(l.Start, length: 0), "// "));
Microsoft.CodeAnalysis.Workspaces.UnitTests (13)
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)
547var newText = existingText.WithChanges(new TextChange(new TextSpan(existingText.Length, length: 0), " With Change"));
SymbolKeyTests.cs (3)
803var updated = sourceText.WithChanges(new TextChange(new TextSpan(position, 0), "insertion")); 850var updated = sourceText.WithChanges(new TextChange(new TextSpan(position, 0), "insertion")); 1348var 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));
Microsoft.VisualStudio.IntegrationTest.Utilities (1)
OutOfProcess\Editor_OutOfProc.cs (1)
76builder.Add(new TextSpan(tagInfo[i], tagInfo[i + 1]));
Microsoft.VisualStudio.LanguageServices (11)
CodeLens\RemoteCodeLensReferencesService.cs (1)
162var span = new TextSpan(descriptor.SpanStart, descriptor.SpanLength);
LanguageService\AbstractLanguageService`2.VsLanguageDebugInfo.cs (1)
341var breakpoint = _breakpointService.ResolveBreakpointAsync(document, new TextSpan(point.Position, length), cancellationToken).WaitAndGetResult(cancellationToken);
Snippets\SnippetFunctions\SnippetFunctionSimpleTypeName.cs (1)
78fieldSpan = new TextSpan(subjectBufferFieldSpan.Start, subjectBufferFieldSpan.Length);
ValueTracking\TreeItemViewModel.cs (1)
116var highlightSpan = new TextSpan(spanStartPosition, TextSpan.Length);
ValueTracking\ValueTrackingCommandHandler.cs (1)
93var textSpan = new TextSpan(caretPosition.Value.Position, 0);
Venus\ContainedDocument.cs (3)
388var spanInOriginalText = new TextSpan(offsetInOriginalText + spanInLeftText.Start, spanInLeftText.Length); 419var spanInOriginalText = new TextSpan(offsetInOriginalText + spanInLeftText.Start, spanInLeftText.Length); 434groups.Add(new TextSpan(0, 0));
Venus\ContainedDocument.DocumentServiceProvider.cs (3)
238builder.Add(new ClassifiedSpan(new TextSpan(0, contentSpan.Length), ClassificationTypeNames.Text)); 245builder.Add(new ClassifiedSpan(new TextSpan(lastSpan.End, contentSpan.Length - lastSpan.End), ClassificationTypeNames.Text)); 319=> new(targetSpan.Start - excerptSpan.Start, targetSpan.Length);
Microsoft.VisualStudio.LanguageServices.UnitTests (13)
Preview\PreviewChangesTests.vb (6)
42Dim textChange = New TextChange(New TextSpan(workspace.Documents.First().CursorPosition.Value, 0), "insertion!") 96Dim textChange = New TextChange(New TextSpan(workspace.Documents.First().CursorPosition.Value, 0), "insertion!") 139Dim textChange = New TextChange(New TextSpan(workspace.Documents.First().CursorPosition.Value, 0), "insertion!") 193Dim textChange = New TextChange(New TextSpan(workspace.Documents.First().CursorPosition.Value, 0), "insertion!") 280Dim textChange1 = New TextChange(New TextSpan(19, 1), "N") 283Dim textChange2 = New TextChange(New TextSpan(47, 1), "Y")
Venus\DocumentService_IntegrationTests.vb (2)
326Return 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 (5)
41Dim spans = Await spanMapper.MapSpansAsync(workspace.CurrentSolution.GetDocument(subjectDocument.Id), {New TextSpan(position, length:=0)}, CancellationToken.None) 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) 255Assert.Equal(New TextSpan(documentSpan.Start - contentSpan.Start, documentSpan.Length), result.Value.MappedSpan)
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)
56var newText = oldText.WithChanges(new[] { new TextChange(new TextSpan(0, 1), "abc") });
5313 references to TextSpan
IdeBenchmarks (2)
RegexClassifierBenchmarks.cs (2)
69protected Task<ImmutableArray<ClassifiedSpan>> GetClassificationSpansAsync(string code, TextSpan span, ParseOptions parseOptions) 78protected static async Task<ImmutableArray<ClassifiedSpan>> GetSemanticClassificationsAsync(Document document, TextSpan span)
IdeCoreBenchmarks (2)
ClassificationBenchmarks.cs (2)
96protected static async Task<ImmutableArray<ClassifiedSpan>> GetSemanticClassificationsAsync(Document document, TextSpan span) 111var span = new TextSpan(0, text.Length);
Microsoft.CodeAnalysis (219)
CodeGen\ILBuilder.cs (1)
1006internal void DefineSequencePoint(SyntaxTree syntaxTree, TextSpan span)
CodeGen\RawSequencePoint.cs (3)
18internal readonly TextSpan Span; 21internal static readonly TextSpan HiddenSequencePointSpan = new TextSpan(0x7FFFFFFF, 0); 23internal RawSequencePoint(SyntaxTree syntaxTree, int ilMarker, TextSpan span)
CodeGen\SequencePointList.cs (4)
134TextSpan span = offsetAndSpan.Span; 224TextSpan span = offsetAndSpan.Span; 247public readonly TextSpan Span; 249public OffsetAndSpan(int offset, TextSpan span)
Compilation\SemanticModel.cs (5)
328public abstract ImmutableArray<Diagnostic> GetSyntaxDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)); 342public abstract ImmutableArray<Diagnostic> GetDeclarationDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)); 356public abstract ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)); 373public abstract ImmutableArray<Diagnostic> GetDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)); 869internal abstract void ComputeDeclarationsInSpan(TextSpan span, bool getSymbol, ArrayBuilder<DeclarationInfo> builder, CancellationToken cancellationToken);
Diagnostic\Diagnostic.cs (2)
491internal bool HasIntersectingLocation(SyntaxTree tree, TextSpan? filterSpanWithinTree = null) 514static bool isLocationWithinSpan(Location location, SyntaxTree tree, TextSpan? filterSpan)
Diagnostic\ExternalFileLocation.cs (4)
16private readonly TextSpan _sourceSpan; 19internal ExternalFileLocation(string filePath, TextSpan sourceSpan, LinePositionSpan lineSpan) 26internal ExternalFileLocation(string filePath, TextSpan sourceSpan, LinePositionSpan lineSpan, string mappedFilePath, LinePositionSpan mappedLineSpan) 33public override TextSpan SourceSpan
Diagnostic\Location.cs (6)
59/// If <see cref="IsInSource"/> returns False this method returns an empty <see cref="TextSpan"/> which starts at position 0. 61public virtual TextSpan SourceSpan { get { return default(TextSpan); } } 158public static Location Create(SyntaxTree syntaxTree, TextSpan textSpan) 171public static Location Create(string filePath, TextSpan textSpan, LinePositionSpan lineSpan) 184public static Location Create(string filePath, TextSpan textSpan, LinePositionSpan lineSpan, string mappedFilePath, LinePositionSpan mappedLineSpan)
Diagnostic\SourceLocation.cs (3)
18private readonly TextSpan _span; 20public SourceLocation(SyntaxTree syntaxTree, TextSpan span) 64public override TextSpan SourceSpan
DiagnosticAnalyzer\AnalysisScope.cs (6)
26public TextSpan? FilterSpanOpt { get; } 76public AnalysisScope(ImmutableArray<DiagnosticAnalyzer> analyzers, SourceOrAdditionalFile filterFile, TextSpan? filterSpan, bool isSyntacticSingleFileAnalysis, bool concurrentAnalysis, bool categorizeDiagnostics) 83private AnalysisScope(IEnumerable<SyntaxTree> trees, IEnumerable<AdditionalText> additionalFiles, ImmutableArray<DiagnosticAnalyzer> analyzers, bool isPartialAnalysis, SourceOrAdditionalFile? filterFile, TextSpan? filterSpanOpt, bool isSyntacticSingleFileAnalysis, bool concurrentAnalysis, bool categorizeDiagnostics) 136public AnalysisScope WithFilterSpan(TextSpan? filterSpan) 208public bool ShouldInclude(TextSpan filterSpan) 213public bool ContainsSpan(TextSpan filterSpan)
DiagnosticAnalyzer\AnalyzerDriver.cs (3)
1251var span = root.FullSpan; 2230protected bool IsGeneratedOrHiddenCodeLocation(SyntaxTree syntaxTree, TextSpan span) 2233protected bool IsHiddenSourceLocation(SyntaxTree syntaxTree, TextSpan span)
DiagnosticAnalyzer\AnalyzerExecutor.AnalyzerDiagnosticReporter.cs (2)
29TextSpan? span, 69private TextSpan? _span;
DiagnosticAnalyzer\AnalyzerExecutor.cs (6)
48private readonly Func<SyntaxTree, TextSpan, bool> _isGeneratedCodeLocation; 113Func<SyntaxTree, TextSpan, bool> isGeneratedCodeLocation, 181Func<SyntaxTree, TextSpan, bool> isGeneratedCodeLocation, 969TextSpan filterSpan, 1058TextSpan filterSpan, 1411private AnalyzerDiagnosticReporter GetAddSemanticDiagnostic(SyntaxTree tree, TextSpan? span, DiagnosticAnalyzer analyzer)
DiagnosticAnalyzer\CompilationUnitCompletedEvent.cs (2)
13public CompilationUnitCompletedEvent(Compilation compilation, SyntaxTree compilationUnit, TextSpan? filterSpan = null) 34public TextSpan? FilterSpan { get; }
DiagnosticAnalyzer\CompilationWithAnalyzers.cs (6)
505public async Task<ImmutableArray<Diagnostic>> GetAnalyzerSemanticDiagnosticsAsync(SemanticModel model, TextSpan? filterSpan, CancellationToken cancellationToken) 520public async Task<ImmutableArray<Diagnostic>> GetAnalyzerSemanticDiagnosticsAsync(SemanticModel model, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 535public Task<AnalysisResult> GetAnalysisResultAsync(SemanticModel model, TextSpan? filterSpan, CancellationToken cancellationToken) 550public Task<AnalysisResult> GetAnalysisResultAsync(SemanticModel model, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 558private async Task<AnalysisResult> GetAnalysisResultCoreAsync(SemanticModel model, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 565private async Task<ImmutableArray<Diagnostic>> GetAnalyzerSemanticDiagnosticsCoreAsync(SemanticModel model, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken)
DiagnosticAnalyzer\DiagnosticAnalysisContext.cs (3)
655internal TextSpan? FilterSpan { get; } 673TextSpan? filterSpan, 1462/// which can be created using <see cref="Location.Create(string, TextSpan, LinePositionSpan)"/> API.
InternalUtilities\TextChangeRangeExtensions.cs (1)
99return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
Syntax\LineDirectiveMap.cs (2)
49public FileLinePositionSpan TranslateSpan(SourceText sourceText, string treeFilePath, TextSpan span) 111internal abstract FileLinePositionSpan TranslateSpanAndVisibility(SourceText sourceText, string treeFilePath, TextSpan span, out bool isHiddenPosition);
Syntax\SeparatedSyntaxList.cs (2)
143public TextSpan FullSpan 151public TextSpan Span
Syntax\SyntaxDiffer.cs (17)
22private readonly TextSpan _oldSpan; 71internal static IList<TextSpan> GetPossiblyDifferentTextSpans(SyntaxTree? before, SyntaxTree? after) 76return SpecializedCollections.EmptyList<TextSpan>(); 94internal static IList<TextSpan> GetPossiblyDifferentTextSpans(SyntaxNode oldNode, SyntaxNode newNode) 99private IList<TextSpan> ComputeSpansInNew() 105var newSpans = new List<TextSpan>(); 532var oldSpan = GetSpan(_oldNodes, 0, oldNodeCount); 544var oldSpan = removedNode.FullSpan; 547var newSpan = insertedNode.FullSpan; 553var oldSpan = GetSpan(_oldNodes, 0, oldNodeCount); 556var newSpan = GetSpan(_newNodes, 0, newNodeCount); 565var newSpan = GetSpan(_newNodes, 0, newNodeCount); 624private static TextSpan GetSpan(Stack<SyntaxNodeOrToken> stack, int first, int length) 646return TextSpan.FromBounds(start, end); 649private static TextSpan GetSpan(Queue<SyntaxNodeOrToken> queue, int first, int length) 671return TextSpan.FromBounds(start, end); 826var span = GetSpan(queue, 0, queue.Count);
Syntax\SyntaxList`1.cs (6)
125public TextSpan FullSpan 131return default(TextSpan); 135return TextSpan.FromBounds(this[0].FullSpan.Start, this[this.Count - 1].FullSpan.End); 143public TextSpan Span 149return default(TextSpan); 153return TextSpan.FromBounds(this[0].Span.Start, this[this.Count - 1].Span.End);
Syntax\SyntaxNode.cs (12)
83public TextSpan FullSpan => new TextSpan(this.Position, this.Green.FullWidth); 90public TextSpan Span 112/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 881public IEnumerable<SyntaxNode> DescendantNodes(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 902public IEnumerable<SyntaxNode> DescendantNodesAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 923public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 944public IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensAndSelf(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 959public SyntaxNode FindNode(TextSpan span, bool findInsideTrivia = false, bool getInnermostNodeForTie = false) 968!.FirstAncestorOrSelf<SyntaxNode, TextSpan>((a, span) => a.FullSpan.Contains(span), span); 1049public IEnumerable<SyntaxToken> DescendantTokens(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 1186public IEnumerable<SyntaxTrivia> DescendantTrivia(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 1528var span = token.Span;
Syntax\SyntaxNode.Iterators.cs (14)
17private IEnumerable<SyntaxNode> DescendantNodesImpl(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool descendIntoTrivia, bool includeSelf) 24private IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensImpl(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool descendIntoTrivia, bool includeSelf) 31private IEnumerable<SyntaxTrivia> DescendantTriviaImpl(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren = null, bool descendIntoTrivia = false) 38private static bool IsInSpan(in TextSpan span, TextSpan childSpan) 69public bool TryGetNextInSpan(in TextSpan span, out SyntaxNodeOrToken value) 84public SyntaxNode? TryGetNextAsNodeInSpan(in TextSpan span) 222public bool TryGetNextInSpan(in TextSpan span, out SyntaxNodeOrToken value) 317public bool TryGetNextInSpan(in TextSpan span, out SyntaxNodeOrToken value) 390private IEnumerable<SyntaxNode> DescendantNodesOnly(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool includeSelf) 415private IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensOnly(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool includeSelf) 444private IEnumerable<SyntaxNodeOrToken> DescendantNodesAndTokensIntoTrivia(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren, bool includeSelf) 532private IEnumerable<SyntaxTrivia> DescendantTriviaOnly(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren) 570private IEnumerable<SyntaxTrivia> DescendantTriviaIntoTrivia(TextSpan span, Func<SyntaxNode, bool>? descendIntoChildren)
Syntax\SyntaxNodeOrToken.cs (5)
226public TextSpan Span 240return default(TextSpan); 245/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 272public TextSpan FullSpan 286return default(TextSpan);
Syntax\SyntaxNodeOrTokenList.cs (4)
134public TextSpan FullSpan => _node?.FullSpan ?? default(TextSpan); 139public TextSpan Span => _node?.Span ?? default(TextSpan);
Syntax\SyntaxReference.cs (1)
24public abstract TextSpan Span { get; }
Syntax\SyntaxToken.cs (4)
108public TextSpan Span 112return Node != null ? new TextSpan(Position + Node.GetLeadingTriviaWidth(), Node.Width) : default(TextSpan); 122/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 135public TextSpan FullSpan => new TextSpan(Position, FullWidth);
Syntax\SyntaxTokenList.cs (5)
141public TextSpan FullSpan 147return default(TextSpan); 157public TextSpan Span 163return default(TextSpan); 166return TextSpan.FromBounds(Position + Node.GetLeadingTriviaWidth(),
Syntax\SyntaxTree.cs (7)
218public abstract FileLinePositionSpan GetLineSpan(TextSpan span, CancellationToken cancellationToken = default); 235public abstract FileLinePositionSpan GetMappedLineSpan(TextSpan span, CancellationToken cancellationToken = default); 268internal virtual FileLinePositionSpan GetMappedLineSpanAndVisibility(TextSpan span, out bool isHiddenPosition) 284internal string GetDisplayPath(TextSpan span, SourceReferenceResolver? resolver) 305internal int GetDisplayLineNumber(TextSpan span) 321public abstract IList<TextSpan> GetChangedSpans(SyntaxTree syntaxTree); 326public abstract Location GetLocation(TextSpan span);
Syntax\SyntaxTreeExtensions.cs (3)
24var fullSpan = new TextSpan(0, text.Length); 31var change = TextChangeRange.Collapse(changes).Span; 44var span = node.FullSpan;
Syntax\SyntaxTrivia.cs (5)
90public TextSpan Span 96: default(TextSpan); 101/// Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>. 120public TextSpan FullSpan 122get { return UnderlyingNode != null ? new TextSpan(Position, UnderlyingNode.FullWidth) : default(TextSpan); }
Syntax\SyntaxTriviaList.cs (5)
131public TextSpan FullSpan 137return default(TextSpan); 147public TextSpan Span 153return default(TextSpan); 156return TextSpan.FromBounds(Position + Node.GetLeadingTriviaWidth(),
Syntax\TranslationSyntaxReference.cs (1)
24public sealed override TextSpan Span
Text\ChangedText.cs (4)
138public override string ToString(TextSpan span) 143public override SourceText GetSubText(TextSpan span) 305var lps = oldLineInfo.GetLinePositionSpan(TextSpan.FromBounds(position, change.Span.Start)); 357var lps = oldLineInfo.GetLinePositionSpan(TextSpan.FromBounds(position, oldText.Length));
Text\CompositeText.cs (1)
78public override SourceText GetSubText(TextSpan span)
Text\LargeText.cs (1)
181public override void Write(TextWriter writer, TextSpan span, CancellationToken cancellationToken = default(CancellationToken))
Text\SourceText.cs (8)
475internal void CheckSubSpan(TextSpan span) 488public virtual SourceText GetSubText(TextSpan span) 538public virtual void Write(TextWriter writer, TextSpan span, CancellationToken cancellationToken = default(CancellationToken)) 610public virtual string ToString(TextSpan span) 749public SourceText Replace(TextSpan span, string newText) 804var span = new TextSpan(newPos, range.NewLength); 878return TextLine.FromSpan(_text, TextSpan.FromBounds(start, _text.Length)); 883return TextLine.FromSpan(_text, TextSpan.FromBounds(start, end));
Text\StringBuilderText.cs (1)
78public override string ToString(TextSpan span)
Text\StringText.cs (2)
71public override string ToString(TextSpan span) 91public override void Write(TextWriter textWriter, TextSpan span, CancellationToken cancellationToken = default(CancellationToken))
Text\SubText.cs (6)
15public SubText(SourceText text, TextSpan span) 39public TextSpan UnderlyingSpan { get; } 66public override string ToString(TextSpan span) 73public override SourceText GetSubText(TextSpan span) 82var span = GetCompositeSpan(sourceIndex, count); 86private TextSpan GetCompositeSpan(int start, int length)
Text\TextChange.cs (3)
24public TextSpan Span { get; } 37public TextChange(TextSpan span, string newText) 65EqualityComparer<TextSpan>.Default.Equals(this.Span, other.Span) &&
Text\TextChangeRange.cs (4)
21public TextSpan Span { get; } 35public TextChangeRange(TextSpan span, int newLength) 126var combined = TextSpan.FromBounds(start, end);
Text\TextLine.cs (5)
33public static TextLine FromSpan(SourceText text, TextSpan span) 146public TextSpan Span 148get { return TextSpan.FromBounds(this.Start, this.End); } 154public TextSpan SpanIncludingLineBreak 156get { return TextSpan.FromBounds(this.Start, this.EndIncludingLineBreak); }
Text\TextLineCollection.cs (5)
53/// Convert a <see cref="TextSpan"/> to a <see cref="LinePositionSpan"/>. 55public LinePositionSpan GetLinePositionSpan(TextSpan span) 69/// Convert a <see cref="LinePositionSpan"/> to <see cref="TextSpan"/>. 71public TextSpan GetTextSpan(LinePositionSpan span) 73return TextSpan.FromBounds(GetPosition(span.Start), GetPosition(span.End));
Text\TextSpan.cs (29)
16public readonly struct TextSpan : IEquatable<TextSpan>, IComparable<TextSpan> 84public bool Contains(TextSpan span) 100public bool OverlapsWith(TextSpan span) 117public TextSpan? Overlap(TextSpan span) 123? TextSpan.FromBounds(overlapStart, overlapEnd) 124: (TextSpan?)null; 138public bool IntersectsWith(TextSpan span) 168public TextSpan? Intersection(TextSpan span) 174? TextSpan.FromBounds(intersectStart, intersectEnd) 175: (TextSpan?)null; 179/// Creates a new <see cref="TextSpan"/> from <paramref name="start" /> and <paramref 185public static TextSpan FromBounds(int start, int end) 201/// Determines if two instances of <see cref="TextSpan"/> are the same. 203public static bool operator ==(TextSpan left, TextSpan right) 209/// Determines if two instances of <see cref="TextSpan"/> are different. 211public static bool operator !=(TextSpan left, TextSpan right) 217/// Determines if current instance of <see cref="TextSpan"/> is equal to another. 219public bool Equals(TextSpan other) 225/// Determines if current instance of <see cref="TextSpan"/> is equal to another. 228=> obj is TextSpan span && Equals(span); 231/// Produces a hash code for <see cref="TextSpan"/>. 239/// Provides a string representation for <see cref="TextSpan"/>. 249/// Compares current instance of <see cref="TextSpan"/> with another. 251public int CompareTo(TextSpan other)
Microsoft.CodeAnalysis.CodeStyle (367)
AbstractAggregatedFormattingResult.cs (3)
22private readonly SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? _formattingSpans; 30SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? formattingSpans) 48protected SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector> GetFormattingSpans()
AbstractFormatEngine.cs (5)
37protected readonly TextSpan SpanToFormat; 317private TextSpan GetSpanToFormat() 322return TextSpan.FromBounds(startPosition, endPosition); 443var spanBetweenTokens = TextSpan.FromBounds(token1.Span.End, token2.SpanStart);
AbstractFormatEngine.OperationApplier.cs (2)
346var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
AbstractFormattingResult.cs (4)
26public readonly TextSpan FormattedSpan; 31TextSpan formattedSpan) 78var span = TextSpan.FromBounds(token1.RawKind == 0 ? this.TreeInfo.StartPosition : token1.Span.End, token2.RawKind == 0 ? this.TreeInfo.EndPosition : token2.SpanStart);
AbstractHeaderFacts.cs (2)
46var headerSpan = TextSpan.FromBounds(
AbstractIndentation.Indenter.cs (3)
237private TextSpan GetNormalizedSpan(int position) 241return TextSpan.FromBounds(LineToBeIndented.Start, position); 244return TextSpan.FromBounds(position, LineToBeIndented.Start);
AbstractOrderModifiersDiagnosticAnalyzer.cs (1)
74TextSpan.FromBounds(modifiers.First().SpanStart, modifiers.Last().Span.End))));
AbstractRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
31protected abstract TextSpan GetFadeSpan(TCastExpression node);
AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (10)
90private IEnumerable<TextSpan> GetContiguousSpans(ImmutableArray<SyntaxNode> nodes) 93(SyntaxNode node, TextSpan textSpan)? previous = null; 98TextSpan textSpan; 102textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 110textSpan = TextSpan.FromBounds(previous.Value.textSpan.Start, nodeEnd); 116textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 143IEnumerable<TextSpan> contiguousSpans, SyntaxTree tree, 146foreach (var span in contiguousSpans) 157protected abstract IEnumerable<TextSpan> GetFixableDiagnosticSpans( 165foreach (var span in spans)
AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
136return Location.Create(parenthesizedExpression.SyntaxTree, TextSpan.FromBounds(parenthesizedExpressionLocation.SourceSpan.Start, textSpanEndPosition));
AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (3)
84TextSpan? span, 225TextSpan? span, 732TextSpan? span,
AbstractSelectedMembers.cs (4)
35SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 39SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 43SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, 78SyntaxNode root, SourceText text, TextSpan textSpan,
AbstractSimplifyInterpolationHelpers.cs (5)
37var unnecessarySpans = new List<TextSpan>(); 77out string? formatString, List<TextSpan> unnecessarySpans) 183private static TextSpan GetSpanWithinLiteralQuotes(IVirtualCharService virtualCharService, SyntaxToken formatToken) 188: TextSpan.FromBounds(sequence.First().Span.Start, sequence.Last().Span.End); 193out TExpressionSyntax? alignment, out bool negate, List<TextSpan> unnecessarySpans)
AbstractSyntaxFormatting.cs (5)
23private static readonly Func<TextSpan, bool> s_notEmpty = s => !s.IsEmpty; 34protected abstract IFormattingResult CreateAggregatedFormattingResult(SyntaxNode node, IList<AbstractFormattingResult> results, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? formattingSpans = null); 38public IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken) 40IReadOnlyList<TextSpan> spansToFormat; 45? SpecializedCollections.EmptyReadOnlyList<TextSpan>()
AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
53public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
AbstractTriviaDataFactory.Whitespace.cs (1)
90public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
AbstractTriviaFormatter.cs (13)
46private delegate void WhitespaceAppender<T>(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<T> changes); 388var span = GetTextSpan(trivia1, trivia2); 500var span = TextSpan.FromBounds(start, end); 716var insertionPoint = GetInsertionSpan(changes); 731private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 766TextSpan notUsed, 823private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 826private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes) 832private TextSpan GetTextSpan(SyntaxTrivia trivia1, SyntaxTrivia trivia2) 836return TextSpan.FromBounds(this.StartPosition, trivia2.FullSpan.Start); 841return TextSpan.FromBounds(trivia1.FullSpan.End, this.EndPosition); 844return TextSpan.FromBounds(trivia1.FullSpan.End, trivia2.FullSpan.Start);
AbstractUseCollectionInitializerDiagnosticAnalyzer.cs (2)
149syntaxTree.GetLocation(TextSpan.FromBounds(match.SpanStart, arguments[0].SpanStart)), 150syntaxTree.GetLocation(TextSpan.FromBounds(arguments.Last().FullSpan.End, match.Span.End)));
AbstractUseObjectInitializerDiagnosticAnalyzer.cs (2)
135var location1 = Location.Create(syntaxTree, TextSpan.FromBounds( 146syntaxTree.GetLocation(TextSpan.FromBounds(match.Initializer.FullSpan.End, match.Statement.Span.End)))));
AbstractVirtualCharService.cs (3)
30string tokenText, int index, int offset, out TextSpan span) 174if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 242return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
AnchorIndentationOperation.cs (2)
16internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 30public TextSpan TextSpan { get; }
BaseIndentationFormattingRule.cs (10)
20private readonly TextSpan _span; 22public BaseIndentationFormattingRule(SyntaxNode root, TextSpan span, int baseIndentation, AbstractFormattingRule? vbHelperFormattingRule = null) 130private TextSpan AdjustTextSpan(TextSpan textSpan) 131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End)); 133private static void SetInnermostNodeForSpan(SyntaxNode root, ref TextSpan span, out SyntaxToken token1, out SyntaxToken token2, out SyntaxNode? commonNode) 149private static void GetTokens(SyntaxNode root, TextSpan span, out SyntaxToken token1, out SyntaxToken token2) 168private static TextSpan GetSpanFromTokens(TextSpan span, SyntaxToken token1, SyntaxToken token2) 217return TextSpan.FromBounds(start, end);
BKTree.Builder.cs (6)
37private readonly TextSpan[] _wordSpans; 102_wordSpans = new TextSpan[distinctValues.Length]; 178private void Add(TextSpan characterSpan, int insertionIndex) 219TextSpan characterSpan, int insertionIndex, int currentNodeEdgeCount, int currentNodeIndex, int editDistance) 289public readonly TextSpan CharacterSpan; 293public BuilderNode(TextSpan characterSpan) : this()
BKTree.cs (1)
122var characterSpan = currentNode.WordSpan;
BKTree.Node.cs (2)
17public readonly TextSpan WordSpan; 27public Node(TextSpan wordSpan, int edgeCount, int firstEdgeIndex)
BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
CommonFormattingHelpers.cs (10)
42public static IEnumerable<(SyntaxToken, SyntaxToken)> ConvertToTokenPairs(this SyntaxNode root, IReadOnlyList<TextSpan> spans) 78public static ValueTuple<SyntaxToken, SyntaxToken> ConvertToTokenPair(this SyntaxNode root, TextSpan textSpan) 154=> (token1.RawKind == 0) ? text.ToString(TextSpan.FromBounds(0, token2.SpanStart)) : text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart)); 256public static TextSpan GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(SyntaxToken startToken, SyntaxToken endToken) 263return TextSpan.FromBounds(startPosition, endPosition); 321var fullSpan = node.FullSpan; 360public static TextSpan GetFormattingSpan(SyntaxNode root, TextSpan span) 370return TextSpan.FromBounds(startPosition, endPosition);
EditorConfigOption.cs (1)
12internal record class EditorConfigOption(Section Section, TextSpan? Span);
EditorConfigOption`1.cs (2)
12internal record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value) 16public static implicit operator EditorConfigOption<T>((Section section, TextSpan? span, T value) tuple)
EditorConfigParser.cs (1)
122var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
EmbeddedDiagnostic.cs (3)
23public readonly TextSpan Span; 25public EmbeddedDiagnostic(string message, TextSpan span) 49hashCode = hashCode * -1521134295 + EqualityComparer<TextSpan>.Default.GetHashCode(Span);
EmbeddedSyntaxHelpers.cs (4)
12public static TextSpan GetSpan<TSyntaxKind>(EmbeddedSyntaxToken<TSyntaxKind> token1, EmbeddedSyntaxToken<TSyntaxKind> token2) where TSyntaxKind : struct 15public static TextSpan GetSpan(VirtualCharSequence virtualChars) 18public static TextSpan GetSpan(VirtualChar firstChar, VirtualChar lastChar) 19=> TextSpan.FromBounds(firstChar.Span.Start, lastChar.Span.End);
EmbeddedSyntaxNode.cs (6)
42private TextSpan? _fullSpan; 56public TextSpan GetSpan() 63return TextSpan.FromBounds(start, end); 66public TextSpan? GetFullSpan() 69private TextSpan? ComputeFullSpan() 76return TextSpan.FromBounds(start.Value, end.Value);
EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
EmbeddedSyntaxToken.cs (3)
73public TextSpan GetSpan() 76public TextSpan? GetFullSpan() 91return TextSpan.FromBounds(start, end);
EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
FormatterHelper.cs (4)
35public static SyntaxNode Format(SyntaxNode node, TextSpan spanToFormat, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, CancellationToken cancellationToken) 49internal static SyntaxNode Format(SyntaxNode node, IEnumerable<TextSpan> spans, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken) 52internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan> spans, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken) 55internal static IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan> spans, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken)
FormattingContext.AnchorData.cs (1)
27public TextSpan TextSpan => _operation.TextSpan;
FormattingContext.cs (18)
47private readonly HashSet<TextSpan> _indentationMap = new(); 48private readonly HashSet<TextSpan> _suppressWrappingMap = new(); 49private readonly HashSet<TextSpan> _suppressSpacingMap = new(); 50private readonly HashSet<TextSpan> _suppressFormattingMap = new(); 51private readonly HashSet<TextSpan> _anchorMap = new(); 141var baseSpan = _initialIndentBlockOperations[0].TextSpan; 160var operationSpan = operations[i].TextSpan; 181var intervalTreeSpan = operation.TextSpan; 433private static void DebugCheckEmpty<T, TIntrospector>(ContextIntervalTree<T, TIntrospector> tree, TextSpan textSpan) 472var span = token.Span; 493var span = token.Span; 616public bool IsWrappingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 638public bool IsSpacingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 667var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End); 674public bool IsFormattingDisabled(TextSpan textSpan) 682var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End);
FormattingContext.IndentationData.cs (14)
20public IndentationData(TextSpan textSpan) 23public TextSpan TextSpan { get; } 26public IndentationData WithTextSpan(TextSpan span) 29protected abstract IndentationData WithTextSpanCore(TextSpan span); 36public SimpleIndentationData(TextSpan textSpan, int indentation) 44protected override IndentationData WithTextSpanCore(TextSpan span) 68public RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter) 79this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 82private RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter, int lazyIndentationDelta) 93this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 96public TextSpan InseparableRegionSpan { get; } 118protected override IndentationData WithTextSpanCore(TextSpan span) 130public AdjustedIndentationData(TextSpan textSpan, IndentationData baseIndentationData, int adjustment) 153protected override IndentationData WithTextSpanCore(TextSpan span)
FormattingContext.InitialContextFinder.cs (2)
67var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
FormattingExtensions.cs (13)
257var span = textChange.Span; 285internal static IEnumerable<TextSpan> GetAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 295static IEnumerable<TextSpan> EnumerateAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 306internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 321return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 324internal static TextSpan GetElasticSpan(SyntaxToken token) 327private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 329var aggregateSpans = new List<TextSpan>(); 331var last = default(TextSpan); 332foreach (var span in spans) 340last = TextSpan.FromBounds(last.Start, span.End);
FormattingOperations.cs (8)
31=> CreateAnchorIndentationOperation(anchorToken, endToken, TextSpan.FromBounds(anchorToken.Span.End, endToken.Span.End)); 36public static AnchorIndentationOperation CreateAnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 43=> CreateSuppressOperation(startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End), option); 48private static SuppressOperation CreateSuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option) 56var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 63public static IndentBlockOperation CreateIndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 71var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 79public static IndentBlockOperation CreateRelativeIndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option)
IndentBlockOperation.cs (3)
15internal IndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 34internal IndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 57public TextSpan TextSpan { get; }
IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
ISyntaxFacts.cs (7)
417bool ContainsInMemberBody([NotNullWhen(true)] SyntaxNode? node, TextSpan span); 419TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 422/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 423/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 425/// an empty <see cref="TextSpan"/> at position 0. 428TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 472bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
ISyntaxFactsExtensions.cs (5)
166var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().Span.End); 184this ISyntaxFacts syntaxFacts, TextSpan span, SyntaxNode node, CancellationToken cancellationToken) 443public static TextSpan GetSpanWithoutAttributes(this ISyntaxFacts syntaxFacts, SyntaxNode root, SyntaxNode node) 463return TextSpan.FromBounds(startOfNodeWithoutAttributes, endOfNode);
ISyntaxFormatting.cs (1)
21IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken);
J\s\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (3)
24var fullSpan = new TextSpan(0, text.Length); 31var change = TextChangeRange.Collapse(changes).Span; 44var span = node.FullSpan;
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (2)
18public static bool OverlapsHiddenPosition([NotNullWhen(returnValue: true)] this SyntaxTree? tree, TextSpan span, CancellationToken cancellationToken) 95public static bool IsEntirelyHidden(this SyntaxTree tree, TextSpan span, CancellationToken cancellationToken)
NamingStyle.cs (21)
159var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 173private WordSpanEnumerable GetWordSpans(string name, TextSpan nameSpan) 176private static string Substring(string name, TextSpan wordSpan) 179private static readonly Func<string, TextSpan, bool> s_firstCharIsLowerCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsLower(val[span.Start]); 180private static readonly Func<string, TextSpan, bool> s_firstCharIsUpperCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsUpper(val[span.Start]); 182private static readonly Func<string, TextSpan, bool> s_wordIsAllUpperCase = (val, span) => 195private static readonly Func<string, TextSpan, bool> s_wordIsAllLowerCase = (val, span) => 209string name, TextSpan nameSpan, Func<string, TextSpan, bool> wordCheck, 215foreach (var wordSpan in GetWordSpans(name, nameSpan)) 231private bool CheckPascalCase(string name, TextSpan nameSpan, out string reason) 236private bool CheckAllUpper(string name, TextSpan nameSpan, out string reason) 241private bool CheckAllLower(string name, TextSpan nameSpan, out string reason) 247string name, TextSpan nameSpan, 248Func<string, TextSpan, bool> firstWordCheck, 249Func<string, TextSpan, bool> restWordCheck, 259foreach (var wordSpan in GetWordSpans(name, nameSpan)) 290private bool CheckCamelCase(string name, TextSpan nameSpan, out string reason) 297private bool CheckFirstUpper(string name, TextSpan nameSpan, out string reason) 405using var parts = TemporaryArray<TextSpan>.Empty;
NamingStyle.WordSpanEnumerable.cs (2)
16private readonly TextSpan _nameSpan; 19public WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
NamingStyle.WordSpanEnumerator.cs (4)
18private readonly TextSpan _nameSpan; 21public WordSpanEnumerator(string name, TextSpan nameSpan, string wordSeparator) 30public TextSpan Current { get; private set; } 72Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
NamingStyleOption.cs (3)
13/// The root naming style option composed of several settings as well as a <see cref="TextSpan"/>s describing where they were all defined. 29/// A description of the kinds of symbols a rule should apply to as well as a <see cref="TextSpan"/>s describing where they were all defined. 42/// The rules about how the specified symbols must be named as well as a <see cref="TextSpan"/>s describing where they were all defined.
NormalizedTextSpanCollection.cs (42)
14internal class NormalizedTextSpanCollection : ReadOnlyCollection<TextSpan> 21: base(new List<TextSpan>(0)) 29public NormalizedTextSpanCollection(TextSpan span) 42public NormalizedTextSpanCollection(IEnumerable<TextSpan> spans) 93var span1 = left[index1]; 94var span2 = right[index2]; 122spans.Add(TextSpan.FromBounds(start, end)); 161var span1 = left[index1]; 162var span2 = right[index2]; 221var span1 = left[index1]; 222var span2 = right[index2]; 283var span1 = left[index1]; 284var span2 = right[index2]; 296spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 307spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span2.Start)); 333var span1 = left[index1++]; 334spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 398var span1 = this[index1]; 399var span2 = set[index2]; 429public bool OverlapsWith(TextSpan span) 458var span1 = this[index1]; 459var span2 = set[index2]; 483public bool IntersectsWith(TextSpan span) 506foreach (var s in this) 533foreach (var s in this) 546private static IList<TextSpan> ListFromSpan(TextSpan span) 548IList<TextSpan> list = new List<TextSpan>(1); 562private static void UpdateSpanUnion(TextSpan span, IList<TextSpan> spans, ref int start, ref int end) 566spans.Add(TextSpan.FromBounds(start, end)); 583private static IList<TextSpan> NormalizeSpans(IEnumerable<TextSpan> spans) 590var sorted = new List<TextSpan>(spans); 597sorted.Sort(delegate (TextSpan s1, TextSpan s2) { return s1.Start.CompareTo(s2.Start); }); 599IList<TextSpan> normalized = new List<TextSpan>(sorted.Count); 609normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 619normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 624private class OrderedSpanList : List<TextSpan>
Section.cs (2)
16public TextSpan Span { get; init; } 24public Section(string? filePath, bool isGlobal, TextSpan span, string text, string fullText)
SimpleIntervalTreeExtensions.cs (2)
15public static bool HasIntervalThatIntersectsWith(this SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector> tree, TextSpan span)
SimplifyTypeNamesDiagnosticAnalyzerBase.cs (9)
76out TextSpan issueSpan, out string diagnosticId, out bool inDeclaration, 111protected abstract ImmutableArray<Diagnostic> AnalyzeSemanticModel(SemanticModelAnalysisContext context, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? codeBlockIntervalTree); 117out var issueSpan, out var diagnosticId, out var inDeclaration, 134internal static Diagnostic CreateDiagnostic(SemanticModel model, TSimplifierOptions options, TextSpan issueSpan, string diagnosticId, bool inDeclaration) 205/// indicate that <c>intervalTree</c> may be updated by adding a new non-overlapping <see cref="TextSpan"/> 221private readonly ConcurrentDictionary<SyntaxTree, (StrongBox<bool> completed, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? intervalTree)> _codeBlockIntervals 232var (completed, intervalTree) = _codeBlockIntervals.GetOrAdd(context.CodeBlock.SyntaxTree, _ => (new StrongBox<bool>(false), SimpleIntervalTree.Create(new TextSpanIntervalIntrospector(), Array.Empty<TextSpan>()))); 251static bool TryProceedWithInterval(bool addIfAvailable, TextSpan span, StrongBox<bool> completed, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector> intervalTree)
SourceTextExtensions_SharedWithCodeStyle.cs (2)
33this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden, CancellationToken cancellationToken) 45this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden,
StringBreaker.cs (10)
16public static void AddWordParts(string identifier, ref TemporaryArray<TextSpan> parts) 19public static void AddCharacterParts(string identifier, ref TemporaryArray<TextSpan> parts) 22public static void AddParts(string text, bool word, ref TemporaryArray<TextSpan> parts) 26var span = StringBreaker.GenerateSpan(text, start, word); 40public static TextSpan GenerateSpan(string identifier, int wordStart, bool word) 80private static TextSpan ScanCharacterRun(string identifier, int length, int wordStart) 101private static TextSpan ScanWordRun(string identifier, int length, int wordStart) 150private static TextSpan ScanLowerCaseRun(string identifier, int length, int wordStart) 161private static TextSpan ScanNumber(string identifier, int length, int wordStart) 169return TextSpan.FromBounds(wordStart, current);
SuppressOperation.cs (2)
15internal SuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option) 28public TextSpan TextSpan { get; }
SuppressSpacingData.cs (2)
14public SuppressSpacingData(TextSpan textSpan) 17public TextSpan TextSpan { get; }
SuppressWrappingData.cs (2)
14public SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 20public TextSpan TextSpan { get; }
SyntaxNodeExtensions.cs (13)
99this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate) 313public static TextSpan GetContainedSpan(this IEnumerable<SyntaxNode> nodes) 318var fullSpan = nodes.First().Span; 321fullSpan = TextSpan.FromBounds( 332public static bool OverlapsHiddenPosition(this SyntaxNode node, TextSpan span, CancellationToken cancellationToken) 340var textSpan = TextSpan.FromBounds(start, end); 416var nodesToReplace = nodes != null ? nodes.ToDictionary(n => n.FullSpan) : new Dictionary<TextSpan, SyntaxNode>(); 417var tokensToReplace = tokens != null ? tokens.ToDictionary(t => t.FullSpan) : new Dictionary<TextSpan, SyntaxToken>(); 418var triviaToReplace = trivia != null ? trivia.ToDictionary(t => t.FullSpan) : new Dictionary<TextSpan, SyntaxTrivia>(); 426var spans = new List<TextSpan>(nodesToReplace.Count + tokensToReplace.Count + triviaToReplace.Count); 449TextSpan previous = default; 450foreach (var span in spans)
TextChangeRangeExtensions.cs (1)
99return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
TextSpanExtensions.cs (22)
18public static IEnumerable<TextSpan> ToNormalizedSpans(this IEnumerable<TextSpan> spans) 21public static ImmutableArray<TextSpan> ToNormalizedSpans(this ImmutableArray<TextSpan> spans) 24public static TextSpan Collapse(this IEnumerable<TextSpan> spans) 29foreach (var span in spans) 48return TextSpan.FromBounds(start, end); 54public static bool IsAround(this TextSpan span, SyntaxNodeOrToken node) => IsAround(span, node, node); 60public static bool IsAround(this TextSpan span, SyntaxNodeOrToken startNode, SyntaxNodeOrToken endNode) 62var innerSpan = TextSpan.FromBounds(startNode.Span.Start, endNode.Span.End); 63var outerSpan = TextSpan.FromBounds(startNode.FullSpan.Start, endNode.FullSpan.End); 67public static IEnumerable<TextSpan> Subtract(this TextSpan span, TextSpan except) 81yield return TextSpan.FromBounds(span.Start, startSegmentEnd); 85yield return TextSpan.FromBounds(endSegmentStart, span.End); 88public static IEnumerable<TextSpan> Subtract(this IEnumerable<TextSpan> spans, TextSpan except)
TextSpanIntervalIntrospector.cs (3)
9internal readonly struct TextSpanIntervalIntrospector : IIntervalIntrospector<TextSpan> 11public int GetStart(TextSpan value) 14public int GetLength(TextSpan value)
TokenStream.cs (1)
51public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
TreeData.cs (1)
70public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
TreeData.NodeAndText.cs (3)
38return _text.ToString(TextSpan.FromBounds(token2.FullSpan.Start, token2.SpanStart)); 44return _text.ToString(TextSpan.FromBounds(token1.Span.End, token1.FullSpan.End)); 47return _text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart));
TriviaData.cs (1)
41public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
VirtualChar.cs (5)
18/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 48public readonly TextSpan Span; 54public static VirtualChar Create(Rune rune, TextSpan span) 62public static VirtualChar Create(char surrogateChar, TextSpan span) 70private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
VirtualCharSequence.Chunks.cs (1)
123var span = new TextSpan(_firstVirtualCharPosition + index, length: 1);
VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 86public VirtualCharSequence GetSubSequence(TextSpan span) 165=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 178return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
Microsoft.CodeAnalysis.CodeStyle.Fixes (31)
AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
56var span = diagnostic.Location.SourceSpan;
AbstractCodeGenerationService_FindDeclaration.cs (3)
46protected static TextSpan GetSpan(SyntaxNode node) 51return TextSpan.FromBounds(start.SpanStart, end.Span.End); 93var span = GetSpan(destination);
AbstractConflictMarkerCodeFixProvider.cs (8)
320edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 324edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, bottomEnd), "")); 333edits.Add(new TextChange(TextSpan.FromBounds(startPos, equalsEnd), "")); 337edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), "")); 346edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 352edits.Add(new TextChange(TextSpan.FromBounds(secondMiddlePos, equalsEnd), "")); 358edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, equalsEnd), "")); 363edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), ""));
AbstractConvertToAsyncCodeFixProvider.cs (1)
48private static bool TryGetNode(SyntaxNode root, TextSpan span, out SyntaxNode node)
AbstractIteratorCodeFixProvider.cs (1)
44protected virtual bool TryGetNode(SyntaxNode root, TextSpan span, out SyntaxNode node)
AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
48var diagnosticSpan = diagnostic.Location.SourceSpan;
AbstractMoveDeclarationNearReferenceService.State.cs (2)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
49private static TXmlElementSyntax? GetParamNode(SyntaxNode root, TextSpan span)
DocumentExtensions.cs (1)
114public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
FormattingCodeFixHelper.cs (3)
21var diagnosticSpan = diagnostic.Location.SourceSpan; 23var spanToFormat = TextSpan.FromBounds(
IIndentationService.cs (1)
40return document.Text.ToString(TextSpan.FromBounds(tokenLine.Start, token.SpanStart));
ISyntaxFactsService.cs (1)
20Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
NamingStyleCodeFixProvider.cs (1)
58var span = context.Span;
RenameActionAnnotation.cs (2)
21public readonly TextSpan OriginalSpan; 67TextSpan originalSpan,
RenameDeclarationLocationReference.cs (2)
19public readonly TextSpan TextSpan; 36public RenameDeclarationLocationReference(DocumentId documentId, TextSpan textSpan, bool overriddenFromMetadata, int declaringSyntaxReferencesCount)
RenameNodeSimplificationAnnotation.cs (1)
13public TextSpan OriginalTextSpan { get; set; }
RenameTokenSimplificationAnnotation.cs (1)
13public TextSpan OriginalTextSpan { get; set; }
Microsoft.CodeAnalysis.CodeStyle.LegacyTestFramework.UnitTestUtilities (36)
AbstractCodeActionOrUserDiagnosticTest.cs (25)
440out var initialMarkupWithoutSpans, out IDictionary<string, ImmutableArray<TextSpan>> initialSpanMap); 443var unnecessarySpans = initialSpanMap.GetOrAdd(UnnecessaryMarkupKey, _ => ImmutableArray<TextSpan>.Empty); 447out var expected, out IDictionary<string, ImmutableArray<TextSpan>> expectedSpanMap); 449var conflictSpans = expectedSpanMap.GetOrAdd("Conflict", _ => ImmutableArray<TextSpan>.Empty); 450var renameSpans = expectedSpanMap.GetOrAdd("Rename", _ => ImmutableArray<TextSpan>.Empty); 451var warningSpans = expectedSpanMap.GetOrAdd("Warning", _ => ImmutableArray<TextSpan>.Empty); 452var navigationSpans = expectedSpanMap.GetOrAdd("Navigation", _ => ImmutableArray<TextSpan>.Empty); 477ImmutableArray<TextSpan> expectedSpans, 493var actual = unnecessaryLocations[i].SourceSpan; 494var expected = expectedSpans[i]; 513ImmutableArray<TextSpan> expectedSpans, 570ImmutableArray<TextSpan> conflictSpans, 571ImmutableArray<TextSpan> renameSpans, 572ImmutableArray<TextSpan> warningSpans, 573ImmutableArray<TextSpan> navigationSpans, 586ImmutableArray<TextSpan> conflictSpans, 587ImmutableArray<TextSpan> renameSpans, 588ImmutableArray<TextSpan> warningSpans, 589ImmutableArray<TextSpan> navigationSpans, 627void TestAnnotations(ImmutableArray<TextSpan> expectedSpans, string annotationKind) 636var actual = annotatedItems[i].Span; 637var expected = expectedSpans[i]; 890out TextSpan span, 900private static bool TryGetDocumentAndSelectSpan(TestWorkspace workspace, out Document document, out TextSpan span) 925private static Document GetDocumentAndAnnotatedSpan(TestWorkspace workspace, out string annotation, out TextSpan span)
AbstractDiagnosticProviderBasedUserDiagnosticTest.cs (5)
149var document = GetDocumentAndSelectSpan(workspace, out var span); 161GetDocumentAndSelectSpanOrAnnotatedSpan(workspace, out var document, out var span, out var annotation); 164var filterSpan = parameters.includeDiagnosticsOutsideSelection ? (TextSpan?)null : span; 219var expected = hostDocument.SelectedSpans.Single(); 220var actual = diagnostics.Single().Location.SourceSpan;
AbstractUserDiagnosticTest.cs (6)
58var expectedSpan = hostDocumentsWithAnnotations.Single().SelectedSpans.Single(); 63var actualSpan = diagnostic.Location.SourceSpan; 110protected static Document GetDocumentAndSelectSpan(TestWorkspace workspace, out TextSpan span) 122TextSpan span, 249MarkupTestFile.GetSpans(initialMarkup, out var unused, out ImmutableArray<TextSpan> spansList); 255ISet<TextSpan> actualTextSpans;
Microsoft.CodeAnalysis.CSharp (173)
Binder\Binder_Expressions.cs (1)
4510var errorSpan = new TextSpan(start, end - start);
Binder\Binder_Statements.cs (2)
3304Text.TextSpan.FromBounds(lambdaSyntax.SpanStart, lambdaSyntax.ArrowToken.Span.End)); 3308Text.TextSpan.FromBounds(anonymousMethodSyntax.SpanStart,
Binder\Binder_Symbols.cs (1)
454diagnostics.Add(info, Location.Create(@delegate.SyntaxTree, TextSpan.FromBounds(@delegate.SpanStart, asterisk.Span.End)));
Binder\BinderFactory.BinderFactoryVisitor.cs (5)
543private Symbol GetMemberSymbol(string memberName, TextSpan memberSpan, NamedTypeSymbol container, SymbolKind kind) 575bool checkSymbol(Symbol sym, TextSpan memberSpan, SymbolKind kind, out Symbol result) 616private static bool InSpan(Location location, SyntaxTree syntaxTree, TextSpan span) 625private static bool InSpan(ImmutableArray<Location> locations, SyntaxTree syntaxTree, TextSpan span) 1042TextSpan containingSpan = containingNode.Span;
BoundTree\BoundSequencePoint.cs (1)
11public static BoundStatement Create(SyntaxNode? syntax, TextSpan? part, BoundStatement statement, bool hasErrors = false)
CodeGen\CodeGenerator.cs (10)
65private PooledDictionary<object, TextSpan> _savedSequencePoints; 398TextSpan span = node.Span; 399if (span != default(TextSpan) && _emitPdbSequencePoints) 411if (instructionsEmitted == 0 && span != default(TextSpan) && _ilEmitStyle == ILEmitStyle.Debug) 430var span = sequencePoints[i].Span; 435_savedSequencePoints ??= PooledDictionary<object, TextSpan>.GetInstance(); 444if (_savedSequencePoints is null || !_savedSequencePoints.TryGetValue(node.Identifier, out var span)) 455private void EmitStepThroughSequencePoint(SyntaxTree syntaxTree, TextSpan span) 496private TextSpan EmitSequencePoint(SyntaxTree syntaxTree, TextSpan span)
CodeGen\EmitStatement.cs (2)
1042TextSpan spSpan; 1051spSpan = TextSpan.FromBounds(syntax.SpanStart, syntax.Declaration.Span.End);
CommandLine\CSharpCompiler.cs (1)
216tree.GetMappedLineSpanAndVisibility(default(TextSpan), out isHiddenDummy);
Compilation\CSharpCompilation.cs (14)
234internal bool IsNullableAnalysisEnabledIn(CSharpSyntaxTree tree, TextSpan span) 248/// from <see cref="IsNullableAnalysisEnabledIn(CSharpSyntaxTree, TextSpan)"/>. 2399TextSpan infoSpan = info.Span; 2526public readonly TextSpan Span; 2528public ImportInfo(SyntaxTree tree, SyntaxKind kind, TextSpan span) 2708var location = syntaxTree.GetLocation(TextSpan.FromBounds(0, 0)); 2804private static bool IsDefinedOrImplementedInSourceTree(Symbol symbol, SyntaxTree tree, TextSpan? span) 2820private ImmutableArray<Diagnostic> GetDiagnosticsForMethodBodiesInTree(SyntaxTree tree, TextSpan? span, CancellationToken cancellationToken) 2901void compileMethodBodiesAndDocComments(SyntaxTree? filterTree, TextSpan? filterSpan, BindingDiagnosticBag bindingDiagnostics, CancellationToken cancellationToken) 2952private ImmutableBindingDiagnostic<AssemblySymbol> GetSourceDeclarationDiagnostics(SyntaxTree? syntaxTree = null, TextSpan? filterSpanWithinTree = null, Func<IEnumerable<Diagnostic>, SyntaxTree, TextSpan?, IEnumerable<Diagnostic>>? locationFilterOpt = null, CancellationToken cancellationToken = default) 2993private ImmutableBindingDiagnostic<AssemblySymbol> GetClsComplianceDiagnostics(SyntaxTree? syntaxTree, TextSpan? filterSpanWithinTree, CancellationToken cancellationToken) 3016private static IEnumerable<Diagnostic> FilterDiagnosticsByLocation(IEnumerable<Diagnostic> diagnostics, SyntaxTree tree, TextSpan? filterSpanWithinTree) 3030TextSpan? filterSpanWithinTree,
Compilation\CSharpSemanticModel.cs (2)
1314var fullSpan = this.Root.FullSpan; 5157internal override void ComputeDeclarationsInSpan(TextSpan span, bool getSymbol, ArrayBuilder<DeclarationInfo> builder, CancellationToken cancellationToken)
Compilation\MemberSemanticModel.cs (7)
561public sealed override ImmutableArray<Diagnostic> GetSyntaxDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 566public sealed override ImmutableArray<Diagnostic> GetDeclarationDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 571public sealed override ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 576public sealed override ImmutableArray<Diagnostic> GetDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 1825TextSpan resultSpan = default(TextSpan); 1831var span = expr.Syntax.FullSpan;
Compilation\SpeculativeSemanticModelWithMemberModel.cs (4)
231public override ImmutableArray<Diagnostic> GetSyntaxDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 236public override ImmutableArray<Diagnostic> GetDeclarationDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 241public override ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 246public override ImmutableArray<Diagnostic> GetDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SyntaxTreeSemanticModel.cs (10)
102private void VerifySpanForGetDiagnostics(TextSpan? span) 110public override ImmutableArray<Diagnostic> GetSyntaxDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 117public override ImmutableArray<Diagnostic> GetDeclarationDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 124public override ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 131public override ImmutableArray<Diagnostic> GetDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 844var span = node.Span; 1000private MemberSemanticModel GetOrAddModelForParameter(ParameterSyntax paramDecl, TextSpan span) 1041private MemberSemanticModel GetOrAddModelIfContains(CSharpSyntaxNode node, TextSpan span) 1726private Symbol GetDeclaredMember(NamespaceOrTypeSymbol container, TextSpan declarationSpan, NameSyntax name) 1753private Symbol GetDeclaredMember(NamespaceOrTypeSymbol container, TextSpan declarationSpan, string name = null)
Compiler\ClsComplianceChecker.cs (3)
28private readonly TextSpan? _filterSpanWithinTree; //if filterTree and filterSpanWithinTree is not null, limit analysis to types residing within this span in the filterTree. 40TextSpan? filterSpanWithinTree, 73public static void CheckCompliance(CSharpCompilation compilation, BindingDiagnosticBag diagnostics, CancellationToken cancellationToken, SyntaxTree filterTree = null, TextSpan? filterSpanWithinTree = null)
Compiler\DocumentationCommentCompiler.cs (3)
38private readonly TextSpan? _filterSpanWithinTree; //if filterTree and filterSpanWithinTree is not null, limit analysis to types residing within this span in the filterTree. 56TextSpan? filterSpanWithinTree, 86public static void WriteDocumentationCommentXml(CSharpCompilation compilation, string? assemblyName, Stream? xmlDocStream, BindingDiagnosticBag diagnostics, CancellationToken cancellationToken, SyntaxTree? filterTree = null, TextSpan? filterSpanWithinTree = null)
Compiler\UnprocessedDocumentationCommentFinder.cs (4)
17private readonly TextSpan? _filterSpanWithinTree; 21private UnprocessedDocumentationCommentFinder(DiagnosticBag diagnostics, TextSpan? filterSpanWithinTree, CancellationToken cancellationToken) 29public static void ReportUnprocessed(SyntaxTree tree, TextSpan? filterSpanWithinTree, DiagnosticBag diagnostics, CancellationToken cancellationToken) 38private bool IsSyntacticallyFilteredOut(TextSpan fullSpan)
CSharpDeclarationComputer.cs (1)
24TextSpan span,
Errors\ErrorFacts.cs (1)
542/// <see cref="SemanticModel.GetDiagnostics(Text.TextSpan?, System.Threading.CancellationToken)"/> API.
FlowAnalysis\AbstractFlowPass.cs (2)
294protected readonly TextSpan RegionSpan; 296protected bool RegionContains(TextSpan span)
Generated\BoundNodes.xml.Generated.cs (7)
3061public BoundSequencePointWithSpan(SyntaxNode syntax, BoundStatement? statementOpt, TextSpan span, bool hasErrors = false) 3069public TextSpan Span { get; } 3074public BoundSequencePointWithSpan Update(BoundStatement? statementOpt, TextSpan span) 3162public BoundStepThroughSequencePoint(SyntaxNode syntax, TextSpan span, bool hasErrors) 3168public BoundStepThroughSequencePoint(SyntaxNode syntax, TextSpan span) 3174public TextSpan Span { get; } 3179public BoundStepThroughSequencePoint Update(TextSpan span)
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (5)
493private BoundStatement AddAnalysisPoint(SyntaxNode syntaxForSpan, Text.TextSpan alternateSpan, SyntheticBoundNodeFactory statementFactory) 593private static TextSpan SkipAttributes(SyntaxNode syntax) 623private static TextSpan SkipAttributes(SyntaxNode syntax, SyntaxList<AttributeListSyntax> attributes, SyntaxTokenList modifiers, SyntaxToken keyword, TypeSyntax? type) 627var originalSpan = syntax.Span; 630var startSpan = modifiers.Node != null ? modifiers.Span : (keyword.Node != null ? keyword.Span : type!.Span);
Lowering\Instrumentation\DebugInfoInjector.cs (14)
199var span = TextSpan.FromBounds( 209TextSpan conditionSequencePointSpan = TextSpan.FromBounds( 248var span = forEachSyntax.AwaitKeyword != default 249? TextSpan.FromBounds(forEachSyntax.AwaitKeyword.Span.Start, forEachSyntax.ForEachKeyword.Span.End) 268TextSpan iterationVarDeclSpan; 274iterationVarDeclSpan = TextSpan.FromBounds(forEachSyntax.Type.SpanStart, forEachSyntax.Identifier.Span.End); 319TextSpan.FromBounds( 335var span = TextSpan.FromBounds(labeledSyntax.Identifier.SpanStart, labeledSyntax.ColonToken.Span.End); 354TextSpan.FromBounds(lockSyntax.LockKeyword.SpanStart, lockSyntax.CloseParenToken.Span.End)); 373TextSpan switchSequencePointSpan = TextSpan.FromBounds(
Lowering\Instrumentation\DebugInfoInjector_SequencePoints.cs (14)
22GetBreakpointSpan(declaratorSyntax, out _, out TextSpan? part); 33TextSpan part = TextSpan.FromBounds(start, end); 44TextSpan span = TextSpan.FromBounds(start, end); 48private static TextSpan CreateSpanForConstructorInitializer(ConstructorDeclarationSyntax constructorSyntax) 55return TextSpan.FromBounds(start, end); 65return TextSpan.FromBounds(start, end); 72private static TextSpan CreateSpan(SyntaxTokenList startOpt, SyntaxNodeOrToken startFallbackOpt, SyntaxNodeOrToken endOpt) 100return TextSpan.FromBounds(startPos, endPos); 106internal static void GetBreakpointSpan(VariableDeclaratorSyntax declaratorSyntax, out SyntaxNode node, out TextSpan? part) 144part = TextSpan.FromBounds(declarationSyntax.SpanStart, declaratorSyntax.Span.End); 161internal static void GetFirstLocalOrFieldBreakpointSpan(SyntaxToken? firstToken, VariableDeclaratorSyntax declaratorSyntax, out SyntaxNode node, out TextSpan? part) 186part = TextSpan.FromBounds(start, end);
Lowering\LocalRewriter\LocalRewriter_SwitchExpression.cs (1)
78var spanForSwitchBody = new TextSpan(spanStart, spanEnd - spanStart);
Lowering\SyntheticBoundNodeFactory.cs (1)
1134public BoundStatement SequencePointWithSpan(CSharpSyntaxNode syntax, TextSpan span, BoundStatement statement)
Parser\Blender.cs (2)
158var finalSpan = TextSpan.FromBounds(start, changeRange.Span.End);
Parser\Blender.Reader.cs (2)
287var oldSpan = nodeOrToken.FullSpan; 288var changeSpan = _changes.Peek().Span;
Symbols\Source\SourceConstructorSymbolBase.cs (1)
195TextSpan span;
Symbols\Source\SourceMemberContainerSymbol.cs (1)
989internal override bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken)
Symbols\Source\SourceMemberFieldSymbol.cs (1)
629internal override bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken = default(CancellationToken))
Symbols\Source\SourceNamespaceSymbol.cs (1)
480internal override bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken = default(CancellationToken))
Symbols\Source\SourceOrdinaryMethodSymbol.cs (1)
617TextSpan? definedWithinSpan,
Symbols\Symbol.cs (1)
800internal virtual bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken = default(CancellationToken))
Symbols\SymbolDistinguisher.cs (1)
169var span = syntaxReferences[0].Span;
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (2)
255internal override bool IsDefinedInSourceTree(SyntaxTree tree, TextSpan? definedWithinSpan, CancellationToken cancellationToken) 265var span = definedWithinSpan.GetValueOrDefault();
Syntax\CSharpLineDirectiveMap.cs (1)
222internal override FileLinePositionSpan TranslateSpanAndVisibility(SourceText sourceText, string treeFilePath, TextSpan span, out bool isHiddenPosition)
Syntax\CSharpSyntaxTree.cs (8)
597public override IList<TextSpan> GetChangedSpans(SyntaxTree oldTree) 646public override FileLinePositionSpan GetLineSpan(TextSpan span, CancellationToken cancellationToken = default) 665public override FileLinePositionSpan GetMappedLineSpan(TextSpan span, CancellationToken cancellationToken = default) 681/// Gets a <see cref="FileLinePositionSpan"/> for a <see cref="TextSpan"/>. FileLinePositionSpans are used 684/// <param name="span">The source <see cref="TextSpan" /> to convert.</param> 687internal override FileLinePositionSpan GetMappedLineSpanAndVisibility(TextSpan span, out bool isHiddenPosition) 729internal bool? IsNullableAnalysisEnabled(TextSpan span) => GetNullableContextStateMap().IsNullableAnalysisEnabled(span); 767public override Location GetLocation(TextSpan span)
Syntax\CSharpSyntaxTree.Dummy.cs (1)
89public override FileLinePositionSpan GetLineSpan(TextSpan span, CancellationToken cancellationToken = default(CancellationToken))
Syntax\NullableContextStateMap.cs (1)
103internal bool? IsNullableAnalysisEnabled(TextSpan span)
Syntax\SimpleSyntaxReference.cs (1)
30public override TextSpan Span
Syntax\SyntaxNodeRemover.cs (19)
52private readonly TextSpan _searchSpan; 67private static TextSpan ComputeTotalSpan(SyntaxNode[] nodes) 69var span0 = nodes[0].FullSpan; 75var span = nodes[i].FullSpan; 344var span = TextSpan.FromBounds(token.Span.Start, node.Span.End); 345var fullSpan = TextSpan.FromBounds(token.FullSpan.Start, node.FullSpan.End); 378var span = TextSpan.FromBounds(node.Span.Start, token.Span.End); 379var fullSpan = TextSpan.FromBounds(node.FullSpan.Start, token.FullSpan.End); 404private TextSpan GetRemovedSpan(TextSpan span, TextSpan fullSpan) 406var removedSpan = fullSpan; 410removedSpan = TextSpan.FromBounds(span.Start, removedSpan.End); 415removedSpan = TextSpan.FromBounds(removedSpan.Start, span.End); 421private void AddDirectives(SyntaxNode node, TextSpan span)
Syntax\SyntaxNormalizer.cs (2)
16private readonly TextSpan _consideredSpan; 34private SyntaxNormalizer(TextSpan consideredSpan, int initialDepth, string indentWhitespace, string eolWhitespace, bool useElasticTrivia)
Syntax\SyntaxReplacer.cs (11)
75private readonly HashSet<TextSpan> _spanSet; 77private readonly TextSpan _totalSpan; 97_spanSet = new HashSet<TextSpan>( 132private static TextSpan ComputeTotalSpan(IEnumerable<TextSpan> spans) 138foreach (var span in spans) 156private bool ShouldVisit(TextSpan span) 166foreach (var s in _spanSet) 289private readonly TextSpan _elementSpan; 296TextSpan elementSpan, 315private bool ShouldVisit(TextSpan span)
Microsoft.CodeAnalysis.CSharp.CodeStyle (121)
AggregatedFormattingResult.cs (1)
16public AggregatedFormattingResult(SyntaxNode node, IList<AbstractFormattingResult> results, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? formattingSpans)
BaseFormattingRule.cs (3)
20TextSpan textSpan, 52list.Add(FormattingOperations.CreateIndentBlockOperation(startToken, endToken, TextSpan.FromBounds(startPosition, endPosition), indentationDelta: -1, option: option)); 88TextSpan textSpan,
ConvertProgramAnalysis_ProgramMain.cs (1)
77TextSpan.FromBounds(start, root.Members.OfType<GlobalStatementSyntax>().Last().FullSpan.End));
ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
51: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.SemicolonToken.Span.End));
ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
55: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.Name.Span.End));
CSharpAddBracesDiagnosticAnalyzer.cs (2)
131var ifStatementSpanWithoutElse = TextSpan.FromBounds(statement.Span.Start, embeddedStatement.Span.End);
CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
314var scopeSpan = scope.Span;
CSharpRemoveUnnecessaryCastDiagnosticAnalyzer.cs (3)
29protected override TextSpan GetFadeSpan(ExpressionSyntax node) 30=> node is CastExpressionSyntax cast ? TextSpan.FromBounds(cast.OpenParenToken.SpanStart, cast.CloseParenToken.Span.End) : 31node is BinaryExpressionSyntax binary ? TextSpan.FromBounds(binary.OperatorToken.SpanStart, node.Span.End) : throw ExceptionUtilities.Unreachable();
CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (1)
50protected override IEnumerable<TextSpan> GetFixableDiagnosticSpans(
CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (4)
205var startReportSpan = TextSpan.FromBounds(anonymousFunction.SpanStart, invokedExpression.SpanStart); 206var endReportSpan = TextSpan.FromBounds(invokedExpression.Span.End, anonymousFunction.Span.End);
CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (16)
83private static ImmutableArray<TextSpan> AnalyzeCodeBlock(CodeBlockAnalysisContext context, int positionOfFirstReducingNullableDirective) 90private ImmutableArray<Diagnostic> AnalyzeSemanticModel(SemanticModelAnalysisContext context, int positionOfFirstReducingNullableDirective, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? codeBlockIntervalTree, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? possibleNullableImpactIntervalTree) 97possibleNullableImpactIntervalTree ??= new SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>(new TextSpanIntervalIntrospector(), values: null); 98foreach (var interval in simplifier.Spans) 148possibleNullableImpactIntervalTree ??= new SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>(new TextSpanIntervalIntrospector(), values: null); 177IntervalTree = SimpleIntervalTree.Create(new TextSpanIntervalIntrospector(), Array.Empty<TextSpan>()); 178PossibleNullableImpactIntervalTree = SimpleIntervalTree.Create(new TextSpanIntervalIntrospector(), Array.Empty<TextSpan>()); 185public SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? IntervalTree { get; } 186public SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? PossibleNullableImpactIntervalTree { get; } 218public bool TryProceedWithInterval(TextSpan span) 222public bool TryReportNullableImpactingSpans(TextSpan span, ImmutableArray<TextSpan> nullableImpactingSpans) 226private bool TryProceedOrReportNullableImpactingSpans(TextSpan span, ImmutableArray<TextSpan>? nullableImpactingSpans) 241foreach (var nullableImpactingSpan in spans)
CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (3)
70SemanticModelAnalysisContext context, SyntaxNode root, TextSpan sourceSpan) 125var span = TextSpan.FromBounds(section[0].FullSpan.Start, section.Last().FullSpan.End);
CSharpSmartTokenFormatter.cs (2)
67_root, new[] { TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End) }, _options.FormattingOptions, smartTokenformattingRules, cancellationToken); 121_root, new[] { TextSpan.FromBounds(adjustedStartPosition, adjustedEndPosition) }, _options.FormattingOptions, smartTokenformattingRules, cancellationToken);
CSharpSyntaxFacts.cs (7)
932public TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node) 959public bool ContainsInMemberBody([NotNullWhen(true)] SyntaxNode? node, TextSpan span) 979private static TextSpan GetBlockBodySpan(BlockSyntax body) 980=> TextSpan.FromBounds(body.OpenBraceToken.Span.End, body.CloseBraceToken.SpanStart); 1094public TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) 1123return !branch.IsActive || !branch.BranchTaken ? TextSpan.FromBounds(branch.FullSpan.Start, position) : default; 1371public bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken)
CSharpSyntaxFormatting.cs (1)
45protected override IFormattingResult CreateAggregatedFormattingResult(SyntaxNode node, IList<AbstractFormattingResult> results, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? formattingSpans = null)
CSharpTypeStyleDiagnosticAnalyzerBase.cs (1)
76private static Diagnostic CreateDiagnostic(DiagnosticDescriptor descriptor, SyntaxNode declaration, TextSpan diagnosticSpan, ReportDiagnostic severity)
CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (2)
45var fadeSpan = TextSpan.FromBounds(defaultExpression.OpenParenToken.SpanStart, defaultExpression.CloseParenToken.Span.End);
CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (4)
54var fadeSpan = TextSpan.FromBounds(nameColon.Name.SpanStart, nameColon.ColonToken.Span.End); 79var fadeSpan = TextSpan.FromBounds(nameEquals.Name.SpanStart, nameEquals.EqualsToken.Span.End);
CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
259TextSpan.FromBounds(arguments.First().SpanStart, arguments.Last().Span.End));
CSharpVirtualCharService.cs (11)
205var lineSpan = currentLine.Span; 252using var _ = ArrayBuilder<(char ch, TextSpan span)>.GetInstance(out var charResults); 268if (!IsLegalBraceEscape(tokenText, index, offset, out var braceSpan)) 285string tokenText, int offset, int startIndexInclusive, int endIndexExclusive, ArrayBuilder<(char ch, TextSpan span)> charResults) 295private static void ConvertCharactersToRunes(ArrayBuilder<(char ch, TextSpan span)> charResults, ImmutableSegmentedList<VirtualChar>.Builder runeResults) 315runeResults.Add(VirtualChar.Create(rune, TextSpan.FromBounds(span.Start, nextSpan.End))); 329ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 342ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 375ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 394ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index, char character) 507result.Add((character, TextSpan.FromBounds(startIndex + offset, endIndex + offset)));
FormattingResult.cs (1)
19internal FormattingResult(TreeData treeInfo, TokenStream tokenStream, TextSpan spanToFormat)
IndentBlockFormattingRule.cs (5)
120TextSpan.FromBounds(lastTokenOfLabel.FullSpan.End, nextToken.SpanStart) : TextSpan.FromBounds(lastTokenOfLabel.FullSpan.End, lastTokenOfLabel.FullSpan.End)); 128var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 129span = lastSection ? span : TextSpan.FromBounds(span.Start, endToken.FullSpan.End); 346AddIndentBlockOperation(list, firstToken, lastToken, TextSpan.FromBounds(firstToken.FullSpan.Start, lastToken.FullSpan.End));
InvokeDelegateWithConditionalAccessAnalyzer.cs (2)
183var fadeLocation = Location.Create(tree, TextSpan.FromBounds(firstStatement.SpanStart, previousToken.Span.End)); 202fadeLocation = Location.Create(tree, TextSpan.FromBounds(nextToken.Span.Start, ifStatement.Span.End));
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (7)
240var fullSpan = trivia.FullSpan; 269var span = trivia.FullSpan; 287var span = trivia.FullSpan; 324var span = trivia.FullSpan; 350var span = trivia.FullSpan; 435var span = token.Span; 474var span = token.Span;
NullableImpactingSpanWalker.cs (7)
21private readonly SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? _ignoredSpans; 24private ImmutableArray<TextSpan>.Builder? _spans; 28public ImmutableArray<TextSpan> Spans => _spans?.ToImmutable() ?? ImmutableArray<TextSpan>.Empty; 30public ImmutableArray<TextSpan>.Builder SpansBuilder 35Interlocked.CompareExchange(ref _spans, ImmutableArray.CreateBuilder<TextSpan>(), null); 44SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? ignoredSpans,
SuppressFormattingRule.cs (2)
335var textSpan = TextSpan.FromBounds(startToken.Span.End, endToken.SpanStart);
SyntaxNodeExtensions.cs (14)
595public static bool ContainsInterleavedDirective(this SyntaxNode syntaxNode, TextSpan span, CancellationToken cancellationToken) 600TextSpan textSpan, 609TextSpan textSpan, 628TextSpan textSpan, 640var matchSpan = match.Span; 796var span = node.FullSpan; 890public static bool CheckTopLevel(this SyntaxNode node, TextSpan span) 920public static bool ContainsInArgument(this ConstructorInitializerSyntax initializer, TextSpan textSpan) 930public static bool ContainsInBlockBody(this BlockSyntax block, TextSpan textSpan) 937var blockSpan = TextSpan.FromBounds(block.OpenBraceToken.Span.End, block.CloseBraceToken.SpanStart); 941public static bool ContainsInExpressionBodiedMemberBody(this ArrowExpressionClauseSyntax expressionBodiedMember, TextSpan textSpan) 948var expressionBodiedMemberBody = TextSpan.FromBounds(expressionBodiedMember.Expression.SpanStart, expressionBodiedMember.Expression.Span.End);
SyntaxTriviaExtensions.cs (1)
156var span = trivia.FullSpan;
TriviaDataFactory.ComplexTrivia.cs (3)
56var span = TextSpan.FromBounds(commonToken1.Span.End, formatSpanEnd); 106public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
TriviaDataFactory.FormattedComplexTrivia.cs (1)
58public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
TriviaDataFactory.ModifiedComplexTrivia.cs (1)
104public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
TriviaRewriter.cs (6)
22private readonly SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector> _spans; 30SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector> spanToFormat, 99private TextSpan GetTextSpan(ValueTuple<SyntaxToken, SyntaxToken> pair) 103return TextSpan.FromBounds(_node.FullSpan.Start, pair.Item2.SpanStart); 108return TextSpan.FromBounds(pair.Item1.Span.End, _node.FullSpan.End); 111return TextSpan.FromBounds(pair.Item1.Span.End, pair.Item2.SpanStart);
UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (1)
100TextSpan.FromBounds(declaration.SpanStart, declaration.ArrowToken.Span.End));
UseUtf8StringLiteralDiagnosticAnalyzer.cs (2)
124var span = TextSpan.FromBounds(elements[0].Syntax.SpanStart, elements[^1].Syntax.Span.End);
WrappingFormattingRule.cs (2)
187var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (35)
AbstractAssignOutParametersCodeFixProvider.cs (1)
49private static (SyntaxNode container, SyntaxNode exprOrStatement) GetContainer(SyntaxNode root, TextSpan span)
ArrowExpressionClausePlacementCodeFixProvider.cs (1)
98edits.Add(new TextChange(TextSpan.FromBounds(start, end), ""));
CompilationUnitSyntaxExtensions.cs (5)
32var span = GetUsingsSpan(root, namespaceDeclaration); 48private static TextSpan GetUsingsSpan(CompilationUnitSyntax root, BaseNamespaceDeclarationSyntax? namespaceDeclaration) 55return TextSpan.FromBounds(start, end); 64return TextSpan.FromBounds(start, end); 72return TextSpan.FromBounds(start, end);
ConditionalExpressionPlacementCodeFixProvider.cs (1)
100edits.Add(new TextChange(TextSpan.FromBounds(start, end), ""));
ConvertNamespaceTransform.cs (3)
73public static (SourceText text, TextSpan semicolonSpan) ConvertNamespaceDeclaration(ParsedDocument document, NamespaceDeclarationSyntax namespaceDeclaration, SyntaxFormattingOptions options, CancellationToken cancellationToken) 92private static (SyntaxNode root, TextSpan semicolonSpan) ReplaceWithFileScopedNamespace( 119private static (SourceText text, TextSpan semicolonSpan) DedentNamespace(
ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
59using var _ = ArrayBuilder<TextSpan>.GetInstance(diagnostics.Length, out var spans);
CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
41var diagnosticSpan = diagnostic.Location.SourceSpan;
CSharpAddYieldCodeFixProvider.cs (1)
214SyntaxNode root, TextSpan span, [NotNullWhen(true)] out SyntaxNode? node)
CSharpConvertToRecordCodeFixProvider.cs (1)
37var span = context.Span;
CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
66var span = diagnostic.Location.SourceSpan;
CSharpMakeMemberRequiredCodeFixProvider.cs (1)
41var span = context.Span;
CSharpRemoveUnnecessaryImportsService.cs (5)
80var spans = new List<TextSpan>(); 90List<TextSpan> spans, 94spans.Add(TextSpan.FromBounds(0, GetEndPosition(compilationUnit, compilationUnit.Members))); 102List<TextSpan> spans, 106spans.Add(TextSpan.FromBounds(namespaceMember.SpanStart, GetEndPosition(namespaceMember, namespaceMember.Members)));
CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
70Document document, TextSpan span, SyntaxNode newExpression, CancellationToken cancellationToken)
CSharpSyntaxFactsService.cs (1)
116public Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken)
HideBaseCodeFixProvider.cs (1)
38var diagnosticSpan = diagnostic.Location.SourceSpan;
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs\SyntaxTokenExtensions.cs (1)
544var existingAccessorSpan = existingAccessor.Span;
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTokenExtensions.cs\SyntaxTokenExtensions.cs (1)
22var name = SyntaxFactory.ParseName(syntaxTree.GetText(cancellationToken).ToString(TextSpan.FromBounds(genericIdentifier.SpanStart, lastToken.Span.End)));
MakeLocalFunctionStaticCodeFixHelper.cs (1)
134var referenceSpan = location.Location.SourceSpan;
MakeRefStructCodeFixProvider.cs (1)
45var span = context.Span;
RemoveInKeywordCodeFixProvider.cs (1)
43var diagnosticSpan = diagnostic.Location.SourceSpan;
RemoveNewModifierCodeFixProvider.cs (1)
41var diagnosticSpan = diagnostic.Location.SourceSpan;
TypeDeclarationSyntaxExtensions.cs (3)
29indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken)); 35indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken)); 47indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken));
UseExplicitTypeForConstCodeFixProvider.cs (1)
67Document document, TextSpan span, ITypeSymbol type, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (1)
CommandLineTests.cs (1)
14337var diagnosticSpan = new TextSpan(2, 2);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (76)
AutomaticCompletion\AutomaticLineEnderCommandHandler.cs (3)
119private static TextSpan? GetFormattedTextSpan(SyntaxNode root, SyntaxToken endToken) 138return CommonFormattingHelpers.GetFormattingSpan(root, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)); 218var endingString = text.ToString(TextSpan.FromBounds(lastToken.Span.End, line.End));
AutomaticCompletion\AutomaticLineEnderCommandHandler_Helpers.cs (1)
740return TextSpan.FromBounds(openBrace.SpanStart, closeBrace.Span.End).Contains(caretPosition);
BlockCommentEditing\BlockCommentEditingCommandHandler.cs (1)
290var span = trivia.FullSpan;
CommentSelection\CSharpToggleBlockCommentCommandHandler.cs (2)
47protected override ImmutableArray<TextSpan> GetBlockCommentsInDocument(Document document, ITextSnapshot snapshot, 48TextSpan linesContainingSelections, CommentSelectionInfo commentInfo, CancellationToken cancellationToken)
ConvertNamespace\ConvertNamespaceCommandHandler.cs (1)
107private (SourceText? convertedText, TextSpan semicolonSpan) ConvertNamespace(
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (1)
305var editSpan = token.Span;
Formatting\CSharpFormattingInteractionService.cs (4)
91TextSpan? textSpan, 97var span = textSpan ?? new TextSpan(0, parsedDocument.Root.FullSpan.Length); 98var formattingSpan = CommonFormattingHelpers.GetFormattingSpan(parsedDocument.Root, span); 103public Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken)
Interactive\CSharpSendToInteractiveSubmissionProvider.cs (6)
36protected override IEnumerable<TextSpan> GetExecutableSyntaxTreeNodeSelection(TextSpan selectionSpan, SyntaxNode root) 40? new TextSpan[] { expandedNode.Span } 41: Array.Empty<TextSpan>(); 49private static SyntaxNode? GetSyntaxNodeForSubmission(TextSpan selectionSpan, SyntaxNode root) 119TextSpan selectionSpan,
StringCopyPaste\AbstractPasteProcessor.cs (6)
74/// mapped forward (<see cref="MapSpanForward(TextSpan)"/>) to <see cref="SnapshotAfterPaste"/> in an inclusive 80protected readonly ImmutableArray<TextSpan> TextContentsSpansAfterPaste; 135protected TextSpan MapSpanForward(TextSpan span) 143SourceText textAfterChange, ImmutableArray<TextSpan> textContentSpansAfterChange) 158SourceText textAfterChange, ImmutableArray<TextSpan> textContentSpansAfterChange)
StringCopyPaste\KnownSourcePasteProcessor.cs (3)
35private readonly TextSpan _selectionSpanBeforePaste; 52TextSpan selectionSpanBeforePaste, 170out SourceText textAfterBasicPaste, out ImmutableArray<TextSpan> contentSpansAfterBasicPaste)
StringCopyPaste\StringCopyPasteCommandHandler.cs (4)
263return textBeforePaste.ToString(TextSpan.FromBounds(lastLine.Span.Start, quotePosition)); 293var spanAfterPaste = MapSpan(stringExpressionBeforePaste.Span, snapshotBeforePaste, snapshotAfterPaste); 314var spanAfterPaste = MapSpan(stringExpressionBeforePaste.Span, snapshotBeforePaste, snapshotAfterPaste); 357static int FindIndex(TextSpan span, int position)
StringCopyPaste\StringCopyPasteData.cs (6)
76public static StringCopyPasteData? TryCreate(IVirtualCharLanguageService virtualCharService, ExpressionSyntax stringExpression, TextSpan selectionSpan) 84private static StringCopyPasteData? TryCreateForLiteral(IVirtualCharLanguageService virtualCharService, LiteralExpressionSyntax literal, TextSpan span) 98TextSpan selectionSpan, 126var subsequence = virtualChars.GetSubSequence(TextSpan.FromBounds(firstCharIndexInclusive, lastCharIndexInclusive + 1)); 134TextSpan selectionSpan, 152TextSpan selectionSpan)
StringCopyPaste\StringCopyPasteHelpers.cs (10)
186public static int GetLongestQuoteSequence(SourceText text, TextSpan span) 189public static int GetLongestOpenBraceSequence(SourceText text, TextSpan span) 192public static int GetLongestCloseBraceSequence(SourceText text, TextSpan span) 200private static int GetLongestCharacterSequence(SourceText text, TextSpan span, char character) 517commonIndentPrefix = GetCommonIndentationPrefix(commonIndentPrefix, text, TextSpan.FromBounds(line.Start, nonWhitespaceIndex)); 524private static string? GetCommonIndentationPrefix(string? commonIndentPrefix, SourceText text, TextSpan lineWhitespaceSpan) 542public static TextSpan MapSpan(TextSpan span, ITextSnapshot from, ITextSnapshot to) 545public static bool RawContentMustBeMultiLine(SourceText text, ImmutableArray<TextSpan> spans) 561foreach (var span in spans)
StringCopyPaste\StringInfo.cs (26)
35public readonly TextSpan StartDelimiterSpan; 40public readonly TextSpan EndDelimiterSpan; 45public readonly TextSpan EndDelimiterSpanWithoutSuffix; 55public readonly ImmutableArray<TextSpan> ContentSpans; 60TextSpan startDelimiterSpan, 61TextSpan endDelimiterSpan, 62TextSpan endDelimiterSpanWithoutSuffix, 63ImmutableArray<TextSpan> contentSpans) 109var contentSpans = ImmutableArray.Create(TextSpan.FromBounds(start, end)); 115startDelimiterSpan: TextSpan.FromBounds(literal.SpanStart, start), 116endDelimiterSpan: TextSpan.FromBounds(end, literal.Span.End), 117endDelimiterSpanWithoutSuffix: TextSpan.FromBounds(end, endBeforeU8Suffix), 156TextSpan.FromBounds(literal.SpanStart, rawStart), 157TextSpan.FromBounds(rawEnd, literal.Span.End), 158TextSpan.FromBounds(rawEnd, endBeforeU8Suffix), 159contentSpans: ImmutableArray.Create(TextSpan.FromBounds(start, end))); 186startDelimiterSpan: TextSpan.FromBounds(literal.SpanStart, start), 187endDelimiterSpan: TextSpan.FromBounds(end, literal.Span.End), 188endDelimiterSpanWithoutSuffix: TextSpan.FromBounds(end, endBeforeU8Suffix), 189ImmutableArray.Create(TextSpan.FromBounds(start, end))); 213using var result = TemporaryArray<TextSpan>.Empty; 220result.Add(TextSpan.FromBounds(currentPosition, content.SpanStart)); 226result.Add(TextSpan.FromBounds(currentPosition, end)); 230startDelimiterSpan: TextSpan.FromBounds(interpolatedString.SpanStart, interpolatedString.StringStartToken.Span.End), 231endDelimiterSpan: TextSpan.FromBounds(interpolatedString.StringEndToken.SpanStart, interpolatedString.Span.End), 232endDelimiterSpanWithoutSuffix: TextSpan.FromBounds(interpolatedString.StringEndToken.SpanStart, endBeforeU8Suffix),
StringCopyPaste\UnknownSourcePasteProcessor.cs (2)
153/// <inheritdoc cref="AbstractPasteProcessor.GetQuotesToAddToRawString(SourceText, ImmutableArray{TextSpan})" /> 157/// <inheritdoc cref="AbstractPasteProcessor.GetDollarSignsToAddToRawString(SourceText, ImmutableArray{TextSpan})" />
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (108)
Classification\SemanticClassifierTests.cs (1)
36protected override async Task<ImmutableArray<ClassifiedSpan>> GetClassificationSpansAsync(string code, TextSpan span, ParseOptions? options, TestHost testHost)
Classification\SyntacticClassifierTests.cs (1)
21protected override async Task<ImmutableArray<ClassifiedSpan>> GetClassificationSpansAsync(string code, TextSpan span, ParseOptions? options, TestHost testHost)
Classification\TotalClassifierTests.cs (1)
23protected override async Task<ImmutableArray<ClassifiedSpan>> GetClassificationSpansAsync(string code, TextSpan span, ParseOptions? options, TestHost testHost)
CodeActions\MoveType\MoveTypeTests.MoveScope.cs (1)
919var textSpan = workspace.Documents[0].SelectedSpans[0];
CodeActions\Preview\PreviewExceptionTests.cs (1)
114var span = document.GetSyntaxRootAsync().Result.Span;
CodeActions\Preview\PreviewTests.cs (1)
99var span = document.GetSyntaxRootAsync().Result.Span;
CodeActions\SyncNamespace\CSharpSyncNamespaceTestsBase.cs (4)
123conflictSpans: ImmutableArray<TextSpan>.Empty, 124renameSpans: ImmutableArray<TextSpan>.Empty, 125warningSpans: ImmutableArray<TextSpan>.Empty, 126navigationSpans: ImmutableArray<TextSpan>.Empty,
CodeRefactorings\AddMissingImports\CSharpAddMissingImportsRefactoringProviderTests.cs (1)
37var pastedTextSpan = hostDocument.SelectedSpans.FirstOrDefault();
Completion\CompletionProviders\OverrideCompletionProviderTests.cs (1)
3093Assert.Equal(change.Span, TextSpan.FromBounds(136, 145));
ConvertAutoPropertyToFullProperty\ConvertAutoPropertyToFullPropertyTests.cs (8)
1234conflictSpans: ImmutableArray<TextSpan>.Empty, 1235renameSpans: ImmutableArray<TextSpan>.Empty, 1236warningSpans: ImmutableArray<TextSpan>.Empty, 1237navigationSpans: ImmutableArray<TextSpan>.Empty, 1281conflictSpans: ImmutableArray<TextSpan>.Empty, 1282renameSpans: ImmutableArray<TextSpan>.Empty, 1283warningSpans: ImmutableArray<TextSpan>.Empty, 1284navigationSpans: ImmutableArray<TextSpan>.Empty,
Debugging\DataTipInfoGetterTests.cs (2)
46private static async Task TestSpanGetterAsync(string markup, Func<Document, int, TextSpan?, Task> continuation) 53: (TextSpan?)null;
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (1)
356=> context.ReportDiagnostic(Diagnostic.Create(Descriptor, Location.Create(context.Tree, TextSpan.FromBounds(1000, 2000))));
Diagnostics\Suppression\SuppressionTests.cs (1)
462var document = GetDocumentAndSelectSpan(workspace, out var span);
EditAndContinue\BreakpointSpansTests.cs (9)
39markup, out var source, out var position, out TextSpan? expectedSpan); 43tree, position.Value, CancellationToken.None, out var breakpointSpan); 72out var source, out var position, out ImmutableArray<TextSpan> expectedSpans); 84var expectedEnvelope = expectedSpans.IsEmpty ? default : TextSpan.FromBounds(expectedSpans[0].Start, expectedSpans[^1].End); 87var actualEnvelope = BreakpointSpans.GetEnvelope(declarationNode); 91public static IEnumerable<TextSpan> GetBreakpointSequence(SyntaxNode root, int position) 93TextSpan lastSpan = default; 97if (BreakpointSpans.TryGetClosestBreakpointSpan(root, p, out var span) && span.Start > lastSpan.Start)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (6)
54foreach (var expected in GetExpectedSpans(source)) 64var actual = CSharpEditAndContinueAnalyzer.GetDiagnosticSpan(node, EditKind.Update); 73private static IEnumerable<TextSpan> GetExpectedSpans(string source) 99TextSpan? span; 315var oldStatementTextSpan = new TextSpan(oldStatementPosition, oldStatementSource.Length); 339var newStatementTextSpan = newText.Lines.GetTextSpan(newStatementSpan);
EditAndContinue\Helpers\EditingTestBase.cs (2)
63internal static SemanticEditDescription SemanticEdit(SemanticEditKind kind, Func<Compilation, ISymbol> symbolProvider, IEnumerable<KeyValuePair<TextSpan, TextSpan>>? syntaxMap, string? partialType = null)
ExtractMethod\ExtractMethodBase.cs (2)
42var textSpan = testDocument.SelectedSpans.Single(); 166protected static async Task TestSelectionAsync(string codeWithMarker, bool expectedFail = false, CSharpParseOptions parseOptions = null, TextSpan? textSpanOverride = null)
ExtractMethod\MiscTests.cs (2)
40MarkupTestFile.GetSpan(markupCode, out var code, out var span); 85MarkupTestFile.GetSpan(markupCode, out var code, out var span);
ExtractMethod\SelectionValidatorTests.cs (1)
1605var span = new TextSpan(12, 1);
FixInterpolatedVerbatimString\FixInterpolatedVerbatimStringCommandHandlerTests.cs (1)
68out var expectedOutput, out ImmutableArray<TextSpan> expectedSpans);
Formatting\Indentation\CSharpFormatterTestsBase.cs (1)
109TextSpan span = default)
Formatting\Indentation\SmartTokenFormatterFormatTokenTests.cs (6)
563out var code, out var position, out TextSpan span); 579TextSpan span = default) 591TextSpan span) 630out var code, out var position, out TextSpan span); 646TextSpan span = default) 658TextSpan span)
Intents\IntentTestsBase.cs (1)
113var priorSelection = testDocument.AnnotatedSpans["priorSelection"].Single();
LineSeparators\LineSeparatorTests.cs (2)
549foreach (var span in spans.OrderBy(t => t.Start)) 553var expectedSpan = expectedToken.Span;
NavigateTo\NavigateToSearcherTests.cs (4)
265private readonly TextSpan _sourceSpan; 267public TestNavigateToSearchResult(TestWorkspace workspace, TextSpan sourceSpan) 274public TextSpan SourceSpan => _sourceSpan; 281public ImmutableArray<TextSpan> NameMatchSpans => throw new NotImplementedException();
PdbSourceDocument\AbstractPdbSourceDocumentTests.cs (4)
88MarkupTestFile.GetSpan(metadataSource, out var source, out var expectedSpan); 108Text.TextSpan expectedSpan, 123protected static async Task<(SourceText?, TextSpan)> GetGeneratedSourceTextAsync( 169var actualSpan = file!.IdentifierLocation.SourceSpan;
PdbSourceDocument\ImplementationAssemblyLookupServiceTests.cs (10)
36MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 73MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 112MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 156MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 215MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 275MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 329MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 379MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 443MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 500MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan);
PdbSourceDocument\PdbFileLocatorServiceTests.cs (3)
29MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 57MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 87MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan);
PdbSourceDocument\PdbSourceDocumentLoaderServiceTests.cs (2)
33MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 67MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan);
PdbSourceDocument\PdbSourceDocumentTests.cs (13)
400MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 429MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 466MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 513MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 569MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 591MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 612MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 633MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 653MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 675MarkupTestFile.GetSpan(source, out var metadataSource, out var expectedSpan); 705MarkupTestFile.GetSpan(source1, out var metadataSource, out var expectedSpan); 742MarkupTestFile.GetSpan(source1, out var metadataSource, out var expectedSpan); 912MarkupTestFile.GetSpan(source2, out source2, out var expectedSpan);
QuickInfo\DiagnosticAnalyzerQuickInfoSourceTests.cs (7)
136", GetFormattedIDEAnalyzerTitle(51, nameof(AnalyzersResources.Remove_unused_private_members)), ImmutableArray<TextSpan>.Empty); 179", description, ImmutableArray<TextSpan>.Empty); 183ImmutableArray<TextSpan> relatedSpans) 190info.RelatedSpans.Select(actualSpan => new Action<TextSpan>(expectedSpan => Assert.Equal(expectedSpan, actualSpan))).ToArray()); 210ImmutableArray<TextSpan> relatedSpans, 244protected static Task TestInClassAsync(string code, string expectedDescription, params TextSpan[] relatedSpans) 249protected static Task TestInMethodAsync(string code, string expectedDescription, params TextSpan[] relatedSpans)
SplitStringLiteral\SplitStringLiteralCommandHandlerTests.cs (1)
104out var expectedOutput, out ImmutableArray<TextSpan> expectedSpans);
StringCopyPaste\StringCopyPasteCommandHandlerTests.cs (3)
73expectedCode, out var massaged, out int? caretPosition, out ImmutableDictionary<string, ImmutableArray<TextSpan>> spans); 165TestFileMarkupParser.GetSpan(expectedMarkup, out expected, out var caretSpan); 183ImmutableArray<TextSpan> copySpans, out IWpfTextView textView, out ITextBuffer2 textBuffer2)
SuggestionTags\SuggestionTagProducerTests.cs (1)
43private static async Task<(ImmutableArray<ITagSpan<IErrorTag>> spans, TextSpan selection)> GetTagSpansAndSelectionAsync(
TypeInferrer\TypeInferrerTests.cs (2)
25protected override async Task TestWorkerAsync(Document document, TextSpan textSpan, string expectedType, TestMode mode) 68private static ExpressionSyntax FindExpressionSyntaxFromSpan(SyntaxNode root, TextSpan textSpan)
TypeInferrer\TypeInferrerTests.Delegate.cs (1)
24MarkupTestFile.GetSpan(text, out text, out var textSpan);
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (1)
EmbeddedLanguages\RegularExpressions\CSharpRegexParserTests.cs (1)
226private static XAttribute GetTextAttribute(SourceText text, TextSpan span)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
PDB\CSharpPDBTestBase.cs (2)
23TextSpan? expectedSpan; 36public static bool CheckIfSpanWithinSequencePoints(TextSpan span, string source, string pdb)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (7)
Diagnostics\DiagnosticAnalyzerTests.cs (5)
1103var badSpan = new Text.TextSpan(100000, 10000); 3793var diagnosticSpan = new TextSpan(2, 2); 3834var diagnosticSpan = new TextSpan(2, 2); 3867TextSpan diagnosticSpan, 3908TextSpan diagnosticSpan,
Diagnostics\GetDiagnosticsTests.cs (2)
722var span = localDecl.Span; 1001var span = localDecl.Span;
Microsoft.CodeAnalysis.CSharp.Features (384)
AbstractAssignOutParametersCodeFixProvider.cs (1)
49private static (SyntaxNode container, SyntaxNode exprOrStatement) GetContainer(SyntaxNode root, TextSpan span)
ArrowExpressionClausePlacementCodeFixProvider.cs (1)
98edits.Add(new TextChange(TextSpan.FromBounds(start, end), ""));
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (3)
190var newTextChangeSpan = newRange.Span; 241var spanToFormat = TextSpan.FromBounds(Math.Max(startPoint, 0), endPoint);
BraceMatching\BlockCommentBraceMatcher.cs (4)
34return new BraceMatchingResult(new TextSpan(trivia.SpanStart, "/*".Length), TextSpan.FromBounds(trivia.Span.End - "*/".Length, trivia.Span.End)); 38var startBrace = new TextSpan(trivia.FullSpan.Start, "/**".Length); 39var endBrace = TextSpan.FromBounds(trivia.FullSpan.End - "*/".Length, trivia.FullSpan.End);
BraceMatching\CSharpDirectiveTriviaBraceMatcher.cs (2)
36internal override TextSpan GetSpanForTagging(DirectiveTriviaSyntax directive) 37=> TextSpan.FromBounds(directive.HashToken.SpanStart, directive.DirectiveNameToken.Span.End);
ChangeSignature\ChangeSignatureFormattingRule.cs (2)
43var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 44span = TextSpan.FromBounds(Math.Max(baseToken.Span.End, span.Start), span.End);
CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (1)
52var span = context.Span;
CodeRefactorings\MoveType\CSharpMoveTypeService.cs (1)
29protected override async Task<BaseTypeDeclarationSyntax> GetRelevantNodeAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken)
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (2)
47TextSpan containerSpan; 335protected override async Task<SyntaxNode?> TryGetApplicableContainerFromSpanAsync(Document document, TextSpan span, CancellationToken cancellationToken)
CodeRefactorings\SyncNamespace\CSharpSyncNamespaceCodeRefactoringProvider.cs (1)
29protected override async Task<SyntaxNode?> TryGetApplicableInvocationNodeAsync(Document document, TextSpan span, CancellationToken cancellationToken)
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (1)
524ImmutableArray<TextSpan> fixAllSpans,
Completion\CompletionProviders\CompletionUtilities.cs (1)
20internal static TextSpan GetCompletionItemSpan(SourceText text, int position)
Completion\CompletionProviders\CrefCompletionProvider.cs (2)
81var span = GetCompletionItemSpan(text, position); 231private static TextSpan GetCompletionItemSpan(SourceText text, int position)
Completion\CompletionProviders\CSharpSuggestionModeCompletionProvider.cs (1)
39Document document, int position, TextSpan itemSpan, CompletionTrigger trigger, CancellationToken cancellationToken = default)
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.NameGenerator.cs (7)
25using var parts = TemporaryArray<TextSpan>.Empty; 42using var breaks = TemporaryArray<TextSpan>.Empty; 49in TemporaryArray<TextSpan> breaks, string baseName, bool pluralize) 67private static Words GetLongestBackwardSubsequence(int length, in TemporaryArray<TextSpan> breaks, string baseName, bool pluralize) 74private static Words GetLongestForwardSubsequence(int length, in TemporaryArray<TextSpan> breaks, string baseName, bool pluralize) 77private static Words GetWords(int start, int end, in TemporaryArray<TextSpan> breaks, string baseName, bool pluralize) 83var @break = breaks[start];
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider.cs (1)
202new TextChange(TextSpan.FromBounds(replacementStart, tokenOnLeft.Span.End), text),
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Operators.cs (2)
142var replacement = item.DisplayText + text.ToString(TextSpan.FromBounds(expressionStart, dotLikeToken.SpanStart)); 144TextSpan.FromBounds(
Completion\CSharpCompletionService.cs (1)
45public override TextSpan GetDefaultCompletionListSpan(SourceText text, int caretPosition)
ConditionalExpressionPlacementCodeFixProvider.cs (1)
100edits.Add(new TextChange(TextSpan.FromBounds(start, end), ""));
ConvertNamespace\ConvertNamespaceCodeRefactoringProvider.cs (1)
92ImmutableArray<TextSpan> fixAllSpans,
ConvertNamespaceTransform.cs (3)
73public static (SourceText text, TextSpan semicolonSpan) ConvertNamespaceDeclaration(ParsedDocument document, NamespaceDeclarationSyntax namespaceDeclaration, SyntaxFormattingOptions options, CancellationToken cancellationToken) 92private static (SyntaxNode root, TextSpan semicolonSpan) ReplaceWithFileScopedNamespace( 119private static (SourceText text, TextSpan semicolonSpan) DedentNamespace(
ConvertProgramAnalysis_ProgramMain.cs (1)
77TextSpan.FromBounds(start, root.Members.OfType<GlobalStatementSyntax>().Last().FullSpan.End));
ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
59using var _ = ArrayBuilder<TextSpan>.GetInstance(diagnostics.Length, out var spans);
ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
51: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.SemicolonToken.Span.End));
ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
55: declaration.SyntaxTree.GetLocation(TextSpan.FromBounds(declaration.SpanStart, declaration.Name.Span.End));
ConvertToRawString\ConvertRegularStringToRawStringCodeRefactoringProvider.cs (6)
193Document document, TextSpan span, ConvertToRawKind kind, CodeActionOptionsProvider optionsProvider, CancellationToken cancellationToken) 208ImmutableArray<TextSpan> fixAllSpans, 221foreach (var fixSpan in fixAllSpans) 460return leadingWhitespace1.GetSubSequence(TextSpan.FromBounds(0, current)); 469return line.GetSubSequence(TextSpan.FromBounds(0, current)); 491var result = characters.GetSubSequence(TextSpan.FromBounds(index, end));
CSharpAddBracesDiagnosticAnalyzer.cs (2)
131var ifStatementSpanWithoutElse = TextSpan.FromBounds(statement.Span.Start, embeddedStatement.Span.End);
CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
41var diagnosticSpan = diagnostic.Location.SourceSpan;
CSharpAddYieldCodeFixProvider.cs (1)
214SyntaxNode root, TextSpan span, [NotNullWhen(true)] out SyntaxNode? node)
CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (1)
314var scopeSpan = scope.Span;
CSharpConvertToRecordCodeFixProvider.cs (1)
37var span = context.Span;
CSharpDeclarationComputer.cs (1)
24TextSpan span,
CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
66var span = diagnostic.Location.SourceSpan;
CSharpMakeMemberRequiredCodeFixProvider.cs (1)
41var span = context.Span;
CSharpRemoveUnnecessaryCastDiagnosticAnalyzer.cs (3)
29protected override TextSpan GetFadeSpan(ExpressionSyntax node) 30=> node is CastExpressionSyntax cast ? TextSpan.FromBounds(cast.OpenParenToken.SpanStart, cast.CloseParenToken.Span.End) : 31node is BinaryExpressionSyntax binary ? TextSpan.FromBounds(binary.OperatorToken.SpanStart, node.Span.End) : throw ExceptionUtilities.Unreachable();
CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (1)
50protected override IEnumerable<TextSpan> GetFixableDiagnosticSpans(
CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (4)
205var startReportSpan = TextSpan.FromBounds(anonymousFunction.SpanStart, invokedExpression.SpanStart); 206var endReportSpan = TextSpan.FromBounds(invokedExpression.Span.End, anonymousFunction.Span.End);
CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (16)
83private static ImmutableArray<TextSpan> AnalyzeCodeBlock(CodeBlockAnalysisContext context, int positionOfFirstReducingNullableDirective) 90private ImmutableArray<Diagnostic> AnalyzeSemanticModel(SemanticModelAnalysisContext context, int positionOfFirstReducingNullableDirective, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? codeBlockIntervalTree, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? possibleNullableImpactIntervalTree) 97possibleNullableImpactIntervalTree ??= new SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>(new TextSpanIntervalIntrospector(), values: null); 98foreach (var interval in simplifier.Spans) 148possibleNullableImpactIntervalTree ??= new SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>(new TextSpanIntervalIntrospector(), values: null); 177IntervalTree = SimpleIntervalTree.Create(new TextSpanIntervalIntrospector(), Array.Empty<TextSpan>()); 178PossibleNullableImpactIntervalTree = SimpleIntervalTree.Create(new TextSpanIntervalIntrospector(), Array.Empty<TextSpan>()); 185public SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? IntervalTree { get; } 186public SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? PossibleNullableImpactIntervalTree { get; } 218public bool TryProceedWithInterval(TextSpan span) 222public bool TryReportNullableImpactingSpans(TextSpan span, ImmutableArray<TextSpan> nullableImpactingSpans) 226private bool TryProceedOrReportNullableImpactingSpans(TextSpan span, ImmutableArray<TextSpan>? nullableImpactingSpans) 241foreach (var nullableImpactingSpan in spans)
CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (3)
70SemanticModelAnalysisContext context, SyntaxNode root, TextSpan sourceSpan) 125var span = TextSpan.FromBounds(section[0].FullSpan.Start, section.Last().FullSpan.End);
CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
70Document document, TextSpan span, SyntaxNode newExpression, CancellationToken cancellationToken)
CSharpTypeStyleDiagnosticAnalyzerBase.cs (1)
76private static Diagnostic CreateDiagnostic(DiagnosticDescriptor descriptor, SyntaxNode declaration, TextSpan diagnosticSpan, ReportDiagnostic severity)
CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (2)
45var fadeSpan = TextSpan.FromBounds(defaultExpression.OpenParenToken.SpanStart, defaultExpression.CloseParenToken.Span.End);
CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (4)
54var fadeSpan = TextSpan.FromBounds(nameColon.Name.SpanStart, nameColon.ColonToken.Span.End); 79var fadeSpan = TextSpan.FromBounds(nameEquals.Name.SpanStart, nameEquals.EqualsToken.Span.End);
CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
259TextSpan.FromBounds(arguments.First().SpanStart, arguments.Last().Span.End));
Debugging\CSharpBreakpointResolutionService.cs (2)
31public async Task<BreakpointResolutionResult?> ResolveBreakpointAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) 36if (tree == null || !BreakpointSpans.TryGetBreakpointSpan(tree, textSpan.Start, cancellationToken, out var span))
Debugging\DataTipInfoGetter.cs (1)
65return new DebugDataTipInfo(TextSpan.FromBounds(curr.SpanStart, expression.Span.End), text: null);
Diagnostics\Analyzers\CSharpSimplifyTypeNamesDiagnosticAnalyzer.cs (2)
61protected override ImmutableArray<Diagnostic> AnalyzeSemanticModel(SemanticModelAnalysisContext context, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? codeBlockIntervalTree) 79out TextSpan issueSpan, out string diagnosticId, out bool inDeclaration,
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.cs (2)
47private readonly SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? _ignoredSpans; 75public TypeSyntaxSimplifierWalker(CSharpSimplifyTypeNamesDiagnosticAnalyzer analyzer, SemanticModel semanticModel, CSharpSimplifierOptions options, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? ignoredSpans, CancellationToken cancellationToken)
Diagnostics\CSharpAnalyzerDriverService.cs (1)
28TextSpan span,
EditAndContinue\BreakpointSpans.cs (30)
17public static bool TryGetBreakpointSpan(SyntaxTree tree, int position, CancellationToken cancellationToken, out TextSpan breakpointSpan) 63public static bool TryGetClosestBreakpointSpan(SyntaxNode root, int position, out TextSpan span) 82private static TextSpan CreateSpan(SyntaxToken startToken, SyntaxToken endToken) 83=> TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End); 85private static TextSpan CreateSpan(SyntaxNode node) 88private static TextSpan CreateSpan(SyntaxNode node, SyntaxToken token) 89=> TextSpan.FromBounds(node.SpanStart, token.Span.End); 91private static TextSpan CreateSpan(SyntaxToken token) 92=> TextSpan.FromBounds(token.SpanStart, token.Span.End); 94private static TextSpan CreateSpan(SyntaxTokenList startOpt, SyntaxNodeOrToken startFallbackOpt, SyntaxNodeOrToken endOpt) 122return TextSpan.FromBounds(startPos, endPos); 137private static TextSpan? TryCreateSpanForNode(SyntaxNode node, int position) 193TextSpan createSpanForSwitchArm(SwitchExpressionArmSyntax switchArm) 333private static TextSpan? CreateSpanForConstructorDeclaration(ConstructorDeclarationSyntax constructorSyntax, int position) 366private static TextSpan CreateSpanForConstructorInitializer(ConstructorInitializerSyntax constructorInitializer) 369private static TextSpan? TryCreateSpanForFieldDeclaration(BaseFieldDeclarationSyntax fieldDeclaration, int position) 372private static TextSpan? TryCreateSpanForSwitchLabel(SwitchLabelSyntax switchLabel, int position) 382private static TextSpan CreateSpanForBlock(BlockSyntax block, int position) 396private static TextSpan? TryCreateSpanForStatement(StatementSyntax statement, int position) 591private static TextSpan? TryCreateSpanForVariableDeclaration(VariableDeclarationSyntax declaration, int position) 600private static TextSpan? TryCreateSpanForVariableDeclaration( 614return default(TextSpan); 621return default(TextSpan); 635return default(TextSpan); 646private static TextSpan CreateSpanForVariableDeclarator( 716private static TextSpan CreateSpanForCatchClause(CatchClauseSyntax catchClause) 776private static TextSpan? CreateSpanForAccessors(SyntaxList<AccessorDeclarationSyntax> accessors, int position) 795internal static TextSpan GetEnvelope(SyntaxNode declaration) 816return TextSpan.FromBounds(firstSpan.Value.Start, constructorBody.Span.End); 821return TextSpan.FromBounds(unit.Members[0].SpanStart, unit.Members.OfType<GlobalStatementSyntax>().Last().Span.End);
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (44)
292internal override (TextSpan envelope, TextSpan hole) GetActiveSpanEnvelope(SyntaxNode declaration) 326protected override SyntaxNode FindStatementAndPartner(SyntaxNode declarationBody, TextSpan span, SyntaxNode? partnerDeclarationBody, out SyntaxNode? partner, out int statementPart) 478private static TextSpan GetActiveSpan(BlockSyntax node, BlockPart part) 492private static TextSpan GetActiveSpan(ForEachStatementSyntax node, ForEachPart part) 496ForEachPart.VariableDeclaration => TextSpan.FromBounds(node.Type.SpanStart, node.Identifier.Span.End), 502private static TextSpan GetActiveSpan(ForEachVariableStatementSyntax node, ForEachPart part) 506ForEachPart.VariableDeclaration => TextSpan.FromBounds(node.Variable.SpanStart, node.Variable.Span.End), 512private static TextSpan GetActiveSpan(SwitchExpressionSyntax node, SwitchExpressionPart part) 516SwitchExpressionPart.SwitchBody => TextSpan.FromBounds(node.SwitchKeyword.SpanStart, node.CloseBraceToken.Span.End), 789protected override TextSpan GetGlobalStatementDiagnosticSpan(SyntaxNode node) 845protected override bool TryGetEnclosingBreakpointSpan(SyntaxNode root, int position, out TextSpan span) 848protected override bool TryGetActiveSpan(SyntaxNode node, int statementPart, int minLength, out TextSpan span) 1585protected override TextSpan? TryGetDiagnosticSpan(SyntaxNode node, EditKind editKind) 1588internal static new TextSpan GetDiagnosticSpan(SyntaxNode node, EditKind editKind) 1591private static TextSpan? TryGetDiagnosticSpanImpl(SyntaxNode node, EditKind editKind) 1595internal static TextSpan? TryGetDiagnosticSpanImpl(SyntaxKind kind, SyntaxNode node, EditKind editKind) 1600return default(TextSpan); 1612return TextSpan.FromBounds(ns.NamespaceKeyword.SpanStart, ns.Name.Span.End); 1691return TextSpan.FromBounds(constraint.WhereKeyword.SpanStart, constraint.Constraints.Last().Span.End); 1734return TextSpan.FromBounds(usingStatement.UsingKeyword.SpanStart, usingStatement.CloseParenToken.Span.End); 1738return TextSpan.FromBounds(fixedStatement.FixedKeyword.SpanStart, fixedStatement.CloseParenToken.Span.End); 1742return TextSpan.FromBounds(lockStatement.LockKeyword.SpanStart, lockStatement.CloseParenToken.Span.End); 1765return TextSpan.FromBounds(ifStatement.IfKeyword.SpanStart, ifStatement.CloseParenToken.Span.End); 1772return TextSpan.FromBounds(switchStatement.SwitchKeyword.SpanStart, 1780return TextSpan.FromBounds(whileStatement.WhileKeyword.SpanStart, whileStatement.CloseParenToken.Span.End); 1787return TextSpan.FromBounds(forStatement.ForKeyword.SpanStart, forStatement.CloseParenToken.Span.End); 1792return TextSpan.FromBounds( 1904private static TextSpan GetDiagnosticSpan(SyntaxTokenList modifiers, SyntaxNodeOrToken start, SyntaxNodeOrToken end) 1905=> TextSpan.FromBounds((modifiers.Count != 0) ? modifiers.First().SpanStart : start.SpanStart, end.Span.End); 1907private static TextSpan CombineSpans(TextSpan first, TextSpan second, TextSpan defaultSpan) 1908=> (first.Length > 0 && second.Length > 0) ? TextSpan.FromBounds(first.Start, second.End) : (first.Length > 0) ? first : (second.Length > 0) ? second : defaultSpan; 1910internal override TextSpan GetLambdaParameterDiagnosticSpan(SyntaxNode lambda, int ordinal) 2249private readonly TextSpan? _span; 2258TextSpan? span = null) 2276var span = (spanNode != null) ? GetDiagnosticSpan(spanNode, _kind) : GetSpan(); 2283private TextSpan GetSpan() 2469internal override void ReportMemberBodyUpdateRudeEdits(ArrayBuilder<RudeEditDiagnostic> diagnostics, SyntaxNode newMember, TextSpan? span) 2598TextSpan newStatementSpan) 2645protected override TextSpan GetExceptionHandlingRegion(SyntaxNode node, out bool coversAllChildren) 2660return TextSpan.FromBounds(
EncapsulateField\CSharpEncapsulateFieldService.cs (1)
128protected override async Task<ImmutableArray<IFieldSymbol>> GetFieldsAsync(Document document, TextSpan span, CancellationToken cancellationToken)
ExtractInterface\CSharpExtractInterfaceService.cs (1)
49var span = new TextSpan(spanStart, spanEnd - spanStart);
ExtractMethod\CSharpExtractMethodService.cs (1)
26protected override CSharpSelectionValidator CreateSelectionValidator(SemanticDocument document, TextSpan textSpan, ExtractMethodOptions options, bool localFunction)
ExtractMethod\CSharpSelectionResult.cs (4)
26TextSpan originalSpan, 27TextSpan finalSpan, 65TextSpan originalSpan, 66TextSpan finalSpan,
ExtractMethod\CSharpSelectionResult.ExpressionResult.cs (2)
25TextSpan originalSpan, 26TextSpan finalSpan,
ExtractMethod\CSharpSelectionResult.StatementResult.cs (2)
23TextSpan originalSpan, 24TextSpan finalSpan,
ExtractMethod\CSharpSelectionValidator.cs (14)
29TextSpan textSpan, 63var controlFlowSpan = GetControlFlowSpan(selectionInfo); 158private static TextSpan GetControlFlowSpan(SelectionInfo selectionInfo) 159=> TextSpan.FromBounds(selectionInfo.FirstTokenInFinalSpan.SpanStart, selectionInfo.LastTokenInFinalSpan.Span.End); 205var adjustedSpan = GetAdjustedSpan(text, OriginalSpan); 367root, TextSpan.FromBounds(selectionInfo.FirstTokenInOriginalSpan.SpanStart, selectionInfo.LastTokenInOriginalSpan.Span.End), 416return selectionInfo.With(s => s.FinalSpan = GetAdjustedSpan(text, TextSpan.FromBounds(start, end))); 440SyntaxNode root, TextSpan textSpan, 493private static TextSpan GetAdjustedSpan(SourceText text, TextSpan textSpan) 516return TextSpan.FromBounds(textSpan.Start, previousLine.EndIncludingLineBreak); 519return TextSpan.FromBounds(textSpan.Start, previousLine.End); 526public TextSpan OriginalSpan { get; set; } 527public TextSpan FinalSpan { get; set; }
ExtractMethod\Extensions.cs (2)
149public static bool ContainArgumentlessThrowWithoutEnclosingCatch(this IEnumerable<SyntaxToken> tokens, TextSpan textSpan) 173public static bool ContainPreprocessorCrossOver(this IEnumerable<SyntaxToken> tokens, TextSpan textSpan)
GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (1)
30SemanticDocument semanticDocument, TextSpan textSpan, CancellationToken cancellationToken,
HideBaseCodeFixProvider.cs (1)
38var diagnosticSpan = diagnostic.Location.SourceSpan;
Highlighting\KeywordHighlighters\AsyncAwaitHighlighter.cs (6)
36protected override void AddHighlightsForNode(SyntaxNode node, List<TextSpan> highlights, CancellationToken cancellationToken) 76private static bool HighlightRelatedKeywords(SyntaxNode node, List<TextSpan> spans) 90private static bool TryAddAsyncModifier(SyntaxTokenList modifiers, List<TextSpan> spans) 103private static bool TryAddAsyncOrAwaitKeyword(SyntaxToken mod, List<TextSpan> spans) 113var lastSpan = spans[^1]; 116spans[^1] = TextSpan.FromBounds(lastSpan.Start, mod.Span.End);
Highlighting\KeywordHighlighters\CheckedExpressionHighlighter.cs (1)
27protected override void AddHighlights(CheckedExpressionSyntax checkedExpressionSyntax, List<TextSpan> highlights, CancellationToken cancellationToken)
Highlighting\KeywordHighlighters\CheckedStatementHighlighter.cs (1)
27protected override void AddHighlights(CheckedStatementSyntax checkedStatement, List<TextSpan> highlights, CancellationToken cancellationToken)
Highlighting\KeywordHighlighters\ConditionalPreprocessorHighlighter.cs (2)
29DirectiveTriviaSyntax directive, List<TextSpan> highlights, CancellationToken cancellationToken) 39highlights.Add(TextSpan.FromBounds(
Highlighting\KeywordHighlighters\IfStatementHighlighter.cs (3)
32IfStatementSyntax ifStatement, List<TextSpan> highlights, CancellationToken cancellationToken) 41IfStatementSyntax ifStatement, List<TextSpan> highlights) 56highlights.Add(TextSpan.FromBounds(
Highlighting\KeywordHighlighters\LockStatementHighlighter.cs (1)
27protected override void AddHighlights(LockStatementSyntax lockStatement, List<TextSpan> highlights, CancellationToken cancellationToken)
Highlighting\KeywordHighlighters\LoopHighlighter.cs (6)
33SyntaxNode node, List<TextSpan> spans, CancellationToken cancellationToken) 54private static void HighlightDoStatement(DoStatementSyntax statement, List<TextSpan> spans) 61private static void HighlightForStatement(ForStatementSyntax statement, List<TextSpan> spans) 64private static void HighlightForEachStatement(CommonForEachStatementSyntax statement, List<TextSpan> spans) 67private static void HighlightWhileStatement(WhileStatementSyntax statement, List<TextSpan> spans) 73private void HighlightRelatedKeywords(SyntaxNode node, List<TextSpan> spans,
Highlighting\KeywordHighlighters\RegionHighlighter.cs (3)
29DirectiveTriviaSyntax directive, List<TextSpan> highlights, CancellationToken cancellationToken) 37highlights.Add(TextSpan.FromBounds( 41highlights.Add(TextSpan.FromBounds(
Highlighting\KeywordHighlighters\ReturnStatementHighlighter.cs (2)
31ReturnStatementSyntax returnStatement, List<TextSpan> spans, CancellationToken cancellationToken) 48private void HighlightRelatedKeywords(SyntaxNode node, List<TextSpan> spans)
Highlighting\KeywordHighlighters\SwitchStatementHighlighter.cs (3)
30SwitchStatementSyntax switchStatement, List<TextSpan> spans, CancellationToken cancellationToken) 50private void HighlightRelatedKeywords(SyntaxNode node, List<TextSpan> spans, 73spans.Add(TextSpan.FromBounds(start, end));
Highlighting\KeywordHighlighters\TryStatementHighlighter.cs (1)
28TryStatementSyntax tryStatement, List<TextSpan> highlights, CancellationToken cancellationToken)
Highlighting\KeywordHighlighters\UnsafeStatementHighlighter.cs (1)
27protected override void AddHighlights(UnsafeStatementSyntax unsafeStatement, List<TextSpan> highlights, CancellationToken cancellationToken)
Highlighting\KeywordHighlighters\UsingStatementHighlighter.cs (1)
27protected override void AddHighlights(UsingStatementSyntax usingStatement, List<TextSpan> highlights, CancellationToken cancellationToken)
Highlighting\KeywordHighlighters\YieldStatementHighlighter.cs (3)
31YieldStatementSyntax yieldStatement, List<TextSpan> spans, CancellationToken cancellationToken) 48private void HighlightRelatedKeywords(SyntaxNode node, List<TextSpan> spans) 54TextSpan.FromBounds(
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (2)
143var applicableSpan = explicitName == null 145: TextSpan.FromBounds(explicitName.FullSpan.Start, identifier.FullSpan.End);
ImplementInterface\CSharpImplementInterfaceCodeFixProvider.cs (1)
42var span = context.Span;
InlineHints\CSharpInlineTypeHintsService.cs (4)
80var span = new TextSpan(parameterNode.Identifier.SpanStart, 0); 99var span = new TextSpan(implicitNew.NewKeyword.Span.End, 0); 115var span = GetSpan(displayAllOverride, normalOption, displayAllSpan, normalSpan); 122private static TextSpan GetSpan(
IntroduceVariable\CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs (1)
42protected override bool IsValid(ExpressionStatementSyntax expressionStatement, TextSpan span)
InvokeDelegateWithConditionalAccessAnalyzer.cs (2)
183var fadeLocation = Location.Create(tree, TextSpan.FromBounds(firstStatement.SpanStart, previousToken.Span.End)); 202fadeLocation = Location.Create(tree, TextSpan.FromBounds(nextToken.Span.Start, ifStatement.Span.End));
LineSeparators\CSharpLineSeparatorService.cs (10)
35public async Task<ImmutableArray<TextSpan>> GetLineSeparatorsAsync( 37TextSpan textSpan, 42using var _ = ArrayBuilder<TextSpan>.GetInstance(out var spans); 49return ImmutableArray<TextSpan>.Empty; 245private static void ProcessUsings(SyntaxList<UsingDirectiveSyntax> usings, ArrayBuilder<TextSpan> spans, CancellationToken cancellationToken) 260private static void ProcessNodeList<T>(SyntaxList<T> children, ArrayBuilder<TextSpan> spans, CancellationToken cancellationToken) where T : SyntaxNode 313private static void AddLineSeparatorSpanForNode(SyntaxNode node, ArrayBuilder<TextSpan> spans, CancellationToken cancellationToken) 320var span = GetLineSeparatorSpanForNode(node); 328private static bool IsLegalSpanForLineSeparator(SyntaxTree syntaxTree, TextSpan textSpan, CancellationToken cancellationToken) 347private static TextSpan GetLineSeparatorSpanForNode(SyntaxNode node)
MakeLocalFunctionStaticCodeFixHelper.cs (1)
134var referenceSpan = location.Location.SourceSpan;
MakeRefStructCodeFixProvider.cs (1)
45var span = context.Span;
NavigationBar\CSharpNavigationBarItemService.cs (4)
218private static TextSpan GetFieldReferenceSpan(SyntaxReference reference) 237return TextSpan.FromBounds(spanStart, spanEnd); 240private static TextSpan GetEnumMemberSpan(SyntaxReference reference) 256return TextSpan.FromBounds(start, end);
NullableImpactingSpanWalker.cs (7)
21private readonly SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? _ignoredSpans; 24private ImmutableArray<TextSpan>.Builder? _spans; 28public ImmutableArray<TextSpan> Spans => _spans?.ToImmutable() ?? ImmutableArray<TextSpan>.Empty; 30public ImmutableArray<TextSpan>.Builder SpansBuilder 35Interlocked.CompareExchange(ref _spans, ImmutableArray.CreateBuilder<TextSpan>(), null); 44SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? ignoredSpans,
QuickInfo\CSharpDiagnosticAnalyzerQuickInfoProvider.cs (3)
139string errorCode, TextSpan location) 153private static QuickInfoItem CreateQuickInfo(TextSpan location, DiagnosticDescriptor descriptor, 154params TextSpan[] relatedSpans)
QuickInfo\CSharpSyntacticQuickInfoProvider.cs (1)
93var spans = ImmutableArray.Create(TextSpan.FromBounds(spanStart, spanEnd));
RemoveInKeywordCodeFixProvider.cs (1)
43var diagnosticSpan = diagnostic.Location.SourceSpan;
RemoveNewModifierCodeFixProvider.cs (1)
41var diagnosticSpan = diagnostic.Location.SourceSpan;
SignatureHelp\AttributeSignatureHelpProvider.cs (2)
105var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(attribute.ArgumentList!); 116private SignatureHelpState? GetCurrentArgumentState(SyntaxNode root, int position, ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken)
SignatureHelp\ConstructorInitializerSignatureHelpProvider.cs (2)
115var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(constructorInitializer.ArgumentList); 128Document document, int position, TextSpan currentSpan, CancellationToken cancellationToken)
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (7)
106var textSpan = GetTextSpan(expression, openBrace); 114private static TextSpan GetTextSpan(ExpressionSyntax expression, SyntaxToken openBracket) 120return TextSpan.FromBounds(conditional.Span.Start, openBracket.FullSpan.End); 135private static SignatureHelpState? GetCurrentArgumentState(SyntaxNode root, int position, ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken) 301internal static TextSpan GetTextSpan(SyntaxToken openBracket) 343internal static TextSpan GetTextSpan(SyntaxNode expression, SyntaxToken openBracket) 346return TextSpan.FromBounds(expression.SpanStart, openBracket.Parent.Span.End);
SignatureHelp\GenericNamePartiallyWrittenSignatureHelpProvider.cs (2)
29protected override TextSpan GetTextSpan(SyntaxToken genericIdentifier, SyntaxToken lessThanToken) 34return TextSpan.FromBounds(genericIdentifier.SpanStart, nextToken.SpanStart);
SignatureHelp\GenericNameSignatureHelpProvider.cs (2)
133var textSpan = GetTextSpan(genericIdentifier, lessThanToken); 162protected virtual TextSpan GetTextSpan(SyntaxToken genericIdentifier, SyntaxToken lessThanToken)
SignatureHelp\InitializerExpressionSignatureHelpProvider.cs (2)
69var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(initializerExpression); 78private SignatureHelpState? GetCurrentArgumentState(SyntaxNode root, int position, ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken)
SignatureHelp\InvocationExpressionSignatureHelpProvider.cs (3)
123var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(invocationExpression.ArgumentList); 171var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(invocationExpression.ArgumentList); 180TextSpan currentSpan,
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.cs (3)
116var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(objectCreationExpression.ArgumentList); 142var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(objectCreationExpression.ArgumentList); 149Document document, int position, TextSpan currentSpan, CancellationToken cancellationToken)
SignatureHelp\PrimaryConstructorBaseTypeSignatureHelpProvider.cs (2)
100var textSpan = SignatureHelpUtilities.GetSignatureHelpSpan(baseTypeSyntax.ArgumentList); 109private SignatureHelpState? GetCurrentArgumentState(SyntaxNode root, int position, ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken)
SignatureHelp\SignatureHelpUtilities.cs (4)
87internal static TextSpan GetSignatureHelpSpan(BaseArgumentListSyntax argumentList) 90internal static TextSpan GetSignatureHelpSpan(TypeArgumentListSyntax argumentList) 93internal static TextSpan GetSignatureHelpSpan(InitializerExpressionSyntax initializer) 96internal static TextSpan GetSignatureHelpSpan(AttributeArgumentListSyntax argumentList)
SignatureHelp\TupleConstructionSignatureHelpProvider.cs (3)
37private SignatureHelpState? GetCurrentArgumentState(SyntaxNode root, int position, ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken) 64ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken, [NotNullWhen(true)] out TupleExpressionSyntax? result) 83ISyntaxFactsService syntaxFacts, TextSpan currentSpan, CancellationToken cancellationToken, [NotNullWhen(true)] out ParenthesizedExpressionSyntax? result)
Snippets\AbstractCSharpAutoPropertySnippetProvider.cs (1)
92var node = root.FindNode(TextSpan.FromBounds(position, position));
Snippets\AbstractCSharpTypeSnippetProvider.cs (2)
62var triviaSpan = typeDeclaration.CloseBraceToken.LeadingTrivia.Span; 86var node = root.FindNode(TextSpan.FromBounds(position, position));
Snippets\CSharpConstructorSnippetProvider.cs (1)
56var triviaSpan = blockStatement!.CloseBraceToken.LeadingTrivia.Span;
Snippets\CSharpElseSnippetProvider.cs (2)
70return Task.FromResult(ImmutableArray.Create(new TextChange(TextSpan.FromBounds(position, position), elseClause.ToFullString()))); 78var triviaSpan = blockStatement.CloseBraceToken.LeadingTrivia.Span;
Snippets\CSharpForEachLoopSnippetProvider.cs (1)
115var triviaSpan = blockStatement.CloseBraceToken.LeadingTrivia.Span;
Snippets\CSharpIfSnippetProvider.cs (1)
36var triviaSpan = blockStatement.CloseBraceToken.LeadingTrivia.Span;
Snippets\CSharpSnippetFunctionService.cs (4)
34protected override async Task<ITypeSymbol?> GetEnumSymbolAsync(Document document, TextSpan switchExpressionSpan, CancellationToken cancellationToken) 51protected override async Task<(Document, TextSpan)> GetDocumentWithEnumCaseAsync( 55TextSpan caseGenerationLocation, 60var typeSpan = new TextSpan(caseGenerationLocation.Start + "case ".Length, fullyQualifiedTypeName.Length);
Snippets\CSharpWhileLoopSnippetProvider.cs (1)
36var triviaSpan = blockStatement.CloseBraceToken.LeadingTrivia.Span;
SplitOrMergeIfStatements\CSharpMergeConsecutiveIfStatementsCodeRefactoringProvider.cs (1)
27protected override bool IsApplicableSpan(SyntaxNode node, TextSpan span, out SyntaxNode ifOrElseIf)
SplitOrMergeIfStatements\CSharpMergeNestedIfStatementsCodeRefactoringProvider.cs (1)
27protected override bool IsApplicableSpan(SyntaxNode node, TextSpan span, out SyntaxNode ifOrElseIf)
SplitStringLiteral\InterpolatedStringSplitter.cs (1)
87var content = Document.Text.ToString(TextSpan.FromBounds(start, end));
SplitStringLiteral\SimpleStringSplitter.cs (3)
48var prefix = Document.Text.GetSubText(TextSpan.FromBounds(_token.SpanStart, CursorPosition)).ToString(); 49var suffix = Document.Text.GetSubText(TextSpan.FromBounds(CursorPosition, _token.Span.End)).ToString(); 54? Document.Text.GetSubText(TextSpan.FromBounds(_token.Span.End - "u8".Length, _token.Span.End)).ToString()
StringIndentation\CSharpStringIndentationService.cs (8)
31Document document, TextSpan textSpan, CancellationToken cancellationToken) 46TextSpan textSpan, 95if (!TryGetIndentSpan(text, (ExpressionSyntax)token.GetRequiredParent(), out _, out var indentSpan)) 116if (!TryGetIndentSpan(text, interpolatedString, out var offset, out var indentSpan)) 119using var _ = ArrayBuilder<TextSpan>.GetInstance(out var builder); 133private static bool IsInHole(InterpolatedStringExpressionSyntax interpolatedString, TextSpan sourceSpan) 165private static bool TryGetIndentSpan(SourceText text, ExpressionSyntax expression, out int offset, out TextSpan indentSpan) 186indentSpan = TextSpan.FromBounds(firstLine.Start, lastLine.Start + offset);
Structure\CSharpStructureHelpers.cs (15)
176var span = TextSpan.FromBounds(startComment.SpanStart, endComment.Span.End); 278textSpan: TextSpan.FromBounds(startPosition, endPosition), 279hintSpan: TextSpan.FromBounds(startPosition, hintTextEndToken.Span.End), 319TextSpan textSpan, string bannerText, bool autoCollapse, 327TextSpan textSpan, TextSpan hintSpan, 378var span = TextSpan.FromBounds(GetCollapsibleStart(startToken), spanEndPos); 379var hintSpan = GetHintSpan(node, hintEndPos); 391private static TextSpan GetHintSpan(SyntaxNode node, int endPos) 401return TextSpan.FromBounds(child.SpanStart, endPos); 405return TextSpan.FromBounds(node.SpanStart, endPos); 483textSpan: TextSpan.FromBounds(spanStart, spanEnd), 484hintSpan: TextSpan.FromBounds(hintSpanStart, hintSpanEnd),
Structure\Providers\ArrowExpressionClauseStructureProvider.cs (1)
27textSpan: TextSpan.FromBounds(previousToken.Span.End, node.Parent.Span.End),
Structure\Providers\BlockSyntaxStructureProvider.cs (4)
82private static TextSpan GetHintSpan(BlockSyntax node) 92return TextSpan.FromBounds(start, end); 95private static TextSpan GetTextSpan(BlockSyntax node) 103return TextSpan.FromBounds(previousToken.Span.End, GetEnd(node));
Structure\Providers\DisabledTextTriviaStructureProvider.cs (2)
59var span = TextSpan.FromBounds(startPos, endPos);
Structure\Providers\DocumentationCommentStructureProvider.cs (2)
36var span = TextSpan.FromBounds(startPos, endPos);
Structure\Providers\IfDirectiveTriviaStructureProvider.cs (2)
53var span = TextSpan.FromBounds(startLine.Start, endLine.End);
Structure\Providers\InitializerExpressionStructureProvider.cs (3)
46textSpan: TextSpan.FromBounds(node.SpanStart, end), 47hintSpan: TextSpan.FromBounds(node.SpanStart, end), 64textSpan: TextSpan.FromBounds(previousToken.Span.End, node.Span.End),
Structure\Providers\RegionDirectiveStructureProvider.cs (1)
54textSpan: TextSpan.FromBounds(regionDirective.SpanStart, match.Span.End),
Structure\Providers\SwitchStatementStructureProvider.cs (2)
24textSpan: TextSpan.FromBounds(node.CloseParenToken != default ? node.CloseParenToken.Span.End : node.Expression.Span.End, node.CloseBraceToken.Span.End), 37textSpan: TextSpan.FromBounds(start, end),
UseExplicitTypeForConstCodeFixProvider.cs (1)
67Document document, TextSpan span, ITypeSymbol type, CancellationToken cancellationToken)
UseExpressionBody\UseExpressionBodyCodeRefactoringProvider.cs (3)
193ImmutableArray<TextSpan> fixAllSpans, 210ImmutableArray<TextSpan> fixAllSpans, 217foreach (var span in fixAllSpans)
UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeRefactoringProvider.cs (4)
82var span = context.Span; 94Document document, TextSpan span, ExpressionBodyPreference option, CancellationToken cancellationToken) 150Document document, TextSpan span, CancellationToken cancellationToken) 166Document document, TextSpan span, ExpressionBodyPreference option, CancellationToken cancellationToken)
UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (1)
100TextSpan.FromBounds(declaration.SpanStart, declaration.ArrowToken.Span.End));
UseUtf8StringLiteralDiagnosticAnalyzer.cs (2)
124var span = TextSpan.FromBounds(elements[0].Syntax.SpanStart, elements[^1].Syntax.Span.End);
Wrapping\SeparatedSyntaxList\CSharpArgumentWrapper.cs (2)
92var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
Wrapping\SeparatedSyntaxList\CSharpParameterWrapper.cs (2)
69var headerSpan = TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (12)
Semantics\BindingAwaitTests.cs (1)
27TextSpan span = new TextSpan(text.Length, 0);
Semantics\GlobalUsingDirectiveTests.cs (3)
3256comp2.GetSemanticModel(comp2.SyntaxTrees[0]).GetDiagnostics(TextSpan.FromBounds(20, comp2.SyntaxTrees[0].Length - 1)).Verify( 3264comp2.GetSemanticModel(comp2.SyntaxTrees[1]).GetDiagnostics(TextSpan.FromBounds(20, comp2.SyntaxTrees[1].Length - 1)).Verify( 3272comp2.GetSemanticModel(comp2.SyntaxTrees[2]).GetDiagnostics(TextSpan.FromBounds(20, comp2.SyntaxTrees[2].Length - 1)).Verify(
SourceGeneration\GeneratorDriverTests.cs (8)
1219new[] { (gen001, TextSpan.FromBounds(2, 5)) }, 1226new[] { (gen001, TextSpan.FromBounds(27, 30)) }, 1240new[] { (gen001, TextSpan.FromBounds(34, 37)) }, 1249new[] { (gen001, TextSpan.FromBounds(34, 37)), (gen001, TextSpan.FromBounds(77, 80)) }, 1253void verifyDiagnosticsWithSource(string source, (Diagnostic, TextSpan)[] reportDiagnostics, params DiagnosticDescription[] expected) 1263foreach ((var d, var l) in reportDiagnostics) 1349return x.Diagnostic.WithLocation(Location.Create(syntaxTree, TextSpan.FromBounds(start, end)));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (11)
DeclarationTests.cs (1)
383public override TextSpan Span
Symbols\AnonymousTypesSemanticsTests.cs (7)
1896private CompilationUtils.SemanticInfoSummary GetAnonymousTypeInfoSummary(TestData data, int node, TextSpan typeSpan, params int[] fields) 1930var span = node.Span; 1964foreach (var span in intervals) 2001private static List<TextSpan> ExtractTextIntervals(ref string source) 2006List<TextSpan> intervals = new List<TextSpan>(); 2022intervals.Add(TextSpan.FromBounds(all[i - 1].offset, all[i].offset));
Symbols\Metadata\MetadataTypeTests.cs (1)
363var span = new TextSpan(oldIText.Length, 0);
Symbols\Source\MethodTests.cs (2)
2067var span = symbol.Locations.Single().SourceSpan; 2088var span = symbol.Locations.Single().SourceSpan;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (61)
Diagnostics\DiagnosticTest.cs (1)
2372private TextSpan GetSpanIn(SyntaxTree syntaxTree, string textToFind)
Diagnostics\LineSpanDirectiveTests.cs (3)
490var span = getTextSpan(mappedText.Lines, mappedLineAndPositionSpan.Span); 494static TextSpan getTextSpan(TextLineCollection lines, LinePositionSpan span) 496return TextSpan.FromBounds(getTextPosition(lines, span.Start), getTextPosition(lines, span.End));
Diagnostics\LocationsTests.cs (9)
45var span = GetSpanIn(syntaxTree, sourceText); 66private TextSpan GetSpanIn(SyntaxTree syntaxTree, string textToFind) 89TextSpan xSpan = new TextSpan(sampleProgram.IndexOf("x;", StringComparison.Ordinal), 2); 90TextSpan xToCloseBraceSpan = new TextSpan(xSpan.Start, sampleProgram.IndexOf('}') - xSpan.Start + 1); 490TextSpan span1 = new TextSpan(sampleProgram.IndexOf("i;", StringComparison.Ordinal), 2); 491TextSpan span2 = new TextSpan(sampleProgram.IndexOf("c;", StringComparison.Ordinal), 2); 514var sourceSpan = new TextSpan(); 561var treeSpan = tree.GetRoot().FullSpan; 589var treeSpan = tree.GetRoot().FullSpan;
IncrementalParsing\IncrementalParsingTests.cs (25)
2525var span = new TextSpan(oldIText.Length, 0); 2608var span = new TextSpan(currLen, 0); 2645var span = new TextSpan(text.LastIndexOf('x'), 0); 2823var span = new TextSpan(source.IndexOf(" A[]?"), 0); 2844var span = new TextSpan(src.IndexOf(":"), 1); 2865var span = new TextSpan(source.IndexOf(";"), 0); 2886var span = new TextSpan(source.IndexOf(";") + 1, 0); 2907var span = new TextSpan(source.IndexOf(";") + 1, 0); 2929var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 2953var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 2977var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3001var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3025var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3049var span = new TextSpan(source.IndexOf(substring) + substring.Length, 1); 3075var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3100var span = new TextSpan(source.IndexOf(substring), 0); 3126var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3152var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3170var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3188var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3206var span = new TextSpan(source.IndexOf(substring) + substring.Length, 0); 3220var span = new TextSpan(start: 0, length: 1); // delete first character 3234var span = new TextSpan(start: 0, length: 0); 3249var span = new TextSpan(start: source.IndexOf(substring), length: 3); // Goo[Goo] -> [Goo] 3286var span = new TextSpan(start: source.IndexOf(":") + 1, length: 0);
LexicalAndXml\RawStringLiteralLexingTests.cs (1)
183MarkupTestFile.GetSpans(markup, out var input, out IDictionary<string, ImmutableArray<TextSpan>> spans);
ParentChecker.cs (3)
20var span = nodeOrToken.Span; 27var tspan = trivia.Span; 40var tspan = trivia.Span;
Parsing\ParserRegressionTests.cs (2)
165var textSpan = Text.TextSpan.FromBounds(0, tree.Length);
Parsing\RoundTrippingTests.cs (2)
62var prevSpan = nodes[0].FullSpan; 65var span = nodes[i].FullSpan;
Syntax\LambdaUtilitiesTests.cs (1)
36TextSpan? span;
Syntax\SyntaxDiffingTests.cs (2)
307var span = new TextSpan(index, 4); 372var span = new TextSpan(index, 6);
Syntax\SyntaxFactoryTests.cs (2)
440var expectedLocation = Location.Create(expression.Token.SyntaxTree, TextSpan.FromBounds(0, 2)); 454var expectedLocation = Location.Create(expression.Token.SyntaxTree, TextSpan.FromBounds(0, 2));
Syntax\SyntaxNodeTests.cs (4)
720var EOFSpan = new TextSpan(root.FullSpan.End, 0); 729var nodeEndPositionSpan = new TextSpan(classDecl.FullSpan.End, 0); 739var invalidSpan = new TextSpan(100, 100); 2058var textSpan = new TextSpan(5, 10);
Syntax\SyntaxTests.cs (2)
160var span = section.Span; 161Assert.Equal(default(TextSpan), span);
TextExtensions.cs (4)
25var span = new TextSpan(offset, length); 35var span = new TextSpan(offset, length); 45var span = new TextSpan(offset, length); 59var span = new TextSpan(offset, 0);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CSharpTestBase.cs (1)
1737internal static string GetDocumentationCommentText(CSharpCompilation compilation, string outputName = null, SyntaxTree filterTree = null, TextSpan? filterSpanWithinTree = null, bool ensureEnglishUICulture = false, params DiagnosticDescription[] expectedDiagnostics)
Microsoft.CodeAnalysis.CSharp.Workspaces (147)
AggregatedFormattingResult.cs (1)
16public AggregatedFormattingResult(SyntaxNode node, IList<AbstractFormattingResult> results, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? formattingSpans)
BaseFormattingRule.cs (3)
20TextSpan textSpan, 52list.Add(FormattingOperations.CreateIndentBlockOperation(startToken, endToken, TextSpan.FromBounds(startPosition, endPosition), indentationDelta: -1, option: option)); 88TextSpan textSpan,
CaseCorrection\CSharpCaseCorrectionService.cs (1)
28ImmutableArray<TextSpan> spans,
Classification\ClassificationHelpers.cs (2)
500internal static void AddLexicalClassifications(SourceText text, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken) 526var span = classifiedSpan.TextSpan;
Classification\CSharpClassificationService.cs (1)
24public override void AddLexicalClassifications(SourceText text, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken)
Classification\SyntaxClassification\CSharpSyntaxClassificationService.cs (2)
37public override void AddLexicalClassifications(SourceText text, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken) 40public override void AddSyntacticClassifications(SyntaxNode root, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken)
Classification\SyntaxClassification\OperatorOverloadSyntaxClassifier.cs (2)
35var operatorSpan = GetOperatorTokenSpan(syntax); 43private static TextSpan GetOperatorTokenSpan(SyntaxNode syntax)
Classification\Worker.cs (9)
25private readonly TextSpan _textSpan; 29private Worker(TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken) 37IEnumerable<SyntaxToken> tokens, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken) 47SyntaxNode node, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken) 53private void AddClassification(TextSpan span, string type) 61private bool ShouldAddSpan(TextSpan span) 94var span = token.Span; 107AddClassification(TextSpan.FromBounds(token.Span.Start, token.Span.End - "u8".Length), type); 108AddClassification(TextSpan.FromBounds(token.Span.End - "u8".Length, token.Span.End), ClassificationTypeNames.Keyword);
Classification\Worker_DocumentationComments.cs (5)
23var childFullSpan = xmlNode.FullSpan; 109var span = TextSpan.FromBounds(spanStart.Value, spanStart.Value + index); 123var span = TextSpan.FromBounds(spanStart.Value, trivia.Span.End);
CodeCleanup\CSharpCodeCleanerService.cs (2)
21protected override ImmutableArray<TextSpan> GetSpansToAvoid(SyntaxNode root) 22=> ImmutableArray<TextSpan>.Empty;
CSharpRemoveUnnecessaryImportsService.cs (5)
80var spans = new List<TextSpan>(); 90List<TextSpan> spans, 94spans.Add(TextSpan.FromBounds(0, GetEndPosition(compilationUnit, compilationUnit.Members))); 102List<TextSpan> spans, 106spans.Add(TextSpan.FromBounds(namespaceMember.SpanStart, GetEndPosition(namespaceMember, namespaceMember.Members)));
CSharpSmartTokenFormatter.cs (2)
67_root, new[] { TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End) }, _options.FormattingOptions, smartTokenformattingRules, cancellationToken); 121_root, new[] { TextSpan.FromBounds(adjustedStartPosition, adjustedEndPosition) }, _options.FormattingOptions, smartTokenformattingRules, cancellationToken);
CSharpSyntaxFacts.cs (7)
932public TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node) 959public bool ContainsInMemberBody([NotNullWhen(true)] SyntaxNode? node, TextSpan span) 979private static TextSpan GetBlockBodySpan(BlockSyntax body) 980=> TextSpan.FromBounds(body.OpenBraceToken.Span.End, body.CloseBraceToken.SpanStart); 1094public TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) 1123return !branch.IsActive || !branch.BranchTaken ? TextSpan.FromBounds(branch.FullSpan.Start, position) : default; 1371public bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken)
CSharpSyntaxFactsService.cs (1)
116public Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken)
CSharpSyntaxFormatting.cs (1)
45protected override IFormattingResult CreateAggregatedFormattingResult(SyntaxNode node, IList<AbstractFormattingResult> results, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? formattingSpans = null)
CSharpVirtualCharService.cs (11)
205var lineSpan = currentLine.Span; 252using var _ = ArrayBuilder<(char ch, TextSpan span)>.GetInstance(out var charResults); 268if (!IsLegalBraceEscape(tokenText, index, offset, out var braceSpan)) 285string tokenText, int offset, int startIndexInclusive, int endIndexExclusive, ArrayBuilder<(char ch, TextSpan span)> charResults) 295private static void ConvertCharactersToRunes(ArrayBuilder<(char ch, TextSpan span)> charResults, ImmutableSegmentedList<VirtualChar>.Builder runeResults) 315runeResults.Add(VirtualChar.Create(rune, TextSpan.FromBounds(span.Start, nextSpan.End))); 329ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 342ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 375ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index) 394ArrayBuilder<(char ch, TextSpan span)> result, string tokenText, int offset, int index, char character) 507result.Add((character, TextSpan.FromBounds(startIndex + offset, endIndex + offset)));
Formatting\CSharpSyntaxFormattingService.cs (2)
325public ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken) 327var formattingSpan = CommonFormattingHelpers.GetFormattingSpan(document.Root, textSpan);
FormattingResult.cs (1)
19internal FormattingResult(TreeData treeInfo, TokenStream tokenStream, TextSpan spanToFormat)
IndentBlockFormattingRule.cs (5)
120TextSpan.FromBounds(lastTokenOfLabel.FullSpan.End, nextToken.SpanStart) : TextSpan.FromBounds(lastTokenOfLabel.FullSpan.End, lastTokenOfLabel.FullSpan.End)); 128var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 129span = lastSection ? span : TextSpan.FromBounds(span.Start, endToken.FullSpan.End); 346AddIndentBlockOperation(list, firstToken, lastToken, TextSpan.FromBounds(firstToken.FullSpan.Start, lastToken.FullSpan.End));
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs\SyntaxNodeExtensions.cs (14)
595public static bool ContainsInterleavedDirective(this SyntaxNode syntaxNode, TextSpan span, CancellationToken cancellationToken) 600TextSpan textSpan, 609TextSpan textSpan, 628TextSpan textSpan, 640var matchSpan = match.Span; 796var span = node.FullSpan; 890public static bool CheckTopLevel(this SyntaxNode node, TextSpan span) 920public static bool ContainsInArgument(this ConstructorInitializerSyntax initializer, TextSpan textSpan) 930public static bool ContainsInBlockBody(this BlockSyntax block, TextSpan textSpan) 937var blockSpan = TextSpan.FromBounds(block.OpenBraceToken.Span.End, block.CloseBraceToken.SpanStart); 941public static bool ContainsInExpressionBodiedMemberBody(this ArrowExpressionClauseSyntax expressionBodiedMember, TextSpan textSpan) 948var expressionBodiedMemberBody = TextSpan.FromBounds(expressionBodiedMember.Expression.SpanStart, expressionBodiedMember.Expression.Span.End);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (7)
240var fullSpan = trivia.FullSpan; 269var span = trivia.FullSpan; 287var span = trivia.FullSpan; 324var span = trivia.FullSpan; 350var span = trivia.FullSpan; 435var span = token.Span; 474var span = token.Span;
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs\CompilationUnitSyntaxExtensions.cs (5)
32var span = GetUsingsSpan(root, namespaceDeclaration); 48private static TextSpan GetUsingsSpan(CompilationUnitSyntax root, BaseNamespaceDeclarationSyntax? namespaceDeclaration) 55return TextSpan.FromBounds(start, end); 64return TextSpan.FromBounds(start, end); 72return TextSpan.FromBounds(start, end);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs\SyntaxTokenExtensions.cs (1)
544var existingAccessorSpan = existingAccessor.Span;
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTokenExtensions.cs\SyntaxTokenExtensions.cs (1)
22var name = SyntaxFactory.ParseName(syntaxTree.GetText(cancellationToken).ToString(TextSpan.FromBounds(genericIdentifier.SpanStart, lastToken.Span.End)));
LanguageServices\FixAllSpanMappingService\CSharpFixAllSpanMappingService.cs (6)
28protected override async Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansIfWithinGlobalStatementAsync( 29Document document, TextSpan span, CancellationToken cancellationToken) 34return ImmutableDictionary<Document, ImmutableArray<TextSpan>>.Empty; 39var fixAllSpan = root.FullSpan; 47return ImmutableDictionary<Document, ImmutableArray<TextSpan>>.Empty; 52return ImmutableDictionary<Document, ImmutableArray<TextSpan>>.Empty
OrganizeImports\CSharpOrganizeImportsService.Rewriter.cs (2)
87private static TextSpan GetTextSpan<TSyntax>(SyntaxList<TSyntax> list) where TSyntax : SyntaxNode 88=> TextSpan.FromBounds(list.First().FullSpan.Start, list.Last().FullSpan.End);
Rename\CSharpRenameRewriterLanguageService.cs (17)
56private readonly ImmutableDictionary<TextSpan, RenameLocation> _renameLocations; 57private readonly ImmutableHashSet<TextSpan> _conflictLocations; 93private readonly ImmutableDictionary<TextSpan, ImmutableSortedSet<TextSpan>?> _stringAndCommentTextSpans; 105private List<(TextSpan oldSpan, TextSpan newSpan)>? _modifiedSubSpans; 109private void AddModifiedSpan(TextSpan oldSpan, TextSpan newSpan) 290_modifiedSubSpans = new List<(TextSpan oldSpan, TextSpan newSpan)>(); 300var oldSpan = originalNode.Span; 315var newSpan = newNode.Span; 392var oldSpan = token.Span; 643private SyntaxToken RenameInStringLiteral(SyntaxToken oldToken, SyntaxToken newToken, ImmutableSortedSet<TextSpan>? subSpansToReplace, Func<SyntaxTriviaList, string, string, SyntaxTriviaList, SyntaxToken> createNewStringLiteral) 649var oldSpan = oldToken.Span; 677var oldSpan = trivia.Span; 688ImmutableSortedSet<TextSpan>? subSpansToReplace = null;
Simplification\Simplifiers\ExpressionSimplifier.cs (5)
38out TextSpan issueSpan, 70out TextSpan issueSpan, 93out TextSpan issueSpan, 266out TextSpan issueSpan, 410out TextSpan issueSpan)
Simplification\Simplifiers\NameSimplifier.cs (4)
38out TextSpan issueSpan, 189out var issueSpanWithoutAttributeSuffix)) 452ref TextSpan issueSpan, 478out TextSpan issueSpan)
Simplification\Simplifiers\QualifiedCrefSimplifier.cs (2)
31out TextSpan issueSpan, 81CrefSyntax replacement, out CrefSyntax replacementNode, out TextSpan issueSpan,
SuppressFormattingRule.cs (2)
335var textSpan = TextSpan.FromBounds(startToken.Span.End, endToken.SpanStart);
SyntaxTriviaExtensions.cs (1)
156var span = trivia.FullSpan;
TriviaDataFactory.ComplexTrivia.cs (3)
56var span = TextSpan.FromBounds(commonToken1.Span.End, formatSpanEnd); 106public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
TriviaDataFactory.FormattedComplexTrivia.cs (1)
58public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
TriviaDataFactory.ModifiedComplexTrivia.cs (1)
104public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
TriviaRewriter.cs (6)
22private readonly SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector> _spans; 30SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector> spanToFormat, 99private TextSpan GetTextSpan(ValueTuple<SyntaxToken, SyntaxToken> pair) 103return TextSpan.FromBounds(_node.FullSpan.Start, pair.Item2.SpanStart); 108return TextSpan.FromBounds(pair.Item1.Span.End, _node.FullSpan.End); 111return TextSpan.FromBounds(pair.Item1.Span.End, pair.Item2.SpanStart);
TypeDeclarationSyntaxExtensions.cs (3)
29indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken)); 35indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken)); 47indices.Add(!destination.OverlapsHiddenPosition(TextSpan.FromBounds(start, end), cancellationToken));
Workspace\LanguageServices\CSharpSyntaxTreeFactoryService.NodeSyntaxReference.cs (1)
25public override TextSpan Span
WrappingFormattingRule.cs (2)
187var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (6)
CodeGeneration\SyntaxGeneratorTests.cs (1)
4695MarkupTestFile.GetSpan(markup, out var code, out var span);
Formatting\CSharpFormattingTestBase.cs (1)
50IEnumerable<TextSpan> spans,
Formatting\FormattingMultipleSpanTests.cs (4)
169var result = Formatter.Format(root, TextSpan.FromBounds(0, 0), workspace.Services.SolutionServices, CSharpSyntaxFormattingOptions.Default, CancellationToken.None); 179private static Tuple<string, List<TextSpan>> PreprocessMarkers(string codeWithMarker) 182var spans = new List<TextSpan>(); 199spans.Add(TextSpan.FromBounds(startPosition, endPosition));
Microsoft.CodeAnalysis.EditorFeatures (199)
AddImports\AbstractAddImportsPasteCommandHandler.cs (1)
167var textSpan = snapshotSpan.Span.ToTextSpan();
AutomaticCompletion\AbstractAutomaticLineEnderCommandHandler.cs (1)
176if (string.IsNullOrWhiteSpace(text.ToString(TextSpan.FromBounds(token.Span.End, line.End))))
BracePairs\BracePairsTaggerProvider.cs (1)
111static SnapshotSpan? CreateSnapshotSpan(TextSpan span, ITextSnapshot snapshot)
Classification\Semantic\ClassificationUtilities.cs (2)
126var changedSpan = new TextSpan(range.Value.Span.Start, range.Value.NewLength); 134var subTextSpan = service.GetMemberBodySpanForSpeculativeBinding(member);
CommentSelection\AbstractCommentSelectionBase.cs (2)
85protected static void DeleteText(ArrayBuilder<TextChange> textChanges, TextSpan span) 173internal static ITrackingSpan CreateTrackingSpan(Operation operation, ITextSnapshot snapshot, TextSpan textSpan)
CommentSelection\AbstractToggleBlockCommentBase.cs (39)
60protected abstract ImmutableArray<TextSpan> GetBlockCommentsInDocument(Document document, ITextSnapshot snapshot, 61TextSpan linesContainingSelections, CommentSelectionInfo commentInfo, CancellationToken cancellationToken); 101var linesContainingSelection = TextSpan.FromBounds(firstLineAroundSelection, lastLineAroundSelection); 135private static bool TryUncommentBlockComment(ImmutableArray<TextSpan> blockCommentedSpans, 141&& blockCommentSelection.TryGetBlockCommentOnSameLine(blockCommentedSpans, out var blockCommentOnSameLine)) 151foreach (var spanToRemove in intersectingBlockComments) 156var trackingSpan = TextSpan.FromBounds(intersectingBlockComments.First().Start, intersectingBlockComments.Last().End); 177var spanToAdd = blockCommentSelection.SelectedSpan; 181spanToAdd = TextSpan.FromBounds(caretLocation, caretLocation); 208if (blockCommentSelection.IsSpanWhitespace(TextSpan.FromBounds(extent.Span.Start, extent.Span.End))) 223var selectedSpan = blockCommentSelection.SelectedSpan; 229foreach (var uncommentedSpan in blockCommentSelection.UncommentedSpansInSelection) 257private static void AddBlockComment(CommentSelectionInfo commentInfo, TextSpan span, ArrayBuilder<TextChange> textChanges) 263private static void DeleteBlockComment(BlockCommentSelectionHelper blockCommentSelection, TextSpan spanToRemove, 285public TextSpan SelectedSpan { get; } 287public ImmutableArray<TextSpan> IntersectingBlockComments { get; } 289public ImmutableArray<TextSpan> UncommentedSpansInSelection { get; } 291public BlockCommentSelectionHelper(ImmutableArray<TextSpan> allBlockComments, SnapshotSpan selectedSnapshotSpan) 296SelectedSpan = TextSpan.FromBounds(selectedSnapshotSpan.Start, selectedSnapshotSpan.End); 304public bool IsSpanWhitespace(TextSpan span) 363public bool TryGetBlockCommentOnSameLine(ImmutableArray<TextSpan> allBlockComments, out TextSpan commentedSpanOnSameLine) 367var lineStartToCaretIsWhitespace = IsSpanWhitespace(TextSpan.FromBounds(selectedLine.Start, SelectedSpan.Start)); 368var caretToLineEndIsWhitespace = IsSpanWhitespace(TextSpan.FromBounds(SelectedSpan.Start, selectedLine.End)); 369foreach (var blockComment in allBlockComments) 375if (IsSpanWhitespace(TextSpan.FromBounds(SelectedSpan.Start, blockComment.Start))) 385if (IsSpanWhitespace(TextSpan.FromBounds(blockComment.End, SelectedSpan.Start))) 401private static ImmutableArray<TextSpan> GetIntersectingBlockComments(ImmutableArray<TextSpan> allBlockComments, TextSpan span) 407private ImmutableArray<TextSpan> GetUncommentedSpansInSelection() 409var uncommentedSpans = new List<TextSpan>(); 413foreach (var commentedSpan in IntersectingBlockComments) 418var possibleUncommentedSpan = TextSpan.FromBounds(spanStart, commentedSpan.Start); 432var uncommentedSpan = TextSpan.FromBounds(spanStart, SelectedSpan.End);
CommentSelection\CommentTrackingSpan.cs (3)
16public TextSpan TrackingTextSpan { get; } 26public CommentTrackingSpan(TextSpan trackingTextSpan) 33public CommentTrackingSpan(TextSpan trackingTextSpan, int amountToAddToStart, int amountToAddToEnd)
CommentSelection\CommentUncommentSelectionCommandHandler.cs (4)
174trackingSpans.Add(new CommentTrackingSpan(TextSpan.FromBounds(firstLine.Start.Position, lastLine.End.Position))); 181trackingSpans.Add(new CommentTrackingSpan(TextSpan.FromBounds(span.Start, span.End))); 273spansToSelect.Add(new CommentTrackingSpan(TextSpan.FromBounds(positionOfStart, positionOfEnd + info.BlockCommentEndString.Length))); 302spansToSelect.Add(new CommentTrackingSpan(TextSpan.FromBounds(firstLine.Start.Position, lastLine.End.Position)));
CommentSelection\ToggleBlockCommentCommandHandler.cs (4)
44protected override ImmutableArray<TextSpan> GetBlockCommentsInDocument(Document document, ITextSnapshot snapshot, 45TextSpan linesContainingSelections, CommentSelectionInfo commentInfo, CancellationToken cancellationToken) 48var commentedSpans = ArrayBuilder<TextSpan>.GetInstance(); 61var blockCommentSpan = new TextSpan(openIdx, closeIdx + commentInfo.BlockCommentEndString.Length - openIdx);
CommentSelection\ToggleLineCommentCommandHandler.cs (2)
133var spanToRemove = TextSpan.FromBounds(commentIndex, commentIndex + commentInfo.SingleLineCommentString.Length);
EditorConfigSettings\Updater\NamingStyles\NamingStyleSettingsUpdater.cs (4)
50var endOfSection = new TextSpan(parseResult.Section.Span.End, 0); 97static SourceText UpdateDocument(SourceText sourceText, string newLine, TextSpan? potentialSpan, TextSpan backupSpan) 106var span = potentialSpan ?? backupSpan;
EditorConfigSettings\Updater\NamingStyles\SourceTextExtensions.cs (3)
40var span = new TextSpan(existingSection.Span.End, 0); 46var span = new TextSpan(sourceText.Length, 0); 56static SourceText WithChanges(SourceText sourceText, TextSpan span, string newText)
Extensibility\NavigationBar\AbstractEditorNavigationBarItemService.cs (1)
81var navigationSpan = item.GetCurrentItemSpan(textVersion, symbolItem.Location.InDocumentInfo.Value.navigationSpan);
Extensibility\NavigationBar\NavigationBarItem.cs (4)
31public ImmutableArray<TextSpan> Spans { get; } 39ImmutableArray<TextSpan> spans, 73public static TextSpan GetCurrentItemSpan(this NavigationBarItem item, ITextVersion toVersion, TextSpan span)
Extensibility\NavigationBar\NavigationBarProjectItem.cs (1)
24spans: ImmutableArray<TextSpan>.Empty,
Extensibility\NavigationBar\SimpleNavigationBarItem.cs (1)
14public SimpleNavigationBarItem(ITextVersion textVersion, string text, Glyph glyph, ImmutableArray<TextSpan> spans, ImmutableArray<NavigationBarItem> childItems, int indent, bool bolded, bool grayed)
Extensibility\NavigationBar\WrappedNavigationBarItem.cs (4)
37private static ImmutableArray<TextSpan> GetSpans(RoslynNavigationBarItem underlyingItem) 39using var _ = ArrayBuilder<TextSpan>.GetInstance(out var spans); 41spans.SortAndRemoveDuplicates(Comparer<TextSpan>.Default); 44static void AddSpans(RoslynNavigationBarItem underlyingItem, ArrayBuilder<TextSpan> spans)
ExternalAccess\IntelliCode\Api\IIntentSourceProvider.cs (2)
56public TextSpan PriorSelection { get; } 58public IntentRequestContext(string intentName, SnapshotSpan currentSnapshotSpan, ImmutableArray<TextChange> textEditsToPrior, TextSpan priorSelection, string? intentData)
ExternalAccess\IntelliCode\IntentProcessor.cs (1)
74var selectionTextSpan = intentRequestContext.PriorSelection;
ExternalAccess\UnitTestGenerator\Api\UnitTestGeneratorAddMissingImportsFeatureServiceAccessor.cs (2)
33internal async Task<Document> AddMissingImportsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) 40internal async Task<WrappedMissingImportsAnalysisResult> AnalyzeAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken)
ExternalAccess\VSTypeScript\Api\IVSTypeScriptBraceMatcherImplementation.cs (2)
17internal readonly record struct VSTypeScriptBraceMatchingResult(TextSpan LeftSpan, TextSpan RightSpan);
ExternalAccess\VSTypeScript\Api\IVSTypeScriptBreakpointResolutionServiceImplementation.cs (1)
14Task<VSTypeScriptBreakpointResolutionResultWrapper> ResolveBreakpointAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken = default);
ExternalAccess\VSTypeScript\Api\IVSTypeScriptFormattingInteractionService.cs (2)
33Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, TextSpan? textSpan, DocumentOptionSet? documentOptions, CancellationToken cancellationToken); 38Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, TextSpan textSpan, DocumentOptionSet? documentOptions, CancellationToken cancellationToken);
ExternalAccess\VSTypeScript\Api\VSTypeScriptBlockSpan.cs (4)
14public TextSpan TextSpan { get; } 15public TextSpan HintSpan { get; } 22string? type, bool isCollapsible, TextSpan textSpan, TextSpan hintSpan, string bannerText = Ellipses, bool autoCollapse = false, bool isDefaultCollapsed = false)
ExternalAccess\VSTypeScript\Api\VSTypeScriptBreakpointResolutionResultWrapper.cs (2)
18public TextSpan TextSpan => UnderlyingObject.TextSpan; 22public static VSTypeScriptBreakpointResolutionResultWrapper CreateSpanResult(Document document, TextSpan textSpan, string? locationNameOpt = null)
ExternalAccess\VSTypeScript\Api\VSTypeScriptDebugDataTipInfoWrapper.cs (2)
14public VSTypeScriptDebugDataTipInfoWrapper(TextSpan span, string text) 17public readonly TextSpan Span => UnderlyingObject.Span;
ExternalAccess\VSTypeScript\Api\VSTypeScriptDocumentSpan.cs (2)
14public TextSpan SourceSpan { get; } 16public VSTypeScriptDocumentSpan(Document document, TextSpan sourceSpan)
ExternalAccess\VSTypeScript\Api\VSTypeScriptGoToSymbolContext.cs (1)
26public TextSpan Span { get; set; }
ExternalAccess\VSTypeScript\Api\VSTypeScriptInlineRenameInfo.cs (5)
28public abstract TextSpan TriggerSpan { get; } 31public abstract TextSpan? GetConflictEditSpan(VSTypeScriptInlineRenameLocationWrapper location, string replacementText, CancellationToken cancellationToken); 33public abstract TextSpan GetReferenceEditSpan(VSTypeScriptInlineRenameLocationWrapper location, CancellationToken cancellationToken); 47TextSpan? IInlineRenameInfo.GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken) 51TextSpan IInlineRenameInfo.GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken)
ExternalAccess\VSTypeScript\Api\VSTypeScriptInlineRenameLocationWrapper.cs (1)
20public TextSpan TextSpan => _underlyingObject.TextSpan;
ExternalAccess\VSTypeScript\Api\VSTypeScriptInlineRenameReplacementWrapper.cs (2)
20public TextSpan OriginalSpan => UnderlyingObject.OriginalSpan; 21public TextSpan NewSpan => UnderlyingObject.NewSpan;
ExternalAccess\VSTypeScript\Api\VSTypescriptNavigationBarItem.cs (2)
18public ImmutableArray<TextSpan> Spans { get; } 23ImmutableArray<TextSpan> spans,
ExternalAccess\VSTypeScript\VSTypeScriptBreakpointResolutionService.cs (1)
29public async Task<BreakpointResolutionResult?> ResolveBreakpointAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken = default)
ExternalAccess\VSTypeScript\VSTypeScriptFormattingInteractionService.cs (2)
39public Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, TextSpan? textSpan, CancellationToken cancellationToken) 42public Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken)
ExternalAccess\VSTypeScript\VSTypeScriptGoToSymbolService.cs (1)
27public async Task<(INavigableLocation? location, TextSpan symbolSpan)> FindDefinitionLocationAsync(
ExternalAccess\VSTypeScript\VSTypeScriptNavigationBarItemService.cs (1)
63var navigationSpan = item.GetCurrentItemSpan(textVersion, item.Spans.First());
ExtractMethod\ExtractMethodCommandHandler.cs (2)
138TextSpan span, 279Document document, TextSpan span, ExtractMethodResult result, ExtractMethodGenerationOptions options, CancellationToken cancellationToken)
Formatting\FormatCommandHandler.cs (1)
64private void Format(ITextView textView, ITextBuffer textBuffer, Document document, TextSpan? selectionOpt, CancellationToken cancellationToken)
Formatting\FormatCommandHandler.FormatSelection.cs (1)
54var formattingSpan = selection[0].Span.ToTextSpan();
Formatting\FormatCommandHandler.Paste.cs (1)
81var span = trackingSpan.GetSpan(subjectBuffer.CurrentSnapshot).Span.ToTextSpan();
Formatting\IFormattingInteractionService.cs (2)
32Task<ImmutableArray<TextChange>> GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, TextSpan? textSpan, CancellationToken cancellationToken); 37Task<ImmutableArray<TextChange>> GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken);
GoToDefinition\AbstractGoToDefinitionService.cs (1)
46public async Task<(INavigableLocation? location, TextSpan symbolSpan)> FindDefinitionLocationAsync(
GoToDefinition\IAsyncGoToDefinitionService.cs (2)
17/// returns that <see cref="INavigableLocation"/>. The <see cref="TextSpan"/> returned in the span of the 21Task<(INavigableLocation? location, TextSpan symbolSpan)> FindDefinitionLocationAsync(
IInlineRenameService.cs (1)
24InlineRenameSessionInfo StartInlineSession(Document document, TextSpan triggerSpan, CancellationToken cancellationToken);
InlineRename\AbstractEditorInlineRenameService.FailureInlineRenameInfo.cs (3)
33public TextSpan TriggerSpan => default; 45public TextSpan GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken) => default; 47public TextSpan? GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken) => null;
InlineRename\AbstractEditorInlineRenameService.SymbolRenameInfo.cs (3)
47public TextSpan TriggerSpan { get; } 89public TextSpan GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken) 111public TextSpan? GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken)
InlineRename\IEditorInlineRenameService.cs (10)
24public TextSpan TextSpan { get; } 26public InlineRenameLocation(Document document, TextSpan textSpan) : this() 71public TextSpan OriginalSpan { get; } 72public TextSpan NewSpan { get; } 74public InlineRenameReplacement(InlineRenameReplacementKind kind, TextSpan originalSpan, TextSpan newSpan) : this() 81internal InlineRenameReplacement(RelatedLocation location, TextSpan newSpan) 172TextSpan TriggerSpan { get; } 216TextSpan GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken); 222TextSpan? GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken);
InlineRename\InlineRenameService.cs (2)
70TextSpan textSpan, 78TextSpan textSpan,
InlineRename\InlineRenameSession.cs (1)
433_openTextBuffers[textBuffer].SetReferenceSpans(SpecializedCollections.EmptyEnumerable<TextSpan>());
InlineRename\InlineRenameSession.OpenTextBufferManager.cs (14)
48private readonly Dictionary<TextSpan, RenameTrackingSpan> _referenceSpanToLinkedRenameSpanMap = new Dictionary<TextSpan, RenameTrackingSpan>(); 55private TextSpan? _activeSpan; 170internal void SetReferenceSpans(IEnumerable<TextSpan> spans) 186foreach (var span in spans) 189var renameableSpan = _session._renameInfo.GetReferenceEditSpan( 213private static string GetTriggerText(Document document, TextSpan span) 458: SpecializedCollections.EmptyEnumerable<TextSpan>(); 460foreach (var conflict in mergeConflictComments) 656private readonly TextSpan _anchorSpan; 657private readonly TextSpan _activeSpan; 721var anchorSpan = _anchorSpan; 727var activeSpan = _activeSpan; 737private SnapshotPoint GetNewEndpoint(TextSpan span)
IntelliSense\AsyncCompletion\CommitManager.cs (1)
177TextSpan completionListSpan,
IntelliSense\AsyncCompletion\CompletionSessionData.cs (1)
26public TextSpan? CompletionListSpan { get; set; }
IntelliSense\AsyncCompletion\CompletionSource.cs (1)
212buffer.ApplyChange(new TextChange(TextSpan.FromBounds(caretPoint - 2, caretPoint), string.Empty));
IntelliSense\AsyncCompletion\ItemManager.CompletionListUpdater.cs (1)
624static Span GetOffsetSpan(TextSpan span, RoslynCompletionItem item)
IntelliSense\QuickInfo\IntellisenseQuickInfoBuilder.cs (1)
108foreach (var span in quickInfoItem.RelatedSpans)
IntelliSense\QuickInfo\Model.cs (1)
33internal SnapshotSpan GetCurrentSpanInSnapshot(TextSpan originalSpan, ITextSnapshot textSnapshot)
IntelliSense\ViewTextSpan.cs (3)
26public readonly TextSpan TextSpan; 28public ViewTextSpan(TextSpan textSpan) 57public ViewTextSpan GetSubjectBufferTextSpanInViewBuffer(TextSpan textSpan)
Intents\DeleteParameterIntentProvider.cs (1)
36TextSpan priorSelection,
Intents\RenameIntentProvider.cs (1)
33TextSpan priorSelection,
Interactive\SendToInteractiveSubmissionProvider.cs (3)
32protected abstract IEnumerable<TextSpan> GetExecutableSyntaxTreeNodeSelection(TextSpan selectedSpan, SyntaxNode node); 73var newSpans = GetExecutableSyntaxTreeNodeSelection(TextSpan.FromBounds(selectedSpansStart, selectedSpansEnd), root).
KeywordHighlighting\HighlighterViewTaggerProvider.cs (3)
40private static readonly PooledObjects.ObjectPool<List<TextSpan>> s_listPool = new(() => new List<TextSpan>()); 120foreach (var span in highlights)
LanguageServer\EditorLspCompletionResultCreationService.cs (1)
33TextSpan defaultSpan,
Navigation\IDocumentNavigationServiceExtensions.cs (3)
30this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, TextSpan textSpan, NavigationOptions options, bool allowInvalidSpan, CancellationToken cancellationToken) 37this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, TextSpan textSpan, NavigationOptions options, CancellationToken cancellationToken) 44this IDocumentNavigationService service, IThreadingContext threadingContext, Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken)
NavigationBar\NavigationBarController_ModelComputation.cs (1)
180foreach (var span in item.Spans)
PasteTracking\PasteTrackingPasteCommandHandler.cs (2)
63var textSpan = TextSpan.FromBounds(snapshotSpan.Start, snapshotSpan.End);
PasteTracking\PasteTrackingService.cs (2)
30public bool TryGetPastedTextSpan(SourceTextContainer sourceTextContainer, out TextSpan textSpan) 43internal void RegisterPastedTextSpan(ITextBuffer textBuffer, TextSpan textSpan)
RenameTracking\RenameTrackingTaggerProvider.cs (2)
115public static (CodeAction action, TextSpan renameSpan) TryGetCodeAction( 116Document document, TextSpan textSpan,
RenameTracking\RenameTrackingTaggerProvider.StateMachine.cs (2)
289internal (CodeAction action, TextSpan renameSpan) TryGetCodeAction( 290Document document, SourceText text, TextSpan userSpan,
Shared\Extensions\ITextSnapshotExtensions.cs (1)
31TextSpan span,
Shared\Extensions\SnapshotSpanExtensions.cs (1)
33public static bool IntersectsWith(this SnapshotSpan snapshotSpan, TextSpan textSpan)
Shared\Extensions\SpanExtensions.cs (1)
20public static TextSpan ToTextSpan(this Span span)
Shared\Utilities\CommonFormattingHelpers.cs (5)
15public static TextSpan GetFormattingSpan(SyntaxNode root, TextSpan span) 18public static TextSpan GetFormattingSpan(ITextSnapshot snapshot, SnapshotSpan selectedSpan) 27return TextSpan.FromBounds(currentLine.Start, endPosition); 31return TextSpan.FromBounds(lastNonNoisyCharPosition, endPosition);
SpellCheck\RoslynSpellCheckFixerProvider.cs (2)
100var fullTokenSpan = info.TriggerSpan; 101var subSpanBeingRenamed = span.Span.ToTextSpan();
Tagging\AbstractAsynchronousTaggerProvider.cs (2)
251public bool SpanEquals(ITextSnapshot snapshot1, TextSpan? span1, ITextSnapshot snapshot2, TextSpan? span2)
Microsoft.CodeAnalysis.EditorFeatures.Cocoa (20)
AsyncSuggestedActionsSource.cs (1)
170TextSpan? selection,
Controller.Session_ComputeModel.cs (1)
224private static bool IsBetter(SignatureHelpItems bestItems, TextSpan? currentTextSpan)
Model.cs (2)
20public TextSpan TextSpan { get; } 34TextSpan textSpan,
Snippets\AbstractSnippetExpansionClient.cs (1)
100var formattingSpan = CommonFormattingHelpers.GetFormattingSpan(SubjectBuffer.CurrentSnapshot, snippetTrackingSpan.GetSpan(SubjectBuffer.CurrentSnapshot));
Snippets\CSharpSnippets\SnippetFunctions\SnippetFunctionGenerateSwitchCases.cs (3)
17using TextSpan = Microsoft.CodeAnalysis.Text.TextSpan; 59var expressionSpan = subjectBufferFieldSpan.Span.ToTextSpan(); 83var typeSpanToAnnotate = new TextSpan(startPosition + "case ".Length, fullyQualifiedTypeName.Length);
Snippets\CSharpSnippets\SnippetFunctions\SnippetFunctionSimpleTypeName.cs (1)
24protected override bool TryGetSimplifiedTypeName(Document documentWithFullyQualifiedTypeName, TextSpan updatedTextSpan, CancellationToken cancellationToken, out string simplifiedTypeName)
Snippets\SnippetFunctions\AbstractSnippetFunctionSimpleTypeName.cs (5)
11using TextSpan = Microsoft.CodeAnalysis.Text.TextSpan; 27protected abstract bool TryGetSimplifiedTypeName(Document documentWithFullyQualifiedTypeName, TextSpan updatedTextSpan, CancellationToken cancellationToken, out string simplifiedTypeName); 38if (!TryGetDocumentWithFullyQualifiedTypeName(document, out var updatedTextSpan, out var documentWithFullyQualifiedTypeName)) 52private bool TryGetDocumentWithFullyQualifiedTypeName(Document document, out TextSpan updatedTextSpan, [NotNullWhen(returnValue: true)] out Document? documentWithFullyQualifiedTypeName) 66var originalTextSpan = new TextSpan(subjectBufferFieldSpan.Start, subjectBufferFieldSpan.Length);
SuggestedActionsSource.cs (6)
198TextSpan? selection, 306TextSpan? selection, 352private async Task<TextSpan?> GetSpanAsync(ReferenceCountedDisposable<State> state, SnapshotSpan range, CancellationToken cancellationToken) 393TextSpan? selection = null; 457TextSpan? selection, 486protected TextSpan? TryGetCodeRefactoringSelection(ReferenceCountedDisposable<State> state, SnapshotSpan range)
Microsoft.CodeAnalysis.EditorFeatures.DiagnosticsTests.Utilities (68)
ChangeSignature\AbstractChangeSignatureTests.cs (4)
59conflictSpans: ImmutableArray<TextSpan>.Empty, 60renameSpans: ImmutableArray<TextSpan>.Empty, 61warningSpans: ImmutableArray<TextSpan>.Empty, 62navigationSpans: ImmutableArray<TextSpan>.Empty,
CodeActions\AbstractCodeActionOrUserDiagnosticTest.cs (25)
440out var initialMarkupWithoutSpans, out IDictionary<string, ImmutableArray<TextSpan>> initialSpanMap); 443var unnecessarySpans = initialSpanMap.GetOrAdd(UnnecessaryMarkupKey, _ => ImmutableArray<TextSpan>.Empty); 447out var expected, out IDictionary<string, ImmutableArray<TextSpan>> expectedSpanMap); 449var conflictSpans = expectedSpanMap.GetOrAdd("Conflict", _ => ImmutableArray<TextSpan>.Empty); 450var renameSpans = expectedSpanMap.GetOrAdd("Rename", _ => ImmutableArray<TextSpan>.Empty); 451var warningSpans = expectedSpanMap.GetOrAdd("Warning", _ => ImmutableArray<TextSpan>.Empty); 452var navigationSpans = expectedSpanMap.GetOrAdd("Navigation", _ => ImmutableArray<TextSpan>.Empty); 477ImmutableArray<TextSpan> expectedSpans, 493var actual = unnecessaryLocations[i].SourceSpan; 494var expected = expectedSpans[i]; 513ImmutableArray<TextSpan> expectedSpans, 570ImmutableArray<TextSpan> conflictSpans, 571ImmutableArray<TextSpan> renameSpans, 572ImmutableArray<TextSpan> warningSpans, 573ImmutableArray<TextSpan> navigationSpans, 586ImmutableArray<TextSpan> conflictSpans, 587ImmutableArray<TextSpan> renameSpans, 588ImmutableArray<TextSpan> warningSpans, 589ImmutableArray<TextSpan> navigationSpans, 627void TestAnnotations(ImmutableArray<TextSpan> expectedSpans, string annotationKind) 636var actual = annotatedItems[i].Span; 637var expected = expectedSpans[i]; 890out TextSpan span, 900private static bool TryGetDocumentAndSelectSpan(TestWorkspace workspace, out Document document, out TextSpan span) 925private static Document GetDocumentAndAnnotatedSpan(TestWorkspace workspace, out string annotation, out TextSpan span)
CodeActions\AbstractCodeActionTest.cs (5)
42GetDocumentAndSelectSpanOrAnnotatedSpan(workspace, out var document, out var span, out var annotation); 80TextSpan selectionSpan, 98GetDocumentAndSelectSpanOrAnnotatedSpan(workspace, out var document, out var span, out _); 104TextSpan selectedOrAnnotatedSpan, 110var actions = ArrayBuilder<(CodeAction, TextSpan?)>.GetInstance();
CodeActions\CSharpCodeFixVerifier`2+Test.cs (1)
111protected override CodeFixContext CreateCodeFixContext(Document document, TextSpan span, ImmutableArray<Diagnostic> diagnostics, Action<CodeAction, ImmutableArray<Diagnostic>> registerCodeFix, CancellationToken cancellationToken)
CodeActions\CSharpCodeRefactoringVerifier`1+Test.cs (1)
117protected override CodeRefactoringContext CreateCodeRefactoringContext(Document document, TextSpan span, Action<CodeAction> registerRefactoring, CancellationToken cancellationToken)
CodeActions\VisualBasicCodeFixVerifier`2+Test.cs (1)
94protected override CodeFixContext CreateCodeFixContext(Document document, TextSpan span, ImmutableArray<Diagnostic> diagnostics, Action<CodeAction, ImmutableArray<Diagnostic>> registerCodeFix, CancellationToken cancellationToken)
CodeActions\VisualBasicCodeRefactoringVerifier`1+Test.cs (1)
103protected override CodeRefactoringContext CreateCodeRefactoringContext(Document document, TextSpan span, Action<CodeAction> registerRefactoring, CancellationToken cancellationToken)
Diagnostics\AbstractDiagnosticProviderBasedUserDiagnosticTest.cs (5)
149var document = GetDocumentAndSelectSpan(workspace, out var span); 161GetDocumentAndSelectSpanOrAnnotatedSpan(workspace, out var document, out var span, out var annotation); 164var filterSpan = parameters.includeDiagnosticsOutsideSelection ? (TextSpan?)null : span; 219var expected = hostDocument.SelectedSpans.Single(); 220var actual = diagnostics.Single().Location.SourceSpan;
Diagnostics\AbstractSuppressionDiagnosticTest.cs (2)
75var document = GetDocumentAndSelectSpan(workspace, out var span); 86GetDocumentAndSelectSpanOrAnnotatedSpan(workspace, out var document, out var span, out var annotation);
Diagnostics\AbstractUnncessarySuppressionDiagnosticTest.cs (2)
42var document = GetDocumentAndSelectSpan(workspace, out var span); 51GetDocumentAndSelectSpanOrAnnotatedSpan(workspace, out var document, out var span, out var annotation);
Diagnostics\AbstractUserDiagnosticTest.cs (6)
58var expectedSpan = hostDocumentsWithAnnotations.Single().SelectedSpans.Single(); 63var actualSpan = diagnostic.Location.SourceSpan; 110protected static Document GetDocumentAndSelectSpan(TestWorkspace workspace, out TextSpan span) 122TextSpan span, 249MarkupTestFile.GetSpans(initialMarkup, out var unused, out ImmutableArray<TextSpan> spansList); 255ISet<TextSpan> actualTextSpans;
Diagnostics\AbstractUserDiagnosticTest_GenerateTypeDialog.cs (8)
114conflictSpans: ImmutableArray<TextSpan>.Empty, 115renameSpans: ImmutableArray<TextSpan>.Empty, 116warningSpans: ImmutableArray<TextSpan>.Empty, 117navigationSpans: ImmutableArray<TextSpan>.Empty, 136conflictSpans: ImmutableArray<TextSpan>.Empty, 137renameSpans: ImmutableArray<TextSpan>.Empty, 138warningSpans: ImmutableArray<TextSpan>.Empty, 139navigationSpans: ImmutableArray<TextSpan>.Empty,
MoveType\AbstractMoveTypeTest.cs (5)
56MarkupTestFile.GetSpan(expectedCode, out var expectedText, out var span); 143conflictSpans: ImmutableArray<TextSpan>.Empty, 144renameSpans: ImmutableArray<TextSpan>.Empty, 145warningSpans: ImmutableArray<TextSpan>.Empty, 146navigationSpans: ImmutableArray<TextSpan>.Empty,
SplitComments\AbstractSplitCommentCommandHandlerTests.cs (2)
68foreach (var selection in originalSelections) 83out var expectedOutput, out ImmutableArray<TextSpan> expectedSpans);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (116)
AbstractCommandHandlerTestState.cs (2)
90var firstSpan = selectionSpanList.First(); 91var lastSpan = selectionSpanList.Last();
BraceMatching\AbstractBraceMatcherTests.cs (1)
36MarkupTestFile.GetSpans(expectedCode, out var parsedExpectedCode, out ImmutableArray<TextSpan> expectedSpans);
BracePairs\AbstractBracePairsTests.cs (1)
50private static bool FindMatch(IDictionary<string, ImmutableArray<TextSpan>> expected, BracePairData bracePair)
Classification\AbstractClassifierTests.cs (7)
29protected abstract Task<ImmutableArray<ClassifiedSpan>> GetClassificationSpansAsync(string text, TextSpan span, ParseOptions? parseOptions, TestHost testHost); 45TextSpan span; 54MarkupTestFile.GetSpans(allCode, out var rewrittenCode, out ImmutableArray<TextSpan> spans); 272protected static async Task<ImmutableArray<ClassifiedSpan>> GetSemanticClassificationsAsync(Document document, TextSpan span) 283protected static async Task<ImmutableArray<ClassifiedSpan>> GetSyntacticClassificationsAsync(Document document, TextSpan span) 293protected static async Task<ImmutableArray<ClassifiedSpan>> GetAllClassificationsAsync(Document document, TextSpan span) 298var classificationsSpans = new HashSet<TextSpan>();
CodeLens\AbstractCodeLensTest.cs (4)
34foreach (var span in annotatedSpan.Value) 63foreach (var span in annotatedSpan.Value) 91foreach (var span in annotatedSpan.Value) 119foreach (var span in annotatedSpan.Value)
CommentSelection\AbstractToggleCommentTestBase.cs (2)
76MarkupTestFile.GetSpans(expectedText, out var actualExpectedText, out ImmutableArray<TextSpan> expectedSpans); 82AssertEx.Equal(expectedSpans, textView.Selection.SelectedSpans.Select(snapshotSpan => TextSpan.FromBounds(snapshotSpan.Start, snapshotSpan.End)));
CompleteStatement\AbstractCompleteStatementTests.cs (1)
93var selectedSpan = testDocument.SelectedSpans[0];
Diagnostics\DiagnosticProviderTestUtilities.cs (2)
18TextSpan span, 28TextSpan span,
Diagnostics\MockDiagnosticAnalyzerService.cs (2)
67public Task<ImmutableArray<DiagnosticData>> GetDiagnosticsForSpanAsync(TextDocument document, TextSpan? range, Func<string, bool>? shouldIncludeDiagnostic, bool includeCompilerDiagnostics, bool includeSuppressedDiagnostics = true, CodeActionRequestPriority priority = CodeActionRequestPriority.None, Func<string, IDisposable?>? addOperationScope = null, DiagnosticKind diagnosticKind = DiagnosticKind.All, CancellationToken cancellationToken = default) 76public Task<(ImmutableArray<DiagnosticData> diagnostics, bool upToDate)> TryGetDiagnosticsForSpanAsync(TextDocument document, TextSpan range, Func<string, bool>? shouldIncludeDiagnostic, bool includeSuppressedDiagnostics = false, CodeActionRequestPriority priority = CodeActionRequestPriority.None, DiagnosticKind diagnosticKind = DiagnosticKind.All, CancellationToken cancellationToken = default)
Diagnostics\TestDiagnosticAnalyzerDriver.cs (4)
52TextSpan? filterSpan, 87public Task<IEnumerable<Diagnostic>> GetAllDiagnosticsAsync(Document document, TextSpan? filterSpan) 95var span = (await document.GetSyntaxRootAsync()).FullSpan; 105public Task<IEnumerable<Diagnostic>> GetDocumentDiagnosticsAsync(Document document, TextSpan span)
DocumentationComments\AbstractDocumentationCommentTests.cs (1)
155var selectedSpan = testDocument.SelectedSpans[0];
EditAndContinue\ActiveStatementsDescription.cs (9)
219private static IEnumerable<(TextSpan Span, int[] Ids)> GetSpansRecursive(Regex regex, string contentGroupName, string markedSource, int offset) 227var span = markedSyntax.Length != 0 ? new TextSpan(absoluteOffset, markedSyntax.Length) : new TextSpan(); 237internal static IEnumerable<(TextSpan Span, int Id)> GetActiveSpans(string markedSource) 248internal static TextSpan[] GetTrackingSpans(string src, int count) 253return Array.Empty<TextSpan>(); 256var result = new TextSpan[count]; 272internal static ImmutableArray<ImmutableArray<TextSpan>> GetExceptionRegions(string markedSource) 277var result = new List<List<TextSpan>>(); 286result[activeStatementId] ??= new List<TextSpan>();
EditAndContinue\DeclaratorMapDescription.cs (7)
19public readonly ImmutableArray<ImmutableArray<TextSpan>> OldSpans; 20public readonly ImmutableArray<ImmutableArray<TextSpan>> NewSpans; 39internal static ImmutableArray<ImmutableArray<TextSpan>> GetSpans(string src) 42var result = new List<List<TextSpan>>(); 55result[id0] = new List<TextSpan>(); 65internal IEnumerable<KeyValuePair<TextSpan, TextSpan>> this[int i]
EditAndContinue\EditAndContinueTestHelpers.cs (3)
356public static SyntaxNode FindNode(SyntaxNode root, TextSpan span) 370IEnumerable<KeyValuePair<TextSpan, TextSpan>> expectedSyntaxMap,
EditAndContinue\SemanticEditDescription.cs (4)
22public readonly IEnumerable<KeyValuePair<TextSpan, TextSpan>>? SyntaxMap; 30IEnumerable<KeyValuePair<TextSpan, TextSpan>>? syntaxMap,
Formatting\CoreFormatterTestsBase.cs (4)
178private protected async Task AssertFormatAsync(string expected, string code, IEnumerable<TextSpan> spans, OptionsCollection options = null, int? baseIndentation = null) 214internal void AssertFormatWithTransformation(Workspace workspace, string expected, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule> rules, SyntaxNode root, IEnumerable<TextSpan> spans) 227internal void AssertFormat(Workspace workspace, string expected, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule> rules, ITextBuffer clonedBuffer, SyntaxNode root, IEnumerable<TextSpan> spans) 277TestFileMarkupParser.GetSpans(markupCode, out var code, out ImmutableArray<TextSpan> spans);
KeywordHighlighting\AbstractKeywordHighlighterTests.cs (6)
49var cursorSpan = testDocument.AnnotatedSpans["Cursor"].Single(); 62var highlightSpans = new List<TextSpan>(); 69private static void CheckSpans(SyntaxTree tree, IList<TextSpan> expectedHighlightSpans, List<TextSpan> highlightSpans) 86var expected = expectedHighlightSpans[j]; 87var actual = highlightSpans[j];
LanguageServer\AbstractLanguageServerProtocolTests.cs (3)
82public Task<ImmutableArray<MappedSpanResult>> MapSpansAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken) 168var textSpan = lines.GetTextSpan(new LinePositionSpan(startPosition, endPosition)); 436static LSP.Location ConvertTextSpanWithTextToLocation(TextSpan span, SourceText text, Uri documentUri)
NavigateTo\AbstractNavigateToTests.cs (2)
198out ImmutableArray<TextSpan> expectedDisplayNameSpans); 205Assert.Equal<TextSpan>(
RefactoringHelpers\RefactoringHelpersTestBase.cs (12)
35text = GetSelectionAndResultSpans(text, out var selection, out var result); 44text = GetSelectionSpan(text, out var selection); 53text = GetSelectionAndResultSpans(text, out var selection, out var result); 66text = GetSelectionSpan(text, out var selection); 72private static string GetSelectionSpan(string text, out TextSpan selection) 74MarkupTestFile.GetSpans(text.NormalizeLineEndings(), out text, out IDictionary<string, ImmutableArray<TextSpan>> spans); 86private static string GetSelectionAndResultSpans(string text, out TextSpan selection, out TextSpan result) 88MarkupTestFile.GetSpans(text.NormalizeLineEndings(), out text, out IDictionary<string, ImmutableArray<TextSpan>> spans); 103private async Task<TNode?> GetNodeForSelectionAsync<TNode>(string text, TextSpan selection, Func<TNode, bool> predicate, bool allowEmptyNodes = false) where TNode : SyntaxNode
SignatureHelp\AbstractSignatureHelpProviderTests.cs (7)
83TextSpan? textSpan = null; 88out ImmutableArray<TextSpan> textSpans); 359IList<TextSpan> textSpans = null; 367TextSpan? textSpan = null; 382TextSpan? textSpan, 476IList<TextSpan> textSpans = null; 484TextSpan? textSpan = null;
SpellCheck\AbstractSpellCheckSpanTests.cs (1)
41private static ImmutableArray<SpellCheckSpan> Flatten(IDictionary<string, ImmutableArray<TextSpan>> annotations)
Squiggles\TestDiagnosticTagProducer.cs (1)
58internal static DiagnosticData CreateDiagnosticData(TestHostDocument document, TextSpan span)
Structure\AbstractSyntaxStructureProviderTests.cs (3)
86IDictionary<string, ImmutableArray<TextSpan>> spans) 93var textSpan = spans[textSpanName][0]; 94var hintSpan = spans[hintSpanName][0];
TaskList\AbstractTaskListTests.cs (1)
52var span = expectedLists[i];
TypeInferrer\TypeInferrerTestBase.cs (2)
56MarkupTestFile.GetSpan(text.NormalizeLineEndings(), out text, out var textSpan); 68protected abstract Task TestWorkerAsync(Document document, TextSpan textSpan, string expectedType, TestMode mode);
Workspaces\TestFormattingRuleFactoryServiceFactory.cs (2)
35public TextSpan TextSpan = default; 54public IEnumerable<TextChange> FilterFormattedChanges(DocumentId document, TextSpan span, IList<TextChange> changes)
Workspaces\TestHostDocument.cs (6)
90public IList<TextSpan> SelectedSpans { get; } = new List<TextSpan>(); 91public IDictionary<string, ImmutableArray<TextSpan>> AnnotatedSpans { get; } = new Dictionary<string, ImmutableArray<TextSpan>>(); 117IDictionary<string, ImmutableArray<TextSpan>> spans, 243var span = this.SelectedSpans.Single();
Workspaces\TestWorkspace.cs (11)
482: ImmutableArray<TextSpan>.Empty; 483foreach (var span in document.SelectedSpans) 498: ImmutableArray<TextSpan>.Empty; 500foreach (var span in spans) 533out Dictionary<string, ImmutableArray<TextSpan>> mappedMarkupSpans, out int? mappedCaretLocation) 587var matchingSpan = documentWithSpan.AnnotatedSpans[spanName].Single(); 628IDictionary<string, ImmutableArray<TextSpan>> markupSpans, 629out Dictionary<string, ImmutableArray<TextSpan>> mappedMarkupSpans, 632var tempMappedMarkupSpans = new Dictionary<string, PooledObjects.ArrayBuilder<TextSpan>>(); 636tempMappedMarkupSpans[key] = PooledObjects.ArrayBuilder<TextSpan>.GetInstance(); 637foreach (var markupSpan in markupSpans[key])
Workspaces\TestWorkspace_XmlConsumption.cs (5)
226out var code, out var cursorPosition, out IDictionary<string, ImmutableArray<TextSpan>> spans); 351out var code, out var cursorPosition, out IDictionary<string, ImmutableArray<TextSpan>> spans); 796ImmutableDictionary<string, ImmutableArray<TextSpan>> spans; 822spans = ImmutableDictionary<string, ImmutableArray<TextSpan>>.Empty; 861out var code, out var cursorPosition, out IDictionary<string, ImmutableArray<TextSpan>> spans);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities2 (8)
Utilities\GoToHelpers\GoToTestHelpers.vb (2)
19Public ReadOnly Property Span As TextSpan 21Public Sub New(filePath As String, span As TextSpan)
Utilities\GoToHelpers\MockDocumentNavigationService.vb (3)
26Public _span As TextSpan = Nothing 38Public Function CanNavigateToSpanAsync(workspace As Workspace, documentId As DocumentId, textSpan As TextSpan, allowInvalidSpan As Boolean, cancellationToken As CancellationToken) As Task(Of Boolean) Implements IDocumentNavigationService.CanNavigateToSpanAsync 64Public Function GetLocationForSpanAsync(workspace As Workspace, documentId As DocumentId, textSpan As TextSpan, allowInvalidSpan As Boolean, cancellationToken As CancellationToken) As Task(Of INavigableLocation) Implements IDocumentNavigationService.GetLocationForSpanAsync
Utilities\MockDocumentNavigationServiceProvider.vb (3)
35Public ProvidedTextSpan As TextSpan 64Public Function CanNavigateToSpanAsync(workspace As Workspace, documentId As DocumentId, textSpan As TextSpan, allowInvalidSpan As Boolean, cancellationToken As CancellationToken) As Task(Of Boolean) Implements IDocumentNavigationService.CanNavigateToSpanAsync 87Public Function GetLocationForSpanAsync(workspace As Workspace, documentId As DocumentId, textSpan As TextSpan, allowInvalidSpans As Boolean, cancellationToken As CancellationToken) As Task(Of INavigableLocation) Implements IDocumentNavigationService.GetLocationForSpanAsync
Microsoft.CodeAnalysis.EditorFeatures.Text (14)
Extensions.SnapshotSourceText.cs (3)
158return TextLine.FromSpan(_text, TextSpan.FromBounds(line.Start, line.End)); 179public override string ToString(TextSpan textSpan) 314public override void Write(TextWriter textWriter, TextSpan span, CancellationToken cancellationToken)
Shared\Extensions\ITextSnapshotExtensions.cs (3)
32/// Convert a <see cref="LinePositionSpan"/> to <see cref="TextSpan"/>. 34public static TextSpan GetTextSpan(this ITextSnapshot snapshot, LinePositionSpan span) 36return TextSpan.FromBounds(
Shared\Extensions\TextSpanExtensions.cs (8)
13/// Convert a <see cref="TextSpan"/> instance to a <see cref="TextSpan"/>. 15public static Span ToSpan(this TextSpan textSpan) 19/// Add an offset to a <see cref="TextSpan"/>. 21public static TextSpan MoveTo(this TextSpan textSpan, int offset) 25/// Convert a <see cref="TextSpan"/> to a <see cref="SnapshotSpan"/> on the given <see cref="ITextSnapshot"/> instance 27public static SnapshotSpan ToSnapshotSpan(this TextSpan textSpan, ITextSnapshot snapshot)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (107)
CodeFixes\CodeFixServiceTests.cs (13)
66document, TextSpan.FromBounds(0, 0), CodeActionRequestPriority.None, CodeActionOptions.DefaultProvider, isBlocking: false, CancellationToken.None); 93_ = await tuple.codeFixService.GetFixesAsync(document, TextSpan.FromBounds(0, 0), CodeActionOptions.DefaultProvider, isBlocking: false, CancellationToken.None); 119var fixCollections = await tuple.codeFixService.GetFixesAsync(document, TextSpan.FromBounds(0, 0), CodeActionOptions.DefaultProvider, isBlocking: false, CancellationToken.None); 150_ = await tuple.codeFixService.GetFixesAsync(document, TextSpan.FromBounds(0, 0), 157_ = await tuple.codeFixService.GetFixesAsync(document, TextSpan.FromBounds(0, 0), 186_ = await tuple.codeFixService.GetFixesAsync(document, TextSpan.FromBounds(0, 0), 271var fixes = await tuple.codeFixService.GetFixesAsync(document, TextSpan.FromBounds(0, 0), CodeActionOptions.DefaultProvider, isBlocking: false, CancellationToken.None); 296document, TextSpan.FromBounds(0, 0), CodeActionRequestPriority.None, CodeActionOptions.DefaultProvider, isBlocking: false, CancellationToken.None); 508c.ReportDiagnostic(Diagnostic.Create(descriptor, c.Tree.GetLocation(TextSpan.FromBounds(0, 0)))); 715return await fixService.GetFixesAsync(document, TextSpan.FromBounds(0, 0), CodeActionOptions.DefaultProvider, isBlocking: false, CancellationToken.None); 816var txtDocumentCodeFixes = await tuple.codeFixService.GetFixesAsync(txtDocument, TextSpan.FromBounds(0, 1), CodeActionOptions.DefaultProvider, isBlocking: false, CancellationToken.None); 833var logDocumentCodeFixes = await tuple.codeFixService.GetFixesAsync(logDocument, TextSpan.FromBounds(0, 1), CodeActionOptions.DefaultProvider, isBlocking: false, CancellationToken.None); 858var span = new TextSpan(line.Start, line.End);
CodeGeneration\CodeGenerationTests.cs (6)
639var destSpan = new TextSpan(); 899var destSpan = Workspace.Documents.Single().SelectedSpans.Single(); 905var destSpan = Workspace.Documents.Single().SelectedSpans.Single(); 912foreach (var span in annotatedSpans) 918public static T GetSelectedSymbol<T>(TextSpan selection, SemanticModel semanticModel) 932var destSpan = Workspace.Documents.Single().SelectedSpans.Single();
CodeRefactorings\CodeRefactoringServiceTest.cs (7)
53var refactorings = await refactoringService.GetRefactoringsAsync(document, TextSpan.FromBounds(0, 0), CodeActionOptions.DefaultProvider, isBlocking: false, CancellationToken.None); 97var refactorings = await refactoringService.GetRefactoringsAsync(document, TextSpan.FromBounds(0, 0), optionsProvider, isBlocking, CancellationToken.None); 118var result = await refactoringService.GetRefactoringsAsync(document, TextSpan.FromBounds(0, 0), CodeActionOptions.DefaultProvider, isBlocking: false, CancellationToken.None); 181var txtRefactorings = await refactoringService.GetRefactoringsAsync(txtAdditionalDocument, TextSpan.FromBounds(0, 0), CodeActionOptions.DefaultProvider, isBlocking: false, CancellationToken.None); 196var logRefactorings = await refactoringService.GetRefactoringsAsync(logAdditionalDocument, TextSpan.FromBounds(0, 0), CodeActionOptions.DefaultProvider, isBlocking: false, CancellationToken.None); 220var editorConfigRefactorings = await refactoringService.GetRefactoringsAsync(editorConfig, TextSpan.FromBounds(0, 0), CodeActionOptions.DefaultProvider, isBlocking: false, CancellationToken.None); 235var globalConfigRefactorings = await refactoringService.GetRefactoringsAsync(globalConfig, TextSpan.FromBounds(0, 0), CodeActionOptions.DefaultProvider, isBlocking: false, CancellationToken.None);
CommentSelection\CommentUncommentSelectionCommandHandlerTests.cs (3)
87CommentSelection(code, new[] { new TextChange(TextSpan.FromBounds(0, 0), "//") }, supportBlockComments: true); 127CommentSelection(code, new[] { new TextChange(TextSpan.FromBounds(0, 0), "//") }, supportBlockComments: false); 423CommentSelection(code, new[] { new TextChange(TextSpan.FromBounds(0, 0), "//") }, new[] { new Span(0, 15) }, supportBlockComments: true);
Completion\CompletionServiceTests.cs (3)
130private static async Task<TextSpan> GetTextChangeSpanAsync(Document document, TextSpan startSpan, CancellationToken cancellationToken) 132var result = startSpan;
Diagnostics\DiagnosticAnalyzerServiceTests.cs (3)
635var diagnosticSpan = new TextSpan(2, 2); 730public AdditionalFileAnalyzer2(bool registerFromInitialize, TextSpan diagnosticSpan, string id) 1300=> Task.FromResult(ImmutableArray.Create(Diagnostic.Create(s_syntaxRule, Location.Create(document.FilePath, TextSpan.FromBounds(0, 0), new LinePositionSpan(new LinePosition(0, 0), new LinePosition(0, 0))))));
Diagnostics\DiagnosticDataTests.cs (2)
112private static async Task VerifyTextSpanAsync(string code, int startLine, int startColumn, int endLine, int endColumn, TextSpan span) 132var actual = data.DataLocation.UnmappedFileSpan.GetClampedTextSpan(text);
Diagnostics\DiagnosticsSquiggleTaggerProviderTests.cs (4)
157var span = TextSpan.FromBounds(0, 5); 196var span = TextSpan.FromBounds(0, 5);
Diagnostics\SuppressMessageAttributeWorkspaceTests.cs (1)
71var span = (await document.GetSyntaxRootAsync()).FullSpan;
EditAndContinue\ActiveStatementsMapTests.cs (9)
49var span = TextSpan.FromBounds(8, 11); 52TextSpan.FromBounds(1, 6), // does not overlap 53TextSpan.FromBounds(3, 9), // overlaps 54TextSpan.FromBounds(4, 5), // does not overlap 55TextSpan.FromBounds(6, 7), // does not overlap 56TextSpan.FromBounds(7, 9), // overlaps 57TextSpan.FromBounds(10, 12), // overlaps 58TextSpan.FromBounds(13, 15)); // does not overlap
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (10)
372private static TextSpan GetSpan(string str, string substr) 2598var activeSpan1 = GetSpan(source1, "System.Console.WriteLine(1);"); 3542var activeSpan11 = GetSpan(sourceV1, "G(1);"); 3543var activeSpan12 = GetSpan(sourceV1, "System.Console.WriteLine(1)"); 3544var activeSpan21 = GetSpan(sourceV2, "G(2); G(1);"); 3545var activeSpan22 = GetSpan(sourceV2, "System.Console.WriteLine(2)"); 3546var adjustedActiveSpan1 = GetSpan(sourceV2, "G(2);"); 3547var adjustedActiveSpan2 = GetSpan(sourceV2, "System.Console.WriteLine(2)"); 3639var activeSpan11 = GetSpan(sourceV1, "G(1)"); 3640var activeSpan12 = GetSpan(sourceV1, "System.Console.WriteLine(1)");
EditAndContinue\EmitSolutionUpdateResultsTests.cs (2)
90(document.Id, ImmutableArray.Create(new RudeEditDiagnostic(RudeEditKind.Insert, TextSpan.FromBounds(1, 10), 123, new[] { "a" }))), 91(document.Id, ImmutableArray.Create(new RudeEditDiagnostic(RudeEditKind.Delete, TextSpan.FromBounds(1, 10), 123, new[] { "b" }))));
EditAndContinue\RemoteEditAndContinueServiceTests.cs (3)
140var diagnostic = Diagnostic.Create(diagnosticDescriptor, Location.Create(syntaxTree, TextSpan.FromBounds(1, 1))); 220var documentDiagnostic = Diagnostic.Create(diagnosticDescriptor1, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2)), new[] { "doc", "some error" }); 222var syntaxError = Diagnostic.Create(diagnosticDescriptor1, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2)), new[] { "doc", "syntax error" });
EditAndContinue\RudeEditDiagnosticTests.cs (4)
87var re = new RudeEditDiagnostic(kind, TextSpan.FromBounds(1, 2)); 93var re = new RudeEditDiagnostic(kind, TextSpan.FromBounds(1, 2), syntaxNode, new[] { "<1>", "<2>" }); 101var re = new RudeEditDiagnostic(kind, TextSpan.FromBounds(1, 2), syntaxNode, new[] { "<1>", "<2>", "<3>" }); 110var re = new RudeEditDiagnostic(kind, TextSpan.FromBounds(1, 2), syntaxNode, new[] { "<1>" });
EditorAdapter\SpanExtensionsTest.cs (1)
24var textSpan = span.ToTextSpan();
EditorAdapter\TextSpanExtensionsTest.cs (3)
24var textSpan = new TextSpan(start, length); 39var textSpan = new TextSpan(0, 5); 51var textSpan = new TextSpan(0, 10);
InheritanceMargin\InheritanceMarginTests.cs (1)
100var searchingSpan = root.Span;
MetadataAsSource\AbstractMetadataAsSourceTests.TestContext.cs (2)
146var actualSpan = file.IdentifierLocation.SourceSpan; 150MarkupTestFile.GetSpan(expected, out expected, out var expectedSpan);
RenameTracking\RenameTrackingTaggerProviderTests.cs (5)
358var textSpan = state.HostDocument.SelectedSpans.Single(); 371var textSpan = state.HostDocument.SelectedSpans.Single(); 384var textSpan = state.HostDocument.SelectedSpans.Single(); 403var textSpan = state.HostDocument.SelectedSpans.Single(); 809var textSpan = state.HostDocument.SelectedSpans.Single();
RenameTracking\RenameTrackingTestState.cs (2)
170public async Task<CodeAction> TryGetCodeActionAsync(TextSpan? textSpan = null) 172var span = textSpan ?? new TextSpan(_view.Caret.Position.BufferPosition, 0);
Snippets\RoslynLSPSnippetConvertTests.cs (3)
493MarkupTestFile.GetPositionAndSpans(markup, out var text, out var cursorPosition, out IDictionary<string, ImmutableArray<TextSpan>> placeholderDictionary); 494var stringSpan = placeholderDictionary[""].First(); 504private static ImmutableArray<SnippetPlaceholder> GetSnippetPlaceholders(string text, IDictionary<string, ImmutableArray<TextSpan>> placeholderDictionary)
StackTraceExplorer\StackTraceExplorerTests.cs (1)
47var selectedSpan = cursorDoc.SelectedSpans.Single();
Structure\BlockSpanTests.cs (10)
18var span = TextSpan.FromBounds(0, 1); 19var hintSpan = TextSpan.FromBounds(2, 3); 36var span = TextSpan.FromBounds(0, 1); 37var hintSpan = TextSpan.FromBounds(2, 3); 51var span = TextSpan.FromBounds(0, 1);
Utilities\PatternMatcherTests.cs (8)
417private static ImmutableArray<string> PartListToSubstrings(string identifier, in TemporaryArray<TextSpan> parts) 420foreach (var span in parts) 428using var parts = TemporaryArray<TextSpan>.Empty; 435using var parts = TemporaryArray<TextSpan>.Empty; 442MarkupTestFile.GetSpans(candidate, out candidate, out ImmutableArray<TextSpan> spans); 453Assert.Equal<TextSpan>(match.Value.MatchedSpans, spans); 461MarkupTestFile.GetSpans(candidate, out candidate, out ImmutableArray<TextSpan> expectedSpans); 473var flattened = new List<TextSpan>();
ValueTracking\AbstractBaseValueTrackingTests.cs (1)
31var textSpan = new TextSpan(cursorDocument.CursorPosition!.Value, 0);
Microsoft.CodeAnalysis.EditorFeatures.Wpf (18)
InlineRename\UI\Adornment\RenameFlyoutViewModel.cs (2)
37public RenameFlyoutViewModel(InlineRenameSession session, TextSpan selectionSpan, bool registerOleComponent, IGlobalOptionService globalOptionService) 192public TextSpan StartingSelection { get; }
InlineRename\UI\InlineRenameAdornmentManager.cs (1)
130var identifierSelection = new TextSpan(start, length);
Interactive\InteractiveDocumentNavigationService.cs (2)
28public Task<bool> CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) 37public async Task<INavigableLocation?> GetLocationForSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken)
LineSeparators\LineSeparatorTaggerProvider.cs (1)
114foreach (var span in lineSeparatorSpans)
NavigateTo\NavigateToItemDisplay.cs (1)
67var span = NavigateToUtilities.GetBoundedSpan(_searchResult.NavigableItem, sourceText);
Preview\PreviewStaticClassificationTaggerProvider.cs (1)
75var requestSpan = span.Span.ToTextSpan();
SignatureHelp\Controller.Session_ComputeModel.cs (1)
224private static bool IsBetter(SignatureHelpItems bestItems, TextSpan? currentTextSpan)
SignatureHelp\Model.cs (2)
20public TextSpan TextSpan { get; } 34TextSpan textSpan,
Suggestions\AsyncSuggestedActionsSource.cs (1)
170TextSpan? selection,
Suggestions\SuggestedActionsSource.cs (6)
198TextSpan? selection, 306TextSpan? selection, 352private async Task<TextSpan?> GetSpanAsync(ReferenceCountedDisposable<State> state, SnapshotSpan range, CancellationToken cancellationToken) 393TextSpan? selection = null; 457TextSpan? selection, 486protected TextSpan? TryGetCodeRefactoringSelection(ReferenceCountedDisposable<State> state, SnapshotSpan range)
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (38)
Classification\ClassificationTests.vb (5)
345Public Sub AddLexicalClassifications(text As SourceText, textSpan As TextSpan, result As ArrayBuilder(Of ClassifiedSpan), cancellationToken As CancellationToken) Implements IClassificationService.AddLexicalClassifications 348Public Sub AddSyntacticClassifications(services As SolutionServices, root As SyntaxNode, textSpan As TextSpan, result As ArrayBuilder(Of ClassifiedSpan), cancellationToken As CancellationToken) Implements IClassificationService.AddSyntacticClassifications 351Public Function AddSemanticClassificationsAsync(document As Document, textSpan As TextSpan, options As ClassificationOptions, result As ArrayBuilder(Of ClassifiedSpan), cancellationToken As CancellationToken) As Task Implements IClassificationService.AddSemanticClassificationsAsync 355Public Function AddSyntacticClassificationsAsync(document As Document, textSpan As TextSpan, result As ArrayBuilder(Of ClassifiedSpan), cancellationToken As CancellationToken) As Task Implements IClassificationService.AddSyntacticClassificationsAsync 370Public Function AddEmbeddedLanguageClassificationsAsync(document As Document, textSpan As TextSpan, options As ClassificationOptions, result As ArrayBuilder(Of ClassifiedSpan), cancellationToken As CancellationToken) As Task Implements IClassificationService.AddEmbeddedLanguageClassificationsAsync
CodeDefinitionWindow\CrossLanguageCodeDefinitionWindowTests.vb (1)
67Public ReadOnly Property SourceSpan As TextSpan Implements INavigableItem.SourceSpan
Diagnostics\DiagnosticServiceTests.vb (1)
944Dim documentDiagnostics = Await DiagnosticProviderTestUtilities.GetDocumentDiagnosticsAsync(workspace, document, TextSpan.FromBounds(0, 0))
FindReferences\FindReferencesTests.vb (10)
198Public ReadOnly Spans As List(Of TextSpan) 200Public Sub New(fileName As String, spans As List(Of TextSpan)) 316Dim expected = If(doc.AnnotatedSpans.ContainsKey(DefinitionKey), doc.AnnotatedSpans(DefinitionKey), ImmutableArray(Of TextSpan).Empty).Order() 409Optional locationFilterOpt As Func(Of ReferenceLocation, Boolean) = Nothing) As Dictionary(Of String, List(Of TextSpan)) 425Private Shared Function PrintSpans(expected As IOrderedEnumerable(Of TextSpan), actual As IOrderedEnumerable(Of TextSpan), doc As Document, prefix As String, suffix As String, Optional messageOnly As Boolean = False) As String 455Private Shared Function TextSpansMatch(expected As IOrderedEnumerable(Of TextSpan), actual As IOrderedEnumerable(Of TextSpan)) As Boolean 459Dim enumeratorExpected As IEnumerator(Of TextSpan) = Nothing 460Dim enumeratorActual As IEnumerator(Of TextSpan) = Nothing
IntelliSense\CompletionRulesTests.vb (1)
63Dim wordMatchSpan As TextSpan = Nothing
IntelliSense\SignatureHelpControllerTests.vb (6)
91.Returns(Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 0), selectedItem:=0, argumentIndex:=0, argumentCount:=0, argumentName:=Nothing))) 119Return Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 0), selectedItem:=0, argumentIndex:=0, argumentCount:=0, argumentName:=Nothing)) 139Return Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 0), selectedItem:=0, argumentIndex:=0, argumentCount:=0, argumentName:=Nothing)) 161.Returns(Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 0), selectedItem:=0, argumentIndex:=0, argumentCount:=0, argumentName:=Nothing))) 172Return Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 2), selectedItem:=0, argumentIndex:=0, argumentCount:=0, argumentName:=Nothing)) 360New SignatureHelpItems(_items, TextSpan.FromBounds(position, position), selectedItem:=0, argumentIndex:=0, argumentCount:=0, argumentName:=Nothing),
NavigableSymbols\NavigableSymbolsTest.vb (7)
39Dim spans As IDictionary(Of String, ImmutableArray(Of TextSpan)) = Nothing 53Dim spans As IDictionary(Of String, ImmutableArray(Of TextSpan)) = Nothing 67Dim spans As IDictionary(Of String, ImmutableArray(Of TextSpan)) = Nothing 83Dim spans As IDictionary(Of String, ImmutableArray(Of TextSpan)) = Nothing 96Dim spans As IDictionary(Of String, ImmutableArray(Of TextSpan)) = Nothing 109Dim spans As IDictionary(Of String, ImmutableArray(Of TextSpan)) = Nothing 128Private Shared Async Function TestNavigated(workspace As TestWorkspace, position As Integer, spans As IDictionary(Of String, ImmutableArray(Of TextSpan))) As Task
PasteTracking\PasteTrackingTestState.vb (4)
60Public Function SendPaste(hostDocument As TestHostDocument, pastedText As String) As TextSpan 82Public Async Function AssertHasPastedTextSpanAsync(hostDocument As TestHostDocument, Optional textSpan As TextSpan = Nothing) As Task 86Dim pastedTextSpan As TextSpan 97Dim textSpan As TextSpan
Rename\RenameTestHelpers.vb (1)
30Private Function GetSessionInfo(workspace As TestWorkspace) As (document As Document, textSpan As TextSpan)
Simplification\AbstractSimplificationTests.vb (2)
66listOfLabelToAddSimplifierAnnotationSpans As IEnumerable(Of KeyValuePair(Of String, ImmutableArray(Of TextSpan))), 67explicitSpansToSimplifyWithin As ImmutableArray(Of TextSpan),
Microsoft.CodeAnalysis.ExternalAccess.AspNetCore (7)
EmbeddedLanguages\AspNetCoreVirtualChar.cs (1)
35public TextSpan Span => VirtualChar.Span;
EmbeddedLanguages\AspNetCoreVirtualCharSequence.cs (1)
37public AspNetCoreVirtualCharSequence GetSubSequence(TextSpan span) => new(_virtualCharSequence.GetSubSequence(span));
EmbeddedLanguages\BraceMatching\AspNetCoreBraceMatchingResult.cs (2)
13TextSpan LeftSpan, 14TextSpan RightSpan)
EmbeddedLanguages\Classification\AspNetCoreEmbeddedLanguageClassificationContext.cs (1)
30public void AddClassification(string classificationType, TextSpan span)
EmbeddedLanguages\DocumentHighlighting\IEmbeddedLanguageDocumentHighlighter.cs (2)
36public TextSpan TextSpan { get; } 41public AspNetCoreHighlightSpan(TextSpan textSpan, AspNetCoreHighlightSpanKind kind) : this()
Microsoft.CodeAnalysis.ExternalAccess.FSharp (75)
Classification\IFSharpClassificationService.cs (3)
28void AddLexicalClassifications(SourceText text, TextSpan textSpan, List<ClassifiedSpan> result, CancellationToken cancellationToken); 36Task AddSyntacticClassificationsAsync(Document document, TextSpan textSpan, List<ClassifiedSpan> result, CancellationToken cancellationToken); 44Task AddSemanticClassificationsAsync(Document document, TextSpan textSpan, List<ClassifiedSpan> result, CancellationToken cancellationToken);
DocumentHighlighting\IFSharpDocumentHighlightsService.cs (2)
24public TextSpan TextSpan { get; } 27public FSharpHighlightSpan(TextSpan textSpan, FSharpHighlightSpanKind kind) : this()
Editor\FSharpNavigationBarItem.cs (2)
23public IList<TextSpan> Spans { get; internal set; } 29IList<TextSpan> spans,
Editor\IFSharpBraceMatcher.cs (4)
15public TextSpan LeftSpan { get; } 16public TextSpan RightSpan { get; } 18public FSharpBraceMatchingResult(TextSpan leftSpan, TextSpan rightSpan)
Editor\IFSharpEditorFormattingService.cs (2)
30Task<IList<TextChange>> GetFormattingChangesAsync(Document document, TextSpan? textSpan, CancellationToken cancellationToken); 35Task<IList<TextChange>> GetFormattingChangesOnPasteAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken);
Editor\IFSharpEditorInlineRenameService.cs (3)
77TextSpan TriggerSpan { get; } 116TextSpan GetReferenceEditSpan(FSharpInlineRenameLocation location, CancellationToken cancellationToken); 122TextSpan? GetConflictEditSpan(FSharpInlineRenameLocation location, string replacementText, CancellationToken cancellationToken);
Editor\Implementation\Debugging\FSharpBreakpointResolutionResult.cs (2)
19public TextSpan TextSpan => UnderlyingObject.TextSpan; 23public static FSharpBreakpointResolutionResult CreateSpanResult(Document document, TextSpan textSpan, string? locationNameOpt = null)
Editor\Implementation\Debugging\FSharpDebugDataTipInfo.cs (2)
14public FSharpDebugDataTipInfo(TextSpan span, string text) 17public readonly TextSpan Span => UnderlyingObject.Span;
Editor\Implementation\Debugging\IFSharpBreakpointResolutionService.cs (1)
14Task<FSharpBreakpointResolutionResult?> ResolveBreakpointAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken = default);
Editor\InlineRename\FSharpInlineRenameInfo.cs (5)
29public abstract TextSpan TriggerSpan { get; } 32public abstract TextSpan? GetConflictEditSpan(FSharpInlineRenameLocation location, string replacementText, CancellationToken cancellationToken); 34public abstract TextSpan GetReferenceEditSpan(FSharpInlineRenameLocation location, CancellationToken cancellationToken); 51TextSpan? IInlineRenameInfo.GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken) 54TextSpan IInlineRenameInfo.GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken)
Editor\InlineRename\FSharpInlineRenameLocation.cs (2)
14public TextSpan TextSpan { get; } 16public FSharpInlineRenameLocation(Document document, TextSpan textSpan)
Editor\InlineRename\FSharpInlineRenameReplacement.cs (4)
14public TextSpan OriginalSpan { get; } 15public TextSpan NewSpan { get; } 17public FSharpInlineRenameReplacement(FSharpInlineRenameReplacementKind kind, TextSpan originalSpan, TextSpan newSpan)
FSharpDocumentSpan.cs (4)
15/// Represents a <see cref="TextSpan"/> location in a <see cref="Document"/>. 20public TextSpan SourceSpan { get; } 27public FSharpDocumentSpan(Document document, TextSpan sourceSpan) 34TextSpan sourceSpan,
InlineHints\FSharpInlineHint.cs (2)
18public readonly TextSpan Span; 23TextSpan span,
InlineHints\IFSharpInlineHintsService.cs (1)
17Task<ImmutableArray<FSharpInlineHint>> GetInlineHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken);
Internal\Classification\FSharpClassificationService.cs (5)
33public void AddLexicalClassifications(SourceText text, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken) 40public async Task AddSemanticClassificationsAsync(Document document, TextSpan textSpan, ClassificationOptions options, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken) 47public async Task AddSyntacticClassificationsAsync(Document document, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken) 59public void AddSyntacticClassifications(SolutionServices services, SyntaxNode root, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken) 76public Task AddEmbeddedLanguageClassificationsAsync(Document document, TextSpan textSpan, ClassificationOptions options, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken)
Internal\Editor\FSharpEditorFormattingService.cs (4)
44public Task<IList<TextChange>> GetFormattingChangesAsync(Document document, TextSpan? textSpan, CancellationToken cancellationToken) 54public Task<IList<TextChange>> GetFormattingChangesOnPasteAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) 79async Task<ImmutableArray<TextChange>> IFormattingInteractionService.GetFormattingChangesAsync(Document document, ITextBuffer textBuffer, TextSpan? textSpan, CancellationToken cancellationToken) 91async Task<ImmutableArray<TextChange>> IFormattingInteractionService.GetFormattingChangesOnPasteAsync(Document document, ITextBuffer textBuffer, TextSpan textSpan, CancellationToken cancellationToken)
Internal\Editor\FSharpEditorInlineRenameService.cs (3)
128public TextSpan TriggerSpan => _info.TriggerSpan; 156public TextSpan? GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken) 166public TextSpan GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken)
Internal\Editor\FSharpNavigationBarItemService.cs (1)
68var span = item.GetCurrentItemSpan(textVersion, item.Spans.First());
Internal\Editor\Implementation\Debugging\FSharpBreakpointResolutionService.cs (1)
31public async Task<BreakpointResolutionResult?> ResolveBreakpointAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken = default)
Internal\InlineHints\FSharpInlineHintsService.cs (1)
30public async Task<ImmutableArray<InlineHint>> GetInlineHintsAsync(Document document, TextSpan textSpan, InlineHintsOptions options, CancellationToken cancellationToken)
Internal\NavigateTo\InternalFSharpNavigateToSearchResult.cs (2)
36public ImmutableArray<TextSpan> NameMatchSpans => ImmutableArray<TextSpan>.Empty;
Internal\Navigation\InternalFSharpNavigableItem.cs (1)
34public TextSpan SourceSpan { get; }
Navigation\FSharpDocumentNavigationService.cs (4)
32public bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan) 35public bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) 65public bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, OptionSet options) 68public bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken)
Navigation\FSharpNavigableItem.cs (2)
14public FSharpNavigableItem(FSharpGlyph glyph, ImmutableArray<TaggedText> displayTaggedParts, Document document, TextSpan sourceSpan) 28public TextSpan SourceSpan { get; }
Navigation\IFSharpDocumentNavigationService.cs (4)
19bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan); 26bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, OptionSet options = null); 34bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken); 41bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken);
SignatureHelp\FSharpSignatureHelpItems.cs (2)
28public TextSpan ApplicableSpan { get; } 61TextSpan applicableSpan,
Structure\FSharpBlockSpan.cs (5)
23public TextSpan TextSpan { get; } 28public TextSpan HintSpan { get; } 50string type, bool isCollapsible, TextSpan textSpan, string bannerText = Ellipses, bool autoCollapse = false, bool isDefaultCollapsed = false) 58string type, bool isCollapsible, TextSpan textSpan, TextSpan hintSpan, string bannerText = Ellipses, bool autoCollapse = false, bool isDefaultCollapsed = false)
TaskList\FSharpTaskListItem.cs (1)
9internal readonly record struct FSharpTaskListItem(FSharpTaskListDescriptor TaskDescriptor, string Message, Document Document, TextSpan Span);
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (18)
CodeActions\OmniSharpCodeFixContextFactory.cs (4)
20TextSpan span, 29TextSpan span, 30Action<CodeAction, TextSpan?> registerRefactoring, 37TextSpan? diagnosticSpan,
DocumentationComments\OmniSharpDocumentationCommentSnippet.cs (2)
14public TextSpan SpanToReplace { get; } 26internal OmniSharpDocumentationCommentSnippet(TextSpan spanToReplace, string snippetText, int caretOffset)
Formatting\OmniSharpFormatter.cs (1)
17public static Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, OmniSharpSyntaxFormattingOptionsWrapper options, CancellationToken cancellationToken)
InlineHints\OmniSharpInlineHintsService.cs (3)
17public static async Task<ImmutableArray<OmniSharpInlineHint>> GetInlineHintsAsync(Document document, TextSpan textSpan, OmniSharpInlineHintsOptions options, CancellationToken cancellationToken) 36TextSpan span, 47public readonly TextSpan Span { get; }
NavigateTo\OmniSharpNavigateToSearchResult.cs (1)
20ImmutableArray<TextSpan> NameMatchSpans,
Navigation\OmniSharpNavigableItem.cs (2)
12public OmniSharpNavigableItem(ImmutableArray<TaggedText> displayTaggedParts, Document document, TextSpan sourceSpan) 23public TextSpan SourceSpan { get; }
Structure\OmniSharpBlockSpan.cs (5)
21public TextSpan TextSpan { get; } 26public TextSpan HintSpan { get; } 48string type, bool isCollapsible, TextSpan textSpan, string bannerText = Ellipses, bool autoCollapse = false, bool isDefaultCollapsed = false) 56string type, bool isCollapsible, TextSpan textSpan, TextSpan hintSpan, string bannerText = Ellipses, bool autoCollapse = false, bool isDefaultCollapsed = false)
Microsoft.CodeAnalysis.ExternalAccess.Razor (13)
IRazorDocumentExcerptService.cs (1)
14Task<RazorExcerptResult?> TryExcerptAsync(Document document, TextSpan span, RazorExcerptMode mode, RazorClassificationOptionsWrapper options, CancellationToken cancellationToken);
IRazorSpanMappingService.cs (1)
15Task<ImmutableArray<RazorMappedSpanResult>> MapSpansAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken);
RazorBreakpointSpans.cs (1)
13public static bool TryGetBreakpointSpan(SyntaxTree tree, int position, CancellationToken cancellationToken, out TextSpan breakpointSpan)
RazorClassifierAccessor.cs (1)
16public static async Task<IEnumerable<ClassifiedSpan>> GetClassifiedSpansAsync(Document document, TextSpan textSpan, RazorClassificationOptionsWrapper options, CancellationToken cancellationToken)
RazorCSharpFormattingInteractionService.cs (1)
63TextSpan span,
RazorDocumentExcerptServiceWrapper.cs (1)
21public async Task<ExcerptResult?> TryExcerptAsync(Document document, TextSpan span, ExcerptMode mode, ClassificationOptions classificationOptions, CancellationToken cancellationToken)
RazorExcerptResult.cs (4)
15public readonly TextSpan MappedSpan; 21public readonly TextSpan Span; 23public RazorExcerptResult(SourceText content, TextSpan mappedSpan, ImmutableArray<ClassifiedSpan> classifiedSpans, Document document, TextSpan span)
RazorMappedSpanResult.cs (2)
16public readonly TextSpan Span; 18public RazorMappedSpanResult(string filePath, LinePositionSpan linePositionSpan, TextSpan span)
RazorSpanMappingServiceWrapper.cs (1)
49IEnumerable<TextSpan> spans,
Microsoft.CodeAnalysis.Features (680)
AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
56var span = diagnostic.Location.SourceSpan;
AbstractConflictMarkerCodeFixProvider.cs (8)
320edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 324edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, bottomEnd), "")); 333edits.Add(new TextChange(TextSpan.FromBounds(startPos, equalsEnd), "")); 337edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), "")); 346edits.Add(new TextChange(TextSpan.FromBounds(startPos, startEnd), "")); 352edits.Add(new TextChange(TextSpan.FromBounds(secondMiddlePos, equalsEnd), "")); 358edits.Add(new TextChange(TextSpan.FromBounds(firstMiddlePos, equalsEnd), "")); 363edits.Add(new TextChange(TextSpan.FromBounds(endPos, bottomEnd), ""));
AbstractConvertToAsyncCodeFixProvider.cs (1)
48private static bool TryGetNode(SyntaxNode root, TextSpan span, out SyntaxNode node)
AbstractIteratorCodeFixProvider.cs (1)
44protected virtual bool TryGetNode(SyntaxNode root, TextSpan span, out SyntaxNode node)
AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
48var diagnosticSpan = diagnostic.Location.SourceSpan;
AbstractOrderModifiersDiagnosticAnalyzer.cs (1)
74TextSpan.FromBounds(modifiers.First().SpanStart, modifiers.Last().Span.End))));
AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
49private static TXmlElementSyntax? GetParamNode(SyntaxNode root, TextSpan span)
AbstractRemoveUnnecessaryCastDiagnosticAnalyzer.cs (1)
31protected abstract TextSpan GetFadeSpan(TCastExpression node);
AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (10)
90private IEnumerable<TextSpan> GetContiguousSpans(ImmutableArray<SyntaxNode> nodes) 93(SyntaxNode node, TextSpan textSpan)? previous = null; 98TextSpan textSpan; 102textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 110textSpan = TextSpan.FromBounds(previous.Value.textSpan.Start, nodeEnd); 116textSpan = TextSpan.FromBounds(node.Span.Start, nodeEnd); 143IEnumerable<TextSpan> contiguousSpans, SyntaxTree tree, 146foreach (var span in contiguousSpans) 157protected abstract IEnumerable<TextSpan> GetFixableDiagnosticSpans( 165foreach (var span in spans)
AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
136return Location.Create(parenthesizedExpression.SyntaxTree, TextSpan.FromBounds(parenthesizedExpressionLocation.SourceSpan.Start, textSpanEndPosition));
AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (3)
84TextSpan? span, 225TextSpan? span, 732TextSpan? span,
AbstractSimplifyInterpolationHelpers.cs (5)
37var unnecessarySpans = new List<TextSpan>(); 77out string? formatString, List<TextSpan> unnecessarySpans) 183private static TextSpan GetSpanWithinLiteralQuotes(IVirtualCharService virtualCharService, SyntaxToken formatToken) 188: TextSpan.FromBounds(sequence.First().Span.Start, sequence.Last().Span.End); 193out TExpressionSyntax? alignment, out bool negate, List<TextSpan> unnecessarySpans)
AbstractUseCollectionInitializerDiagnosticAnalyzer.cs (2)
149syntaxTree.GetLocation(TextSpan.FromBounds(match.SpanStart, arguments[0].SpanStart)), 150syntaxTree.GetLocation(TextSpan.FromBounds(arguments.Last().FullSpan.End, match.Span.End)));
AbstractUseObjectInitializerDiagnosticAnalyzer.cs (2)
135var location1 = Location.Create(syntaxTree, TextSpan.FromBounds( 146syntaxTree.GetLocation(TextSpan.FromBounds(match.Initializer.FullSpan.End, match.Statement.Span.End)))));
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.cs (2)
58Document document, TextSpan textSpan, CodeGenerationOptionsProvider fallbackOptions, CancellationToken cancellationToken) 166Document priorDocument, TextSpan priorSelection, Document currentDocument, IntentDataProvider intentDataProvider, CancellationToken cancellationToken)
AddFileBanner\AbstractAddFileBannerCodeRefactoringProvider.cs (1)
193ImmutableArray<TextSpan> fixAllSpans,
AddImport\AbstractAddImportCodeFixProvider.cs (1)
52var span = context.Span;
AddImport\AbstractAddImportFeatureService.cs (5)
58Document document, TextSpan span, string diagnosticId, int maxResults, 82Document document, TextSpan span, string diagnosticId, int maxResults, 486Document document, TextSpan span, ImmutableArray<Diagnostic> diagnostics, int maxResultsPerDiagnostic, 509Document document, TextSpan span, ImmutableArray<string> diagnosticIds, 534TextSpan span,
AddImport\IAddImportFeatureService.cs (4)
31Document document, TextSpan span, string diagnosticId, int maxResults, 40Document document, TextSpan span, ImmutableArray<Diagnostic> diagnostics, int maxResultsPerDiagnostic, 54/// Similar to <see cref="GetFixesAsync(Document, TextSpan, string, int, ISymbolSearchService, AddImportOptions, ImmutableArray{PackageSource}, CancellationToken)"/> 58Document document, TextSpan span, ImmutableArray<string> diagnosticIds,
AddImport\Remote\IRemoteMissingImportDiscoveryService.cs (2)
27Checksum solutionChecksum, RemoteServiceCallbackId callbackId, DocumentId documentId, TextSpan span, string diagnosticId, int maxResults, 31Checksum solutionChecksum, RemoteServiceCallbackId callbackId, DocumentId id, TextSpan span, ImmutableArray<string> diagnosticIds,
BraceCompletion\AbstractBraceCompletionService.cs (1)
64var braceTextEdit = new TextChange(TextSpan.FromBounds(closingPoint, closingPoint), ClosingBrace.ToString());
BraceMatching\AbstractDirectiveTriviaBraceMatcher.cs (1)
28internal abstract TextSpan GetSpanForTagging(TDirectiveTriviaSyntax directive);
BraceMatching\IBraceMatchingService.cs (2)
19[property: DataMember(Order = 0)] TextSpan LeftSpan, 20[property: DataMember(Order = 1)] TextSpan RightSpan);
BraceMatching\IBraceMatchingServiceExtensions.cs (1)
13public static async Task<TextSpan?> FindMatchingSpanAsync(
BracePairs\IBracePairsService.cs (4)
16TextSpan Start, 17TextSpan End); 21Task AddBracePairsAsync(Document document, TextSpan textSpan, ArrayBuilder<BracePairData> bracePairs, CancellationToken cancellationToken); 46Document document, TextSpan span, ArrayBuilder<BracePairData> bracePairs, CancellationToken cancellationToken)
ChangeSignature\AbstractChangeSignatureService.cs (1)
91public async Task<ImmutableArray<ChangeSignatureCodeAction>> GetChangeSignatureCodeActionAsync(Document document, TextSpan span, CodeCleanupOptionsProvider fallbackOptions, CancellationToken cancellationToken)
ClassifiedSpansAndHighlightSpan.cs (2)
17public readonly TextSpan HighlightSpan; 21TextSpan highlightSpan)
ClassifiedSpansAndHighlightSpanFactory.cs (14)
19Document document, TextSpan sourceSpan, ClassificationOptions options, CancellationToken cancellationToken) 47Document document, TextSpan sourceSpan, ClassificationOptions options, CancellationToken cancellationToken) 51var narrowSpan = sourceSpan; 52var lineSpan = GetLineSpanForReference(sourceText, narrowSpan); 59private static TextSpan GetLineSpanForReference(SourceText sourceText, TextSpan referenceSpan) 68return TextSpan.FromBounds(Math.Min(firstNonWhitespacePosition, referenceSpan.Start), sourceLine.End); 72Document document, TextSpan narrowSpan, TextSpan widenedSpan, ClassificationOptions options, CancellationToken cancellationToken) 74var highlightSpan = new TextSpan( 84Document document, TextSpan narrowSpan, TextSpan widenedSpan, ClassificationOptions options, CancellationToken cancellationToken) 97new ClassifiedSpan(ClassificationTypeNames.Text, TextSpan.FromBounds(widenedSpan.Start, narrowSpan.Start)), 99new ClassifiedSpan(ClassificationTypeNames.Text, TextSpan.FromBounds(narrowSpan.End, widenedSpan.End)));
CodeFixes\CodeFixCollection.cs (2)
19public TextSpan TextSpan { get; } 31TextSpan span,
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.cs (1)
57public Task<ImmutableArray<CodeFix>> GetFixesAsync(TextDocument document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CodeActionOptionsProvider fallbackOptions, CancellationToken cancellationToken)
CodeFixes\Configuration\ConfigureSeverity\ConfigureSeverityLevelCodeFixProvider.cs (1)
46public Task<ImmutableArray<CodeFix>> GetFixesAsync(TextDocument document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CodeActionOptionsProvider fallbackOptions, CancellationToken cancellationToken)
CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (1)
63TextSpan span, Diagnostic diagnostic)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.cs (6)
142TextDocument textDocument, TextSpan span, IEnumerable<Diagnostic> diagnostics, CodeActionOptionsProvider fallbackOptions, CancellationToken cancellationToken) 150internal async Task<ImmutableArray<PragmaWarningCodeAction>> GetPragmaSuppressionsAsync(Document document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CodeActionOptionsProvider fallbackOptions, CancellationToken cancellationToken) 159Document document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CodeActionOptionsProvider fallbackOptions, bool skipSuppressMessage, bool skipUnsuppress, CancellationToken cancellationToken) 265private async Task<SuppressionTargetInfo> GetSuppressionTargetInfoAsync(Document document, TextSpan span, CancellationToken cancellationToken) 322TextSpan? minContainingSpan = null; 325var declSpan = decl.DeclaredNode.Span;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs (8)
51var currentDiagnosticSpans = new Dictionary<Diagnostic, TextSpan>(); 63if (!currentDiagnosticSpans.TryGetValue(diagnostic, out var currentDiagnosticSpan)) 131private static void UpdateDiagnosticSpans(ImmutableArray<Diagnostic> diagnostics, Dictionary<Diagnostic, TextSpan> currentDiagnosticSpans, IEnumerable<TextChange> textChanges) 133static bool IsPriorSpan(TextSpan span, TextChange textChange) => span.End <= textChange.Span.Start; 134static bool IsFollowingSpan(TextSpan span, TextChange textChange) => span.Start >= textChange.Span.End; 135static bool IsEnclosingSpan(TextSpan span, TextChange textChange) => span.Contains(textChange.Span); 141if (!currentDiagnosticSpans.TryGetValue(diagnostic, out var originalSpan)) 146var currentSpan = originalSpan;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaHelpers.cs (6)
26TextSpan diagnosticSpan, 28Func<SyntaxToken, TextSpan, SyntaxToken> getNewStartToken, 29Func<SyntaxToken, TextSpan, SyntaxToken> getNewEndToken, 65private static int GetPositionForPragmaInsertion(ImmutableArray<SyntaxTrivia> triviaList, TextSpan currentDiagnosticSpan, AbstractSuppressionCodeFixProvider fixer, bool isStartToken, out SyntaxTrivia triviaAtIndex) 104TextSpan currentDiagnosticSpan, 156TextSpan currentDiagnosticSpan,
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaWarningBatchFixAllProvider.cs (1)
40var span = diagnostic.Location.SourceSpan;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.BatchFixer.cs (1)
47var span = diagnostic.Location.SourceSpan;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (6)
87SyntaxToken getNewStartToken(SyntaxToken startToken, TextSpan currentDiagnosticSpan) => includeStartTokenChange 91SyntaxToken getNewEndToken(SyntaxToken endToken, TextSpan currentDiagnosticSpan) => includeEndTokenChange 124var diagnosticSpan = diagnostic.Location.SourceSpan; 158private SyntaxToken GetNewTokenWithModifiedPragma(SyntaxToken token, TextSpan currentDiagnosticSpan, bool add, bool toggle, int indexOfTriviaToRemoveOrToggle, bool isStartToken, CancellationToken cancellationToken) 165private SyntaxToken GetNewTokenWithAddedPragma(SyntaxToken token, TextSpan currentDiagnosticSpan, bool isStartToken, CancellationToken cancellationToken) 208var spanToCheck = new TextSpan(
CodeLens\CodeLensReferencesService.cs (1)
144var referenceSpan = new TextSpan(spanStart, token.Span.Length);
CodeLens\ICodeLensMemberFinder.cs (1)
24internal record struct CodeLensMember(SyntaxNode Node, TextSpan Span);
CodeLens\IRemoteCodeLensReferencesService.cs (4)
17ValueTask<ReferenceCount?> GetReferenceCountAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, int maxResultCount, CancellationToken cancellationToken); 18ValueTask<ImmutableArray<ReferenceLocationDescriptor>?> FindReferenceLocationsAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken); 19ValueTask<ImmutableArray<ReferenceMethodDescriptor>?> FindReferenceMethodsAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken); 20ValueTask<string> GetFullyQualifiedNameAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken);
CodeRefactoringHelpers.cs (7)
30/// cref="IRefactoringHelpersService.GetRelevantNodesAsync{TSyntaxNode}(Document, TextSpan, bool, 43public static bool IsNodeUnderselected(SyntaxNode? node, TextSpan selection) 105/// Returns unchanged <paramref name="span"/> in case <see cref="TextSpan.IsEmpty"/>. 106/// Returns empty Span with original <see cref="TextSpan.Start"/> in case it contains only whitespace. 108public static async Task<TextSpan> GetTrimmedTextSpanAsync(Document document, TextSpan span, CancellationToken cancellationToken) 129return TextSpan.FromBounds(start, end);
CodeRefactorings\AbstractRefactoringHelpersService.cs (6)
29Document document, TextSpan selectionRaw, bool allowEmptyNodes, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 49Document document, TextSpan selectionRaw, ArrayBuilder<TSyntaxNode> relevantNodes, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 60var selectionTrimmed = await CodeRefactoringHelpers.GetTrimmedTextSpanAsync(document, selectionRaw, cancellationToken).ConfigureAwait(false); 337var rightNodeSpanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, rightNode); 349TextSpan selectionTrimmed, 365var spanWithoutAttributes = syntaxFacts.GetSpanWithoutAttributes(root, nonHiddenExtractedNode);
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (5)
32public async Task<Document> AddMissingImportsAsync(Document document, TextSpan textSpan, AddMissingImportsOptions options, CancellationToken cancellationToken) 52public async Task<AddMissingImportsAnalysisResult> AnalyzeAsync(Document document, TextSpan textSpan, AddMissingImportsOptions options, CancellationToken cancellationToken) 147private async Task<Document> CleanUpNewLinesAsync(Document document, IEnumerable<TextSpan> insertSpans, SyntaxFormattingOptions formattingOptions, CancellationToken cancellationToken) 154foreach (var insertSpan in insertSpans) 162private async Task<Document> CleanUpNewLinesAsync(Document document, TextSpan insertSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken)
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsRefactoringProvider.cs (1)
34if (!_pasteTrackingService.TryGetPastedTextSpan(sourceText.Container, out var textSpan))
CodeRefactorings\AddMissingImports\IAddMissingImportsFeatureService.cs (3)
28Task<Document> AddMissingImportsAsync(Document document, TextSpan textSpan, AddMissingImportsOptions options, CancellationToken cancellationToken); 33Task<AddMissingImportsAnalysisResult> AnalyzeAsync(Document document, TextSpan textSpan, AddMissingImportsOptions options, CancellationToken cancellationToken); 36/// Performs the same action as <see cref="AddMissingImportsAsync(Document, TextSpan, AddMissingImportsOptions, CancellationToken)"/> but
CodeRefactorings\CodeRefactoring.cs (3)
25/// applicable to. It doesn't have to precisely represent the exact <see cref="TextSpan"/> that will get changed. 27public ImmutableArray<(CodeAction action, TextSpan? applicableToSpan)> CodeActions { get; } 35ImmutableArray<(CodeAction, TextSpan?)> actions,
CodeRefactorings\CodeRefactoringContextExtensions.cs (5)
22this CodeRefactoringContext context, ImmutableArray<TCodeAction> actions, TextSpan? applicableToSpan = null) 53public static Task<TSyntaxNode?> TryGetRelevantNodeAsync<TSyntaxNode>(this Document document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 56public static async Task<TSyntaxNode?> TryGetRelevantNodeAsync<TSyntaxNode>(this Document document, TextSpan span, bool allowEmptyNode, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 63this Document document, TextSpan span, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode 67this Document document, TextSpan span, bool allowEmptyNodes, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
CodeRefactorings\CodeRefactoringService.cs (4)
94TextSpan state, 119TextSpan state, 158TextSpan state, 174using var _ = ArrayBuilder<(CodeAction action, TextSpan? applicableToSpan)>.GetInstance(out var actions);
CodeRefactorings\ExtractMethod\AbstractExtractMethodCodeRefactoringProvider.cs (3)
69TextSpan textSpan, 84private static async Task<CodeAction> ExtractMethodAsync(Document document, TextSpan textSpan, ExtractMethodGenerationOptions extractOptions, CodeCleanupOptions cleanupOptions, CancellationToken cancellationToken) 108private static async Task<CodeAction> ExtractLocalFunctionAsync(Document document, TextSpan textSpan, ExtractMethodGenerationOptions extractOptions, CodeCleanupOptions cleanupOptions, CancellationToken cancellationToken)
CodeRefactorings\ICodeRefactoringService.cs (3)
16Task<bool> HasRefactoringsAsync(TextDocument document, TextSpan textSpan, CodeActionOptionsProvider options, CancellationToken cancellationToken); 18Task<ImmutableArray<CodeRefactoring>> GetRefactoringsAsync(TextDocument document, TextSpan textSpan, CodeActionRequestPriority priority, CodeActionOptionsProvider options, bool isBlocking, Func<string, IDisposable?> addOperationScope, CancellationToken cancellationToken); 23public static Task<ImmutableArray<CodeRefactoring>> GetRefactoringsAsync(this ICodeRefactoringService service, TextDocument document, TextSpan state, CodeActionOptionsProvider options, bool isBlocking, CancellationToken cancellationToken)
CodeRefactorings\IRefactoringHelpersService.cs (2)
56Task<ImmutableArray<TSyntaxNode>> GetRelevantNodesAsync<TSyntaxNode>(Document document, TextSpan selection, bool allowEmptyNodes, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode; 62this IRefactoringHelpersService service, Document document, TextSpan selection, CancellationToken cancellationToken) where TSyntaxNode : SyntaxNode
CodeRefactorings\MoveType\AbstractMoveTypeService.cs (6)
33public abstract Task<Solution> GetModifiedSolutionAsync(Document document, TextSpan textSpan, MoveTypeOperationKind operationKind, CodeCleanupOptionsProvider fallbackOptions, CancellationToken cancellationToken); 34public abstract Task<ImmutableArray<CodeAction>> GetRefactoringAsync(Document document, TextSpan textSpan, CodeCleanupOptionsProvider fallbackOptions, CancellationToken cancellationToken); 46Document document, TextSpan textSpan, CodeCleanupOptionsProvider fallbackOptions, CancellationToken cancellationToken) 59public override async Task<Solution> GetModifiedSolutionAsync(Document document, TextSpan textSpan, MoveTypeOperationKind operationKind, CodeCleanupOptionsProvider fallbackOptions, CancellationToken cancellationToken) 81protected abstract Task<TTypeDeclarationSyntax> GetRelevantNodeAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); 83private async Task<State> CreateStateAsync(Document document, TextSpan textSpan, CodeCleanupOptionsProvider fallbackOptions, CancellationToken cancellationToken)
CodeRefactorings\MoveType\IMoveTypeService.cs (2)
20Task<ImmutableArray<CodeAction>> GetRefactoringAsync(Document document, TextSpan textSpan, CodeCleanupOptionsProvider fallbackOptions, CancellationToken cancellationToken); 22Task<Solution> GetModifiedSolutionAsync(Document document, TextSpan textSpan, MoveTypeOperationKind operationKind, CodeCleanupOptionsProvider fallbackOptions, CancellationToken cancellationToken);
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (3)
79protected abstract Task<SyntaxNode?> TryGetApplicableContainerFromSpanAsync(Document document, TextSpan span, CancellationToken cancellationToken); 271TextSpan span, 281using var _2 = PooledHashSet<TextSpan>.GetInstance(out var spanForContainers);
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.cs (1)
96protected abstract Task<SyntaxNode?> TryGetApplicableInvocationNodeAsync(Document document, TextSpan span, CancellationToken cancellationToken);
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.State.cs (1)
69TextSpan textSpan,
Completion\CommonCompletionUtilities.cs (3)
29public static TextSpan GetWordSpan(SourceText text, int position, 35public static TextSpan GetWordSpan(SourceText text, int position, 59return TextSpan.FromBounds(start, end);
Completion\CompletionContext.cs (4)
54public TextSpan DefaultItemSpan { get; } 67public TextSpan CompletionListSpan { get; set; } 117TextSpan defaultSpan, 144TextSpan defaultSpan,
Completion\CompletionItem.cs (6)
85public TextSpan Span { get; internal set; } 138TextSpan span, 250TextSpan span, 270Optional<TextSpan> span = default, 283var newSpan = span.HasValue ? span.Value : Span; 337public CompletionItem WithSpan(TextSpan span)
Completion\CompletionList.cs (9)
40public TextSpan DefaultSpan { get; } 50public TextSpan Span { get; } 72TextSpan defaultSpan, 101TextSpan defaultSpan, 110TextSpan defaultSpan, 120Optional<TextSpan> span = default, 125var newSpan = span.HasValue ? span.Value : Span; 147public CompletionList WithDefaultSpan(TextSpan span) 150public CompletionList WithSpan(TextSpan span)
Completion\CompletionService.cs (3)
160public virtual TextSpan GetDefaultItemSpan(SourceText text, int caretPosition) 163public virtual TextSpan GetDefaultCompletionListSpan(SourceText text, int caretPosition) 374var defaultItemSpan = _completionServiceWithProviders.GetDefaultCompletionListSpan(text, position);
Completion\CompletionService_GetCompletions.cs (5)
100var defaultItemSpan = GetDefaultCompletionListSpan(text, caretPosition); 239CompletionOptions options, TextSpan defaultItemSpan, 258TextSpan defaultSpan, 265var finalCompletionListSpan = completionContexts.FirstOrDefault(c => c.CompletionListSpan != defaultSpan)?.CompletionListSpan ?? defaultSpan; 332TextSpan defaultSpan,
Completion\PatternMatchHelper.cs (2)
33public ImmutableArray<TextSpan> GetHighlightedSpans(string text, CultureInfo culture) 36return match == null ? ImmutableArray<TextSpan>.Empty : match.Value.MatchedSpans;
Completion\Providers\AbstractAwaitCompletionProvider.cs (1)
210builder.Add(new TextChange(TextSpan.FromBounds(dotToken.Value.SpanStart, item.Span.End), replacementText));
Completion\Providers\AbstractDocCommentCompletionProvider.cs (3)
275var itemSpan = item.Span; 276var replacementSpan = TextSpan.FromBounds(text[itemSpan.Start - 1] == '<' && beforeCaretText[0] == '<' ? itemSpan.Start - 1 : itemSpan.Start, itemSpan.End);
Completion\Providers\AbstractInternalsVisibleToCompletionProvider.cs (3)
248private static async Task<TextSpan> GetTextChangeSpanAsync(Document document, TextSpan startSpan, CancellationToken cancellationToken) 250var result = startSpan;
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (4)
104var destinationSpan = ComputeDestinationSpan(insertionRoot); 146contextLocation: semanticModel.SyntaxTree.GetLocation(TextSpan.FromBounds(line.Start, line.Start))), 169private TextSpan ComputeDestinationSpan(SyntaxNode insertionRoot) 194return TextSpan.FromBounds(firstToken.SpanStart, line.End);
Completion\Providers\AbstractPartialMethodCompletionProvider.cs (3)
83Document document, int position, TextSpan span, DeclarationModifiers modifiers, SyntaxToken token, CancellationToken cancellationToken) 100var lineSpan = text.Lines.GetLineFromPosition(position).Span; 104private CompletionItem CreateItem(IMethodSymbol method, int line, TextSpan span, SemanticModel semanticModel, DeclarationModifiers modifiers, SyntaxToken token)
Completion\Providers\AbstractSuggestionModeCompletionProvider.cs (1)
15protected abstract Task<CompletionItem?> GetSuggestionModeItemAsync(Document document, int position, TextSpan span, CompletionTrigger triggerInfo, CancellationToken cancellationToken);
Completion\Providers\Scripting\AbstractDirectivePathCompletionProvider.cs (2)
112private static TextSpan GetTextChangeSpan(string quotedPath, int quotedPathStart, int position) 133return TextSpan.FromBounds(startIndex + quotedPathStart, endIndex + quotedPathStart);
Completion\Providers\Snippets\AbstractSnippetCompletionProvider.cs (3)
56var textSpan = TextSpan.FromBounds(item.Span.Start, change.Span.End); 128var span = completionService.GetDefaultCompletionListSpan(originalText, position);
Completion\Utilities.cs (3)
31var totalOldSpan = TextSpan.FromBounds(changes.First().Span.Start, changes.Last().Span.End); 40var totalNewSpan = new TextSpan(totalOldSpan.Start, totalOldSpan.Length + sumOfDeltas);
ConvertAnonymousType\AbstractConvertAnonymousTypeCodeRefactoringProvider.cs (1)
18Document document, TextSpan span, CancellationToken cancellationToken)
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (1)
81private async Task<Document> ConvertAsync(Document document, TextSpan span, CodeActionOptionsProvider fallbackOptions, bool isRecord, CancellationToken cancellationToken)
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.cs (1)
182ImmutableArray<TextSpan> fixAllSpans,
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
39var ifSpan = ifStatement.Span;
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (6)
121TextSpan span, 172private CodeAction CreateAction(Document document, TextSpan span, Scope scope, CleanCodeGenerationOptionsProvider fallbackOptions, bool isRecord) 186Document document, TextSpan span, CancellationToken cancellationToken) 208Document document, TextSpan span, Scope scope, CleanCodeGenerationOptionsProvider fallbackOptions, bool isRecord, CancellationToken cancellationToken) 243(DocumentId documentId, TextSpan span) renamedToken, 255Document document, TextSpan span, Scope scope, CleanCodeGenerationOptionsProvider fallbackOptions, bool isRecord, CancellationToken cancellationToken)
ConvertTupleToStruct\IConvertTupleToStructCodeRefactoringProvider.cs (1)
18Document document, TextSpan span, Scope scope, CleanCodeGenerationOptionsProvider fallbackOptions, bool isRecord, CancellationToken cancellationToken);
ConvertTupleToStruct\IRemoteConvertTupleToStructCodeRefactoringService.cs (3)
32TextSpan span, 58public readonly (DocumentId, TextSpan) RenamedToken; 62(DocumentId, TextSpan) renamedToken)
Debugging\AbstractBreakpointResolver.cs (1)
84var textSpan = new TextSpan(location.SourceSpan.Start, 0);
Debugging\BreakpointResolutionResult.cs (3)
12public TextSpan TextSpan { get; } 16private BreakpointResolutionResult(Document document, TextSpan textSpan, string? locationNameOpt, bool isLineBreakpoint) 24internal static BreakpointResolutionResult CreateSpanResult(Document document, TextSpan textSpan, string? locationNameOpt = null)
Debugging\DebugDataTipInfo.cs (2)
11public readonly TextSpan Span; 14public DebugDataTipInfo(TextSpan span, string text)
Debugging\IBreakpointResolutionService.cs (1)
15Task<BreakpointResolutionResult?> ResolveBreakpointAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken = default);
Diagnostics\DiagnosticArguments.cs (2)
49public TextSpan? DocumentSpan; 79TextSpan? documentSpan,
Diagnostics\IAnalyzerDriverService.cs (1)
25void ComputeDeclarationsInSpan(SemanticModel model, TextSpan span, bool getSymbol, ArrayBuilder<DeclarationInfo> builder, CancellationToken cancellationToken);
Diagnostics\IDiagnosticAnalyzerService.cs (5)
77/// Use <see cref="GetDiagnosticsForSpanAsync(TextDocument, TextSpan?, Func{string, bool}?, bool, bool, CodeActionRequestPriority, Func{string, IDisposable?}?, DiagnosticKind, CancellationToken)"/> 81TextDocument document, TextSpan range, Func<string, bool>? shouldIncludeDiagnostic, 96TextDocument document, TextSpan? range, Func<string, bool>? shouldIncludeDiagnostic, 107TextDocument document, TextSpan range, string? diagnosticId = null, 122TextDocument document, TextSpan? range, string? diagnosticId = null,
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (5)
75var replaceSpan = new TextSpan(token.Span.Start, spanToReplaceLength); 237var replaceSpan = token.Span; 281var replaceSpan = new TextSpan(token.Span.Start, 0); 348var replaceSpan = firstNonWhitespaceOffset != null 349? TextSpan.FromBounds(currentLine.Start, currentLine.Start + firstNonWhitespaceOffset.Value)
DocumentationComments\DocumentationCommentSnippet.cs (2)
14public TextSpan SpanToReplace { get; } 26internal DocumentationCommentSnippet(TextSpan spanToReplace, string snippetText, int caretOffset)
DocumentHighlighting\IDocumentHighlightsService.cs (2)
26public TextSpan TextSpan { get; } 31public HighlightSpan(TextSpan textSpan, HighlightSpanKind kind) : this()
DocumentIdSpan.cs (2)
23public readonly TextSpan SourceSpan; 25public DocumentIdSpan(DocumentId documentId, TextSpan sourceSpan)
DocumentSpan.cs (4)
13/// Represents a <see cref="TextSpan"/> location in a <see cref="Document"/>. 18public TextSpan SourceSpan { get; } 25public DocumentSpan(Document document, TextSpan sourceSpan) 32TextSpan sourceSpan,
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (52)
149internal abstract (TextSpan envelope, TextSpan hole) GetActiveSpanEnvelope(SyntaxNode declaration); 179protected abstract SyntaxNode FindStatementAndPartner(SyntaxNode declarationBody, TextSpan span, SyntaxNode? partnerDeclarationBody, out SyntaxNode? partner, out int statementPart); 181private SyntaxNode FindStatement(SyntaxNode declarationBody, TextSpan span, out int statementPart) 224protected abstract bool TryGetEnclosingBreakpointSpan(SyntaxNode root, int position, out TextSpan span); 232protected abstract bool TryGetActiveSpan(SyntaxNode node, int statementPart, int minLength, out TextSpan span); 263protected abstract TextSpan GetGlobalStatementDiagnosticSpan(SyntaxNode node); 297protected abstract TextSpan? TryGetDiagnosticSpan(SyntaxNode node, EditKind editKind); 299internal TextSpan GetDiagnosticSpan(SyntaxNode node, EditKind editKind) 302protected virtual TextSpan GetBodyDiagnosticSpan(SyntaxNode node, EditKind editKind) 322internal abstract TextSpan GetLambdaParameterDiagnosticSpan(SyntaxNode lambda, int ordinal); 412protected abstract TextSpan GetExceptionHandlingRegion(SyntaxNode node, out bool coversAllChildren); 415internal abstract void ReportEnclosingExceptionHandlingRudeEdits(ArrayBuilder<RudeEditDiagnostic> diagnostics, IEnumerable<Edit<SyntaxNode>> exceptionHandlingEdits, SyntaxNode oldStatement, TextSpan newStatementSpan); 417internal abstract void ReportMemberBodyUpdateRudeEdits(ArrayBuilder<RudeEditDiagnostic> diagnostics, SyntaxNode newMember, TextSpan? span); 620using var _3 = ArrayBuilder<(SyntaxNode OldNode, SyntaxNode NewNode, TextSpan DiagnosticSpan)>.GetInstance(out var triviaEdits); 710lineText = text.ToString(TextSpan.FromBounds(diagnostic.Span.Start, Math.Min(diagnostic.Span.Start + 120, line.End))); 815var oldStatementSpan = oldActiveStatements[i].UnmappedSpan; 876var newStatementSpan = FindClosestActiveSpan(newStatement, statementPart); 973var newSpan = FindClosestActiveSpan(newDeclaration, DefaultStatementPart); 1008var oldStatementSpan = oldActiveStatements[activeStatementIndex].UnmappedSpan; 1113TextSpan newSpan; 1239var bodySpan = GetBodyDiagnosticSpan(newBody, EditKind.Update); 1280var trackedSpan = text.Lines.GetTextSpan(trackedLineSpan); 1296private ActiveStatement GetActiveStatementWithSpan(UnmappedActiveStatement oldStatement, SyntaxTree newTree, TextSpan newSpan, ArrayBuilder<RudeEditDiagnostic> diagnostics, CancellationToken cancellationToken) 1316TextSpan newStatementSyntaxSpan, 1570public ActiveStatementExceptionRegions GetExceptionRegions(SyntaxNode syntaxRoot, TextSpan unmappedActiveStatementSpan, bool isNonLeaf, CancellationToken cancellationToken) 1589var span = GetExceptionHandlingRegion(exceptionHandlingAncestors[i], out var coversAllChildren); 1608private TextSpan GetDeletedNodeDiagnosticSpan(SyntaxNode deletedLambdaBody, Match<SyntaxNode> match, Dictionary<SyntaxNode, LambdaInfo> lambdaInfos) 1628private TextSpan FindClosestActiveSpan(SyntaxNode statement, int statementPart) 1630if (TryGetActiveSpan(statement, statementPart, minLength: statement.Span.Length, out var span)) 1655internal TextSpan GetDeletedNodeActiveSpan(IReadOnlyDictionary<SyntaxNode, SyntaxNode> forwardMap, SyntaxNode deletedNode) 1673internal TextSpan GetDeletedNodeDiagnosticSpan(IReadOnlyDictionary<SyntaxNode, SyntaxNode> forwardMap, SyntaxNode deletedNode) 1756protected void AddAroundActiveStatementRudeDiagnostic(ArrayBuilder<RudeEditDiagnostic> diagnostics, SyntaxNode? oldNode, SyntaxNode? newNode, TextSpan newActiveStatementSpan) 1792protected void AddRudeDeleteAroundActiveStatement(ArrayBuilder<RudeEditDiagnostic> diagnostics, SyntaxNode oldNode, TextSpan newActiveStatementSpan) 1981[Out] ArrayBuilder<(SyntaxNode OldNode, SyntaxNode NewNode, TextSpan DiagnosticSpan)> triviaEdits, 2034var rudeEditSpan = default(TextSpan); 2047if (!TryGetEnclosingBreakpointSpan(oldNode, oldNode.SpanStart, out var oldBreakpointSpan) || 2048!TryGetEnclosingBreakpointSpan(newNode, newNode.SpanStart, out var newBreakpointSpan)) 2100var oldSpan = oldTokensEnum.Current.Span; 2101var newSpan = newTokensEnum.Current.Span; 2156rudeEditSpan = TextSpan.FromBounds( 2407IReadOnlyList<(SyntaxNode OldNode, SyntaxNode NewNode, TextSpan DiagnosticSpan)> triviaEdits, 2615var newSpan = IsDeclarationWithInitializer(oldDeclaration) 2693var diagnosticSpan = GetDeletedNodeDiagnosticSpan(editScript.Match.Matches, oldDeclaration); 4605var span = (rudeEdit == RudeEditKind.ChangeImplicitMainReturnType) ? GetGlobalStatementDiagnosticSpan(node) : GetDiagnosticSpan(node, EditKind.Update); 4968var firstSpan = updatesInCurrentDocument.ChangedDeclarations.Keys.Where(IsDeclarationWithInitializer).Aggregate( 4969(min: int.MaxValue, span: default(TextSpan)), 5444TextSpan errorSpan; 5516private static TextSpan GetThisParameterDiagnosticSpan(ISymbol member) 5519private static TextSpan GetVariableDiagnosticSpan(ISymbol local) 5769TextSpan span;
EditAndContinue\ActiveStatementsMap.cs (3)
194if (TryGetTextSpan(oldText.Lines, unmappedLineSpan, out var unmappedSpan) && 266private static bool TryGetTextSpan(TextLineCollection lines, LinePositionSpan lineSpan, out TextSpan span) 276span = TextSpan.FromBounds(start, end);
EditAndContinue\EditSession.cs (4)
218private static TextSpan GetFirstLineDifferenceSpan(SourceText oldText, SourceText newText) 225var oldLineSpan = oldText.Lines[i].Span; 226var newLineSpan = newText.Lines[i].Span; 235TextSpan.FromBounds(newText.Lines[newLineCount - 1].End, newText.Lines[newLineCount - 1].EndIncludingLineBreak);
EditAndContinue\IEditAndContinueAnalyzer.cs (1)
24ActiveStatementExceptionRegions GetExceptionRegions(SyntaxNode syntaxRoot, TextSpan unmappedActiveStatementSpan, bool isNonLeaf, CancellationToken cancellationToken);
EditAndContinue\RudeEditDiagnostic.cs (3)
18public readonly TextSpan Span; 26internal RudeEditDiagnostic(RudeEditKind kind, TextSpan span, ushort syntaxKind, string?[] arguments) 34internal RudeEditDiagnostic(RudeEditKind kind, TextSpan span, SyntaxNode? node = null, string?[]? arguments = null)
EditAndContinue\UnmappedActiveStatement.cs (3)
18public TextSpan UnmappedSpan { get; } 30public UnmappedActiveStatement(TextSpan unmappedSpan, ActiveStatement statement, ActiveStatementExceptionRegions exceptionRegions) 37public void Deconstruct(out TextSpan unmappedSpan, out ActiveStatement statement, out ActiveStatementExceptionRegions exceptionRegions)
EmbeddedLanguages\Classification\AbstractEmbeddedLanguageClassificationService.cs (4)
38Document document, TextSpan textSpan, ClassificationOptions options, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken) 45Project? project, SemanticModel semanticModel, TextSpan textSpan, ClassificationOptions options, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken) 60private readonly TextSpan _textSpan; 69TextSpan textSpan,
EmbeddedLanguages\Classification\EmbeddedLanguageClassifierContext.cs (1)
52public void AddClassification(string classificationType, TextSpan span)
EmbeddedLanguages\DateAndTime\EmbeddedCompletionContext.cs (2)
22private readonly TextSpan _replacementSpan; 50_replacementSpan = TextSpan.FromBounds(startPosition, context.Position);
EmbeddedLanguages\Json\JsonLexer.cs (3)
38=> Text.GetSubSequence(TextSpan.FromBounds(start, end)); 317private readonly TextSpan GetTextSpan(int startInclusive, int endExclusive) 318=> TextSpan.FromBounds(Text[startInclusive].Span.Start, Text[endExclusive - 1].Span.End);
EmbeddedLanguages\Json\JsonParser.cs (2)
403literalToken.VirtualChars.GetSubSequence(TextSpan.FromBounds(1, literalToken.VirtualChars.Length)), 590private readonly TextSpan GetTokenStartPositionSpan(JsonToken token)
EmbeddedLanguages\Json\JsonParser.StrictSyntaxChecker.cs (1)
242return new EmbeddedDiagnostic(FeaturesResources.Invalid_escape_sequence, TextSpan.FromBounds(chars[i].Span.Start, chars[i + 1].Span.End));
EmbeddedLanguages\RegularExpressions\LanguageServices\EmbeddedCompletionContext.cs (2)
50var replacementSpan = TextSpan.FromBounds(replacementStart, Position);
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexDocumentHighlighter.cs (4)
91if (tree.CaptureNumbersToSpan.TryGetValue(val, out var captureSpan)) 99if (tree.CaptureNamesToSpan.TryGetValue(val, out var captureSpan)) 109RegexEscapeNode node, TextSpan captureSpan) 114private static HighlightSpan CreateHighlightSpan(TextSpan textSpan)
EmbeddedLanguages\RegularExpressions\RegexLexer.cs (3)
55=> Text.GetSubSequence(TextSpan.FromBounds(start, end)); 178public readonly TextSpan GetTextSpan(int startInclusive, int endExclusive) 179=> TextSpan.FromBounds(Text[startInclusive].Span.Start, Text[endExclusive - 1].Span.End);
EmbeddedLanguages\RegularExpressions\RegexParser.CaptureInfoAnalyzer.cs (12)
32private readonly ImmutableDictionary<int, TextSpan>.Builder _captureNumberToSpan; 33private readonly ImmutableDictionary<string, TextSpan>.Builder _captureNameToSpan; 41_captureNumberToSpan = ImmutableDictionary.CreateBuilder<int, TextSpan>(); 42_captureNameToSpan = ImmutableDictionary.CreateBuilder<string, TextSpan>(); 50public static (ImmutableDictionary<string, TextSpan>, ImmutableDictionary<int, TextSpan>) Analyze( 57private (ImmutableDictionary<string, TextSpan>, ImmutableDictionary<int, TextSpan>) Analyze( 139private readonly TextSpan GetGroupingSpan(RegexGroupingNode grouping) 181private readonly void RecordCapture(RegexToken token, TextSpan span) 197ImmutableDictionary<T, TextSpan>.Builder mapping, 199T val, TextSpan span)
EmbeddedLanguages\RegularExpressions\RegexParser.cs (8)
83private readonly ImmutableDictionary<string, TextSpan> _captureNamesToSpan; 84private readonly ImmutableDictionary<int, TextSpan> _captureNumbersToSpan; 93ImmutableDictionary<string, TextSpan> captureNamesToSpan, 94ImmutableDictionary<int, TextSpan> captureNumbersToSpan) : this() 146ImmutableDictionary<string, TextSpan>.Empty, 147ImmutableDictionary<int, TextSpan>.Empty).ParseTree(); 705private readonly TextSpan GetTokenSpanIncludingEOF(RegexToken token) 710private readonly TextSpan GetTokenStartPositionSpan(RegexToken token)
EmbeddedLanguages\RegularExpressions\RegexTree.cs (4)
16public readonly ImmutableDictionary<string, TextSpan> CaptureNamesToSpan; 17public readonly ImmutableDictionary<int, TextSpan> CaptureNumbersToSpan; 23ImmutableDictionary<string, TextSpan> captureNamesToSpan, 24ImmutableDictionary<int, TextSpan> captureNumbersToSpan)
EmbeddedLanguages\StackFrame\StackFrameLexer.cs (1)
66=> Text.GetSubSequence(TextSpan.FromBounds(start, end));
EncapsulateField\AbstractEncapsulateFieldService.cs (7)
35protected abstract Task<ImmutableArray<IFieldSymbol>> GetFieldsAsync(Document document, TextSpan span, CancellationToken cancellationToken); 37public async Task<EncapsulateFieldResult> EncapsulateFieldsInSpanAsync(Document document, TextSpan span, CleanCodeGenerationOptionsProvider fallbackOptions, bool useDefaultBehavior, CancellationToken cancellationToken) 50public async Task<ImmutableArray<CodeAction>> GetEncapsulateFieldCodeActionsAsync(Document document, TextSpan span, CleanCodeGenerationOptionsProvider fallbackOptions, CancellationToken cancellationToken) 304Func<DocumentId, TextSpan, bool> filter, 325private static bool IntersectsWithAny(DocumentId documentId, TextSpan span, ISet<(DocumentId documentId, TextSpan span)> constructorLocations) 339private ISet<(DocumentId documentId, TextSpan span)> GetConstructorLocations(Solution solution, INamedTypeSymbol containingType)
ExternalAccess\UnitTesting\API\UnitTestingDocumentSpan.cs (1)
22/// The raw <see cref="Document"/> and <see cref="TextSpan"/> that the symbol is located at.
ExternalAccess\VSTypeScript\Api\IVSTypeScriptCommentSlectionServiceImplementation.cs (2)
17Task<VSTypeScriptCommentSelectionInfo> GetInfoAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); 19Task<Document> FormatAsync(Document document, ImmutableArray<TextSpan> changes, CancellationToken cancellationToken);
ExternalAccess\VSTypeScript\Api\IVSTypeScriptFormattingServiceImplementation.cs (1)
19Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, VSTypeScriptIndentationOptions options, CancellationToken cancellationToken);
ExternalAccess\VSTypeScript\Api\IVSTypeScriptNavigableItem.cs (1)
33TextSpan SourceSpan { get; }
ExternalAccess\VSTypeScript\Api\IVSTypeScriptNavigateToSearchResult.cs (1)
17ImmutableArray<TextSpan> NameMatchSpans { get; }
ExternalAccess\VSTypeScript\VSTypeScriptFormattingService.cs (1)
28public Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, LineFormattingOptions lineFormattingOptions, SyntaxFormattingOptions? syntaxFormattingOptions, CancellationToken cancellationToken)
ExternalAccess\VSTypeScript\VSTypeScriptNavigableItemWrapper.cs (1)
31public TextSpan SourceSpan => _navigableItem.SourceSpan;
ExternalAccess\VSTypeScript\VSTypeScriptNavigateToSearchService.cs (1)
134public ImmutableArray<TextSpan> NameMatchSpans => _result.NameMatchSpans;
ExternalAccess\VSTypeScript\VSTypeScriptTaskListService.cs (1)
45var textSpan = new TextSpan(Math.Min(text.Length, Math.Max(0, d.Position)), 0);
ExtractClass\AbstractExtractClassRefactoringProvider.cs (2)
93var memberSpan = TextSpan.FromBounds(
ExtractClass\ExtractClassWithDialogCodeAction.cs (2)
34public TextSpan Span { get; } 43TextSpan span,
ExtractInterface\AbstractExtractInterfaceService.cs (1)
51public async Task<ImmutableArray<ExtractInterfaceCodeAction>> GetExtractInterfaceCodeActionAsync(Document document, TextSpan span, CleanCodeGenerationOptionsProvider fallbackOptions, CancellationToken cancellationToken)
ExtractMethod\AbstractExtractMethodService.cs (2)
17protected abstract TValidator CreateSelectionValidator(SemanticDocument document, TextSpan textSpan, ExtractMethodOptions options, bool localFunction); 22TextSpan textSpan,
ExtractMethod\AbstractSyntaxTriviaService.cs (3)
28public ITriviaSavedResult SaveTriviaAroundSelection(SyntaxNode root, TextSpan textSpan) 94private static Dictionary<TriviaLocation, IEnumerable<SyntaxTrivia>> GetTriviaAtEdges(Dictionary<TriviaLocation, SyntaxToken> tokens, TextSpan textSpan) 110private static Dictionary<TriviaLocation, SyntaxToken> GetTokensAtEdges(SyntaxNode root, TextSpan textSpan)
ExtractMethod\ExtractMethodService.cs (1)
15public static Task<ExtractMethodResult> ExtractMethodAsync(Document document, TextSpan textSpan, bool localFunction, ExtractMethodGenerationOptions options, CancellationToken cancellationToken)
ExtractMethod\IExtractMethodService.cs (1)
15Task<ExtractMethodResult> ExtractMethodAsync(Document document, TextSpan textSpan, bool localFunction, ExtractMethodGenerationOptions options, CancellationToken cancellationToken);
ExtractMethod\ISyntaxTriviaService.cs (1)
67ITriviaSavedResult SaveTriviaAroundSelection(SyntaxNode root, TextSpan textSpan);
ExtractMethod\MethodExtractor.Analyzer.SymbolMapBuilder.cs (3)
24private readonly TextSpan _span; 32TextSpan span, 48TextSpan span,
ExtractMethod\MethodExtractor.VariableSymbol.cs (1)
239var span = _localSymbol.Locations[0].SourceSpan;
ExtractMethod\SelectionResult.cs (6)
30TextSpan originalSpan, 31TextSpan finalSpan, 60public TextSpan OriginalSpan { get; } 61public TextSpan FinalSpan { get; } 147var span = TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End);
ExtractMethod\SelectionValidator.cs (6)
26protected readonly TextSpan OriginalSpan; 31TextSpan textSpan, 51public abstract bool IsFinalSpanSemanticallyValidSpan(SyntaxNode node, TextSpan textSpan, IEnumerable<SyntaxNode> returnStatements, CancellationToken cancellationToken); 55SemanticModel semanticModel, TextSpan textSpan, Tuple<SyntaxNode, SyntaxNode> range, CancellationToken cancellationToken) 103SyntaxNode root, TextSpan textSpan, CancellationToken cancellationToken) where T : SyntaxNode 163SyntaxNode root, TextSpan textSpan, CancellationToken cancellationToken) where T : SyntaxNode
FindUsages\AbstractFindUsagesService.ProgressAdapter.cs (1)
42public async ValueTask OnReferenceFoundAsync(Document document, TextSpan span, CancellationToken cancellationToken)
FindUsages\AbstractFindUsagesService_FindImplementations.cs (2)
109var seenLocations = new HashSet<(string filePath, TextSpan span)>(); 124static bool AddedAllLocations(ISymbol implementation, HashSet<(string filePath, TextSpan span)> seenLocations)
FindUsages\IDefinitionsAndReferencesFactory.cs (1)
255var sourceSpan = location.SourceSpan;
FindUsages\IRemoteFindUsagesService.cs (2)
167public readonly TextSpan SourceSpan; 169public SerializableDocumentSpan(DocumentId documentId, TextSpan sourceSpan)
FormatterHelper.cs (4)
35public static SyntaxNode Format(SyntaxNode node, TextSpan spanToFormat, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, CancellationToken cancellationToken) 49internal static SyntaxNode Format(SyntaxNode node, IEnumerable<TextSpan> spans, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken) 52internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan> spans, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken) 55internal static IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan> spans, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken)
Formatting\FormattingRuleUtilities.cs (1)
14ParsedDocument document, TextSpan span, IEnumerable<AbstractFormattingRule>? additionalRules)
FormattingCodeFixHelper.cs (3)
21var diagnosticSpan = diagnostic.Location.SourceSpan; 23var spanToFormat = TextSpan.FromBounds(
FullyQualify\AbstractFullyQualifyService.cs (2)
41Document document, TextSpan span, bool hideAdvancedMembers, CancellationToken cancellationToken) 61Document document, TextSpan span, bool hideAdvancedMembers, CancellationToken cancellationToken)
FullyQualify\IFullyQualifyService.cs (1)
47Task<FullyQualifyFixData?> GetFixDataAsync(Document document, TextSpan span, bool hideAdvancedMembers, CancellationToken cancellationToken);
FullyQualify\IRemoteFullyQualifyService.cs (1)
13ValueTask<FullyQualifyFixData?> GetFixDataAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan span, bool hideAdvancedMembers, CancellationToken cancellationToken);
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.cs (6)
76public async Task<ImmutableArray<IntentProcessorResult>> ComputeIntentAsync(Document priorDocument, TextSpan priorSelection, Document currentDocument, IntentDataProvider intentDataProvider, CancellationToken cancellationToken) 148TextSpan textSpan, 149Action<CodeAction, TextSpan> registerSingleAction, 177private async Task<(CodeAction CodeAction, TextSpan ApplicableToSpan)?> HandleNonSelectionAsync( 179TextSpan textSpan, 249Document document, TextSpan textSpan, bool addNullChecks, Accessibility? desiredAccessibility, CleanCodeGenerationOptionsProvider fallbackOptions, CancellationToken cancellationToken)
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.GenerateConstructorWithDialogCodeAction.cs (2)
30private readonly TextSpan _textSpan; 41TextSpan textSpan,
GenerateConstructorFromMembers\AbstractGenerateConstructorFromMembersCodeRefactoringProvider.State.cs (3)
23public TextSpan TextSpan { get; private set; } 37TextSpan textSpan, 54TextSpan textSpan,
GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.cs (2)
25SemanticDocument document, TextSpan textSpan, CancellationToken cancellationToken, 30TextSpan textSpan,
GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.State.cs (2)
30TextSpan textSpan, 46TextSpan textSpan,
GenerateDefaultConstructors\IGenerateDefaultConstructorsService.cs (1)
18Document document, TextSpan textSpan, CodeAndImportGenerationOptionsProvider fallbackOptions, bool forRefactoring, CancellationToken cancellationToken);
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.cs (1)
171TextSpan textSpan,
GenerateFromMembers\AbstractGenerateFromMembersCodeRefactoringProvider.cs (1)
28Document document, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken)
GenerateOverrides\GenerateOverridesWithDialogCodeAction.cs (2)
28private readonly TextSpan _textSpan; 34TextSpan textSpan,
GoToDefinition\AbstractGoToDefinitionSymbolService.cs (2)
23public async Task<(ISymbol?, Project, TextSpan)> GetSymbolProjectAndBoundSpanAsync(Document document, int position, bool includeType, CancellationToken cancellationToken) 58public async Task<(int? targetPosition, TextSpan tokenSpan)> GetTargetIfControlFlowAsync(Document document, int position, CancellationToken cancellationToken)
GoToDefinition\IGoToDefinitionSymbolService.cs (2)
14Task<(ISymbol?, Project, TextSpan)> GetSymbolProjectAndBoundSpanAsync(Document document, int position, bool includeType, CancellationToken cancellationToken); 20Task<(int? targetPosition, TextSpan tokenSpan)> GetTargetIfControlFlowAsync(Document document, int position, CancellationToken cancellationToken);
Highlighting\HighlightingService.cs (6)
22private static readonly PooledObjects.ObjectPool<List<TextSpan>> s_listPool = new(() => new List<TextSpan>()); 33SyntaxNode root, int position, List<TextSpan> highlights, CancellationToken cancellationToken) 44var lastSpan = default(TextSpan); 45foreach (var span in tempHighlights)
Highlighting\IHighlighter.cs (1)
15void AddHighlights(SyntaxNode root, int position, List<TextSpan> highlights, CancellationToken cancellationToken);
Highlighting\IHighlightingService.cs (1)
21void AddHighlights(SyntaxNode root, int position, List<TextSpan> highlights, CancellationToken cancellationToken);
Highlighting\Keywords\AbstractKeywordHighlighter.cs (9)
18protected sealed override void AddHighlightsForNode(SyntaxNode node, List<TextSpan> highlights, CancellationToken cancellationToken) 21protected abstract void AddHighlights(TNode node, List<TextSpan> highlights, CancellationToken cancellationToken); 26private static readonly ObjectPool<List<TextSpan>> s_textSpanListPool = new(() => new List<TextSpan>()); 32SyntaxNode root, int position, List<TextSpan> highlights, CancellationToken cancellationToken) 59private static bool AnyIntersects(int position, List<TextSpan> highlights) 61foreach (var highlight in highlights) 72protected abstract void AddHighlightsForNode(SyntaxNode node, List<TextSpan> highlights, CancellationToken cancellationToken); 74protected static TextSpan EmptySpan(int position)
InheritanceMargin\AbstractInheritanceMarginService.cs (1)
44TextSpan spanToSearch,
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (3)
80TextSpan spanToSearch, 121TextSpan spanToSearch, 153TextSpan spanToSearch,
InheritanceMargin\IInheritanceMarginService.cs (1)
22TextSpan spanToSearch,
InheritanceMargin\IRemoteInheritanceMarginService.cs (1)
18TextSpan spanToSearch,
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (2)
55TextSpan parameterSpan, 128TextSpan parameterSpan,
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (1)
53ImmutableArray<SyntaxNode> listOfParameterNodes, TextSpan parameterSpan,
InitializeParameter\AbstractInitializeParameterCodeRefactoringProvider.cs (1)
45TextSpan parameterSpan,
InlineHints\AbstractInlineHintsService.cs (1)
18Document document, TextSpan textSpan, InlineHintsOptions options, CancellationToken cancellationToken)
InlineHints\AbstractInlineParameterNameHintsService.cs (2)
44public async Task<ImmutableArray<InlineHint>> GetInlineHintsAsync(Document document, TextSpan textSpan, InlineParameterHintsOptions options, SymbolDescriptionOptions displayOptions, CancellationToken cancellationToken) 108var textSpan = new TextSpan(position, 0);
InlineHints\AbstractInlineTypeHintsService.cs (1)
40Document document, TextSpan textSpan, InlineTypeHintsOptions options, SymbolDescriptionOptions displayOptions, CancellationToken cancellationToken)
InlineHints\IInlineHintsService.cs (1)
17Task<ImmutableArray<InlineHint>> GetInlineHintsAsync(Document document, TextSpan textSpan, InlineHintsOptions options, CancellationToken cancellationToken);
InlineHints\IInlineParameterNameHintsService.cs (1)
20Task<ImmutableArray<InlineHint>> GetInlineHintsAsync(Document document, TextSpan textSpan, InlineParameterHintsOptions options, SymbolDescriptionOptions displayOptions, CancellationToken cancellationToken);
InlineHints\IInlineTypeHintsService.cs (1)
20Task<ImmutableArray<InlineHint>> GetInlineHintsAsync(Document document, TextSpan textSpan, InlineTypeHintsOptions options, SymbolDescriptionOptions displayOptions, CancellationToken cancellationToken);
InlineHints\InlineHint.cs (4)
16public readonly TextSpan Span; 23TextSpan span, 31TextSpan span, 40TextSpan span,
InlineHints\TypeHint.cs (3)
16public TextSpan Span { get; } 21public TypeHint(ITypeSymbol type, TextSpan span, TextChange? textChange, bool leadingSpace = false, bool trailingSpace = false) 33public void Deconstruct(out ITypeSymbol type, out TextSpan span, out TextChange? textChange, out ImmutableArray<SymbolDisplayPart> prefix, out ImmutableArray<SymbolDisplayPart> suffix)
Intents\IIntentProvider.cs (1)
16TextSpan priorSelection,
IntroduceUsingStatement\AbstractIntroduceUsingStatementCodeRefactoringProvider.cs (1)
62private async Task<(TLocalDeclarationSyntax? declaration, string? variableName)> FindDisposableLocalDeclarationAsync(Document document, TextSpan selection, CancellationToken cancellationToken)
IntroduceVariable\AbstractIntroduceLocalForExpressionCodeRefactoringProvider.cs (1)
27protected abstract bool IsValid(TExpressionStatementSyntax expressionStatement, TextSpan span);
IntroduceVariable\AbstractIntroduceVariableService.cs (1)
65TextSpan textSpan,
IntroduceVariable\AbstractIntroduceVariableService.State.cs (2)
54TextSpan textSpan, 68TextSpan textSpan,
IntroduceVariable\IIntroduceVariableService.cs (1)
18Task<CodeAction> IntroduceVariableAsync(Document document, TextSpan textSpan, CodeCleanupOptions options, CancellationToken cancellationToken);
InvertConditional\AbstractInvertConditionalCodeRefactoringProvider.cs (1)
40Document document, TextSpan span, CancellationToken cancellationToken)
LineSeparators\ILineSeparatorService.cs (2)
15Task<ImmutableArray<TextSpan>> GetLineSeparatorsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken);
MoveStaticMembers\AbstractMoveStaticMembersRefactoringProvider.cs (2)
60var memberSpan = TextSpan.FromBounds(
MoveToNamespace\AbstractMoveToNamespaceService.cs (3)
29Task<ImmutableArray<AbstractMoveToNamespaceCodeAction>> GetCodeActionsAsync(Document document, TextSpan span, CodeCleanupOptionsProvider options, CancellationToken cancellationToken); 53TextSpan span, 254var moveSpan = new TextSpan(container.FullSpan.Start, 0);
NameTupleElement\AbstractNameTupleElementCodeRefactoringProvider.cs (2)
42Document document, TextSpan span, CancellationToken cancellationToken) 83private async Task<Document> AddNamedElementAsync(Document document, TextSpan span, CancellationToken cancellationToken)
NamingStyleCodeFixProvider.cs (1)
58var span = context.Span;
NavigateTo\AbstractNavigateToSearchService.InProcess.cs (1)
181using var matchedSpans = TemporaryArray<TextSpan>.Empty;
NavigateTo\INavigateToSearchResult.cs (1)
22ImmutableArray<TextSpan> NameMatchSpans { get; }
NavigateTo\NavigateToUtilities.cs (2)
29public static TextSpan GetBoundedSpan(INavigableItem item, SourceText sourceText) 42return TextSpan.FromBounds(spanStart, spanEnd);
NavigateTo\RoslynNavigateToItem.cs (4)
54public readonly ImmutableArray<TextSpan> NameMatchSpans; 67ImmutableArray<TextSpan> nameMatchSpans, 214ImmutableArray<TextSpan> INavigateToSearchResult.NameMatchSpans => _item.NameMatchSpans; 358TextSpan INavigableItem.SourceSpan => _item.DeclaredSymbolInfo.Span;
Navigation\DefaultDocumentNavigationService.cs (2)
14public Task<bool> CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) 23public Task<INavigableLocation?> GetLocationForSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken)
Navigation\IDocumentNavigationService.cs (4)
19Task<bool> CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken); 31Task<INavigableLocation?> GetLocationForSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken); 38public static Task<bool> CanNavigateToSpanAsync(this IDocumentNavigationService service, Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) 44public static Task<INavigableLocation?> GetLocationForSpanAsync(this IDocumentNavigationService service, Workspace workspace, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken)
Navigation\INavigableItem.cs (1)
37TextSpan SourceSpan { get; }
Navigation\NavigableItemFactory.SymbolLocationNavigableItem.cs (1)
44public TextSpan SourceSpan => _location.SourceSpan;
NavigationBar\AbstractNavigationBarItemService.cs (3)
44Solution solution, ISymbol symbol, SyntaxTree tree, Func<SyntaxReference, TextSpan> computeFullSpan) 51Func<SyntaxReference, TextSpan> computeFullSpan, 67var navigationLocationSpan = symbol.Locations.FirstOrDefault(loc => loc.SourceTree == tree)?.SourceSpan ??
NavigationBar\NavigationBarItems\RoslynNavigationBarItem.SymbolItem.cs (6)
76public readonly (ImmutableArray<TextSpan> spans, TextSpan navigationSpan)? InDocumentInfo; 86public readonly (DocumentId documentId, TextSpan navigationSpan)? OtherDocumentInfo; 89(ImmutableArray<TextSpan> spans, TextSpan navigationSpan)? inDocumentInfo, 90(DocumentId documentId, TextSpan navigationSpan)? otherDocumentInfo)
PasteTracking\IPasteTrackingService.cs (1)
13bool TryGetPastedTextSpan(SourceTextContainer sourceTextContainer, out TextSpan textSpan);
PullMemberUp\AbstractPullMemberUpRefactoringProvider.cs (2)
69var memberSpan = TextSpan.FromBounds(
QuickInfo\IndentationHelper.cs (6)
43var span = classifiedSpan.TextSpan; 53var deletion = TextSpan.FromBounds(line.Start, line.Start + lineOffsetOfColumn); 57var spanBeforeDeletion = TextSpan.FromBounds(span.Start, Math.Min(span.End, deletion.Start)); 66span = TextSpan.FromBounds(Math.Min(deletion.End, span.End), span.End);
QuickInfo\QuickInfoItem.cs (7)
15public TextSpan Span { get; } 31public ImmutableArray<TextSpan> RelatedSpans { get; } 34TextSpan span, 37ImmutableArray<TextSpan> relatedSpans) 42RelatedSpans = relatedSpans.IsDefault ? ImmutableArray<TextSpan>.Empty : relatedSpans; 46TextSpan span, 49ImmutableArray<TextSpan> relatedSpans = default)
QuickInfo\QuickInfoUtilities.cs (2)
24public static Task<QuickInfoItem> CreateQuickInfoItemAsync(SolutionServices services, SemanticModel semanticModel, TextSpan span, ImmutableArray<ISymbol> symbols, SymbolDescriptionOptions options, CancellationToken cancellationToken) 30TextSpan span,
ReplaceDocCommentTextWithTag\AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (8)
42var singleWordSpan = ExpandSpan(sourceText, span, fullyQualifiedName: false); 64var fullyQualifiedSpan = ExpandSpan(sourceText, span, fullyQualifiedName: true); 111CodeRefactoringContext context, SemanticModel semanticModel, SyntaxToken token, TextSpan replacementSpan, CancellationToken cancellationToken) 142CodeRefactoringContext context, TextSpan expandedSpan, string replacement) 153Document document, TextSpan span, string replacement, CancellationToken cancellationToken) 161private static TextSpan ExpandSpan(SourceText sourceText, TextSpan span, bool fullyQualifiedName) 182return TextSpan.FromBounds(startInclusive, endExclusive);
Shared\Naming\IdentifierNameParts.cs (3)
32using var parts = TemporaryArray<TextSpan>.Empty; 76private static ImmutableArray<string> CreateWords(in TemporaryArray<TextSpan> parts, string name) 79foreach (var part in parts)
SignatureHelp\AbstractSignatureHelpProvider.cs (2)
40IList<SignatureHelpItem> items, TextSpan applicableSpan, SignatureHelpState? state, int? selectedItemIndex, int parameterIndexOverride) 72IList<SignatureHelpItem> items, TextSpan applicableSpan, SignatureHelpState? state)
SignatureHelp\CommonSignatureHelpUtilities.cs (4)
72internal static TextSpan GetSignatureHelpSpan<TArgumentList>( 80internal static TextSpan GetSignatureHelpSpan<TArgumentList>( 89return TextSpan.FromBounds(start, closeToken.SpanStart); 100return TextSpan.FromBounds(start, nextToken.SpanStart);
SignatureHelp\SignatureHelpItems.cs (2)
26public TextSpan ApplicableSpan { get; } 59TextSpan applicableSpan,
SimplifyTypeNames\AbstractSimplifyTypeNamesCodeFixProvider.cs (4)
45SyntaxNode root, SemanticModel model, TextSpan span, 78var span = context.Span; 124private bool CanSimplifyTypeNameExpression(SemanticModel model, SyntaxNode node, TSimplifierOptions options, TextSpan span, out string diagnosticId, CancellationToken cancellationToken) 129model, node, options, out var issueSpan, out diagnosticId, out _, cancellationToken))
SimplifyTypeNamesDiagnosticAnalyzerBase.cs (9)
76out TextSpan issueSpan, out string diagnosticId, out bool inDeclaration, 111protected abstract ImmutableArray<Diagnostic> AnalyzeSemanticModel(SemanticModelAnalysisContext context, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? codeBlockIntervalTree); 117out var issueSpan, out var diagnosticId, out var inDeclaration, 134internal static Diagnostic CreateDiagnostic(SemanticModel model, TSimplifierOptions options, TextSpan issueSpan, string diagnosticId, bool inDeclaration) 205/// indicate that <c>intervalTree</c> may be updated by adding a new non-overlapping <see cref="TextSpan"/> 221private readonly ConcurrentDictionary<SyntaxTree, (StrongBox<bool> completed, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? intervalTree)> _codeBlockIntervals 232var (completed, intervalTree) = _codeBlockIntervals.GetOrAdd(context.CodeBlock.SyntaxTree, _ => (new StrongBox<bool>(false), SimpleIntervalTree.Create(new TextSpanIntervalIntrospector(), Array.Empty<TextSpan>()))); 251static bool TryProceedWithInterval(bool addIfAvailable, TextSpan span, StrongBox<bool> completed, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector> intervalTree)
Snippets\RoslynLSPSnippetConverter.cs (3)
113var extendedSpan = GetUpdatedTextSpan(textChange, placeholders, caretPosition, triggerLocation); 126private static TextSpan GetUpdatedTextSpan(TextChange textChange, ImmutableArray<SnippetPlaceholder> placeholders, int caretPosition, int triggerLocation) 145return TextSpan.FromBounds(startPosition, endPosition);
Snippets\SnippetFunctionService.cs (9)
38public static async Task<string?> GetSimplifiedTypeNameAsync(Document document, TextSpan fieldSpan, string fullyQualifiedTypeName, SimplifierOptions simplifierOptions, CancellationToken cancellationToken) 41var updatedTextSpan = new TextSpan(fieldSpan.Start, fullyQualifiedTypeName.Length); 56public async Task<string?> GetSwitchExpansionAsync(Document document, TextSpan caseGenerationLocation, TextSpan switchExpressionLocation, SimplifierOptions simplifierOptions, CancellationToken cancellationToken) 120protected abstract Task<ITypeSymbol?> GetEnumSymbolAsync(Document document, TextSpan switchExpressionSpan, CancellationToken cancellationToken); 122protected abstract Task<(Document, TextSpan)> GetDocumentWithEnumCaseAsync(Document document, string fullyQualifiedTypeName, string firstEnumMemberName, TextSpan caseGenerationLocation, CancellationToken cancellationToken); 128TextSpan caseGenerationLocation, 140private static async Task<string?> GetSimplifiedTypeNameAtSpanAsync(Document documentWithFullyQualifiedTypeName, TextSpan fullyQualifiedTypeSpan, SimplifierOptions simplifierOptions, CancellationToken cancellationToken)
Snippets\SnippetProviders\AbstractConsoleSnippetProvider.cs (2)
77return new TextChange(TextSpan.FromBounds(position, position), expressionStatement.NormalizeWhitespace().ToFullString()); 148var closestNode = root.FindNode(TextSpan.FromBounds(position, position));
Snippets\SnippetProviders\AbstractConstructorSnippetProvider.cs (2)
36var nodeAtPosition = root.FindNode(TextSpan.FromBounds(position, position)); 42return ImmutableArray.Create(new TextChange(TextSpan.FromBounds(position, position), constructorDeclaration.NormalizeWhitespace().ToFullString()));
Snippets\SnippetProviders\AbstractForEachLoopSnippetProvider.cs (1)
35var snippetTextChange = new TextChange(TextSpan.FromBounds(position, position), forEachStatementSyntax.NormalizeWhitespace().ToFullString());
Snippets\SnippetProviders\AbstractIfSnippetProvider.cs (1)
29return new TextChange(TextSpan.FromBounds(position, position), ifStatement.ToFullString());
Snippets\SnippetProviders\AbstractPropertySnippetProvider.cs (1)
26return ImmutableArray.Create(new TextChange(TextSpan.FromBounds(position, position), propertyDeclaration.NormalizeWhitespace().ToFullString()));
Snippets\SnippetProviders\AbstractSnippetProvider.cs (1)
242var closestNode = root.FindNode(TextSpan.FromBounds(position, position), getInnermostNodeForTie: true);
Snippets\SnippetProviders\AbstractTypeSnippetProvider.cs (1)
28var snippetTextChange = new TextChange(TextSpan.FromBounds(position, position), typeDeclaration.NormalizeWhitespace().ToFullString());
Snippets\SnippetProviders\AbstractWhileLoopSnippetProvider.cs (1)
25return new TextChange(TextSpan.FromBounds(position, position), whileStatement.ToFullString());
Snippets\SnippetUtilities.cs (2)
12public static bool TryGetWordOnLeft(int position, SourceText currentText, ISyntaxFactsService syntaxFactsService, [NotNullWhen(true)] out TextSpan? wordSpan) 35wordSpan = TextSpan.FromBounds(startPosition, endPosition);
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (1)
45var span = context.Span;
SpellCheck\SpellCheckSpan.cs (1)
10TextSpan TextSpan,
SplitOrMergeIfStatements\AbstractMergeIfStatementsCodeRefactoringProvider.cs (6)
23protected abstract bool IsApplicableSpan(SyntaxNode node, TextSpan span, out SyntaxNode ifOrElseIf); 53void RegisterRefactoring(MergeDirection direction, TextSpan upperIfOrElseIfSpan, TextSpan lowerIfOrElseIfSpan) 65private async Task<Document> RefactorAsync(Document document, TextSpan upperIfOrElseIfSpan, TextSpan lowerIfOrElseIfSpan, CancellationToken cancellationToken) 80static SyntaxNode FindIfOrElseIf(TextSpan span, IIfLikeStatementGenerator ifGenerator, SyntaxNode root)
SplitOrMergeIfStatements\AbstractSplitIfStatementCodeRefactoringProvider.cs (2)
60private async Task<Document> RefactorAsync(Document document, TextSpan tokenSpan, TextSpan ifOrElseIfSpan, CancellationToken cancellationToken)
StackTraceExplorer\StackTraceAnalyzer.cs (3)
85yield return callstack.GetSubSequence(TextSpan.FromBounds(position, i)); 94yield return callstack.GetSubSequence(TextSpan.FromBounds(position, callstack.Length)); 118return virtualChars.GetSubSequence(TextSpan.FromBounds(start, end + 1));
StackTraceExplorer\VSDebugCallstackParser.cs (1)
40var textToParse = line.GetSubSequence(TextSpan.FromBounds(startPoint, line.Length));
StringIndentation\IStringIndentationService.cs (5)
16Task<ImmutableArray<StringIndentationRegion>> GetStringIndentationRegionsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); 56public readonly TextSpan IndentSpan; 110public readonly ImmutableArray<TextSpan> OrderedHoleSpans; 112public StringIndentationRegion(TextSpan indentSpan, ImmutableArray<TextSpan> holeSpans = default)
Structure\BlockSpan.cs (9)
23public TextSpan TextSpan { get; } 28public TextSpan HintSpan { get; } 51string type, bool isCollapsible, TextSpan textSpan, string bannerText = Ellipses, bool autoCollapse = false, bool isDefaultCollapsed = false) 57string type, bool isCollapsible, TextSpan textSpan, TextSpan hintSpan, string bannerText = Ellipses, bool autoCollapse = false, bool isDefaultCollapsed = false) 83Optional<TextSpan> textSpan = default, 84Optional<TextSpan> hintSpan = default, 91var newTextSpan = textSpan.HasValue ? textSpan.Value : TextSpan; 92var newHintSpan = hintSpan.HasValue ? hintSpan.Value : HintSpan;
TaskList\AbstractTaskListService.cs (2)
130var fullSpan = trivia.FullSpan; 145var startMessage = text.ToString(TextSpan.FromBounds(fullSpan.Start, startLine.End));
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
311ISet<(string filePath, TextSpan span)> constructorSpans,
ValueTracking\IValueTrackingService.cs (2)
16Task<ImmutableArray<ValueTrackedItem>> TrackValueSourceAsync(TextSpan selection, Document document, CancellationToken cancellationToken); 22ValueTask<ImmutableArray<SerializableValueTrackedItem>> TrackValueSourceAsync(Checksum solutionChecksum, TextSpan selection, DocumentId document, CancellationToken cancellationToken);
ValueTracking\SerializableValueTrackedItem.cs (2)
21public TextSpan TextSpan { get; } 31TextSpan textSpan,
ValueTracking\ValueTrackedItem.cs (2)
23public TextSpan Span { get; } 30TextSpan textSpan,
ValueTracking\ValueTracker.cs (2)
21TextSpan selection, 256private static async Task<(ISymbol?, SyntaxNode?)> GetSelectedSymbolAsync(TextSpan textSpan, Document document, CancellationToken cancellationToken)
ValueTracking\ValueTracker.FindReferencesProgress.cs (2)
143var span = referenceLocation.Location.SourceSpan; 166var span = referenceLocation.Location.SourceSpan;
ValueTracking\ValueTrackingService.cs (1)
29TextSpan selection,
Wrapping\AbstractCodeActionComputer.cs (6)
93new TextChange(TextSpan.FromBounds(nodeOrToken.Span.End + newLine.Length, newSourceText.Length), "")); 165private async Task<Document> FormatDocumentAsync(SyntaxNode rewrittenRoot, TextSpan spanToFormat) 173private async Task<(SyntaxNode root, SyntaxNode rewrittenRoot, TextSpan spanToFormat)> RewriteTreeAsync(ImmutableArray<Edit> edits) 180var span = TextSpan.FromBounds(edit.Left.Span.End, edit.Right.Span.Start); 221private async Task<(SyntaxNode root, SyntaxNode rewrittenRoot, TextSpan spanToFormat)> RewriteTreeAsync(
Wrapping\AbstractWrapper.cs (1)
66protected static bool ContainsOverlappingSyntaxErrror(SyntaxNode declaration, TextSpan headerSpan)
Microsoft.CodeAnalysis.LanguageServer.Protocol (130)
Extensions\ProtocolConversions.cs (8)
195public static TextSpan RangeToTextSpan(LSP.Range range, SourceText text) 229public static LSP.Range TextSpanToRange(TextSpan textSpan, SourceText text) 323TextSpan textSpan, 332TextSpan textSpan, 357TextSpan span, 372span = TextSpan.FromBounds( 380static LSP.Location ConvertTextSpanWithTextToLocation(TextSpan span, SourceText text, Uri documentUri) 805private static async Task<ImmutableArray<MappedSpanResult>?> GetMappedSpanResultAsync(TextDocument textDocument, ImmutableArray<TextSpan> textSpans, CancellationToken cancellationToken)
Features\CodeCleanup\AbstractCodeCleanupService.cs (2)
176var textSpan = new TextSpan(0, tree.Length); 197var range = new TextSpan(0, tree.Length);
Features\CodeFixes\CodeFixService.cs (17)
100TextDocument document, TextSpan range, CodeActionRequestPriority priority, CodeActionOptionsProvider fallbackOptions, bool isBlocking, CancellationToken cancellationToken) 115var spanToErrorDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>>(); 116var spanToOtherDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>>(); 142SortedDictionary<TextSpan, List<DiagnosticData>> spanToDiagnostics, 159TextSpan range, 227private static SortedDictionary<TextSpan, List<DiagnosticData>> ConvertToMap( 234var spanToDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>>(); 252TextDocument document, TextSpan range, string diagnosticId, CodeActionOptionsProvider fallbackOptions, CancellationToken cancellationToken) 256TextDocument document, TextSpan range, string diagnosticId, DiagnosticSeverity minimumSeverity, CodeActionOptionsProvider fallbackOptions, CancellationToken cancellationToken) 267var spanToDiagnostics = new SortedDictionary<TextSpan, List<DiagnosticData>> 302var textSpan = new TextSpan(0, text.Length); 401SortedDictionary<TextSpan, List<DiagnosticData>> spanToDiagnostics, 423using var _1 = PooledDictionary<CodeFixProvider, List<(TextSpan range, List<DiagnosticData> diagnostics)>>.GetInstance(out var fixerToRangesAndDiagnostics); 535TextSpan range, 568TextDocument document, TextSpan span, CodeFixProvider fixer, CodeChangeProviderMetadata? fixerMetadata, CodeActionOptionsProvider fallbackOptions, bool isBlocking, 651TextSpan diagnosticsSpan, 688TextSpan fixesSpan,
Features\CodeFixes\CodeFixService.FixAllDiagnosticProvider.cs (1)
53public override async Task<IEnumerable<Diagnostic>> GetDocumentSpanDiagnosticsAsync(Document document, TextSpan fixAllSpan, CancellationToken cancellationToken)
Features\CodeFixes\ICodeFixService.cs (7)
19IAsyncEnumerable<CodeFixCollection> StreamFixesAsync(TextDocument document, TextSpan textSpan, CodeActionRequestPriority priority, CodeActionOptionsProvider options, bool isBlocking, Func<string, IDisposable?> addOperationScope, CancellationToken cancellationToken); 26Task<FirstFixResult> GetMostSevereFixAsync(TextDocument document, TextSpan range, CodeActionRequestPriority priority, CodeActionOptionsProvider fallbackOptions, bool isBlocking, CancellationToken cancellationToken); 28Task<CodeFixCollection?> GetDocumentFixAllForIdInSpanAsync(TextDocument document, TextSpan textSpan, string diagnosticId, DiagnosticSeverity severity, CodeActionOptionsProvider fallbackOptions, CancellationToken cancellationToken); 36public static IAsyncEnumerable<CodeFixCollection> StreamFixesAsync(this ICodeFixService service, TextDocument document, TextSpan range, CodeActionOptionsProvider fallbackOptions, bool isBlocking, CancellationToken cancellationToken) 39public static Task<ImmutableArray<CodeFixCollection>> GetFixesAsync(this ICodeFixService service, TextDocument document, TextSpan range, CodeActionOptionsProvider fallbackOptions, bool isBlocking, CancellationToken cancellationToken) 42public static Task<ImmutableArray<CodeFixCollection>> GetFixesAsync(this ICodeFixService service, TextDocument document, TextSpan textSpan, CodeActionRequestPriority priority, CodeActionOptionsProvider fallbackOptions, bool isBlocking, Func<string, IDisposable?> addOperationScope, CancellationToken cancellationToken) 45public static Task<CodeFixCollection?> GetDocumentFixAllForIdInSpanAsync(this ICodeFixService service, TextDocument document, TextSpan range, string diagnosticId, CodeActionOptionsProvider fallbackOptions, CancellationToken cancellationToken)
Features\Diagnostics\DiagnosticAnalyzerService.cs (2)
73TextSpan range, 99TextSpan? range,
Features\Diagnostics\DocumentAnalysisExecutor.cs (5)
195private async Task<ImmutableArray<DiagnosticData>> GetCompilerAnalyzerDiagnosticsAsync(DiagnosticAnalyzer analyzer, TextSpan? span, CancellationToken cancellationToken) 278async Task<TextSpan?> GetAdjustedSpanForCompilerAnalyzerAsync() 307var startSpan = service.IsMethodLevelMember(startNode) ? startNode.FullSpan : span.Value; 308var endSpan = service.IsMethodLevelMember(endNode) ? endNode.FullSpan : span.Value; 310return TextSpan.FromBounds(Math.Min(startSpan.Start, endSpan.Start), Math.Max(startSpan.End, endSpan.End));
Features\Diagnostics\DocumentAnalysisExecutor_Helpers.cs (1)
389public static IEnumerable<DiagnosticData> ConvertToLocalDiagnostics(IEnumerable<Diagnostic> diagnostics, TextDocument targetTextDocument, TextSpan? span = null)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer.cs (12)
130ImmutableArray<TextSpan> oldMemberSpans, 137var span = spanBased ? changedMember.FullSpan : (TextSpan?)null; 145ImmutableArray<TextSpan> oldMemberSpans, 157ImmutableArray<TextSpan> oldMemberSpans, 170ImmutableArray<TextSpan> oldMemberSpans, 200private async Task<(SyntaxNode changedMember, int changedMemberId, ImmutableArray<TextSpan> memberSpans, Document lastDocument)?> TryGetChangedMemberAsync( 240ImmutableArray<TextSpan> oldMemberSpans, 287ImmutableArray<TextSpan> oldMemberSpans, 296var oldSpan = oldMemberSpans[memberId]; 331var diagnosticSpan = diagnostic.DataLocation.UnmappedFileSpan.GetClampedTextSpan(text); 383var diagnosticSpan = location.UnmappedFileSpan.GetClampedTextSpan(text); 385var newSpan = new TextSpan(start, start >= tree.Length ? 0 : diagnosticSpan.Length);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer_MemberSpans.cs (4)
22private readonly record struct MemberSpans(DocumentId DocumentId, VersionStamp Version, ImmutableArray<TextSpan> Spans); 27private async Task<ImmutableArray<TextSpan>> GetOrCreateMemberSpansAsync(Document document, VersionStamp version, CancellationToken cancellationToken) 44static async Task<ImmutableArray<TextSpan>> CreateMemberSpansAsync(Document document, VersionStamp version, CancellationToken cancellationToken) 53private void SaveMemberSpans(DocumentId documentId, VersionStamp version, ImmutableArray<TextSpan> memberSpans)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs (6)
25TextDocument document, TextSpan? range, ArrayBuilder<DiagnosticData> result, Func<string, bool>? shouldIncludeDiagnostic, 37TextSpan? range, 72private readonly TextSpan? _range; 88TextSpan? range, 156TextSpan? range, 312TextSpan? span,
Features\UnifiedSuggestions\UnifiedSuggestedActionSet.cs (2)
27public TextSpan? ApplicableToSpan { get; } 35TextSpan? applicableToSpan)
Features\UnifiedSuggestions\UnifiedSuggestedActionSetComparer.cs (6)
15private readonly TextSpan? _targetSpan; 17public UnifiedSuggestedActionSetComparer(TextSpan? targetSpan) 20private static int Distance(TextSpan? maybeA, TextSpan? maybeB) 28var a = maybeA.Value; 29var b = maybeB.Value;
Features\UnifiedSuggestions\UnifiedSuggestedActionsSource.cs (15)
38TextSpan selection, 347static (TextSpan? span, string category) CombineSpansAndCategory(ArrayBuilder<UnifiedSuggestedActionSet> sets) 384var combinedSpan = minStart >= 0 ? TextSpan.FromBounds(minStart, maxEnd) : (TextSpan?)null; 440TextSpan selection, 471TextSpan selection, 477TextSpan selection, 487bool IsActionAndSpanApplicable((CodeAction action, TextSpan? applicableSpan) actionAndSpan) 515TextSpan selection, 547async Task<IUnifiedSuggestedAction> GetUnifiedSuggestedActionSetAsync(CodeAction codeAction, TextSpan? applicableToSpan, TextSpan selection, CancellationToken cancellationToken) 589TextSpan selection, 651TextSpan? selectionOpt, 670TextSpan? selectionOpt, 714ImmutableArray<UnifiedSuggestedActionSet> actionSets, TextSpan? selectionOpt)
Handler\Breakpoints\ValidateBreakableRangeHandler.cs (2)
40var span = ProtocolConversions.RangeToTextSpan(request.Range, text); 81var breakpointSpan = result.IsLineBreakpoint ? new TextSpan(span.Start, length: 0) : result.TextSpan;
Handler\CodeActions\CodeActionHelpers.cs (1)
241var textSpan = ProtocolConversions.RangeToTextSpan(selection, text);
Handler\Completion\CompletionHandler.cs (3)
112var defaultSpan = completionChange.TextChange.Span; 309var completionListSpan = completionService.GetDefaultCompletionListSpan(sourceText, position); 367TextSpan completionListSpan,
Handler\Completion\CompletionResolveHandler.cs (1)
146var completionChangeSpan = completionChange.TextChange.Span;
Handler\Completion\ILspCompletionResultCreationService.cs (4)
25TextSpan defaultSpan, 44TextSpan defaultSpan, 60TextSpan defaultSpan, 69var completionChangeSpan = completionChange.TextChange.Span;
Handler\Formatting\AbstractFormatDocumentHandlerBase.cs (2)
38var rangeSpan = (range != null) ? ProtocolConversions.RangeToTextSpan(range, text) : new TextSpan(0, root.FullSpan.Length); 39var formattingSpan = CommonFormattingHelpers.GetFormattingSpan(root, rangeSpan);
Handler\Highlights\DocumentHighlightHandler.cs (1)
74var keywordSpans = new List<TextSpan>();
Handler\InlineCompletions\InlineCompletionsHandler.cs (21)
130TextSpan snippetShortcut, 148var spanToFormat = TextSpan.FromBounds(textChange.Span.Start, snippetEndPosition); 161var spanContainingFormattedSnippet = TextSpan.FromBounds(snippetShortcut.Start, snippetEndPosition); 168foreach (var span in spans) 171var fieldInFormattedText = GetAdjustedSpan(formattingChanges, span); 172var fieldInSnippetContext = GetTextSpanInContextOfSnippet(fieldInFormattedText.Start, spanContainingFormattedSnippet.Start, fieldInFormattedText.Length); 180var caretInFormattedText = GetAdjustedSpan(formattingChanges, caretSpan.Value); 181var caretInSnippetContext = GetTextSpanInContextOfSnippet(caretInFormattedText.Start, spanContainingFormattedSnippet.Start, caretInFormattedText.Length); 190static TextSpan GetAdjustedSpan(ImmutableArray<TextChange> textChanges, TextSpan originalSpan) 197static TextSpan GetTextSpanInContextOfSnippet(int positionInFullText, int snippetPositionInFullText, int length) 199var offsetInSnippet = new TextSpan(positionInFullText - snippetPositionInFullText, length); 208private static async Task<(string ReplacedSnippetText, ImmutableDictionary<SnippetFieldPart, ImmutableArray<TextSpan>> Fields, TextSpan? CaretSpan)> GetReplacedSnippetTextAsync( 211TextSpan snippetSpan, 223var fieldOffsets = new Dictionary<SnippetFieldPart, ImmutableArray<TextSpan>>(); 225TextSpan? caretSpan = null; 248var fieldSpan = new TextSpan(locationInFinalSnippet, part.DefaultText.Length); 249fieldOffsets[fieldPart] = fieldOffsets.GetValueOrDefault(fieldPart, ImmutableArray<TextSpan>.Empty).Add(fieldSpan);
Handler\InlineCompletions\XmlSnippetParser.ParsedXmlSnippet.cs (1)
44public async Task<SnippetFunctionPart> WithSnippetFunctionResultAsync(Document documentWithSnippet, TextSpan fieldSpan, SimplifierOptions simplifierOptions, CancellationToken cancellationToken)
Handler\References\FindUsagesLSPContext.cs (1)
67private readonly HashSet<(string? filePath, TextSpan span)> _referenceLocations = new();
Handler\SemanticTokens\SemanticTokensHelpers.cs (5)
86var textSpan = range is null ? root.FullSpan : ProtocolConversions.RangeToTextSpan(range, text); 102TextSpan textSpan, 187TextSpan textSpan; 198textSpan = TextSpan.FromBounds(Math.Min(absoluteStart, line.End), line.End); 281var originalTextSpan = classifiedSpan.TextSpan;
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (4)
Diagnostics\AdditionalFileDiagnosticsTests.cs (1)
152location: Location.Create(context.AdditionalFile.Path, Text.TextSpan.FromBounds(0, 0), new Text.LinePositionSpan(new Text.LinePosition(0, 0), new Text.LinePosition(0, 0))), "args"));
SpellCheck\SpellCheckTests.cs (3)
184{|Comment:// comment|}", out _, out IDictionary<string, ImmutableArray<TextSpan>> annotatedSpans); 480{|Comment:// comment|}", out _, out IDictionary<string, ImmutableArray<TextSpan>> annotatedSpans); 527private static VSInternalSpellCheckableRange[] GetRanges(SourceText sourceText, IDictionary<string, ImmutableArray<TextSpan>> annotatedSpans)
Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator (1)
Graph\Range.cs (1)
25public static Range FromTextSpan(TextSpan textSpan, SourceText sourceText, IdFactory idFactory)
Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests (1)
Utilities\TestLsifOutput.vb (1)
86Private Async Function GetRangesAsync(selector As Func(Of TestHostDocument, IEnumerable(Of TextSpan))) As Task(Of IEnumerable(Of Graph.Range))
Microsoft.CodeAnalysis.Remote.ServiceHub (18)
Services\CodeLensReferences\RemoteCodeLensReferencesService.cs (5)
28private static async ValueTask<SyntaxNode?> TryFindNodeAsync(Solution solution, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) 43public async ValueTask<ReferenceCount?> GetReferenceCountAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, int maxResultCount, CancellationToken cancellationToken) 66public async ValueTask<ImmutableArray<ReferenceLocationDescriptor>?> FindReferenceLocationsAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) 84public async ValueTask<ImmutableArray<ReferenceMethodDescriptor>?> FindReferenceMethodsAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken) 102public ValueTask<string?> GetFullyQualifiedNameAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan textSpan, CancellationToken cancellationToken)
Services\ConvertTupleToStructCodeRefactoringProvider\RemoteConvertTupleToStructCodeRefactoringService.cs (2)
45TextSpan span, 70private static async Task<(DocumentId, TextSpan)> GetRenamedTokenAsync(
Services\DiagnosticAnalyzer\DiagnosticComputer.cs (3)
52private readonly TextSpan? _span; 63TextSpan? span, 84TextSpan? span,
Services\FullyQualify\RemoteFullyQualifyService.cs (1)
28public ValueTask<FullyQualifyFixData?> GetFixDataAsync(Checksum solutionChecksum, DocumentId documentId, TextSpan span, bool hideAdvancedMembers, CancellationToken cancellationToken)
Services\InheritanceMargin\RemoteInheritanceMarginService.cs (1)
31TextSpan spanToSearch,
Services\MissingImportDiscovery\RemoteMissingImportDiscoveryService.cs (2)
36TextSpan span, 64TextSpan span,
Services\SemanticClassification\RemoteSemanticClassificationService.Caching.cs (1)
83DocumentKey documentKey, TextSpan textSpan, ClassificationType type, Checksum checksum, CancellationToken cancellationToken)
Services\SemanticClassification\RemoteSemanticClassificationService.cs (1)
26TextSpan span,
Services\SymbolFinder\RemoteSymbolFinderService.cs (1)
189public ValueTask OnReferenceFoundAsync(Document document, TextSpan span, CancellationToken cancellationToken)
Services\ValueTracking\RemoteValueTrackingService.cs (1)
28public ValueTask<ImmutableArray<SerializableValueTrackedItem>> TrackValueSourceAsync(Checksum solutionChecksum, TextSpan selection, DocumentId documentId, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Test.Utilities (34)
Diagnostics\CommonDiagnosticAnalyzers.cs (4)
798private readonly TextSpan _badSpan; 808public AnalyzerWithInvalidDiagnosticSpan(TextSpan badSpan) => _badSpan = badSpan; 2449private readonly TextSpan _diagnosticSpan; 2451public AdditionalFileAnalyzer(bool registerFromInitialize, TextSpan diagnosticSpan, string id = "ID0001")
Diagnostics\DiagnosticsHelper.cs (1)
18private static TextSpan FindSpan(string source, string pattern)
Diagnostics\SuppressMessageAttributeTests.cs (1)
1395MarkupTestFile.GetSpans(markup, out var source, out ImmutableArray<TextSpan> spans);
Diagnostics\SuppressMessageAttributeTests.DiagnosticAnalyzers.cs (2)
224private readonly IList<TextSpan> _spans; 226public WarningOnTokenAnalyzer(IList<TextSpan> spans)
MarkedSource\MarkupTestFile.cs (19)
53string input, out string output, out int? position, out IDictionary<string, ArrayBuilder<TextSpan>> spans) 56var tempSpans = new Dictionary<string, ArrayBuilder<TextSpan>>(); 191IDictionary<string, ArrayBuilder<TextSpan>> spans, 196var span = TextSpan.FromBounds(matchIndex, finalIndex); 197GetOrAdd(spans, name, _ => ArrayBuilder<TextSpan>.GetInstance()).Add(span); 210string input, out string output, out int? cursorPositionOpt, out ImmutableArray<TextSpan> spans) 214var builder = GetOrAdd(dictionary, string.Empty, _ => ArrayBuilder<TextSpan>.GetInstance()); 220string input, out string output, out int? cursorPositionOpt, out IDictionary<string, ImmutableArray<TextSpan>> spans) 226public static void GetSpans(string input, out string output, out IDictionary<string, ImmutableArray<TextSpan>> spans) 229public static void GetPositionAndSpans(string input, out string output, out int cursorPosition, out ImmutableArray<TextSpan> spans) 236=> GetPositionAndSpans(input, out output, out cursorPosition, out ImmutableArray<TextSpan> spans); 241public static void GetPositionAndSpan(string input, out string output, out int? cursorPosition, out TextSpan? textSpan) 243GetPositionAndSpans(input, out output, out cursorPosition, out ImmutableArray<TextSpan> spans); 244textSpan = spans.Length == 0 ? null : (TextSpan?)spans.Single(); 247public static void GetPositionAndSpan(string input, out string output, out int cursorPosition, out TextSpan textSpan) 253public static void GetSpans(string input, out string output, out ImmutableArray<TextSpan> spans) 258public static void GetSpan(string input, out string output, out TextSpan textSpan) 260GetSpans(input, out output, out ImmutableArray<TextSpan> spans);
MarkedSource\SourceWithMarkedNodes.cs (2)
32public readonly ImmutableArray<ValueTuple<TextSpan, int, int>> SpansAndKindsAndIds; 120private SyntaxNode GetNode(SyntaxNode root, ValueTuple<TextSpan, int, int> spanAndKindAndId)
MarkedSource\SourceWithMarkedNodes.MarkedSpan.cs (4)
15public readonly TextSpan MarkedSyntax; 16public readonly TextSpan MatchedSpan; 22public MarkedSpan(TextSpan markedSyntax, TextSpan matchedSpan, string tagName, int syntaxKind, int id, int parentId)
Metadata\ILValidation.cs (1)
420var span = text.Lines.GetTextSpan(lineSpan);
Microsoft.CodeAnalysis.UnitTests (69)
CommonSyntaxTests.cs (6)
53Assert.Equal(default(TextSpan), d.FullSpan); 54Assert.Equal(default(TextSpan), d.Span); 70Assert.Equal(default(TextSpan), d.FullSpan); 71Assert.Equal(default(TextSpan), d.Span); 119var correctSpan = csharpTrivia.Span; 156var correctSpan = vbTrivia.Span;
Diagnostics\SarifErrorLoggerTests.cs (1)
35var span = new TextSpan(0, 0);
Diagnostics\SuppressMessageTargetSymbolResolverTests.cs (2)
1339out var source, out var pos, out IDictionary<string, ImmutableArray<TextSpan>> spans); 1356foreach (var span in spans.Values.First())
Text\SourceTextTests.cs (5)
181var span = new TextSpan(0, 1); 325sourceText.Write(writer, TextSpan.FromBounds(1, sourceText.Length)); 338public void WriteWithAllRanges(TextSpan span) 353SourceText.From("ABC").Write(TextWriter.Null, TextSpan.FromBounds(4, 4))); 362SourceText.From("ABC").Write(TextWriter.Null, TextSpan.FromBounds(2, 4)));
Text\StringText_LineTest.cs (5)
20var span = new TextSpan(0, 3); 31var span = TextSpan.FromBounds(0, text.Length); 42var span = TextSpan.FromBounds(0, text.Length);
Text\TextChangeRangeTest.cs (1)
26var span = new TextSpan(2, 50);
Text\TextSpanTest.cs (49)
21var span = new TextSpan(0, 42); 30var span = new TextSpan(1, 40); 42var span = new TextSpan(0, 0); 50var s1 = new TextSpan(1, 40); 51var s2 = new TextSpan(1, 40); 64var s1 = new TextSpan(1, 40); 65var s2 = new TextSpan(2, 40); 78var s1 = new TextSpan(1, 5); 79var s2 = new TextSpan(1, 40); 89TextSpan span = new TextSpan(0, 0); 100TextSpan span = new TextSpan(0, 1); 112TextSpan span = new TextSpan(15, 1485); 122TextSpan span = new TextSpan(0, int.MaxValue - 1); 131TextSpan span = new TextSpan(0, 10); 141TextSpan span_05_15 = new TextSpan(5, 10); 142TextSpan span_03_10 = new TextSpan(3, 7); 143TextSpan span_10_11 = new TextSpan(10, 1); 144TextSpan span_00_03 = new TextSpan(0, 3); 201TextSpan span1 = new TextSpan(0, 10); 202TextSpan span2 = new TextSpan(0, 10); 218TextSpan span1 = new TextSpan(0, 10); 219TextSpan span2 = new TextSpan(0, 11); 220TextSpan span3 = new TextSpan(1, 11); 236TextSpan span1 = new TextSpan(10, 10); // 10..20 237TextSpan span2 = new TextSpan(5, 5); // 5..10 248TextSpan span1 = new TextSpan(10, 10); // 10..20 249TextSpan span2 = new TextSpan(5, 2); // 5..7 260TextSpan span1 = new TextSpan(10, 10); // 10..20 261TextSpan span2 = new TextSpan(5, 10); // 5..15 272TextSpan span1 = new TextSpan(10, 0); // [10, 10) 273TextSpan span2 = new TextSpan(10, 0); // [10, 10) 284TextSpan span1 = new TextSpan(10, 0); // [10, 10) 285TextSpan span2 = new TextSpan(5, 10); // [5, 15) 296TextSpan span1 = new TextSpan(10, 10); // 10..20 297TextSpan span2 = new TextSpan(5, 5); // 5..10 308TextSpan span1 = new TextSpan(10, 10); // 10..20 309TextSpan span2 = new TextSpan(5, 2); // 5..7 320TextSpan span1 = new TextSpan(10, 10); // 10..20 321TextSpan span2 = new TextSpan(5, 10); // 5..15 332TextSpan span1 = new TextSpan(10, 0); // [10, 10) 333TextSpan span2 = new TextSpan(10, 0); // [10, 10) 344TextSpan span1 = new TextSpan(2, 5); // [2, 7) 345TextSpan span2 = new TextSpan(7, 5); // [7, 12) 356TextSpan span1 = new TextSpan(2, 5); // [2, 7) 357TextSpan span2 = new TextSpan(3, 0); // [3, 3) 368TextSpan span1 = new TextSpan(2, 5); // [2, 7) 369TextSpan span2 = new TextSpan(2, 0); // [2, 2) 380TextSpan span1 = new TextSpan(2, 5); // [2, 7) 381TextSpan span2 = new TextSpan(7, 0); // [7, 0)
Microsoft.CodeAnalysis.VisualBasic (158)
Analysis\FlowAnalysis\AbstractFlowPass.Regions.vb (2)
27Protected ReadOnly _region As TextSpan 52Protected Function IsInsideRegion(span As TextSpan) As Boolean
Analysis\FlowAnalysis\FlowAnalysisInfo.vb (2)
45Public ReadOnly Region As TextSpan 47Public Sub New(_firstInRegion As BoundNode, _lastInRegion As BoundNode, _region As TextSpan)
Analysis\FlowAnalysis\RegionAnalysisContext.vb (2)
31Private ReadOnly _region As TextSpan 53Friend Sub New(compilation As VisualBasicCompilation, member As Symbol, boundNode As BoundNode, firstInRegion As BoundNode, lastInRegion As BoundNode, region As textspan)
Binding\Binder.vb (1)
659Public Function GetLocation(span As TextSpan) As Location
Binding\Binder_Invocation.vb (1)
3288Private Shared Function GetCallerLocation(syntax As SyntaxNode) As TextSpan
Binding\Binder_Query.vb (11)
830Dim operatorNameLocation As TextSpan 1146Dim operatorNameLocation As TextSpan 1838Private Shared Function GetGroupByOperatorNameSpan(groupBy As GroupByClauseSyntax) As TextSpan 2269Private Shared Function GetQueryOperatorNameSpan(ByRef left As SyntaxToken, ByRef right As SyntaxToken) As TextSpan 2270Dim operatorNameSpan As TextSpan = left.Span 2273operatorNameSpan = TextSpan.FromBounds(operatorNameSpan.Start, right.Span.End) 2305operatorNameLocation As TextSpan, 2582Dim operatorNameLocation As TextSpan 4592operatorNameLocation As TextSpan, 4610operatorNameLocation As TextSpan, 4631operatorNameLocation As TextSpan,
Binding\MemberSemanticModel.vb (4)
413Public NotOverridable Overrides Function GetSyntaxDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 428Public NotOverridable Overrides Function GetDeclarationDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 443Public NotOverridable Overrides Function GetMethodBodyDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 460Public NotOverridable Overrides Function GetDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic)
CodeGen\CodeGenerator.vb (2)
298Private Function EmitSequencePoint(tree As SyntaxTree, span As TextSpan) As TextSpan
CommandLine\CommandLineDiagnosticFormatter.vb (1)
130Private Function GetDiagnosticSpanAndFileText(diagnostic As Diagnostic, <Out> ByRef text As SourceText) As TextSpan?
Compilation\ClsComplianceChecker.vb (3)
29Private ReadOnly _filterSpanWithinTree As TextSpan? 40Private Sub New(compilation As VisualBasicCompilation, filterTree As SyntaxTree, filterSpanWithinTree As TextSpan?, diagnostics As BindingDiagnosticBag, cancellationToken As CancellationToken) 72Public Shared Sub CheckCompliance(compilation As VisualBasicCompilation, diagnostics As BindingDiagnosticBag, cancellationToken As CancellationToken, Optional filterTree As SyntaxTree = Nothing, Optional filterSpanWithinTree As TextSpan? = Nothing)
Compilation\DocumentationComments\DocumentationCommentCompiler.Includes.vb (3)
33Private ReadOnly _filterSpanWithinTree As TextSpan? 48filterSpanWithinTree As TextSpan?, 157filterSpanWithinTree As TextSpan?,
Compilation\DocumentationComments\DocumentationCommentCompiler.vb (3)
28Private ReadOnly _filterSpanWithinTree As TextSpan? ' if filterTree and filterSpanWithinTree is not null, limit analysis to types residing within this span in the filterTree. 37filterTree As SyntaxTree, filterSpanWithinTree As TextSpan?, 67Optional filterSpanWithinTree As TextSpan? = Nothing)
Compilation\DocumentationComments\UnprocessedDocumentationCommentFinder.vb (4)
24Private ReadOnly _filterSpanWithinTree As TextSpan? 30filterSpanWithinTree As TextSpan?, 43Public Shared Sub ReportUnprocessed(tree As SyntaxTree, filterSpanWithinTree As TextSpan?, diagnostics As DiagnosticBag, cancellationToken As CancellationToken) 50Private Function IsSyntacticallyFilteredOut(fullSpan As TextSpan) As Boolean
Compilation\MethodCompiler.vb (2)
122Private Shared Function IsDefinedOrImplementedInSourceTree(symbol As Symbol, tree As SyntaxTree, span As TextSpan?) As Boolean 160filterSpanWithinTree As TextSpan?,
Compilation\SemanticModel.vb (1)
3515Friend Overrides Sub ComputeDeclarationsInSpan(span As TextSpan, getSymbol As Boolean, builder As ArrayBuilder(Of DeclarationInfo), cancellationToken As CancellationToken)
Compilation\SpeculativeSemanticModelWithMemberModel.vb (4)
137Public Overrides Function GetSyntaxDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 141Public Overrides Function GetDeclarationDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 145Public Overrides Function GetMethodBodyDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 149Public Overrides Function GetDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic)
Compilation\SpeculativeSyntaxTreeSemanticModel.vb (3)
113Public Overrides Function GetSyntaxDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 117Public Overrides Function GetDeclarationDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 121Public Overrides Function GetDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic)
Compilation\SyntaxTreeSemanticModel.vb (7)
93Public Overrides Function GetDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 105Public Overrides Function GetSyntaxDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 120Public Overrides Function GetDeclarationDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 135Public Overrides Function GetMethodBodyDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 1891Dim region As TextSpan = expression.Span 1907Dim region As TextSpan = TextSpan.FromBounds(firstStatement.SpanStart, lastStatement.Span.End)
Compilation\VisualBasicCompilation.vb (11)
1698Dim unusedBuilder As ArrayBuilder(Of TextSpan) = Nothing 1723unusedBuilder = ArrayBuilder(Of TextSpan).GetInstance() 1752Private Sub AddImportsDependencies(diagnostics As BindingDiagnosticBag, infoTree As SyntaxTree, clauseSpan As TextSpan) 1824Public ReadOnly StatementSpan As TextSpan 1825Public ReadOnly ClauseSpans As ImmutableArray(Of TextSpan) 1835Dim builder = ArrayBuilder(Of TextSpan).GetInstance() 2168Dim location = tree.GetLocation(TextSpan.FromBounds(0, 0)) 2201Private Sub AddClsComplianceDiagnostics(diagnostics As BindingDiagnosticBag, cancellationToken As CancellationToken, Optional filterTree As SyntaxTree = Nothing, Optional filterSpanWithinTree As TextSpan? = Nothing) 2222Private Shared Iterator Function FilterDiagnosticsByLocation(diagnostics As IEnumerable(Of Diagnostic), tree As SyntaxTree, filterSpanWithinTree As TextSpan?) As IEnumerable(Of Diagnostic) 2232filterSpanWithinTree As TextSpan?, 2286Private Sub GetDiagnosticsForMethodBodiesInTree(tree As SyntaxTree, filterSpanWithinTree As TextSpan?, hasDeclarationErrors As Boolean, diagnostics As BindingDiagnosticBag, cancellationToken As CancellationToken)
Errors\ErrorFacts.vb (1)
9''' <see cref="SemanticModel.GetDiagnostics(Text.TextSpan?, System.Threading.CancellationToken)"/> API.
Generated\BoundNodes.xml.Generated.vb (4)
2563Public Sub New(syntax As SyntaxNode, statementOpt As BoundStatement, span As TextSpan, Optional hasErrors As Boolean = False) 2577Private ReadOnly _Span As TextSpan 2578Public ReadOnly Property Span As TextSpan 2589Public Function Update(statementOpt As BoundStatement, span As TextSpan) As BoundSequencePointWithSpan
Locations\EmbeddedTreeLocation.vb (3)
17Friend ReadOnly _span As TextSpan 31Friend Overrides ReadOnly Property PossiblyEmbeddedOrMySourceSpan As TextSpan 43Public Sub New(embeddedKind As EmbeddedSymbolKind, span As TextSpan)
Locations\LocationExtensions.vb (1)
23Public Function PossiblyEmbeddedOrMySourceSpan(location As Location) As TextSpan
Locations\MyTemplateLocation.vb (3)
16Private ReadOnly _span As TextSpan 25Friend Overrides ReadOnly Property PossiblyEmbeddedOrMySourceSpan As TextSpan 37Public Sub New(tree As SyntaxTree, span As TextSpan)
Locations\VBLocation.vb (1)
23Friend Overridable ReadOnly Property PossiblyEmbeddedOrMySourceSpan As TextSpan
Lowering\Instrumentation\CodeCoverageInstrumenter.vb (5)
449Private Function AddAnalysisPoint(syntaxForSpan As SyntaxNode, alternateSpan As Text.TextSpan, statementFactory As SyntheticBoundNodeFactory) As BoundStatement 520Private Shared Function SkipAttributes(syntax As SyntaxNode) As Text.TextSpan 546Private Shared Function SkipAttributes(syntax As SyntaxNode, attributes As SyntaxList(Of AttributeListSyntax), modifiers As SyntaxTokenList, keyword As SyntaxToken) As Text.TextSpan 547Dim originalSpan As Text.TextSpan = syntax.Span 549Dim startSpan As Text.TextSpan = If(modifiers.Node IsNot Nothing, modifiers.Span, keyword.Span)
Lowering\Instrumentation\DebugInfoInjector.vb (5)
105Dim sequencePointSpan As TextSpan 125sequencePointSpan = TextSpan.FromBounds(aggregateClause.SpanStart, 128sequencePointSpan = TextSpan.FromBounds(aggregateClause.SpanStart, 138sequencePointSpan = TextSpan.FromBounds(original.Syntax.SpanStart, original.Syntax.Span.End) 209condGoto = New BoundSequencePointWithSpan(asSingleLine, condGoto, TextSpan.FromBounds(asSingleLine.IfKeyword.SpanStart, asSingleLine.ThenKeyword.EndPosition - 1))
Lowering\Instrumentation\DebugInfoInjector_SequencePoints.vb (2)
105Dim statementSpanWithoutAttributes = TextSpan.FromBounds(firstModifierOrKeyword.SpanStart, methodStatement.Span.End) 124Dim span = TextSpan.FromBounds(propertyStatement.Identifier.SpanStart,
Lowering\SyntheticBoundNodeFactory.vb (1)
1083Public Function SequencePointWithSpan(syntax As SyntaxNode, textSpan As TextSpan, boundStatement As BoundStatement) As BoundStatement
Scanner\Blender.vb (8)
92Private Shared Function ExpandToNearestStatements(root As VisualBasic.VisualBasicSyntaxNode, span As TextSpan) As TextSpan 101Return TextSpan.FromBounds(start.Start, [end].End) 111rootFullSpan As TextSpan) As TextSpan 154Private Shared Function ExpandByLookAheadAndBehind(root As VisualBasic.VisualBasicSyntaxNode, span As TextSpan) As TextSpan 181Return TextSpan.FromBounds(start, [end])
Scanner\Scanner.vb (3)
258Public Function SkipToNextConditionalLine() As TextSpan 326Return TextSpan.FromBounds(start, condLineStart) 347Friend Function GetDisabledTextAt(span As TextSpan) As SyntaxTrivia
Symbols\NamedTypeSymbolExtensions.vb (2)
24Friend Function FindMember(container As NamedTypeSymbol, symbolName As String, kind As SymbolKind, nameSpan As TextSpan, tree As SyntaxTree) As Symbol 55Friend Function FindFieldOrProperty(container As NamedTypeSymbol, symbolName As String, nameSpan As TextSpan, tree As SyntaxTree) As Symbol
Symbols\NamespaceSymbol.vb (1)
391Friend Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Symbols\Source\SourceComplexParameterSymbol.vb (1)
200Friend NotOverridable Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Symbols\Source\SourceEventSymbol.vb (1)
454Friend NotOverridable Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Symbols\Source\SourceFieldSymbol.vb (2)
854Private Shared Function GetFieldLocationFromSyntax(node As SyntaxToken) As TextSpan 865Dim nameSpan As TextSpan = GetFieldLocationFromSyntax(variableName)
Symbols\Source\SourceFile.vb (4)
159Private Function BindFileInformation(diagBag As DiagnosticBag, cancellationToken As CancellationToken, Optional filterSpan As TextSpan? = Nothing) As BoundFileInformation 191Optional filterSpan As TextSpan? = Nothing) 245Optional filterSpan As TextSpan? = Nothing) 464Friend Function GetDeclarationErrorsInSpan(filterSpan As TextSpan, cancellationToken As CancellationToken) As IEnumerable(Of Diagnostic)
Symbols\Source\SourceMemberFieldSymbol.vb (1)
38Friend NotOverridable Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Symbols\Source\SourceMethodSymbol.vb (3)
803Friend NotOverridable Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean 860Private Shared Function GetMethodLocationFromSyntax(node As VisualBasicSyntaxNode) As TextSpan 1203Dim span As TextSpan
Symbols\Source\SourceModuleSymbol.vb (2)
572filterSpanWithinTree As TextSpan?, 573locationFilter As Func(Of IEnumerable(Of Diagnostic), SyntaxTree, TextSpan?, IEnumerable(Of Diagnostic)),
Symbols\Source\SourceNamespaceSymbol.vb (2)
407Friend Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean 451Friend Sub GenerateDeclarationErrorsInTree(tree As SyntaxTree, filterSpanWithinTree As TextSpan?, cancellationToken As CancellationToken)
Symbols\Source\SourcePropertySymbol.vb (1)
460Friend Overrides Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Symbols\Symbol.vb (2)
837Friend Overridable Function IsDefinedInSourceTree(tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean 857Friend Shared Function IsDefinedInSourceTree(syntaxNode As SyntaxNode, tree As SyntaxTree, definedWithinSpan As TextSpan?, Optional cancellationToken As CancellationToken = Nothing) As Boolean
Syntax\SimpleSyntaxReference.vb (1)
29Public Overrides ReadOnly Property Span As TextSpan
Syntax\SyntaxNodeRemover.vb (12)
40Private ReadOnly _searchSpan As TextSpan 52Private Shared Function ComputeTotalSpan(nodes As SyntaxNode()) As TextSpan 244Dim fullSpan = TextSpan.FromBounds(token.FullSpan.Start, node.FullSpan.End) 245Dim span = TextSpan.FromBounds(token.Span.Start, node.Span.End) 268Dim fullSpan = TextSpan.FromBounds(node.FullSpan.Start, token.FullSpan.End) 269Dim span = TextSpan.FromBounds(node.Span.Start, token.Span.End) 287Private Function GetRemovedSpan(span As TextSpan, fullSpan As TextSpan) As TextSpan 290removedSpan = TextSpan.FromBounds(span.Start, removedSpan.End) 293removedSpan = TextSpan.FromBounds(removedSpan.Start, span.End) 298Private Sub AddDirectives(node As SyntaxNode, span As TextSpan)
Syntax\SyntaxNormalizer.vb (2)
16Private ReadOnly _consideredSpan As TextSpan 44Private Sub New(consideredSpan As TextSpan, indentWhitespace As String, eolWhitespace As String, useElasticTrivia As Boolean, useDefaultCasing As Boolean)
Syntax\SyntaxReplacer.vb (9)
62Private ReadOnly _spanSet As HashSet(Of TextSpan) 63Private ReadOnly _totalSpan As TextSpan 83Me._spanSet = New HashSet(Of TextSpan)(Me._nodeSet.Select(Function(n) n.FullSpan).Concat( 112Private Shared Function ComputeTotalSpan(spans As IEnumerable(Of TextSpan)) As TextSpan 131Private Function ShouldVisit(span As TextSpan) As Boolean 234Private ReadOnly _elementSpan As TextSpan 240elementSpan As TextSpan, 256Private Function ShouldVisit(span As TextSpan) As Boolean
Syntax\VisualBasicLineDirectiveMap.vb (1)
209Friend Overrides Function TranslateSpanAndVisibility(sourceText As SourceText, treeFilePath As String, span As TextSpan, ByRef isHiddenPosition As Boolean) As FileLinePositionSpan
Syntax\VisualBasicSyntaxNode.vb (1)
158''' Same as accessing <see cref="TextSpan.Start"/> on <see cref="Span"/>.
Syntax\VisualBasicSyntaxTree.vb (5)
434Public Overrides Function GetLineSpan(span As TextSpan, Optional cancellationToken As CancellationToken = Nothing) As FileLinePositionSpan 448Public Overrides Function GetMappedLineSpan(span As TextSpan, Optional cancellationToken As CancellationToken = Nothing) As FileLinePositionSpan 457Friend Overrides Function GetMappedLineSpanAndVisibility(span As TextSpan, ByRef isHiddenPosition As Boolean) As FileLinePositionSpan 491Public Overrides Function GetLocation(span As TextSpan) As Location 519Public Overrides Function GetChangedSpans(oldTree As SyntaxTree) As IList(Of TextSpan)
VisualBasicDeclarationComputer.vb (1)
16span As TextSpan,
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (46)
AggregatedFormattingResult.vb (1)
15Public Sub New(node As SyntaxNode, results As IList(Of AbstractFormattingResult), formattingSpans As SimpleIntervalTree(Of TextSpan, TextSpanIntervalIntrospector))
BaseFormattingRule.vb (8)
28Optional textSpan As TextSpan = Nothing, 38Protected Shared Sub SetAlignmentBlockOperation(operations As List(Of IndentBlockOperation), baseToken As SyntaxToken, startToken As SyntaxToken, endToken As SyntaxToken, span As TextSpan, Optional [option] As IndentBlockOption = IndentBlockOption.RelativePosition) 46Protected Shared Sub AddAbsolutePositionIndentBlockOperation(operations As List(Of IndentBlockOperation), startToken As SyntaxToken, endToken As SyntaxToken, indentation As Integer, span As TextSpan, Optional [option] As IndentBlockOption = IndentBlockOption.AbsolutePosition) 50Private Shared Function GetAlignmentSpan(startToken As SyntaxToken, endToken As SyntaxToken) As TextSpan 52Return TextSpan.FromBounds(previousToken.Span.End, endToken.FullSpan.End) 55Private Shared Function GetIndentBlockSpan(startToken As SyntaxToken, endToken As SyntaxToken) As TextSpan 64Return TextSpan.FromBounds(spanStart, trivia.FullSpan.Start) 68Return TextSpan.FromBounds(spanStart, nextToken.SpanStart)
FormattingResult.vb (1)
21Friend Sub New(treeInfo As TreeData, tokenStream As TokenStream, spanToFormat As TextSpan)
NodeBasedFormattingRule.vb (2)
79AddIndentBlockOperation(operations, baseToken, startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)) 157operations.Add(FormattingOperations.CreateIndentBlockOperation(caseBlockLastToken, nextTokenAfterCase, TextSpan.FromBounds(caseBlockLastToken.Span.End, nextTokenAfterCase.SpanStart), 1, IndentBlockOption.RelativePosition))
SyntaxNodeExtensions.vb (6)
380textSpan As TextSpan, 388textSpan As TextSpan, 404textSpan As TextSpan, 885Public Function CheckTopLevel(node As SyntaxNode, span As TextSpan) As Boolean 909Public Function ContainsInMethodBlockBody(block As MethodBlockBaseSyntax, textSpan As TextSpan) As Boolean 914Dim blockSpan = TextSpan.FromBounds(block.BlockStatement.Span.End, block.EndBlockStatement.SpanStart)
TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
TriviaDataFactory.ComplexTrivia.vb (1)
98Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
TriviaDataFactory.FormattedComplexTrivia.vb (1)
58Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
TriviaDataFactory.ModifiedComplexTrivia.vb (1)
90Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
TriviaDataFactory.TriviaRewriter.vb (7)
16Private ReadOnly _spans As SimpleIntervalTree(Of TextSpan, TextSpanIntervalIntrospector) 23Public Sub New(node As SyntaxNode, spanToFormat As SimpleIntervalTree(Of TextSpan, TextSpanIntervalIntrospector), map As Dictionary(Of ValueTuple(Of SyntaxToken, SyntaxToken), TriviaData), cancellationToken As CancellationToken) 84Private Function GetTextSpan(pair As ValueTuple(Of SyntaxToken, SyntaxToken)) As TextSpan 86Return TextSpan.FromBounds(_node.FullSpan.Start, pair.Item2.SpanStart) 90Return TextSpan.FromBounds(pair.Item1.Span.End, _node.FullSpan.End) 93Return TextSpan.FromBounds(pair.Item1.Span.End, pair.Item2.SpanStart) 108Private Shared Function GetSyntaxTriviaList(textSpan As TextSpan, triviaData As TriviaData, cancellationToken As CancellationToken) As SyntaxTriviaList
VisualBasicRemoveUnnecessaryCastDiagnosticAnalyzer.vb (1)
35Protected Overrides Function GetFadeSpan(node As ExpressionSyntax) As TextSpan
VisualBasicRemoveUnnecessaryImportsDiagnosticAnalyzer.vb (1)
55nodes As IEnumerable(Of SyntaxNode), tree As SyntaxTree, cancellationToken As CancellationToken) As IEnumerable(Of TextSpan)
VisualBasicSmartTokenFormatter.vb (1)
40Dim spans = SpecializedCollections.SingletonEnumerable(TextSpan.FromBounds(previousToken.SpanStart, token.Span.End))
VisualBasicSyntaxFacts.vb (11)
794Public Function GetMemberBodySpanForSpeculativeBinding(node As SyntaxNode) As TextSpan Implements ISyntaxFacts.GetMemberBodySpanForSpeculativeBinding 817Return TextSpan.FromBounds(spanStart, method.EndBlockStatement.SpanStart) 823Public Function ContainsInMemberBody(node As SyntaxNode, span As TextSpan) As Boolean Implements ISyntaxFacts.ContainsInMemberBody 857Private Shared Function ContainsExclusively(outerSpan As TextSpan, innerSpan As TextSpan) As Boolean 865Private Shared Function GetSyntaxListSpan(Of T As SyntaxNode)(list As SyntaxList(Of T)) As TextSpan 867Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End) 870Private Shared Function GetSeparatedSyntaxListSpan(Of T As SyntaxNode)(list As SeparatedSyntaxList(Of T)) As TextSpan 872Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End) 1140Public Function GetInactiveRegionSpanAroundPosition(tree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As TextSpan Implements ISyntaxFacts.GetInactiveRegionSpanAroundPosition 1462Public Function ContainsInterleavedDirective(span As TextSpan, token As SyntaxToken, cancellationToken As CancellationToken) As Boolean Implements ISyntaxFacts.ContainsInterleavedDirective
VisualBasicSyntaxFormatting.vb (1)
42Protected Overrides Function CreateAggregatedFormattingResult(node As SyntaxNode, results As IList(Of AbstractFormattingResult), Optional formattingSpans As SimpleIntervalTree(Of TextSpan, TextSpanIntervalIntrospector) = Nothing) As IFormattingResult
VisualBasicUseInferredMemberNameDiagnosticAnalyzer.vb (2)
52Dim fadeSpan = TextSpan.FromBounds(nameColonEquals.Name.SpanStart, nameColonEquals.ColonEqualsToken.Span.End) 72Dim fadeSpan = TextSpan.FromBounds(fieldInitializer.Name.SpanStart, fieldInitializer.EqualsToken.Span.End)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (10)
CompilationUnitSyntaxExtensions.vb (2)
32Return Not contextNode.SyntaxTree.OverlapsHiddenPosition(TextSpan.FromBounds(start, [end]), cancellationToken) 39Return Not contextNode.SyntaxTree.OverlapsHiddenPosition(TextSpan.FromBounds(start, [end]), cancellationToken)
ExpressionSyntaxExtensions.vb (1)
221Public Function GetImplicitMemberAccessExpressions(expression As SyntaxNode, span As TextSpan) As IEnumerable(Of ExpressionSyntax)
SpecialFormattingOperation.vb (5)
71TextSpan.FromBounds(startToken.FullSpan.Start, node.FullSpan.End), indentationDelta:=1, [option]:=IndentBlockOption.RelativePosition)) 109baseToken, startToken, endToken, TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End), indentationDelta, IndentBlockOption.RelativePosition)) 147Dim span As TextSpan 155span = TextSpan.FromBounds(baseToken.Span.End, firstToken.SpanStart) 158span = TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End)
VisualBasicSymbolDeclarationService.vb (1)
51Public Overrides ReadOnly Property Span As TextSpan
VisualBasicSyntaxFactsService.vb (1)
39Public Function GetSelectedFieldsAndPropertiesAsync(tree As SyntaxTree, textSpan As TextSpan, allowPartialSelection As Boolean, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of SyntaxNode)) Implements ISyntaxFactsService.GetSelectedFieldsAndPropertiesAsync
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (1)
CommandLineTests.vb (1)
10747Private Sub ReportDiagnostic(path As String, context As CompilationAnalysisContext, Optional span As TextSpan = Nothing)
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures (7)
AutomaticCompletion\AutomaticLineEnderCommandHandler.vb (1)
90Dim endingString = text.ToString(TextSpan.FromBounds(nonMissingToken.Span.End, line.End))
EndConstructGeneration\EndConstructCommandHandler.vb (2)
154Private Shared Function GetSpanToCleanup(statement As StatementSyntax) As TextSpan 161Return TextSpan.FromBounds(If(previousToken.Kind <> SyntaxKind.None, previousToken, firstToken).SpanStart,
EndConstructGeneration\VisualBasicEndConstructGenerationService.vb (1)
272Dim span = TextSpan.FromBounds(asSingleLine.IfKeyword.SpanStart, asSingleLine.ThenKeyword.Span.End)
LineCommit\ContainingStatementInfo.vb (3)
13Public ReadOnly TextSpan As TextSpan 20Public Sub New(node As SyntaxNode, span As TextSpan) 186Return New ContainingStatementInfo(node, TextSpan.FromBounds(attributes.Last.Span.End, node.Span.End))
Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests (30)
AutomaticEndConstructCorrection\AutomaticEndConstructCorrectorTests.vb (2)
402Private Shared Sub Verify(document As TestHostDocument, keyword As String, expected As String, spanToReplace As TextSpan, spanToVerify As TextSpan, workspace As TestWorkspace)
Classification\SemanticClassifierTests.vb (1)
17Protected Overrides Async Function GetClassificationSpansAsync(code As String, span As TextSpan, parseOptions As ParseOptions, testHost As TestHost) As Task(Of ImmutableArray(Of ClassifiedSpan))
Classification\SyntacticClassifierTests.vb (1)
16Protected Overrides Async Function GetClassificationSpansAsync(code As String, span As TextSpan, parseOptions As ParseOptions, testHost As TestHost) As Task(Of ImmutableArray(Of ClassifiedSpan))
CommentSelection\VisualBasicCommentSelectionTests.vb (1)
79Dim spans As ImmutableArray(Of TextSpan) = Nothing
Debugging\DataTipInfoGetterTests.vb (1)
37Dim textSpan As TextSpan
EditAndContinue\BreakpointSpansTests.vb (5)
39Dim expectedSpan As TextSpan? = Nothing 45Dim breakpointSpan As TextSpan 69Dim expectedSpans As ImmutableArray(Of TextSpan) = Nothing 84Public Shared Iterator Function GetBreakpointSequence(root As SyntaxNode, position As Integer) As IEnumerable(Of TextSpan) 88Dim span As TextSpan = Nothing
EditAndContinue\Helpers\EditingTestBase.vb (2)
69syntaxMap As IEnumerable(Of KeyValuePair(Of TextSpan, TextSpan)),
EditAndContinue\VisualBasicEditAndContinueAnalyzerTests.vb (4)
75Private Shared Iterator Function GetExpectedPositionsAndSpans(source As String) As IEnumerable(Of KeyValuePair(Of Integer, TextSpan)) 90Dim span As TextSpan 96span = TextSpan.FromBounds(source.IndexOf(s_startSpanMark, start, length, StringComparison.Ordinal) + s_startSpanMark.Length, 109Dim span As TextSpan?
ExtractMethod\ExtractMethodTests.vb (5)
28Dim textSpan As TextSpan 38Dim textSpan As TextSpan 97textSpan As TextSpan, 133Dim namedSpans = CType(New Dictionary(Of String, ImmutableArray(Of TextSpan))(), IDictionary(Of String, ImmutableArray(Of TextSpan)))
Formatting\FormattingEngineTests_Venus.vb (1)
256Dim textSpan As TextSpan
Formatting\VisualBasicFormatterTestBase.vb (1)
39Protected Shared Async Function AssertFormatSpanAsync(content As String, expected As String, Optional baseIndentation As Integer? = Nothing, Optional span As TextSpan = Nothing) As Task
LineCommit\CommitTestData.vb (1)
103Public Function StartInlineSession(snapshot As Document, triggerSpan As TextSpan, cancellationToken As CancellationToken) As InlineRenameSessionInfo Implements IInlineRenameService.StartInlineSession
LineSeparators\LineSeparatorTests.vb (3)
19Await AssertTagsAsync(Array.Empty(Of TextSpan)(), "") 279Private Shared Async Function AssertTagsAsync(spans As IEnumerable(Of TextSpan), content As String) As Tasks.Task 290Private Shared Async Function GetSpansForAsync(content As String) As Tasks.Task(Of IEnumerable(Of TextSpan))
TypeInferrer\TypeInferrerTests.vb (2)
19Protected Overrides Async Function TestWorkerAsync(document As Document, textSpan As TextSpan, expectedType As String, testMode As TestMode) As Task 48Private Shared Function FindExpressionSyntaxFromSpan(root As SyntaxNode, textSpan As TextSpan) As ExpressionSyntax
Microsoft.CodeAnalysis.VisualBasic.Features (220)
BraceMatching\VisualBasicDirectiveTriviaBraceMatcher.vb (2)
33Friend Overrides Function GetSpanForTagging(directive As DirectiveTriviaSyntax) As TextSpan 41Return TextSpan.FromBounds(directive.HashToken.SpanStart, keywordToken.Span.End)
CodeFixes\GenerateEndConstruct\GenerateEndConstructCodeFixProvider.vb (1)
252Dim updatedText = text.WithChanges(New TextChange(TextSpan.FromBounds(insertionPoint, insertionPoint), stringToAppend))
CodeFixes\IncorrectFunctionReturnType\IncorrectFunctionReturnTypeCodeFixProvider.vb (1)
73Private Shared Function GetNodeToFix(Of T As SyntaxNode)(token As SyntaxToken, span As TextSpan) As T
CodeFixes\MoveToTopOfFile\MoveToTopOfFileCodeFixProvider.MoveToLineCodeAction.vb (1)
39Dim textWithMovedLine = textWithoutLine.WithChanges(New TextChange(TextSpan.FromBounds(destinationLineSpan, destinationLineSpan), textLineToMove.ToString().TrimStart() + vbCrLf))
CodeRefactorings\MoveType\VisualBasicMoveTypeService.vb (1)
23Protected Overrides Async Function GetRelevantNodeAsync(document As Document, textSpan As TextSpan, cancellationToken As CancellationToken) As Task(Of TypeBlockSyntax)
CodeRefactorings\NodeSelectionHelpers.vb (1)
16Dim span As TextSpan = context.Span
CodeRefactorings\SyncNamespace\VisualBasicChangeNamespaceService.vb (1)
75Protected Overrides Function TryGetApplicableContainerFromSpanAsync(document As Document, span As TextSpan, cancellationToken As CancellationToken) As Task(Of SyntaxNode)
Completion\CompletionProviders\CompletionUtilities.vb (1)
24Public Function GetCompletionItemSpan(text As SourceText, position As Integer) As TextSpan
Completion\CompletionProviders\VisualBasicSuggestionModeCompletionProvider.vb (1)
33Protected Overrides Async Function GetSuggestionModeItemAsync(document As Document, position As Integer, itemSpan As TextSpan, trigger As CompletionTrigger, cancellationToken As CancellationToken) As Task(Of CompletionItem)
Completion\KeywordRecommenders\Statements\FinallyKeywordRecommender.vb (1)
43If TextSpan.FromBounds(tryBlock.CatchBlocks.Last().SpanStart, tryBlock.EndTryStatement.SpanStart).Contains(context.Position) Then
Completion\VisualBasicCompletionService.vb (1)
124Public Overrides Function GetDefaultCompletionListSpan(text As SourceText, caretPosition As Integer) As TextSpan
Debugging\DataTipInfoGetter.vb (1)
54span = TextSpan.FromBounds(conditionalAccess.SpanStart, span.End)
Debugging\VisualBasicBreakpointService.vb (2)
61Dim span As TextSpan 76Public Function ResolveBreakpointAsync(document As Document, textSpan As TextSpan, Optional cancellationToken As CancellationToken = Nothing) As Task(Of BreakpointResolutionResult) Implements IBreakpointResolutionService.ResolveBreakpointAsync
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.vb (2)
41Private ReadOnly _ignoredSpans As SimpleIntervalTree(Of TextSpan, TextSpanIntervalIntrospector) 70Public Sub New(analyzer As VisualBasicSimplifyTypeNamesDiagnosticAnalyzer, semanticModel As SemanticModel, options As VisualBasicSimplifierOptions, ignoredSpans As SimpleIntervalTree(Of TextSpan, TextSpanIntervalIntrospector), cancellationToken As CancellationToken)
Diagnostics\Analyzers\VisualBasicSimplifyTypeNamesDiagnosticAnalyzer.vb (2)
49Protected Overrides Function AnalyzeSemanticModel(context As SemanticModelAnalysisContext, codeBlockIntervalTree As SimpleIntervalTree(Of TextSpan, TextSpanIntervalIntrospector)) As ImmutableArray(Of Diagnostic) 73ByRef issueSpan As TextSpan, ByRef diagnosticId As String, ByRef inDeclaration As Boolean,
Diagnostics\VisualBasicAnalyzerDriverService.vb (1)
23span As TextSpan,
EditAndContinue\BreakpointSpans.vb (28)
13Friend Function TryGetBreakpointSpan(tree As SyntaxTree, position As Integer, cancellationToken As CancellationToken, <Out> ByRef breakpointSpan As TextSpan) As Boolean 58Public Function TryGetEnclosingBreakpointSpan(root As SyntaxNode, position As Integer, minLength As Integer, <Out> ByRef span As TextSpan) As Boolean 61Dim candidate As TextSpan? = Nothing 91Private Function CreateSpan(node As SyntaxNode) As TextSpan 92Return TextSpan.FromBounds(node.SpanStart, node.Span.End) 95Private Function TryCreateSpan(Of TNode As SyntaxNode)(list As SeparatedSyntaxList(Of TNode)) As TextSpan? 100Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End) 103Private Function TryCreateSpanForNode(node As SyntaxNode, position As Integer) As TextSpan? 174Return TextSpan.FromBounds(asSingleLine.IfKeyword.SpanStart, asSingleLine.ThenKeyword.Span.End) 235Private Function CreateSpanForMethodBase(methodBase As MethodBaseSyntax) As TextSpan 237Return TextSpan.FromBounds(methodBase.DeclarationKeyword.SpanStart, methodBase.Span.End) 240Return TextSpan.FromBounds(methodBase.Modifiers.First().SpanStart, methodBase.Span.End) 243Private Function TryCreateSpanForPropertyStatement(node As PropertyStatementSyntax) As TextSpan? 250Return TextSpan.FromBounds(node.Identifier.Span.Start, node.Initializer.Span.End) 254Return TextSpan.FromBounds(node.Identifier.Span.Start, node.AsClause.Span.End) 260Private Function TryCreateSpanForVariableDeclaration(modifiers As SyntaxTokenList, declarators As SeparatedSyntaxList(Of VariableDeclaratorSyntax), position As Integer) As TextSpan? 334Private Function TryCreateSpanForFromClause(fromClause As FromClauseSyntax, position As Integer) As TextSpan? 352Private Function TryCreateSpanForFunctionAggregation(functionAggregation As FunctionAggregationSyntax) As TextSpan? 360Private Function TryCreateSpanForOrderByClause(orderByClause As OrderByClauseSyntax, position As Integer) As TextSpan? 368Private Function TryCreateSpanForOrderingSyntax(orderingSyntax As OrderingSyntax) As TextSpan? 372Private Function TryCreateSpanForPartitionWhileClauseSyntax(partitionWhileClause As PartitionWhileClauseSyntax) As TextSpan? 376Private Function TryCreateSpanForCollectionRangeVariable(collectionRangeVariable As CollectionRangeVariableSyntax) As TextSpan? 392Private Function TryCreateSpanForWhereClause(clause As WhereClauseSyntax) As TextSpan? 396Private Function TryCreateSpanForGroupByClause(clause As GroupByClauseSyntax, position As Integer) As TextSpan? 417Return TextSpan.FromBounds(clause.Keys.First.SpanStart, clause.Span.End) 420Private Function TryCreateSpanForSelectClause(clause As SelectClauseSyntax) As TextSpan? 428Private Function TryCreateSpanForLetClause(clause As LetClauseSyntax, position As Integer) As TextSpan? 432Private Function TryCreateSpanForExpression(expression As ExpressionSyntax) As TextSpan?
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (38)
378Friend Overrides Function GetActiveSpanEnvelope(declaration As SyntaxNode) As (envelope As TextSpan, hole As TextSpan) 397Return (TextSpan.FromBounds(propertyStatement.Identifier.Span.Start, propertyStatement.Initializer.Span.End), Nothing) 401Return (TextSpan.FromBounds(propertyStatement.Identifier.Span.Start, propertyStatement.AsClause.Span.End), Nothing) 445Return (envelope:=TextSpan.FromBounds(declaration.Span.Start, asNewClause.NewExpression.Span.End), 446hole:=TextSpan.FromBounds(declaration.Span.End, asNewClause.NewExpression.Span.Start)) 495span As TextSpan, 818Protected Overrides Function GetGlobalStatementDiagnosticSpan(node As SyntaxNode) As TextSpan 892Protected Overrides Function TryGetEnclosingBreakpointSpan(root As SyntaxNode, position As Integer, <Out> ByRef span As TextSpan) As Boolean 896Protected Overrides Function TryGetActiveSpan(node As SyntaxNode, statementPart As Integer, minLength As Integer, <Out> ByRef span As TextSpan) As Boolean 1499Protected Overrides Function TryGetDiagnosticSpan(node As SyntaxNode, editKind As EditKind) As TextSpan? 1503Protected Overloads Shared Function GetDiagnosticSpan(node As SyntaxNode, editKind As EditKind) As TextSpan 1507Private Shared Function TryGetDiagnosticSpanImpl(node As SyntaxNode, editKind As EditKind) As TextSpan? 1511Protected Overrides Function GetBodyDiagnosticSpan(node As SyntaxNode, editKind As EditKind) As TextSpan 1516Friend Shared Function TryGetDiagnosticSpanImpl(kind As SyntaxKind, node As SyntaxNode, editKind As EditKind) As TextSpan? 1680Return TextSpan.FromBounds(newWith.NewKeyword.Span.Start, 1712Return TextSpan.FromBounds(groupJoin.GroupKeyword.SpanStart, groupJoin.JoinKeyword.Span.End) 1727Return TextSpan.FromBounds(partition.SkipOrTakeKeyword.SpanStart, partition.WhileKeyword.Span.End) 1741Private Overloads Shared Function GetDiagnosticSpan(ifKeyword As SyntaxToken, condition As SyntaxNode, thenKeywordOpt As SyntaxToken) As TextSpan 1742Return TextSpan.FromBounds(ifKeyword.Span.Start, 1746Private Overloads Shared Function GetDiagnosticSpan(node As NamespaceStatementSyntax) As TextSpan 1747Return TextSpan.FromBounds(node.NamespaceKeyword.SpanStart, node.Name.Span.End) 1750Private Overloads Shared Function GetDiagnosticSpan(node As TypeStatementSyntax) As TextSpan 1756Private Overloads Shared Function GetDiagnosticSpan(modifiers As SyntaxTokenList, start As SyntaxNodeOrToken, endNode As SyntaxNodeOrToken) As TextSpan 1757Return TextSpan.FromBounds(If(modifiers.Count <> 0, modifiers.First.SpanStart, start.SpanStart), 1761Private Overloads Shared Function GetDiagnosticSpan(header As MethodBaseSyntax) As TextSpan 1822Return TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End) 1825Private Overloads Shared Function GetDiagnosticSpan(lambda As LambdaHeaderSyntax) As TextSpan 1835Return TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End) 1838Friend Overrides Function GetLambdaParameterDiagnosticSpan(lambda As SyntaxNode, ordinal As Integer) As TextSpan 2130Private ReadOnly _span As TextSpan? 2138Optional span As TextSpan? = Nothing) 2161Private Function GetSpan() As TextSpan 2434Friend Overrides Sub ReportMemberBodyUpdateRudeEdits(diagnostics As ArrayBuilder(Of RudeEditDiagnostic), newMember As SyntaxNode, span As TextSpan?) 2573newStatementSpan As TextSpan) 2605Protected Overrides Function GetExceptionHandlingRegion(node As SyntaxNode, <Out> ByRef coversAllChildren As Boolean) As TextSpan 2613Return TextSpan.FromBounds(tryBlock.FinallyBlock.SpanStart, tryBlock.EndTryStatement.Span.End) 2616Return TextSpan.FromBounds(tryBlock.CatchBlocks.First().SpanStart, tryBlock.EndTryStatement.Span.End)
EncapsulateField\VisualBasicEncapsulateFieldService.vb (1)
72Protected Overrides Async Function GetFieldsAsync(document As Document, span As TextSpan, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of IFieldSymbol))
ExtractMethod\Extensions.vb (7)
158Public Function ContainArgumentlessThrowWithoutEnclosingCatch(ByVal tokens As IEnumerable(Of SyntaxToken), ByVal textSpan As TextSpan) As Boolean 179Public Function ContainPreprocessorCrossOver(ByVal tokens As IEnumerable(Of SyntaxToken), ByVal textSpan As TextSpan) As Boolean 252Dim withBlockSpan = TextSpan.FromBounds(withBlock.WithStatement.Span.End, withBlock.EndWithStatement.SpanStart) 263Dim initializerSpan = TextSpan.FromBounds(initializer.WithKeyword.Span.End, initializer.Span.End) 283Dim span = TextSpan.FromBounds(asNewClause.NewExpression.NewKeyword.Span.End, asNewClause.NewExpression.Span.End) 315Public Function ContainsInMethodBlockBody(block As MethodBlockBaseSyntax, textSpan As TextSpan) As Boolean 320Dim blockSpan = TextSpan.FromBounds(block.BlockStatement.Span.End, block.EndBlockStatement.SpanStart)
ExtractMethod\VisualBasicExtractMethodService.vb (1)
22textSpan As TextSpan,
ExtractMethod\VisualBasicSelectionResult.vb (5)
22originalSpan As TextSpan, 23finalSpan As TextSpan, 54originalSpan As TextSpan, 55finalSpan As TextSpan, 310TextSpan.FromBounds(first.SpanStart, last.Span.End)) _
ExtractMethod\VisualBasicSelectionValidator.vb (11)
19textSpan As TextSpan, 76Private Shared Function GetControlFlowSpan(selectionInfo As SelectionInfo) As TextSpan 77Return TextSpan.FromBounds(selectionInfo.FirstTokenInFinalSpan.SpanStart, selectionInfo.LastTokenInFinalSpan.Span.End) 254.FinalSpan = GetAdjustedSpan(root, TextSpan.FromBounds(start, [end])) 386root, TextSpan.FromBounds(selectionInfo.FirstTokenInOriginalSpan.SpanStart, selectionInfo.LastTokenInOriginalSpan.Span.End), 597textSpan As TextSpan, 640Private Shared Function GetAdjustedSpan(root As SyntaxNode, textSpan As TextSpan) As TextSpan 662Return TextSpan.FromBounds(textSpan.Start, previousLine.End) 668Public Property OriginalSpan() As TextSpan 669Public Property FinalSpan() As TextSpan
GenerateDefaultConstructors\VisualBasicGenerateDefaultConstructorsService.vb (1)
24semanticDocument As SemanticDocument, textSpan As TextSpan, cancellationToken As CancellationToken,
Highlighting\KeywordHighlighters\AccessorDeclarationHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 39highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\ConditionalPreprocessorHighlighter.vb (4)
22Protected Overloads Overrides Sub AddHighlights(directive As DirectiveTriviaSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 31highlights.Add(TextSpan.FromBounds(.HashToken.SpanStart, .IfOrElseIfKeyword.Span.End)) 38highlights.Add(TextSpan.FromBounds(.HashToken.SpanStart, .ElseKeyword.Span.End)) 42highlights.Add(TextSpan.FromBounds(.HashToken.SpanStart, .IfKeyword.Span.End))
Highlighting\KeywordHighlighters\ConstructorDeclarationHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 31highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .NewKeyword.Span.End))
Highlighting\KeywordHighlighters\DoLoopBlockHighlighter.vb (3)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 38highlights.Add(TextSpan.FromBounds(.DoKeyword.SpanStart, .WhileOrUntilClause.WhileOrUntilKeyword.Span.End)) 50highlights.Add(TextSpan.FromBounds(.LoopKeyword.SpanStart, .WhileOrUntilClause.WhileOrUntilKeyword.Span.End))
Highlighting\KeywordHighlighters\EnumBlockHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 38highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .EnumKeyword.Span.End))
Highlighting\KeywordHighlighters\EventBlockHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 32highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\EventDeclarationHighlighter.vb (2)
22Protected Overrides Sub AddHighlights(eventDeclaration As EventStatementSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 32highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\ForLoopBlockHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 38highlights.Add(TextSpan.FromBounds(.ForKeyword.SpanStart, .EachKeyword.Span.End))
Highlighting\KeywordHighlighters\MethodDeclarationHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 37highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\MultiLineIfBlockHighlighter.vb (1)
22Protected Overloads Overrides Sub addHighlights(ifBlock As MultiLineIfBlockSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\MultiLineLambdaExpressionHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 37highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\NamespaceBlockHighlighter.vb (1)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\OperatorDeclarationHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 31highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\PropertyBlockHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 31highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\PropertyDeclarationHighlighter.vb (2)
22Protected Overrides Sub AddHighlights(propertyDeclaration As PropertyStatementSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 32highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\RegionHighlighter.vb (3)
22Protected Overloads Overrides Sub AddHighlights(directive As DirectiveTriviaSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 37highlights.Add(TextSpan.FromBounds(region.HashToken.SpanStart, region.RegionKeyword.Span.End)) 38highlights.Add(TextSpan.FromBounds(endRegion.HashToken.SpanStart, endRegion.RegionKeyword.Span.End))
Highlighting\KeywordHighlighters\SelectBlockHighlighter.vb (3)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 35TextSpan.FromBounds( 44highlights.Add(TextSpan.FromBounds(.CaseKeyword.SpanStart, elseKeyword.Span.End))
Highlighting\KeywordHighlighters\SingleLineIfBlockHighlighter.vb (1)
22Protected Overloads Overrides Sub AddHighlights(ifStatement As SingleLineIfStatementSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\SyncLockBlockHighlighter.vb (1)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\TryBlockHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 57Private Sub HighlightRelatedStatements(node As SyntaxNode, highlights As List(Of TextSpan))
Highlighting\KeywordHighlighters\TypeBlockHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 41highlights.Add(TextSpan.FromBounds(firstKeyword.SpanStart, .DeclarationKeyword.Span.End))
Highlighting\KeywordHighlighters\UsingBlockHighlighter.vb (1)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\WhileBlockHighlighter.vb (1)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\WithBlockHighlighter.vb (1)
22Protected Overloads Overrides Sub AddHighlights(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\XmlCDataHighlighter.vb (1)
22Protected Overloads Overrides Sub addHighlights(xmlComment As XmlCDataSectionSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\XmlCommentHighlighter.vb (1)
22Protected Overloads Overrides Sub addHighlights(xmlComment As XmlCommentSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\XmlDocumentPrologueHighlighter.vb (1)
22Protected Overloads Overrides Sub addHighlights(xmlProcessingInstruction As XmlProcessingInstructionSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\XmlElementHighlighter.vb (2)
22Protected Overloads Overrides Sub AddHighlights(node As XmlNodeSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 33highlights.Add(TextSpan.FromBounds(.LessThanToken.SpanStart, .Name.Span.End))
Highlighting\KeywordHighlighters\XmlEmbeddedExpressionHighlighter.vb (1)
22Protected Overloads Overrides Sub addHighlights(xmlEmbeddExpression As XmlEmbeddedExpressionSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlighters\XmlProcessingInstructionHighlighter.vb (1)
22Protected Overloads Overrides Sub addHighlights(xmlDocumentPrologue As XmlDeclarationSyntax, highlights As List(Of TextSpan), cancellationToken As CancellationToken)
Highlighting\KeywordHighlightingHelpers.vb (8)
15highlights As List(Of TextSpan), 50Optional checkReturns As Boolean = False) As IEnumerable(Of TextSpan) 52Dim highlights As New List(Of TextSpan) 78Friend Sub HighlightRelatedAwaits(node As SyntaxNode, highlights As List(Of TextSpan), cancellationToken As CancellationToken) 96highlights(index) = TextSpan.FromBounds(span.Start, .AwaitKeyword.Span.End) 115Private Sub HighlightRelatedYieldStatements(Of T)(node As SyntaxNode, highlights As List(Of TextSpan)) 130Friend Function GetRelatedYieldStatementHighlights(Of T As SyntaxNode)(node As T) As IEnumerable(Of TextSpan) 131Dim highlights As New List(Of TextSpan)
IntroduceVariable\VisualBasicIntroduceLocalForExpressionCodeRefactoringProvider.vb (1)
29Protected Overrides Function IsValid(expressionStatement As ExpressionStatementSyntax, span As TextSpan) As Boolean
IntroduceVariable\VisualBasicIntroduceVariableService.vb (1)
164Return block.OverlapsHiddenPosition(TextSpan.FromBounds(first.SpanStart, last.SpanStart), cancellationToken)
LineSeparators\VisualBasicLineSeparatorService.vb (7)
56textSpan As TextSpan, 57cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of TextSpan)) Implements ILineSeparatorService.GetLineSeparatorsAsync 61Dim spans = ArrayBuilder(Of TextSpan).GetInstance() 67Return ImmutableArray(Of TextSpan).Empty 103Private Shared Sub ProcessNodeList(Of T As SyntaxNode)(children As SyntaxList(Of T), spans As ArrayBuilder(Of TextSpan), token As CancellationToken) 145Private Shared Sub ProcessImports(importsList As SyntaxList(Of ImportsStatementSyntax), spans As ArrayBuilder(Of TextSpan)) 151Private Shared Function GetLineSeparatorSpanForNode(node As SyntaxNode) As TextSpan
SignatureHelp\AbstractIntrinsicOperatorSignatureHelpProvider.vb (1)
103Private Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState
SignatureHelp\AttributeSignatureHelpProvider.vb (1)
95Private Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\CollectionInitializerSignatureHelpProvider.vb (1)
70Private Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\FunctionAggregationSignatureHelpProvider.vb (1)
33Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState
SignatureHelp\GenericNameSignatureHelpProvider.vb (1)
33Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\InvocationExpressionSignatureHelpProvider.vb (1)
34Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.vb (1)
33Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\RaiseEventStatementSignatureHelpProvider.vb (1)
32Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState?
SignatureHelp\SignatureHelpUtilities.vb (4)
51Friend Function GetSignatureHelpSpan(argumentList As ArgumentListSyntax) As TextSpan 55Friend Function GetSignatureHelpSpan(argumentList As ArgumentListSyntax, start As Integer) As TextSpan 59Friend Function GetSignatureHelpSpan(argumentList As TypeArgumentListSyntax) As TextSpan 63Friend Function GetSignatureHelpSpan(initializer As CollectionInitializerSyntax) As TextSpan
Snippets\VisualBasicSnippetFunctionService.vb (3)
29Protected Overrides Async Function GetEnumSymbolAsync(document As Document, switchExpressionSpan As TextSpan, cancellationToken As CancellationToken) As Task(Of ITypeSymbol) 44Protected Overrides Async Function GetDocumentWithEnumCaseAsync(document As Document, fullyQualifiedTypeName As String, firstEnumMemberName As String, caseGenerationLocation As TextSpan, cancellationToken As CancellationToken) As Task(Of (Document, TextSpan))
SplitOrMergeIfStatements\VisualBasicMergeConsecutiveIfStatementsCodeRefactoringProvider.vb (1)
22Protected Overrides Function IsApplicableSpan(node As SyntaxNode, span As TextSpan, ByRef ifOrElseIf As SyntaxNode) As Boolean
SplitOrMergeIfStatements\VisualBasicMergeNestedIfStatementsCodeRefactoringProvider.vb (1)
22Protected Overrides Function IsApplicableSpan(node As SyntaxNode, span As TextSpan, ByRef ifOrElseIf As SyntaxNode) As Boolean
Structure\Providers\CollectionInitializerStructureProvider.vb (2)
44textSpan:=TextSpan.FromBounds(node.SpanStart, endPos), 45hintSpan:=TextSpan.FromBounds(node.SpanStart, endPos),
Structure\Providers\CompilationUnitStructureProvider.vb (1)
26Dim span = TextSpan.FromBounds(startPos, endPos)
Structure\Providers\DisabledTextTriviaStructureProvider.vb (1)
24Dim span = TextSpan.FromBounds(startPos, endPos)
Structure\Providers\DocumentationCommentStructureProvider.vb (1)
33Dim fullSpan = TextSpan.FromBounds(startPos, endPos)
Structure\Providers\ObjectCreationInitializerStructureProvider.vb (1)
34textSpan:=TextSpan.FromBounds(previousToken.Span.End, node.Span.End),
Structure\Providers\RegionDirectiveStructureProvider.vb (1)
42Dim span = TextSpan.FromBounds(regionDirective.SpanStart, matchingDirective.Span.End)
Structure\VisualBasicStructureHelpers.vb (7)
28Dim span = TextSpan.FromBounds(startComment.SpanStart, endComment.Span.End) 118textSpan:=TextSpan.FromBounds(startPosition, endPosition), 119hintSpan:=TextSpan.FromBounds(startPosition, hintTextEndToken.Span.End), 171span As TextSpan, 172hintSpan As TextSpan, 212Private Function GetHintSpan(blockNode As SyntaxNode) As TextSpan 222Return TextSpan.FromBounds(child.SpanStart, blockNode.Span.End)
VisualBasicDeclarationComputer.vb (1)
16span As TextSpan,
VisualBasicRemoveUnnecessaryCastDiagnosticAnalyzer.vb (1)
35Protected Overrides Function GetFadeSpan(node As ExpressionSyntax) As TextSpan
VisualBasicRemoveUnnecessaryImportsDiagnosticAnalyzer.vb (1)
55nodes As IEnumerable(Of SyntaxNode), tree As SyntaxTree, cancellationToken As CancellationToken) As IEnumerable(Of TextSpan)
VisualBasicUseInferredMemberNameDiagnosticAnalyzer.vb (2)
52Dim fadeSpan = TextSpan.FromBounds(nameColonEquals.Name.SpanStart, nameColonEquals.ColonEqualsToken.Span.End) 72Dim fadeSpan = TextSpan.FromBounds(fieldInitializer.Name.SpanStart, fieldInitializer.EqualsToken.Span.End)
Wrapping\SeparatedSyntaxList\VisualBasicArgumentWrapper.vb (1)
68Dim span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)
Wrapping\SeparatedSyntaxList\VisualBasicParameterWrapper.vb (1)
60Dim headerSpan = TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (9)
Diagnostics\DiagnosticAnalyzerTests.vb (1)
1674expectedDiagnosticSpan As TextSpan,
FlowAnalysis\FlowTestBase.vb (2)
90Dim spans As IEnumerable(Of IEnumerable(Of TextSpan)) = Nothing 170Private Sub FindRegionNodes(tree As SyntaxTree, region As TextSpan,
SourceGeneration\GeneratorDriverTests.vb (6)
229gen001, TextSpan.FromBounds(1, 4), 234gen001, TextSpan.FromBounds(19, 22), 244gen001, TextSpan.FromBounds(26, 29), 251gen001, TextSpan.FromBounds(60, 63), 366Shared Sub VerifyDiagnosticsWithSource(source As String, diag As Diagnostic, location As TextSpan, ParamArray expected As DiagnosticDescription()) 407Return x.Diagnostic.WithLocation(Location.Create(syntaxTree, TextSpan.FromBounds(start, endpoint)))
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (8)
SymbolsTests\AnonymousTypes\AnonymousTypesSemanticsTests.vb (3)
1926Dim span As TextSpan = node.Span 1968Dim spans As New List(Of TextSpan) 2001Private Shared Sub ExtractTextIntervals(text As XElement, nodes As List(Of TextSpan))
SymbolsTests\MyBaseMyClassSemanticsTests.vb (3)
86Dim span As TextSpan = node.Span 117Dim spans As New List(Of TextSpan) 150Private Shared Sub ExtractTextIntervals(text As XElement, nodes As List(Of TextSpan))
SymbolsTests\WithStatementSymbolsTests.vb (2)
270Dim spans As New List(Of TextSpan) 303Private Shared Sub ExtractTextIntervals(text As XElement, nodes As List(Of TextSpan))
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (12)
IncrementalParser\IncrementalParser.vb (3)
1523New TextChange(TextSpan.FromBounds(8, 8), "System" + vbCrLf + "Imports "), 1524New TextChange(TextSpan.FromBounds(29, 45), "")) 1557Dim newText = oldText.Replace(TextSpan.FromBounds(startOfOld, endOfOld), newSource.Substring(startOfNew, endOfNew - startOfNew + 1))
LocationTests.vb (1)
55Private Function GetSpanIn(tree As SyntaxTree, textToFind As String) As TextSpan
TestSyntaxNodes.vb (8)
219Private Sub VerifyListSpans(Of T As VisualBasicSyntaxNode)(list As SyntaxList(Of T), expectedFullSpan As TextSpan) 241Private Sub VerifyListSpans(list As ChildSyntaxList, expectedFullSpan As TextSpan) 263Private Sub VerifyListSpans(list As SyntaxNodeOrTokenList, expectedFullSpan As TextSpan) 287Private Sub VerifyListSpans(list As SyntaxTokenList, expectedFullSpan As TextSpan) 306Private Sub VerifyListSpans(list As SyntaxTriviaList, expectedFullSpan As TextSpan) 411VerifyListSpans(statements, TextSpan.FromBounds(statements(0).FullSpan.Start, statements(statements.Count - 1).FullSpan.End)) 942Private Sub CheckErrorList(node As VisualBasicSyntaxNode, expectedErrorCodes As Integer(), expectedSpans As TextSpan()) 964Private Sub CheckErrorList(node As SyntaxToken, expectedErrorCodes As Integer(), expectedSpans As TextSpan())
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (7)
BasicTestSource.vb (1)
44Optional ByRef spans As IEnumerable(Of IEnumerable(Of TextSpan)) = Nothing) As SyntaxTree()
CompilationTestUtils.vb (4)
288Optional ByRef spans As IEnumerable(Of IEnumerable(Of TextSpan)) = Nothing) As IEnumerable(Of SyntaxTree) 363Optional ByRef spans As IEnumerable(Of IEnumerable(Of TextSpan)) = Nothing, 634Public Function CreateParseTreeAndSpans(programElement As XElement, Optional parseOptions As VisualBasicParseOptions = Nothing) As (tree As SyntaxTree, spans As IList(Of TextSpan)) 637Dim spans As ImmutableArray(Of TextSpan) = Nothing
DiagnosticExtensions.vb (1)
23Friend Function GetDiagnosticsForSyntaxTree(c As VisualBasicCompilation, stage As CompilationStage, tree As SyntaxTree, Optional filterSpan As TextSpan? = Nothing) As ImmutableArray(Of Diagnostic)
ParserTestUtilities.vb (1)
216Public changeSpan As TextSpan
Microsoft.CodeAnalysis.VisualBasic.Workspaces (135)
CaseCorrection\VisualBasicCaseCorrectionService.vb (2)
29spans As ImmutableArray(Of TextSpan), 39span As TextSpan,
Classification\ClassificationHelpers.vb (1)
321Friend Sub AddLexicalClassifications(text As SourceText, textSpan As TextSpan, result As ArrayBuilder(Of ClassifiedSpan), cancellationToken As CancellationToken)
Classification\SyntaxClassification\VisualBasicSyntaxClassificationService.vb (2)
35Public Overrides Sub AddLexicalClassifications(text As SourceText, textSpan As TextSpan, result As ArrayBuilder(Of ClassifiedSpan), cancellationToken As CancellationToken) 39Public Overrides Sub AddSyntacticClassifications(root As SyntaxNode, textSpan As TextSpan, result As ArrayBuilder(Of ClassifiedSpan), cancellationToken As CancellationToken)
Classification\VisualBasicClassificationService.vb (1)
22Public Overrides Sub AddLexicalClassifications(text As SourceText, textSpan As TextSpan, result As ArrayBuilder(Of ClassifiedSpan), cancellationToken As CancellationToken)
Classification\Worker.DocumentationCommentClassifier.vb (2)
88Dim span = TextSpan.FromBounds(spanStart.Value, spanStart.Value + index) 98Dim span = TextSpan.FromBounds(spanStart.Value, trivia.Span.End)
Classification\Worker.vb (5)
14Private ReadOnly _textSpan As TextSpan 19Private Sub New(textSpan As TextSpan, list As ArrayBuilder(Of ClassifiedSpan), cancellationToken As CancellationToken) 28tokens As IEnumerable(Of SyntaxToken), textSpan As TextSpan, list As ArrayBuilder(Of ClassifiedSpan), cancellationToken As CancellationToken) 37node As SyntaxNode, textSpan As TextSpan, list As ArrayBuilder(Of ClassifiedSpan), cancellationToken As CancellationToken) 42Private Sub AddClassification(textSpan As TextSpan, classificationType As String)
CodeCleanup\Providers\AbstractTokensCodeCleanupProvider.vb (6)
20document As Document, root As SyntaxNode, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) As Task(Of Rewriter) 22Public Async Function CleanupAsync(document As Document, spans As ImmutableArray(Of TextSpan), options As CodeCleanupOptions, cancellationToken As CancellationToken) As Task(Of Document) Implements ICodeCleanupProvider.CleanupAsync 30Public Async Function CleanupAsync(root As SyntaxNode, spans As ImmutableArray(Of TextSpan), options As SyntaxFormattingOptions, services As SolutionServices, cancellationToken As CancellationToken) As Task(Of SyntaxNode) Implements ICodeCleanupProvider.CleanupAsync 38Protected ReadOnly _spans As SimpleIntervalTree(Of TextSpan, TextSpanIntervalIntrospector) 44Public Sub New(spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) 49_spans = New SimpleIntervalTree(Of TextSpan, TextSpanIntervalIntrospector)(New TextSpanIntervalIntrospector(), spans)
CodeCleanup\Providers\AddMissingTokensCodeCleanupProvider.vb (3)
29Protected Overrides Async Function GetRewriterAsync(document As Document, root As SyntaxNode, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) As Task(Of Rewriter) 38Private Sub New(semanticModel As SemanticModel, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) 44Public Shared Async Function CreateAsync(document As Document, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) As Task(Of AddMissingTokensRewriter)
CodeCleanup\Providers\CaseCorrectionCodeCleanupProvider.vb (2)
31Public Function CleanupAsync(document As Document, spans As ImmutableArray(Of TextSpan), options As CodeCleanupOptions, cancellationToken As CancellationToken) As Task(Of Document) Implements ICodeCleanupProvider.CleanupAsync 35Public Function CleanupAsync(root As SyntaxNode, spans As ImmutableArray(Of TextSpan), options As SyntaxFormattingOptions, services As SolutionServices, cancellationToken As CancellationToken) As Task(Of SyntaxNode) Implements ICodeCleanupProvider.CleanupAsync
CodeCleanup\Providers\FixIncorrectTokensCodeCleanupProvider.vb (3)
38Protected Overrides Function GetRewriterAsync(document As Document, root As SyntaxNode, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) As Task(Of Rewriter) 48spans As ImmutableArray(Of TextSpan), 55Public Shared Async Function CreateAsync(document As Document, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) As Task(Of Rewriter)
CodeCleanup\Providers\NormalizeModifiersOrOperatorsCodeCleanupProvider.vb (5)
35Public Async Function CleanupAsync(document As Document, spans As ImmutableArray(Of TextSpan), options As CodeCleanupOptions, cancellationToken As CancellationToken) As Task(Of Document) Implements ICodeCleanupProvider.CleanupAsync 42Public Function CleanupAsync(root As SyntaxNode, spans As ImmutableArray(Of TextSpan), options As SyntaxFormattingOptions, services As SolutionServices, cancellationToken As CancellationToken) As Task(Of SyntaxNode) Implements ICodeCleanupProvider.CleanupAsync 74Private ReadOnly _spans As SimpleIntervalTree(Of TextSpan, TextSpanIntervalIntrospector) 81Public Sub New(spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) 84_spans = New SimpleIntervalTree(Of TextSpan, TextSpanIntervalIntrospector)(New TextSpanIntervalIntrospector(), spans)
CodeCleanup\Providers\ReduceTokensCodeCleanupProvider.vb (2)
33Protected Overrides Function GetRewriterAsync(document As Document, root As SyntaxNode, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) As Task(Of Rewriter) 40Public Sub New(spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken)
CodeCleanup\Providers\RemoveUnnecessaryLineContinuationCodeCleanupProvider.vb (6)
32Public Async Function CleanupAsync(document As Document, spans As ImmutableArray(Of TextSpan), options As CodeCleanupOptions, cancellationToken As CancellationToken) As Task(Of Document) Implements ICodeCleanupProvider.CleanupAsync 45Public Function CleanupAsync(root As SyntaxNode, spans As ImmutableArray(Of TextSpan), options As SyntaxFormattingOptions, services As SolutionServices, cancellationToken As CancellationToken) As Task(Of SyntaxNode) Implements ICodeCleanupProvider.CleanupAsync 55Private ReadOnly _spans As ImmutableArray(Of TextSpan) 57Public Shared Function Process(root As SyntaxNode, spans As ImmutableArray(Of TextSpan), cancellationToken As CancellationToken) As SyntaxNode 62Private Sub New(root As SyntaxNode, spans As ImmutableArray(Of TextSpan)) 102Private Sub Cleanup(root As SyntaxNode, span As TextSpan, cancellationToken As CancellationToken)
CodeCleanup\VisualBasicCodeCleanerService.vb (5)
31Protected Overrides Function GetSpansToAvoid(root As SyntaxNode) As ImmutableArray(Of TextSpan) 39Dim result = ArrayBuilder(Of TextSpan).GetInstance() 46Private Sub ProcessNode(node As SyntaxNode, result As ArrayBuilder(Of TextSpan)) 60Private Sub ProcessToken(token As SyntaxToken, result As ArrayBuilder(Of TextSpan)) 73Private Shared Function SkipProcessing(nodeOrToken As SyntaxNodeOrToken, result As ArrayBuilder(Of TextSpan)) As Boolean
CodeGeneration\VisualBasicCodeGenerationService.vb (2)
74indices.Add(Not destination.OverlapsHiddenPosition(TextSpan.FromBounds(0, destination.Members.First.SpanStart), cancellationToken)) 87TextSpan.FromBounds(destination.Members.Last.Span.End, destination.EndOfFileToken.SpanStart), cancellationToken))
CompilationUnitSyntaxExtensions.vb (2)
32Return Not contextNode.SyntaxTree.OverlapsHiddenPosition(TextSpan.FromBounds(start, [end]), cancellationToken) 39Return Not contextNode.SyntaxTree.OverlapsHiddenPosition(TextSpan.FromBounds(start, [end]), cancellationToken)
Formatting\Engine\AggregatedFormattingResult.vb (1)
15Public Sub New(node As SyntaxNode, results As IList(Of AbstractFormattingResult), formattingSpans As SimpleIntervalTree(Of TextSpan, TextSpanIntervalIntrospector))
Formatting\Engine\FormattingResult.vb (1)
21Friend Sub New(treeInfo As TreeData, tokenStream As TokenStream, spanToFormat As TextSpan)
Formatting\Engine\Trivia\TriviaDataFactory.AbstractLineBreakTrivia.vb (1)
48Public Overrides Function GetTextChanges(textSpan As TextSpan) As IEnumerable(Of TextChange)
Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.vb (1)
98Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.vb (1)
58Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.vb (1)
90Public Overrides Function GetTextChanges(span As TextSpan) As IEnumerable(Of TextChange)
Formatting\Engine\Trivia\TriviaDataFactory.TriviaRewriter.vb (7)
16Private ReadOnly _spans As SimpleIntervalTree(Of TextSpan, TextSpanIntervalIntrospector) 23Public Sub New(node As SyntaxNode, spanToFormat As SimpleIntervalTree(Of TextSpan, TextSpanIntervalIntrospector), map As Dictionary(Of ValueTuple(Of SyntaxToken, SyntaxToken), TriviaData), cancellationToken As CancellationToken) 84Private Function GetTextSpan(pair As ValueTuple(Of SyntaxToken, SyntaxToken)) As TextSpan 86Return TextSpan.FromBounds(_node.FullSpan.Start, pair.Item2.SpanStart) 90Return TextSpan.FromBounds(pair.Item1.Span.End, _node.FullSpan.End) 93Return TextSpan.FromBounds(pair.Item1.Span.End, pair.Item2.SpanStart) 108Private Shared Function GetSyntaxTriviaList(textSpan As TextSpan, triviaData As TriviaData, cancellationToken As CancellationToken) As SyntaxTriviaList
Formatting\Rules\BaseFormattingRule.vb (8)
28Optional textSpan As TextSpan = Nothing, 38Protected Shared Sub SetAlignmentBlockOperation(operations As List(Of IndentBlockOperation), baseToken As SyntaxToken, startToken As SyntaxToken, endToken As SyntaxToken, span As TextSpan, Optional [option] As IndentBlockOption = IndentBlockOption.RelativePosition) 46Protected Shared Sub AddAbsolutePositionIndentBlockOperation(operations As List(Of IndentBlockOperation), startToken As SyntaxToken, endToken As SyntaxToken, indentation As Integer, span As TextSpan, Optional [option] As IndentBlockOption = IndentBlockOption.AbsolutePosition) 50Private Shared Function GetAlignmentSpan(startToken As SyntaxToken, endToken As SyntaxToken) As TextSpan 52Return TextSpan.FromBounds(previousToken.Span.End, endToken.FullSpan.End) 55Private Shared Function GetIndentBlockSpan(startToken As SyntaxToken, endToken As SyntaxToken) As TextSpan 64Return TextSpan.FromBounds(spanStart, trivia.FullSpan.Start) 68Return TextSpan.FromBounds(spanStart, nextToken.SpanStart)
Formatting\Rules\NodeBasedFormattingRule.vb (2)
79AddIndentBlockOperation(operations, baseToken, startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End)) 157operations.Add(FormattingOperations.CreateIndentBlockOperation(caseBlockLastToken, nextTokenAfterCase, TextSpan.FromBounds(caseBlockLastToken.Span.End, nextTokenAfterCase.SpanStart), 1, IndentBlockOption.RelativePosition))
Formatting\VisualBasicSyntaxFormatting.vb (1)
42Protected Overrides Function CreateAggregatedFormattingResult(node As SyntaxNode, results As IList(Of AbstractFormattingResult), Optional formattingSpans As SimpleIntervalTree(Of TextSpan, TextSpanIntervalIntrospector) = Nothing) As IFormattingResult
Formatting\VisualBasicSyntaxFormattingService.vb (1)
32Public Function GetFormattingChangesOnPaste(document As ParsedDocument, textSpan As TextSpan, options As SyntaxFormattingOptions, cancellationToken As CancellationToken) As ImmutableArray(Of TextChange) Implements ISyntaxFormattingService.GetFormattingChangesOnPaste
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\ExpressionSyntaxExtensions.vb\ExpressionSyntaxExtensions.vb (1)
221Public Function GetImplicitMemberAccessExpressions(expression As SyntaxNode, span As TextSpan) As IEnumerable(Of ExpressionSyntax)
LanguageServices\FixAllSpanMappingService\VisualBasicFixAllSpanMappingService.vb (3)
22Protected Overrides Function GetFixAllSpansIfWithinGlobalStatementAsync(document As Document, diagnosticSpan As TextSpan, cancellationToken As CancellationToken) As Task(Of ImmutableDictionary(Of Document, ImmutableArray(Of TextSpan))) 24Return Task.FromResult(ImmutableDictionary(Of Document, ImmutableArray(Of TextSpan)).Empty)
OrganizeImports\VisualBasicOrganizeImportsService.Rewriter.vb (4)
74Private Shared Function GetTextSpan(Of TSyntax As SyntaxNode)(list As SyntaxList(Of TSyntax)) As TextSpan 75Return TextSpan.FromBounds(list.First().FullSpan.Start, list.Last().FullSpan.[End]) 78Private Shared Function GetTextSpan(Of TSyntax As SyntaxNode)(list As SeparatedSyntaxList(Of TSyntax)) As TextSpan 79Return TextSpan.FromBounds(list.First().FullSpan.Start, list.Last().FullSpan.[End])
Rename\VisualBasicRenameRewriterLanguageService.vb (14)
46Private ReadOnly _renameLocations As ImmutableDictionary(Of TextSpan, RenameLocation) 47Private ReadOnly _conflictLocations As ImmutableHashSet(Of TextSpan) 81Private ReadOnly _stringAndCommentTextSpans As ImmutableDictionary(Of TextSpan, ImmutableSortedSet(Of TextSpan)) 91Private _modifiedSubSpans As List(Of ValueTuple(Of TextSpan, TextSpan)) 94Private ReadOnly _complexifiedSpans As HashSet(Of TextSpan) = New HashSet(Of TextSpan) 96Private Sub AddModifiedSpan(oldSpan As TextSpan, newSpan As TextSpan) 186Me._modifiedSubSpans = New List(Of ValueTuple(Of TextSpan, TextSpan))() 590Private Function RenameInStringLiteral(oldToken As SyntaxToken, newToken As SyntaxToken, subSpansToReplace As ImmutableSortedSet(Of TextSpan), createNewStringLiteral As Func(Of SyntaxTriviaList, String, String, SyntaxTriviaList, SyntaxToken)) As SyntaxToken 627Dim subSpansToReplace As ImmutableSortedSet(Of TextSpan) = Nothing
Simplification\Reducers\VisualBasicNameReducer.vb (1)
40Dim issueSpan As TextSpan
Simplification\Reducers\VisualBasicVariableDeclaratorReducer.vb (2)
38Dim issueSpan As TextSpan 53<Out> ByRef issueSpan As TextSpan) As Boolean
Simplification\Simplifiers\ExpressionSimplifier.vb (6)
28ByRef issueSpan As TextSpan, 54<Out> ByRef issueSpan As TextSpan, 78<Out> ByRef issueSpan As TextSpan, 175<Out> ByRef issueSpan As TextSpan 230<Out()> ByRef issueSpan As TextSpan 275<Out> ByRef issueSpan As TextSpan,
Simplification\Simplifiers\NameSimplifier.vb (4)
30<Out> ByRef issueSpan As TextSpan, 120Dim issueSpanWithoutAttributeSuffix As TextSpan = Nothing 324Private Shared Function TryOmitModuleName(name As QualifiedNameSyntax, semanticModel As SemanticModel, <Out()> ByRef replacementNode As ExpressionSyntax, <Out()> ByRef issueSpan As TextSpan, cancellationToken As CancellationToken) As Boolean 357<Out> ByRef issueSpan As TextSpan,
SpecialFormattingOperation.vb (5)
71TextSpan.FromBounds(startToken.FullSpan.Start, node.FullSpan.End), indentationDelta:=1, [option]:=IndentBlockOption.RelativePosition)) 109baseToken, startToken, endToken, TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End), indentationDelta, IndentBlockOption.RelativePosition)) 147Dim span As TextSpan 155span = TextSpan.FromBounds(baseToken.Span.End, firstToken.SpanStart) 158span = TextSpan.FromBounds(baseToken.Span.End, closeBrace.Span.End)
SyntaxNodeExtensions.vb (6)
380textSpan As TextSpan, 388textSpan As TextSpan, 404textSpan As TextSpan, 885Public Function CheckTopLevel(node As SyntaxNode, span As TextSpan) As Boolean 909Public Function ContainsInMethodBlockBody(block As MethodBlockBaseSyntax, textSpan As TextSpan) As Boolean 914Dim blockSpan = TextSpan.FromBounds(block.BlockStatement.Span.End, block.EndBlockStatement.SpanStart)
VisualBasicSmartTokenFormatter.vb (1)
40Dim spans = SpecializedCollections.SingletonEnumerable(TextSpan.FromBounds(previousToken.SpanStart, token.Span.End))
VisualBasicSymbolDeclarationService.vb (1)
51Public Overrides ReadOnly Property Span As TextSpan
VisualBasicSyntaxFacts.vb (11)
794Public Function GetMemberBodySpanForSpeculativeBinding(node As SyntaxNode) As TextSpan Implements ISyntaxFacts.GetMemberBodySpanForSpeculativeBinding 817Return TextSpan.FromBounds(spanStart, method.EndBlockStatement.SpanStart) 823Public Function ContainsInMemberBody(node As SyntaxNode, span As TextSpan) As Boolean Implements ISyntaxFacts.ContainsInMemberBody 857Private Shared Function ContainsExclusively(outerSpan As TextSpan, innerSpan As TextSpan) As Boolean 865Private Shared Function GetSyntaxListSpan(Of T As SyntaxNode)(list As SyntaxList(Of T)) As TextSpan 867Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End) 870Private Shared Function GetSeparatedSyntaxListSpan(Of T As SyntaxNode)(list As SeparatedSyntaxList(Of T)) As TextSpan 872Return TextSpan.FromBounds(list.First.SpanStart, list.Last.Span.End) 1140Public Function GetInactiveRegionSpanAroundPosition(tree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As TextSpan Implements ISyntaxFacts.GetInactiveRegionSpanAroundPosition 1462Public Function ContainsInterleavedDirective(span As TextSpan, token As SyntaxToken, cancellationToken As CancellationToken) As Boolean Implements ISyntaxFacts.ContainsInterleavedDirective
VisualBasicSyntaxFactsService.vb (1)
39Public Function GetSelectedFieldsAndPropertiesAsync(tree As SyntaxTree, textSpan As TextSpan, allowPartialSelection As Boolean, cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of SyntaxNode)) Implements ISyntaxFactsService.GetSelectedFieldsAndPropertiesAsync
Workspace\LanguageServices\VisualBasicSyntaxTreeFactoryService.NodeSyntaxReference.vb (1)
24Public Overrides ReadOnly Property Span As TextSpan
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (5)
Formatting\VisualBasicFormattingTestBase.vb (4)
64Dim spans = New List(Of TextSpan)() 73spans = New List(Of TextSpan)() 86Dim spans As ImmutableArray(Of TextSpan) = Nothing 105spans As IEnumerable(Of TextSpan),
VisualBasicSyntaxFactsServiceTests.vb (1)
507Dim span As TextSpan
Microsoft.CodeAnalysis.Workspaces (734)
AbstractAggregatedFormattingResult.cs (3)
22private readonly SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? _formattingSpans; 30SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? formattingSpans) 48protected SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector> GetFormattingSpans()
AbstractCodeGenerationService_FindDeclaration.cs (3)
46protected static TextSpan GetSpan(SyntaxNode node) 51return TextSpan.FromBounds(start.SpanStart, end.Span.End); 93var span = GetSpan(destination);
AbstractFormatEngine.cs (5)
37protected readonly TextSpan SpanToFormat; 317private TextSpan GetSpanToFormat() 322return TextSpan.FromBounds(startPosition, endPosition); 443var spanBetweenTokens = TextSpan.FromBounds(token1.Span.End, token2.SpanStart);
AbstractFormatEngine.OperationApplier.cs (2)
346var spanBetweenTokens = TextSpan.FromBounds(previousToken.Token.Span.End, currentToken.Token.SpanStart);
AbstractFormattingResult.cs (4)
26public readonly TextSpan FormattedSpan; 31TextSpan formattedSpan) 78var span = TextSpan.FromBounds(token1.RawKind == 0 ? this.TreeInfo.StartPosition : token1.Span.End, token2.RawKind == 0 ? this.TreeInfo.EndPosition : token2.SpanStart);
AbstractHeaderFacts.cs (2)
46var headerSpan = TextSpan.FromBounds(
AbstractIndentation.Indenter.cs (3)
237private TextSpan GetNormalizedSpan(int position) 241return TextSpan.FromBounds(LineToBeIndented.Start, position); 244return TextSpan.FromBounds(position, LineToBeIndented.Start);
AbstractMoveDeclarationNearReferenceService.State.cs (2)
172var affectedSpan = TextSpan.FromBounds(previousToken.SpanStart, FirstStatementAffectedInInnermostBlock.Span.End);
AbstractSelectedMembers.cs (4)
35SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 39SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken) 43SyntaxTree tree, TextSpan textSpan, bool allowPartialSelection, 78SyntaxNode root, SourceText text, TextSpan textSpan,
AbstractSyntaxFormatting.cs (5)
23private static readonly Func<TextSpan, bool> s_notEmpty = s => !s.IsEmpty; 34protected abstract IFormattingResult CreateAggregatedFormattingResult(SyntaxNode node, IList<AbstractFormattingResult> results, SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>? formattingSpans = null); 38public IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken) 40IReadOnlyList<TextSpan> spansToFormat; 45? SpecializedCollections.EmptyReadOnlyList<TextSpan>()
AbstractTriviaDataFactory.FormattedWhitespace.cs (1)
53public override IEnumerable<TextChange> GetTextChanges(TextSpan textSpan)
AbstractTriviaDataFactory.Whitespace.cs (1)
90public override IEnumerable<TextChange> GetTextChanges(TextSpan span)
AbstractTriviaFormatter.cs (13)
46private delegate void WhitespaceAppender<T>(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<T> changes); 388var span = GetTextSpan(trivia1, trivia2); 500var span = TextSpan.FromBounds(start, end); 716var insertionPoint = GetInsertionSpan(changes); 731private TextSpan GetInsertionSpan(ArrayBuilder<TextChange> changes) 766TextSpan notUsed, 823private TextChange GetWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span) 826private void AddWhitespaceTextChange(LineColumn lineColumn, LineColumnDelta delta, TextSpan span, ArrayBuilder<TextChange> changes) 832private TextSpan GetTextSpan(SyntaxTrivia trivia1, SyntaxTrivia trivia2) 836return TextSpan.FromBounds(this.StartPosition, trivia2.FullSpan.Start); 841return TextSpan.FromBounds(trivia1.FullSpan.End, this.EndPosition); 844return TextSpan.FromBounds(trivia1.FullSpan.End, trivia2.FullSpan.Start);
AbstractVirtualCharService.cs (3)
30string tokenText, int index, int offset, out TextSpan span) 174if (!IsLegalBraceEscape(tokenText, index, offset, out var span)) 242return sequence.GetSubSequence(TextSpan.FromBounds(startIndexInclusive, endIndexExclusive));
AnchorIndentationOperation.cs (2)
16internal AnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 30public TextSpan TextSpan { get; }
BaseIndentationFormattingRule.cs (10)
20private readonly TextSpan _span; 22public BaseIndentationFormattingRule(SyntaxNode root, TextSpan span, int baseIndentation, AbstractFormattingRule? vbHelperFormattingRule = null) 130private TextSpan AdjustTextSpan(TextSpan textSpan) 131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End)); 133private static void SetInnermostNodeForSpan(SyntaxNode root, ref TextSpan span, out SyntaxToken token1, out SyntaxToken token2, out SyntaxNode? commonNode) 149private static void GetTokens(SyntaxNode root, TextSpan span, out SyntaxToken token1, out SyntaxToken token2) 168private static TextSpan GetSpanFromTokens(TextSpan span, SyntaxToken token1, SyntaxToken token2) 217return TextSpan.FromBounds(start, end);
BKTree.Builder.cs (6)
37private readonly TextSpan[] _wordSpans; 102_wordSpans = new TextSpan[distinctValues.Length]; 178private void Add(TextSpan characterSpan, int insertionIndex) 219TextSpan characterSpan, int insertionIndex, int currentNodeEdgeCount, int currentNodeIndex, int editDistance) 289public readonly TextSpan CharacterSpan; 293public BuilderNode(TextSpan characterSpan) : this()
BKTree.cs (1)
122var characterSpan = currentNode.WordSpan;
BKTree.Node.cs (2)
17public readonly TextSpan WordSpan; 27public Node(TextSpan wordSpan, int edgeCount, int firstEdgeIndex)
BottomUpBaseIndentationFinder.cs (1)
314var map = new HashSet<TextSpan>();
CaseCorrection\AbstractCaseCorrectionService.cs (4)
22protected abstract void AddReplacements(SemanticModel? semanticModel, SyntaxNode root, ImmutableArray<TextSpan> spans, ConcurrentDictionary<SyntaxToken, SyntaxToken> replacements, CancellationToken cancellationToken); 24public async Task<Document> CaseCorrectAsync(Document document, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken) 43public SyntaxNode CaseCorrect(SyntaxNode root, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken) 46private SyntaxNode CaseCorrect(SemanticModel? semanticModel, SyntaxNode root, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken)
CaseCorrection\CaseCorrector.cs (3)
56public static async Task<Document> CaseCorrectAsync(Document document, TextSpan span, CancellationToken cancellationToken = default) 64public static Task<Document> CaseCorrectAsync(Document document, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken = default) 70internal static SyntaxNode CaseCorrect(SyntaxNode root, ImmutableArray<TextSpan> spans, SolutionServices services, CancellationToken cancellationToken = default)
CaseCorrection\ICaseCorrectionService.cs (2)
19Task<Document> CaseCorrectAsync(Document document, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken); 24SyntaxNode CaseCorrect(SyntaxNode root, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken);
Classification\AbstractClassificationService.cs (9)
23public abstract void AddLexicalClassifications(SourceText text, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken); 27Document document, TextSpan textSpan, ClassificationOptions options, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken) 33Document document, TextSpan textSpan, ClassificationOptions options, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken) 40TextSpan textSpan, 113TextSpan textSpan, 143TextSpan textSpan, 166foreach (var span in reassignedVariableSpans) 185public async Task AddSyntacticClassificationsAsync(Document document, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken) 192SolutionServices services, SyntaxNode? root, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken)
Classification\ClassifiedSpan.cs (3)
14public TextSpan TextSpan { get; } 16public ClassifiedSpan(string classificationType, TextSpan textSpan) 21public ClassifiedSpan(TextSpan textSpan, string classificationType)
Classification\Classifier.cs (4)
25TextSpan textSpan, 45TextSpan textSpan, 57TextSpan textSpan, 93SolutionServices services, SemanticModel semanticModel, TextSpan textSpan, ClassificationOptions options,
Classification\ClassifierHelper.cs (7)
29TextSpan span, 84TextSpan widenedSpan) 129private static void AdjustSpans(ArrayBuilder<ClassifiedSpan> spans, TextSpan widenedSpan) 177TextSpan.FromBounds( 242finalParts.Add(new ClassifiedSpan(syntacticPart.ClassificationType, TextSpan.FromBounds( 257finalParts.Add(new ClassifiedSpan(syntacticPart.ClassificationType, TextSpan.FromBounds( 265finalParts.Add(new ClassifiedSpan(syntacticPart.ClassificationType, TextSpan.FromBounds(
Classification\IClassificationService.cs (5)
27void AddLexicalClassifications(SourceText text, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken); 33void AddSyntacticClassifications(SolutionServices services, SyntaxNode root, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken); 41Task AddSyntacticClassificationsAsync(Document document, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken); 53Task AddSemanticClassificationsAsync(Document document, TextSpan textSpan, ClassificationOptions options, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken); 59Task AddEmbeddedLanguageClassificationsAsync(Document document, TextSpan textSpan, ClassificationOptions options, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken);
Classification\IEmbeddedLanguageClassificationService.cs (2)
17TextSpan textSpan, 25TextSpan textSpan,
Classification\IRemoteSemanticClassificationService.cs (3)
24TextSpan span, 38TextSpan textSpan, 79var textSpan = classifiedSpan.TextSpan;
Classification\SyntaxClassification\AbstractNameSyntaxClassifier.cs (1)
32TextSpan span,
Classification\SyntaxClassification\AbstractSyntaxClassificationService.cs (4)
24public abstract void AddLexicalClassifications(SourceText text, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken); 25public abstract void AddSyntacticClassifications(SyntaxNode root, TextSpan textSpan, ArrayBuilder<ClassifiedSpan> result, CancellationToken cancellationToken); 33TextSpan textSpan, 53TextSpan textSpan,
Classification\SyntaxClassification\AbstractSyntaxClassificationService.Worker.cs (4)
21private readonly TextSpan _textSpan; 32TextSpan textSpan, 55TextSpan textSpan, 77private void AddClassification(TextSpan textSpan, string type)
Classification\SyntaxClassification\ISyntaxClassificationService.cs (4)
22TextSpan textSpan, 29TextSpan textSpan, 36TextSpan textSpan, 46TextSpan textSpan,
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (1)
114TextSpan.FromBounds(start: commonLeftWidth.Value, end: oldRootWidth - commonRightWidth),
CodeCleanup\AbstractCodeCleanerService.cs (30)
28protected abstract ImmutableArray<TextSpan> GetSpansToAvoid(SyntaxNode root); 30public async Task<Document> CleanupAsync(Document document, ImmutableArray<TextSpan> spans, CodeCleanupOptions options, ImmutableArray<ICodeCleanupProvider> providers, CancellationToken cancellationToken) 74public async Task<SyntaxNode> CleanupAsync(SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SolutionServices services, ImmutableArray<ICodeCleanupProvider> providers, CancellationToken cancellationToken) 115private static ImmutableArray<TextSpan> GetTextSpansFromAnnotation( 121var builder = ArrayBuilder<TextSpan>.GetInstance(); 138out var span)) 153out TextSpan span) 220span = TextSpan.FromBounds(node.SpanStart, GetNextTokenEndPosition(nextTokenMarker.Type, nextToken)); 227span = TextSpan.FromBounds(GetPreviousTokenStartPosition(previousTokenMarker.Type, previousToken), node.Span.End); 271SyntaxNode root, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken) 279foreach (var span in nonOverlappingSpans) 321private static ImmutableArray<TextSpan> GetNonOverlappingSpans( 322SyntaxNode root, ImmutableArray<TextSpan> spans, CancellationToken cancellationToken) 328var tokenSpans = new List<TextSpan>(); 329foreach (var span in spans) 348tokenSpans.Add(TextSpan.FromBounds(start, end)); 360SyntaxNode root, TextSpan span, 382private static TextSpan GetSpanAlignedToTokens( 383SyntaxNode root, TextSpan span, 392return TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End); 445private static bool CleanupWholeNode(TextSpan nodeSpan, ImmutableArray<TextSpan> spans) 459Func<SyntaxNode, ImmutableArray<TextSpan>> spanGetter, 467var spans = ImmutableArray<TextSpan>.Empty; 521private ImmutableArray<TextSpan> GetSpans( 522SyntaxNode root, Func<SyntaxNode, ImmutableArray<TextSpan>> spanGetter) 540Func<SyntaxNode, ImmutableArray<TextSpan>> spanGetter, 549var spans = ImmutableArray<TextSpan>.Empty; 600private static bool TryCreateTextSpan(int start, int end, out TextSpan span) 609span = TextSpan.FromBounds(start, end);
CodeCleanup\CodeCleaner.cs (4)
72public static Task<Document> CleanupAsync(Document document, TextSpan span, CodeCleanupOptions options, ImmutableArray<ICodeCleanupProvider> providers = default, CancellationToken cancellationToken = default) 79public static async Task<Document> CleanupAsync(Document document, ImmutableArray<TextSpan> spans, CodeCleanupOptions options, ImmutableArray<ICodeCleanupProvider> providers = default, CancellationToken cancellationToken = default) 89public static Task<SyntaxNode> CleanupAsync(SyntaxNode root, TextSpan span, SyntaxFormattingOptions options, SolutionServices services, ImmutableArray<ICodeCleanupProvider> providers = default, CancellationToken cancellationToken = default) 96public static Task<SyntaxNode> CleanupAsync(SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SolutionServices services, ImmutableArray<ICodeCleanupProvider> providers = default, CancellationToken cancellationToken = default)
CodeCleanup\ICodeCleanerService.cs (2)
30Task<Document> CleanupAsync(Document document, ImmutableArray<TextSpan> spans, CodeCleanupOptions options, ImmutableArray<ICodeCleanupProvider> providers, CancellationToken cancellationToken); 37Task<SyntaxNode> CleanupAsync(SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SolutionServices services, ImmutableArray<ICodeCleanupProvider> providers, CancellationToken cancellationToken);
CodeCleanup\Providers\FormatCodeCleanupProvider.cs (2)
28public async Task<Document> CleanupAsync(Document document, ImmutableArray<TextSpan> spans, CodeCleanupOptions options, CancellationToken cancellationToken) 40public Task<SyntaxNode> CleanupAsync(SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SolutionServices services, CancellationToken cancellationToken)
CodeCleanup\Providers\ICodeCleanupProvider.cs (2)
27Task<Document> CleanupAsync(Document document, ImmutableArray<TextSpan> spans, CodeCleanupOptions options, CancellationToken cancellationToken); 34Task<SyntaxNode> CleanupAsync(SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SolutionServices services, CancellationToken cancellationToken);
CodeCleanup\Providers\SimplificationCodeCleanupProvider.cs (2)
19public Task<Document> CleanupAsync(Document document, ImmutableArray<TextSpan> spans, CodeCleanupOptions options, CancellationToken cancellationToken) 22public Task<SyntaxNode> CleanupAsync(SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SolutionServices services, CancellationToken cancellationToken)
CodeFixes\CodeFixContext.cs (6)
25private readonly TextSpan _span; 61public TextSpan Span => _span; 114TextSpan span, 147TextSpan span, 216TextSpan span, 291private static void VerifyDiagnosticsArgument(ImmutableArray<Diagnostic> diagnostics, TextSpan span)
CodeFixes\FixAllOccurrences\FixAllContext.cs (3)
150TextSpan? diagnosticSpan, 245TextSpan? filterSpan) 263internal async Task<ImmutableArray<Diagnostic>> GetDocumentSpanDiagnosticsAsync(Document document, TextSpan filterSpan)
CodeFixes\FixAllOccurrences\FixAllContext.SpanBasedDiagnosticProvider.cs (3)
23/// which supports a <see cref="GetDocumentSpanDiagnosticsAsync(Document, TextSpan, CancellationToken)"/> 30/// <see cref="GetDocumentSpanDiagnosticsAsync(Document, TextSpan, CancellationToken)"/> method to compute 38public abstract Task<IEnumerable<Diagnostic>> GetDocumentSpanDiagnosticsAsync(Document document, TextSpan fixAllSpan, CancellationToken cancellationToken);
CodeFixes\FixAllOccurrences\FixAllContextHelper.cs (2)
111IEnumerable<KeyValuePair<Document, ImmutableArray<TextSpan>>> documentsAndSpans) 116foreach (var span in spans)
CodeFixes\FixAllOccurrences\FixAllState.cs (2)
25public TextSpan? DiagnosticSpan { get; } 29TextSpan? diagnosticSpan,
CodeFixes\Supression\IConfigurationFixProvider.cs (1)
29Task<ImmutableArray<CodeFix>> GetFixesAsync(TextDocument document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CodeActionOptionsProvider fallbackOptions, CancellationToken cancellationToken);
CodeRefactorings\CodeRefactoringContext.cs (12)
52public TextSpan Span { get; } 70private readonly Action<CodeAction, TextSpan?> _registerRefactoring; 78TextSpan span, 89TextSpan span, 100TextSpan span, 101Action<CodeAction, TextSpan?> registerRefactoring, 126/// <param name="applicableToSpan">The <see cref="TextSpan"/> within original document the <paramref name="action"/> is applicable to.</param> 129/// applicable to. It doesn't have to precisely represent the exact <see cref="TextSpan"/> that will get changed. 131internal void RegisterRefactoring(CodeAction action, TextSpan applicableToSpan) => RegisterRefactoring(action, new Nullable<TextSpan>(applicableToSpan)); 133private void RegisterRefactoring(CodeAction action, TextSpan? applicableToSpan) 143internal void Deconstruct(out Document document, out TextSpan span, out CancellationToken cancellationToken)
CodeRefactorings\FixAllOccurences\DocumentBasedFixAllProvider.cs (2)
27/// <see cref="FixAllAsync(FixAllContext, Document, Optional{ImmutableArray{TextSpan}})"/> is invoked for each document for implementors to process. 66protected abstract Task<Document?> FixAllAsync(FixAllContext fixAllContext, Document document, Optional<ImmutableArray<TextSpan>> fixAllSpans);
CodeRefactorings\FixAllOccurences\FixAllContext.cs (1)
110public Task<ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>> GetFixAllSpansAsync(CancellationToken cancellationToken)
CodeRefactorings\FixAllOccurences\FixAllProvider.cs (5)
59public static FixAllProvider Create(Func<FixAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> fixAllAsync) 79Func<FixAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> fixAllAsync, 96private readonly Func<FixAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> _fixAllAsync; 99Func<FixAllContext, Document, Optional<ImmutableArray<TextSpan>>, Task<Document?>> fixAllAsync, 106protected override Task<Document?> FixAllAsync(FixAllContext context, Document document, Optional<ImmutableArray<TextSpan>> fixAllSpans)
CodeRefactorings\FixAllOccurences\FixAllState.cs (9)
29private readonly TextSpan _selectionSpan; 38TextSpan selectionSpan, 51TextSpan selectionSpan, 65TextSpan selectionSpan, 95internal async Task<ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>> GetFixAllSpansAsync(CancellationToken cancellationToken) 104return ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>.Empty; 108return spansByDocument.Select(kvp => KeyValuePairUtil.Create(kvp.Key, new Optional<ImmutableArray<TextSpan>>(kvp.Value))) 125return ImmutableDictionary<Document, Optional<ImmutableArray<TextSpan>>>.Empty; 128return documentsToFix.ToImmutableDictionary(d => d, _ => default(Optional<ImmutableArray<TextSpan>>));
CodeRefactorings\SyntaxEditorBasedCodeRefactoringProvider.cs (3)
41TextSpan fixAllSpan, 53Optional<ImmutableArray<TextSpan>> fixAllSpans, 85ImmutableArray<TextSpan> fixAllSpans,
CommonFormattingHelpers.cs (10)
42public static IEnumerable<(SyntaxToken, SyntaxToken)> ConvertToTokenPairs(this SyntaxNode root, IReadOnlyList<TextSpan> spans) 78public static ValueTuple<SyntaxToken, SyntaxToken> ConvertToTokenPair(this SyntaxNode root, TextSpan textSpan) 154=> (token1.RawKind == 0) ? text.ToString(TextSpan.FromBounds(0, token2.SpanStart)) : text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart)); 256public static TextSpan GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(SyntaxToken startToken, SyntaxToken endToken) 263return TextSpan.FromBounds(startPosition, endPosition); 321var fullSpan = node.FullSpan; 360public static TextSpan GetFormattingSpan(SyntaxNode root, TextSpan span) 370return TextSpan.FromBounds(startPosition, endPosition);
Diagnostics\DiagnosticDataLocation.cs (1)
104public DiagnosticDataLocation WithSpan(TextSpan newSourceSpan, SyntaxTree tree)
Diagnostics\DocumentAnalysisScope.cs (3)
23TextSpan? span, 39public TextSpan? Span { get; } 57public DocumentAnalysisScope WithSpan(TextSpan? span)
Diagnostics\Extensions.cs (5)
57var span = dataLocation.UnmappedFileSpan.GetClampedTextSpan(text); 227TextSpan? span, 245TextSpan? span, 295TextSpan? filterSpan = null) 416async Task AnalyzeDocumentAsync(IPragmaSuppressionsAnalyzer suppressionAnalyzer, Document document, TextSpan? span, Action<Diagnostic> reportDiagnostic)
Diagnostics\IWorkspaceVenusSpanMappingService.cs (1)
20void GetAdjustedDiagnosticSpan(DocumentId documentId, Location location, out TextSpan span, out FileLinePositionSpan originalLineInfo, out FileLinePositionSpan mappedLineInfo);
Differencing\AbstractSyntaxComparer.cs (1)
50protected internal sealed override TextSpan GetSpan(SyntaxNode node)
Differencing\TreeComparer.cs (1)
132protected internal abstract TextSpan GetSpan(TNode node);
DocumentExtensions.cs (1)
114public static async ValueTask<SemanticModel> ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken)
Editing\ImportAdder.cs (7)
20private static async ValueTask<IEnumerable<TextSpan>> GetSpansAsync(Document document, CancellationToken cancellationToken) 26private static async ValueTask<IEnumerable<TextSpan>> GetSpansAsync(Document document, SyntaxAnnotation annotation, CancellationToken cancellationToken) 41public static Task<Document> AddImportsAsync(Document document, TextSpan span, OptionSet? options = null, CancellationToken cancellationToken = default) 53public static Task<Document> AddImportsAsync(Document document, IEnumerable<TextSpan> spans, OptionSet? options = null, CancellationToken cancellationToken = default) 56private static async Task<Document> AddImportsFromSyntaxesAsync(Document document, IEnumerable<TextSpan> spans, OptionSet? _, CancellationToken cancellationToken) 84internal static Task<Document> AddImportsFromSyntaxesAsync(Document document, IEnumerable<TextSpan> spans, AddImportPlacementOptions options, CancellationToken cancellationToken) 99internal static Task<Document> AddImportsFromSymbolAnnotationAsync(Document document, IEnumerable<TextSpan> spans, AddImportPlacementOptions options, CancellationToken cancellationToken)
Editing\ImportAdderService.cs (2)
35IEnumerable<TextSpan> spans, 46var spansTree = new SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>(new TextSpanIntervalIntrospector(), spans);
EditorConfigOption.cs (1)
12internal record class EditorConfigOption(Section Section, TextSpan? Span);
EditorConfigOption`1.cs (2)
12internal record class EditorConfigOption<T>(Section Section, TextSpan? Span, T Value) 16public static implicit operator EditorConfigOption<T>((Section section, TextSpan? span, T value) tuple)
EditorConfigParser.cs (1)
122var sectionSpan = new TextSpan(activeSectionStart, activeSectionEnd);
EmbeddedDiagnostic.cs (3)
23public readonly TextSpan Span; 25public EmbeddedDiagnostic(string message, TextSpan span) 49hashCode = hashCode * -1521134295 + EqualityComparer<TextSpan>.Default.GetHashCode(Span);
EmbeddedSyntaxHelpers.cs (4)
12public static TextSpan GetSpan<TSyntaxKind>(EmbeddedSyntaxToken<TSyntaxKind> token1, EmbeddedSyntaxToken<TSyntaxKind> token2) where TSyntaxKind : struct 15public static TextSpan GetSpan(VirtualCharSequence virtualChars) 18public static TextSpan GetSpan(VirtualChar firstChar, VirtualChar lastChar) 19=> TextSpan.FromBounds(firstChar.Span.Start, lastChar.Span.End);
EmbeddedSyntaxNode.cs (6)
42private TextSpan? _fullSpan; 56public TextSpan GetSpan() 63return TextSpan.FromBounds(start, end); 66public TextSpan? GetFullSpan() 69private TextSpan? ComputeFullSpan() 76return TextSpan.FromBounds(start.Value, end.Value);
EmbeddedSyntaxNodeOrToken.cs (1)
43public TextSpan? GetFullSpan()
EmbeddedSyntaxToken.cs (3)
73public TextSpan GetSpan() 76public TextSpan? GetFullSpan() 91return TextSpan.FromBounds(start, end);
EmbeddedSyntaxTrivia.cs (1)
34public TextSpan GetSpan()
FindSymbols\FindReferences\FindReferenceCache.cs (1)
146var span = token.Span;
FindSymbols\IRemoteSymbolFinderService.cs (1)
29ValueTask OnLiteralReferenceFoundAsync(RemoteServiceCallbackId callbackId, DocumentId documentId, TextSpan span, CancellationToken cancellationToken);
FindSymbols\IStreamingFindReferencesProgress.cs (1)
82ValueTask OnReferenceFoundAsync(Document document, TextSpan span, CancellationToken cancellationToken);
FindSymbols\SymbolFinder.CallbackDispatcher.cs (1)
66public ValueTask OnLiteralReferenceFoundAsync(RemoteServiceCallbackId callbackId, DocumentId documentId, TextSpan span, CancellationToken cancellationToken)
FindSymbols\SymbolFinder.FindLiteralsServerCallback.cs (1)
34public async ValueTask OnLiteralReferenceFoundAsync(DocumentId documentId, TextSpan span, CancellationToken cancellationToken)
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (4)
75public readonly TextSpan Span; 105TextSpan span, 128TextSpan span, 220var span = new TextSpan(spanStart, spanLength);
Formatting\AbstractFormattingService.cs (1)
18public Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, LineFormattingOptions lineFormattingOptions, SyntaxFormattingOptions? syntaxFormattingOptions, CancellationToken cancellationToken)
Formatting\Formatter.cs (17)
65public static Task<Document> FormatAsync(Document document, TextSpan span, OptionSet? options = null, CancellationToken cancellationToken = default) 70internal static Task<Document> FormatAsync(Document document, TextSpan span, SyntaxFormattingOptions options, CancellationToken cancellationToken) 81public static async Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, OptionSet? options = null, CancellationToken cancellationToken = default) 93internal static async Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken) 204public static SyntaxNode Format(SyntaxNode node, TextSpan span, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 207internal static SyntaxNode Format(SyntaxNode node, TextSpan span, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken) 219public static SyntaxNode Format(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 222private static SyntaxNode Format(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken) 228internal static SyntaxNode Format(SyntaxNode node, IEnumerable<TextSpan>? spans, SolutionServices services, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken) 231private static IFormattingResult? GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken) 255internal static IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SolutionServices services, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken) 284public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, TextSpan span, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 287internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, TextSpan span, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken = default) 299public static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options = null, CancellationToken cancellationToken = default) 302internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, SolutionServices services, SyntaxFormattingOptions options, CancellationToken cancellationToken = default) 305private static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, Workspace workspace, OptionSet? options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken) 313internal static IList<TextChange> GetFormattedTextChanges(SyntaxNode node, IEnumerable<TextSpan>? spans, SolutionServices services, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken = default)
Formatting\IFormattingService.cs (1)
24Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, LineFormattingOptions lineFormattingOptions, SyntaxFormattingOptions? syntaxFormattingOptions, CancellationToken cancellationToken);
Formatting\ISyntaxFormattingService.cs (1)
19ImmutableArray<TextChange> GetFormattingChangesOnPaste(ParsedDocument document, TextSpan textSpan, SyntaxFormattingOptions options, CancellationToken cancellationToken);
Formatting\Rules\DefaultFormattingRuleFactoryServiceFactory.cs (1)
32public IEnumerable<TextChange> FilterFormattedChanges(DocumentId document, TextSpan span, IList<TextChange> changes)
Formatting\Rules\IHostDependentFormattingRuleFactoryService.cs (1)
16IEnumerable<TextChange> FilterFormattedChanges(DocumentId documentId, TextSpan span, IList<TextChange> changes);
FormattingContext.AnchorData.cs (1)
27public TextSpan TextSpan => _operation.TextSpan;
FormattingContext.cs (18)
47private readonly HashSet<TextSpan> _indentationMap = new(); 48private readonly HashSet<TextSpan> _suppressWrappingMap = new(); 49private readonly HashSet<TextSpan> _suppressSpacingMap = new(); 50private readonly HashSet<TextSpan> _suppressFormattingMap = new(); 51private readonly HashSet<TextSpan> _anchorMap = new(); 141var baseSpan = _initialIndentBlockOperations[0].TextSpan; 160var operationSpan = operations[i].TextSpan; 181var intervalTreeSpan = operation.TextSpan; 433private static void DebugCheckEmpty<T, TIntrospector>(ContextIntervalTree<T, TIntrospector> tree, TextSpan textSpan) 472var span = token.Span; 493var span = token.Span; 616public bool IsWrappingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 638public bool IsSpacingSuppressed(TextSpan textSpan, bool containsElasticTrivia) 667var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End); 674public bool IsFormattingDisabled(TextSpan textSpan) 682var spanBetweenTwoTokens = TextSpan.FromBounds(token1.SpanStart, token2.Span.End);
FormattingContext.IndentationData.cs (14)
20public IndentationData(TextSpan textSpan) 23public TextSpan TextSpan { get; } 26public IndentationData WithTextSpan(TextSpan span) 29protected abstract IndentationData WithTextSpanCore(TextSpan span); 36public SimpleIndentationData(TextSpan textSpan, int indentation) 44protected override IndentationData WithTextSpanCore(TextSpan span) 68public RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter) 79this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 82private RelativeIndentationData(FormattingContext formattingContext, int inseparableRegionSpanStart, TextSpan textSpan, IndentBlockOperation operation, Func<FormattingContext, IndentBlockOperation, SyntaxToken> effectiveBaseTokenGetter, Func<FormattingContext, IndentBlockOperation, SyntaxToken, int> indentationDeltaGetter, Func<FormattingContext, SyntaxToken, int> baseIndentationGetter, int lazyIndentationDelta) 93this.InseparableRegionSpan = TextSpan.FromBounds(inseparableRegionSpanStart, textSpan.End); 96public TextSpan InseparableRegionSpan { get; } 118protected override IndentationData WithTextSpanCore(TextSpan span) 130public AdjustedIndentationData(TextSpan textSpan, IndentationData baseIndentationData, int adjustment) 153protected override IndentationData WithTextSpanCore(TextSpan span)
FormattingContext.InitialContextFinder.cs (2)
67var span = TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End);
FormattingExtensions.cs (13)
257var span = textChange.Span; 285internal static IEnumerable<TextSpan> GetAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 295static IEnumerable<TextSpan> EnumerateAnnotatedSpans(SyntaxNode node, SyntaxAnnotation annotation) 306internal static TextSpan GetSpan(SyntaxToken firstToken, SyntaxToken lastToken) 321return TextSpan.FromBounds(firstToken.SpanStart, lastToken.Span.End); 324internal static TextSpan GetElasticSpan(SyntaxToken token) 327private static IEnumerable<TextSpan> AggregateSpans(IEnumerable<TextSpan> spans) 329var aggregateSpans = new List<TextSpan>(); 331var last = default(TextSpan); 332foreach (var span in spans) 340last = TextSpan.FromBounds(last.Start, span.End);
FormattingOperations.cs (8)
31=> CreateAnchorIndentationOperation(anchorToken, endToken, TextSpan.FromBounds(anchorToken.Span.End, endToken.Span.End)); 36public static AnchorIndentationOperation CreateAnchorIndentationOperation(SyntaxToken anchorToken, SyntaxToken endToken, TextSpan textSpan) 43=> CreateSuppressOperation(startToken, endToken, TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End), option); 48private static SuppressOperation CreateSuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option) 56var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 63public static IndentBlockOperation CreateIndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 71var span = CommonFormattingHelpers.GetSpanIncludingTrailingAndLeadingTriviaOfAdjacentTokens(startToken, endToken); 79public static IndentBlockOperation CreateRelativeIndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option)
IIndentationService.cs (1)
40return document.Text.ToString(TextSpan.FromBounds(tokenLine.Start, token.SpanStart));
IndentBlockOperation.cs (3)
15internal IndentBlockOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 34internal IndentBlockOperation(SyntaxToken baseToken, SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, int indentationDelta, IndentBlockOption option) 57public TextSpan TextSpan { get; }
IPragmaSuppressionsAnalyzer.cs (1)
24TextSpan? span,
ISyntaxFacts.cs (7)
417bool ContainsInMemberBody([NotNullWhen(true)] SyntaxNode? node, TextSpan span); 419TextSpan GetInactiveRegionSpanAroundPosition(SyntaxTree tree, int position, CancellationToken cancellationToken); 422/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body 423/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be 425/// an empty <see cref="TextSpan"/> at position 0. 428TextSpan GetMemberBodySpanForSpeculativeBinding(SyntaxNode node); 472bool ContainsInterleavedDirective(TextSpan span, SyntaxToken token, CancellationToken cancellationToken);
ISyntaxFactsExtensions.cs (5)
166var span = TextSpan.FromBounds(nodes.First().Span.Start, nodes.Last().Span.End); 184this ISyntaxFacts syntaxFacts, TextSpan span, SyntaxNode node, CancellationToken cancellationToken) 443public static TextSpan GetSpanWithoutAttributes(this ISyntaxFacts syntaxFacts, SyntaxNode root, SyntaxNode node) 463return TextSpan.FromBounds(startOfNodeWithoutAttributes, endOfNode);
ISyntaxFactsService.cs (1)
20Task<ImmutableArray<SyntaxNode>> GetSelectedFieldsAndPropertiesAsync(SyntaxTree syntaxTree, TextSpan textSpan, bool allowPartialSelection, CancellationToken cancellationToken);
ISyntaxFormatting.cs (1)
21IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable<TextSpan>? spans, SyntaxFormattingOptions options, IEnumerable<AbstractFormattingRule>? rules, CancellationToken cancellationToken);
J\s\src\Compilers\Core\Portable\Syntax\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (3)
24var fullSpan = new TextSpan(0, text.Length); 31var change = TextChangeRange.Collapse(changes).Span; 44var span = node.FullSpan;
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (2)
18public static bool OverlapsHiddenPosition([NotNullWhen(returnValue: true)] this SyntaxTree? tree, TextSpan span, CancellationToken cancellationToken) 95public static bool IsEntirelyHidden(this SyntaxTree tree, TextSpan span, CancellationToken cancellationToken)
LanguageServices\FixAllSpanMappingService\AbstractFixAllSpanMappingService.cs (9)
19protected abstract Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansIfWithinGlobalStatementAsync( 20Document document, TextSpan span, CancellationToken cancellationToken); 22public Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 23Document document, TextSpan triggerSpan, FixAllScope fixAllScope, CancellationToken cancellationToken) 31private async Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 32Document document, TextSpan span, bool fixAllInContainingMember, CancellationToken cancellationToken) 50var builder = PooledDictionary<Document, ArrayBuilder<TextSpan>>.GetInstance(); 56var partialDeclSpan = syntaxFacts.GetContainingTypeDeclaration(root, syntaxRef.Span.Start)!.FullSpan; 73TextSpan span,
LanguageServices\FixAllSpanMappingService\IFixAllSpanMappingService.cs (2)
30Task<ImmutableDictionary<Document, ImmutableArray<TextSpan>>> GetFixAllSpansAsync( 31Document document, TextSpan triggerSpan, FixAllScope fixAllScope, CancellationToken cancellationToken);
LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs (4)
76var oldText = oldDocumentText.GetSubText(TextSpan.FromBounds(startLineStartPosition, endLineEndPosition)); 77var adjustedChanges = changePartition.Select(c => new TextChange(TextSpan.FromBounds(c.Span.Start - startLineStartPosition, c.Span.End - startLineStartPosition), c.NewText)); 87commentChanges.Add(new TextChange(TextSpan.FromBounds(startLineStartPosition, startLineStartPosition), warningText)); 114? text.GetSubText(TextSpan.FromBounds(text.Lines[startLine].Start, text.Lines[endLine].End)).ToString()
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (5)
110IList<TextSpan> mergeConflictResolutionSpan = new List<TextSpan>(); 226IList<TextSpan> mergeConflictResolutionSpans, 258var conflictingCommentInsertionLocation = new TextSpan(mergedChange.Span.Start, 0); 304currentChange = new TextChange(TextSpan.FromBounds(currentChange.Span.Start, nextChange.Span.End), currentChange.NewText + nextChange.NewText);
LinkedFileDiffMerging\LinkedFileMergeResult.cs (2)
17public IEnumerable<TextSpan> MergeConflictResolutionSpans { get; } 20public LinkedFileMergeResult(IEnumerable<DocumentId> documentIds, SourceText mergedSourceText, IEnumerable<TextSpan> mergeConflictResolutionSpans)
LinkedFileDiffMerging\LinkedFileMergeSessionResult.cs (2)
16private readonly Dictionary<DocumentId, IEnumerable<TextSpan>> _mergeConflictCommentSpans = new(); 17public Dictionary<DocumentId, IEnumerable<TextSpan>> MergeConflictCommentSpans => _mergeConflictCommentSpans;
NamingStyle.cs (21)
159var spanToCheck = TextSpan.FromBounds(0, name.Length - Suffix.Length); 173private WordSpanEnumerable GetWordSpans(string name, TextSpan nameSpan) 176private static string Substring(string name, TextSpan wordSpan) 179private static readonly Func<string, TextSpan, bool> s_firstCharIsLowerCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsLower(val[span.Start]); 180private static readonly Func<string, TextSpan, bool> s_firstCharIsUpperCase = (val, span) => !DoesCharacterHaveCasing(val[span.Start]) || char.IsUpper(val[span.Start]); 182private static readonly Func<string, TextSpan, bool> s_wordIsAllUpperCase = (val, span) => 195private static readonly Func<string, TextSpan, bool> s_wordIsAllLowerCase = (val, span) => 209string name, TextSpan nameSpan, Func<string, TextSpan, bool> wordCheck, 215foreach (var wordSpan in GetWordSpans(name, nameSpan)) 231private bool CheckPascalCase(string name, TextSpan nameSpan, out string reason) 236private bool CheckAllUpper(string name, TextSpan nameSpan, out string reason) 241private bool CheckAllLower(string name, TextSpan nameSpan, out string reason) 247string name, TextSpan nameSpan, 248Func<string, TextSpan, bool> firstWordCheck, 249Func<string, TextSpan, bool> restWordCheck, 259foreach (var wordSpan in GetWordSpans(name, nameSpan)) 290private bool CheckCamelCase(string name, TextSpan nameSpan, out string reason) 297private bool CheckFirstUpper(string name, TextSpan nameSpan, out string reason) 405using var parts = TemporaryArray<TextSpan>.Empty;
NamingStyle.WordSpanEnumerable.cs (2)
16private readonly TextSpan _nameSpan; 19public WordSpanEnumerable(string name, TextSpan nameSpan, string wordSeparator)
NamingStyle.WordSpanEnumerator.cs (4)
18private readonly TextSpan _nameSpan; 21public WordSpanEnumerator(string name, TextSpan nameSpan, string wordSeparator) 30public TextSpan Current { get; private set; } 72Current = TextSpan.FromBounds(Current.End, Math.Min(_nameSpan.End, nextWordSeparator));
NamingStyleOption.cs (3)
13/// The root naming style option composed of several settings as well as a <see cref="TextSpan"/>s describing where they were all defined. 29/// A description of the kinds of symbols a rule should apply to as well as a <see cref="TextSpan"/>s describing where they were all defined. 42/// The rules about how the specified symbols must be named as well as a <see cref="TextSpan"/>s describing where they were all defined.
NormalizedTextSpanCollection.cs (42)
14internal class NormalizedTextSpanCollection : ReadOnlyCollection<TextSpan> 21: base(new List<TextSpan>(0)) 29public NormalizedTextSpanCollection(TextSpan span) 42public NormalizedTextSpanCollection(IEnumerable<TextSpan> spans) 93var span1 = left[index1]; 94var span2 = right[index2]; 122spans.Add(TextSpan.FromBounds(start, end)); 161var span1 = left[index1]; 162var span2 = right[index2]; 221var span1 = left[index1]; 222var span2 = right[index2]; 283var span1 = left[index1]; 284var span2 = right[index2]; 296spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 307spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span2.Start)); 333var span1 = left[index1++]; 334spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 398var span1 = this[index1]; 399var span2 = set[index2]; 429public bool OverlapsWith(TextSpan span) 458var span1 = this[index1]; 459var span2 = set[index2]; 483public bool IntersectsWith(TextSpan span) 506foreach (var s in this) 533foreach (var s in this) 546private static IList<TextSpan> ListFromSpan(TextSpan span) 548IList<TextSpan> list = new List<TextSpan>(1); 562private static void UpdateSpanUnion(TextSpan span, IList<TextSpan> spans, ref int start, ref int end) 566spans.Add(TextSpan.FromBounds(start, end)); 583private static IList<TextSpan> NormalizeSpans(IEnumerable<TextSpan> spans) 590var sorted = new List<TextSpan>(spans); 597sorted.Sort(delegate (TextSpan s1, TextSpan s2) { return s1.Start.CompareTo(s2.Start); }); 599IList<TextSpan> normalized = new List<TextSpan>(sorted.Count); 609normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 619normalized.Add(TextSpan.FromBounds(oldStart, oldEnd)); 624private class OrderedSpanList : List<TextSpan>
PatternMatching\AllLowerCamelCaseMatcher.cs (14)
49in TemporaryArray<TextSpan> candidateHumps, out ImmutableArray<TextSpan> matchedSpans) 64matchedSpans = ImmutableArray<TextSpan>.Empty; 70: ImmutableArray<TextSpan>.Empty; 76private static PatternMatchKind GetKind(CamelCaseResult result, in TemporaryArray<TextSpan> candidateHumps) 80int patternIndex, int candidateHumpIndex, bool? contiguous, in TemporaryArray<TextSpan> candidateHumps) 86var matchedSpansInReverse = _includeMatchedSpans ? ArrayBuilder<TextSpan>.GetInstance() : null; 106var candidateHump = candidateHumps[humpIndex]; 160int patternIndex, int humpIndex, bool contiguous, in TemporaryArray<TextSpan> candidateHumps) 164var candidateHump = candidateHumps[humpIndex]; 202var matchSpanToAdd = new TextSpan(candidateHump.Start, possibleHumpMatchLength); 222CamelCaseResult result, ref CamelCaseResult? bestResult, TextSpan? matchSpanToAdd, in TemporaryArray<TextSpan> candidateHumps) 251private static bool IsBetter(CamelCaseResult result, CamelCaseResult? currentBestResult, in TemporaryArray<TextSpan> candidateHumps)
PatternMatching\CamelCaseResult.cs (4)
21public readonly ArrayBuilder<TextSpan> MatchedSpansInReverse; 23public CamelCaseResult(bool fromStart, bool contiguous, int matchCount, ArrayBuilder<TextSpan> matchedSpansInReverse) 39public CamelCaseResult WithAddedMatchedSpan(TextSpan value) 46private static PatternMatchKind GetCamelCaseKind(CamelCaseResult result, in TemporaryArray<TextSpan> candidateHumps)
PatternMatching\PatternMatch.cs (5)
36public ImmutableArray<TextSpan> MatchedSpans { get; } 42TextSpan? matchedSpan) 44matchedSpan == null ? ImmutableArray<TextSpan>.Empty : ImmutableArray.Create(matchedSpan.Value)) 52ImmutableArray<TextSpan> matchedSpans) 60public PatternMatch WithMatchedSpans(ImmutableArray<TextSpan> matchedSpans)
PatternMatching\PatternMatcher.cs (17)
176using var candidateHumps = TemporaryArray<TextSpan>.Empty; 229var hump = TextSpan.FromBounds(candidateHumps[i].Start, candidateLength); 272private TextSpan? GetMatchedSpan(int start, int length) 394private bool PartStartsWith(string candidate, TextSpan candidatePart, string pattern, TextSpan patternPart, CompareOptions compareOptions) 415private bool PartStartsWith(string candidate, TextSpan candidatePart, string pattern, CompareOptions compareOptions) 423in TemporaryArray<TextSpan> candidateHumps) 467in TemporaryArray<TextSpan> candidateHumps, 469out ImmutableArray<TextSpan> matchedSpans) 477in TemporaryArray<TextSpan> candidateHumps, 480out ImmutableArray<TextSpan> matchedSpans) 497using var _ = ArrayBuilder<TextSpan>.GetInstance(out var matchSpans); 509: ImmutableArray<TextSpan>.Empty; 517matchedSpans = ImmutableArray<TextSpan>.Empty; 521var candidateHump = candidateHumps[currentCandidateHump]; 530var patternChunkCharacterSpan = patternHumps[currentPatternHump];
PatternMatching\PatternMatcher.TextChunk.cs (2)
33public TemporaryArray<TextSpan> PatternHumps; 42PatternHumps = TemporaryArray<TextSpan>.Empty;
ReassignedVariable\AbstractReassignedVariableService.cs (6)
39public async Task<ImmutableArray<TextSpan>> GetLocationsAsync( 40Document document, TextSpan span, CancellationToken cancellationToken) 49using var _2 = ArrayBuilder<TextSpan>.GetInstance(out var result); 150if (!TryGetParameterLocation(parameter, out var parameterLocation)) 180bool TryGetParameterLocation(IParameterSymbol parameter, out TextSpan location) 231TextSpan localOrParameterDeclarationSpan,
ReassignedVariable\IReassignedVariableService.cs (2)
20Task<ImmutableArray<TextSpan>> GetLocationsAsync(Document document, TextSpan span, CancellationToken cancellationToken);
Remote\RemoteArguments.cs (2)
144public readonly TextSpan Location; 161TextSpan location,
Rename\ConflictEngine\ComplexifiedSpan.cs (8)
15public readonly TextSpan OriginalSpan; 18public readonly TextSpan NewSpan; 21public readonly ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)> ModifiedSubSpans; 23public ComplexifiedSpan(TextSpan originalSpan, TextSpan newSpan, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)> modifiedSubSpans)
Rename\ConflictEngine\ConflictResolver.Session.cs (7)
79public readonly TextSpan ComplexifiedSpan; 83public readonly TextSpan OriginalIdentifierSpan; 370var originalLocation = conflictAnnotation.OriginalSpan; 879private static ImmutableSortedSet<TextSpan>? GetSubSpansToRenameInStringAndCommentTextSpans( 880TextSpan containingLocationForStringOrComment, 883var builder = ImmutableSortedSet.CreateBuilder<TextSpan>(); 898var subSpan = new TextSpan(offset, length);
Rename\ConflictEngine\RelatedLocation.cs (4)
23public readonly TextSpan ConflictCheckSpan; 39public readonly TextSpan ComplexifiedTargetSpan; 41public RelatedLocation(TextSpan conflictCheckSpan, DocumentId documentId, RelatedLocationType type, bool isReference = false, TextSpan complexifiedTargetSpan = default)
Rename\ConflictEngine\RenamedSpansTracker.cs (28)
25private readonly Dictionary<DocumentId, List<(TextSpan oldSpan, TextSpan newSpan)>> _documentToModifiedSpansMap = new(); 31internal void AddModifiedSpan(DocumentId documentId, TextSpan oldSpan, TextSpan newSpan) 35spans = new List<(TextSpan oldSpan, TextSpan newSpan)>(); 42internal void AddComplexifiedSpan(DocumentId documentId, TextSpan oldSpan, TextSpan newSpan, List<(TextSpan oldSpan, TextSpan newSpan)> modifiedSubSpans) 58SpecializedCollections.EmptyEnumerable<(TextSpan oldSpan, TextSpan newSpan)>(); 70var appliedTextSpans = new HashSet<TextSpan>(); 123public TextSpan OriginalSpan; 124public TextSpan NewSpan; 125public List<(TextSpan oldSpan, TextSpan newSpan)> ModifiedSubSpans; 128TextSpan originalSpan, TextSpan newSpan, List<(TextSpan oldSpan, TextSpan newSpan)> modifiedSubSpans) 190var oldSpan = annotationAndNode.Item1.OriginalTextSpan; 196var modifiedSubSpans = new List<(TextSpan oldSpan, TextSpan newSpan)>(); 231public ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> GetDocumentToModifiedSpansMap() 233var builder = ImmutableDictionary.CreateBuilder<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>>();
Rename\ConflictResolution.cs (16)
49private readonly ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> _documentToModifiedSpansMap; 65_documentToModifiedSpansMap = ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>>.Empty; 76ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> documentToModifiedSpansMap, 98public ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)> GetComplexifiedSpans(DocumentId documentId) 101: ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>.Empty; 103public ImmutableDictionary<TextSpan, TextSpan> GetModifiedSpanMap(DocumentId documentId) 105var result = ImmutableDictionary.CreateBuilder<TextSpan, TextSpan>(); 129internal TextSpan GetResolutionTextSpan(TextSpan originalSpan, DocumentId documentId)
Rename\IRemoteRenamerService.cs (8)
79public readonly TextSpan Location; 94public readonly TextSpan ContainingLocationForStringOrComment; 100TextSpan location, 105TextSpan containingLocationForStringOrComment, 276public readonly ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> DocumentToModifiedSpansMap; 290ImmutableDictionary<DocumentId, ImmutableArray<(TextSpan oldSpan, TextSpan newSpan)>> documentToModifiedSpansMap,
Rename\LightweightRenameLocations.cs (1)
126public LightweightRenameLocations Filter(Func<DocumentId, TextSpan, bool> filter)
Rename\RenameLocation.cs (2)
18public readonly TextSpan ContainingLocationForStringOrComment; 30TextSpan containingLocationForStringOrComment = default)
Rename\RenameRewriterParameters.cs (8)
17internal readonly ImmutableHashSet<TextSpan> ConflictLocationSpans; 25internal readonly ImmutableDictionary<TextSpan, RenameLocation> RenameLocations; 30internal readonly ImmutableDictionary<TextSpan, ImmutableSortedSet<TextSpan>?> StringAndCommentTextSpans; 44ImmutableDictionary<TextSpan, RenameLocation> renameLocations, 45ImmutableDictionary<TextSpan, ImmutableSortedSet<TextSpan>?> stringAndCommentTextSpans, 46ImmutableHashSet<TextSpan> conflictLocationSpans,
Rename\RenameUtilities.cs (2)
246ImmutableSortedSet<TextSpan>? subSpansToReplace = null) 262foreach (var subSpan in subSpansToReplace)
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (3)
396IEnumerable<Tuple<string, int, TextSpan>> renameStringsAndPositions, 404var containingSpan = renameStringAndPosition.Item3; 415var matchTextSpan = new TextSpan(start, renameText.Length);
RenameActionAnnotation.cs (2)
21public readonly TextSpan OriginalSpan; 67TextSpan originalSpan,
RenameDeclarationLocationReference.cs (2)
19public readonly TextSpan TextSpan; 36public RenameDeclarationLocationReference(DocumentId documentId, TextSpan textSpan, bool overriddenFromMetadata, int declaringSyntaxReferencesCount)
RenameNodeSimplificationAnnotation.cs (1)
13public TextSpan OriginalTextSpan { get; set; }
RenameTokenSimplificationAnnotation.cs (1)
13public TextSpan OriginalTextSpan { get; set; }
Section.cs (2)
16public TextSpan Span { get; init; } 24public Section(string? filePath, bool isGlobal, TextSpan span, string text, string fullText)
Shared\Extensions\FileLinePositionSpanExtensions.cs (3)
14public static TextSpan GetClampedTextSpan(this FileLinePositionSpan span, SourceText text) 25/// Returns a new <see cref="TextSpan"/> based off of the positions in <paramref name="span"/>, but 28public static TextSpan GetClampedTextSpan(this LinePositionSpan span, SourceText text)
Shared\Extensions\SourceTextExtensions.cs (1)
35TextSpan textSpan,
Shared\Extensions\SyntaxGeneratorExtensions_CreateEqualsMethod.cs (2)
364using var parts = TemporaryArray<TextSpan>.Empty; 368var p = parts[i];
Shared\Extensions\TokenSemanticInfo.cs (2)
24public readonly TextSpan Span; 32TextSpan span)
SimpleIntervalTreeExtensions.cs (2)
15public static bool HasIntervalThatIntersectsWith(this SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector> tree, TextSpan span)
Simplification\AbstractSimplificationService.cs (3)
52ImmutableArray<TextSpan> spans, 97ImmutableArray<TextSpan> spans, 103var spansTree = new SimpleIntervalTree<TextSpan, TextSpanIntervalIntrospector>(new TextSpanIntervalIntrospector(), spans);
Simplification\ISimplificationService.cs (1)
33ImmutableArray<TextSpan> spans,
Simplification\Simplifier.cs (4)
203public static Task<Document> ReduceAsync(Document document, TextSpan span, OptionSet? optionSet = null, CancellationToken cancellationToken = default) 215internal static Task<Document> ReduceAsync(Document document, TextSpan span, SimplifierOptions options, CancellationToken cancellationToken) 222public static async Task<Document> ReduceAsync(Document document, IEnumerable<TextSpan> spans, OptionSet? optionSet = null, CancellationToken cancellationToken = default) 240internal static Task<Document> ReduceAsync(Document document, IEnumerable<TextSpan> spans, SimplifierOptions options, CancellationToken cancellationToken)
Simplification\Simplifiers\AbstractSimplifier.cs (1)
22out TextSpan issueSpan,
SourceTextExtensions_SharedWithCodeStyle.cs (2)
33this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden, CancellationToken cancellationToken) 45this SourceText text, TextSpan span, Func<int, CancellationToken, bool> isPositionHidden,
StringBreaker.cs (10)
16public static void AddWordParts(string identifier, ref TemporaryArray<TextSpan> parts) 19public static void AddCharacterParts(string identifier, ref TemporaryArray<TextSpan> parts) 22public static void AddParts(string text, bool word, ref TemporaryArray<TextSpan> parts) 26var span = StringBreaker.GenerateSpan(text, start, word); 40public static TextSpan GenerateSpan(string identifier, int wordStart, bool word) 80private static TextSpan ScanCharacterRun(string identifier, int length, int wordStart) 101private static TextSpan ScanWordRun(string identifier, int length, int wordStart) 150private static TextSpan ScanLowerCaseRun(string identifier, int length, int wordStart) 161private static TextSpan ScanNumber(string identifier, int length, int wordStart) 169return TextSpan.FromBounds(wordStart, current);
SuppressOperation.cs (2)
15internal SuppressOperation(SyntaxToken startToken, SyntaxToken endToken, TextSpan textSpan, SuppressOption option) 28public TextSpan TextSpan { get; }
SuppressSpacingData.cs (2)
14public SuppressSpacingData(TextSpan textSpan) 17public TextSpan TextSpan { get; }
SuppressWrappingData.cs (2)
14public SuppressWrappingData(TextSpan textSpan, bool ignoreElastic) 20public TextSpan TextSpan { get; }
SyntaxNodeExtensions.cs (13)
99this SyntaxNode node, TextSpan searchSpan, Func<SyntaxNode, bool> predicate) 313public static TextSpan GetContainedSpan(this IEnumerable<SyntaxNode> nodes) 318var fullSpan = nodes.First().Span; 321fullSpan = TextSpan.FromBounds( 332public static bool OverlapsHiddenPosition(this SyntaxNode node, TextSpan span, CancellationToken cancellationToken) 340var textSpan = TextSpan.FromBounds(start, end); 416var nodesToReplace = nodes != null ? nodes.ToDictionary(n => n.FullSpan) : new Dictionary<TextSpan, SyntaxNode>(); 417var tokensToReplace = tokens != null ? tokens.ToDictionary(t => t.FullSpan) : new Dictionary<TextSpan, SyntaxToken>(); 418var triviaToReplace = trivia != null ? trivia.ToDictionary(t => t.FullSpan) : new Dictionary<TextSpan, SyntaxTrivia>(); 426var spans = new List<TextSpan>(nodesToReplace.Count + tokensToReplace.Count + triviaToReplace.Count); 449TextSpan previous = default; 450foreach (var span in spans)
TextChangeRangeExtensions.cs (1)
99return new TextChangeRange(TextSpan.FromBounds(currentStart, currentOldEnd), currentNewEnd - currentStart);
TextSpanExtensions.cs (22)
18public static IEnumerable<TextSpan> ToNormalizedSpans(this IEnumerable<TextSpan> spans) 21public static ImmutableArray<TextSpan> ToNormalizedSpans(this ImmutableArray<TextSpan> spans) 24public static TextSpan Collapse(this IEnumerable<TextSpan> spans) 29foreach (var span in spans) 48return TextSpan.FromBounds(start, end); 54public static bool IsAround(this TextSpan span, SyntaxNodeOrToken node) => IsAround(span, node, node); 60public static bool IsAround(this TextSpan span, SyntaxNodeOrToken startNode, SyntaxNodeOrToken endNode) 62var innerSpan = TextSpan.FromBounds(startNode.Span.Start, endNode.Span.End); 63var outerSpan = TextSpan.FromBounds(startNode.FullSpan.Start, endNode.FullSpan.End); 67public static IEnumerable<TextSpan> Subtract(this TextSpan span, TextSpan except) 81yield return TextSpan.FromBounds(span.Start, startSegmentEnd); 85yield return TextSpan.FromBounds(endSegmentStart, span.End); 88public static IEnumerable<TextSpan> Subtract(this IEnumerable<TextSpan> spans, TextSpan except)
TextSpanIntervalIntrospector.cs (3)
9internal readonly struct TextSpanIntervalIntrospector : IIntervalIntrospector<TextSpan> 11public int GetStart(TextSpan value) 14public int GetLength(TextSpan value)
TokenStream.cs (1)
51public TokenStream(TreeData treeData, SyntaxFormattingOptions options, TextSpan spanToFormat, AbstractTriviaDataFactory factory)
TreeData.cs (1)
70public IEnumerable<SyntaxToken> GetApplicableTokens(TextSpan textSpan)
TreeData.NodeAndText.cs (3)
38return _text.ToString(TextSpan.FromBounds(token2.FullSpan.Start, token2.SpanStart)); 44return _text.ToString(TextSpan.FromBounds(token1.Span.End, token1.FullSpan.End)); 47return _text.ToString(TextSpan.FromBounds(token1.Span.End, token2.SpanStart));
TriviaData.cs (1)
41public abstract IEnumerable<TextChange> GetTextChanges(TextSpan span);
VirtualChar.cs (5)
18/// value of <c>9</c> as well as what <see cref="TextSpan"/> in the original <see cref="SourceText"/> they occupied. 48public readonly TextSpan Span; 54public static VirtualChar Create(Rune rune, TextSpan span) 62public static VirtualChar Create(char surrogateChar, TextSpan span) 70private VirtualChar(Rune rune, char surrogateChar, TextSpan span)
VirtualCharSequence.Chunks.cs (1)
123var span = new TextSpan(_firstVirtualCharPosition + index, length: 1);
VirtualCharSequence.cs (6)
47private readonly TextSpan _span; 54private VirtualCharSequence(Chunk sequence, TextSpan span) 86public VirtualCharSequence GetSubSequence(TextSpan span) 165=> this.GetSubSequence(TextSpan.FromBounds(count, this.Length)); 178return this.GetSubSequence(TextSpan.FromBounds(start, this.Length)); 211TextSpan.FromBounds(chars1._span.Start, chars2._span.End));
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (1)
28IEnumerable<TextSpan> spans,
Workspace\Host\DocumentService\IDocumentExcerptService.cs (8)
21/// return <see cref="ExcerptResult"/> of given <see cref="Document"/> and <see cref="TextSpan"/> 25Task<ExcerptResult?> TryExcerptAsync(Document document, TextSpan span, ExcerptMode mode, ClassificationOptions classificationOptions, CancellationToken cancellationToken); 50public readonly TextSpan MappedSpan; 60/// should be same document in <see cref="IDocumentExcerptService.TryExcerptAsync(Document, TextSpan, ExcerptMode, ClassificationOptions, CancellationToken)" /> 67/// should be same text span in <see cref="IDocumentExcerptService.TryExcerptAsync(Document, TextSpan, ExcerptMode, ClassificationOptions, CancellationToken)" /> 69public readonly TextSpan Span; 71public ExcerptResult(SourceText content, TextSpan mappedSpan, ImmutableArray<ClassifiedSpan> classifiedSpans, Document document, TextSpan span)
Workspace\Host\DocumentService\ISpanMappingService.cs (3)
49Task<ImmutableArray<MappedSpanResult>> MapSpansAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken); 70public readonly TextSpan Span; 72public MappedSpanResult(string filePath, LinePositionSpan linePositionSpan, TextSpan span)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (9)
Formatting\FormattingTestBase.cs (8)
37IEnumerable<TextSpan> spans, 73SolutionServices services, string expected, SyntaxNode root, IEnumerable<TextSpan> spans, SyntaxFormattingOptions options, bool treeCompare = true, ParseOptions? parseOptions = null) 89private static async Task AssertFormatAsync(SolutionServices services, string expected, SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SourceText sourceText) 105private static bool TryAdjustSpans(SourceText inputText, IList<TextChange> changes, SourceText outputText, ImmutableArray<TextSpan> inputSpans, out ImmutableArray<TextSpan> outputSpans) 113var outputBuilder = ImmutableArray.CreateBuilder<TextSpan>(inputSpans.Length); 116var span = inputSpans[i]; 120outputBuilder.Add(TextSpan.FromBounds(0, outputText.Length));
TestDocumentServiceProvider.cs (1)
73public Task<ImmutableArray<MappedSpanResult>> MapSpansAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Workspaces.UnitTests (231)
BatchFixAllProviderTests.cs (1)
122private static async Task<Document> CreateChangedDocument(Document document, TextSpan sourceSpan, int replacement, CancellationToken cancellationToken)
CodeCleanup\AddMissingTokensTests.cs (1)
2717out var codeWithoutMarker, out ImmutableArray<TextSpan> textSpans);
CodeCleanup\CodeCleanupTests.cs (16)
44var cleanDocument = await CodeCleaner.CleanupAsync(document, ImmutableArray<TextSpan>.Empty, CodeCleanupOptions.GetDefault(document.Project.Services)); 96var cleanDocument = await CodeCleaner.CleanupAsync(document, ImmutableArray<TextSpan>.Empty, CodeCleanupOptions.GetDefault(document.Project.Services)); 175var expectedResult = (IEnumerable<TextSpan>)null; 195var expectedResult = (IEnumerable<TextSpan>)null; 217var expectedResult = (IEnumerable<TextSpan>)null; 239var expectedResult = (IEnumerable<TextSpan>)null; 351var expectedResult = (IEnumerable<TextSpan>)null; 364expectedResult = SpecializedCollections.EmptyEnumerable<TextSpan>(); 379out var codeWithoutMarker, out IDictionary<string, ImmutableArray<TextSpan>> namedSpans); 381var expectedResult = namedSpans.ContainsKey("r") ? namedSpans["r"] as IEnumerable<TextSpan> : SpecializedCollections.EmptyEnumerable<TextSpan>(); 386private static void VerifyRange(string codeWithMarker, ICodeCleanupProvider transformer, ref IEnumerable<TextSpan> expectedResult, string language = LanguageNames.CSharp) 389out var codeWithoutMarker, out IDictionary<string, ImmutableArray<TextSpan>> namedSpans); 394private static void VerifyRange(string code, ImmutableArray<ICodeCleanupProvider> codeCleanups, ImmutableArray<TextSpan> spans, ref IEnumerable<TextSpan> expectedResult, string language) 396var result = (IEnumerable<TextSpan>)null;
CodeCleanup\Extensions.cs (2)
18public static TextSpan GetCodeCleanupSpan(this SyntaxNode node) 23return TextSpan.FromBounds(previousToken.SpanStart, endToken.Span.End);
CodeCleanup\FixIncorrectTokenTests.cs (1)
742out var codeWithoutMarker, out ImmutableArray<TextSpan> textSpans);
CodeCleanup\MockCodeCleanupProvider.cs (4)
19public Func<Document, ImmutableArray<TextSpan>, SyntaxFormattingOptions, CancellationToken, Task<Document>>? CleanupDocumentAsyncImpl { get; set; } 20public Func<SyntaxNode, ImmutableArray<TextSpan>, SyntaxFormattingOptions, SolutionServices, SyntaxNode>? CleanupNodeImpl { get; set; } 28public Task<Document> CleanupAsync(Document document, ImmutableArray<TextSpan> spans, CodeCleanupOptions options, CancellationToken cancellationToken) 31public Task<SyntaxNode> CleanupAsync(SyntaxNode root, ImmutableArray<TextSpan> spans, SyntaxFormattingOptions options, SolutionServices services, CancellationToken cancellationToken)
CodeCleanup\NormalizeModifiersOrOperatorsTests.cs (1)
1018out var codeWithoutMarker, out ImmutableArray<TextSpan> textSpans);
CodeCleanup\ReduceTokenTests.cs (1)
2006out var codeWithoutMarker, out ImmutableArray<TextSpan> textSpans);
CodeCleanup\RemoveUnnecessaryLineContinuationTests.cs (1)
1375out var codeWithoutMarker, out ImmutableArray<TextSpan> textSpans);
Differencing\TestTreeComparer.cs (1)
54protected internal override TextSpan GetSpan(TestNode node)
EditorConfigParsing\EditorConfigFileParserTests.cs (72)
16internal static EditorConfigFile<EditorConfigOption> CreateParseResults(string editorconfigFilePath, params (string headerText, TextSpan span, bool isGlobal)[] sections) 33(string.Empty, TextSpan.FromBounds(0, 9), true), 34("*.cs", TextSpan.FromBounds(10, 19), false), 35("*.vb", TextSpan.FromBounds(20, 29), false), 36("*.{cs,vb}", TextSpan.FromBounds(30, 39), false), 37("*.{cs,csx,vb,vbx}", TextSpan.FromBounds(40, 49), false)); 56(string.Empty, TextSpan.FromBounds(0, 9), true), 57("*.vb", TextSpan.FromBounds(20, 29), false), 58("*.{cs,vb}", TextSpan.FromBounds(30, 39), false), 59("*.{cs,csx,vb,vbx}", TextSpan.FromBounds(40, 49), false), 60("*s", TextSpan.FromBounds(50, 59), false), 61("*", TextSpan.FromBounds(60, 69), false), 62("*.{cs,csx}", TextSpan.FromBounds(70, 79), false)); 71(string.Empty, TextSpan.FromBounds(0, 9), true), 72("*.vb", TextSpan.FromBounds(20, 29), false), 73("*.{cs,vb}", TextSpan.FromBounds(30, 39), false), 74("*.{cs,csx,vb,vbx}", TextSpan.FromBounds(40, 49), false), 75("*s", TextSpan.FromBounds(50, 59), false), 76("*", TextSpan.FromBounds(60, 69), false), 77("*.{cs,csx}", TextSpan.FromBounds(70, 79), false)); 88(string.Empty, TextSpan.FromBounds(0, 9), true), 89("*.vb", TextSpan.FromBounds(20, 29), false), 90("*.{cs,csx,vb,vbx}", TextSpan.FromBounds(40, 49), false), 91("*s", TextSpan.FromBounds(50, 59), false), 92("*", TextSpan.FromBounds(60, 69), false), 93("*.{cs,csx}", TextSpan.FromBounds(70, 79), false)); 112(string.Empty, TextSpan.FromBounds(0, 9), true), 113("*.cs", TextSpan.FromBounds(10, 19), false), 114("*.vb", TextSpan.FromBounds(20, 29), false), 115("*.{cs,vb}", TextSpan.FromBounds(30, 39), false), 116("*.{cs,csx,vb,vbx}", TextSpan.FromBounds(40, 49), false), 117("*s", TextSpan.FromBounds(50, 59), false), 118("*", TextSpan.FromBounds(60, 69), false), 119("*.{cs,csx}", TextSpan.FromBounds(70, 79), false)); 134(string.Empty, TextSpan.FromBounds(0, 9), true), 135("sources/**/*.cs", TextSpan.FromBounds(10, 19), false), 136("sources/**/*.vb", TextSpan.FromBounds(20, 29), false), 137("*.{cs,vb}", TextSpan.FromBounds(30, 39), false), 138("*.{cs,csx,vb,vbx}", TextSpan.FromBounds(40, 49), false), 139("*s", TextSpan.FromBounds(50, 59), false), 140("*", TextSpan.FromBounds(60, 69), false), 141("*.{cs,csx}", TextSpan.FromBounds(70, 79), false)); 151(string.Empty, TextSpan.FromBounds(0, 9), true), 152("sources/**/*.cs", TextSpan.FromBounds(10, 19), false), 153("sources/**/*.vb", TextSpan.FromBounds(20, 29), false), 154("*.{cs,vb}", TextSpan.FromBounds(30, 39), false), 155("*.{cs,csx,vb,vbx}", TextSpan.FromBounds(40, 49), false), 156("*s", TextSpan.FromBounds(50, 59), false), 157("*", TextSpan.FromBounds(60, 69), false), 158("*.{cs,csx}", TextSpan.FromBounds(70, 79), false)); 173(string.Empty, TextSpan.FromBounds(0, 9), true), 174("*.{cs,csx,vbx}", TextSpan.FromBounds(30, 39), false), 175("*.{cs,csx,vb,vbx}", TextSpan.FromBounds(40, 49), false), 176("*s", TextSpan.FromBounds(50, 59), false), 177("*", TextSpan.FromBounds(60, 69), false)); 192(string.Empty, TextSpan.FromBounds(0, 9), true), 193("*.*b", TextSpan.FromBounds(30, 39), false), 194("*.*b", TextSpan.FromBounds(80, 89), false), 195("*.*b", TextSpan.FromBounds(130, 139), false), 196("*.*s", TextSpan.FromBounds(40, 49), false), 197("*.*s", TextSpan.FromBounds(90, 99), false), 198("*.*s", TextSpan.FromBounds(120, 129), false), 199("*s", TextSpan.FromBounds(50, 59), false), 200("*s", TextSpan.FromBounds(100, 109), false), 201("*", TextSpan.FromBounds(60, 69), false), 202("*b", TextSpan.FromBounds(70, 79), false), 203("*b", TextSpan.FromBounds(110, 119), false)); 218(string.Empty, TextSpan.FromBounds(0, 9), true), 219("*s", TextSpan.FromBounds(100, 109), false), 220("*", TextSpan.FromBounds(60, 69), false)); 235(string.Empty, TextSpan.FromBounds(0, 9), true), 236("*s", TextSpan.FromBounds(100, 109), false));
EditorConfigParsing\NamingStyleParserTests.cs (48)
59Assert.Equal(TextSpan.FromBounds(2155, 2260), rule0.NamingScheme.OptionName.Span); 67Assert.Equal(TextSpan.FromBounds(2562, 2641), rule0.NamingScheme.Capitalization.Span); 70Assert.Equal(TextSpan.FromBounds(2338, 2481), rule0.ApplicableSymbolInfo.Accessibilities.Span); 77Assert.Equal(TextSpan.FromBounds(2338, 2481), rule0.ApplicableSymbolInfo.Accessibilities.Span); 80Assert.Equal(TextSpan.FromBounds(2483, 2558), rule0.ApplicableSymbolInfo.Modifiers.Span); 83Assert.Equal(TextSpan.FromBounds(2338, 2481), rule0.ApplicableSymbolInfo.Accessibilities.Span); 86Assert.Equal(TextSpan.FromBounds(1961, 2049), rule0.Severity.Span); 94Assert.Equal(TextSpan.FromBounds(5078, 5149), rule1.NamingScheme.OptionName.Span); 102Assert.Equal(TextSpan.FromBounds(5236, 5300), rule1.NamingScheme.Capitalization.Span); 105Assert.Equal(TextSpan.FromBounds(4998, 5076), rule1.ApplicableSymbolInfo.OptionName.Span); 120Assert.Equal(TextSpan.FromBounds(5153, 5232), rule1.ApplicableSymbolInfo.SymbolKinds.Span); 123Assert.Equal(TextSpan.FromBounds(4928, 4996), rule1.Severity.Span); 132Assert.Equal(TextSpan.FromBounds(5925, 5999), rule2.NamingScheme.OptionName.Span); 140Assert.Equal(TextSpan.FromBounds(6061, 6127), rule2.NamingScheme.Capitalization.Span); 143Assert.Equal(TextSpan.FromBounds(5853, 5923), rule2.ApplicableSymbolInfo.OptionName.Span); 170Assert.Equal(TextSpan.FromBounds(6003, 6057), rule2.ApplicableSymbolInfo.SymbolKinds.Span); 173Assert.Equal(TextSpan.FromBounds(5781, 5851), rule2.Severity.Span); 181Assert.Equal(TextSpan.FromBounds(2891, 3000), rule3.NamingScheme.OptionName.Span); 189Assert.Equal(TextSpan.FromBounds(3310, 3391), rule3.NamingScheme.Capitalization.Span); 192Assert.Equal(TextSpan.FromBounds(2783, 2889), rule3.ApplicableSymbolInfo.OptionName.Span); 199Assert.Equal(TextSpan.FromBounds(3080, 3225), rule3.ApplicableSymbolInfo.Accessibilities.Span); 202Assert.Equal(TextSpan.FromBounds(3227, 3306), rule3.ApplicableSymbolInfo.Modifiers.Span); 205Assert.Equal(TextSpan.FromBounds(3004, 3078), rule3.ApplicableSymbolInfo.SymbolKinds.Span); 208Assert.Equal(TextSpan.FromBounds(2691, 2781), rule3.Severity.Span); 216Assert.Equal(TextSpan.FromBounds(5502, 5587), rule4.NamingScheme.OptionName.Span); 224Assert.Equal(TextSpan.FromBounds(5666, 5735), rule4.NamingScheme.Capitalization.Span); 227Assert.Equal(TextSpan.FromBounds(5418, 5500), rule4.ApplicableSymbolInfo.OptionName.Span); 241Assert.Equal(TextSpan.FromBounds(5591, 5662), rule4.ApplicableSymbolInfo.SymbolKinds.Span); 244Assert.Equal(TextSpan.FromBounds(5338, 5416), rule4.Severity.Span); 252Assert.Equal(TextSpan.FromBounds(3569, 3642), rule5.NamingScheme.OptionName.Span); 260Assert.Equal(TextSpan.FromBounds(3773, 3836), rule5.NamingScheme.Capitalization.Span); 263Assert.Equal(TextSpan.FromBounds(3497, 3567), rule5.ApplicableSymbolInfo.OptionName.Span); 275Assert.Equal(TextSpan.FromBounds(3711, 3769), rule5.ApplicableSymbolInfo.Modifiers.Span); 279Assert.Equal(TextSpan.FromBounds(3646, 3709), rule5.ApplicableSymbolInfo.SymbolKinds.Span); 282Assert.Equal(TextSpan.FromBounds(3423, 3495), rule5.Severity.Span); 290Assert.Equal(TextSpan.FromBounds(4601, 4685), rule6.NamingScheme.OptionName.Span); 292Assert.Equal(TextSpan.FromBounds(4825, 4885), rule6.NamingScheme.Prefix.Span); 298Assert.Equal(TextSpan.FromBounds(4755, 4823), rule6.NamingScheme.Capitalization.Span); 301Assert.Equal(TextSpan.FromBounds(4518, 4599), rule6.ApplicableSymbolInfo.OptionName.Span); 315Assert.Equal(TextSpan.FromBounds(4689, 4751), rule6.ApplicableSymbolInfo.SymbolKinds.Span); 318Assert.Equal(TextSpan.FromBounds(4439, 4516), rule6.Severity.Span); 326Assert.Equal(TextSpan.FromBounds(4045, 4125), rule7.NamingScheme.OptionName.Span); 328Assert.Equal(TextSpan.FromBounds(4326, 4385), rule7.NamingScheme.Prefix.Span); 334Assert.Equal(TextSpan.FromBounds(4258, 4324), rule7.NamingScheme.Capitalization.Span); 337Assert.Equal(TextSpan.FromBounds(3966, 4043), rule7.ApplicableSymbolInfo.OptionName.Span); 349Assert.Equal(TextSpan.FromBounds(4191, 4254), rule7.ApplicableSymbolInfo.Modifiers.Span); 352Assert.Equal(TextSpan.FromBounds(4129, 4189), rule7.ApplicableSymbolInfo.SymbolKinds.Span); 355Assert.Equal(TextSpan.FromBounds(3889, 3964), rule7.Severity.Span);
EditorConfigParsing\SectionParserTests.cs (17)
20var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 30var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 39var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 49var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 59var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 69var section = new Section(null, true, default(TextSpan), headerText, $"[{headerText}]"); 79var section = new Section(null, true, default(TextSpan), string.Empty, string.Empty); 92var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 103var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 112var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 121var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 135var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 152var section = new Section(null, false, default(TextSpan), headerText, $"[{headerText}]"); 187var section = new Section(editorconfigFilePath, false, default(TextSpan), headerText, $"[{headerText}]"); 210var section = new Section(editorconfigFilePath, false, default(TextSpan), headerText, $"[{headerText}]"); 219var section = new Section(editorconfigFilePath, false, default(TextSpan), headerText, $"[{headerText}]"); 230var section = new Section(editorconfigFilePath, false, default(TextSpan), headerText, $"[{headerText}]");
Formatter\FormatterTests.cs (1)
41public Task<Document> FormatAsync(Document document, IEnumerable<TextSpan>? spans, LineFormattingOptions lineFormattingOptions, SyntaxFormattingOptions? syntaxFormattingOptions, CancellationToken cancellationToken)
Shared\Extensions\TextSpanExtensions\SubtractTests.cs (59)
28private static TextSpan LongSpan { get; } = TextSpan.FromBounds(10, 20); 29private static TextSpan UnitSpan { get; } = TextSpan.FromBounds(10, 11); 30private static TextSpan EmptySpan { get; } = TextSpan.FromBounds(10, 10); 32private static int RightBeforeStart(TextSpan span) => span.Start - 1; 33private static int AtStart(TextSpan span) => span.Start; 34private static int RightAfterStart(TextSpan span) => span.Start + 1; 35private static int RightBeforeEnd(TextSpan span) => span.End - 1; 36private static int AtEnd(TextSpan span) => span.End; 37private static int RightAfterEnd(TextSpan span) => span.End + 1; 44LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), RightBeforeStart(LongSpan)))); 52LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), AtStart(LongSpan)))); 59new[] { TextSpan.FromBounds(RightAfterStart(LongSpan), AtEnd(LongSpan)) }, 60LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), RightAfterStart(LongSpan)))); 67new[] { TextSpan.FromBounds(RightBeforeEnd(LongSpan), AtEnd(LongSpan)) }, 68LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), RightBeforeEnd(LongSpan)))); 75LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), AtEnd(LongSpan)))); 82LongSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(LongSpan), RightAfterEnd(LongSpan)))); 90LongSpan.Subtract(TextSpan.FromBounds(AtStart(LongSpan), AtStart(LongSpan)))); 97new[] { TextSpan.FromBounds(RightAfterStart(LongSpan), AtEnd(LongSpan)) }, 98LongSpan.Subtract(TextSpan.FromBounds(AtStart(LongSpan), RightAfterStart(LongSpan)))); 105new[] { TextSpan.FromBounds(RightBeforeEnd(LongSpan), AtEnd(LongSpan)) }, 106LongSpan.Subtract(TextSpan.FromBounds(AtStart(LongSpan), RightBeforeEnd(LongSpan)))); 113LongSpan.Subtract(TextSpan.FromBounds(AtStart(LongSpan), AtEnd(LongSpan)))); 120LongSpan.Subtract(TextSpan.FromBounds(AtStart(LongSpan), RightAfterEnd(LongSpan)))); 128LongSpan.Subtract(TextSpan.FromBounds(RightAfterStart(LongSpan), RightAfterStart(LongSpan)))); 137TextSpan.FromBounds(AtStart(LongSpan), RightAfterStart(LongSpan)), 138TextSpan.FromBounds(RightBeforeEnd(LongSpan), AtEnd(LongSpan)) 140LongSpan.Subtract(TextSpan.FromBounds(RightAfterStart(LongSpan), RightBeforeEnd(LongSpan)))); 147new[] { TextSpan.FromBounds(AtStart(LongSpan), RightAfterStart(LongSpan)) }, 148LongSpan.Subtract(TextSpan.FromBounds(RightAfterStart(LongSpan), AtEnd(LongSpan)))); 155new[] { TextSpan.FromBounds(AtStart(LongSpan), RightAfterStart(LongSpan)) }, 156LongSpan.Subtract(TextSpan.FromBounds(RightAfterStart(LongSpan), RightAfterEnd(LongSpan)))); 164LongSpan.Subtract(TextSpan.FromBounds(RightBeforeEnd(LongSpan), RightBeforeEnd(LongSpan)))); 171new[] { TextSpan.FromBounds(AtStart(LongSpan), RightBeforeEnd(LongSpan)) }, 172LongSpan.Subtract(TextSpan.FromBounds(RightBeforeEnd(LongSpan), AtEnd(LongSpan)))); 179new[] { TextSpan.FromBounds(AtStart(LongSpan), RightBeforeEnd(LongSpan)) }, 180LongSpan.Subtract(TextSpan.FromBounds(RightBeforeEnd(LongSpan), RightAfterEnd(LongSpan)))); 188LongSpan.Subtract(TextSpan.FromBounds(AtEnd(LongSpan), AtEnd(LongSpan)))); 196LongSpan.Subtract(TextSpan.FromBounds(AtEnd(LongSpan), RightAfterEnd(LongSpan)))); 204LongSpan.Subtract(TextSpan.FromBounds(RightAfterEnd(LongSpan), RightAfterEnd(LongSpan)))); 212UnitSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(UnitSpan), RightBeforeStart(UnitSpan)))); 220UnitSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(UnitSpan), AtStart(UnitSpan)))); 227UnitSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(UnitSpan), AtEnd(UnitSpan)))); 234UnitSpan.Subtract(TextSpan.FromBounds(RightBeforeStart(UnitSpan), RightAfterEnd(UnitSpan)))); 242UnitSpan.Subtract(TextSpan.FromBounds(AtStart(UnitSpan), AtStart(UnitSpan)))); 249UnitSpan.Subtract(TextSpan.FromBounds(AtStart(UnitSpan), AtEnd(UnitSpan)))); 256UnitSpan.Subtract(TextSpan.FromBounds(AtStart(UnitSpan), RightAfterEnd(UnitSpan)))); 264UnitSpan.Subtract(TextSpan.FromBounds(AtEnd(UnitSpan), AtEnd(UnitSpan)))); 272UnitSpan.Subtract(TextSpan.FromBounds(AtEnd(UnitSpan), RightAfterEnd(UnitSpan)))); 280UnitSpan.Subtract(TextSpan.FromBounds(RightAfterEnd(UnitSpan), RightAfterEnd(UnitSpan)))); 288EmptySpan.Subtract(TextSpan.FromBounds(RightBeforeStart(EmptySpan), RightBeforeStart(EmptySpan)))); 295EmptySpan.Subtract(TextSpan.FromBounds(RightBeforeStart(EmptySpan), EmptySpan.Start))); 302EmptySpan.Subtract(TextSpan.FromBounds(RightBeforeStart(EmptySpan), RightAfterEnd(EmptySpan)))); 309EmptySpan.Subtract(TextSpan.FromBounds(EmptySpan.Start, EmptySpan.Start))); 316EmptySpan.Subtract(TextSpan.FromBounds(EmptySpan.Start, RightAfterEnd(EmptySpan)))); 324EmptySpan.Subtract(TextSpan.FromBounds(RightAfterEnd(EmptySpan), RightAfterEnd(EmptySpan))));
SolutionTests\ProjectSemanticVersionTests.cs (4)
114var span = new TextSpan(text.ToString().IndexOf("20"), length: 2); 142var span = new TextSpan(text.ToString().IndexOf("20"), length: 2); 226var span = new TextSpan(text.ToString().IndexOf("20"), length: 2); 254var span = new TextSpan(text.ToString().IndexOf("20"), length: 2);
SyntaxPathTests.cs (1)
414var span = new TextSpan(offset, length);
Microsoft.VisualStudio.IntegrationTest.Utilities (6)
OutOfProcess\Editor_OutOfProc.cs (6)
59public ImmutableArray<TextSpan> GetTagSpans(string tagId) 72var builder = ArrayBuilder<TextSpan>.GetInstance(); 184public TextSpan[] GetKeywordHighlightTags() 187public TextSpan[] GetOutliningSpans() 193private static TextSpan[] Deserialize(string[] v) 203return TextSpan.FromBounds(int.Parse(start), int.Parse(end));
Microsoft.VisualStudio.LanguageServices (128)
CallHierarchy\CallHierarchyDetail.cs (2)
20private readonly TextSpan _span; 53return location.SourceTree.GetText().GetSubText(TextSpan.FromBounds(start, end)).ToString();
CodeLens\CodeLensCallbackListener.cs (1)
156var textSpan = descriptorContext.ApplicableSpan.Value.ToTextSpan();
CodeLens\RemoteCodeLensReferencesService.cs (1)
162var span = new TextSpan(descriptor.SpanStart, descriptor.SpanLength);
Diagnostics\VisualStudioVenusSpanMappingService.cs (2)
31out TextSpan sourceSpan, out FileLinePositionSpan originalLineInfo, out FileLinePositionSpan mappedLineInfo) 60sourceSpan = TextSpan.FromBounds(startPos, Math.Max(startPos, endPos));
Extensions\DocumentExtensions.cs (3)
20public static IList<Tuple<TextSpan, uint>> GetVisibleCodeBlocks(this Document document, CancellationToken cancellationToken) 22var codeBlocks = new List<Tuple<TextSpan, uint>>(); 57codeBlocks.Add(Tuple.Create(TextSpan.FromBounds(start, end), cookie));
Extensions\SourceTextExtensions.cs (1)
15public static VsTextSpan GetVsTextSpanForSpan(this SourceText text, TextSpan textSpan)
F1Help\AbstractHelpContextService.cs (1)
46public abstract Task<string> GetHelpTermAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken);
F1Help\IHelpContextService.cs (1)
18Task<string> GetHelpTermAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken);
FindReferences\Contexts\WithReferencesFindUsagesContext.cs (1)
73using var _2 = PooledHashSet<(string? filePath, TextSpan span)>.GetInstance(out var seenLocations);
FindReferences\Entries\DocumentSpanEntry.cs (5)
114TextSpan sourceSpan, 221private DisposableToolTip CreateDisposableToolTip(Document document, TextSpan sourceSpan) 259private static void SetHighlightSpan(HighlightSpanKind spanKind, ITextBuffer textBuffer, TextSpan span) 272private static Span GetRegionSpanForReference(SourceText sourceText, TextSpan sourceSpan) 276var referenceSpan = sourceSpan;
FindReferences\RoslynDefinitionBucket.cs (2)
37private readonly Dictionary<(string? filePath, TextSpan span), DocumentSpanEntry> _locationToEntry = new(); 130public DocumentSpanEntry GetOrAddEntry(string? filePath, TextSpan sourceSpan, DocumentSpanEntry entry)
Implementation\AbstractEditorFactory.cs (3)
362var originalNewLine = originalText.ToString(CodeAnalysis.Text.TextSpan.FromBounds(originalLine.End, originalLine.EndIncludingLineBreak)); 368var currentSpan = CodeAnalysis.Text.TextSpan.FromBounds(currentLine.End, currentLine.EndIncludingLineBreak);
InheritanceMargin\InheritanceMarginTaggerProvider.cs (1)
116var spanToSearch = spanToTag.SnapshotSpan.Span.ToTextSpan();
LanguageService\AbstractLanguageService`2.IVsLanguageBlock.cs (2)
41(string description, TextSpan span)? foundBlock = null; 68public static (string description, TextSpan span)? GetCurrentBlock(
LanguageService\AbstractLanguageService`2.IVsLanguageContextProvider.cs (2)
38var span = Microsoft.CodeAnalysis.Text.TextSpan.FromBounds(start, end);
LanguageService\AbstractLanguageService`2.IVsLanguageTextOps.cs (6)
19using RoslynTextSpan = Microsoft.CodeAnalysis.Text.TextSpan; 64var adjustedSpan = GetFormattingSpan(root, start, end); 76var originalSpan = RoslynTextSpan.FromBounds(start, end); 88private static RoslynTextSpan GetFormattingSpan(SyntaxNode root, int start, int end) 105return RoslynTextSpan.FromBounds(start, end);
Snippets\AbstractSnippetExpansionClient.cs (1)
222var formattingSpan = CommonFormattingHelpers.GetFormattingSpan(SubjectBuffer.CurrentSnapshot, snippetTrackingSpan.GetSpan(SubjectBuffer.CurrentSnapshot));
Snippets\SnippetFunctions\SnippetFunctionGenerateSwitchCases.cs (1)
70private bool TryGetSpan(string fieldName, [NotNullWhen(true)] out TextSpan? switchExpressionSpan)
Snippets\SnippetFunctions\SnippetFunctionSimpleTypeName.cs (2)
12using TextSpan = Microsoft.CodeAnalysis.Text.TextSpan; 59private bool TryGetFieldSpan([NotNullWhen(true)] out TextSpan? fieldSpan)
TableDataSource\Suppression\VisualStudioSuppressionFixService.cs (1)
195var span = diagnostic.DataLocation.UnmappedFileSpan.GetClampedTextSpan(text);
TaskList\ProjectExternalErrorReporter.cs (1)
332var span = diagnostic.DataLocation.UnmappedFileSpan.GetClampedTextSpan(text);
ValueTracking\TreeItemViewModel.cs (3)
26protected TextSpan TextSpan { get; } 45TextSpan textSpan, 116var highlightSpan = new TextSpan(spanStartPosition, TextSpan.Length);
ValueTracking\ValueTrackingCommandHandler.cs (1)
93var textSpan = new TextSpan(caretPosition.Value.Position, 0);
Venus\ContainedDocument.cs (52)
241var editorVisibleSpansInOriginal = SharedPools.Default<List<TextSpan>>().AllocateAndClear(); 260SharedPools.Default<List<TextSpan>>().ClearAndFree(editorVisibleSpansInOriginal); 264private IEnumerable<TextChange> FilterTextChanges(SourceText originalText, List<TextSpan> editorVisibleSpansInOriginal, IEnumerable<TextChange> changes) 282var visibleSpan = editorVisibleSpansInOriginal[spanIndex]; 283var visibleTextSpan = GetVisibleTextSpan(originalText, visibleSpan, uptoFirstAndLastLine: true); 331private static bool WhitespaceOnEdges(TextSpan visibleTextSpan, TextChange change) 351private IEnumerable<TextChange> GetSubTextChanges(SourceText originalText, TextChange changeInOriginalText, TextSpan visibleSpanInOriginalText) 368SourceText originalText, TextSpan visibleSpanInOriginalText, string leftText, string rightText, int offsetInOriginalText, List<TextChange> changes) 371using var leftPool = SharedPools.Default<List<TextSpan>>().GetPooledObject(); 372using var rightPool = SharedPools.Default<List<TextSpan>>().GetPooledObject(); 381var spanInLeftText = spansInLeftText[i]; 382var spanInRightText = spansInRightText[i]; 388var spanInOriginalText = new TextSpan(offsetInOriginalText + spanInLeftText.Start, spanInLeftText.Length); 402SourceText originalText, TextSpan visibleSpanInOriginalText, string leftText, string rightText, int offsetInOriginalText) 419var spanInOriginalText = new TextSpan(offsetInOriginalText + spanInLeftText.Start, spanInLeftText.Length); 427private static bool TryGetWhitespaceOnlyChanges(string leftText, string rightText, List<TextSpan> spansInLeftText, List<TextSpan> spansInRightText) 430private static bool TryGetWhitespaceGroup(string text, List<TextSpan> groups) 457groups.Add(TextSpan.FromBounds(0, 0)); 461groups.Add(TextSpan.FromBounds(start, i)); 465groups.Add(TextSpan.FromBounds(start, i)); 478groups.Add(TextSpan.FromBounds(start, text.Length)); 506SourceText originalText, TextSpan visibleSpanInOriginalText, 507string rightText, TextSpan spanInOriginalText, TextSpan spanInRightText, out TextChange textChange) 551TextSpan.FromBounds(visibleFirstLineInOriginalText.EndIncludingLineBreak, visibleLastLineInOriginalText.Start), 572TextSpan.FromBounds(visibleFirstLineInOriginalText.EndIncludingLineBreak, spanInOriginalText.End), 589TextSpan.FromBounds(spanInOriginalText.Start, visibleLastLineInOriginalText.Start), 703public IEnumerable<TextSpan> GetEditorVisibleSpans() 717return SpecializedCollections.EmptyEnumerable<TextSpan>(); 724IList<TextSpan> visibleSpansInOriginal, 778using var pooledObject = SharedPools.Default<List<TextSpan>>().GetPooledObject(); 789var visibleSpan = spans[spanIndex]; 797Document document, ITextEdit edit, TextSpan visibleSpan, AbstractFormattingRule baseIndentationRule, SyntaxFormattingOptions options) 802using var spanPool = SharedPools.Default<List<TextSpan>>().GetPooledObject(); 815root, new TextSpan[] { CommonFormattingHelpers.GetFormattingSpan(root, visibleSpan) }, 827public BaseIndentationFormattingRule GetBaseIndentationRule(SyntaxNode root, SourceText text, List<TextSpan> spans, int spanIndex) 832GetVisibleAndTextSpan(text, spans, currentSpanIndex, out var visibleSpan, out var visibleTextSpan); 844return new BaseIndentationFormattingRule(root, TextSpan.FromBounds(visibleSpan.Start, end), baseIndentation, _vbHelperFormattingRule); 854return new BaseIndentationFormattingRule(root, TextSpan.FromBounds(visibleSpan.Start, end), baseIndentation, _vbHelperFormattingRule); 870var span = spans[spanIndex]; 875private static void GetVisibleAndTextSpan(SourceText text, List<TextSpan> spans, int spanIndex, out TextSpan visibleSpan, out TextSpan visibleTextSpan) 887private int GetBaseIndentation(SyntaxNode root, SourceText text, TextSpan span) 914private static TextSpan GetVisibleTextSpan(SourceText text, TextSpan visibleSpan, bool uptoFirstAndLastLine = false) 949return (start <= end) ? TextSpan.FromBounds(start, end + 1) : default; 952private int GetAdditionalIndentation(SyntaxNode root, SourceText text, TextSpan span, int hostIndentationSize) 972var textSpan = GetVisibleTextSpan(text, span); 991var textSpan = GetVisibleTextSpan(text, span);
Venus\ContainedDocument.DocumentServiceProvider.cs (11)
86IEnumerable<TextSpan> spans, 103foreach (var span in spans) 136public async Task<ExcerptResult?> TryExcerptAsync(Document document, TextSpan span, ExcerptMode mode, ClassificationOptions classificationOptions, CancellationToken cancellationToken) 182var contentSpan = contentSpanOnPrimarySnapshot.Span.ToTextSpan(); 215var spanOnContentSpan = GetSpanOnContent(mappedSpan.Value.Span.ToTextSpan(), contentSpan); 242var lastSpan = builder[^1].TextSpan; 265private static SnapshotSpan? MapRoslynSpanToPrimarySpan(IProjectionSnapshot primarySnapshot, ITextSnapshot roslynSnapshot, TextSpan span) 277private static (SourceText, TextSpan) GetContentAndMappedSpan(ExcerptMode mode, SnapshotSpan primarySpan, SnapshotSpan contentSpan) 318private static TextSpan GetSpanOnContent(TextSpan targetSpan, TextSpan excerptSpan)
Workspace\SourceGeneratedFileManager.cs (2)
94public Func<CancellationToken, Task<bool>> GetNavigationCallback(SourceGeneratedDocument document, TextSpan sourceSpan) 494public Task<bool> NavigateToSpanAsync(TextSpan sourceSpan, CancellationToken cancellationToken)
Workspace\VisualStudioDocumentNavigationService.cs (14)
29using TextSpan = Microsoft.CodeAnalysis.Text.TextSpan; 62public async Task<bool> CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) 130Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) 154static async Task<TextSpan> GetTextSpanFromLineAndOffsetAsync(Document document, int lineNumber, int offset, CancellationToken cancellationToken) 180static async Task<TextSpan> GetTextSpanFromPositionAsync(Document document, int position, int virtualSpace, CancellationToken cancellationToken) 212Func<Document, Task<TextSpan>> getTextSpanForMappingAsync, 235Func<Document, Task<TextSpan>> getTextSpanForMappingAsync, 369ISpanMappingService spanMappingService, Document generatedDocument, TextSpan textSpan, CancellationToken cancellationToken) 397private static VsTextSpan GetVsTextSpan(SourceText text, TextSpan textSpan, bool allowInvalidSpan) 399var boundedTextSpan = GetSpanWithinDocumentBounds(textSpan, text.Length); 415/// It is unclear why, but we are sometimes asked to navigate to a <see cref="TextSpan"/> 422private static TextSpan GetSpanWithinDocumentBounds(TextSpan span, int documentLength) 423=> TextSpan.FromBounds(GetPositionWithinDocumentBounds(span.Start, documentLength), GetPositionWithinDocumentBounds(span.End, documentLength));
Workspace\VisualStudioFormattingRuleFactoryServiceFactory.cs (5)
56using var pooledObject = SharedPools.Default<List<TextSpan>>().GetPooledObject(); 66var visibleSpan = spans[i]; 82var visibleSpan = spans[i]; 96public IEnumerable<TextChange> FilterFormattedChanges(DocumentId documentId, TextSpan span, IList<TextChange> changes) 107foreach (var visibleSpan in containedDocument.GetEditorVisibleSpans())
Microsoft.VisualStudio.LanguageServices.CSharp (8)
CodeModel\CSharpCodeModelService.cs (4)
2806text = text.Replace(TextSpan.FromBounds(deletionStart, deletionEnd), string.Empty); 2881text = text.Replace(TextSpan.FromBounds(deletionStart, deletionEnd), string.Empty); 3200protected override TextSpan GetSpanToFormat(SyntaxNode root, TextSpan span)
CodeModel\CSharpCodeModelService.NodeLocator.cs (2)
141var textAfterBrace = text.ToString(TextSpan.FromBounds(openBrace.Span.End, openBraceLine.End)); 215var textBeforeBrace = text.ToString(TextSpan.FromBounds(closeBraceLine.Start, closeBrace.SpanStart));
LanguageService\CSharpHelpContextService.cs (2)
46public override async Task<string> GetHelpTermAsync(Document document, TextSpan span, CancellationToken cancellationToken) 89return text.GetSubText(TextSpan.FromBounds(start, end)).ToString();
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
EditorConfigSettings\DataProvider\DataProviderTests.MockAnalyzerReference.cs (1)
111c.ReportDiagnostic(Diagnostic.Create(descriptor, c.Tree.GetLocation(TextSpan.FromBounds(0, 0))));
Microsoft.VisualStudio.LanguageServices.Implementation (6)
CodeModel\AbstractCodeModelService.cs (6)
97protected TextSpan GetEncompassingSpan(SyntaxNode root, SyntaxToken startToken, SyntaxToken endToken) 102return TextSpan.FromBounds(startPosition, endPosition); 1023protected abstract TextSpan GetSpanToFormat(SyntaxNode root, TextSpan span); 1036var formattingSpan = GetSpanToFormat(root, annotatedNode.FullSpan); 1050new TextSpan[] { formattingSpan },
Microsoft.VisualStudio.LanguageServices.IntegrationTests (19)
CSharp\CSharpExtractMethod.cs (3)
78MarkupTestFile.GetSpans(expectedMarkup, out var expectedText, out ImmutableArray<TextSpan> spans); 118MarkupTestFile.GetSpans(expectedMarkup, out var expectedText, out ImmutableArray<TextSpan> spans); 159MarkupTestFile.GetSpans(expectedMarkup, out var expectedText, out ImmutableArray<TextSpan> spans);
CSharp\CSharpKeywordHighlighting.cs (5)
42Roslyn.Test.Utilities.MarkupTestFile.GetSpans(input, out var text, out ImmutableArray<TextSpan> spans); 49Verify("in", ImmutableArray.Create<TextSpan>()); 75out IDictionary<string, ImmutableArray<TextSpan>> spans); 100out ImmutableArray<TextSpan> spans); 108private void Verify(string marker, ImmutableArray<TextSpan> expectedCount)
CSharp\CSharpOutlining.cs (3)
49MarkupTestFile.GetSpans(input, out var text, out ImmutableArray<TextSpan> spans); 81MarkupTestFile.GetSpans(input, out var text, out IDictionary<string, ImmutableArray<TextSpan>> spans); 88private void VerifySpansInConfiguration(IDictionary<string, ImmutableArray<TextSpan>> spans, string configuration)
CSharp\CSharpReferenceHighlighting.cs (3)
43Test.Utilities.MarkupTestFile.GetSpans(markup, out var text, out IDictionary<string, ImmutableArray<TextSpan>> spans); 63Test.Utilities.MarkupTestFile.GetSpans(markup, out var text, out IDictionary<string, ImmutableArray<TextSpan>> spans); 116private void Verify(string marker, IDictionary<string, ImmutableArray<TextSpan>> spans)
VisualBasic\BasicExtractMethod.cs (2)
82MarkupTestFile.GetSpans(expectedMarkup, out var expectedText, out ImmutableArray<TextSpan> spans); 125MarkupTestFile.GetSpans(expectedMarkup, out var expectedText, out ImmutableArray<TextSpan> spans);
VisualBasic\BasicOutlining.cs (1)
41MarkupTestFile.GetSpans(input, out var text, out ImmutableArray<TextSpan> spans);
VisualBasic\BasicReferenceHighlighting.cs (2)
40Test.Utilities.MarkupTestFile.GetSpans(markup, out var text, out IDictionary<string, ImmutableArray<TextSpan>> spans); 48private void Verify(string marker, IDictionary<string, ImmutableArray<TextSpan>> spans)
Microsoft.VisualStudio.LanguageServices.LiveShare (1)
Client\RemoteLanguageServiceWorkspace.cs (1)
327var textSpan = ProtocolConversions.RangeToTextSpan(location.Range, text);
Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests (2)
MockDocumentNavigationServiceFactory.cs (2)
40public Task<bool> CanNavigateToSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken) => SpecializedTasks.True; 48public Task<INavigableLocation?> GetLocationForSpanAsync(Workspace workspace, DocumentId documentId, TextSpan textSpan, bool allowInvalidSpan, CancellationToken cancellationToken)
Microsoft.VisualStudio.LanguageServices.New.IntegrationTests (40)
CSharp\CSharpCodeActions.cs (7)
163MarkupTestFile.GetSpans(markup, out _, out ImmutableArray<TextSpan> _); 225MarkupTestFile.GetSpans(markup, out _, out ImmutableArray<TextSpan> _); 982MarkupTestFile.GetSpans(markup, out _, out ImmutableArray<TextSpan> _); 1148MarkupTestFile.GetSpans(markup1, out _, out ImmutableArray<TextSpan> _); 1228MarkupTestFile.GetSpans(markup, out _, out ImmutableArray<TextSpan> _); 1362MarkupTestFile.GetSpans(markup1, out _, out ImmutableArray<TextSpan> _); 1440MarkupTestFile.GetSpans(markup, out _, out ImmutableArray<TextSpan> _);
CSharp\CSharpFormatting.cs (1)
304MarkupTestFile.GetSpans(markup, out var expectedTextFourSpaceIndent, out ImmutableArray<TextSpan> _);
CSharp\CSharpRename.cs (9)
74MarkupTestFile.GetSpans(markup, out var _, out ImmutableArray<TextSpan> renameSpans); 117MarkupTestFile.GetSpans(markup, out var _, out ImmutableArray<TextSpan> renameSpans); 146MarkupTestFile.GetSpans(markup, out var _, out ImmutableArray<TextSpan> renameSpans); 180MarkupTestFile.GetSpans(markup, out _, out ImmutableArray<TextSpan> renameSpans); 219MarkupTestFile.GetSpans(markup, out _, out ImmutableArray<TextSpan> renameSpans); 277MarkupTestFile.GetSpans(markup, out var _, out ImmutableArray<TextSpan> renameSpans); 339MarkupTestFile.GetSpans(markup, out var _, out ImmutableArray<TextSpan> renameSpans); 389MarkupTestFile.GetSpans(markup, out var _, out ImmutableArray<TextSpan> renameSpans); 431MarkupTestFile.GetSpans(class2Markup, out var code, out ImmutableArray<TextSpan> renameSpans);
CSharp\CSharpSquigglesCommon.cs (6)
47var usingsErrorTags = SupportsGlobalUsings ? ("suggestion", TextSpan.FromBounds(0, 68), @"using System; 50: ("suggestion", TextSpan.FromBounds(15, 68), @"using System.Collections.Generic; 57("syntax error", TextSpan.FromBounds(286, 287), "\r", "CS1002: ; expected"), 58("syntax error", TextSpan.FromBounds(354, 355), "}", "CS1513: } expected"), 74("suggestion", TextSpan.FromBounds(0, 13), "using System;", "IDE0005: Using directive is unnecessary."), 75("syntax error", TextSpan.FromBounds(28, 31), "Bar", "CS0246: The type or namespace name 'Bar' could not be found (are you missing a using directive or an assembly reference?)"),
InProcess\EditorInProcess.cs (4)
57using TextSpan = Microsoft.CodeAnalysis.Text.TextSpan; 187public async Task SetMultiSelectionAsync(ImmutableArray<TextSpan> positions, CancellationToken cancellationToken) 1100public async Task<ImmutableArray<(bool Collapsed, TextSpan Span)>> GetOutliningSpansAsync(CancellationToken cancellationToken) 1118return (r.IsCollapsed, TextSpan.FromBounds(span.Start.Position, span.End.Position));
InProcess\EditorVerifierInProcess.cs (1)
250(string errorType, TextSpan textSpan, string taggedText, string tooltipText)[] expectedTags, CancellationToken cancellationToken)
VisualBasic\BasicRename.cs (10)
67MarkupTestFile.GetSpans(markup, out var _, out ImmutableArray<TextSpan> renameSpans); 117MarkupTestFile.GetSpans(markup, out var _, out ImmutableArray<TextSpan> renameSpans); 162MarkupTestFile.GetSpans(markup, out var _, out ImmutableArray<TextSpan> renameSpans); 202MarkupTestFile.GetSpans(markup, out var _, out ImmutableArray<TextSpan> renameSpans); 234MarkupTestFile.GetSpans(markup, out var _, out ImmutableArray<TextSpan> renameSpans); 262MarkupTestFile.GetSpans(markup, out var _, out ImmutableArray<TextSpan> renameSpans); 293MarkupTestFile.GetSpans(markup, out _, out ImmutableArray<TextSpan> renameSpans); 328MarkupTestFile.GetSpans(markup, out _, out ImmutableArray<TextSpan> renameSpans); 359MarkupTestFile.GetSpans(markup, out var _, out ImmutableArray<TextSpan> renameSpans); 386MarkupTestFile.GetSpans(markup, out var _, out ImmutableArray<TextSpan> renameSpans);
VisualBasic\BasicSquigglesCommon.cs (2)
33await TestServices.EditorVerifier.ErrorTagsAsync(new[] { ("syntax error", TextSpan.FromBounds(50, 51), "\r", "BC30201: Expression expected.") }, HangMitigatingCancellationToken); 47new[] { ("syntax error", TextSpan.FromBounds(33, 36), "Bar", "BC30002: Type 'Bar' is not defined.") },
Microsoft.VisualStudio.LanguageServices.UnitTests (9)
CallHierarchy\CallHierarchyTests.vb (1)
326Assert.Equal(TextSpan.FromBounds(43, 46), mockNavigationService.ProvidedTextSpan)
CodeModel\CSharp\FileCodeModelTests.vb (1)
1227span:=TextSpan.FromBounds(0, textAfterOperation.Length),
Debugging\VisualBasicBreakpointResolutionServiceTests.vb (1)
23Dim expectedSpan As TextSpan? = Nothing
Diagnostics\ExternalDiagnosticUpdateSourceTests.vb (2)
670Public Function GetDiagnosticsForSpanAsync(document As TextDocument, range As TextSpan?, shouldIncludeDiagnostic As Func(Of String, Boolean), includeCompilerDiagnostics As Boolean, Optional includeSuppressedDiagnostics As Boolean = False, Optional priority As CodeActionRequestPriority = CodeActionRequestPriority.None, Optional addOperationScope As Func(Of String, IDisposable) = Nothing, Optional diagnosticKinds As DiagnosticKind = DiagnosticKind.All, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ImmutableArray(Of DiagnosticData)) Implements IDiagnosticAnalyzerService.GetDiagnosticsForSpanAsync 702Public Function TryGetDiagnosticsForSpanAsync(document As TextDocument, range As TextSpan, shouldIncludeDiagnostic As Func(Of String, Boolean), Optional includeSuppressedDiagnostics As Boolean = False, Optional priority As CodeActionRequestPriority = CodeActionRequestPriority.None, Optional diagnosticKinds As DiagnosticKind = DiagnosticKind.All, Optional cancellationToken As CancellationToken = Nothing) As Task(Of (diagnostics As ImmutableArray(Of DiagnosticData), upToDate As Boolean)) Implements IDiagnosticAnalyzerService.TryGetDiagnosticsForSpanAsync
Venus\DocumentService_IntegrationTests.vb (3)
270Public Async Function MapSpansAsync(document As Document, spans As IEnumerable(Of TextSpan), cancellationToken As CancellationToken) As Task(Of ImmutableArray(Of MappedSpanResult)) Implements ISpanMappingService.MapSpansAsync 308Public Async Function TryExcerptAsync(document As Document, span As TextSpan, mode As ExcerptMode, classificationOptions As ClassificationOptions, cancellationToken As CancellationToken) As Task(Of ExcerptResult?) Implements IDocumentExcerptService.TryExcerptAsync 316Dim mappedSpan As TextSpan
Venus\DocumentServiceTests.vb (1)
299Private Shared Function GetNamedSpan(document As TestHostDocument, Optional spanName As String = "Document") As TextSpan
Microsoft.VisualStudio.LanguageServices.VisualBasic (10)
CodeModel\VisualBasicCodeModelService.vb (6)
1301text = text.Replace(TextSpan.FromBounds(deletionStart, deletionEnd), String.Empty) 1360text = text.Replace(TextSpan.FromBounds(spanStart, spanEnd), String.Empty) 3731Protected Overrides Function GetSpanToFormat(root As SyntaxNode, span As TextSpan) As TextSpan 4133text = text.Replace(TextSpan.FromBounds(clauseItemToRemove.SpanStart, methodStatement.HandlesClause.Events.GetSeparator(0).Span.End), String.Empty) 4135text = text.Replace(TextSpan.FromBounds(methodStatement.HandlesClause.Events.GetSeparator(index - 1).SpanStart, clauseItemToRemove.Span.End), String.Empty)
Help\VisualBasicHelpContextService.vb (1)
39Public Overrides Async Function GetHelpTermAsync(document As Document, span As TextSpan, cancellationToken As CancellationToken) As Task(Of String)
Help\VisualBasicHelpContextService.Visitor.vb (2)
19Private ReadOnly _span As TextSpan 25Public Sub New(span As TextSpan, semanticModel As SemanticModel, isNotMetadata As Boolean, service As VisualBasicHelpContextService, cancellationToken As CancellationToken)
Snippets\SnippetCommandHandler.vb (1)
120subjectBuffer.ApplyChange(New TextChange(Microsoft.CodeAnalysis.Text.TextSpan.FromBounds(caretPosition - 1, caretPosition), String.Empty))
Microsoft.VisualStudio.LanguageServices.Xaml (17)
Features\Completion\XamlCompletionItem.cs (1)
23public TextSpan? Span { get; set; }
Features\Completion\XamlCompletionResult.cs (1)
15public TextSpan? ApplicableToSpan { get; set; }
Features\Definitions\XamlSourceDefinition.cs (2)
16public XamlSourceDefinition(string filePath, TextSpan span) 34public TextSpan? Span { get; }
Features\DocumentSpan.cs (2)
16public TextSpan TextSpan { get; } 18public DocumentSpan(Document document, TextSpan textSpan) : this()
Features\Formatting\IXamlFormattingService.cs (1)
18Task<IList<TextChange>> GetFormattingChangesAsync(TextDocument document, XamlFormattingOptions options, TextSpan? textSpan, CancellationToken cancellationToken);
Features\InlineRename\IXamlRenameInfo.cs (1)
30TextSpan TriggerSpan { get; }
Features\InlineRename\XamlEditorInlineRenameService.cs (3)
66public TextSpan TriggerSpan => _renameInfo.TriggerSpan; 88public TextSpan? GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken) 98public TextSpan GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken)
Features\QuickInfo\XamlQuickInfo.cs (3)
15public TextSpan Span { get; } 22TextSpan span, 32TextSpan span,
Features\Structure\XamlStructureTag.cs (1)
14public TextSpan TextSpan { get; set; }
Features\TypeRename\XamlTypeRenameResult.cs (1)
12public ImmutableArray<TextSpan> Ranges { get; set; }
Implementation\LanguageServer\Handler\Formatting\AbstractFormatDocumentHandlerBase.cs (1)
37TextSpan? textSpan = null;
Roslyn.VisualStudio.Next.UnitTests (3)
Services\ServiceHubServicesTests.cs (1)
84var newText = oldText.WithChanges(new TextChange(TextSpan.FromBounds(0, 0), "/* test */"));
Services\VisualStudioDiagnosticAnalyzerExecutorTests.cs (2)
295c.ReportDiagnostic(Diagnostic.Create(_supportedDiagnostics[0], c.Tree.GetLocation(TextSpan.FromBounds(0, 1)))); 313c.ReportDiagnostic(Diagnostic.Create(_supportedDiagnostics[0], c.Tree.GetLocation(TextSpan.FromBounds(0, 1))));