From b39b95e6b115ab41e6491c0185d951172fa73124 Mon Sep 17 00:00:00 2001 From: JieCarolHu Date: Wed, 7 Mar 2018 17:48:16 -0800 Subject: [PATCH] rename QuickInfoCommandHandlerAndSourceProvider to QuickInfoSourceProvider --- .../AbstractIntelliSenseCommandHandler.cs | 9 +++++---- .../CommandHandlers/IntelliSenseCommandHandler.cs | 5 +++-- .../PredefinedQuickInfoSourceProviderNames.cs | 9 --------- .../QuickInfo/QuickInfoSourceProvider .cs} | 13 +++---------- .../QuickInfoSourceProvider.QuickInfoSource.cs} | 14 +++++++------- .../InteractiveIntelliSenseCommandHandler.cs | 5 +++-- 6 files changed, 21 insertions(+), 34 deletions(-) delete mode 100644 src/EditorFeatures/Core/Extensibility/QuickInfo/PredefinedQuickInfoSourceProviderNames.cs rename src/EditorFeatures/Core/{CommandHandlers/QuickInfoCommandHandlerAndSourceProvider.cs => Implementation/IntelliSense/QuickInfo/QuickInfoSourceProvider .cs} (79%) rename src/EditorFeatures/Core/{CommandHandlers/QuickInfoCommandHandlerAndSourceProvider.QuickInfoSource.cs => Implementation/IntelliSense/QuickInfo/QuickInfoSourceProvider.QuickInfoSource.cs} (71%) diff --git a/src/EditorFeatures/Core/CommandHandlers/AbstractIntelliSenseCommandHandler.cs b/src/EditorFeatures/Core/CommandHandlers/AbstractIntelliSenseCommandHandler.cs index bb3ddea75fa..4a74ab6500d 100644 --- a/src/EditorFeatures/Core/CommandHandlers/AbstractIntelliSenseCommandHandler.cs +++ b/src/EditorFeatures/Core/CommandHandlers/AbstractIntelliSenseCommandHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo; using Microsoft.VisualStudio.Commanding; using Microsoft.VisualStudio.Text.Editor.Commanding.Commands; using VSCommanding = Microsoft.VisualStudio.Commanding; @@ -30,18 +31,18 @@ internal abstract class AbstractIntelliSenseCommandHandler : { private readonly CompletionCommandHandler _completionCommandHandler; private readonly SignatureHelpCommandHandler _signatureHelpCommandHandler; - private readonly QuickInfoCommandHandlerAndSourceProvider _quickInfoCommandHandler; + private readonly QuickInfoSourceProvider _quickInfoSourceProvider; public string DisplayName => EditorFeaturesResources.IntelliSense; protected AbstractIntelliSenseCommandHandler( CompletionCommandHandler completionCommandHandler, SignatureHelpCommandHandler signatureHelpCommandHandler, - QuickInfoCommandHandlerAndSourceProvider quickInfoCommandHandler) + QuickInfoSourceProvider quickInfoSourceProvider) { _completionCommandHandler = completionCommandHandler; _signatureHelpCommandHandler = signatureHelpCommandHandler; - _quickInfoCommandHandler = quickInfoCommandHandler; + _quickInfoSourceProvider = quickInfoSourceProvider; } public VSCommanding.CommandState GetCommandState(EscapeKeyCommandArgs args, Func nextHandler) @@ -63,7 +64,7 @@ public void ExecuteCommand(EscapeKeyCommandArgs args, Action nextHandler, Comman { if ((_completionCommandHandler != null && _completionCommandHandler.TryHandleEscapeKey(args)) || (_signatureHelpCommandHandler != null && _signatureHelpCommandHandler.TryHandleEscapeKey(args)) || - (_quickInfoCommandHandler != null && _quickInfoCommandHandler.TryHandleEscapeKey(args))) + (_quickInfoSourceProvider != null && _quickInfoSourceProvider.TryHandleEscapeKey(args))) { return; } diff --git a/src/EditorFeatures/Core/CommandHandlers/IntelliSenseCommandHandler.cs b/src/EditorFeatures/Core/CommandHandlers/IntelliSenseCommandHandler.cs index de343c25320..60126606f73 100644 --- a/src/EditorFeatures/Core/CommandHandlers/IntelliSenseCommandHandler.cs +++ b/src/EditorFeatures/Core/CommandHandlers/IntelliSenseCommandHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.ComponentModel.Composition; +using Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo; using Microsoft.VisualStudio.Utilities; using VSCommanding = Microsoft.VisualStudio.Commanding; @@ -15,10 +16,10 @@ internal sealed class IntelliSenseCommandHandler : AbstractIntelliSenseCommandHa public IntelliSenseCommandHandler( CompletionCommandHandler completionCommandHandler, SignatureHelpCommandHandler signatureHelpCommandHandler, - QuickInfoCommandHandlerAndSourceProvider quickInfoCommandHandler) + QuickInfoSourceProvider quickInfoSourceProvider) : base(completionCommandHandler, signatureHelpCommandHandler, - quickInfoCommandHandler) + quickInfoSourceProvider) { } } diff --git a/src/EditorFeatures/Core/Extensibility/QuickInfo/PredefinedQuickInfoSourceProviderNames.cs b/src/EditorFeatures/Core/Extensibility/QuickInfo/PredefinedQuickInfoSourceProviderNames.cs deleted file mode 100644 index 9cd67e58a1a..00000000000 --- a/src/EditorFeatures/Core/Extensibility/QuickInfo/PredefinedQuickInfoSourceProviderNames.cs +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.CodeAnalysis.Editor -{ - internal static class PredefinedQuickInfoSourceProviderNames - { - public const string EventHookup = "Event Hookup QuickInfo Source"; - } -} diff --git a/src/EditorFeatures/Core/CommandHandlers/QuickInfoCommandHandlerAndSourceProvider.cs b/src/EditorFeatures/Core/Implementation/IntelliSense/QuickInfo/QuickInfoSourceProvider .cs similarity index 79% rename from src/EditorFeatures/Core/CommandHandlers/QuickInfoCommandHandlerAndSourceProvider.cs rename to src/EditorFeatures/Core/Implementation/IntelliSense/QuickInfo/QuickInfoSourceProvider .cs index a55b3694b9f..9e96ab21a4f 100644 --- a/src/EditorFeatures/Core/CommandHandlers/QuickInfoCommandHandlerAndSourceProvider.cs +++ b/src/EditorFeatures/Core/Implementation/IntelliSense/QuickInfo/QuickInfoSourceProvider .cs @@ -1,29 +1,22 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; using System.ComponentModel.Composition; -using System.Linq; -using Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.CodeAnalysis.Editor.Shared.Options; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; -using Microsoft.CodeAnalysis.Shared.TestHooks; -using Microsoft.CodeAnalysis.Shared.Utilities; using Microsoft.VisualStudio.Language.Intellisense; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor.Commanding; using Microsoft.VisualStudio.Text.Editor.Commanding.Commands; using Microsoft.VisualStudio.Utilities; -namespace Microsoft.CodeAnalysis.Editor.CommandHandlers +namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo { - [Export] - [Order(After = PredefinedQuickInfoPresenterNames.RoslynQuickInfoPresenter)] + [Export] [ContentType(ContentTypeNames.RoslynContentType)] [Export(typeof(IAsyncQuickInfoSourceProvider))] [Name("RoslynQuickInfoProvider")] - internal partial class QuickInfoCommandHandlerAndSourceProvider : + internal partial class QuickInfoSourceProvider : ForegroundThreadAffinitizedObject, IAsyncQuickInfoSourceProvider { diff --git a/src/EditorFeatures/Core/CommandHandlers/QuickInfoCommandHandlerAndSourceProvider.QuickInfoSource.cs b/src/EditorFeatures/Core/Implementation/IntelliSense/QuickInfo/QuickInfoSourceProvider.QuickInfoSource.cs similarity index 71% rename from src/EditorFeatures/Core/CommandHandlers/QuickInfoCommandHandlerAndSourceProvider.QuickInfoSource.cs rename to src/EditorFeatures/Core/Implementation/IntelliSense/QuickInfo/QuickInfoSourceProvider.QuickInfoSource.cs index e1c6a43529a..a4d6e0c84c1 100644 --- a/src/EditorFeatures/Core/CommandHandlers/QuickInfoCommandHandlerAndSourceProvider.QuickInfoSource.cs +++ b/src/EditorFeatures/Core/Implementation/IntelliSense/QuickInfo/QuickInfoSourceProvider.QuickInfoSource.cs @@ -6,29 +6,29 @@ using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor.Commanding.Commands; -namespace Microsoft.CodeAnalysis.Editor.CommandHandlers +namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo { - internal partial class QuickInfoCommandHandlerAndSourceProvider + internal partial class QuickInfoSourceProvider { private class QuickInfoSource : IAsyncQuickInfoSource { - private readonly QuickInfoCommandHandlerAndSourceProvider _commandHandler; + private readonly QuickInfoSourceProvider _quickInfoSourceProvider; private readonly ITextBuffer _subjectBuffer; - public QuickInfoSource(QuickInfoCommandHandlerAndSourceProvider commandHandler, ITextBuffer subjectBuffer) + public QuickInfoSource(QuickInfoSourceProvider quickInfoSourceProvider, ITextBuffer subjectBuffer) { - _commandHandler = commandHandler; + _quickInfoSourceProvider = quickInfoSourceProvider; _subjectBuffer = subjectBuffer; } public Task GetQuickInfoItemAsync(IAsyncQuickInfoSession session, CancellationToken cancellationToken) { var triggerPoint = session.GetTriggerPoint(_subjectBuffer.CurrentSnapshot); - if (triggerPoint != null && triggerPoint.HasValue) + if (triggerPoint.HasValue) { var textView = session.TextView; var args = new InvokeQuickInfoCommandArgs(textView, _subjectBuffer); - if (_commandHandler.TryGetController(args, out var controller)) + if (_quickInfoSourceProvider.TryGetController(args, out var controller)) { return controller.GetQuickInfoItemAsync(triggerPoint.Value, cancellationToken); } diff --git a/src/Interactive/EditorFeatures/Core/CommandHandlers/InteractiveIntelliSenseCommandHandler.cs b/src/Interactive/EditorFeatures/Core/CommandHandlers/InteractiveIntelliSenseCommandHandler.cs index cb4bc4368c3..1f4a29b12db 100644 --- a/src/Interactive/EditorFeatures/Core/CommandHandlers/InteractiveIntelliSenseCommandHandler.cs +++ b/src/Interactive/EditorFeatures/Core/CommandHandlers/InteractiveIntelliSenseCommandHandler.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.ComponentModel.Composition; +using Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo; using Microsoft.VisualStudio.InteractiveWindow.Commands; using Microsoft.VisualStudio.Utilities; using VSCommanding = Microsoft.VisualStudio.Commanding; @@ -16,10 +17,10 @@ internal sealed class InteractiveIntelliSenseCommandHandler : AbstractIntelliSen public InteractiveIntelliSenseCommandHandler( CompletionCommandHandler completionCommandHandler, SignatureHelpCommandHandler signatureHelpCommandHandler, - QuickInfoCommandHandlerAndSourceProvider quickInfoCommandHandler) + QuickInfoSourceProvider quickInfoSourceProvider) : base(completionCommandHandler, signatureHelpCommandHandler, - quickInfoCommandHandler) + quickInfoSourceProvider) { } } -- GitLab