public void SetUp() { logSpy = new LogSpy(); logSpy.Attach(); var taskContext = new JoinableTaskContext(); shellMock = Substitute.For <ILLDBShell>(); commandWindowText = ""; commandWindowMock = Substitute.For <IVsCommandWindow>(); commandWindowMock.Print(Arg.Do <string>(x => commandWindowText += x)); serviceProviderMock = Substitute.For <IServiceProvider>(); yetiOptions = Substitute.For <OptionPageGrid>(); var yetiService = new YetiVSIService(yetiOptions); serviceProviderMock.GetService(typeof(YetiVSIService)).Returns(yetiService); serviceProviderMock.GetService(typeof(SLLDBShell)).Returns(shellMock); serviceProviderMock.GetService(typeof(SVsCommandWindow)).Returns(commandWindowMock); menuCommandService = new OleMenuCommandService(serviceProviderMock); serviceProviderMock.GetService(typeof(IMenuCommandService)).Returns(menuCommandService); LLDBShellCommandTarget.Register(taskContext, serviceProviderMock); }
private bool OpenSolutionResource(SolutionFile sr, string editor) { if (sr == null) { return(false); } if (string.IsNullOrEmpty(sr.FilePath)) { return(false); } IVsCommandWindow cmw = (IVsCommandWindow)GetService(typeof(SVsCommandWindow)); if (cmw == null) { return(false); } if (editor == null) { cmw.ExecuteCommand("of \"" + sr.FilePath + "\""); } else if (editor.Length == 0) { cmw.ExecuteCommand("of \"" + sr.FilePath + "\" /editor"); } else { cmw.ExecuteCommand("of \"" + sr.FilePath + "\" /e:\"" + editor + "\""); } return(true); }
public void SetUp() { logSpy = new LogSpy(); logSpy.Attach(); taskContext = new JoinableTaskContext(); returnObjectMock = Substitute.For <SbCommandReturnObject>(); returnObjectMock.GetDescription().Returns(COMMAND_DESCRIPTION); commandInterpreterMock = Substitute.For <SbCommandInterpreter>(); commandInterpreterMock.WhenForAnyArgs(x => x.HandleCommand(DUMMY_COMMAND, out returnObjectMock)).Do(x => x[1] = returnObjectMock); debuggerMock = Substitute.For <SbDebugger>(); debuggerMock.GetCommandInterpreter().Returns(commandInterpreterMock); commandWindowText = ""; commandWindowMock = Substitute.For <IVsCommandWindow>(); commandWindowMock.Print(Arg.Do <string>(x => commandWindowText += x)); commandWindowWriter = new CommandWindowWriter(taskContext, commandWindowMock); shell = new YetiVSI.LLDBShell.LLDBShell(taskContext, commandWindowWriter); shell.AddDebugger(debuggerMock); }
/// <summary> /// Finds a command by cannonical name. /// </summary> public async Task <CommandID?> FindCommandAsync(string name) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); IVsCommandWindow cw = await VS.Services.GetCommandWindowAsync(); int hr = cw.PrepareCommand(name, out Guid commandGroup, out uint commandId, out _, new PREPARECOMMANDRESULT[0]);
public override async Task LaunchAsync(DebugLaunchOptions launchOptions) { await base.LaunchAsync(launchOptions); IVsCommandWindow commandWnd = (IVsCommandWindow)ServiceProvider.GetService(typeof(SVsCommandWindow)); commandWnd.ExecuteCommand("Tools.Alias gdb Debug.VRDebugExec"); }
public CommandWindowWriter(JoinableTaskContext taskContext, IVsCommandWindow commandWindow) { taskContext.ThrowIfNotOnMainThread(); this.taskContext = taskContext; this.commandWindow = commandWindow; }
public void Launch(string path, string args, string workingDir) { PipeLaunchOptions options = BuildLaunchOptions(path, args, workingDir); VsDebugTargetInfo4 target = new VsDebugTargetInfo4 { dlo = (uint)DEBUG_LAUNCH_OPERATION.DLO_CreateProcess, bstrExe = path, guidLaunchDebugEngine = new Guid(EngineConstants.EngineId), bstrOptions = ToXmlString(options) }; env.LaunchVsDebugger(target); IVsCommandWindow commandWnd = env.GetService <SVsCommandWindow, IVsCommandWindow>(); commandWnd.ExecuteCommand("Tools.Alias gdb Debug.VRDebugExec"); }
DebuggerOptionsCommand(JoinableTaskContext taskContext, YetiVSIService vsiService, IDebugEngineManager debugEngineManager, IVsCommandWindow commandWindow, IMenuCommandService menuCommandService) { taskContext.ThrowIfNotOnMainThread(); this.taskContext = taskContext; this.debugEngineManager = debugEngineManager; this.vsiService = vsiService; commandWindowWriter = new CommandWindowWriter(taskContext, commandWindow); var menuCommand = new OleMenuCommand(HandleCommand, new CommandID(YetiConstants.CommandSetGuid, PkgCmdID.cmdidDebuggerOptionsCommand)); // Accept any parameter value. menuCommand.ParametersDescription = "$"; menuCommandService?.AddCommand(menuCommand); }
public void SetUp() { logSpy = new LogSpy(); logSpy.Attach(); var taskContext = new JoinableTaskContext(); commandWindowText = ""; commandWindowMock = Substitute.For <IVsCommandWindow>(); commandWindowMock.Print(Arg.Do <string>(x => commandWindowText += x)); serviceProviderMock = Substitute.For <IServiceProvider>(); yetiService = new YetiVSIService(null); serviceProviderMock.GetService(typeof(YetiVSIService)).Returns(yetiService); serviceProviderMock.GetService(typeof(SVsCommandWindow)).Returns(commandWindowMock); debugEngineCommandsMock = Substitute.For <IDebugEngineCommands>(); // (internal): This needs to be a member variable since debugEngineManager tracks it // by weak reference only!. debugEngineMock = Substitute.For <IGgpDebugEngine>(); debugEngineMock.DebugEngineCommands.Returns(debugEngineCommandsMock); debugEngineManager = new DebugEngineManager(); debugEngineManager.AddDebugEngine(debugEngineMock); serviceProviderMock.GetService(typeof(SDebugEngineManager)) .Returns(debugEngineManager); menuCommandService = new OleMenuCommandService(serviceProviderMock); serviceProviderMock.GetService(typeof(IMenuCommandService)) .Returns(menuCommandService); DebuggerOptionsCommand.Register(taskContext, serviceProviderMock); }