-
Notifications
You must be signed in to change notification settings - Fork 234
/
Copy pathDebugAdapterClientExtensions.cs
34 lines (30 loc) · 1.12 KB
/
DebugAdapterClientExtensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.Threading.Tasks;
using Microsoft.PowerShell.EditorServices.Handlers;
using OmniSharp.Extensions.DebugAdapter.Client;
using OmniSharp.Extensions.DebugAdapter.Protocol.Requests;
namespace PowerShellEditorServices.Test.E2E
{
public static class DebugAdapterClientExtensions
{
public static async Task LaunchScript(this DebugAdapterClient debugAdapterClient, string script, TaskCompletionSource<object> started)
{
LaunchResponse launchResponse = await debugAdapterClient.Launch(
new PsesLaunchRequestArguments
{
NoDebug = false,
Script = script,
Cwd = "",
CreateTemporaryIntegratedConsole = false
});
if (launchResponse is null)
{
throw new Exception("Launch response was null.");
}
// This will check to see if we received the Initialized event from the server.
await started.Task;
}
}
}