Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable integration tests #25151

Merged
merged 9 commits into from
Mar 3, 2018
Prev Previous commit
Next Next commit
Improve the deadlock mitigation in ShowLightBulb by posting the View.…
…ShowSmartTags command
  • Loading branch information
sharwell committed Mar 3, 2018
commit 00a1c0a91327ced1bb80b891c2fc9df0f5660474
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Editor.Implementation.Suggestions;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Operations;
using Microsoft.VisualStudio.Text.Tagging;
using OLECMDEXECOPT = Microsoft.VisualStudio.OLE.Interop.OLECMDEXECOPT;

namespace Microsoft.VisualStudio.IntegrationTest.Utilities.InProcess
{
Expand Down Expand Up @@ -58,7 +60,19 @@ public string GetCurrentCompletionItem()
});

public void ShowLightBulb()
=> InvokeOnUIThread(() => GetDTE().ExecuteCommand(WellKnownCommandNames.View_ShowSmartTag));
{
InvokeOnUIThread(() =>
{
var shell = GetGlobalService<SVsUIShell, IVsUIShell>();
var cmdGroup = typeof(VSConstants.VSStd2KCmdID).GUID;
var cmdExecOpt = OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER;

const VSConstants.VSStd2KCmdID ECMD_SMARTTASKS = (VSConstants.VSStd2KCmdID)147;
var cmdID = ECMD_SMARTTASKS;
object obj = null;
shell.PostExecCommand(cmdGroup, (uint)cmdID, (uint)cmdExecOpt, ref obj);
});
}

public void WaitForLightBulbSession()
=> ExecuteOnActiveView(view =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ public void CodeActions(
FixAllScope? fixAllScope = null,
bool blockUntilComplete = true)
{
// Wait for the light bulb to appear before forcing it to drop down, otherwise the UI thread can
// deadlock in SuggestedActionsSource.
_textViewWindow.WaitForLightBulbSession();
_textViewWindow.ShowLightBulb();
_textViewWindow.WaitForLightBulbSession();

Expand Down