Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static void Main(string[] args)
}
}
}");
var terms = CSharpProximityExpressionsService.TestAccessor.Do(tree, 245);
var terms = CSharpProximityExpressionsService.GetProximityExpressions(tree, 245, cancellationToken: default);
Assert.NotNull(terms);
AssertEx.Equal(new[] { "yy", "xx" }, terms);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,18 @@ public async Task<IList<string>> GetProximityExpressionsAsync(
try
{
var tree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);
return Do(tree, position, cancellationToken);
return GetProximityExpressions(tree, position, cancellationToken);
}
catch (Exception e) when (FatalError.ReportAndCatchUnlessCanceled(e))
{
return null;
}
}

public static IList<string> GetProximityExpressions(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
=> new Worker(syntaxTree, position).Do(cancellationToken);

[Obsolete($"Use {nameof(GetProximityExpressions)}.")]
private static IList<string> Do(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken)
=> new Worker(syntaxTree, position).Do(cancellationToken);

Expand All @@ -110,11 +114,5 @@ private static void AddRelevantExpressions(
{
new RelevantExpressionsCollector(includeDeclarations, expressions).Visit(statement);
}

internal static class TestAccessor
{
public static IList<string> Do(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken = default)
=> CSharpProximityExpressionsService.Do(syntaxTree, position, cancellationToken);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.CSharp" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.CSharp.EditorFeatures.Wpf" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.Remote.Workspaces" />
<!-- BEGIN External Access -->
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.Razor" />
Comment thread
NTaylorMullen marked this conversation as resolved.
<!-- END External Access -->
<!-- BEGIN MONODEVELOP
These MonoDevelop dependencies don't ship with Visual Studio, so can't break our
binary insertions and are exempted from the ExternalAccess adapter assembly policies.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

<ItemGroup>
<ProjectReference Include="..\..\..\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj" />
<ProjectReference Include="..\..\..\Features\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.Features.csproj" />
<ProjectReference Include="..\..\..\Workspaces\Core\Portable\Microsoft.CodeAnalysis.Workspaces.csproj" />
<ProjectReference Include="..\..\..\Workspaces\Remote\Core\Microsoft.CodeAnalysis.Remote.Workspaces.csproj" />
</ItemGroup>
Expand Down
18 changes: 18 additions & 0 deletions src/Tools/ExternalAccess/Razor/RazorCSharpBreakpointResolver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System.Threading;
using Microsoft.CodeAnalysis.CSharp.EditAndContinue;
using Microsoft.CodeAnalysis.Text;

namespace Microsoft.CodeAnalysis.ExternalAccess.Razor
{
internal static class RazorBreakpointSpans
{
public static bool TryGetBreakpointSpan(SyntaxTree tree, int position, CancellationToken cancellationToken, out TextSpan breakpointSpan)
=> BreakpointSpans.TryGetBreakpointSpan(tree, position, cancellationToken, out breakpointSpan);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System.Collections.Generic;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Debugging;

namespace Microsoft.CodeAnalysis.ExternalAccess.Razor
{
internal static class RazorCSharpProximityExpressionResolverService
{
public static IList<string> GetProximityExpressions(SyntaxTree syntaxTree, int absoluteIndex, CancellationToken cancellationToken)
=> CSharpProximityExpressionsService.GetProximityExpressions(syntaxTree, absoluteIndex, cancellationToken);
}
}