Skip to content

Commit 456031c

Browse files
The entire Debug Adapter moved over... (#1043)
* initial non-working dap * working launch but not attach * working attach handler * update namespaces * Disconnect support and handling of JsonRpcServer teardown * Add foundation for debug tests - stdio and fixures * all handlers * remote file manager working * rest of debug adapter * use actual release * Apply suggestions from code review Co-Authored-By: Robert Holt <[email protected]>
1 parent e790f8c commit 456031c

File tree

51 files changed

+4964
-331
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+4964
-331
lines changed

PowerShellEditorServices.build.ps1

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ $script:RequiredBuildAssets = @{
6464
'publish/OmniSharp.Extensions.JsonRpc.dll',
6565
'publish/OmniSharp.Extensions.LanguageProtocol.dll',
6666
'publish/OmniSharp.Extensions.LanguageServer.dll',
67+
'publish/OmniSharp.Extensions.DebugAdapter.dll',
68+
'publish/OmniSharp.Extensions.DebugAdapter.Server.dll',
6769
'publish/runtimes/linux-64/native/libdisablekeyecho.so',
6870
'publish/runtimes/osx-64/native/libdisablekeyecho.dylib',
6971
'publish/Serilog.dll',

docs/api/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ the PowerShell debugger.
2020
Use the @Microsoft.PowerShell.EditorServices.Console.ConsoleService to provide interactive
2121
console support in the user's editor.
2222

23-
Use the @Microsoft.PowerShell.EditorServices.Extensions.ExtensionService to allow
23+
Use the @Microsoft.PowerShell.EditorServices.Engine.Services.ExtensionService to allow
2424
the user to extend the host editor with new capabilities using PowerShell code.
2525

2626
The core of all the services is the @Microsoft.PowerShell.EditorServices.PowerShellContext
2727
class. This class manages a session's runspace and handles script and command
28-
execution no matter what state the runspace is in.
28+
execution no matter what state the runspace is in.

docs/guide/extensions.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ uses PowerShell Editor Services.
99
### Introducing `$psEditor`
1010

1111
The entry point for the PowerShell Editor Services extensibility model is the `$psEditor`
12-
object of the type @Microsoft.PowerShell.EditorServices.Extensions.EditorObject. For
12+
object of the type @Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorObject. For
1313
those familiar with the PowerShell ISE's `$psISE` object, the `$psEditor` object is very
1414
similar. The primary difference is that this model has been generalized to work against
1515
any editor which leverages PowerShell Editor Services for its PowerShell editing experience.
@@ -19,7 +19,7 @@ any editor which leverages PowerShell Editor Services for its PowerShell editing
1919
> please file an issue on our GitHub page.
2020
2121
This object gives access to all of the high-level services in the current
22-
editing session. For example, the @Microsoft.PowerShell.EditorServices.Extensions.EditorObject.Workspace
22+
editing session. For example, the @Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorObject.Workspace
2323
property gives access to the editor's workspace, allowing you to create or open files
2424
in the editor.
2525

@@ -79,17 +79,17 @@ Register-EditorCommand `
7979
-ScriptBlock { Write-Output "My command's script block was invoked!" }
8080
```
8181

82-
### The @Microsoft.PowerShell.EditorServices.Extensions.EditorContext parameter
82+
### The @Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorContext parameter
8383

8484
Your function, cmdlet, or ScriptBlock can optionally accept a single parameter
85-
of type @Microsoft.PowerShell.EditorServices.Extensions.EditorContext which provides
85+
of type @Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorContext which provides
8686
information about the state of the host editor at the time your command was
8787
invoked. With this object you can easily perform operations like manipulatin the
8888
state of the user's active editor buffer or changing the current selection.
8989

9090
The usual convention is that a `$context` parameter is added to your editor
9191
command's function. For now it is recommended that you fully specify the
92-
type of the @Microsoft.PowerShell.EditorServices.Extensions.EditorContext object
92+
type of the @Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorContext object
9393
so that you get full IntelliSense on your context parameter.
9494

9595
Here is an example of using the `$context` parameter:
@@ -99,7 +99,7 @@ Register-EditorCommand `
9999
-Name "MyModule.MyEditorCommandWithContext" `
100100
-DisplayName "My command with context usage" `
101101
-ScriptBlock {
102-
param([Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context)
102+
param([Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorContext]$context)
103103
Write-Output "The user's cursor is on line $($context.CursorPosition.Line)!"
104104
}
105105
```
@@ -165,4 +165,4 @@ in that editor starts up.
165165
> NOTE: In the future we plan to provide an easy way for the user to opt-in
166166
> to the automatic loading of any editor command modules that they've installed
167167
> from the PowerShell Gallery. If this interests you, please let us know on
168-
> [this GitHub issue](https://github.com/PowerShell/PowerShellEditorServices/issues/215).
168+
> [this GitHub issue](https://github.com/PowerShell/PowerShellEditorServices/issues/215).

global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "2.1.602"
3+
"version": "2.1.801"
44
}
55
}

module/PowerShellEditorServices.VSCode/PowerShellEditorServices.VSCode.psm1

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.VSCode.dll"
77

8-
if ($psEditor -is [Microsoft.PowerShell.EditorServices.Extensions.EditorObject]) {
8+
if ($psEditor -is [Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorObject]) {
99
[Microsoft.PowerShell.EditorServices.VSCode.ComponentRegistration]::Register($psEditor.Components)
1010
}
1111
else {

module/PowerShellEditorServices.VSCode/Public/HtmlContentView/New-VSCodeHtmlContentView.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function New-VSCodeHtmlContentView {
4141
)
4242

4343
process {
44-
if ($psEditor -is [Microsoft.PowerShell.EditorServices.Extensions.EditorObject]) {
44+
if ($psEditor -is [Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorObject]) {
4545
$viewFeature = $psEditor.Components.Get([Microsoft.PowerShell.EditorServices.VSCode.CustomViews.IHtmlContentViews])
4646
$view = $viewFeature.CreateHtmlContentViewAsync($Title).Result
4747

module/PowerShellEditorServices/Commands/Private/BuiltInCommands.ps1

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Register-EditorCommand `
33
-DisplayName 'Open Editor Profile' `
44
-SuppressOutput `
55
-ScriptBlock {
6-
param([Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context)
6+
param([Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorContext]$context)
77
If (!(Test-Path -Path $Profile)) { New-Item -Path $Profile -ItemType File }
88
$psEditor.Workspace.OpenFile($Profile)
99
}
@@ -13,18 +13,18 @@ Register-EditorCommand `
1313
-DisplayName 'Open Profile from List (Current User)' `
1414
-SuppressOutput `
1515
-ScriptBlock {
16-
param([Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context)
17-
18-
$Current = Split-Path -Path $profile -Leaf
16+
param([Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorContext]$context)
17+
18+
$Current = Split-Path -Path $profile -Leaf
1919
$List = @($Current,'Microsoft.VSCode_profile.ps1','Microsoft.PowerShell_profile.ps1','Microsoft.PowerShellISE_profile.ps1','Profile.ps1') | Select-Object -Unique
2020
$Choices = [System.Management.Automation.Host.ChoiceDescription[]] @($List)
2121
$Selection = $host.ui.PromptForChoice('Please Select a Profile', '(Current User)', $choices,'0')
2222
$Name = $List[$Selection]
23-
23+
2424
$ProfileDir = Split-Path $Profile -Parent
2525
$ProfileName = Join-Path -Path $ProfileDir -ChildPath $Name
26-
26+
2727
If (!(Test-Path -Path $ProfileName)) { New-Item -Path $ProfileName -ItemType File }
28-
28+
2929
$psEditor.Workspace.OpenFile($ProfileName)
30-
}
30+
}

module/PowerShellEditorServices/Commands/Public/CmdletInterface.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function Register-EditorCommand {
4747
$commandArgs += $Function
4848
}
4949

50-
$editorCommand = New-Object Microsoft.PowerShell.EditorServices.Extensions.EditorCommand -ArgumentList $commandArgs
50+
$editorCommand = New-Object Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorCommand -ArgumentList $commandArgs
5151
if ($psEditor.RegisterCommand($editorCommand))
5252
{
5353
Write-Verbose "Registered new command '$Name'"

module/PowerShellEditorServices/Commands/Public/Import-EditorCommand.ps1

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function Import-EditorCommand {
77
<#
88
.EXTERNALHELP ..\PowerShellEditorServices.Commands-help.xml
99
#>
10-
[OutputType([Microsoft.PowerShell.EditorServices.Extensions.EditorCommand])]
10+
[OutputType([Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorCommand])]
1111
[CmdletBinding(DefaultParameterSetName='ByCommand')]
1212
param(
1313
[Parameter(Position=0,
@@ -75,7 +75,7 @@ function Import-EditorCommand {
7575
$commands = $Command | Get-Command -ErrorAction SilentlyContinue
7676
}
7777
}
78-
$attributeType = [Microsoft.PowerShell.EditorServices.Extensions.EditorCommandAttribute]
78+
$attributeType = [Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorCommandAttribute]
7979
foreach ($aCommand in $commands) {
8080
# Get the attribute from our command to get name info.
8181
$details = $aCommand.ScriptBlock.Attributes | Where-Object TypeId -eq $attributeType
@@ -99,7 +99,7 @@ function Import-EditorCommand {
9999
}
100100
# Check for a context parameter.
101101
$contextParameter = $aCommand.Parameters.Values |
102-
Where-Object ParameterType -eq ([Microsoft.PowerShell.EditorServices.Extensions.EditorContext])
102+
Where-Object ParameterType -eq ([Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorContext])
103103

104104
# If one is found then add a named argument. Otherwise call the command directly.
105105
if ($contextParameter) {
@@ -109,7 +109,7 @@ function Import-EditorCommand {
109109
$scriptBlock = [scriptblock]::Create($aCommand.Name)
110110
}
111111

112-
$editorCommand = New-Object Microsoft.PowerShell.EditorServices.Extensions.EditorCommand @(
112+
$editorCommand = New-Object Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorCommand @(
113113
<# commandName: #> $details.Name,
114114
<# displayName: #> $details.DisplayName,
115115
<# suppressOutput: #> $details.SuppressOutput,

module/docs/Import-EditorCommand.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The Import-EditorCommand function will search the specified module for functions
3030

3131
Alternatively, you can specify command info objects (like those from the Get-Command cmdlet) to be processed directly.
3232

33-
To tag a command as an editor command, attach the attribute 'Microsoft.PowerShell.EditorServices.Extensions.EditorCommandAttribute' to the function like you would with 'CmdletBindingAttribute'. The attribute accepts the named parameters 'Name', 'DisplayName', and 'SuppressOutput'.
33+
To tag a command as an editor command, attach the attribute 'Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorCommandAttribute' to the function like you would with 'CmdletBindingAttribute'. The attribute accepts the named parameters 'Name', 'DisplayName', and 'SuppressOutput'.
3434

3535
## EXAMPLES
3636

@@ -55,7 +55,7 @@ Registers all editor commands that contain "Editor" in the name and return all s
5555
```powershell
5656
function Invoke-MyEditorCommand {
5757
[CmdletBinding()]
58-
[Microsoft.PowerShell.EditorServices.Extensions.EditorCommand(DisplayName='My Command', SuppressOutput)]
58+
[Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorCommand(DisplayName='My Command', SuppressOutput)]
5959
param()
6060
end {
6161
ConvertTo-ScriptExtent -Offset 0 | Set-ScriptExtent -Text 'My Command!'
@@ -145,7 +145,7 @@ You can pass commands to register as editor commands.
145145
146146
## OUTPUTS
147147
148-
### Microsoft.PowerShell.EditorServices.Extensions.EditorCommand
148+
### Microsoft.PowerShell.EditorServices.Engine.Services.PowerShellContext.EditorCommand
149149
150150
If the "PassThru" parameter is specified editor commands that were successfully registered
151151
will be returned. This function does not output to the pipeline otherwise.

0 commit comments

Comments
 (0)