提交 1f293366 编写于 作者: R Ravi Chande

CR feedback

上级 781fbc15
...@@ -132,7 +132,7 @@ public void NavigateTo(SymbolKey id, Project project, CancellationToken cancella ...@@ -132,7 +132,7 @@ public void NavigateTo(SymbolKey id, Project project, CancellationToken cancella
{ {
var compilation = project.GetCompilationAsync(cancellationToken).WaitAndGetResult(cancellationToken); var compilation = project.GetCompilationAsync(cancellationToken).WaitAndGetResult(cancellationToken);
var resolution = id.Resolve(compilation, cancellationToken: cancellationToken); var resolution = id.Resolve(compilation, cancellationToken: cancellationToken);
project.Solution.Workspace.Services.GetService<ISymbolNavigationService>().TryNavigateToSymbol(resolution.Symbol, project, usePreviewTab: true); project.Solution.Workspace.Services.GetService<ISymbolNavigationService>().TryNavigateToSymbol(resolution.Symbol, project, usePreviewTab: true, cancellationToken: CancellationToken.None);
} }
} }
} }
...@@ -70,7 +70,7 @@ internal static class GoToDefinitionHelpers ...@@ -70,7 +70,7 @@ internal static class GoToDefinitionHelpers
// to a metadata-as-source view. // to a metadata-as-source view.
var symbolNavigationService = solution.Workspace.Services.GetService<ISymbolNavigationService>(); var symbolNavigationService = solution.Workspace.Services.GetService<ISymbolNavigationService>();
return symbolNavigationService.TryNavigateToSymbol(symbol, project, usePreviewTab: true, cancellationToken: cancellationToken); return symbolNavigationService.TryNavigateToSymbol(symbol, project, cancellationToken: cancellationToken, usePreviewTab: true);
} }
// If we have a single location, then just navigate to it. // If we have a single location, then just navigate to it.
......
...@@ -37,7 +37,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Utilities ...@@ -37,7 +37,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Utilities
Public NavigationLineNumberReturnValue As Integer = 0 Public NavigationLineNumberReturnValue As Integer = 0
Public NavigationCharOffsetReturnValue As Integer = 0 Public NavigationCharOffsetReturnValue As Integer = 0
Public Function TryNavigateToSymbol(symbol As ISymbol, project As Project, Optional usePreviewTab As Boolean = False, Optional cancellationToken As CancellationToken = Nothing) As Boolean Implements ISymbolNavigationService.TryNavigateToSymbol Public Function TryNavigateToSymbol(symbol As ISymbol, project As Project, cancellationToken As CancellationToken, Optional usePreviewTab As Boolean = False) As Boolean Implements ISymbolNavigationService.TryNavigateToSymbol
Me.TryNavigateToSymbolProvidedSymbol = symbol Me.TryNavigateToSymbolProvidedSymbol = symbol
Me.TryNavigateToSymbolProvidedProject = project Me.TryNavigateToSymbolProvidedProject = project
Me.TryNavigateToSymbolProvidedUsePreviewTab = usePreviewTab Me.TryNavigateToSymbolProvidedUsePreviewTab = usePreviewTab
......
...@@ -6,7 +6,7 @@ namespace Microsoft.CodeAnalysis.Navigation ...@@ -6,7 +6,7 @@ namespace Microsoft.CodeAnalysis.Navigation
{ {
internal class DefaultSymbolNavigationService : ISymbolNavigationService internal class DefaultSymbolNavigationService : ISymbolNavigationService
{ {
public bool TryNavigateToSymbol(ISymbol symbol, Project project, bool usePreviewTab = false, CancellationToken cancellationToken = default(CancellationToken)) public bool TryNavigateToSymbol(ISymbol symbol, Project project, CancellationToken cancellationToken = default(CancellationToken), bool usePreviewTab = false)
{ {
return false; return false;
} }
......
...@@ -15,7 +15,7 @@ internal interface ISymbolNavigationService : IWorkspaceService ...@@ -15,7 +15,7 @@ internal interface ISymbolNavigationService : IWorkspaceService
/// <param name="symbol">The symbol to navigate to</param> /// <param name="symbol">The symbol to navigate to</param>
/// <param name="usePreviewTab">Indicates whether a preview tab should be used if the /// <param name="usePreviewTab">Indicates whether a preview tab should be used if the
/// containing document is opened in a new tab. Defaults to false.</param> /// containing document is opened in a new tab. Defaults to false.</param>
bool TryNavigateToSymbol(ISymbol symbol, Project project, bool usePreviewTab = false, CancellationToken cancellationToken = default(CancellationToken)); bool TryNavigateToSymbol(ISymbol symbol, Project project, CancellationToken cancellationToken, bool usePreviewTab = false);
/// <returns>True if the navigation was handled, indicating that the caller should not /// <returns>True if the navigation was handled, indicating that the caller should not
/// perform the navigation.</returns> /// perform the navigation.</returns>
......
...@@ -40,7 +40,7 @@ public override int GoToSource() ...@@ -40,7 +40,7 @@ public override int GoToSource()
if (symbol != null && referencingProject != null) if (symbol != null && referencingProject != null)
{ {
var navigationService = _workspace.Services.GetService<ISymbolNavigationService>(); var navigationService = _workspace.Services.GetService<ISymbolNavigationService>();
return navigationService.TryNavigateToSymbol(symbol, referencingProject) return navigationService.TryNavigateToSymbol(symbol, referencingProject, CancellationToken.None)
? VSConstants.S_OK ? VSConstants.S_OK
: VSConstants.E_FAIL; : VSConstants.E_FAIL;
} }
......
...@@ -49,7 +49,7 @@ internal partial class VisualStudioSymbolNavigationService : ForegroundThreadAff ...@@ -49,7 +49,7 @@ internal partial class VisualStudioSymbolNavigationService : ForegroundThreadAff
_metadataAsSourceFileService = componentModel.GetService<IMetadataAsSourceFileService>(); _metadataAsSourceFileService = componentModel.GetService<IMetadataAsSourceFileService>();
} }
public bool TryNavigateToSymbol(ISymbol symbol, Project project, bool usePreviewTab = false, CancellationToken cancellationToken = default(CancellationToken)) public bool TryNavigateToSymbol(ISymbol symbol, Project project, CancellationToken cancellationToken = default(CancellationToken), bool usePreviewTab = false)
{ {
if (project == null || symbol == null) if (project == null || symbol == null)
{ {
......
...@@ -303,7 +303,7 @@ public Task<Document> AddEventAsync(Solution solution, INamedTypeSymbol destinat ...@@ -303,7 +303,7 @@ public Task<Document> AddEventAsync(Solution solution, INamedTypeSymbol destinat
return GetEditAsync( return GetEditAsync(
solution, solution,
destination, destination,
(t, opts, ai, _) => AddEvent(t, @event, opts, ai), (t, opts, ai, ct) => AddEvent(t, @event, opts, ai),
options, options,
new[] { @event }, new[] { @event },
cancellationToken); cancellationToken);
...@@ -314,7 +314,7 @@ public Task<Document> AddFieldAsync(Solution solution, INamedTypeSymbol destinat ...@@ -314,7 +314,7 @@ public Task<Document> AddFieldAsync(Solution solution, INamedTypeSymbol destinat
return GetEditAsync( return GetEditAsync(
solution, solution,
destination, destination,
(t, opts, ai, _) => AddField(t, field, opts, ai), (t, opts, ai, ct) => AddField(t, field, opts, ai),
options, options,
new[] { field }, new[] { field },
cancellationToken); cancellationToken);
...@@ -324,7 +324,7 @@ public Task<Document> AddPropertyAsync(Solution solution, INamedTypeSymbol desti ...@@ -324,7 +324,7 @@ public Task<Document> AddPropertyAsync(Solution solution, INamedTypeSymbol desti
{ {
return GetEditAsync( return GetEditAsync(
solution, destination, solution, destination,
(t, opts, ai, _) => AddProperty(t, property, opts, ai), (t, opts, ai, ct) => AddProperty(t, property, opts, ai),
options, new[] { property }, options, new[] { property },
cancellationToken); cancellationToken);
} }
...@@ -333,7 +333,7 @@ public Task<Document> AddNamedTypeAsync(Solution solution, INamedTypeSymbol dest ...@@ -333,7 +333,7 @@ public Task<Document> AddNamedTypeAsync(Solution solution, INamedTypeSymbol dest
{ {
return GetEditAsync( return GetEditAsync(
solution, destination, solution, destination,
(t, opts, ai, _) => AddNamedType(t, namedType, opts, ai, _), (t, opts, ai, ct) => AddNamedType(t, namedType, opts, ai, ct),
options, new[] { namedType }, options, new[] { namedType },
cancellationToken); cancellationToken);
} }
...@@ -358,7 +358,7 @@ public Task<Document> AddMethodAsync(Solution solution, INamedTypeSymbol destina ...@@ -358,7 +358,7 @@ public Task<Document> AddMethodAsync(Solution solution, INamedTypeSymbol destina
{ {
return GetEditAsync( return GetEditAsync(
solution, destination, solution, destination,
(t, opts, ai, _) => AddMethod(t, method, opts, ai), (t, opts, ai, ct) => AddMethod(t, method, opts, ai),
options, new[] { method }, cancellationToken); options, new[] { method }, cancellationToken);
} }
......
...@@ -15,7 +15,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration ...@@ -15,7 +15,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration
[namespace] As INamespaceSymbol, [namespace] As INamespaceSymbol,
options As CodeGenerationOptions, options As CodeGenerationOptions,
availableIndices As IList(Of Boolean), availableIndices As IList(Of Boolean),
cancellationToken As CancellationToken) As CompilationUnitSyntax cancellationToken As CancellationToken) As CompilationUnitSyntax
Dim declaration = GenerateNamespaceDeclaration(service, [namespace], options, cancellationToken) Dim declaration = GenerateNamespaceDeclaration(service, [namespace], options, cancellationToken)
If Not TypeOf declaration Is NamespaceBlockSyntax Then If Not TypeOf declaration Is NamespaceBlockSyntax Then
Throw New ArgumentException(VBWorkspaceResources.NamespaceCannotBeAdded) Throw New ArgumentException(VBWorkspaceResources.NamespaceCannotBeAdded)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册