24 writes to Range
Microsoft.CodeAnalysis.LanguageServer.Protocol (7)
Extensions\ProtocolConversions.cs (3)
424Range = location.Range, 602Range = MappedSpanResultToRange(mappedSpan) 635Range = TextSpanToRange(span, text),
Extensions\ProtocolConversions.Diagnostics.cs (1)
98Range = GetRange(l),
Handler\Definitions\AbstractGoToDefinitionHandler.cs (1)
92Range = ProtocolConversions.LinePositionToRange(linePosSpan),
Handler\References\FindUsagesLSPContext.cs (1)
290Range = ProtocolConversions.LinePositionToRange(linePosSpan),
Handler\Symbols\DocumentSymbolsHandler.cs (1)
134Range = ProtocolConversions.TextSpanToRange(symbolItem.Location.InDocumentInfo.Value.navigationSpan, text),
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (7)
Definitions\GoToDefinitionTests.cs (1)
105Range = new LSP.Range { Start = position, End = position }
Metadata\LspMetadataAsSourceWorkspaceTests.cs (1)
106Range = new LSP.Range
References\FindImplementationsTests.cs (1)
100Range = new LSP.Range { Start = position, End = position }
Rename\RenameTests.cs (3)
179Range = new LSP.Range { Start = startPosition, End = endPosition } 452Range = ProtocolConversions.TextSpanToRange(spans["caret"].First(), generatedSourceText) 505Range = ProtocolConversions.TextSpanToRange(spans["caret"].First(), generatedSourceText)
Workspaces\SourceGeneratedDocumentTests.cs (1)
120var location = new LSP.Location { DocumentUri = sourceGeneratorDocumentUri, Range = new LSP.Range { Start = new LSP.Position(0, 6), End = new LSP.Position(0, 6) } };
Microsoft.CodeAnalysis.LanguageServer.UnitTests (1)
Utilities\AbstractLanguageServerClientTests.cs (1)
126Range = ProtocolConversions.TextSpanToRange(span, text),
Microsoft.CodeAnalysis.Razor.Workspaces (3)
Extensions\LspFactory.cs (1)
174=> new() { DocumentUri = new(uri), Range = range };
Protocol\DocumentSymbols\DocumentSymbolService.cs (2)
33symbolInformation.Location.Range = LspFactory.DefaultRange; 39symbolInformation.Location.Range = newRange;
Microsoft.CodeAnalysis.Remote.Razor (2)
FindAllReferences\RemoteFindAllReferencesService.cs (1)
131location.Range = mappedRange.ToRange();
RemoteTagHelperSearchEngine.cs (1)
79Range = text.GetRange(location.SourceSpan)
Microsoft.VisualStudio.LanguageServices.Razor.UnitTests (2)
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Endpoints\CohostGoToDefinitionEndpointTest.cs (1)
455Range = inputText.GetRange(input.Span),
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Endpoints\CohostGoToImplementationEndpointTest.cs (1)
109Range = inputText.GetRange(input.Span),
Microsoft.VisualStudioCode.RazorExtension.UnitTests (2)
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Endpoints\CohostGoToDefinitionEndpointTest.cs (1)
455Range = inputText.GetRange(input.Span),
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Endpoints\CohostGoToImplementationEndpointTest.cs (1)
109Range = inputText.GetRange(input.Span),
192 references to Range
IdeBenchmarks (3)
Lsp\LspCompletionSerializationBenchmarks.cs (1)
109Position = caret.Range.Start,
Lsp\LspSourceGeneratorBenchmarks.cs (2)
99var typingLine = typingLocation.Range.Start.Line; 100var typingColumn = typingLocation.Range.Start.Character;
Microsoft.CodeAnalysis.LanguageServer.Protocol (5)
Extensions\ProtocolConversions.cs (1)
424Range = location.Range,
Handler\MapCode\MapCodeHandler.cs (1)
134builder.Add((document, ProtocolConversions.RangeToTextSpan(location.Range, focusText)));
Protocol\Location.cs (3)
59EqualityComparer<Range>.Default.Equals(this.Range, other.Range); 65hashCode = (hashCode * -1521134295) + EqualityComparer<Range>.Default.GetHashCode(this.Range);
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (115)
CallHierarchy\CallHierarchyTests.cs (9)
43Assert.Equal(0, CompareRange(definition.Range, preparedItem.SelectionRange)); 82Assert.Equal(0, CompareRange(typeLocation.Range, constructorCall.To.SelectionRange)); 86Assert.Equal(0, CompareRange(methodLocation.Range, methodCall.To.SelectionRange)); 130Assert.Equal(0, CompareRange(firstCallerLocation.Range, firstCaller.From.SelectionRange)); 131Assert.Equal(0, CompareRange(secondCallerLocation.Range, secondCaller.From.SelectionRange)); 170Assert.Equal(0, CompareRange(testLspServer.GetLocations("method").Single().Range, methodCall.To.SelectionRange)); 171Assert.Equal(0, CompareRange(testLspServer.GetLocations("property").Single().Range, propertyCall.To.SelectionRange)); 172Assert.Equal(0, CompareRange(testLspServer.GetLocations("field").Single().Range, fieldCall.To.SelectionRange)); 185Position = caret.Range.Start,
CodeActions\CodeActionsTests.cs (5)
118Range = caret.Range, 162Range = caret.Range, 206Range = caret.Range, 254Range = caret.Range, 295Range = caret.Range,
CodeActions\RunCodeActionsTests.cs (1)
45var commandArgument = new CodeActionResolveData(string.Format(FeaturesResources.Move_type_to_0, "B.cs"), customTags: [], caretLocation.Range, documentId, fixAllFlavors: null, nestedCodeActions: null, codeActionPath: titlePath);
CodeLens\AbstractCodeLensTests.cs (2)
42var matchingCodeLenses = actualCodeLenses.Where(actualCodeLens => actualCodeLens.Range == expectedCodeLens.Range); 70.Where(actualCodeLens => actualCodeLens.Range == expectedCodeLens.Range)
Completion\CompletionFeaturesTests.cs (17)
85Position = caret.Range.Start, 359await testLspServer.InsertTextAsync(caretLocation.DocumentUri, (caretLocation.Range.End.Line, caretLocation.Range.End.Character, "s")); 463Position = caret.Range.Start, 657Position = caret.Range.Start, 669Assert.Equal(new() { Start = new(2, 0), End = caret.Range.Start }, results.ItemDefaults.EditRange.Value.First); 764Position = caret.Range.Start, 798Position = caret.Range.Start, 814await testLspServer.InsertTextAsync(caret.DocumentUri, (caret.Range.End.Line, caret.Range.End.Character, "i")); 868await testLspServer.InsertTextAsync(caretLocation.DocumentUri, (caretLocation.Range.End.Line, caretLocation.Range.End.Character, "s")); 966Position = caret.Range.Start, 1035Position = caret.Range.Start, 1092Position = caret.Range.Start, 1111await testLspServer.InsertTextAsync(caret.DocumentUri, (caret.Range.End.Line, caret.Range.End.Character, "f"));
Completion\CompletionResolveTests.cs (1)
392var editRange = testLspServer.GetLocations("editRange").Single().Range;
Completion\CompletionTests.cs (18)
1052await testLspServer.InsertTextAsync(caretLocation.DocumentUri, (caretLocation.Range.End.Line, caretLocation.Range.End.Character, "a")); 1120await testLspServer.InsertTextAsync(caretLocation.DocumentUri, (caretLocation.Range.End.Line, caretLocation.Range.End.Character, "C")); 1189await testLspServer.InsertTextAsync(caretLocation.DocumentUri, (caretLocation.Range.End.Line, caretLocation.Range.End.Character, "ask")); 1201await testLspServer.DeleteTextAsync(caretLocation.DocumentUri, (caretLocation.Range.End.Line, caretLocation.Range.End.Character, caretLocation.Range.End.Line, caretLocation.Range.End.Character + 3)); 1214await testLspServer.InsertTextAsync(caretLocation.DocumentUri, (caretLocation.Range.End.Line, caretLocation.Range.End.Character, "i")); 1415await testLspServer.InsertTextAsync(secondCaretLocation.DocumentUri, (secondCaretLocation.Range.End.Line, secondCaretLocation.Range.End.Character, "S")); 1430await testLspServer.InsertTextAsync(firstCaretLocation.DocumentUri, (firstCaretLocation.Range.End.Line, firstCaretLocation.Range.End.Character, "a")); 1532await testLspServer.InsertTextAsync(caretLocation.DocumentUri, (caretLocation.Range.End.Line, caretLocation.Range.End.Character, "z"));
DataTips\DataTipRangeHandlerTests.cs (1)
25Position = caret.Range.Start,
Diagnostics\PullDiagnosticTests.cs (13)
550var locationToReplace = testLspServer.GetLocations("caret").Single().Range; 603var locationToReplace = testLspServer.GetLocations("caret").Single().Range; 683var textEdit = new LSP.TextEdit { Range = textLocation.Range, NewText = "partial " }; 835var firstLocation = testLspServer.GetLocations("first").Single().Range; 875var firstLocation = testLspServer.GetLocations("first").Single().Range; 903var openLocation = testLspServer.GetLocations("open").Single().Range; 904var closeLocation = testLspServer.GetLocations("close").Single().Range; 905var lineLocation = testLspServer.GetLocations("line").Single().Range; 935Assert.Equal(openLocation, results.Single().Diagnostics!.Single().RelatedInformation![0].Location.Range); 938Assert.Equal(closeLocation, results.Single().Diagnostics!.Single().RelatedInformation![1].Location.Range); 1794var caretLocation = testLspServer.GetLocations("caret").First().Range; 1880var caretLocation = testLspServer.GetLocations("caret").First().Range; 1948var caretLocation = testLspServer.GetLocations("caret").First().Range;
FoldingRanges\FoldingRangesTests.cs (1)
151.SelectMany(kvp => kvp.Value.Select(location => CreateFoldingRange(kvp.Key, location.Range, collapsedText ?? "...", lineFoldingOnly)))
Formatting\FormatDocumentOnTypeTests.cs (1)
190Position = locationTyped.Range.Start,
Formatting\FormatDocumentRangeTests.cs (1)
101Range = location.Range,
Highlights\DocumentHighlightTests.cs (7)
74Assert.Equal(expectedLocations[0].Range, results[0].Range); 75Assert.Equal(expectedLocations[1].Range, results[1].Range); 76Assert.Equal(expectedLocations[2].Range, results[2].Range); 119Assert.Equal(expectedLocations[0].Range, results[0].Range); 120Assert.Equal(expectedLocations[1].Range, results[1].Range); 148Assert.Equal(expectedLocations[0].Range, results[0].Range); 189Range = location.Range
InlayHint\AbstractInlayHintTests.cs (1)
46var matchingInlayHints = actualInlayHints.Where(actualInlayHints => actualInlayHints.Position == location.Range.Start);
InlineCompletions\InlineCompletionsTests.cs (1)
268Position = locationTyped.Range.Start,
OnAutoInsert\AbstractOnAutoInsertTests.cs (1)
102Position = locationTyped.Range.Start,
References\FindAllReferencesHandlerTests.cs (1)
461Position = caret.Range.Start,
Rename\PrepareRenameTests.cs (4)
33Assert.Equal(testLspServer.GetLocations("range").Single().Range, results); 52Assert.Equal(testLspServer.GetLocations("range").Single().Range, results); 72Assert.Equal(testLspServer.GetLocations("range").Single().Range, results); 98Position = location.Range.Start,
Rename\RenameTests.cs (12)
49var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.TextEdit() { NewText = renameValue, Range = location.Range }); 104var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.TextEdit() { NewText = renameValue, Range = location.Range }); 149var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.TextEdit() { NewText = renameValue, Range = location.Range }); 185var expectedMappedRanges = ImmutableArray.Create(TestSpanMapper.MappedFileLocation.Range, TestSpanMapper.MappedFileLocation.Range); 229var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.TextEdit() { NewText = renameValue, Range = location.Range }); 282var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.TextEdit() { NewText = renameValue, Range = location.Range }); 337var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.TextEdit() { NewText = renameValue, Range = location.Range }); 389var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.TextEdit() { NewText = renameValue, Range = location.Range }); 394ProtocolConversions.PositionToLinePosition(renameLocation.Range.Start), 455var expectedEdits = testLspServer.GetLocations("renamed").Select(location => new LSP.TextEdit() { NewText = renameValue, Range = location.Range }); 520Position = location.Range.Start,
SelectionRanges\SelectionRangesTests.cs (3)
181Positions = [caret1.Range.Start, caret2.Range.Start] 225Positions = [caret.Range.Start]
SemanticTokens\AbstractSemanticTokensTests.cs (1)
54Range = location.Range
Symbols\DocumentSymbolsTests.Hierarchical.cs (2)
847Range = testLspServer.GetLocations(rangeLocationName).Single().Range, 848SelectionRange = testLspServer.GetLocations(selectionRangeLocationName).Single().Range,
TypeHierarchy\TypeHierarchyTests.cs (2)
403Assert.Equal(0, CompareRange(expectedDefinition.Range, item.SelectionRange)); 412Position = caret.Range.Start,
ValidateBreakableRange\ValidateBreakableRangeTests.cs (10)
34var expected = testLspServer.GetLocations("expected").Single().Range; 59var expected = caret.Range; 103var expected = testLspServer.GetLocations("expected").Single().Range; 126var expected = breakpoint.Range; 150var expected = breakpoint.Range; 175var expected = testLspServer.GetLocations("expected").Single().Range; 204var expected = testLspServer.GetLocations("expected").Single().Range; 229var expected = testLspServer.GetLocations("expected").Single().Range; 253var expected = testLspServer.GetLocations("expected").Single().Range; 266Range = caret.Range
Microsoft.CodeAnalysis.LanguageServer.UnitTests (1)
Utilities\AbstractLanguageServerClientTests.cs (1)
154Range = location.Range,
Microsoft.CodeAnalysis.Razor.Workspaces (2)
Extensions\LspExtensions_Location.cs (1)
12=> (uri, range) = (position.DocumentUri.GetRequiredParsedUri(), position.Range);
Protocol\DocumentSymbols\DocumentSymbolService.cs (1)
37else if (_documentMappingService.TryMapToRazorDocumentRange(csharpDocument, symbolInformation.Location.Range, out var newRange))
Microsoft.CodeAnalysis.Remote.Razor (1)
FindAllReferences\RemoteFindAllReferencesService.cs (1)
106var (mappedUri, mappedRange) = await DocumentMappingService.MapToHostDocumentUriAndRangeAsync(context.Snapshot, UriExtensions.GetRequiredParsedUri(location.DocumentUri), location.Range.ToLinePositionSpan(), cancellationToken).ConfigureAwait(false);
Microsoft.VisualStudio.LanguageServices.LiveShare (1)
Client\RemoteLanguageServiceWorkspace.cs (1)
311var textSpan = ProtocolConversions.RangeToTextSpan(location.Range, text);
Microsoft.VisualStudio.LanguageServices.Razor (2)
src\Razor\src\Razor\src\Microsoft.CodeAnalysis.Razor.CohostingShared\Navigation\CohostGoToDefinitionEndpoint.cs (2)
101return LspFactory.CreateLocation(RemapVirtualHtmlUri(singleLocation.DocumentUri.GetRequiredParsedUri()), singleLocation.Range.ToLinePositionSpan()); 105return Array.ConvertAll(multipleLocations, l => LspFactory.CreateLocation(RemapVirtualHtmlUri(l.DocumentUri.GetRequiredParsedUri()), l.Range.ToLinePositionSpan()));
Microsoft.VisualStudio.LanguageServices.Razor.UnitTests (30)
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Endpoints\CohostDocumentSymbolEndpointTest.cs (1)
349Assert.Equal(expectedRange, symbolInformation.Location.Range);
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Endpoints\CohostFindAllReferencesEndpointTest.cs (6)
239Assert.Equal(range, location.Range); 247Assert.Equal(range, location.Range); 285matchedText = inputText.Lines[location.Range.Start.Line].ToString(); 286Assert.Single(input.Spans, s => inputText.GetRange(s).Equals(location.Range)); 292matchedText = text.Lines[location.Range.Start.Line].ToString(); 293Assert.Single(testCode.Spans, s => text.GetRange(s).Equals(location.Range));
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Endpoints\CohostGoToDefinitionEndpointTest.cs (21)
87var line = File.ReadLines(location.DocumentUri.GetRequiredParsedUri().LocalPath).ElementAt(location.Range.Start.Line); 160Assert.Equal(range, location.Range); 195Assert.Equal(range, location.Range); 228Assert.Equal(range, location.Range); 261Assert.Equal(range, location.Range); 299Assert.Equal(range, location.Range); 341Assert.Equal(range, location.Range); 383Assert.Equal(range, location.Range); 430Assert.Equal(range, location.Range); 492Assert.Equal(expected.Span, SourceText.From(expected.Text).GetTextSpan(location.Range)); 528Assert.Equal(expected.Span, SourceText.From(expected.Text).GetTextSpan(location.Range)); 572Assert.Equal(expected.Span, SourceText.From(expected.Text).GetTextSpan(location.Range)); 610Assert.Equal(expected.Span, SourceText.From(expected.Text).GetTextSpan(location.Range)); 655Assert.Equal(expected.Span, SourceText.From(expected.Text).GetTextSpan(location.Range)); 719Assert.Equal(expected.Span, SourceText.From(expected.Text).GetTextSpan(location.Range)); 783Assert.Equal(expected.Span, SourceText.From(expected.Text).GetTextSpan(location.Range)); 870Assert.Equal(expected.Spans[0], SourceText.From(expected.Text).GetTextSpan(location.Range)); 874Assert.Equal(expected.Spans[1], SourceText.From(expected.Text).GetTextSpan(location.Range)); 980var line = File.ReadLines(location.DocumentUri.GetRequiredParsedUri().LocalPath).ElementAt(location.Range.Start.Line); 1033Assert.Equal(range, location.Range); 1053Assert.Equal(range, location.Range);
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Endpoints\CohostGoToImplementationEndpointTest.cs (2)
146Assert.Equal(range, location.Range); 160var actual = roslynLocations.Select(l => l.Range.ToLinePositionSpan()).OrderBy(r => r.Start.Line).ToArray();
Microsoft.VisualStudioCode.RazorExtension (2)
src\Razor\src\Razor\src\Microsoft.CodeAnalysis.Razor.CohostingShared\Navigation\CohostGoToDefinitionEndpoint.cs (2)
101return LspFactory.CreateLocation(RemapVirtualHtmlUri(singleLocation.DocumentUri.GetRequiredParsedUri()), singleLocation.Range.ToLinePositionSpan()); 105return Array.ConvertAll(multipleLocations, l => LspFactory.CreateLocation(RemapVirtualHtmlUri(l.DocumentUri.GetRequiredParsedUri()), l.Range.ToLinePositionSpan()));
Microsoft.VisualStudioCode.RazorExtension.UnitTests (30)
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Endpoints\CohostDocumentSymbolEndpointTest.cs (1)
349Assert.Equal(expectedRange, symbolInformation.Location.Range);
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Endpoints\CohostFindAllReferencesEndpointTest.cs (6)
239Assert.Equal(range, location.Range); 247Assert.Equal(range, location.Range); 285matchedText = inputText.Lines[location.Range.Start.Line].ToString(); 286Assert.Single(input.Spans, s => inputText.GetRange(s).Equals(location.Range)); 292matchedText = text.Lines[location.Range.Start.Line].ToString(); 293Assert.Single(testCode.Spans, s => text.GetRange(s).Equals(location.Range));
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Endpoints\CohostGoToDefinitionEndpointTest.cs (21)
87var line = File.ReadLines(location.DocumentUri.GetRequiredParsedUri().LocalPath).ElementAt(location.Range.Start.Line); 160Assert.Equal(range, location.Range); 195Assert.Equal(range, location.Range); 228Assert.Equal(range, location.Range); 261Assert.Equal(range, location.Range); 299Assert.Equal(range, location.Range); 341Assert.Equal(range, location.Range); 383Assert.Equal(range, location.Range); 430Assert.Equal(range, location.Range); 492Assert.Equal(expected.Span, SourceText.From(expected.Text).GetTextSpan(location.Range)); 528Assert.Equal(expected.Span, SourceText.From(expected.Text).GetTextSpan(location.Range)); 572Assert.Equal(expected.Span, SourceText.From(expected.Text).GetTextSpan(location.Range)); 610Assert.Equal(expected.Span, SourceText.From(expected.Text).GetTextSpan(location.Range)); 655Assert.Equal(expected.Span, SourceText.From(expected.Text).GetTextSpan(location.Range)); 719Assert.Equal(expected.Span, SourceText.From(expected.Text).GetTextSpan(location.Range)); 783Assert.Equal(expected.Span, SourceText.From(expected.Text).GetTextSpan(location.Range)); 870Assert.Equal(expected.Spans[0], SourceText.From(expected.Text).GetTextSpan(location.Range)); 874Assert.Equal(expected.Spans[1], SourceText.From(expected.Text).GetTextSpan(location.Range)); 980var line = File.ReadLines(location.DocumentUri.GetRequiredParsedUri().LocalPath).ElementAt(location.Range.Start.Line); 1033Assert.Equal(range, location.Range); 1053Assert.Equal(range, location.Range);
src\Razor\src\Razor\test\Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests\Endpoints\CohostGoToImplementationEndpointTest.cs (2)
146Assert.Equal(range, location.Range); 160var actual = roslynLocations.Select(l => l.Range.ToLinePositionSpan()).OrderBy(r => r.Start.Line).ToArray();